]> git.ipfire.org Git - thirdparty/qemu.git/commit
pci-host: designware: Limit value range of iATU viewport register
authorGuenter Roeck <linux@roeck-us.net>
Mon, 29 Jan 2024 06:00:55 +0000 (22:00 -0800)
committerMichael Tokarev <mjt@tls.msk.ru>
Sat, 3 Feb 2024 13:45:54 +0000 (16:45 +0300)
commit2884514b98b69bc03f173ab7fe1adce7bcd564ab
tree6230410308e3db379d4537a9e268c255d08d7a6a
parentf039059e0a1cc3cebb74d60096ba2cad05e9dfd5
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>
(cherry picked from commit 8a73152020337a7fbf34daf0a006d4d89ec1494e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/pci-host/designware.c