Hello,
This is a set of kernel patches which I have been using to support the new QEMU
virt platform [1]. The virt platform supports PCI hence I have a patch here to
add PCI support to OpenRISC.
A defconfig is also included which turns on drivers supported devices include
virt network cards and the goldfish RTC.
[1] https://github.com/stffrdhrn/qemu/tree/or1k-virt-3
Changes since v2:
- This is based on the pci cleanup patches from
https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/log/?h=pci/header-cleanup-immutable
so pci.h is removed.
- Change comment about parport.h in patch 2/3.
- Added a patch to define __pci_ioport_map as NULL when when IO ports
are not supported.
Changes since v1:
- Remove PIO support as suggest by Arnd
Stafford Horne (3):
asm-generic: Support NO_IOPORT_MAP in pci_iomap.h
openrisc: Add pci bus support
openrisc: Add virt defconfig
arch/openrisc/Kconfig | 5 +-
arch/openrisc/configs/virt_defconfig | 108 +++++++++++++++++++++++++++
arch/openrisc/include/asm/Kbuild | 1 +
arch/openrisc/include/asm/io.h | 2 +-
include/asm-generic/pci_iomap.h | 2 +
5 files changed, 116 insertions(+), 2 deletions(-)
create mode 100644 arch/openrisc/configs/virt_defconfig
--
2.36.1
I have been developing a new qemu virt platform to help with more
efficient toolchain and kernel testing [1].
This patch adds the defconfig which is needed to support booting
linux on the platform.
[1] https://lore.kernel.org/qemu-devel/YpwNtowUTxRbh2Uq@antec/T/#m6db180b0d682785fb320e4a05345c12a063e0c47
Signed-off-by: Stafford Horne <[email protected]>
---
arch/openrisc/configs/virt_defconfig | 108 +++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
create mode 100644 arch/openrisc/configs/virt_defconfig
diff --git a/arch/openrisc/configs/virt_defconfig b/arch/openrisc/configs/virt_defconfig
new file mode 100644
index 000000000000..c1b69166c500
--- /dev/null
+++ b/arch/openrisc/configs/virt_defconfig
@@ -0,0 +1,108 @@
+CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_NO_HZ_IDLE=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_CGROUPS=y
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_OPENRISC_HAVE_INST_CMOV=y
+CONFIG_OPENRISC_HAVE_INST_ROR=y
+CONFIG_OPENRISC_HAVE_INST_RORI=y
+CONFIG_OPENRISC_HAVE_INST_SEXT=y
+CONFIG_NR_CPUS=8
+CONFIG_SMP=y
+CONFIG_HZ_100=y
+# CONFIG_OPENRISC_NO_SPR_SR_DSX is not set
+# CONFIG_COMPAT_BRK is not set
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+# CONFIG_INET_DIAG is not set
+CONFIG_TCP_CONG_ADVANCED=y
+# CONFIG_TCP_CONG_BIC is not set
+# CONFIG_TCP_CONG_CUBIC is not set
+# CONFIG_TCP_CONG_WESTWOOD is not set
+# CONFIG_TCP_CONG_HTCP is not set
+# CONFIG_IPV6 is not set
+# CONFIG_WIRELESS is not set
+CONFIG_PCI=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCI_HOST_GENERIC=y
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_PREVENT_FIRMWARE_BUILD is not set
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_NBD=y
+CONFIG_VIRTIO_BLK=y
+CONFIG_NETDEVICES=y
+CONFIG_VIRTIO_NET=y
+CONFIG_ETHOC=y
+CONFIG_MICREL_PHY=y
+# CONFIG_WLAN is not set
+CONFIG_INPUT_MOUSEDEV=y
+# CONFIG_LEGACY_PTYS is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_VIRTIO_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_SYSCON=y
+CONFIG_POWER_RESET_SYSCON_POWEROFF=y
+CONFIG_SYSCON_REBOOT_MODE=y
+# CONFIG_HWMON is not set
+CONFIG_DRM=y
+# CONFIG_DRM_FBDEV_EMULATION is not set
+CONFIG_DRM_VIRTIO_GPU=y
+CONFIG_FB=y
+CONFIG_FIRMWARE_EDID=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
+CONFIG_LOGO=y
+CONFIG_SOUND=y
+CONFIG_SND=y
+CONFIG_SND_INTEL8X0=y
+CONFIG_SND_INTEL8X0M=y
+CONFIG_SND_SOC=y
+CONFIG_SND_VIRTIO=y
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_CYPRESS is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_ITE is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_REDRAGON is not set
+# CONFIG_HID_MICROSOFT is not set
+# CONFIG_HID_MONTEREY is not set
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_PLATFORM=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
+CONFIG_USB_SERIAL=y
+CONFIG_USB_GADGET=y
+CONFIG_TYPEC=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_GOLDFISH=y
+CONFIG_VIRT_DRIVERS=y
+CONFIG_VIRTIO_PCI=y
+# CONFIG_VIRTIO_PCI_LEGACY is not set
+CONFIG_VIRTIO_INPUT=y
+CONFIG_VIRTIO_MMIO=y
+CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_POSIX_ACL=y
+# CONFIG_DNOTIFY is not set
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_EXFAT_FS=y
+CONFIG_TMPFS=y
+CONFIG_NFS_FS=y
+CONFIG_UNICODE=y
+CONFIG_PRINTK_TIME=y
+CONFIG_DYNAMIC_DEBUG=y
+CONFIG_FTRACE=y
--
2.36.1
When building OpenRISC PCI which has no ioport_map we get the following build
error.
lib/pci_iomap.c: In function 'pci_iomap_range':
CC drivers/i2c/i2c-core-base.o
./include/asm-generic/pci_iomap.h:29:41: error: implicit declaration of function 'ioport_map'; did you mean 'ioremap'? [-Werror=implicit-function-declaration]
29 | #define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
| ^~~~~~~~~~
lib/pci_iomap.c:44:24: note: in expansion of macro '__pci_ioport_map'
44 | return __pci_ioport_map(dev, start, len);
| ^~~~~~~~~~~~~~~~
This patch adds a NULL definition of __pci_ioport_map for architetures
which do not support ioport_map.
Suggested-by: Arnd Bergmann <[email protected]>
Signed-off-by: Stafford Horne <[email protected]>
---
include/asm-generic/pci_iomap.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h
index 5a2f9bf53384..8fbb0a55545d 100644
--- a/include/asm-generic/pci_iomap.h
+++ b/include/asm-generic/pci_iomap.h
@@ -25,6 +25,8 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
#ifdef CONFIG_NO_GENERIC_PCI_IOPORT_MAP
extern void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port,
unsigned int nr);
+#elif !defined(CONFIG_HAS_IOPORT_MAP)
+#define __pci_ioport_map(dev, port, nr) NULL
#else
#define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
#endif
--
2.36.1
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 <[email protected]>
---
arch/openrisc/Kconfig | 5 ++++-
arch/openrisc/include/asm/Kbuild | 1 +
arch/openrisc/include/asm/io.h | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index e814df4c483c..c7f282f60f64 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -20,8 +20,9 @@ config OPENRISC
select GENERIC_IRQ_CHIP
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
- select GENERIC_IOMAP
+ select GENERIC_PCI_IOMAP
select GENERIC_CPU_DEVICES
+ select HAVE_PCI
select HAVE_UID16
select GENERIC_ATOMIC64
select GENERIC_CLOCKEVENTS_BROADCAST
@@ -32,6 +33,8 @@ config OPENRISC
select CPU_NO_EFFICIENT_FFS if !OPENRISC_HAVE_INST_FF1
select ARCH_USE_QUEUED_RWLOCKS
select OMPIC if SMP
+ select PCI_DOMAINS_GENERIC if PCI
+ select PCI_MSI if PCI
select ARCH_WANT_FRAME_POINTERS
select GENERIC_IRQ_MULTI_HANDLER
select MMU_GATHER_NO_RANGE if MMU
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 3386b9c1c073..c8c99b554ca4 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
generic-y += extable.h
generic-y += kvm_para.h
+generic-y += parport.h
generic-y += spinlock_types.h
generic-y += spinlock.h
generic-y += qrwlock_types.h
diff --git a/arch/openrisc/include/asm/io.h b/arch/openrisc/include/asm/io.h
index c298061c70a7..625ac6ad1205 100644
--- a/arch/openrisc/include/asm/io.h
+++ b/arch/openrisc/include/asm/io.h
@@ -17,7 +17,7 @@
#include <linux/types.h>
/*
- * PCI: can we really do 0 here if we have no port IO?
+ * PCI: We do not use IO ports in OpenRISC
*/
#define IO_SPACE_LIMIT 0
--
2.36.1
On Mon, Jul 25, 2022 at 11:07:35AM +0900, Stafford Horne wrote:
> When building OpenRISC PCI which has no ioport_map we get the following build
> error.
>
> lib/pci_iomap.c: In function 'pci_iomap_range':
> CC drivers/i2c/i2c-core-base.o
> ./include/asm-generic/pci_iomap.h:29:41: error: implicit declaration of function 'ioport_map'; did you mean 'ioremap'? [-Werror=implicit-function-declaration]
> 29 | #define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
> | ^~~~~~~~~~
> lib/pci_iomap.c:44:24: note: in expansion of macro '__pci_ioport_map'
> 44 | return __pci_ioport_map(dev, start, len);
> | ^~~~~~~~~~~~~~~~
>
> This patch adds a NULL definition of __pci_ioport_map for architetures
> which do not support ioport_map.
>
> Suggested-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Stafford Horne <[email protected]>
FWIW,
Acked-by: Bjorn Helgaas <[email protected]>
I assume this will go via some other tree; let me know if otherwise.
> ---
> include/asm-generic/pci_iomap.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h
> index 5a2f9bf53384..8fbb0a55545d 100644
> --- a/include/asm-generic/pci_iomap.h
> +++ b/include/asm-generic/pci_iomap.h
> @@ -25,6 +25,8 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
> #ifdef CONFIG_NO_GENERIC_PCI_IOPORT_MAP
> extern void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port,
> unsigned int nr);
> +#elif !defined(CONFIG_HAS_IOPORT_MAP)
> +#define __pci_ioport_map(dev, port, nr) NULL
> #else
> #define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
> #endif
> --
> 2.36.1
>
On Mon, Jul 25, 2022 at 12:10:59PM -0500, Bjorn Helgaas wrote:
> On Mon, Jul 25, 2022 at 11:07:35AM +0900, Stafford Horne wrote:
> > When building OpenRISC PCI which has no ioport_map we get the following build
> > error.
> >
> > lib/pci_iomap.c: In function 'pci_iomap_range':
> > CC drivers/i2c/i2c-core-base.o
> > ./include/asm-generic/pci_iomap.h:29:41: error: implicit declaration of function 'ioport_map'; did you mean 'ioremap'? [-Werror=implicit-function-declaration]
> > 29 | #define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
> > | ^~~~~~~~~~
> > lib/pci_iomap.c:44:24: note: in expansion of macro '__pci_ioport_map'
> > 44 | return __pci_ioport_map(dev, start, len);
> > | ^~~~~~~~~~~~~~~~
> >
> > This patch adds a NULL definition of __pci_ioport_map for architetures
> > which do not support ioport_map.
> >
> > Suggested-by: Arnd Bergmann <[email protected]>
> > Signed-off-by: Stafford Horne <[email protected]>
>
> FWIW,
>
> Acked-by: Bjorn Helgaas <[email protected]>
Thank you,
> I assume this will go via some other tree; let me know if otherwise.
Yes I plan to send this along with the other patches via the OpenRISC tree.
-Stafford
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 <[email protected]>
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.
Bisect log attached.
Guenter
---
# bad: [7c5e07b73ff3011c9b82d4a3286a3362b951ad2b] Add linux-next specific files for 20220728
# good: [e0dccc3b76fb35bb257b4118367a883073d7390e] Linux 5.19-rc8
git bisect start 'HEAD' 'v5.19-rc8'
# bad: [96bce6a87ad9690eaa9b1ca9ace7c98444d7869f] Revert "Revert "drm/amdgpu: add drm buddy support to amdgpu""
git bisect bad 96bce6a87ad9690eaa9b1ca9ace7c98444d7869f
# bad: [08765bd733f4662c2ad80e813c933758b3c1dddc] Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
git bisect bad 08765bd733f4662c2ad80e813c933758b3c1dddc
# good: [d40269b953fd9abba9aadaa57c6486990ab806d1] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git
git bisect good d40269b953fd9abba9aadaa57c6486990ab806d1
# bad: [3d810ed5c60843645c6a40cc5ebd66e399c94165] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
git bisect bad 3d810ed5c60843645c6a40cc5ebd66e399c94165
# good: [046537a939b089589a1a6e70df16b10a8f0c8ca8] Merge branch 'clk-next' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
git bisect good 046537a939b089589a1a6e70df16b10a8f0c8ca8
# good: [d6b551b8f90cc92c7d3c09cf38c748efe305ecb4] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
git bisect good d6b551b8f90cc92c7d3c09cf38c748efe305ecb4
# bad: [e30727fee2a25176c4558f49a102524eba973d49] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git
git bisect bad e30727fee2a25176c4558f49a102524eba973d49
# bad: [36c4dbb3e78602ee750e12c85fadb3da4392eeac] Merge branch 'for-next' of git://github.com/openrisc/linux.git
git bisect bad 36c4dbb3e78602ee750e12c85fadb3da4392eeac
# good: [9db5e69af1f4de043ae962a908fc7ef1a40f7f51] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git
git bisect good 9db5e69af1f4de043ae962a908fc7ef1a40f7f51
# good: [62fb295ce7dd9df3e04b48a943f8cafaf1f32980] MIPS: dts: align gpio-key node names with dtschema
git bisect good 62fb295ce7dd9df3e04b48a943f8cafaf1f32980
# bad: [2479c96f5d3db2610a6d463077dd3dad087529fb] openrisc: Add virt defconfig
git bisect bad 2479c96f5d3db2610a6d463077dd3dad087529fb
# good: [a2912b45b0826c6fc0ca9b264d03a2dacb7a72e8] asm-generic: Add new pci.h and use it
git bisect good a2912b45b0826c6fc0ca9b264d03a2dacb7a72e8
# good: [3e2a6fbbbf34d230b9063f1ca885d5d625a0404c] asm-generic: Support NO_IOPORT_MAP in pci_iomap.h
git bisect good 3e2a6fbbbf34d230b9063f1ca885d5d625a0404c
# bad: [48ef4b584af7ba4ecdf2dd58b641fb8d0a9d0c63] openrisc: Add pci bus support
git bisect bad 48ef4b584af7ba4ecdf2dd58b641fb8d0a9d0c63
# first bad commit: [48ef4b584af7ba4ecdf2dd58b641fb8d0a9d0c63] openrisc: Add pci bus support
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 <[email protected]>
>
> 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.
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:
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 will try to see what is going on in linux-next.
-Stafford
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 <[email protected]>
>>
>> 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 ?
Thanks,
Guenter
> I will try to see what is going on in linux-next.
>
> -Stafford
>
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 <[email protected]>
> > >
> > > 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.