[PATCH] x86/msi: always propagate MSI register writes from __setup_msi_irq()

Roger Pau Monne posted 1 patch 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20250318084725.52261-1-roger.pau@citrix.com
xen/arch/x86/msi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] x86/msi: always propagate MSI register writes from __setup_msi_irq()
Posted by Roger Pau Monne 9 months ago
After 8e60d47cf011 writes from __setup_msi_irq() will no longer be
propagated to the MSI registers if the IOMMU IRTE was already allocated.
Given the purpose of __setup_msi_irq() is MSI initialization, always
propagate the write to the hardware, regardless of whether the IRTE was
already allocated.

No functional change expected, as the write should always be propagated in
__setup_msi_irq(), but make it explicit on the write_msi_msg() call.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
I haven't actually spotted any cases where this would go wrong, but better
stay on the safe side and always propagate the write there.
__setup_msi_irq() should not be a hot path.
---
 xen/arch/x86/msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 8bb3bb18af61..5389bc08674a 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -532,7 +532,7 @@ int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc,
     desc->msi_desc = msidesc;
     desc->handler = handler;
     msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg);
-    ret = write_msi_msg(msidesc, &msg, false);
+    ret = write_msi_msg(msidesc, &msg, true);
     if ( unlikely(ret) )
     {
         desc->handler = &no_irq_type;
-- 
2.48.1


Re: [PATCH] x86/msi: always propagate MSI register writes from __setup_msi_irq()
Posted by Jan Beulich 9 months ago
On 18.03.2025 09:47, Roger Pau Monne wrote:
> After 8e60d47cf011 writes from __setup_msi_irq() will no longer be
> propagated to the MSI registers if the IOMMU IRTE was already allocated.
> Given the purpose of __setup_msi_irq() is MSI initialization, always
> propagate the write to the hardware, regardless of whether the IRTE was
> already allocated.
> 
> No functional change expected, as the write should always be propagated in
> __setup_msi_irq(), but make it explicit on the write_msi_msg() call.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

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