Re: [PATCH v3 3/5] qemu: build command line for pci-bridge device

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

 



On 04/22/2013 02:43 PM, Ján Tomko wrote:
> From: liguang <lig.fnst@xxxxxxxxxxxxxx>


Add a "Signed-off-by:" line for yourself.


>
> ---
>  src/qemu/qemu_capabilities.c |  3 +++
>  src/qemu/qemu_capabilities.h |  1 +
>  src/qemu/qemu_command.c      | 30 +++++++++++++++++++++++++++++-
>  tests/qemuhelptest.c         | 21 ++++++++++++++-------
>  4 files changed, 47 insertions(+), 8 deletions(-)
>
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index ef291c0..31e56fa 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -220,6 +220,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
>                "machine-usb-opt",
>                "tpm-passthrough",
>                "tpm-tis",
> +
> +              "pci-bridge", /* 140 */
>      );
>  
>  struct _virQEMUCaps {
> @@ -1347,6 +1349,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
>      { "virtio-rng-ccw", QEMU_CAPS_DEVICE_VIRTIO_RNG },
>      { "rng-random", QEMU_CAPS_OBJECT_RNG_RANDOM },
>      { "rng-egd", QEMU_CAPS_OBJECT_RNG_EGD },
> +    { "pci-bridge", QEMU_CAPS_DEVICE_PCI_BRIDGE },
>  };
>  
>  static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
> diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
> index 4e76799..9c11157 100644
> --- a/src/qemu/qemu_capabilities.h
> +++ b/src/qemu/qemu_capabilities.h
> @@ -178,6 +178,7 @@ enum virQEMUCapsFlags {
>      QEMU_CAPS_MACHINE_USB_OPT    = 137, /* -machine xxx,usb=on/off */
>      QEMU_CAPS_DEVICE_TPM_PASSTHROUGH = 138, /* -tpmdev passthrough */
>      QEMU_CAPS_DEVICE_TPM_TIS     = 139, /* -device tpm_tis */
> +    QEMU_CAPS_DEVICE_PCI_BRIDGE  = 140, /* -device pci-bridge */
>  
>      QEMU_CAPS_LAST,                   /* this must always be the last item */
>  };
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 37a961d..f052a91 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -3606,6 +3606,24 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
>  
>          break;
>  
> +    case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
> +        switch (def->model) {
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
> +            if (def->idx == 0) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                               _("PCI bridge index should be > 0"));
> +                goto error;
> +            }
> +            virBufferAsprintf(&buf, "pci-bridge,chassis_nr=%d,id=pci.%d",
> +                              def->idx, def->idx);
> +            break;
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
> +            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                           _("wrong function called for pci-root"));
> +            return NULL;
> +        }
> +        break;
> +
>      /* We always get an IDE controller, whether we want it or not. */
>      case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
>      default:
> @@ -5791,7 +5809,11 @@ qemuBuildCommandLine(virConnectPtr conn,
>      int contOrder[] = {
>          /* We don't add an explicit IDE or FD controller because the
>           * provided PIIX4 device already includes one. It isn't possible to
> -         * remove the PIIX4. */
> +         * remove the PIIX4.
> +         *
> +         * We don't add PCI root controller either, because it's implicit,
> +         * but we do add PCI bridges. */


"because it's implicit in the machinetype".

Move the closing */ down to the next line.


> +        VIR_DOMAIN_CONTROLLER_TYPE_PCI,
>          VIR_DOMAIN_CONTROLLER_TYPE_USB,
>          VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
>          VIR_DOMAIN_CONTROLLER_TYPE_SATA,
> @@ -6405,6 +6427,12 @@ qemuBuildCommandLine(virConnectPtr conn,
>                      continue;
>                  }
>  
> +                /* Skip pci-root */
> +                if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
> +                    cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) {
> +                    continue;
> +                }
> +
>                  /* Only recent QEMU implements a SATA (AHCI) controller */
>                  if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
>                      if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
> diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
> index 7290183..eeba4d4 100644
> --- a/tests/qemuhelptest.c
> +++ b/tests/qemuhelptest.c
> @@ -398,7 +398,8 @@ mymain(void)
>              QEMU_CAPS_DEVICE_CIRRUS_VGA,
>              QEMU_CAPS_DEVICE_VMWARE_SVGA,
>              QEMU_CAPS_DEVICE_USB_SERIAL,
> -            QEMU_CAPS_DEVICE_USB_NET);
> +            QEMU_CAPS_DEVICE_USB_NET,
> +            QEMU_CAPS_DEVICE_PCI_BRIDGE);
>      DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0,
>              QEMU_CAPS_VNC_COLON,
>              QEMU_CAPS_NO_REBOOT,
> @@ -507,7 +508,8 @@ mymain(void)
>              QEMU_CAPS_DEVICE_CIRRUS_VGA,
>              QEMU_CAPS_DEVICE_VMWARE_SVGA,
>              QEMU_CAPS_DEVICE_USB_SERIAL,
> -            QEMU_CAPS_DEVICE_USB_NET);
> +            QEMU_CAPS_DEVICE_USB_NET,
> +            QEMU_CAPS_DEVICE_PCI_BRIDGE);
>      DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
>              QEMU_CAPS_VNC_COLON,
>              QEMU_CAPS_NO_REBOOT,
> @@ -572,7 +574,8 @@ mymain(void)
>              QEMU_CAPS_DEVICE_CIRRUS_VGA,
>              QEMU_CAPS_DEVICE_VMWARE_SVGA,
>              QEMU_CAPS_DEVICE_USB_SERIAL,
> -            QEMU_CAPS_DEVICE_USB_NET);
> +            QEMU_CAPS_DEVICE_USB_NET,
> +            QEMU_CAPS_DEVICE_PCI_BRIDGE);
>      DO_TEST("qemu-kvm-0.12.1.2-rhel62-beta", 12001, 1, 0,
>              QEMU_CAPS_VNC_COLON,
>              QEMU_CAPS_NO_REBOOT,
> @@ -644,7 +647,8 @@ mymain(void)
>              QEMU_CAPS_VNC,
>              QEMU_CAPS_DEVICE_QXL,
>              QEMU_CAPS_DEVICE_VGA,
> -            QEMU_CAPS_DEVICE_CIRRUS_VGA);
> +            QEMU_CAPS_DEVICE_CIRRUS_VGA,
> +            QEMU_CAPS_DEVICE_PCI_BRIDGE);
>      DO_TEST("qemu-1.0", 1000000, 0, 0,
>              QEMU_CAPS_VNC_COLON,
>              QEMU_CAPS_NO_REBOOT,
> @@ -816,7 +820,8 @@ mymain(void)
>              QEMU_CAPS_DEVICE_USB_SERIAL,
>              QEMU_CAPS_DEVICE_USB_NET,
>              QEMU_CAPS_DTB,
> -            QEMU_CAPS_IPV6_MIGRATION);
> +            QEMU_CAPS_IPV6_MIGRATION,
> +            QEMU_CAPS_DEVICE_PCI_BRIDGE);
>      DO_TEST("qemu-1.2.0", 1002000, 0, 0,
>              QEMU_CAPS_VNC_COLON,
>              QEMU_CAPS_NO_REBOOT,
> @@ -919,7 +924,8 @@ mymain(void)
>              QEMU_CAPS_DEVICE_USB_NET,
>              QEMU_CAPS_DTB,
>              QEMU_CAPS_SCSI_MEGASAS,
> -            QEMU_CAPS_IPV6_MIGRATION);
> +            QEMU_CAPS_IPV6_MIGRATION,
> +            QEMU_CAPS_DEVICE_PCI_BRIDGE);
>      DO_TEST("qemu-kvm-1.2.0", 1002000, 1, 0,
>              QEMU_CAPS_VNC_COLON,
>              QEMU_CAPS_NO_REBOOT,
> @@ -1027,7 +1033,8 @@ mymain(void)
>              QEMU_CAPS_DEVICE_USB_NET,
>              QEMU_CAPS_DTB,
>              QEMU_CAPS_SCSI_MEGASAS,
> -            QEMU_CAPS_IPV6_MIGRATION);
> +            QEMU_CAPS_IPV6_MIGRATION,
> +            QEMU_CAPS_DEVICE_PCI_BRIDGE);
>  
>      return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
>  }

ACK

--
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]