Skip to content

Commit 2af9b20

Browse files
committed
Merge tag 'x86-urgent-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull misc x86 fixes from Ingo Molnar: - Fix a possible CPU hotplug deadlock bug caused by the new TSC synchronization code - Fix a legacy PIC discovery bug that results in device troubles on affected systems, such as non-working keybards, etc - Add a new Intel CPU model number to <asm/intel-family.h> * tag 'x86-urgent-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/tsc: Defer marking TSC unstable to a worker x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility x86/cpu: Add model number for Intel Arrow Lake mobile processor
2 parents e663ab6 + bd94d86 commit 2af9b20

File tree

5 files changed

+46
-9
lines changed

5 files changed

+46
-9
lines changed

Diff for: arch/x86/include/asm/i8259.h

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ struct legacy_pic {
6969
void (*make_irq)(unsigned int irq);
7070
};
7171

72+
void legacy_pic_pcat_compat(void);
73+
7274
extern struct legacy_pic *legacy_pic;
7375
extern struct legacy_pic null_legacy_pic;
7476

Diff for: arch/x86/include/asm/intel-family.h

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* _X - regular server parts
2828
* _D - micro server parts
2929
* _N,_P - other mobile parts
30+
* _H - premium mobile parts
3031
* _S - other client parts
3132
*
3233
* Historical OPTDIFFs:
@@ -124,6 +125,7 @@
124125
#define INTEL_FAM6_METEORLAKE 0xAC
125126
#define INTEL_FAM6_METEORLAKE_L 0xAA
126127

128+
#define INTEL_FAM6_ARROWLAKE_H 0xC5
127129
#define INTEL_FAM6_ARROWLAKE 0xC6
128130

129131
#define INTEL_FAM6_LUNARLAKE_M 0xBD

Diff for: arch/x86/kernel/acpi/boot.c

+3
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
148148
pr_debug("Local APIC address 0x%08x\n", madt->address);
149149
}
150150

151+
if (madt->flags & ACPI_MADT_PCAT_COMPAT)
152+
legacy_pic_pcat_compat();
153+
151154
/* ACPI 6.3 and newer support the online capable bit. */
152155
if (acpi_gbl_FADT.header.revision > 6 ||
153156
(acpi_gbl_FADT.header.revision == 6 &&

Diff for: arch/x86/kernel/i8259.c

+30-8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
*/
3333
static void init_8259A(int auto_eoi);
3434

35+
static bool pcat_compat __ro_after_init;
3536
static int i8259A_auto_eoi;
3637
DEFINE_RAW_SPINLOCK(i8259A_lock);
3738

@@ -299,15 +300,32 @@ static void unmask_8259A(void)
299300

300301
static int probe_8259A(void)
301302
{
303+
unsigned char new_val, probe_val = ~(1 << PIC_CASCADE_IR);
302304
unsigned long flags;
303-
unsigned char probe_val = ~(1 << PIC_CASCADE_IR);
304-
unsigned char new_val;
305+
306+
/*
307+
* If MADT has the PCAT_COMPAT flag set, then do not bother probing
308+
* for the PIC. Some BIOSes leave the PIC uninitialized and probing
309+
* fails.
310+
*
311+
* Right now this causes problems as quite some code depends on
312+
* nr_legacy_irqs() > 0 or has_legacy_pic() == true. This is silly
313+
* when the system has an IO/APIC because then PIC is not required
314+
* at all, except for really old machines where the timer interrupt
315+
* must be routed through the PIC. So just pretend that the PIC is
316+
* there and let legacy_pic->init() initialize it for nothing.
317+
*
318+
* Alternatively this could just try to initialize the PIC and
319+
* repeat the probe, but for cases where there is no PIC that's
320+
* just pointless.
321+
*/
322+
if (pcat_compat)
323+
return nr_legacy_irqs();
324+
305325
/*
306-
* Check to see if we have a PIC.
307-
* Mask all except the cascade and read
308-
* back the value we just wrote. If we don't
309-
* have a PIC, we will read 0xff as opposed to the
310-
* value we wrote.
326+
* Check to see if we have a PIC. Mask all except the cascade and
327+
* read back the value we just wrote. If we don't have a PIC, we
328+
* will read 0xff as opposed to the value we wrote.
311329
*/
312330
raw_spin_lock_irqsave(&i8259A_lock, flags);
313331

@@ -429,5 +447,9 @@ static int __init i8259A_init_ops(void)
429447

430448
return 0;
431449
}
432-
433450
device_initcall(i8259A_init_ops);
451+
452+
void __init legacy_pic_pcat_compat(void)
453+
{
454+
pcat_compat = true;
455+
}

Diff for: arch/x86/kernel/tsc_sync.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* ( The serial nature of the boot logic and the CPU hotplug lock
1616
* protects against more than 2 CPUs entering this code. )
1717
*/
18+
#include <linux/workqueue.h>
1819
#include <linux/topology.h>
1920
#include <linux/spinlock.h>
2021
#include <linux/kernel.h>
@@ -342,6 +343,13 @@ static inline unsigned int loop_timeout(int cpu)
342343
return (cpumask_weight(topology_core_cpumask(cpu)) > 1) ? 2 : 20;
343344
}
344345

346+
static void tsc_sync_mark_tsc_unstable(struct work_struct *work)
347+
{
348+
mark_tsc_unstable("check_tsc_sync_source failed");
349+
}
350+
351+
static DECLARE_WORK(tsc_sync_work, tsc_sync_mark_tsc_unstable);
352+
345353
/*
346354
* The freshly booted CPU initiates this via an async SMP function call.
347355
*/
@@ -395,7 +403,7 @@ static void check_tsc_sync_source(void *__cpu)
395403
"turning off TSC clock.\n", max_warp);
396404
if (random_warps)
397405
pr_warn("TSC warped randomly between CPUs\n");
398-
mark_tsc_unstable("check_tsc_sync_source failed");
406+
schedule_work(&tsc_sync_work);
399407
}
400408

401409
/*

0 commit comments

Comments
 (0)