PCI/switchtec: Read all 64 bits of part_event_bitmap
Subsystems (3)
Logan Gunthorpe
maintainerPATCH 1/1 PCI/switchtec: Read all 64 bits of part_event_bitmap
commit 6acdf7e19b37cb3a9258603d0eab315079c19c5e upstream.
The part_event_bitmap register is 64 bits wide, so read it with ioread64() instead of the 32-bit ioread32().
---
ioread64() was introduced in v5.1 so the upstream patch won't compile on stable versions 4.14 or 4.19. This is the same patch but uses readq() which should be equivalent.
drivers/pci/switch/switchtec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/switch/switchtec.c +1 -1
@@ -898,7 +898,7 @@ static int ioctl_event_summary(struct switchtec_dev *stdev,u32 reg; s.global =ioread32 (&stdev->mmio_sw_event->global_summary); - s.part_bitmap =ioread32 (&stdev->mmio_sw_event->part_event_bitmap); + s.part_bitmap =readq (&stdev->mmio_sw_event->part_event_bitmap); s.local_part =ioread32 (&stdev->mmio_part_cfg->part_event_summary);for (i =0 ; i < stdev->partition_count; i++) {
--
2.20.1
Greg Kroah-Hartman
maintainerQuoted 13 lines · Logan Gunthorpe
commit
6acdf7e19b37cb3a9258603d0eab315079c19c5eupstream.The
part_event_bitmapregister is 64 bits wide, so read it withioread64()instead of the 32-bitioread32().Fixes 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")Reported-by Doug Meyer <[email protected]>Signed-off-by Logan Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc [email protected] # v4.12+Cc Kelvin Cao <[email protected]>Cc Greg Kroah-Hartman <[email protected]>
Quoted 5 lines
---
ioread64()was introduced in v5.1 so the upstream patch won't compile on stable versions 4.14 or 4.19. This is the same patch but usesreadq()which should be equivalent.
Now queued up, thanks.
greg k-h
Sasha Levin
maintainerQuoted 16 lines · Greg Kroah-Hartman
Quoted 15 lines · Logan Gunthorpe
commit
6acdf7e19b37cb3a9258603d0eab315079c19c5eupstream.The
part_event_bitmapregister is 64 bits wide, so read it withioread64()instead of the 32-bitioread32().Fixes 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")Reported-by Doug Meyer <[email protected]>Signed-off-by Logan Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc [email protected] # v4.12+Cc Kelvin Cao <[email protected]>Cc Greg Kroah-Hartman <[email protected]>---
Quoted 5 lines
Quoted 3 lines
ioread64()was introduced in v5.1 so the upstream patch won't compile on stable versions 4.14 or 4.19. This is the same patch but usesreadq()which should be equivalent.Now queued up, thanks.
Hey Logan,
As Guenter has pointed out, readq() is only defined for 64 bits, so this breaks compilation in i386. I've dropped this backport for now, if you could fix it up we could queue it up again.
Signature · 2 lines
Thanks, Sasha
Logan Gunthorpe
maintainerQuoted 23 lines · Sasha Levin
Quoted 22 lines · Greg Kroah-Hartman
Quoted 20 lines · Logan Gunthorpe
commit
6acdf7e19b37cb3a9258603d0eab315079c19c5eupstream.The
part_event_bitmapregister is 64 bits wide, so read it withioread64()
instead of the 32-bitioread32().Fixes 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")Link:
https://lore.kernel.org/r/[email protected]Reported-by Doug Meyer <[email protected]>Signed-off-by Logan Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc [email protected] # v4.12+Cc Kelvin Cao <[email protected]>Cc Greg Kroah-Hartman <[email protected]>---
ioread64()was introduced in v5.1 so the upstream patch won't compile on stable versions 4.14 or 4.19. This is the same patch but usesreadq()which should be equivalent.
Quoted 7 lines
Quoted 1 line
Now queued up, thanks.
Hey Logan,
As Guenter has pointed out,
readq()is only defined for 64 bits, so this breaks compilation in i386. I've dropped this backport for now, if you could fix it up we could queue it up again.
Not quiet true. It is in fact defined for 32-bit architectures as two readl() calls in "linux/io-64-nonatomic-lo-hi.h".
So, unless I'm missing something the patch should be fine.
Logan
Sasha Levin
maintainerQuoted 30 lines · Logan Gunthorpe
Quoted 27 lines · Sasha Levin
Quoted 18 lines · Greg Kroah-Hartman
Quoted 17 lines · Logan Gunthorpe
commit
6acdf7e19b37cb3a9258603d0eab315079c19c5eupstream.The
part_event_bitmapregister is 64 bits wide, so read it withioread64()
instead of the 32-bitioread32().Fixes 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")Link:
https://lore.kernel.org/r/[email protected]Reported-by Doug Meyer <[email protected]>Signed-off-by Logan Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc [email protected] # v4.12+Cc Kelvin Cao <[email protected]>Cc Greg Kroah-Hartman <[email protected]>---
Quoted 5 lines
Quoted 3 lines
ioread64()was introduced in v5.1 so the upstream patch won't compile on stable versions 4.14 or 4.19. This is the same patch but usesreadq()which should be equivalent.Now queued up, thanks.
Hey Logan,
Quoted 8 lines
Quoted 3 lines
As Guenter has pointed out,
readq()is only defined for 64 bits, so this breaks compilation in i386. I've dropped this backport for now, if you could fix it up we could queue it up again.Not quiet true. It is in fact defined for 32-bit architectures as two
readl()calls in "linux/io-64-nonatomic-lo-hi.h".So, unless I'm missing something the patch should be fine.
This is an actual error we're seeing:
drivers/pci/switch/switchtec.c: In function ‘ioctl_event_summary’:drivers/pci/switch/switchtec.c:636:18: error: implicit declaration of function ‘readq’; did you mean ‘readl’? [-Werror=implicit-function-declaration]
636 | s.part_bitmap = readq(&stdev->mmio_sw_event->part_event_bitmap);
| ^~~~~
| readlcc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:310: drivers/pci/switch/switchtec.o] Error 1
make: *** [Makefile:1695: drivers/pci/switch/] Error 2
So the patch isn't fine :)
You're correct about linux/io-64-nonatomic-lo-hi.h, but sadly it isn't included in drivers/pci/switch/switchtec.c so it's not getting used. Something like the following has fixed compilation for me:
drivers/pci/switch/switchtec.c +0 -0
@@ -16,6 +16,8 @@
#include <linux/nospec.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
+MODULE_DESCRIPTION("Microsemi Switchtec(tm) PCIe Management Driver"); MODULE_VERSION("0.1");MODULE_LICENSE("GPL");
Signature · 2 lines
Thanks, Sasha
Logan Gunthorpe
maintainerQuoted 55 lines · Sasha Levin
Quoted 31 lines · Logan Gunthorpe
Quoted 28 lines · Sasha Levin
Quoted 18 lines · Greg Kroah-Hartman
Quoted 17 lines · Logan Gunthorpe
commit
6acdf7e19b37cb3a9258603d0eab315079c19c5eupstream.The
part_event_bitmapregister is 64 bits wide, so read it withioread64()
instead of the 32-bitioread32().Fixes 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")Link:
https://lore.kernel.org/r/[email protected]Reported-by Doug Meyer <[email protected]>Signed-off-by Logan Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc [email protected] # v4.12+Cc Kelvin Cao <[email protected]>Cc Greg Kroah-Hartman <[email protected]>---
Quoted 6 lines
Quoted 4 lines
ioread64()was introduced in v5.1 so the upstream patch won't compile on
stable versions 4.14 or 4.19. This is the same patch but usesreadq()which should be equivalent.Now queued up, thanks.
Hey Logan,
Quoted 8 lines
Quoted 3 lines
As Guenter has pointed out,
readq()is only defined for 64 bits, so this breaks compilation in i386. I've dropped this backport for now, if you could fix it up we could queue it up again.Not quiet true. It is in fact defined for 32-bit architectures as two
readl()calls in "linux/io-64-nonatomic-lo-hi.h".So, unless I'm missing something the patch should be fine.
This is an actual error we're seeing:
drivers/pci/switch/switchtec.c: In function ‘ioctl_event_summary’:drivers/pci/switch/switchtec.c:636:18: error: implicit declaration of function ‘readq’; did you mean ‘readl’? [-Werror=implicit-function-declaration]
636 | s.part_bitmap =readq(&stdev->mmio_sw_event->part_event_bitmap); | ^~~~~
| readl
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:310:drivers/pci/switch/switchtec.o] Error 1
make: *** [Makefile:1695:drivers/pci/switch/] Error 2
Quoted 5 lines
So the patch isn't fine :)
You're correct about
linux/io-64-nonatomic-lo-hi.h, but sadly it isn't included indrivers/pci/switch/switchtec.cso it's not getting used. Something like the following has fixed compilation for me:
Oh, hmm, yes looks like we added that include in v5.0 so earlier versions need it for that patch to be correct on non-64bit arches. Sigh.
Can you just add the include line to the patch or do you need me to send a new one fixed up?
Thanks,
Logan
Greg Kroah-Hartman
maintainerQuoted 64 lines · Logan Gunthorpe
Quoted 55 lines · Sasha Levin
Quoted 31 lines · Logan Gunthorpe
Quoted 28 lines · Sasha Levin
Quoted 18 lines · Greg Kroah-Hartman
Quoted 17 lines · Logan Gunthorpe
commit
6acdf7e19b37cb3a9258603d0eab315079c19c5eupstream.The
part_event_bitmapregister is 64 bits wide, so read it withioread64()
instead of the 32-bitioread32().Fixes 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")Link:
https://lore.kernel.org/r/[email protected]Reported-by Doug Meyer <[email protected]>Signed-off-by Logan Gunthorpe <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc [email protected] # v4.12+Cc Kelvin Cao <[email protected]>Cc Greg Kroah-Hartman <[email protected]>---
Quoted 6 lines
Quoted 4 lines
ioread64()was introduced in v5.1 so the upstream patch won't compile on
stable versions 4.14 or 4.19. This is the same patch but usesreadq()which should be equivalent.Now queued up, thanks.
Hey Logan,
Quoted 8 lines
Quoted 3 lines
As Guenter has pointed out,
readq()is only defined for 64 bits, so this breaks compilation in i386. I've dropped this backport for now, if you could fix it up we could queue it up again.Not quiet true. It is in fact defined for 32-bit architectures as two
readl()calls in "linux/io-64-nonatomic-lo-hi.h".So, unless I'm missing something the patch should be fine.
This is an actual error we're seeing:
drivers/pci/switch/switchtec.c: In function ‘ioctl_event_summary’:drivers/pci/switch/switchtec.c:636:18: error: implicit declaration of function ‘readq’; did you mean ‘readl’? [-Werror=implicit-function-declaration]
636 | s.part_bitmap =readq(&stdev->mmio_sw_event->part_event_bitmap); | ^~~~~
| readl
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:310:drivers/pci/switch/switchtec.o] Error 1
make: *** [Makefile:1695:drivers/pci/switch/] Error 2Quoted 5 lines
So the patch isn't fine :)
You're correct about
linux/io-64-nonatomic-lo-hi.h, but sadly it isn't included indrivers/pci/switch/switchtec.cso it's not getting used. Something like the following has fixed compilation for me:
Quoted 5 lines
Oh, hmm, yes looks like we added that include in v5.0 so earlier versions need it for that patch to be correct on non-64bit arches. Sigh.
Can you just add the include line to the patch or do you need me to send a new one fixed up?
A new one fixed up would be great, thanks.
greg k-h