[PATCH 2/3] x86/apic: Drop the APIC_MSR_BASE constant

Andrew Cooper posted 3 patches 11 months, 3 weeks ago
[PATCH 2/3] x86/apic: Drop the APIC_MSR_BASE constant
Posted by Andrew Cooper 11 months, 3 weeks ago
Use MSR_X2APIC_FIRST from msr-index.h instead.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
---
 xen/arch/x86/include/asm/apic.h    | 4 ++--
 xen/arch/x86/include/asm/apicdef.h | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/include/asm/apic.h b/xen/arch/x86/include/asm/apic.h
index 288b4933eb38..486d689478b2 100644
--- a/xen/arch/x86/include/asm/apic.h
+++ b/xen/arch/x86/include/asm/apic.h
@@ -69,7 +69,7 @@ static __inline void apic_wrmsr(unsigned long reg, uint64_t msr_content)
         reg == APIC_LVR)
         return;
 
-    wrmsrl(APIC_MSR_BASE + (reg >> 4), msr_content);
+    wrmsrl(MSR_X2APIC_FIRST + (reg >> 4), msr_content);
 }
 
 static __inline uint64_t apic_rdmsr(unsigned long reg)
@@ -79,7 +79,7 @@ static __inline uint64_t apic_rdmsr(unsigned long reg)
     if (reg == APIC_DFR)
         return -1u;
 
-    rdmsrl(APIC_MSR_BASE + (reg >> 4), msr_content);
+    rdmsrl(MSR_X2APIC_FIRST + (reg >> 4), msr_content);
     return msr_content;
 }
 
diff --git a/xen/arch/x86/include/asm/apicdef.h b/xen/arch/x86/include/asm/apicdef.h
index 8d1b0087d4ef..c4068ccc10f4 100644
--- a/xen/arch/x86/include/asm/apicdef.h
+++ b/xen/arch/x86/include/asm/apicdef.h
@@ -124,9 +124,6 @@
 
 #define APIC_BASE __fix_to_virt(FIX_APIC_BASE)
 
-/* It's only used in x2APIC mode of an x2APIC unit. */
-#define APIC_MSR_BASE 0x800
-
 #define MAX_IO_APICS 128
 
 extern bool x2apic_enabled;
-- 
2.30.2


Re: [PATCH 2/3] x86/apic: Drop the APIC_MSR_BASE constant
Posted by Stefano Stabellini 11 months, 3 weeks ago
On Wed, 22 Nov 2023, Andrew Cooper wrote:
> Use MSR_X2APIC_FIRST from msr-index.h instead.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>