Skip to content

Commit b939c51

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Catalin Marinas: "ACPI-related fixes for arm64: - GICC MADT entry validity check fix - Skip IRQ registration with pmu=off in an ACPI guest - struct acpi_pci_root_ops freeing on error path" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: ARM64/ACPI: Fix BAD_MADT_GICC_ENTRY() macro implementation drivers/perf: arm_pmu_acpi: avoid perf IRQ init when guest PMU is off ARM64: PCI: Fix struct acpi_pci_root_ops allocation failure path
2 parents 65d0332 + cb7cf77 commit b939c51

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

arch/arm64/include/asm/acpi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
#define ACPI_MADT_GICC_LENGTH \
2424
(acpi_gbl_FADT.header.revision < 6 ? 76 : 80)
2525

26-
#define BAD_MADT_GICC_ENTRY(entry, end) \
27-
(!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) || \
28-
(entry)->header.length != ACPI_MADT_GICC_LENGTH)
26+
#define BAD_MADT_GICC_ENTRY(entry, end) \
27+
(!(entry) || (entry)->header.length != ACPI_MADT_GICC_LENGTH || \
28+
(unsigned long)(entry) + ACPI_MADT_GICC_LENGTH > (end))
2929

3030
/* Basic configuration for ACPI */
3131
#ifdef CONFIG_ACPI

arch/arm64/kernel/pci.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
191191
return NULL;
192192

193193
root_ops = kzalloc_node(sizeof(*root_ops), GFP_KERNEL, node);
194-
if (!root_ops)
194+
if (!root_ops) {
195+
kfree(ri);
195196
return NULL;
197+
}
196198

197199
ri->cfg = pci_acpi_setup_ecam_mapping(root);
198200
if (!ri->cfg) {

drivers/perf/arm_pmu_acpi.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ static int arm_pmu_acpi_register_irq(int cpu)
2929
return -EINVAL;
3030

3131
gsi = gicc->performance_interrupt;
32+
33+
/*
34+
* Per the ACPI spec, the MADT cannot describe a PMU that doesn't
35+
* have an interrupt. QEMU advertises this by using a GSI of zero,
36+
* which is not known to be valid on any hardware despite being
37+
* valid per the spec. Take the pragmatic approach and reject a
38+
* GSI of zero for now.
39+
*/
40+
if (!gsi)
41+
return 0;
42+
3243
if (gicc->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE)
3344
trigger = ACPI_EDGE_SENSITIVE;
3445
else

0 commit comments

Comments
 (0)