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

[XTF PATCH v1 14/15] x86: apic: add few more registers


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Wed, 4 Nov 2026 17:38:16 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 148.163.138.245) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ford.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ford.com; dkim=pass (signature was verified) header.d=saarlouis.ford.com; dkim=pass (signature was verified) header.d=ford.com; arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BDmabGfQnILh3U1P9bmeX8e0pffiRErfGCa95EvFXp0=; b=uDP7/x6TIw3btVjmkMU5oH6z2U1hGz1dFe4G+8mGvRCtXM+V8oGVvZhMF/FI/5Jr+uHcd+v1mUzuQkcj0yIj5A3nSOP1RaB0bmXPb6dqVUkYRxX/ff9dxe+2ejp+U3NGDY5NqkCu9giREE02viTfg0Ubq2ZQfy3nU4tzuwZA4zphFeU6RbdbCBHzfUHPfTLKfKXR06jdpXm41a3/NPS8XqsZ31ChzTsAtpFg3OGmPl7541KyTspD6ME2ogWA/J79R8JLLtVsYtRjeSq5Gk19c+3tb1o8b+fdQlIwvJwJ5Vev9FDtgyI5thjILcsnSaCB12/4eTNft6Anz8U+2PoNZQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bEFJ/BDNe/Y81i09kPocEVSWroveaHRDahaomo3ZvKP+wu7S+c/kKi632rfCGQfZ6o0GttnRtoQgpgOvEFJ9bQOJ6yHD2StJ4AVBrlqy4LzBvnpZo+703ugpsQ+O3lLd1ZHav0A8BhkPGwhlg0kWVcr26h5+ngWCt5W+VYP4Y0p9gGsdAU2y8dTX19Ao2gocSyjqj1a1NycnBRRcTexAC0xfcEj+ZJr2TO0bKJH1FLC4KMv3Zrk1gnrAorFHkmyb3sCAmNzmGEongMtgAxkzug/HQW1cxnqig9m54foI58ZGbVgmUajQvEbUCN/98wFGI5KdYTOhaJKMFlE6lG9I0A==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=ppford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=selector2-azureford-onmicrosoft-com header.d=azureford.onmicrosoft.com header.i="@azureford.onmicrosoft.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=ppserprodsaar header.d=saarlouis.ford.com header.i="@saarlouis.ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=ppfserpocford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"
  • Cc: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, michal.orzel@xxxxxxx, roger@xxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, dmukhin@xxxxxxx, Denis Mukhin <dmukhin@xxxxxxxx>
  • Delivery-date: Thu, 05 Nov 2026 01:40:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

From: Denis Mukhin <dmukhin@xxxxxxxx>

Add few more registers definitions for testing: TPR, EOI, ISR, IRR.

Add routines to extract APIC ID from register 0x20.

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
 arch/x86/include/arch/apic.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arch/x86/include/arch/apic.h b/arch/x86/include/arch/apic.h
index 71c09a836998..8cf28ba5a39b 100644
--- a/arch/x86/include/arch/apic.h
+++ b/arch/x86/include/arch/apic.h
@@ -17,10 +17,24 @@
 
 /* Local APIC register definitions. */
 #define APIC_ID         0x020
+#define   GET_xAPIC_ID(x)         (((x) >> 24) & 0xffu)
+#define   SET_xAPIC_ID(x)         (((x) << 24))
+
 #define APIC_LVR        0x030
+
+#define APIC_TPR        0x080
+#define   APIC_TPR_MASK           0x000FF
+
+#define APIC_EOI        0x0b0
+#define   APIC_EOI_ACK            0x00000
+
 #define APIC_SPIV       0x0f0
 #define   APIC_SPIV_APIC_ENABLED  0x00100
 
+#define APIC_ISR        0x100
+
+#define APIC_IRR        0x200
+
 #define APIC_ESR        0x280
 #define   APIC_SIV                0x00020 /* Send Illegal Vector */
 #define   APIC_RIV                0x00040 /* Recieve Illegal Vector */
@@ -126,6 +140,21 @@ static inline void apic_icr_write(uint64_t val)
         return apic_msr_icr_write(val);
 }
 
+static inline bool apic_isr_read(unsigned int vector)
+{
+    return apic_read(APIC_ISR + (vector / 32 * 0x10)) & (1U << (vector % 32));
+}
+
+static inline bool apic_irr_read(unsigned int vector)
+{
+    return apic_read(APIC_IRR + (vector / 32 * 0x10)) & (1U << (vector % 32));
+}
+
+static inline unsigned int get_apic_id(void)
+{
+    return GET_xAPIC_ID(apic_read(APIC_ID));
+}
+
 #endif /* XTF_X86_APIC_H */
 
 /*
-- 
2.55.0




 


Rackspace

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