vfio: re-arrange vfio region definitions
Subsystems (2)
PATCH 1/1 vfio: re-arrange vfio region definitions
It is easy to miss already defined region types. Let's re-arrange the definitions a bit and add more comments to make it hopefully a bit clearer.
No functional change.
--- include/uapi/linux/vfio.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
include/uapi/linux/vfio.h +12 -7
@@ -295,15 +295,23 @@ struct vfio_region_info_cap_type {__u32 subtype;/* type specific */ }; +/* +* List of region types, global per bus driver. +* If you introduce a new type, please add it here. +*/ + +/* PCI region type containing a PCI vendor part */ #define VFIO_REGION_TYPE_PCI_VENDOR_TYPE (1 << 31)#define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff) +#define VFIO_REGION_TYPE_GFX (1) +#define VFIO_REGION_TYPE_CCW (2) -/* 8086 Vendor sub-types */ +/* 8086 vendor PCI sub-types */ #define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1)#define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2)#define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3) -#define VFIO_REGION_TYPE_GFX (1) +/* GFX sub-types */ #define VFIO_REGION_SUBTYPE_GFX_EDID (1)/**
@@ -353,20 +361,17 @@ struct vfio_region_gfx_edid {#define VFIO_DEVICE_GFX_LINK_STATE_DOWN 2 }; -#define VFIO_REGION_TYPE_CCW (2)/* ccw sub-types */ #define VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD (1) +/* 10de vendor PCI sub-types */ /* -* 10de vendor sub-type -* * NVIDIA GPU NVlink2 RAM is coherent RAM mapped onto the host address space. */ #define VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM (1) +/* 1014 vendor PCI sub-types*/ /* -* 1014 vendor sub-type -* * IBM NPU NVlink2 ATSD (Address Translation Shootdown) register of NPU * to do TLB invalidation on a GPU. */
Signature · 1 line
2.20.1
Quoted 10 lines · On Wed, 17 Jul 2019 13:49:56 +0200 Cornelia Huck <[email protected]> wrote:
It is easy to miss already defined region types. Let's re-arrange the definitions a bit and add more comments to make it hopefully a bit clearer.
No functional change.
Signed-off-by Cornelia Huck <[email protected]>--- include/uapi/linux/vfio.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
Friendly ping :)
Quoted 54 lines
include/uapi/linux/vfio.h +12
-7@@ -295,15 +295,23 @@ struct vfio_region_info_cap_type {__u32 subtype;/* type specific */ }; +/* +* List of region types, global per bus driver. +* If you introduce a new type, please add it here. +*/ + +/* PCI region type containing a PCI vendor part */ #define VFIO_REGION_TYPE_PCI_VENDOR_TYPE (1 << 31)#define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff) +#define VFIO_REGION_TYPE_GFX (1) +#define VFIO_REGION_TYPE_CCW (2) -/* 8086 Vendor sub-types */ +/* 8086 vendor PCI sub-types */ #define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1)#define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2)#define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3) -#define VFIO_REGION_TYPE_GFX (1) +/* GFX sub-types */ #define VFIO_REGION_SUBTYPE_GFX_EDID (1)/** @@ -353,20 +361,17 @@ struct vfio_region_gfx_edid {#define VFIO_DEVICE_GFX_LINK_STATE_DOWN 2 }; -#define VFIO_REGION_TYPE_CCW (2)/* ccw sub-types */ #define VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD (1) +/* 10de vendor PCI sub-types */ /* -* 10de vendor sub-type -* * NVIDIA GPU NVlink2 RAM is coherent RAM mapped onto the host address space. */ #define VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM (1) +/* 1014 vendor PCI sub-types*/ /* -* 1014 vendor sub-type -* * IBM NPU NVlink2 ATSD (Address Translation Shootdown) register of NPU * to do TLB invalidation on a GPU. */
Hi Connie,
Quoted 50 lines · Cornelia Huck
It is easy to miss already defined region types. Let's re-arrange the definitions a bit and add more comments to make it hopefully a bit clearer.
No functional change.
Signed-off-by Cornelia Huck <[email protected]>--- include/uapi/linux/vfio.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)include/uapi/linux/vfio.h +11
-3@@ -295,15 +295,23 @@ struct vfio_region_info_cap_type {__u32 subtype;/* type specific */ }; +/* +* List of region types, global per bus driver. +* If you introduce a new type, please add it here. +*/ + +/* PCI region type containing a PCI vendor part */ #define VFIO_REGION_TYPE_PCI_VENDOR_TYPE (1 << 31)#define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff) +#define VFIO_REGION_TYPE_GFX (1) +#define VFIO_REGION_TYPE_CCW (2) -/* 8086 Vendor sub-types */ +/* 8086 vendor PCI sub-types */ #define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1)#define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2)#define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3) -#define VFIO_REGION_TYPE_GFX (1) +/* GFX sub-types */ #define VFIO_REGION_SUBTYPE_GFX_EDID (1)/** @@ -353,20 +361,17 @@ struct vfio_region_gfx_edid {#define VFIO_DEVICE_GFX_LINK_STATE_DOWN 2 }; -#define VFIO_REGION_TYPE_CCW (2)/* ccw sub-types */ #define VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD (1) +/* 10de vendor PCI sub-types */
include/uapi/linux/vfio.h struct vfio_region_gfx_edid { · line 368
Quoted 10 lines
include/uapi/linux/vfio.h +1
-3/* -* 10de vendor sub-type -* * NVIDIA GPU NVlink2 RAM is coherent RAM mapped onto the host address space. */ #define VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM (1) +/* 1014 vendor PCI sub-types*/ /* -* 1014 vendor sub-type
Maybe the 10de vendor sub-type and 1014 vendor sub-type could be put just after /* 8086 vendor PCI sub-types */
More generally if it were possible to leave the subtypes close to their parent type too, this would be beneficial I think.
Besides that becomes sensible to put all those definitions together.
Thanks
Eric
Quoted 5 lines
include/uapi/linux/vfio.h +0
-1-* * IBM NPU NVlink2 ATSD (Address Translation Shootdown) register of NPU * to do TLB invalidation on a GPU. */
Quoted 66 lines · On Wed, 31 Jul 2019 20:47:07 +0200 Auger Eric <[email protected]> wrote:
Hi Connie,
Quoted 50 lines · Cornelia Huck
It is easy to miss already defined region types. Let's re-arrange the definitions a bit and add more comments to make it hopefully a bit clearer.
No functional change.
Signed-off-by Cornelia Huck <[email protected]>--- include/uapi/linux/vfio.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)include/uapi/linux/vfio.h +11
-3@@ -295,15 +295,23 @@ struct vfio_region_info_cap_type {__u32 subtype;/* type specific */ }; +/* +* List of region types, global per bus driver. +* If you introduce a new type, please add it here. +*/ + +/* PCI region type containing a PCI vendor part */ #define VFIO_REGION_TYPE_PCI_VENDOR_TYPE (1 << 31)#define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff) +#define VFIO_REGION_TYPE_GFX (1) +#define VFIO_REGION_TYPE_CCW (2) -/* 8086 Vendor sub-types */ +/* 8086 vendor PCI sub-types */ #define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1)#define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2)#define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3) -#define VFIO_REGION_TYPE_GFX (1) +/* GFX sub-types */ #define VFIO_REGION_SUBTYPE_GFX_EDID (1)/** @@ -353,20 +361,17 @@ struct vfio_region_gfx_edid {#define VFIO_DEVICE_GFX_LINK_STATE_DOWN 2 }; -#define VFIO_REGION_TYPE_CCW (2)/* ccw sub-types */ #define VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD (1) +/* 10de vendor PCI sub-types */ include/uapi/linux/vfio.h struct vfio_region_gfx_edid { · line 368
Quoted 10 lines
include/uapi/linux/vfio.h +1
-3/* -* 10de vendor sub-type -* * NVIDIA GPU NVlink2 RAM is coherent RAM mapped onto the host address space. */ #define VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM (1) +/* 1014 vendor PCI sub-types*/ /* -* 1014 vendor sub-type Maybe the 10de vendor sub-type and 1014 vendor sub-type could be put just after /* 8086 vendor PCI sub-types */
Quoted 4 lines
More generally if it were possible to leave the subtypes close to their parent type too, this would be beneficial I think.
Besides that becomes sensible to put all those definitions together.
Any sort of consolidation or grouping is an improvement here, thanks for taking this on, Connie! I haven't started my branch yet for v5.4, but if you want to iterate to something agreeable, I'll happily take the end product :) The original patch here looks like a good degree of consolidating the type definitions and improving consistency without moving large chunks of code. Thanks,
Alex