Skip to contentSkip to conversation

RISC-V ACPI: Assorted fixes

PATCH Applied Sunil V L 5 participants 7 messages Jun 7, 2023 – Jun 20, 2023

Subsystems (3)
lore
Share & tools
lore

Sunil V L

author
#0 lore raw

v2 cover RISC-V ACPI: Assorted fixes

This series fixes couple of issues required to complete the previously merged basic ACPI support series.

1) Kernel test bot has found a new warning using the sparse tool. Though I believe this warning exists for other architectures also, I don't see an issue fixing this for RISC-V.

2) When sscofpmf extension is enabled, the perf driver tries to find out the root INTC domain to register the over flow interrupt handler. However, this function is DT based and needs to be enhanced to work on ACPI based systems.

Changes since v1:
1) Added "Fixes:" tag
2) Added RB tag from Conor

Sunil V L (2):
RISC-V: ACPI : Fix for usage of pointers in different address space RISC-V/perf: Use standard interface to get INTC domain

 arch/riscv/kernel/acpi.c     |  4 ++--
 drivers/perf/riscv_pmu_sbi.c | 17 ++---------------
 2 files changed, 4 insertions(+), 17 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/2 RISC-V: ACPI : Fix for usage of pointers in different address space

The arch specific __acpi_map_table can be wrapper around either early_memremap or early_ioremap. But early_memremap routine works with normal pointers whereas __acpi_map_table expects pointers in iomem address space. This causes kernel test bot to fail while using the sparse tool. Fix the issue by using early_ioremap and similar fix done for __acpi_unmap_table.

---
 arch/riscv/kernel/acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/acpi.c +2 -2
index df5a45a2eb93..5ee03ebab80e 100644
@@ -204,7 +204,7 @@ void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)
 	if (!size)
 		return NULL;
 
-	return early_memremap(phys, size);
+	return early_ioremap(phys, size);
 }
 
 void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
@@ -212,7 +212,7 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
 	if (!map || !size)
 		return;
 
-	early_memunmap(map, size);
+	early_iounmap(map, size);
 }
 
 void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v2 2/2 RISC-V/perf: Use standard interface to get INTC domain

In reply to Sunil V L

Currently the PMU driver is using DT based lookup to find the INTC node for sscofpmf extension. This will not work for ACPI based systems causing the driver to fail to register the PMU overflow interrupt handler.

Hence, change the code to use the standard interface to find the INTC node which works irrespective of DT or ACPI.

---
 drivers/perf/riscv_pmu_sbi.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/perf/riscv_pmu_sbi.c +2 -15
index 4f3ac296b3e2..0bc491252a44 100644
@@ -739,7 +739,6 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde
 {
 	int ret;
 	struct cpu_hw_events __percpu *hw_events = pmu->hw_events;
-	struct device_node *cpu, *child;
 	struct irq_domain *domain = NULL;
 
 	if (riscv_isa_extension_available(NULL, SSCOFPMF)) {
@@ -756,20 +755,8 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde
 	if (!riscv_pmu_use_irq)
 		return -EOPNOTSUPP;
 
-	for_each_of_cpu_node(cpu) {
-		child = of_get_compatible_child(cpu, "riscv,cpu-intc");
-		if (!child) {
-			pr_err("Failed to find INTC node\n");
-			of_node_put(cpu);
-			return -ENODEV;
-		}
-		domain = irq_find_host(child);
-		of_node_put(child);
-		if (domain) {
-			of_node_put(cpu);
-			break;
-		}
-	}
+	domain = irq_find_matching_fwnode(riscv_get_intc_hwnode(),
+					  DOMAIN_BUS_ANY);
 	if (!domain) {
 		pr_err("Failed to find INTC IRQ root domain\n");
 		return -ENODEV;
Signature · 1 line
2.34.1
Reviewed-by on v2 2/2
#3 lore raw

Re: [PATCH v2 -next 2/2] RISC-V/perf: Use standard interface to get INTC domain

In reply to Sunil V L
Quoted 51 lines · Sunil V L

Currently the PMU driver is using DT based lookup to find the INTC node for sscofpmf extension. This will not work for ACPI based systems causing the driver to fail to register the PMU overflow interrupt handler.

Hence, change the code to use the standard interface to find the INTC node which works irrespective of DT or ACPI.

---
 drivers/perf/riscv_pmu_sbi.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/perf/riscv_pmu_sbi.c +2 -16
index 4f3ac296b3e2..0bc491252a44 100644
@@ -739,7 +739,6 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde
 {
        int ret;
        struct cpu_hw_events __percpu *hw_events = pmu->hw_events;
-       struct device_node *cpu, *child;
        struct irq_domain *domain = NULL;
 
        if (riscv_isa_extension_available(NULL, SSCOFPMF)) {
@@ -756,20 +755,8 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde
        if (!riscv_pmu_use_irq)
                return -EOPNOTSUPP;
 
-       for_each_of_cpu_node(cpu) {
-               child = of_get_compatible_child(cpu, "riscv,cpu-intc");
-               if (!child) {
-                       pr_err("Failed to find INTC node\n");
-                       of_node_put(cpu);
-                       return -ENODEV;
-               }
-               domain = irq_find_host(child);
-               of_node_put(child);
-               if (domain) {
-                       of_node_put(cpu);
-                       break;
-               }
-       }
+       domain = irq_find_matching_fwnode(riscv_get_intc_hwnode(),
+                                         DOMAIN_BUS_ANY);
        if (!domain) {
                pr_err("Failed to find INTC IRQ root domain\n");
                return -ENODEV;
--
Quoted 2 lines

2.34.1

Signature · 2 lines
Regards,
Atish
#5 lore raw
In reply to Sunil V L
Quoted 8 lines · Sunil V L

This series fixes couple of issues required to complete the previously merged basic ACPI support series.

1) Kernel test bot has found a new warning using the sparse tool. Though I believe this warning exists for other architectures also, I don't see an issue fixing this for RISC-V.

[...]

Applied, thanks!

[1/2] RISC-V: ACPI : Fix for usage of pointers in different address space

      https://git.kernel.org/palmer/c/3b426d4b5b14
[2/2] RISC-V/perf: Use standard interface to get INTC domain
      https://git.kernel.org/palmer/c/ca7473cb8312

Best regards,

Signature · 7 lines
Palmer Dabbelt <[email protected]>


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#6 lore raw
In reply to Sunil V L
This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Hello:

This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Quoted 8 lines · On Wed, 7 Jun 2023 16:54:15 +0530 you wrote:

This series fixes couple of issues required to complete the previously merged basic ACPI support series.

1) Kernel test bot has found a new warning using the sparse tool. Though I believe this warning exists for other architectures also, I don't see an issue fixing this for RISC-V.

[...]

Here is the summary with links:
- [v2,-next,1/2] RISC-V: ACPI : Fix for usage of pointers in different address space

    https://git.kernel.org/riscv/c/3b426d4b5b14
  - [v2,-next,2/2] RISC-V/perf: Use standard interface to get INTC domain
    https://git.kernel.org/riscv/c/ca7473cb8312

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html