Re: [PATCH 6/7] vfio/ccw: Fix the missed unrealize() call in error path

2024-05-23 Thread Cédric Le Goater
On 5/22/24 19:01, Cédric Le Goater wrote: From: Zhenzhong Duan When get name failed, we should call unrealize() so that vfio_ccw_realize() is self contained. Fixes: 909a6254eda ("vfio/ccw: Make vfio cdev pre-openable by passing a file handle") Signed-off-by: Zhenzhong Duan

[PATCH 3/7] hw/s390x/ccw: Remove local Error variable from s390_ccw_realize()

2024-05-22 Thread Cédric Le Goater
Use the 'Error **errp' argument of s390_ccw_realize() instead and remove the error_propagate() call. Signed-off-by: Cédric Le Goater --- hw/s390x/s390-ccw.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c index

[PATCH 6/7] vfio/ccw: Fix the missed unrealize() call in error path

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan When get name failed, we should call unrealize() so that vfio_ccw_realize() is self contained. Fixes: 909a6254eda ("vfio/ccw: Make vfio cdev pre-openable by passing a file handle") Signed-off-by: Zhenzhong Duan --- hw/vfio/ccw.c | 3 ++- 1 file changed, 2 insertions(+),

[PATCH 7/7] vfio/{ap, ccw}: Use warn_report_err() for IRQ notifier registration errors

2024-05-22 Thread Cédric Le Goater
vfio_ccw_register_irq_notifier() and vfio_ap_register_irq_notifier() errors are currently reported using error_report_err(). Since they are not considered as failing conditions, using warn_report_err() is more appropriate. Signed-off-by: Cédric Le Goater --- hw/vfio/ap.c | 2 +- hw/vfio/ccw.c

[PATCH 4/7] s390x/css: Make S390CCWDeviceClass::realize return bool

2024-05-22 Thread Cédric Le Goater
Since the realize() handler of S390CCWDeviceClass takes an 'Error **' argument, best practices suggest to return a bool. See the api/error.h Rules section. While at it, modify the call in vfio_ccw_realize(). Signed-off-by: Cédric Le Goater --- include/hw/s390x/s390-ccw.h | 2 +- hw/s390x/s390

[PATCH 5/7] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize()

2024-05-22 Thread Cédric Le Goater
The local error variable is kept for vfio_ccw_register_irq_notifier() because it is not considered as a failing condition. We will change how error reporting is done in following changes. Remove the error_propagate() call. Cc: Zhenzhong Duan Signed-off-by: Cédric Le Goater --- hw/vfio/ccw.c

[PATCH 0/7] s390x/ccw: Error reporting cleanups

2024-05-22 Thread Cédric Le Goater
of this vfio PR : https://lore.kernel.org/qemu-devel/20240522095442.195243-1-...@redhat.com Thanks, C. Cédric Le Goater (6): hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool s390x/css: Make CCWDeviceClass::realize return bool hw/s390x/ccw: Remove local Error variable from

[PATCH 1/7] hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool

2024-05-22 Thread Cédric Le Goater
Since s390_ccw_get_dev_info() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. While at it, modify the call in s390_ccw_realize(). Signed-off-by: Cédric Le Goater --- hw/s390x/s390-ccw.c | 12 ++-- 1 file changed, 6 insertions

[PATCH 2/7] s390x/css: Make CCWDeviceClass::realize return bool

2024-05-22 Thread Cédric Le Goater
Since the realize() handler of CCWDeviceClass takes an 'Error **' argument, best practices suggest to return a bool. See the api/error.h Rules section. While at it, modify the call in s390_ccw_realize(). Signed-off-by: Cédric Le Goater --- hw/s390x/ccw-device.h | 2 +- hw/s390x/ccw-device.c | 3

[PULL 30/47] vfio/display: Fix error path in call site of ramfb_setup()

2024-05-22 Thread Cédric Le Goater
Hoffmann Fixes: b290659fc3d ("hw/vfio/display: add ramfb support") Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/display.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/vfio/display.c b/hw/vfio/displ

[PULL 24/47] vfio/container: Make vfio_connect_container() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand to return bool if 'Error **' is used to pass error. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/container.c | 18 +++--- 1 file

[PULL 45/47] vfio/pci-quirks: Make vfio_add_*_cap() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Include below functions: vfio_add_virt_caps() vfio_add_nv_gpudirect_cap() vfio_add_vmd_shadow_cap() Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed

[PULL 46/47] vfio: Use g_autofree in all call site of vfio_get_region_info()

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan There are some exceptions when pointer to vfio_region_info is reused. In that case, the pointed memory is freed manually. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/helpers.c

[PULL 16/47] vfio/migration: Emit VFIO migration QAPI event

2024-05-22 Thread Cédric Le Goater
so events can be enabled only for the required devices. It is disabled by default. Signed-off-by: Avihai Horon Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 1 + hw/vfio/migration.c | 59 +-- hw/

[PULL 21/47] vfio: Make VFIOIOMMUClass::attach_device() and its wrapper return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan Make VFIOIOMMUClass::attach_device() and its wrapper function vfio_attach_device() return bool. This is to follow the coding standand to return bool if 'Error **' is used to pass error. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le

[PULL 22/47] vfio: Make VFIOIOMMUClass::setup() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand to return bool if 'Error **' is used to pass error. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-container-base.h | 2 +- hw

[PULL 27/47] vfio/iommufd: Make iommufd_cdev_*() return bool

2024-05-22 Thread Cédric Le Goater
iommufd_cdev_get_info_iova_range After the change, all functions in hw/vfio/iommufd.c follows the standand. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/iommufd.c | 88

[PULL 29/47] backends/iommufd: Make iommufd_backend_*() return bool

2024-05-22 Thread Cédric Le Goater
either error interface or trace, not both. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/sysemu/iommufd.h | 6 +++--- backends/iommufd.c | 29 + hw/vfio/iommufd.c

[PULL 13/47] vfio/ccw: Make vfio_ccw_register_irq_notifier() return a bool

2024-05-22 Thread Cédric Le Goater
Since vfio_ccw_register_irq_notifier() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. Reviewed-by: Markus Armbruster Reviewed-by: Eric Farman Signed-off-by: Cédric Le Goater --- hw/vfio/ccw.c | 22 +++--- 1 file

[PULL 47/47] vfio/igd: Use g_autofree in vfio_probe_igd_bar4_quirk()

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan Pointer opregion, host and lpc are allocated and freed in vfio_probe_igd_bar4_quirk(). Use g_autofree to automatically free them. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/igd.c | 27

[PULL 03/47] migration: Extend migration_file_set_error() with Error* argument

2024-05-22 Thread Cédric Le Goater
Use it to update the current error of the migration stream if available and if not, simply print out the error. Next changes will update with an error to report. Reviewed-by: Avihai Horon Acked-by: Fabiano Rosas Reviewed-by: Eric Auger Signed-off-by: Cédric Le Goater --- include/migration

[PULL 01/47] vfio: Add Error** argument to .set_dirty_page_tracking() handler

2024-05-22 Thread Cédric Le Goater
We will use the Error object to improve error reporting in the .log_global*() handlers of VFIO. Add documentation while at it. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Avihai Horon Reviewed-by: Eric Auger Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-container-base.h | 18

[PULL 18/47] vfio/migration: Enhance VFIO migration state tracing

2024-05-22 Thread Cédric Le Goater
(covering recover state and device reset transitions) and in no-op state transitions to the same state. Suggested-by: Cédric Le Goater Signed-off-by: Avihai Horon Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/migration.c | 8 ++-- hw/vfio/trace-events | 3

[PULL 05/47] vfio/migration: Add Error** argument to .vfio_save_config() handler

2024-05-22 Thread Cédric Le Goater
Use vmstate_save_state_with_err() to improve error reporting in the callers and store a reported error under the migration stream. Add documentation while at it. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Reviewed-by: Avihai Horon Signed-off-by: Cédric Le Goater --- include

[PULL 33/47] vfio/helpers: Make vfio_set_irq_signaling() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 4 ++-- hw

[PULL 26/47] vfio/container: Make vfio_get_device() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand to return bool if 'Error **' is used to pass error. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/container.c | 16 +++- 1 file

[PULL 40/47] vfio/pci: Make vfio_intx_enable() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/pci.c | 19 --- 1 file

[PULL 20/47] vfio/pci: Use g_autofree in iommufd_cdev_get_info_iova_range()

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan Local pointer info is freed before return from iommufd_cdev_get_info_iova_range(). Use 'g_autofree' to avoid the g_free() calls. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/iommufd.c | 4 +--- 1 file changed

[PULL 19/47] vfio/pci: Use g_autofree in vfio_realize

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan Local pointer name is allocated before vfio_attach_device() call and freed after the call. Same for tmp when calling realpath(). Use 'g_autofree' to avoid the g_free() calls. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater

[PULL 34/47] vfio/helpers: Make vfio_device_get_name() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 2 +- hw/vfio

[PULL 32/47] vfio/helpers: Use g_autofree in vfio_set_irq_signaling()

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan Local pointer irq_set is freed before return from vfio_set_irq_signaling(). Use 'g_autofree' to avoid the g_free() calls. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/helpers.c | 3 +-- 1 file changed, 1

[PULL 43/47] vfio/pci: Use g_autofree for vfio_region_info pointer

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan Pointer opregion is freed after vfio_pci_igd_opregion_init(). Use 'g_autofree' to avoid the g_free() calls. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions

[PULL 23/47] vfio: Make VFIOIOMMUClass::add_window() and its wrapper return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan Make VFIOIOMMUClass::add_window() and its wrapper function vfio_container_add_section_window() return bool. This is to follow the coding standand to return bool if 'Error **' is used to pass error. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed

[PULL 15/47] qapi/vfio: Add VFIO migration QAPI event

2024-05-22 Thread Cédric Le Goater
of the VFIO device for their own purposes. Note that this new event is introduced since VFIO devices have a unique set of migration states which cannot be described as accurately by other existing events such as run state or migration status. Signed-off-by: Avihai Horon Reviewed-by: Cédric Le Goater

[PULL 14/47] vfio/pci: migration: Skip config space check for Vendor Specific Information in VSC during restore/load

2024-05-22 Thread Cédric Le Goater
;= 9.1. The check would be enforced on older machine types (<= 9.0). Cc: Alex Williamson Cc: Michael S. Tsirkin Cc: Cédric Le Goater Signed-off-by: Vinayak Kale Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/pci.h | 1 + hw/core/machine.c | 1 + hw/vfio/pci.c

[PULL 17/47] vfio/migration: Don't emit STOP_COPY VFIO migration QAPI event twice

2024-05-22 Thread Cédric Le Goater
ces that don't support pre-copy, for migrating an already stopped guest and for snapshots. Signed-off-by: Avihai Horon Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/migration.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/vfio/migration.c b/hw/vfio/migratio

[PULL 39/47] vfio/pci: Make vfio_populate_device() return a bool

2024-05-22 Thread Cédric Le Goater
-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/pci.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 4fb5fd0c9f61627c402164fc4bed1868540350e0..46d3c618596d95266543e9a0ebc65c04d9a7cc5d 100644

[PULL 38/47] vfio/pci: Make vfio_pci_relocate_msix() and vfio_msix_early_setup() return a bool

2024-05-22 Thread Cédric Le Goater
-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/pci.c | 33 - 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 12fb534d796f52724f365746c9c8c2491265f03d

[PULL 36/47] vfio/ccw: Make vfio_ccw_get_region() return a bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan Since vfio_populate_device() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/ccw.c | 15 +++ 1

[PULL 07/47] memory: Add Error** argument to memory_get_xlat_addr()

2024-05-22 Thread Cédric Le Goater
Let the callers do the reporting. This will be useful in vfio_iommu_map_dirty_notify(). Cc: Michael S. Tsirkin Cc: Paolo Bonzini Cc: David Hildenbrand Reviewed-by: Peter Xu Reviewed-by: Eric Auger Reviewed-by: Avihai Horon Signed-off-by: Cédric Le Goater --- include/exec/memory.h | 15

[PULL 12/47] vfio/ccw: Use g_autofree variable in vfio_ccw_register_irq_notifier()

2024-05-22 Thread Cédric Le Goater
Reviewed-by: Markus Armbruster Reviewed-by: Eric Farman Signed-off-by: Cédric Le Goater --- hw/vfio/ccw.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index 90e4a534371684c08e112364e1537eb8979f73f4

[PULL 37/47] vfio/pci: Make vfio_intx_enable_kvm() return a bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan Since vfio_intx_enable_kvm() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/pci.c | 15 --- 1

[PULL 42/47] vfio/pci: Make capability related functions return bool

2024-05-22 Thread Cédric Le Goater
: vfio_add_vendor_specific_cap() vfio_setup_pcie_cap() But the returned integer is only used for check succeed/failure. Change them all to return bool so now all capability related functions follow the coding standand in qapi/error.h to return bool. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off

[PULL 28/47] vfio/cpr: Make vfio_cpr_register_container() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand to return bool if 'Error **' is used to pass error. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 2 +- hw/vfio

[PULL 04/47] vfio/migration: Add an Error** argument to vfio_migration_set_state()

2024-05-22 Thread Cédric Le Goater
under the migration stream if a migration is in progress. Reviewed-by: Avihai Horon Signed-off-by: Cédric Le Goater --- hw/vfio/migration.c | 81 + 1 file changed, 52 insertions(+), 29 deletions(-) diff --git a/hw/vfio/migration.c b/hw/vfio

[PULL 41/47] vfio/pci: Make vfio_populate_vga() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/pci.h | 2 +- hw/vfio/igd.c | 2

[PULL 35/47] vfio/platform: Make vfio_populate_device() and vfio_base_device_init() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/platform.c | 40

[PULL 11/47] vfio/ap: Make vfio_ap_register_irq_notifier() return a bool

2024-05-22 Thread Cédric Le Goater
Since vfio_ap_register_irq_notifier() takes and 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. Reviewed-by: Markus Armbruster Signed-off-by: Cédric Le Goater --- hw/vfio/ap.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions

[PULL 10/47] vfio/ap: Use g_autofree variable in vfio_ap_register_irq_notifier()

2024-05-22 Thread Cédric Le Goater
Reviewed-by: Markus Armbruster Reviewed-by: Anthony Krowiak Signed-off-by: Cédric Le Goater --- hw/vfio/ap.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 7c4caa5938636937680fec87e999249ac84a4498

[PULL 08/47] vfio: Add Error** argument to .get_dirty_bitmap() handler

2024-05-22 Thread Cédric Le Goater
Let the callers do the error reporting. Add documentation while at it. Reviewed-by: Eric Auger Reviewed-by: Avihai Horon Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 5 +-- include/hw/vfio/vfio-container-base.h | 19 +++-- hw/vfio/common.c

[PULL 44/47] vfio/pci-quirks: Make vfio_pci_igd_opregion_init() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/pci.h| 6 +++--- hw/vfio/igd.c

[PULL 31/47] vfio/display: Make vfio_display_*() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/pci.h | 2 +- hw/vfio/display.c

[PULL 09/47] vfio: Also trace event failures in vfio_save_complete_precopy()

2024-05-22 Thread Cédric Le Goater
vfio_save_complete_precopy() currently returns before doing the trace event. Change that. Reviewed-by: Avihai Horon Reviewed-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio/migration.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c

[PULL 25/47] vfio/container: Make vfio_set_iommu() return bool

2024-05-22 Thread Cédric Le Goater
From: Zhenzhong Duan This is to follow the coding standand to return bool if 'Error **' is used to pass error. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/container.c | 22 ++ 1

[PULL 02/47] vfio: Add Error** argument to vfio_devices_dma_logging_start()

2024-05-22 Thread Cédric Le Goater
and reported. The vfio_set_migration_error() call becomes redundant in vfio_listener_log_global_start(). Remove it. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Avihai Horon Reviewed-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio/common.c | 26 +++--- 1 file

[PULL 06/47] vfio: Reverse test on vfio_get_xlat_addr()

2024-05-22 Thread Cédric Le Goater
It will simplify the changes coming after. Reviewed-by: Avihai Horon Reviewed-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio/common.c | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index

[PULL 00/47] vfio queue

2024-05-22 Thread Cédric Le Goater
): qapi/vfio: Add VFIO migration QAPI event vfio/migration: Emit VFIO migration QAPI event vfio/migration: Don't emit STOP_COPY VFIO migration QAPI event twice vfio/migration: Enhance VFIO migration state tracing Cédric Le Goater (13): vfio: Add Error** argument

Re: [PATCH v2 00/20] VFIO: misc cleanups part2

2024-05-22 Thread Cédric Le Goater
On 5/22/24 06:39, Zhenzhong Duan wrote: Hi This is the last round of cleanup series to change functions in hw/vfio/ to return bool when the error is passed through errp parameter. The first round is at https://lists.gnu.org/archive/html/qemu-devel/2024-05/msg01147.html I see Cédric is also

Re: [PATCH v2 20/20] vfio/ccw: Fix the missed unrealize() call in error path

2024-05-22 Thread Cédric Le Goater
On 5/22/24 10:05, Duan, Zhenzhong wrote: Hi Cédric, -Original Message- From: Cédric Le Goater Sent: Wednesday, May 22, 2024 3:52 PM To: Duan, Zhenzhong ; qemu- de...@nongnu.org Cc: alex.william...@redhat.com; eric.au...@redhat.com; Peng, Chao P ; Eric Farman ; Matthew Rosato ; Thomas

Re: [PATCH v2 20/20] vfio/ccw: Fix the missed unrealize() call in error path

2024-05-22 Thread Cédric Le Goater
On 5/22/24 06:40, Zhenzhong Duan wrote: When get name failed, we should call unrealize() so that vfio_ccw_realize() is self contained. Fixes: 909a6254eda ("vfio/ccw: Make vfio cdev pre-openable by passing a file handle") Signed-off-by: Zhenzhong Duan If the realize handler fails, the

Re: [PATCH v2 19/20] vfio/ccw: Drop local @err in vfio_ccw_realize()

2024-05-22 Thread Cédric Le Goater
On 5/22/24 06:40, Zhenzhong Duan wrote: Use @errp to fetch error information directly and drop the local variable @err. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan --- hw/vfio/ccw.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git

Re: [PATCH v2 17/20] vfio: Use g_autofree in all call site of vfio_get_region_info()

2024-05-22 Thread Cédric Le Goater
On 5/22/24 06:40, Zhenzhong Duan wrote: There are some exceptions when pointer to vfio_region_info is reused. In that case, the pointed memory is freed manually. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio

Re: [PATCH v2 18/20] vfio/igd: Use g_autofree in vfio_probe_igd_bar4_quirk()

2024-05-22 Thread Cédric Le Goater
On 5/22/24 06:40, Zhenzhong Duan wrote: Pointer opregion, host and lpc are allocated and freed in vfio_probe_igd_bar4_quirk(). Use g_autofree to automatically free them. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/igd.c | 27

Re: [PATCH v2 10/20] vfio/pci: Make vfio_populate_device() return a bool

2024-05-22 Thread Cédric Le Goater
-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/pci.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 4fb5fd0c9f..46d3c61859 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2740,7 +2740,7

Re: [PATCH v2 09/20] vfio/pci: Make vfio_pci_relocate_msix() and vfio_msix_early_setup() return a bool

2024-05-22 Thread Cédric Le Goater
error_propagate(). Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/pci.c | 33 - 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 12fb534d79..4fb5fd0c9f 100644 --- a/hw/vfio

Re: [PATCH v2 03/20] vfio/helpers: Use g_autofree in vfio_set_irq_signaling()

2024-05-22 Thread Cédric Le Goater
On 5/22/24 06:39, Zhenzhong Duan wrote: Local pointer irq_set is freed before return from vfio_set_irq_signaling(). Use 'g_autofree' to avoid the g_free() calls. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/helpers.c | 3 +-- 1 file changed, 1

Re: [PATCH 16/16] vfio/pci-quirks: Make vfio_add_*_cap() return bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Include below functions: vfio_add_virt_caps() vfio_add_nv_gpudirect_cap() vfio_add_vmd_shadow_cap() Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong

Re: [PATCH 13/16] vfio/pci: Make capability related functions return bool

2024-05-21 Thread Cédric Le Goater
: vfio_add_vendor_specific_cap() vfio_setup_pcie_cap() But the returned integer is only used for check succeed/failure. Change them all to return bool so now all capability related functions follow the coding standand in qapi/error.h to return bool. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le

Re: [PATCH 14/16] vfio/pci: Use g_autofree for vfio_region_info pointer

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: Pointer opregion is freed after vfio_pci_igd_opregion_init(). Use 'g_autofree' to avoid the g_free() calls. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/pci.c | 3 +-- 1 file changed, 1 insertion(+), 2

Re: [PATCH 15/16] vfio/pci-quirks: Make vfio_pci_igd_opregion_init() return bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/pci.h| 6 +++--- hw

Re: [PATCH 12/16] vfio/pci: Make vfio_populate_vga() return bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/pci.h | 2 +- hw/vfio/igd.c

Re: [PATCH 11/16] vfio/pci: Make vfio_intx_enable() return bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/pci.c | 19

Re: [PATCH 10/16] vfio/pci: Make vfio_populate_device() return a bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: Since vfio_populate_device() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. Signed-off-by: Zhenzhong Duan --- hw/vfio/pci.c | 19 ++- 1 file changed, 10 insertions(+), 9

Re: [PATCH 09/16] vfio/pci: Make vfio_pci_relocate_msix() and vfio_msix_early_setup() return a bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: Since vfio_pci_relocate_msix() and vfio_msix_early_setup() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. Signed-off-by: Zhenzhong Duan --- hw/vfio/pci.c | 32

Re: [PATCH 08/16] vfio/pci: Make vfio_intx_enable_kvm() return a bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: Since vfio_intx_enable_kvm() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/pci.c | 15

Re: [PATCH 07/16] vfio/ccw: Make vfio_ccw_get_region() return a bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: Since vfio_populate_device() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater One comment below --- hw/vfio/ccw.c | 15

Re: [PATCH 06/16] vfio/platform: Make vfio_populate_device() and vfio_base_device_init() return bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/platform.c | 40

Re: [PATCH 05/16] vfio/helpers: Make vfio_device_get_name() return bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- include/hw/vfio/vfio-common.h | 2 +- hw

Re: [PATCH 04/16] vfio/helpers: Make vfio_set_irq_signaling() return bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- include/hw/vfio/vfio-common.h | 4

Re: [PATCH 03/16] vfio/helpers: Use g_autofree in hw/vfio/helpers.c

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: Changed functions include vfio_set_irq_signaling() this change looks fine and vfio_region_setup(). I would prefer all users of vfio_get_region_info() to be changed. Thanks, C. Signed-off-by: Zhenzhong Duan --- hw/vfio/helpers.c | 7 ++-

Re: [PATCH 02/16] vfio/display: Make vfio_display_*() return bool

2024-05-21 Thread Cédric Le Goater
On 5/15/24 10:20, Zhenzhong Duan wrote: This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater One comment below, --- hw/vfio/pci.h | 2 +- hw

Re: [PATCH 01/16] vfio/display: Fix error path in call site of ramfb_setup()

2024-05-21 Thread Cédric Le Goater
(). Cc: Gerd Hoffmann Fixes: b290659fc3d ("hw/vfio/display: add ramfb support") Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/display.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/vfio/display.c b/hw/vfio/display.c index

Re: [PATCH 00/32] hw/sd: eMMC support

2024-05-21 Thread Cédric Le Goater
On 8/28/23 18:27, Cédric Le Goater wrote: Hello, On 7/3/23 15:24, Cédric Le Goater wrote: Hello, This series adds an extension for a new eMMC device using the framework Philippe put in place to support various SD implementations. Previous discussion on the same topic:    http

Re: [PATCH v3 2/5] ppc/pnv: Extend SPI model

2024-05-21 Thread Cédric Le Goater
On 5/21/24 08:11, Chalapathi V wrote: On 18-05-2024 01:24, Miles Glenn wrote: Chalapathi, I'm having trouble seeing the benefit of breaking this commit out from patch 1/5.  It seems like the two should be merged into a single commit responsible for adding the PNV SPI Controller model. -Glenn

Re: [PATCH v3 5/5] tests/qtest: Add pnv-spi-seeprom qtest

2024-05-20 Thread Cédric Le Goater
On 5/15/24 19:41, Chalapathi V wrote: In this commit Write a qtest pnv-spi-seeprom-test to check the SPI transactions between spi controller and seeprom device. Signed-off-by: Chalapathi V --- tests/qtest/pnv-spi-seeprom-test.c | 129 + tests/qtest/meson.build

Re: [PATCH v3 4/5] hw/ppc: SPI controller wiring to P10 chip

2024-05-20 Thread Cédric Le Goater
PIO_CS, 0); +qdev_connect_gpio_out_named(DEVICE(s), "cs", 0, cs_line); +} + /* Reset all N1 and N2 counters, and other constants */ s->N2_bits = 0; s->N2_bytes = 0; Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH v3 3/5] hw/block: Add Microchip's 25CSM04 to m25p80

2024-05-19 Thread Cédric Le Goater
and industrial applications where reliable and dependable nonvolatile memory storage is essential. Signed-off-by: Chalapathi V Reviewed-by: Cédric Le Goater Thanks, C. --- hw/block/m25p80.c | 3 +++ hw/ppc/Kconfig| 1 + 2 files changed, 4 insertions(+) diff --git a/hw/block

Re: [PATCH v3 1/5] ppc/pnv: Add SPI controller model

2024-05-19 Thread Cédric Le Goater
On 5/15/24 19:41, Chalapathi V wrote: SPI controller device model supports a connection to a single SPI responder. This provide access to SPI seeproms, TPM, flash device and an ADC controller. All SPI function control is mapped into the SPI register space to enable full control by firmware. In

Re: [PATCH v3 12/16] aspeed/soc: Add AST2700 support

2024-05-17 Thread Cédric Le Goater
On 4/19/24 09:58, Jamin Lin wrote: Hi Cedric, On 4/16/24 11:18, Jamin Lin wrote: Initial definitions for a simple machine using an AST2700 SOC (Cortex-a35 CPU). AST2700 SOC and its interrupt controller are too complex to handle in the common Aspeed SoC framework. We introduce a new ast2700

Re: [PATCH v3 08/16] aspeed/smc: support 64 bits dma dram address

2024-05-17 Thread Cédric Le Goater
Hello Jamin On 5/15/24 11:01, Jamin Lin wrote: Hi Cedric, Sorry reply you late. Hello Jamin, To handle the DMA DRAM Side Address High register, we should reintroduce an "dram-base" property which I removed a while ago. Something like : diff --git a/include/hw/ssi/aspeed_smc.h

Re: [PATCH] hw/intc/s390_flic: Fix crash that occurs when saving the machine state

2024-05-17 Thread Cédric Le Goater
e VM state. Fix it by using s390_get_flic() to get the correct device here instead. Reported-by: Marc Hartmayer Fixes: 9d1b0f5bf5 ("s390_flic: add migration-enabled property") Signed-off-by: Thomas Huth Reviewed-by: Cédric Le Goater Thanks, C. --- hw/intc/s390_flic.c | 2 +-

Re: [PATCH 00/16] VFIO: misc cleanups part2

2024-05-16 Thread Cédric Le Goater
Hello Zhenzhong, On 5/15/24 10:20, Zhenzhong Duan wrote: Hi This is the last round of cleanup series to change functions in hw/vfio/ to return bool when the error is passed through errp parameter. The first round is at https://lists.gnu.org/archive/html/qemu-devel/2024-05/msg01147.html I

Re: [PATCH v2 00/11] VFIO: misc cleanups

2024-05-16 Thread Cédric Le Goater
On 5/7/24 08:42, Zhenzhong Duan wrote: Hi This is a cleanup series to change functions in hw/vfio/ to return bool when the error is passed through errp parameter, also some cleanup with g_autofree. See discussion at https://lists.gnu.org/archive/html/qemu-devel/2024-04/msg04782.html This

Re: [PATCH v3 0/4] qapi/vfio: Add VFIO migration QAPI event

2024-05-16 Thread Cédric Le Goater
On 5/15/24 15:21, Avihai Horon wrote: Hello, This series adds a new QAPI event for VFIO device migration state change. This event will be emitted when a VFIO device changes its state, for example, during migration or when stopping/starting the guest. This event can be used by management

Re: [PATCH v4] vfio/pci: migration: Skip config space check for Vendor Specific Information in VSC during restore/load

2024-05-16 Thread Cédric Le Goater
ine types >= 9.1. The check would be enforced on older machine types (<= 9.0). Signed-off-by: Vinayak Kale Cc: Alex Williamson Cc: Michael S. Tsirkin Cc: Cédric Le Goater Applied to vfio-next. Thanks, C. --- Version History v3->v4: - VSC check is skipped for machine

Re: [PATCH v2 1/4] vfio/ap: Use g_autofree variable in vfio_ap_register_irq_notifier()

2024-05-16 Thread Cédric Le Goater
Applied series to vfio-next. Thanks, C. On 4/25/24 11:02, Cédric Le Goater wrote: Signed-off-by: Cédric Le Goater --- hw/vfio/ap.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 7c4caa5938636937680fec87e999249ac84a4498

Re: [PATCH v7 0/9] vfio: Improve error reporting (part 2)

2024-05-16 Thread Cédric Le Goater
On 5/16/24 14:46, Cédric Le Goater wrote: Hello, The motivation behind these changes is to improve error reporting to the upper management layer (libvirt) with a more detailed error, this to let it decide, depending on the reported error, whether to try migration again later. It would be useful

Re: [PATCH v7 8/9] vfio: Add Error** argument to .get_dirty_bitmap() handler

2024-05-16 Thread Cédric Le Goater
On 5/16/24 14:46, Cédric Le Goater wrote: Let the callers do the error reporting. Add documentation while at it. Reviewed-by: Eric Auger Reviewed-by: Avihai Horon Signed-off-by: Cédric Le Goater --- Changes in v7: - Fixed even more line wrapping of *dirty_bitmap() routines (Avihai

[PATCH v7 3/9] migration: Extend migration_file_set_error() with Error* argument

2024-05-16 Thread Cédric Le Goater
Use it to update the current error of the migration stream if available and if not, simply print out the error. Next changes will update with an error to report. Reviewed-by: Avihai Horon Acked-by: Fabiano Rosas Reviewed-by: Eric Auger Signed-off-by: Cédric Le Goater --- Changes in v7

[PATCH v7 9/9] vfio: Also trace event failures in vfio_save_complete_precopy()

2024-05-16 Thread Cédric Le Goater
vfio_save_complete_precopy() currently returns before doing the trace event. Change that. Reviewed-by: Avihai Horon Reviewed-by: Eric Auger Signed-off-by: Cédric Le Goater --- hw/vfio/migration.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c

  1   2   3   4   5   6   7   8   9   10   >