vfio: pci: make "vfio-pci-nohotplug" as MACRO
PATCH 1/4 vfio: pci: make "vfio-pci-nohotplug" as MACRO
--- hw/vfio/pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/vfio/pci.c +4 -2
@@ -40,6 +40,8 @@#define TYPE_VFIO_PCI "vfio-pci"#define PCI_VFIO (obj) OBJECT_CHECK(VFIOPCIDevice, obj, TYPE_VFIO_PCI) +#define TYPE_VIFO_PCI_NOHOTPLUG "vfio-pci-nohotplug" +static void vfio_disable_interrupts (VFIOPCIDevice *vdev);static void vfio_mmap_set_enabled (VFIOPCIDevice *vdev,bool enabled);
@@ -3304,8 +3306,8 @@ static void vfio_pci_nohotplug_dev_class_init(ObjectClass *klass, void *data) }static const TypeInfo vfio_pci_nohotplug_dev_info = { - .name ="vfio-pci-nohotplug" , - .parent ="vfio-pci" , + .name =TYPE_VIFO_PCI_NOHOTPLUG , + .parent =TYPE_VFIO_PCI , .instance_size =sizeof (VFIOPCIDevice), .class_init = vfio_pci_nohotplug_dev_class_init, };
Signature · 1 line
2.17.1
PATCH 2/4 hw: vfio: drop TYPE_FOO MACRO in VMStateDescription
As the vmstate structure names aren't related with the QOM type names.
--- hw/vfio/amd-xgbe.c | 2 +- hw/vfio/ap.c | 2 +- hw/vfio/calxeda-xgmac.c | 2 +- hw/vfio/ccw.c | 2 +- hw/vfio/platform.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
hw/vfio/amd-xgbe.c +1 -1
@@ -26,7 +26,7 @@ static void amd_xgbe_realize(DeviceState *dev, Error **errp) }static const VMStateDescription vfio_platform_amd_xgbe_vmstate = { - .name =TYPE_VFIO_AMD_XGBE , + .name ="vfio-amd-xgbe" , .unmigratable =1 , };
hw/vfio/ap.c +1 -1
@@ -155,7 +155,7 @@ static void vfio_ap_reset(DeviceState *dev) }static const VMStateDescription vfio_ap_vmstate = { - .name =VFIO_AP_DEVICE_TYPE , + .name ="vfio-ap" , .unmigratable =1 , };
hw/vfio/calxeda-xgmac.c +1 -1
@@ -26,7 +26,7 @@ static void calxeda_xgmac_realize(DeviceState *dev, Error **errp) }static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate = { - .name =TYPE_VFIO_CALXEDA_XGMAC , + .name ="vfio-calxeda-xgmac" , .unmigratable =1 , };
hw/vfio/ccw.c +1 -1
@@ -468,7 +468,7 @@ static Property vfio_ccw_properties[] = { };static const VMStateDescription vfio_ccw_vmstate = { - .name =TYPE_VFIO_CCW , + .name ="vfio-ccw" , .unmigratable =1 , };
hw/vfio/platform.c +1 -1
@@ -697,7 +697,7 @@ out: }static const VMStateDescription vfio_platform_vmstate = { - .name =TYPE_VFIO_PLATFORM , + .name ="vfio-platform" , .unmigratable =1 , };
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 2/4] hw: vfio: drop TYPE_FOO MACRO in VMStateDescription
Quoted 2 lines · On Fri, 17 May 2019 20:28:09 -0700 Li Qiang <[email protected]> wrote:
As the vmstate structure names aren't related with the QOM type names.
Seems contrary to the first patch in the series.
Quoted 75 lines
Signed-off-by Li Qiang <[email protected]>--- hw/vfio/amd-xgbe.c | 2 +- hw/vfio/ap.c | 2 +- hw/vfio/calxeda-xgmac.c | 2 +- hw/vfio/ccw.c | 2 +- hw/vfio/platform.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)hw/vfio/amd-xgbe.c +1
-1@@ -26,7 +26,7 @@ static void amd_xgbe_realize(DeviceState *dev, Error **errp) }static const VMStateDescription vfio_platform_amd_xgbe_vmstate = { - .name =TYPE_VFIO_AMD_XGBE , + .name ="vfio-amd-xgbe" , .unmigratable =1 , };hw/vfio/ap.c +1
-1@@ -155,7 +155,7 @@ static void vfio_ap_reset(DeviceState *dev) }static const VMStateDescription vfio_ap_vmstate = { - .name =VFIO_AP_DEVICE_TYPE , + .name ="vfio-ap" , .unmigratable =1 , };hw/vfio/calxeda-xgmac.c +1
-1@@ -26,7 +26,7 @@ static void calxeda_xgmac_realize(DeviceState *dev, Error **errp) }static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate = { - .name =TYPE_VFIO_CALXEDA_XGMAC , + .name ="vfio-calxeda-xgmac" , .unmigratable =1 , };hw/vfio/ccw.c +1
-1@@ -468,7 +468,7 @@ static Property vfio_ccw_properties[] = { };static const VMStateDescription vfio_ccw_vmstate = { - .name =TYPE_VFIO_CCW , + .name ="vfio-ccw" , .unmigratable =1 , };hw/vfio/platform.c +1
-1@@ -697,7 +697,7 @@ out: }static const VMStateDescription vfio_platform_vmstate = { - .name =TYPE_VFIO_PLATFORM , + .name ="vfio-platform" , .unmigratable =1 , };
Re: [Qemu-devel] [PATCH 2/4] hw: vfio: drop TYPE_FOO MACRO in VMStateDescription
Quoted 9 lines · Alex Williamson <[email protected]> 于2019年5月18日周六 下午10:20写道:
Quoted 2 lines · On Fri, 17 May 2019 20:28:09 -0700 Li Qiang <[email protected]> wrote:
As the vmstate structure names aren't related with the QOM type names.
Seems contrary to the first patch in the series.
No, once there is a discussion of this:
-->https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg02175.html
Thanks,
Li Qiang
Quoted 79 lines
hw/vfio/amd-xgbe.c static void amd_xgbe_realize(DeviceState *dev, Error
Quoted 15 lines
Signed-off-by Li Qiang <[email protected]>--- hw/vfio/amd-xgbe.c | 2 +- hw/vfio/ap.c | 2 +- hw/vfio/calxeda-xgmac.c | 2 +- hw/vfio/ccw.c | 2 +- hw/vfio/platform.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)hw/vfio/amd-xgbe.c +0
-0@@ -26,7 +26,7 @@ static void amd_xgbe_realize(DeviceState *dev, Error**errp)
hw/vfio/calxeda-xgmac.c static void calxeda_xgmac_realize(DeviceState *dev,
Quoted 26 lines
hw/vfio/amd-xgbe.c +1
-1}static const VMStateDescription vfio_platform_amd_xgbe_vmstate = { - .name =TYPE_VFIO_AMD_XGBE , + .name ="vfio-amd-xgbe" , .unmigratable =1 , };hw/vfio/ap.c +1
-1@@ -155,7 +155,7 @@ static void vfio_ap_reset(DeviceState *dev) }static const VMStateDescription vfio_ap_vmstate = { - .name =VFIO_AP_DEVICE_TYPE , + .name ="vfio-ap" , .unmigratable =1 , };hw/vfio/calxeda-xgmac.c +0
-0@@ -26,7 +26,7 @@ static void calxeda_xgmac_realize(DeviceState *dev,Error **errp)
Quoted 34 lines
hw/vfio/calxeda-xgmac.c +1
-1}static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate = { - .name =TYPE_VFIO_CALXEDA_XGMAC , + .name ="vfio-calxeda-xgmac" , .unmigratable =1 , };hw/vfio/ccw.c +1
-1@@ -468,7 +468,7 @@ static Property vfio_ccw_properties[] = { };static const VMStateDescription vfio_ccw_vmstate = { - .name =TYPE_VFIO_CCW , + .name ="vfio-ccw" , .unmigratable =1 , };hw/vfio/platform.c +1
-1@@ -697,7 +697,7 @@ out: }static const VMStateDescription vfio_platform_vmstate = { - .name =TYPE_VFIO_PLATFORM , + .name ="vfio-platform" , .unmigratable =1 , };
Re: [Qemu-devel] [PATCH 2/4] hw: vfio: drop TYPE_FOO MACRO in VMStateDescription
Quoted 5 lines · On Mon, 20 May 2019 09:29:21 +0800 Li Qiang <[email protected]> wrote:
Quoted 3 lines · Alex Williamson <[email protected]> 于2019年5月18日周六 下午10:20写道:
On Fri, 17 May 2019 20:28:09 -0700
Li Qiang <[email protected]> wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
As the vmstate structure names aren't related with the QOM type names.
Seems contrary to the first patch in the series.
No, once there is a discussion of this:
-->https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg02175.html
Ok, then rather than the commit log above, it would be more useful (at least to me) to state:
It's recommended that VMStateDescription names are decoupled from QOM type names as the latter may freely change without consideration of migration compatibility.
Otherwise this appears as a rather arbitrary change. Thanks,
Alex
Quoted 79 lines
Quoted 79 lines
hw/vfio/amd-xgbe.c static void amd_xgbe_realize(DeviceState *dev, Error
Quoted 15 lines
Signed-off-by Li Qiang <[email protected]>--- hw/vfio/amd-xgbe.c | 2 +- hw/vfio/ap.c | 2 +- hw/vfio/calxeda-xgmac.c | 2 +- hw/vfio/ccw.c | 2 +- hw/vfio/platform.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)hw/vfio/amd-xgbe.c +0
-0@@ -26,7 +26,7 @@ static void amd_xgbe_realize(DeviceState *dev, Error**errp)
hw/vfio/calxeda-xgmac.c static void calxeda_xgmac_realize(DeviceState *dev,
Quoted 26 lines
hw/vfio/amd-xgbe.c +1
-1}static const VMStateDescription vfio_platform_amd_xgbe_vmstate = { - .name =TYPE_VFIO_AMD_XGBE , + .name ="vfio-amd-xgbe" , .unmigratable =1 , };hw/vfio/ap.c +1
-1@@ -155,7 +155,7 @@ static void vfio_ap_reset(DeviceState *dev) }static const VMStateDescription vfio_ap_vmstate = { - .name =VFIO_AP_DEVICE_TYPE , + .name ="vfio-ap" , .unmigratable =1 , };hw/vfio/calxeda-xgmac.c +0
-0@@ -26,7 +26,7 @@ static void calxeda_xgmac_realize(DeviceState *dev,Error **errp)
Quoted 34 lines
hw/vfio/calxeda-xgmac.c +1
-1}static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate = { - .name =TYPE_VFIO_CALXEDA_XGMAC , + .name ="vfio-calxeda-xgmac" , .unmigratable =1 , };hw/vfio/ccw.c +1
-1@@ -468,7 +468,7 @@ static Property vfio_ccw_properties[] = { };static const VMStateDescription vfio_ccw_vmstate = { - .name =TYPE_VFIO_CCW , + .name ="vfio-ccw" , .unmigratable =1 , };hw/vfio/platform.c +1
-1@@ -697,7 +697,7 @@ out: }static const VMStateDescription vfio_platform_vmstate = { - .name =TYPE_VFIO_PLATFORM , + .name ="vfio-platform" , .unmigratable =1 , };
PATCH 3/4 vfio: platform: fix a typo
In reply to Li Qiang--- hw/vfio/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/vfio/platform.c +2 -2
@@ -72,7 +72,7 @@ static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,g_free (intp->interrupt);g_free (intp);error_setg_errno (errp, -ret, -"failed to initialize trigger eventd notifier" ); +"failed to initialize trigger eventfd notifier" );return NULL ; }if (vfio_irq_is_automasked (intp)) {
@@ -84,7 +84,7 @@ static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,g_free (intp->unmask);g_free (intp);error_setg_errno (errp, -ret, -"failed to initialize resample eventd notifier" ); +"failed to initialize resample eventfd notifier" );return NULL ; } }
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 3/4] vfio: platform: fix a typo
On Fri, 17 May 2019 20:28:10 -0700
Li Qiang <[email protected]> wrote:
An actual trivial patch, but it could still use a commit message.
Quoted 28 lines
Signed-off-by Li Qiang <[email protected]>--- hw/vfio/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/vfio/platform.c +2
-2@@ -72,7 +72,7 @@ static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,g_free (intp->interrupt);g_free (intp);error_setg_errno (errp, -ret, -"failed to initialize trigger eventd notifier" ); +"failed to initialize trigger eventfd notifier" );return NULL ; }if (vfio_irq_is_automasked (intp)) {@@ -84,7 +84,7 @@ static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,g_free (intp->unmask);g_free (intp);error_setg_errno (errp, -ret, -"failed to initialize resample eventd notifier" ); +"failed to initialize resample eventfd notifier" );return NULL ; } }
PATCH 4/4 pci: msix: move 'MSIX_CAP_LENGTH' to header file
In reply to Li Qiang--- hw/pci/msix.c | 2 -- hw/vfio/pci.c | 2 -- include/hw/pci/msix.h | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-)
hw/pci/msix.c +0 -2
@@ -24,8 +24,6 @@#include "qapi/error.h" #include "trace.h" -#define MSIX_CAP_LENGTH 12 -/* MSI enable bit and maskall bit are in byte 1 in FLAGS register */ #define MSIX_CONTROL_OFFSET (PCI_MSIX_FLAGS + 1)#define MSIX_ENABLE_MASK (PCI_MSIX_FLAGS_ENABLE >> 8)
hw/vfio/pci.c +0 -2
@@ -35,8 +35,6 @@#include "trace.h" #include "qapi/error.h" -#define MSIX_CAP_LENGTH 12 -#define TYPE_VFIO_PCI "vfio-pci"#define PCI_VFIO (obj) OBJECT_CHECK(VFIOPCIDevice, obj, TYPE_VFIO_PCI)
include/hw/pci/msix.h +2 -0
@@ -4,6 +4,8 @@#include "qemu-common.h" #include "hw/pci/pci.h" +#define MSIX_CAP_LENGTH 12 +void msix_set_message (PCIDevice *dev,int vector,MSIMessage msg);MSIMessage msix_get_message (PCIDevice *dev,unsigned int vector); int msix_init(PCIDevice *dev, unsigned short nentries,
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 4/4] pci: msix: move 'MSIX_CAP_LENGTH' to header file
On Fri, 17 May 2019 20:28:11 -0700
Li Qiang <[email protected]> wrote:
Lacking commit message.
Quoted 47 lines
Signed-off-by Li Qiang <[email protected]>--- hw/pci/msix.c | 2 -- hw/vfio/pci.c | 2 -- include/hw/pci/msix.h | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-)hw/pci/msix.c +0
-2@@ -24,8 +24,6 @@#include "qapi/error.h" #include "trace.h" -#define MSIX_CAP_LENGTH 12 -/* MSI enable bit and maskall bit are in byte 1 in FLAGS register */ #define MSIX_CONTROL_OFFSET (PCI_MSIX_FLAGS + 1)#define MSIX_ENABLE_MASK (PCI_MSIX_FLAGS_ENABLE >> 8)hw/vfio/pci.c +0
-2@@ -35,8 +35,6 @@#include "trace.h" #include "qapi/error.h" -#define MSIX_CAP_LENGTH 12 -#define TYPE_VFIO_PCI "vfio-pci"#define PCI_VFIO (obj) OBJECT_CHECK(VFIOPCIDevice, obj, TYPE_VFIO_PCI)include/hw/pci/msix.h +2
-0@@ -4,6 +4,8 @@#include "qemu-common.h" #include "hw/pci/pci.h" +#define MSIX_CAP_LENGTH 12 +void msix_set_message (PCIDevice *dev,int vector,MSIMessage msg);MSIMessage msix_get_message (PCIDevice *dev,unsigned int vector); int msix_init(PCIDevice *dev, unsigned short nentries,
On Fri, 17 May 2019 20:28:08 -0700
Li Qiang <[email protected]> wrote:
Why? (No commit message, nor cover letter)
Quoted 30 lines
Signed-off-by Li Qiang <[email protected]>--- hw/vfio/pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)hw/vfio/pci.c +4
-2@@ -40,6 +40,8 @@#define TYPE_VFIO_PCI "vfio-pci"#define PCI_VFIO (obj) OBJECT_CHECK(VFIOPCIDevice, obj, TYPE_VFIO_PCI) +#define TYPE_VIFO_PCI_NOHOTPLUG "vfio-pci-nohotplug" +static void vfio_disable_interrupts (VFIOPCIDevice *vdev);static void vfio_mmap_set_enabled (VFIOPCIDevice *vdev,bool enabled);@@ -3304,8 +3306,8 @@ static void vfio_pci_nohotplug_dev_class_init(ObjectClass *klass, void *data) }static const TypeInfo vfio_pci_nohotplug_dev_info = { - .name ="vfio-pci-nohotplug" , - .parent ="vfio-pci" , + .name =TYPE_VIFO_PCI_NOHOTPLUG , + .parent =TYPE_VFIO_PCI , .instance_size =sizeof (VFIOPCIDevice), .class_init = vfio_pci_nohotplug_dev_class_init, };
Quoted 6 lines · Alex Williamson <[email protected]> 于2019年5月18日周六 下午10:18写道:
On Fri, 17 May 2019 20:28:08 -0700
Li Qiang <[email protected]> wrote:Why? (No commit message, nor cover letter)
Once I think these are trivial so no cover letter and lack some commit message.
I will add some commit message in the next revision.
For this patch, this is more consistent with QOMConventions:
-->https://wiki.qemu.org/Documentation/QOMConventions
Thanks,
Li Qiang
Quoted 33 lines
hw/vfio/pci.c static void
Quoted 20 lines
Signed-off-by Li Qiang <[email protected]>--- hw/vfio/pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)hw/vfio/pci.c +2
-0@@ -40,6 +40,8 @@#define TYPE_VFIO_PCI "vfio-pci"#define PCI_VFIO (obj) OBJECT_CHECK(VFIOPCIDevice, obj, TYPE_VFIO_PCI) +#define TYPE_VIFO_PCI_NOHOTPLUG "vfio-pci-nohotplug" +static void vfio_disable_interrupts (VFIOPCIDevice *vdev);static void vfio_mmap_set_enabled (VFIOPCIDevice *vdev,bool enabled);@@ -3304,8 +3306,8 @@ static void
vfio_pci_nohotplug_dev_class_init(ObjectClass *klass, void *data)Quoted 10 lines
hw/vfio/pci.c +2
-2}static const TypeInfo vfio_pci_nohotplug_dev_info = { - .name ="vfio-pci-nohotplug" , - .parent ="vfio-pci" , + .name =TYPE_VIFO_PCI_NOHOTPLUG , + .parent =TYPE_VFIO_PCI , .instance_size =sizeof (VFIOPCIDevice), .class_init = vfio_pci_nohotplug_dev_class_init, };
Quoted 11 lines · On Mon, 20 May 2019 09:27:47 +0800 Li Qiang <[email protected]> wrote:
Quoted 6 lines · Alex Williamson <[email protected]> 于2019年5月18日周六 下午10:18写道:
On Fri, 17 May 2019 20:28:08 -0700
Li Qiang <[email protected]> wrote:Why? (No commit message, nor cover letter)
Once I think these are trivial so no cover letter and lack some commit message.
I will add some commit message in the next revision.
There is no patch that is not improved by a commit message IMO.
Quoted 2 lines
For this patch, this is more consistent with QOMConventions:
-->https://wiki.qemu.org/Documentation/QOMConventions
Ok, so you're effectively just updating your previous commit 2683ccd5be8f ("vfio-pci: make vfio-pci device more QOM conventional") which crossed in flight with b290659fc3dd ("hw/vfio/display: add ramfb support") which added this new TypeInfo. The QOMConventions only recommend a TYPE_FOO if used in other parts of the code, but for consistency I think it's reasonable (with a commit log ;). Thanks,
Alex
Quoted 33 lines
Quoted 33 lines
hw/vfio/pci.c static void
Quoted 20 lines
Signed-off-by Li Qiang <[email protected]>--- hw/vfio/pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)hw/vfio/pci.c +2
-0@@ -40,6 +40,8 @@#define TYPE_VFIO_PCI "vfio-pci"#define PCI_VFIO (obj) OBJECT_CHECK(VFIOPCIDevice, obj, TYPE_VFIO_PCI) +#define TYPE_VIFO_PCI_NOHOTPLUG "vfio-pci-nohotplug" +static void vfio_disable_interrupts (VFIOPCIDevice *vdev);static void vfio_mmap_set_enabled (VFIOPCIDevice *vdev,bool enabled);@@ -3304,8 +3306,8 @@ static void
vfio_pci_nohotplug_dev_class_init(ObjectClass *klass, void *data)Quoted 10 lines
hw/vfio/pci.c +2
-2}static const TypeInfo vfio_pci_nohotplug_dev_info = { - .name ="vfio-pci-nohotplug" , - .parent ="vfio-pci" , + .name =TYPE_VIFO_PCI_NOHOTPLUG , + .parent =TYPE_VFIO_PCI , .instance_size =sizeof (VFIOPCIDevice), .class_init = vfio_pci_nohotplug_dev_class_init, };