qemu/hw/pci-host
Guenter Roeck 5f5e30229e pci-host: designware: Limit value range of iATU viewport register
The latest version of qemu (v8.2.0-869-g7a1dc45af5) crashes when booting
the mcimx7d-sabre emulation with Linux v5.11 and later.

qemu-system-arm: ../system/memory.c:2750: memory_region_set_alias_offset: Assertion `mr->alias' failed.

Problem is that the Designware PCIe emulation accepts the full value range
for the iATU Viewport Register. However, both hardware and emulation only
support four inbound and four outbound viewports.

The Linux kernel determines the number of supported viewports by writing
0xff into the viewport register and reading the value back. The expected
value when reading the register is the highest supported viewport index.
Match that code by masking the supported viewport value range when the
register is written. With this change, the Linux kernel reports

imx6q-pcie 33800000.pcie: iATU: unroll F, 4 ob, 4 ib, align 0K, limit 4G

as expected and supported.

Fixes: d64e5eabc4 ("pci: Add support for Designware IP block")
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Nikita Ostrenkov <n.ostrenkov@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20240129060055.2616989-1-linux@roeck-us.net
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 8a73152020)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-02-09 10:44:49 +03:00
..
articia.c hw/pci-host: Add emulation of Mai Logic Articia S 2023-11-07 12:59:29 -03:00
astro.c hw/pci-host/astro: Add missing astro & elroy registers for NetBSD 2024-01-17 10:32:47 +03:00
bonito.c hw/pci-host/bonito: Do not use SysBus API to map local MMIO region 2023-10-19 23:13:28 +02:00
designware.c pci-host: designware: Limit value range of iATU viewport register 2024-02-09 10:44:49 +03:00
dino.c hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
gpex-acpi.c hw/pci: spelling fixes 2023-09-20 07:54:34 +03:00
gpex.c hw/pci-host/gpex: Don't fault for unmapped parts of MMIO and PIO windows 2021-04-30 11:16:52 +01:00
grackle.c hw/pci-host: Use register definitions from PCI standard 2023-01-27 11:47:02 -05:00
gt64120.c hw/pci: spelling fixes 2023-09-20 07:54:34 +03:00
i440fx.c pc: remove short_root_bus property 2023-09-29 09:33:10 +02:00
Kconfig hw/pci-host: Add emulation of Mai Logic Articia S 2023-11-07 12:59:29 -03:00
meson.build hw/pci-host/astro: Fix boot for C3700 machine 2023-11-13 09:21:32 -08:00
mv643xx.h mv64361: Add dummy gigabit ethernet PHY access registers 2023-07-07 04:18:26 -03:00
mv64361.c mv64361: Add dummy gigabit ethernet PHY access registers 2023-07-07 04:18:26 -03:00
pam.c hw/pci-host/pam: Make init_pam() usage more readable 2023-05-19 10:30:46 -04:00
pnv_phb3_msi.c hw/pci: spelling fixes 2023-09-20 07:54:34 +03:00
pnv_phb3_pbcq.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
pnv_phb3.c hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
pnv_phb4_pec.c hw/pci-host: Update PHB5 XSCOM registers 2023-11-07 15:49:41 -03:00
pnv_phb4.c hw/pci-host: Update PHB5 XSCOM registers 2023-11-07 15:49:41 -03:00
pnv_phb.c hw/pci: spelling fixes 2023-09-20 07:54:34 +03:00
pnv_phb.h include/hw/ppc include/hw/pci-host: Drop extra typedefs 2023-01-20 07:25:22 +01:00
ppce500.c hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
q35.c pc: remove short_root_bus property 2023-09-29 09:33:10 +02:00
raven.c hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
remote.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
sabre.c hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
sh_pci.c hw/pci-host/sh_pcic: Replace magic value by proper definition 2023-10-19 23:13:28 +02:00
trace-events hw/pci-host: Add Astro system bus adapter found on PA-RISC machines 2023-10-20 00:47:38 +02:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
uninorth.c hw/pci-host: Use register definitions from PCI standard 2023-01-27 11:47:02 -05:00
versatile.c hw/pci/pci: Factor out pci_bus_map_irqs() from pci_bus_irqs() 2023-01-13 16:22:57 +01:00
xen_igd_pt.c xen: Use ERRP_GUARD() 2020-07-10 15:18:09 +02:00
xilinx-pcie.c pci: drop redundant PCIDeviceClass::is_bridge field 2022-12-21 07:32:24 -05:00