[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] x86/vPCI: check address in vpci_msi_update()



commit 0f7bcaf19f7c67ee8c07d1674b2bbb70f16c2d11
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Jan 5 13:18:26 2021 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jan 5 13:18:26 2021 +0100

    x86/vPCI: check address in vpci_msi_update()
    
    If the upper address bits don't match the interrupt delivery address
    space window, entirely different behavior would need to be implemented.
    Refuse such requests for the time being.
    
    Replace adjacent hard tabs while introducing MSI_ADDR_BASE_MASK.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/hvm/vmsi.c   | 7 +++++++
 xen/include/asm-x86/msi.h | 5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index ddcfc6c229..a2ac82c95c 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -682,6 +682,13 @@ static int vpci_msi_update(const struct pci_dev *pdev, 
uint32_t data,
 
     ASSERT(pcidevs_locked());
 
+    if ( (address & MSI_ADDR_BASE_MASK) != MSI_ADDR_HEADER )
+    {
+        gdprintk(XENLOG_ERR, "%pp: PIRQ %u: unsupported address %lx\n",
+                 &pdev->sbdf, pirq, address);
+        return -EOPNOTSUPP;
+    }
+
     for ( i = 0; i < vectors; i++ )
     {
         uint8_t vector = MASK_EXTR(data, MSI_DATA_VECTOR_MASK);
diff --git a/xen/include/asm-x86/msi.h b/xen/include/asm-x86/msi.h
index 18cf2de61e..e228b0f3f3 100644
--- a/xen/include/asm-x86/msi.h
+++ b/xen/include/asm-x86/msi.h
@@ -36,8 +36,9 @@
  * Shift/mask fields for msi address
  */
 
-#define MSI_ADDR_BASE_HI               0
-#define MSI_ADDR_BASE_LO               0xfee00000
+#define MSI_ADDR_BASE_HI            0
+#define MSI_ADDR_BASE_LO            0xfee00000
+#define MSI_ADDR_BASE_MASK          (~0xfffff)
 #define MSI_ADDR_HEADER             MSI_ADDR_BASE_LO
 
 #define MSI_ADDR_DESTMODE_SHIFT     2
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.