Re: [PATCH V4 1/4] arm_pmu: acpi: Refactor arm_spe_acpi_register_device()

Anshuman Khandual
2023-08-11T08:44:30Z

On 8/8/23 13:52, Anshuman Khandual wrote:
> + /*
> + * Sanity check all the GICC tables for the same interrupt
> + * number. For now, only support homogeneous ACPI machines.
> + */
> + for_each_possible_cpu(cpu) {
> + struct acpi_madt_generic_interrupt *gicc;
> +
> + gicc = acpi_cpu_get_madt_gicc(cpu);
> + if (gicc->header.length < len)
> + return gsi ? -ENXIO : 0;
> +
> + this_gsi = parse_gsi(gicc);
> + if (!this_gsi)
> + return gsi ? -ENXIO : 0;
> +
> + this_hetid = find_acpi_cpu_topology_hetero_id(cpu);
> + if (!gsi) {
> + hetid = this_hetid;
> + gsi = this_gsi;
> + } else if (hetid != this_hetid || gsi != this_gsi) {
> + pr_warn("ACPI: %s: must be homogeneous\n", pdev->name);
> + return -ENXIO;
> + }
> + }

As discussed on the previous version i.e V3 thread, will move the
'this_gsi' check after parse_gsi(), inside if (!gsi) conditional
block. This will treat subsequent cpu parse_gsi()'s failure as a
mismatch thus triggering the pr_warn() message.

diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
index 845683ca7c64..6eae772d6298 100644
--- a/drivers/perf/arm_pmu_acpi.c
+++ b/drivers/perf/arm_pmu_acpi.c
@@ -98,11 +98,11 @@ arm_acpi_register_pmu_device(struct platform_device *pdev, u8 len,
return gsi ? -ENXIO : 0;

this_gsi = parse_gsi(gicc);
- if (!this_gsi)
- return gsi ? -ENXIO : 0;
-
this_hetid = find_acpi_cpu_topology_hetero_id(cpu);
if (!gsi) {
+ if (!this_gsi)
+ return 0;
+
hetid = this_hetid;
gsi = this_gsi;
} else if (hetid != this_hetid || gsi != this_gsi) {