aboutsummaryrefslogtreecommitdiff
path: root/hw/pci-host
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2024-01-28 22:00:55 -0800
committerPeter Maydell <peter.maydell@linaro.org>2024-02-02 13:51:58 +0000
commit8a73152020337a7fbf34daf0a006d4d89ec1494e (patch)
tree598fadb89ea3181580de2137205b78e920966712 /hw/pci-host
parent12af201a59e4cfc55381aae4ccb8cd071f026b0d (diff)
downloadqemu-8a73152020337a7fbf34daf0a006d4d89ec1494e.zip
qemu-8a73152020337a7fbf34daf0a006d4d89ec1494e.tar.gz
qemu-8a73152020337a7fbf34daf0a006d4d89ec1494e.tar.bz2
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: d64e5eabc4c7 ("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>
Diffstat (limited to 'hw/pci-host')
-rw-r--r--hw/pci-host/designware.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
index dd9e389..c25d50f 100644
--- a/hw/pci-host/designware.c
+++ b/hw/pci-host/designware.c
@@ -340,6 +340,8 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,
break;
case DESIGNWARE_PCIE_ATU_VIEWPORT:
+ val &= DESIGNWARE_PCIE_ATU_REGION_INBOUND |
+ (DESIGNWARE_PCIE_NUM_VIEWPORTS - 1);
root->atu_viewport = val;
break;