On 8/25/25 23:24, Farhan Ali wrote:
Provide a architecture specific error handling callback, that can be used
by platforms to handle PCI errors for passthrough devices.

Signed-off-by: Farhan Ali <al...@linux.ibm.com>
---
  hw/vfio/pci.c | 5 +++++
  hw/vfio/pci.h | 1 +
  2 files changed, 6 insertions(+)

diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 07257d0fa0..3c71d19306 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3026,6 +3026,11 @@ static void vfio_err_notifier_handler(void *opaque)
          return;
      }
+ if (vdev->arch_err_handler) {
+        vdev->arch_err_handler(vdev);


I am not sure that the "architecture specific error handling"
will be implemented this way but we need to check for potential
errors.

So, please make the handler return a bool and add an extra
'Error **' parameter.


Thanks,

C.




+        return;
+    }
+
      /*
       * TBD. Retrieve the error details and decide what action
       * needs to be taken. One of the actions could be to pass
diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
index 810a842f4a..45d4405e47 100644
--- a/hw/vfio/pci.h
+++ b/hw/vfio/pci.h
@@ -145,6 +145,7 @@ struct VFIOPCIDevice {
      EventNotifier err_notifier;
      EventNotifier req_notifier;
      int (*resetfn)(struct VFIOPCIDevice *);
+    void (*arch_err_handler)(struct VFIOPCIDevice *);

      uint32_t vendor_id;
      uint32_t device_id;
      uint32_t sub_vendor_id;


Reply via email to