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

[PATCH] x86/ioapic: Check 1k alignment for IO-APIC physical addresses


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 20 Nov 2023 15:10:06 +0000
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 20 Nov 2023 15:10:25 +0000
  • Ironport-data: A9a23:Y3rw7Kmj+VNngUwd8IyI4QTo5gzCJkRdPkR7XQ2eYbSJt1+Wr1Gzt xJMXTuFbvqLZ2SmL49+YI22oxwPscDcxoRqSwo5qy03EyMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+e6UKicfHkpGWeIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE0p5KiaVA8w5ARkPqkS5geGzRH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 cMjEzlXZTOPvL2Z7+25beJtuZUjB8a+aevzulk4pd3YJfMvQJSFSKTW/95Imjw3g6iiH96HO ZBfM2A2Kk2dMlsQYj/7C7pn9AusrlD5fydVtxS+oq0v7nKI5AdwzKLsIJzefdniqcB9xxzI/ DqXpTSjav0cHPeEjgjcz1uTv9TKtHLJdbMDCLjo+fE/1TV/wURMUUZLBDNXu8KRmkO4Ht5SN UEQ0i4vtrQpslymSMHnWB+1q2LCuQQTM/JyOeAn7ACGyoLP/h2UQGMDS1Zpd9gOpMIwAzsw2 Te0c8jBXGI19ufPEDTEq+bS8mva1TUpwXEqWhQ/RFEOwNXY/64c0RDoRddcQa6egYigcd3v+ AxmvBTSlp1K0pZTi/3qowCX6w9AsKQlWeLc2+k2Yo5GxlkgDGJdT9b0gWU3FN4ZRGpjcnGPv WIfh++V5/0UAJeGmUSlGbpVRO3wt6fYbmGG2jaD+qXNEBz3oxaekX14umkidC+FzO5ZEdMWX KMjkVwIv8ICVJdbRaR2f5iwG6wXIVvITLzYugTvRoMWOPBZLVbXlByCkGbMhwgBZmBwy/BgU XpaGO7wZUsn5VNPlmvrHbxFi+RymkjTBwr7HPjG8vhu6pLGDFb9dFvPGALmgjwRhE9cnDjoz g==
  • Ironport-hdrordr: A9a23:kdga36vwahorckdNqtHhhGj77skDctV00zEX/kB9WHVpm5qj5q STdZUgtSMc5wx7ZJhNo7q90cq7IE80l6Qb3WBLB8bGYOCOggLBEGgF1+bfKlbbdREWmNQw6U /OGZIOb+EZoTJB/KXHCKjTKadD/OW6
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The MP spec requires a minimum of 1k alignment.  So too does Xen's use of a
single fixmap page to map the IO-APIC.

Reject out-of-spec values so we don't end up in a position where a bad
firmware value causes Xen to use the wrong mapping.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/io_apic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 0ef61fb2f167..db1ea6e2f2ca 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2589,10 +2589,11 @@ static void __init ioapic_init_mappings(void)
         union IO_APIC_reg_01 reg_01;
         paddr_t ioapic_phys = mp_ioapics[i].mpc_apicaddr;
 
-        if ( !ioapic_phys )
+        if ( !ioapic_phys || (ioapic_phys & (KB(1) - 1)) )
         {
             printk(KERN_ERR
-                   "WARNING: bogus zero IO-APIC address found in MPTABLE, 
disabling IO/APIC support!\n");
+                   "WARNING: bogus IO-APIC address %08lx found in MPTABLE, 
disabling IO/APIC support!\n",
+                   ioapic_phys);
             smp_found_config = false;
             skip_ioapic_setup = true;
             break;
-- 
2.30.2




 


Rackspace

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