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

Re: [PATCH 5/5] node_device: mdev vfio-ccw support



On Mon, Aug 24, 2020 at 01:59:15PM +0200, Bjoern Walk wrote:
> From: Boris Fiuczynski <fiuczy linux ibm com>
>
> Allow vfio-ccw mdev devices to be created besides vfio-pci mdev devices
> as well.
>
> Reviewed-by: Bjoern Walk <bwalk linux ibm com>
> Signed-off-by: Boris Fiuczynski <fiuczy linux ibm com>
> ---
>  src/conf/domain_addr.c               |  2 +-
>  src/conf/domain_addr.h               |  3 ++
>  src/libvirt_private.syms             |  1 +
>  src/node_device/node_device_driver.c | 49 +++++++++++++++++++++++-----
>  4 files changed, 45 insertions(+), 10 deletions(-)
[snip]

> @@ -639,22 +640,52 @@ nodeDeviceFindAddressByName(const char *name)
>
>      def = virNodeDeviceObjGetDef(dev);
>      for (caps = def->caps; caps != NULL; caps = caps->next) {
> -        if (caps->data.type == VIR_NODE_DEV_CAP_PCI_DEV) {
> -            virPCIDeviceAddress addr = {
> +        switch ((virNodeDevCapType) caps->data.type) {
> +        case VIR_NODE_DEV_CAP_PCI_DEV: {
> +            virPCIDeviceAddress pci_addr = {
>                  .domain = caps->data.pci_dev.domain,
>                  .bus = caps->data.pci_dev.bus,
>                  .slot = caps->data.pci_dev.slot,
>                  .function = caps->data.pci_dev.function
>              };
>
> -            pci_addr = virPCIDeviceAddressAsString(&addr);
> +            addr = virPCIDeviceAddressAsString(&pci_addr);
>              break;
>          }
> +        case VIR_NODE_DEV_CAP_CSS_DEV: {
> +            virDomainDeviceCCWAddress ccw_addr = {
> +                .cssid = caps->data.ccw_dev.cssid,
> +                .ssid = caps->data.ccw_dev.ssid,
> +                .devno = caps->data.ccw_dev.devno
> +            };
> +
> +            addr = virDomainCCWAddressAsString(&ccw_addr);
> +            break;
> +        }
> +
> +        case VIR_NODE_DEV_CAP_SYSTEM:
> +        case VIR_NODE_DEV_CAP_USB_DEV:
> +        case VIR_NODE_DEV_CAP_USB_INTERFACE:
> +        case VIR_NODE_DEV_CAP_NET:
> +        case VIR_NODE_DEV_CAP_SCSI_HOST:
> +        case VIR_NODE_DEV_CAP_SCSI_TARGET:
> +        case VIR_NODE_DEV_CAP_SCSI:
> +        case VIR_NODE_DEV_CAP_STORAGE:
> +        case VIR_NODE_DEV_CAP_FC_HOST:
> +        case VIR_NODE_DEV_CAP_VPORTS:
> +        case VIR_NODE_DEV_CAP_SCSI_GENERIC:
> +        case VIR_NODE_DEV_CAP_DRM:
> +        case VIR_NODE_DEV_CAP_MDEV_TYPES:
> +        case VIR_NODE_DEV_CAP_MDEV:
> +        case VIR_NODE_DEV_CAP_CCW_DEV:

What about ccw mdevs? I would think that it's CCW end point device that
we would want to assign concurrently, but we're only "slicing" the root channel
subsystem device. If you have and CSS mdev, are the CCW subchannels separate
for each VM or does it behave kind of like NPIV with its vHBAs? OR I'm
completely off here?

> +        case VIR_NODE_DEV_CAP_LAST:
> +            continue;
> +        }
>      }
>
>      virNodeDeviceObjEndAPI(&dev);
>
> -    return pci_addr;
> +    return addr;
>  }
>
>
> @@ -664,11 +695,11 @@ nodeDeviceGetMdevctlStartCommand(virNodeDeviceDefPtr def,
>  {
>      virCommandPtr cmd;
>      g_autofree char *json = NULL;
> -    g_autofree char *parent_pci = nodeDeviceFindAddressByName(def->parent);
> +    g_autofree char *parent_addr = nodeDeviceFindAddressByName(def->parent);
>
> -    if (!parent_pci) {
> +    if (!parent_addr) {
>          virReportError(VIR_ERR_NO_NODE_DEVICE,
> -                       _("unable to find PCI address for parent device '%s'"), def->parent);
> +                       _("unable to find address for parent device '%s'"), def->parent);

I'm wondering whether "unable to find parent device '%s'" would not suffice,
since we're not specifying what type of address we were not able to find - I'm
not even sure the address information is important at all.

Erik

>          return NULL;
>      }
>
> @@ -679,7 +710,7 @@ nodeDeviceGetMdevctlStartCommand(virNodeDeviceDefPtr def,
>      }
>
>      cmd = virCommandNewArgList(MDEVCTL, "start",
> -                               "-p", parent_pci,
> +                               "-p", parent_addr,
>                                 "--jsonfile", "/dev/stdin",
>                                 NULL);
>
> --
> 2.24.1
>


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