Skip to contentSkip to conversation

ACPI/irq: Apply ACPI_IRQCHIP_FWSPEC_ARG0 only for GSI domain

RFC In review Shanker Donthineni 1 participant 3 messages Apr 28, 2023 – Jun 23, 2023 ACPI

lore
Share & tools
lore
#0 lore raw

RFC 1/1 ACPI/irq: Apply ACPI_IRQCHIP_FWSPEC_ARG0 only for GSI domain

The implementation of the updated GICv3 parameter parsing code in pack_fwspec() is not compatible for the non-GSI drivers. It uses the offset 1 for hardware IRQ, but the unmodified GPIO driver expects the offset value to be 0, leading to a regression.

This patch applies new mapping to the GSI driver only to fix the issue.

---

 drivers/acpi/irq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/irq.c +3 -2
index d4225d0b45d0..3d7f0643ed14 100644
@@ -53,7 +53,8 @@ static void pack_fwspec(struct irq_fwspec *fwspec, u32 gsi, int trigger,
 {
 	unsigned int offset = 0;
 
-	if (IS_ENABLED(CONFIG_ACPI_IRQCHIP_FWSPEC_ARG0)) {
+	if (IS_ENABLED(CONFIG_ACPI_IRQCHIP_FWSPEC_ARG0) &&
+	    (fwspec->fwnode == acpi_get_gsi_domain_id(gsi))) {
 		fwspec->param[0] = ACPI_IRQCHIP_FWSPEC_ARG0;
 		offset = 1;
 	}
@@ -216,8 +217,8 @@ static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode,
 	ctx->rc = 0;
 	*ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable);
 
-	pack_fwspec(ctx->fwspec, hwirq, triggering, polarity);
 	ctx->fwspec->fwnode = fwnode;
+	pack_fwspec(ctx->fwspec, hwirq, triggering, polarity);
 }
 
 /**
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

Hi James

When the IRQ combining feature is enabled, the following modification becomes necessary. Without implementing this change. The MPAM feature is not working on NVIDIA platforms.

Please review the code and provide feedback.

Quoted 29 lines · Shanker Donthineni

The implementation of the updated GICv3 parameter parsing code in pack_fwspec() is not compatible for the non-GSI drivers. It uses the offset 1 for hardware IRQ, but the unmodified GPIO driver expects the offset value to be 0, leading to a regression.

This patch applies new mapping to the GSI driver only to fix the issue.

---

  drivers/acpi/irq.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/irq.c +2 -1
index d4225d0b45d0..3d7f0643ed14 100644
@@ -53,7 +53,8 @@ static void pack_fwspec(struct irq_fwspec *fwspec, u32 gsi, int trigger,
  {
  	unsigned int offset = 0;
 
-	if (IS_ENABLED(CONFIG_ACPI_IRQCHIP_FWSPEC_ARG0)) {
+	if (IS_ENABLED(CONFIG_ACPI_IRQCHIP_FWSPEC_ARG0) &&
+	    (fwspec->fwnode == acpi_get_gsi_domain_id(gsi))) {
  		fwspec->param[0] = ACPI_IRQCHIP_FWSPEC_ARG0;
  		offset = 1;
  	}

drivers/acpi/irq.c static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode, · line 224

Quoted 9 lines
drivers/acpi/irq.c +1 -1
@@ -216,8 +217,8 @@ static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode,
  	ctx->rc = 0;
  	*ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable);
 
-	pack_fwspec(ctx->fwspec, hwirq, triggering, polarity);
  	ctx->fwspec->fwnode = fwnode;
+	pack_fwspec(ctx->fwspec, hwirq, triggering, polarity);
  }
 
  /**

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw

Hi James,

The usage of an uninitialized variable in the PPTT code has resulted in another problem. The MPAM driver probe fails when the variable "num_levels" contains a random value. The code modification provided below resolves the issue. Please review it.

$ git diff drivers/acpi/pptt.c
drivers/acpi/pptt.c +4 -0
index 200a5f806d89..773334379fa4 100644
@@ -1003,6 +1003,8 @@ int find_acpi_cache_level_from_id(u32 cache_id)
                cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
                if (!cpu_node)
                        break;
+
+               num_levels = 0;
                acpi_count_levels(table, cpu_node, &num_levels, NULL);
 
                for (level = 0; level <= num_levels; level++) {
@@ -1073,6 +1075,8 @@ int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id, cpumask_t *cpus)
                cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
                if (!cpu_node)
                        break;
+
+               num_levels = 0;
                acpi_count_levels(table, cpu_node, &num_levels, NULL);
 
                for (level = 0; level <= num_levels; level++) {

-Shanker

Quoted 37 lines · Shanker Donthineni

Hi James

When the IRQ combining feature is enabled, the following modification becomes necessary. Without implementing this change. The MPAM feature is not working on NVIDIA platforms.

Please review the code and provide feedback.

Quoted 27 lines · Shanker Donthineni

The implementation of the updated GICv3 parameter parsing code in pack_fwspec() is not compatible for the non-GSI drivers. It uses the offset 1 for hardware IRQ, but the unmodified GPIO driver expects the offset value to be 0, leading to a regression.

This patch applies new mapping to the GSI driver only to fix the issue.

---

  drivers/acpi/irq.c | 5 +++--

  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/irq.c +2 -1
index d4225d0b45d0..3d7f0643ed14 100644
@@ -53,7 +53,8 @@ static void pack_fwspec(struct irq_fwspec *fwspec, u32 gsi, int trigger,
   {
       unsigned int offset = 0;
-    if (IS_ENABLED(CONFIG_ACPI_IRQCHIP_FWSPEC_ARG0)) {
+    if (IS_ENABLED(CONFIG_ACPI_IRQCHIP_FWSPEC_ARG0) &&
+        (fwspec->fwnode == acpi_get_gsi_domain_id(gsi))) {
           fwspec->param[0] = ACPI_IRQCHIP_FWSPEC_ARG0;
           offset = 1;
       }
Quoted 8 lines

drivers/acpi/irq.c static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode, · line 222

Quoted 8 lines
drivers/acpi/irq.c +1 -1
@@ -216,8 +217,8 @@ static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode,
       ctx->rc = 0;
       *ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable);
-    pack_fwspec(ctx->fwspec, hwirq, triggering, polarity);
       ctx->fwspec->fwnode = fwnode;
+    pack_fwspec(ctx->fwspec, hwirq, triggering, polarity);
   }
   /**

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel