[libvirt] [PATCH 13/13] qemu: support new pci controller model "pcie-switch-downstream-port"

Alex Williamson alex.williamson at redhat.com
Tue Jun 23 15:35:46 UTC 2015


On Mon, 2015-06-22 at 14:44 -0400, Laine Stump wrote:
> This is backed by the qemu device xio3130-downstream. It can only be
> connected to a pcie-switch-upstream-port (x3130-upstream) on the
> upstream side.
> ---
>  src/qemu/qemu_command.c                                   | 15 +++++++++++++++
>  .../qemuxml2argv-pcie-switch-downstream-port.args         | 13 +++++++++++++
>  tests/qemuxml2argvtest.c                                  |  9 +++++++++
>  3 files changed, 37 insertions(+)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-switch-downstream-port.args
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index b4df65a..064adcb 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -2367,6 +2367,10 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
>                   */
>                  flags = VIR_PCI_CONNECT_TYPE_PCIE_ONLY;
>                  break;
> +            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
> +                /* pcie-switch-port can only plug into pcie-switch */
> +                flags = VIR_PCI_CONNECT_TYPE_PCIE_SWITCH;
> +                break;
>              default:
>                  flags = VIR_PCI_CONNECT_HOTPLUGGABLE | VIR_PCI_CONNECT_TYPE_PCI;
>                  break;
> @@ -4647,6 +4651,17 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
>              }
>              virBufferAsprintf(&buf, "x3130-upstream,id=%s", def->info.alias);
>              break;
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
> +            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM)) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                               _("The pcie-switch-downstream-port "
> +                                 "(xio3130-downstream) controller "
> +                                 "is not supported in this QEMU binary"));
> +                goto error;
> +            }
> +            virBufferAsprintf(&buf, "xio3130-downstream,port=1,chassis=%d,id=%s",
> +                              def->idx, def->info.alias);

And why put all the downstream switch ports on port=1?  I had suggested
the slot address would match what I see on physical hardware.  Is the
slot address not available at this point?  Thanks,

Alex

> +            break;
>          }
>          break;
>  
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-switch-downstream-port.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-switch-downstream-port.args
> new file mode 100644
> index 0000000..04b760c
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-switch-downstream-port.args
> @@ -0,0 +1,13 @@
> +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
> +/usr/libexec/qemu-kvm -S -M q35 -m 2048 -smp 2 -nographic -nodefaults \
> +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
> +-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
> +-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
> +-device x3130-upstream,id=pci.3,bus=pcie.0,addr=0x2 \
> +-device xio3130-downstream,port=1,chassis=4,id=pci.4,bus=pci.3,addr=0x1 \
> +-device xio3130-downstream,port=1,chassis=5,id=pci.5,bus=pci.3,addr=0x2 \
> +-device xio3130-downstream,port=1,chassis=6,id=pci.6,bus=pci.3,addr=0x3 \
> +-device xio3130-downstream,port=1,chassis=7,id=pci.7,bus=pci.3,addr=0x4 \
> +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \
> +-device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \
> +-vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index b15352e..fc16152 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -1477,6 +1477,15 @@ mymain(void)
>              QEMU_CAPS_DRIVE, QEMU_CAPS_ICH9_AHCI,
>              QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
>              QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
> +    DO_TEST("pcie-switch-downstream-port",
> +            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
> +            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
> +            QEMU_CAPS_DEVICE_IOH3420,
> +            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
> +            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
> +            QEMU_CAPS_DRIVE, QEMU_CAPS_ICH9_AHCI,
> +            QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
> +            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
>  
>      DO_TEST("hostdev-scsi-lsi", QEMU_CAPS_DRIVE,
>              QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,






More information about the libvir-list mailing list