]> xenbits.xensource.com Git - people/hx242/xen.git/commitdiff
x86: PCID is unused when !PV
authorJan Beulich <jbeulich@suse.com>
Wed, 18 Sep 2019 13:21:51 +0000 (15:21 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 18 Sep 2019 13:21:51 +0000 (15:21 +0200)
This allows in particular some streamlining of the TLB flushing code
paths.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/flushtlb.c
xen/include/asm-x86/processor.h
xen/include/asm-x86/pv/domain.h

index 5ecce9c44a81c3bd3192c491cd13f7fd252dea76..c1ae0d9467a41b76f6500b7b5485c2a8f591887e 100644 (file)
 #define WRAP_MASK (0x000003FFU)
 #endif
 
+#ifndef CONFIG_PV
+# undef X86_CR4_PCIDE
+# define X86_CR4_PCIDE 0
+#endif
+
 u32 tlbflush_clock = 1U;
 DEFINE_PER_CPU(u32, tlbflush_time);
 
index e25c3223e4333011de213bbedb414ac6a7e6523e..c6fc1987a1b058363b9751123955068d7e7484e7 100644 (file)
@@ -289,7 +289,7 @@ static inline unsigned long cr3_pa(unsigned long cr3)
 
 static inline unsigned int cr3_pcid(unsigned long cr3)
 {
-    return cr3 & X86_CR3_PCID_MASK;
+    return IS_ENABLED(CONFIG_PV) ? cr3 & X86_CR3_PCID_MASK : 0;
 }
 
 static inline unsigned long read_cr4(void)
@@ -301,8 +301,12 @@ static inline void write_cr4(unsigned long val)
 {
     struct cpu_info *info = get_cpu_info();
 
+#ifdef CONFIG_PV
     /* No global pages in case of PCIDs enabled! */
     ASSERT(!(val & X86_CR4_PGE) || !(val & X86_CR4_PCIDE));
+#else
+    ASSERT(!(val & X86_CR4_PCIDE));
+#endif
 
     /*
      * On hardware supporting FSGSBASE, the value in %cr4 is the kernel's
index 99a0fe7b6a56b0334d102595144477383076af1c..7a69bfb303020ea6ec74d5de9cd554a9b4c05079 100644 (file)
  */
 static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 {
+#ifdef CONFIG_PV
     return X86_CR3_NOFLUSH | (is_xpti ? PCID_PV_XPTI : 0) |
            ((v->arch.flags & TF_kernel_mode) ? PCID_PV_PRIV : PCID_PV_USER);
+#else
+    ASSERT_UNREACHABLE();
+    return 0;
+#endif
 }
 
 #ifdef CONFIG_PV