Skip to content

Fix ARM64 crash for accessing unmapped IO port regions

John Garry linux-arm-kernel linux-pci lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 13 repliesIn review
  2. v34 patches 13 repliesSuperseded
  3. v23 patches 13 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC2 patches7 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3lib: logic_pio: Use logical PIO low-level accessors for !CONFIG_INDIRECT_PIOinclude/linux/logic_pio.h lib/logic_pio.c+63 -278 replies
2/3lib: logic_pio: Reject accesses to unregistered CPU MMIO regionslib/logic_pio.c+41 -195 replies
3/3lib: logic_pio: Fix up a printlib/logic_pio.c+1 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/3] Fix ARM64 crash for accessing unmapped IO port regions

It was reported some time ago that arm64 systems will crash if a driver attempts to access IO port addresses when the PCI IO port region has not been mapped [1].

More recently, a similar crash is where the system PCI host probe fails, and the IPMI driver crashes the system while attempting to do some IO port accesses [2].

This patchset attempts to keep the kernel alive in such situations by rejecting logical PIO access to PCI IO regions until PCI IO port regions have been mapped. Accesses to unmapped regions fail silently, mimicking x86 behaviour.

The previous versions of this patchset also included a patch to reject IO port resource requests until PCI IO port regions have been mapped (in a pci_remap_iospace() call). However I decided to drop it since the validity of the patch was strongly in doubt - [3].

1. https://lore.kernel.org/linux-pci/[email protected]
2. https://lore.kernel.org/linux-arm-kernel/[email protected]/
3. https://lore.kernel.org/linux-pci/[email protected]/

Differences to v3 patchset:
https://lkml.org/lkml/2019/4/4/1294
- Drop patch to reject IO port requests
- Make unmapped IO port accesses silent, mimicking x86

Differences to v2 patchset:
https://lkml.org/lkml/2019/3/20/788
- Add a patch to use logical PIO accessors for !CONFIG_INDIRECT_PIO
- Some tidy-up according to Andy's review

Differences to v1 patchset:
https://lkml.org/lkml/2019/3/14/630
- Drop f71805f fix - it can be done in a separate patchset
- Change implementation in resource.c patch to check if parent of region is ioport_resource
- Add patch to fix some logic_pio.c prints

John Garry (3):
lib: logic_pio: Use logical PIO low-level accessors for
!CONFIG_INDIRECT_PIO
lib: logic_pio: Reject accesses to unregistered CPU MMIO regions
lib: logic_pio: Fix up a print

 include/linux/logic_pio.h |   7 ++-
 lib/logic_pio.c           | 116 ++++++++++++++++++++++++++++----------
 2 files changed, 90 insertions(+), 33 deletions(-)
Signature · 1 line
2.17.1