[RFC: vf-token 3/5] conf: vf-token flag

Vivek Kashyap posted 5 patches 2 years, 4 months ago
There is a newer version of this series
[RFC: vf-token 3/5] conf: vf-token flag
Posted by Vivek Kashyap 2 years, 4 months ago
Define PCI address extension flag for vf-token

Signed-off-by: Vivek Kashyap <vivek.kashyap@linux.intel.com>
---
 src/conf/device_conf.h         | 3 +++
 src/conf/domain_addr.h         | 1 +
 src/qemu/qemu_domain_address.c | 3 +++
 3 files changed, 7 insertions(+)

diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index a83377417a..29e03baa99 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -188,6 +188,9 @@ bool virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *info);
 int virPCIDeviceAddressParseXML(xmlNodePtr node,
                                 virPCIDeviceAddress *addr);
 
+int virPCIDeviceTokenParseXML(xmlNodePtr node,
+                                virPCIDeviceAddress *addr);
+
 void virPCIDeviceAddressFormat(virBuffer *buf,
                                virPCIDeviceAddress addr,
                                bool includeTypeInAddr);
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index e72fb48847..bca96ee797 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -29,6 +29,7 @@
 typedef enum {
     VIR_PCI_ADDRESS_EXTENSION_NONE = 0, /* no extension */
     VIR_PCI_ADDRESS_EXTENSION_ZPCI = 1 << 0, /* zPCI support */
+    VIR_PCI_ADDRESS_EXTENSION_VFTOKEN = 1 << 1, /* Token support */
 } virPCIDeviceAddressExtensionFlags;
 
 typedef enum {
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 099778b2a8..3be5acbc9e 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -575,6 +575,9 @@ qemuDomainDeviceCalculatePCIAddressExtensionFlags(virQEMUCaps *qemuCaps,
         extFlags |= VIR_PCI_ADDRESS_EXTENSION_ZPCI;
     }
 
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VFIO_VFTOKEN))
+        extFlags |= VIR_PCI_ADDRESS_EXTENSION_VFTOKEN;
+
     return extFlags;
 }
 
-- 
2.25.1
Re: [RFC: vf-token 3/5] conf: vf-token flag
Posted by Peter Krempa 2 years, 4 months ago
On Thu, Oct 05, 2023 at 16:05:02 -0700, Vivek Kashyap wrote:
> Define PCI address extension flag for vf-token
> 
> Signed-off-by: Vivek Kashyap <vivek.kashyap@linux.intel.com>
> ---
>  src/conf/device_conf.h         | 3 +++
>  src/conf/domain_addr.h         | 1 +
>  src/qemu/qemu_domain_address.c | 3 +++
>  3 files changed, 7 insertions(+)
> 
> diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
> index a83377417a..29e03baa99 100644
> --- a/src/conf/device_conf.h
> +++ b/src/conf/device_conf.h
> @@ -188,6 +188,9 @@ bool virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *info);
>  int virPCIDeviceAddressParseXML(xmlNodePtr node,
>                                  virPCIDeviceAddress *addr);
>  
> +int virPCIDeviceTokenParseXML(xmlNodePtr node,
> +                                virPCIDeviceAddress *addr);

Broken alignment of the second line. And same as in 1/5 the function is
not used here so don't define it in this patch.