diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-06-02 15:06:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-06-02 15:06:27 -0400 |
commit | b939c51445f0542e80a8f910014c418d04b5de6e (patch) | |
tree | a127ad46bec81f91a52bc2533087b9bb797c2d4f | |
parent | 65d03328aace31043be98f807f6e20332cdb19c8 (diff) | |
parent | cb7cf772d83d2d4e6995c5bb9e0fb59aea8f7080 (diff) |
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
-rw-r--r-- | arch/arm64/include/asm/acpi.h | 6 | ||||
-rw-r--r-- | arch/arm64/kernel/pci.c | 4 | ||||
-rw-r--r-- | drivers/perf/arm_pmu_acpi.c | 11 |
3 files changed, 17 insertions, 4 deletions
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index 0e99978da3f0..59cca1d6ec54 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h | |||
@@ -23,9 +23,9 @@ | |||
23 | #define ACPI_MADT_GICC_LENGTH \ | 23 | #define ACPI_MADT_GICC_LENGTH \ |
24 | (acpi_gbl_FADT.header.revision < 6 ? 76 : 80) | 24 | (acpi_gbl_FADT.header.revision < 6 ? 76 : 80) |
25 | 25 | ||
26 | #define BAD_MADT_GICC_ENTRY(entry, end) \ | 26 | #define BAD_MADT_GICC_ENTRY(entry, end) \ |
27 | (!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) || \ | 27 | (!(entry) || (entry)->header.length != ACPI_MADT_GICC_LENGTH || \ |
28 | (entry)->header.length != ACPI_MADT_GICC_LENGTH) | 28 | (unsigned long)(entry) + ACPI_MADT_GICC_LENGTH > (end)) |
29 | 29 | ||
30 | /* Basic configuration for ACPI */ | 30 | /* Basic configuration for ACPI */ |
31 | #ifdef CONFIG_ACPI | 31 | #ifdef CONFIG_ACPI |
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 4f0e3ebfea4b..c7e3e6387a49 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c | |||
@@ -191,8 +191,10 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) | |||
191 | return NULL; | 191 | return NULL; |
192 | 192 | ||
193 | root_ops = kzalloc_node(sizeof(*root_ops), GFP_KERNEL, node); | 193 | root_ops = kzalloc_node(sizeof(*root_ops), GFP_KERNEL, node); |
194 | if (!root_ops) | 194 | if (!root_ops) { |
195 | kfree(ri); | ||
195 | return NULL; | 196 | return NULL; |
197 | } | ||
196 | 198 | ||
197 | ri->cfg = pci_acpi_setup_ecam_mapping(root); | 199 | ri->cfg = pci_acpi_setup_ecam_mapping(root); |
198 | if (!ri->cfg) { | 200 | if (!ri->cfg) { |
diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c index 34c862f213c7..0a9b78705ee8 100644 --- a/drivers/perf/arm_pmu_acpi.c +++ b/drivers/perf/arm_pmu_acpi.c | |||
@@ -29,6 +29,17 @@ static int arm_pmu_acpi_register_irq(int cpu) | |||
29 | return -EINVAL; | 29 | return -EINVAL; |
30 | 30 | ||
31 | gsi = gicc->performance_interrupt; | 31 | 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 | |||
32 | if (gicc->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE) | 43 | if (gicc->flags & ACPI_MADT_PERFORMANCE_IRQ_MODE) |
33 | trigger = ACPI_EDGE_SENSITIVE; | 44 | trigger = ACPI_EDGE_SENSITIVE; |
34 | else | 45 | else |