qemu-patch-raspberry4/hw
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
..
9pfs 9pfs: reduce latency of Twalk 2021-07-05 13:03:16 +02:00
acpi hw/acpi/ich9: Set ACPI PCI hot-plug as default on Q35 2021-07-16 04:34:22 -04:00
adc adc: Move the max111x driver to the adc directory 2021-06-17 07:10:32 -05:00
alpha hw/alpha: Provide a PCI-ISA bridge device node 2021-06-28 07:27:32 -07:00
arm hw/arm/virt-acpi-build: Add IORT support to bypass SMMUv3 2021-07-16 11:10:45 -04:00
audio hw/audio/sb16: Restrict I/O sampling rate range for command 41h/42h 2021-06-24 11:42:54 +02:00
avr hw/avr/atmega.c: use the avr51 cpu for atmega1280 2021-05-13 19:11:42 +02:00
block pc,pci,virtio: bugfixes, improvements 2021-07-09 14:30:01 +01:00
char hw/char/ibex_uart: Make the register layout private 2021-06-24 05:00:12 -07:00
core hw/pci/pcie: Do not set HPC flag if acpihp is used 2021-07-16 04:33:35 -04:00
cpu cpu/core: Fix "help" of CPU core device types 2021-04-09 16:05:16 -04:00
cris Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
display * More SVM fixes (Lara) 2021-07-11 22:20:51 +01:00
dma docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
gpio hw/gpio/pl061: Document a shortcoming in our implementation 2021-07-09 16:09:12 +01:00
hppa docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
hyperv vmbus: Don't make QOM property registration conditional 2021-07-06 18:04:38 -04:00
i2c hw/i2c: add support for PMBus 2021-07-08 14:15:45 -05:00
i386 hw/i386: Add a default_bus_bypass_iommu pc machine option 2021-07-16 11:10:45 -04:00
ide docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
input Some qemu updates for IPMI and I2C 2021-07-11 14:32:49 +01:00
intc s390x updates: 2021-07-12 19:15:11 +01:00
ipack Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
ipmi ipmi/sim: fix watchdog_expired data type error in IPMIBmcSim struct 2021-07-08 14:15:01 -05:00
isa hw/block/fdc: Extract ISA floppy controllers to fdc-isa.c 2021-06-25 08:53:28 -04:00
m68k hw/m68k/q800: fix PROM checksum and MAC address storage 2021-07-02 17:35:08 +02:00
mem docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
microblaze Do not include sysemu/sysemu.h if it's not really necessary 2021-05-02 17:24:50 +02:00
mips hw/mips/jazz: Map the UART devices unconditionally 2021-07-02 17:35:08 +02:00
misc Some qemu updates for IPMI and I2C 2021-07-11 14:32:49 +01:00
net net/rocker: use GDateTime for formatting timestamp in debug messages 2021-07-14 14:15:52 +01:00
nios2 Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
nubus hw: Do not include hw/sysbus.h if it is not necessary 2021-05-02 17:24:50 +02:00
nvme hw/nvme: fix pin-based interrupt behavior (again) 2021-06-29 07:18:10 +02:00
nvram docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
openrisc Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
pci hw/pci: Add pci_bus_range() to get PCI bus number range 2021-07-16 11:10:45 -04:00
pci-bridge hw/pxb: Add a bypass iommu property 2021-07-16 11:10:45 -04:00
pci-host hw/i386: Add a default_bus_bypass_iommu pc machine option 2021-07-16 11:10:45 -04:00
pcmcia hw/pcmcia: Do not register PCMCIA type if not required 2021-05-02 17:24:50 +02:00
ppc ppc/pegasos2: Allow setprop in VOF 2021-07-13 10:04:30 +10:00
rdma pvrdma: Fix the ring init error flow (CVE-2021-3608) 2021-07-04 22:47:51 +03:00
remote multi-process: Initialize variables declared with g_auto* 2021-05-21 15:43:57 +01:00
riscv hw/riscv: OpenTitan: Connect the mtime and mtimecmp timer 2021-06-24 05:00:13 -07:00
rtc docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
rx hw/rx/rx-gdbsim: Do not accept invalid memory size 2021-05-03 10:07:41 +02:00
s390x s390x updates: 2021-07-12 19:15:11 +01:00
scsi virtio: Clarify MR transaction optimization 2021-07-02 11:13:39 -04:00
sd hw/sd/sdcard: Check for valid address range in SEND_WRITE_PROT (CMD30) 2021-07-12 12:27:38 +02:00
sensor hw/misc: add MAX34451 device 2021-07-08 14:42:00 -05:00
sh4 Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
smbios hw/smbios: support for type 41 (onboard devices extended information) 2021-05-14 10:26:18 -04:00
sparc hw/block/fdc: Extract SysBus floppy controllers to fdc-sysbus.c 2021-06-25 08:53:28 -04:00
sparc64 hw/block/fdc: Extract ISA floppy controllers to fdc-isa.c 2021-06-25 08:53:28 -04:00
ssi Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
timer hw/timer: Initial commit of Ibex Timer 2021-06-24 05:00:12 -07:00
tpm docs: fix references to docs/specs/tpm.rst 2021-06-02 06:51:09 +02:00
tricore hw/tricore: Add testdevice for tests in tests/tcg/ 2021-05-18 09:36:21 +01:00
usb * More SVM fixes (Lara) 2021-07-11 22:20:51 +01:00
vfio vfio/pci: Add pba_offset PCI quirk for BAIDU KUNLUN AI processor 2021-07-14 13:47:17 -06:00
virtio hw/virtio: add vhost-user-i2c-pci boilerplate 2021-07-16 11:10:45 -04:00
watchdog docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
xen docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
xenpv meson: convert hw/arch* 2020-08-21 06:30:33 -04:00
xtensa Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
Kconfig sensor: Move hardware sensors from misc to a sensor directory 2021-06-17 07:10:32 -05:00
meson.build sensor: Move hardware sensors from misc to a sensor directory 2021-06-17 07:10:32 -05:00