public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 -fixes] RISC-V: ACPI: Fix acpi_os_ioremap to return iomem address
@ 2023-07-23 19:17 Sunil V L
  2023-07-24  8:07 ` Conor Dooley
  0 siblings, 1 reply; 3+ messages in thread
From: Sunil V L @ 2023-07-23 19:17 UTC (permalink / raw)
  To: linux-riscv, linux-kernel
  Cc: Albert Ou, kernel test robot, Conor Dooley, Palmer Dabbelt,
	Paul Walmsley, Andrew Jones

acpi_os_ioremap() currently is a wrapper to memremap() on
RISC-V. But the callers of acpi_os_ioremap() expect it to
return __iomem address and hence sparse tool reports a new
warning. Fix this issue by type casting to  __iomem type.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307230357.egcTAefj-lkp@intel.com/
Fixes: a91a9ffbd3a5 ("RISC-V: Add support to build the ACPI core")
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
---
Changes since v1:
	1) Removed enhancements from the fix patch.

 arch/riscv/include/asm/acpi.h | 2 +-
 arch/riscv/kernel/acpi.c      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h
index f71ce21ff684..d5604d2073bc 100644
--- a/arch/riscv/include/asm/acpi.h
+++ b/arch/riscv/include/asm/acpi.h
@@ -19,7 +19,7 @@ typedef u64 phys_cpuid_t;
 #define PHYS_CPUID_INVALID INVALID_HARTID
 
 /* ACPI table mapping after acpi_permanent_mmap is set */
-void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
+void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
 #define acpi_os_ioremap acpi_os_ioremap
 
 #define acpi_strict 1	/* No out-of-spec workarounds on RISC-V */
diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
index 5ee03ebab80e..e6fdb9edcdd9 100644
--- a/arch/riscv/kernel/acpi.c
+++ b/arch/riscv/kernel/acpi.c
@@ -215,9 +215,9 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
 	early_iounmap(map, size);
 }
 
-void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
+void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
 {
-	return memremap(phys, size, MEMREMAP_WB);
+	return (__force void __iomem *) memremap(phys, size, MEMREMAP_WB);
 }
 
 #ifdef CONFIG_PCI
-- 
2.39.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 -fixes] RISC-V: ACPI: Fix acpi_os_ioremap to return iomem address
  2023-07-23 19:17 [PATCH v2 -fixes] RISC-V: ACPI: Fix acpi_os_ioremap to return iomem address Sunil V L
@ 2023-07-24  8:07 ` Conor Dooley
  2023-07-24 10:03   ` Sunil V L
  0 siblings, 1 reply; 3+ messages in thread
From: Conor Dooley @ 2023-07-24  8:07 UTC (permalink / raw)
  To: Sunil V L
  Cc: linux-riscv, linux-kernel, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Andrew Jones, kernel test robot


[-- Attachment #1.1: Type: text/plain, Size: 2075 bytes --]

On Mon, Jul 24, 2023 at 12:47:58AM +0530, Sunil V L wrote:
> acpi_os_ioremap() currently is a wrapper to memremap() on
> RISC-V. But the callers of acpi_os_ioremap() expect it to
> return __iomem address and hence sparse tool reports a new
> warning. Fix this issue by type casting to  __iomem type.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202307230357.egcTAefj-lkp@intel.com/
> Fixes: a91a9ffbd3a5 ("RISC-V: Add support to build the ACPI core")
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
> ---
> Changes since v1:
> 	1) Removed enhancements from the fix patch.
> 
>  arch/riscv/include/asm/acpi.h | 2 +-
>  arch/riscv/kernel/acpi.c      | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h
> index f71ce21ff684..d5604d2073bc 100644
> --- a/arch/riscv/include/asm/acpi.h
> +++ b/arch/riscv/include/asm/acpi.h
> @@ -19,7 +19,7 @@ typedef u64 phys_cpuid_t;
>  #define PHYS_CPUID_INVALID INVALID_HARTID
>  
>  /* ACPI table mapping after acpi_permanent_mmap is set */
> -void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
> +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
>  #define acpi_os_ioremap acpi_os_ioremap
>  
>  #define acpi_strict 1	/* No out-of-spec workarounds on RISC-V */
> diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
> index 5ee03ebab80e..e6fdb9edcdd9 100644
> --- a/arch/riscv/kernel/acpi.c
> +++ b/arch/riscv/kernel/acpi.c
> @@ -215,9 +215,9 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
>  	early_iounmap(map, size);
>  }
>  
> -void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
> +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
>  {
> -	return memremap(phys, size, MEMREMAP_WB);
> +	return (__force void __iomem *) memremap(phys, size, MEMREMAP_WB);

Why's the __force needed? Does sparse complain about the cast too?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 -fixes] RISC-V: ACPI: Fix acpi_os_ioremap to return iomem address
  2023-07-24  8:07 ` Conor Dooley
@ 2023-07-24 10:03   ` Sunil V L
  0 siblings, 0 replies; 3+ messages in thread
From: Sunil V L @ 2023-07-24 10:03 UTC (permalink / raw)
  To: Conor Dooley
  Cc: linux-riscv, linux-kernel, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Andrew Jones, kernel test robot

On Mon, Jul 24, 2023 at 09:07:46AM +0100, Conor Dooley wrote:
> On Mon, Jul 24, 2023 at 12:47:58AM +0530, Sunil V L wrote:
> > acpi_os_ioremap() currently is a wrapper to memremap() on
> > RISC-V. But the callers of acpi_os_ioremap() expect it to
> > return __iomem address and hence sparse tool reports a new
> > warning. Fix this issue by type casting to  __iomem type.
> > 
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202307230357.egcTAefj-lkp@intel.com/
> > Fixes: a91a9ffbd3a5 ("RISC-V: Add support to build the ACPI core")
> > Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
> > ---
> > Changes since v1:
> > 	1) Removed enhancements from the fix patch.
> > 
> >  arch/riscv/include/asm/acpi.h | 2 +-
> >  arch/riscv/kernel/acpi.c      | 4 ++--
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h
> > index f71ce21ff684..d5604d2073bc 100644
> > --- a/arch/riscv/include/asm/acpi.h
> > +++ b/arch/riscv/include/asm/acpi.h
> > @@ -19,7 +19,7 @@ typedef u64 phys_cpuid_t;
> >  #define PHYS_CPUID_INVALID INVALID_HARTID
> >  
> >  /* ACPI table mapping after acpi_permanent_mmap is set */
> > -void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
> > +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
> >  #define acpi_os_ioremap acpi_os_ioremap
> >  
> >  #define acpi_strict 1	/* No out-of-spec workarounds on RISC-V */
> > diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
> > index 5ee03ebab80e..e6fdb9edcdd9 100644
> > --- a/arch/riscv/kernel/acpi.c
> > +++ b/arch/riscv/kernel/acpi.c
> > @@ -215,9 +215,9 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
> >  	early_iounmap(map, size);
> >  }
> >  
> > -void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
> > +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
> >  {
> > -	return memremap(phys, size, MEMREMAP_WB);
> > +	return (__force void __iomem *) memremap(phys, size, MEMREMAP_WB);
> 
> Why's the __force needed? Does sparse complain about the cast too?
Nope, I think it is required only if the cast is other way. Let me remove
this in v3.

Thanks,
Sunil



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-24 10:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-23 19:17 [PATCH v2 -fixes] RISC-V: ACPI: Fix acpi_os_ioremap to return iomem address Sunil V L
2023-07-24  8:07 ` Conor Dooley
2023-07-24 10:03   ` Sunil V L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox