Re: [PATCHv2 11/17] qemu: support new pci controller model "pcie-root-port"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 07/17/2015 02:43 PM, Laine Stump wrote:
> This is backed by the qemu device ioh3420.
> 
> chassis and port from the <model> subelement are used to store/set the
> respective qemu device options for the ioh3420. Currently, chassis is
> set to be the index of the controller, and port is set to
> "(slot << 3) + function" (per suggestion from Alex Williamson).
> ---
> src/qemu/qemu_command.c                            | 40 ++++++++++++++++++++++
>  .../qemuxml2argv-pcie-root-port.args               | 10 ++++++
>  tests/qemuxml2argvtest.c                           |  7 ++++
>  3 files changed, 57 insertions(+)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 53f5317..1b86f1d 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1598,6 +1598,12 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
>                   */
>                  flags = VIR_PCI_CONNECT_TYPE_PCIE;
>                  break;
> +            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
> +                /* pcie-root-port can only connect to pcie-root, isn't
> +                 * hot-pluggable
> +                 */
> +                flags = VIR_PCI_CONNECT_TYPE_PCIE_ROOT;
> +                break;
>              default:
>                  break;
>              }
> @@ -2268,6 +2274,13 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
>                          deviceName = "i82801b11-bridge";
>                      break;
>                  case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
> +                    if (!options->type)
> +                        deviceName = "ioh3420";
> +                    if (options->chassis == -1)
> +                       options->chassis = cont->idx;
> +                    if (options->port == -1)
> +                       options->port = (addr->slot << 3) + addr->function;
> +                    break;
>                  case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
>                  case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
>                  case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
> @@ -2382,6 +2395,10 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
>                   */
>                  flags = VIR_PCI_CONNECT_TYPE_PCIE;
>                  break;
> +            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
> +                /* pcie-root-port can only plug into pcie-root */
> +                flags = VIR_PCI_CONNECT_TYPE_PCIE_ROOT;
> +                break;
>              default:
>                  flags = VIR_PCI_CONNECT_HOTPLUGGABLE | VIR_PCI_CONNECT_TYPE_PCI;
>                  break;
> @@ -4687,6 +4704,29 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
>              virBufferAsprintf(&buf, "%s,id=%s",
>                                def->opts.pciopts.type, def->info.alias);
>              break;
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
> +            if (!def->opts.pciopts.type) {
> +                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                               _("autogenerated pcie-root-port options not set"));
> +                goto error;
> +            }
> +            if (STREQ(def->opts.pciopts.type, "ioh3420")) {
> +                if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IOH3420)) {
> +                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                                   _("the pcie-root-port (ioh3420) "
> +                                     "controller is not supported in this QEMU binary"));
> +                goto error;
> +                }
> +            } else {
> +                virReportError(VIR_ERR_INTERNAL_ERROR,
> +                               _("unknown pcie-root-port device '%s'"),
> +                               def->opts.pciopts.type);

Similar to 06/17

unknown pcii-root-port option model '%s'

ACK

John
> +                goto error;
> +            }
> +            virBufferAsprintf(&buf, "%s,port=0x%x,chassis=%d,id=%s",
> +                              def->opts.pciopts.type, def->opts.pciopts.port,
> +                              def->opts.pciopts.chassis, def->info.alias);
> +            break;
>          }
>          break;
>  
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args
> new file mode 100644
> index 0000000..5e4891c
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args
> @@ -0,0 +1,10 @@
> +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 ioh3420,port=0x10,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \
> +-device ioh3420,port=0x1a,chassis=40,id=pci.4,bus=pcie.0,addr=0x3 \
> +-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 f5cbe3a..0129717 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -1496,6 +1496,13 @@ 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-root-port",
> +            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
> +            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
> +            QEMU_CAPS_DEVICE_IOH3420,
> +            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,
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]