Re: [PATCH v3 2/3] openrisc: Add pci bus support

From: Stafford Horne
Date: Fri Jul 29 2022 - 03:55:05 EST


On Thu, Jul 28, 2022 at 11:10:37PM -0700, Guenter Roeck wrote:
> On 7/28/22 22:50, Stafford Horne wrote:
> > On Thu, Jul 28, 2022 at 08:37:28PM -0700, Guenter Roeck wrote:
> > > On Mon, Jul 25, 2022 at 11:07:36AM +0900, Stafford Horne wrote:
> > > > This patch adds required definitions to allow for PCI buses on OpenRISC.
> > > > This is being tested on the OpenRISC QEMU virt platform which is in
> > > > development.
> > > >
> > > > OpenRISC does not have IO ports so we keep the definition of
> > > > IO_SPACE_LIMIT and PIO_RESERVED to be 0.
> > > >
> > > > Note, since commit 66bcd06099bb ("parport_pc: Also enable driver for PCI
> > > > systems") all platforms that support PCI also need to support parallel
> > > > port. We add a generic header to support compiling parallel port
> > > > drivers, though they generally will not work as they require IO ports.
> > > >
> > > > Signed-off-by: Stafford Horne <shorne@xxxxxxxxx>
> > >
> > > This patch results in
> > >
> > > Building openrisc:allmodconfig ... failed
> > > --------------
> > > Error log:
> > > drivers/video/fbdev/riva/fbdev.c: In function 'rivafb_probe':
> > > drivers/video/fbdev/riva/fbdev.c:2062:42: error:
> > > passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type
> > >
> > > drivers/video/fbdev/nvidia/nvidia.c: In function 'nvidiafb_probe':
> > > drivers/video/fbdev/nvidia/nvidia.c:1414:20: error:
> > > passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type
> > >
> > > drivers/scsi/aic7xxx/aic7xxx_osm.c: In function 'ahc_platform_free':
> > > drivers/scsi/aic7xxx/aic7xxx_osm.c:1231:41: error:
> > > passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type
> > >
> > > ... and so on.
> > >
> > > Prior to this patch, the code was not enabled because it depends on PCI.
> >
> > Hi Guenter,
> >
> > Thanks for reporting this.
> >
> > It's interesting, I don't get this on the openrisc/for-next branch.
> >
>
> Hmm, weird. I see it all over the place. Complete log is at
> https://kerneltests.org/builders/next-openrisc-next/builds/1880/steps/buildcommand/logs/stdio
> if you are interested.
>
> > BTW, do you turn off WERROR on the allmodconfig config? I get many warnings
> > such as the below, but I haven't looked into it much yet:
> >
>
> No, I don't. Disabling it would defeat its purpose.
>
> > fs/exec.c: In function 'shift_arg_pages':
> > fs/exec.c:687:27: error: 'tlb' is used uninitialized [-Werror=uninitialized]
> > 687 | struct mmu_gather tlb;
> > | ^~~
> >
>
> I don't see that in next-20220728. I tried with gcc-11.2 and 11.3.
> Which compiler do you use ?

I am using gcc 12.0.1 with next-20220728. That might exaplain it, I am doing
compiler development at the same time so I always end up with the latest and
greatest warnings.

$ or1k-linux-gcc -v
..
gcc version 12.0.1 20220210 (experimental) (GCC)

I can see the issue now:

drivers/video/fbdev/riva/fbdev.c:2062:42: warning: passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
2062 | iounmap(default_par->riva.PRAMIN);
| ~~~~~~~~~~~~~~~~~^~~~~~~

Just adding volatile does seem to fix this, I will do some more testing and
create a formal patch.

--

diff --git a/arch/openrisc/include/asm/io.h b/arch/openrisc/include/asm/io.h
index 625ac6ad1205..ee6043a03173 100644
--- a/arch/openrisc/include/asm/io.h
+++ b/arch/openrisc/include/asm/io.h
@@ -31,7 +31,7 @@
void __iomem *ioremap(phys_addr_t offset, unsigned long size);

#define iounmap iounmap
-extern void iounmap(void __iomem *addr);
+extern void iounmap(volatile void __iomem *addr);

#include <asm-generic/io.h>

diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c
index daae13a76743..8ec0dafecf25 100644
--- a/arch/openrisc/mm/ioremap.c
+++ b/arch/openrisc/mm/ioremap.c
@@ -77,7 +77,7 @@ void __iomem *__ref ioremap(phys_addr_t addr, unsigned long size)
}
EXPORT_SYMBOL(ioremap);

-void iounmap(void __iomem *addr)
+void iounmap(volatile void __iomem *addr)
{
/* If the page is from the fixmap pool then we just clear out
* the fixmap mapping.