Re: [PATCHv6 1/5] Add a hostdev PCI backend type

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

 



Chunyan Liu wrote:
> Add VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN. For legacy xen, it will use "pciback" as
> stub driver.
>   

Sorry for the long delay in helping review these patches. I finally have
some time to work on libvirt :).

With the pending release, this series will have to wait for the next
cycle, but hopefully we can get it in early for prolonged testing. It
plugs a big hole in the libxl dirver, so thanks for your work and
perseverance :).

I've applied your patches to latest git master and testing looks good so
far, after fixing a small issue in 2/5. See the individual patches for
further comments.

> Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
> ---
>  docs/schemas/domaincommon.rng |    1 +
>  src/conf/domain_conf.c        |    3 ++-
>  src/conf/domain_conf.h        |    1 +
>  src/libxl/libxl_domain.c      |    9 +++++++++
>  src/qemu/qemu_command.c       |    3 +--
>  src/qemu/qemu_hotplug.c       |    4 +---
>  6 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 14b6700..c096c09 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -3318,6 +3318,7 @@
>              <choice>
>                <value>kvm</value>
>                <value>vfio</value>
> +              <value>xen</value>
>              </choice>
>            </attribute>
>            <empty/>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 51c4e29..3c87464 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -615,7 +615,8 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysPciBackend,
>                VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST,
>                "default",
>                "kvm",
> -              "vfio")
> +              "vfio",
> +              "xen")
>  
>  VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
>                "storage",
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 4520ae4..471c645 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -402,6 +402,7 @@ typedef enum {
>      VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, /* detect automaticaly, prefer VFIO */
>      VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM,    /* force legacy kvm style */
>      VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO,   /* force vfio */
> +    VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN,    /* force legacy xen style, use pciback */
>  
>      VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST
>  } virDomainHostdevSubsysPciBackendType;
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 68009db..32e798b 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -393,6 +393,15 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
>          STRNEQ(def->os.type, "hvm"))
>          dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
>  
> +    if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
> +        virDomainHostdevDefPtr hostdev = dev->data.hostdev;
> +
> +        if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
> +            hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
> +            hostdev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT)
> +            hostdev->source.subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
> +    }
> +
>      return 0;
>  }
>   

Shouldn't this hunk be in 3/5?

Regards,
Jim

>  
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 63e235d..2e3c2df 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -5500,8 +5500,7 @@ qemuBuildPCIHostdevDevStr(virDomainDefPtr def,
>          virBufferAddLit(&buf, "vfio-pci");
>          break;
>  
> -    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
> -    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
> +    default:
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("invalid PCI passthrough type '%s'"),
>                         virDomainHostdevSubsysPciBackendTypeToString(backend));
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index e9424d9..a72e1f1 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -1164,9 +1164,7 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
>  
>          break;
>  
> -    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
> -    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
> -    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
> +    default:
>          break;
>      }
>  
>   

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