Re: [PATCH v2 0/2] Attach DT nodes to existing PCI devices

Bjorn Helgaas
2023-12-01T22:46:02Z

On Fri, Dec 01, 2023 at 04:26:45PM -0600, Rob Herring wrote:
> On Thu, Nov 30, 2023 at 10:57 AM Herve Codina <herve.codina@bootlin.com> wrote:
> ...

> Also, no idea if the bridge part works because my qemu setup doesn't
> create bridges (anyone got a magic cmdline to create them?).

I probably copied this from somewhere and certainly couldn't construct
it from scratch, but it did create a hierarchy like this:

00:04.0 bridge to [bus 01-04] (Root Port)
01:00.0 bridge to [bus 02-04] (Switch Upstream Port)
02:00.0 bridge to [bus 03] (Switch Downstream Port)
02:01.0 bridge to [bus 04] (Switch Downstream Port)
03:00.0 endpoint
04:00.0 endpoint

IMAGE=ubuntu.img
KERNEL=~/linux/arch/x86/boot/bzImage
IMGDIR=~/virt/img/

qemu-system-x86_64 -enable-kvm -s -m 2048 $IMAGE \
-device pcie-root-port,id=root_port1,chassis=1,slot=1 \
-device x3130-upstream,id=upstream_port1,bus=root_port1 \
-device xio3130-downstream,id=downstream_port1,bus=upstream_port1,chassis=2,slot=1 \
-device xio3130-downstream,id=downstream_port2,bus=upstream_port1,chassis=2,slot=2 \
-drive file=${IMGDIR}/nvme.qcow2,if=none,id=nvme1,snapshot=on \
-device nvme,drive=nvme1,serial=nvme1,cmb_size_mb=2048,bus=downstream_port1 \
-drive file=${IMGDIR}/nvme2.qcow2,if=none,id=nvme2,snapshot=on \
-device nvme,drive=nvme2,serial=nvme1,bus=downstream_port2 \
-virtfs local,id=home,path=/home/,security_model=mapped,mount_tag=home \
-nographic \
-kernel $KERNEL \
-append "root=/dev/sda2 rootfstype=ext4 console=ttyS0,38400n8"