[PATCH v4 2/3] x86/hvm: check return code of hvm_pi_update_irte when binding

Roger Pau Monne posted 3 patches 9 months, 2 weeks ago
[PATCH v4 2/3] x86/hvm: check return code of hvm_pi_update_irte when binding
Posted by Roger Pau Monne 9 months, 2 weeks ago
Consume the return code from hvm_pi_update_irte(), and propagate the error
back to the caller if hvm_pi_update_irte() fails.

Fixes: 35a1caf8b6b5 ('pass-through: update IRTE according to guest interrupt config changes')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Changes since v3:
 - New in this version.
---
 xen/drivers/passthrough/x86/hvm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index f5faff7a499a..47de6953fdf8 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -381,7 +381,15 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+        {
+            rc = hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+
+            if ( rc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return rc;
+            }
+        }
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
         {
-- 
2.48.1


Re: [PATCH v4 2/3] x86/hvm: check return code of hvm_pi_update_irte when binding
Posted by Jan Beulich 9 months, 2 weeks ago
On 11.03.2025 13:06, Roger Pau Monne wrote:
> Consume the return code from hvm_pi_update_irte(), and propagate the error
> back to the caller if hvm_pi_update_irte() fails.
> 
> Fixes: 35a1caf8b6b5 ('pass-through: update IRTE according to guest interrupt config changes')
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>