qemu-patch-raspberry4/hw/arm
Xingang Wang 42e0f050e3 hw/arm/virt-acpi-build: Add IORT support to bypass SMMUv3
When we build IORT table with SMMUv3 and bypass iommu feature enabled,
we can no longer setup one map from RC to SMMUv3 covering the whole RIDs.
We need to walk the PCI bus and check whether the root bus will bypass
iommu, setup RC -> SMMUv3 -> ITS map for RC which will not bypass iommu.

When a SMMUv3 node exist, we setup the idmap from SMMUv3 to ITS
covering the whole RIDs, and only modify the map from RC to SMMUv3.
We build RC -> SMMUv3 -> ITS map for root bus with bypass_iommu
disabled, and build idmap from RC to ITS directly for the rest of
the whole RID space.

For example we run qemu with command line:

qemu/build/aarch64-softmmu/qemu-system-aarch64 \
 -kernel arch/arm64/boot/Image \
 -enable-kvm \
 -cpu host \
 -m 8G \
 -smp 8,sockets=2,cores=4,threads=1 \
 -machine virt,kernel_irqchip=on,gic-version=3,iommu=smmuv3,default_bus_bypass_iommu=true \
 -drive file=./QEMU_EFI-pflash.raw,if=pflash,format=raw,unit=0,readonly=on \
 -device pxb-pcie,bus_nr=0x10,id=pci.10,bus=pcie.0,addr=0x3.0x1 \
 -device pxb-pcie,bus_nr=0x20,id=pci.20,bus=pcie.0,addr=0x3.0x2,bypass_iommu=true \
 -device pcie-root-port,port=0x20,chassis=1,id=pci.1,bus=pcie.0,addr=0x2 \
 -device pcie-root-port,port=0x20,chassis=11,id=pci.11,bus=pci.10,addr=0x1 \
 -device pcie-root-port,port=0x20,chassis=21,id=pci.21,bus=pci.20,addr=0x1 \
 -device virtio-scsi-pci,id=scsi0,bus=pci.1,addr=0x1 \
 -device virtio-scsi-pci,id=scsi1,bus=pci.11,addr=0x1 \
 -device virtio-scsi-pci,id=scsi2,bus=pci.21,addr=0x1 \
 -initrd /mnt/davinci/wxg/kill-linux/rootfs/mfs.cpio.gz \
 -nographic \
 -append "rdinit=init console=ttyAMA0 earlycon=pl011,0x9000000 nokaslr" \

And we get guest configuration:

-+-[0000:20]---01.0-[21]--
 +-[0000:10]---01.0-[11]--
 \-[0000:00]-+-00.0  Device 1b36:0008
             +-01.0  Device 1af4:1000
             \-02.0-[01]--

With bypass_iommu enabled, the attached devices will bypass iommu.

/sys/class/iommu/smmu3.0x0000000009050000/
|-- device -> ../../../arm-smmu-v3.0.auto
|-- devices
|   `-- 0000:10:01.0 -> ../../../../../pci0000:10/0000:10:01.0

Signed-off-by: Xingang Wang <wangxingang5@huawei.com>
Message-Id: <1625748919-52456-7-git-send-email-wangxingang5@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2021-07-16 11:10:45 -04:00
..
allwinner-a10.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
allwinner-h3.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
armsse.c hw/arm: Model TCMs in the SSE-300, not the AN547 2021-05-25 16:01:43 +01:00
armv7m.c target/arm: Allow board models to specify initial NS VTOR 2021-06-03 16:43:25 +01:00
aspeed.c sensor: Move hardware sensors from misc to a sensor directory 2021-06-17 07:10:32 -05:00
aspeed_ast2600.c Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
aspeed_soc.c Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
bcm2835_peripherals.c hw/arm: Add basic power management to raspi. 2021-07-02 11:48:36 +01:00
bcm2836.c Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
boot.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
collie.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
cubieboard.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
digic.c error: Eliminate error_propagate() with Coccinelle, part 1 2020-07-10 15:18:08 +02:00
digic_boards.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
exynos4_boards.c Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
exynos4210.c hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
fsl-imx6.c Add the ability to change the FEC PHY MDIO device number on i.MX6 processor 2020-07-13 14:36:08 +01:00
fsl-imx6ul.c qom: Put name parameter before value / visitor parameter 2020-07-10 15:18:08 +02:00
fsl-imx7.c Add the ability to change the FEC PHY MDIO devices numbers on i.MX7 processor 2020-07-13 14:36:08 +01:00
fsl-imx25.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
fsl-imx31.c Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
gumstix.c hw/arm/gumstix: Simplify since the machines are little-endian only 2020-03-05 16:09:14 +00:00
highbank.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
imx25_pdk.c hw/arm/imx25_pdk: Fix error message for invalid RAM size 2021-05-10 17:21:54 +01:00
integratorcp.c qom: simplify object_find_property / object_class_find_property 2020-09-22 16:45:16 -04:00
Kconfig * More SVM fixes (Lara) 2021-07-11 22:20:51 +01:00
kzm.c Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
mainstone.c qtest: delete superfluous inclusions of qtest.h 2021-03-09 06:03:53 +01:00
mcimx6ul-evk.c arm: Consistently use "Cortex-Axx", not "Cortex Axx" 2021-06-03 16:43:25 +01:00
mcimx7d-sabre.c arm: Consistently use "Cortex-Axx", not "Cortex Axx" 2021-06-03 16:43:25 +01:00
meson.build stm32vldiscovery: Add the STM32VLDISCOVERY Machine 2021-07-09 16:09:12 +01:00
microbit.c hw/arm: Display CPU type in machine description 2021-02-03 10:15:51 +00:00
mps2-tz.c hw/arm: Model TCMs in the SSE-300, not the AN547 2021-05-25 16:01:43 +01:00
mps2.c hw/misc/mps2-scc: Support configurable number of OSCCLK values 2021-03-06 13:30:38 +00:00
msf2-soc.c hw: Do not include hw/irq.h if it is not necessary 2021-05-02 17:24:50 +02:00
msf2-som.c Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
musca.c arm: Update infocenter.arm.com URLs 2021-02-11 11:50:14 +00:00
musicpal.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
netduino2.c hw/arm: Display CPU type in machine description 2021-02-03 10:15:51 +00:00
netduinoplus2.c hw/arm: Display CPU type in machine description 2021-02-03 10:15:51 +00:00
npcm7xx.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
npcm7xx_boards.c hw/arm: gsj add pca9548 2021-06-16 14:33:51 +01:00
nrf51_soc.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
nseries.c hw/input/lm832x: Define TYPE_LM8323 in public header 2021-07-08 14:15:01 -05:00
omap1.c Do not include hw/boards.h if it's not really necessary 2021-05-02 17:24:51 +02:00
omap2.c Do not include hw/boards.h if it's not really necessary 2021-05-02 17:24:51 +02:00
omap_sx1.c hw/arm: Use memory_region_init_rom() with read-only regions 2020-03-17 15:18:46 +01:00
orangepi.c Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
palm.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
pxa2xx.c hw/i2c: Rename i2c_set_slave_address() -> i2c_slave_set_address() 2021-07-08 14:15:01 -05:00
pxa2xx_gpio.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
pxa2xx_pic.c hw/arm: Constify VMStateDescription 2021-05-02 17:24:50 +02:00
raspi.c Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
realview.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
sabrelite.c arm: Consistently use "Cortex-Axx", not "Cortex Axx" 2021-06-03 16:43:25 +01:00
sbsa-ref.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
smmu-common.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
smmu-internal.h hw/arm/smmuv3: Fix SMMU_CMD_CFGI_STE_RANGE handling 2021-03-12 12:40:10 +00:00
smmuv3-internal.h hw/arm/smmuv3: Drop unused CDM_VALID() and is_cd_valid() 2021-03-30 14:05:33 +01:00
smmuv3.c hw/arm/smmuv3: Another range invalidation fix 2021-05-25 15:44:45 +01:00
spitz.c hw/i2c: Rename i2c_set_slave_address() -> i2c_slave_set_address() 2021-07-08 14:15:01 -05:00
stellaris.c hw/arm/stellaris: Expand comment about handling of OLED chipselect 2021-07-09 16:09:12 +01:00
stm32f100_soc.c stm32f100: Add the stm32f100 SoC 2021-07-09 16:09:11 +01:00
stm32f205_soc.c hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ 2020-11-10 11:03:48 +00:00
stm32f405_soc.c error: Eliminate error_propagate() with Coccinelle, part 1 2020-07-10 15:18:08 +02:00
stm32vldiscovery.c stm32vldiscovery: Add the STM32VLDISCOVERY Machine 2021-07-09 16:09:12 +01:00
strongarm.c Do not include hw/boards.h if it's not really necessary 2021-05-02 17:24:51 +02:00
strongarm.h hw/arm/collie: Create the RAM in the board 2019-10-22 17:44:01 +01:00
sysbus-fdt.c arm: Eliminate all TPM related code if CONFIG_TPM is not set 2021-06-15 10:54:55 -04:00
tosa.c hw/ssi: Rename SSI 'slave' as 'peripheral' 2020-12-10 12:15:03 -05:00
trace-events docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
versatilepb.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
vexpress.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
virt-acpi-build.c hw/arm/virt-acpi-build: Add IORT support to bypass SMMUv3 2021-07-16 11:10:45 -04:00
virt.c hw/arm/virt: Add default_bus_bypass_iommu machine option 2021-07-16 11:10:45 -04:00
xilinx_zynq.c adc: Move the zynq-xadc file to the adc directories 2021-06-17 07:10:32 -05:00
xlnx-versal-virt.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
xlnx-versal.c hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
xlnx-zcu102.c Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
xlnx-zynqmp.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
z2.c hw/arm: Constify VMStateDescription 2021-05-02 17:24:50 +02:00