|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 29/44] x86/smp: Allocate percpu resources for the GDT and LDT
Like the mapcache region, we need an L1e which is modifiable in the context
switch code.
The Xen-reserved GDT frames are proactively mapped for the benefit of future
changes to the AP boot path.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/smpboot.c | 21 +++++++++++++++++++++
xen/include/asm-x86/config.h | 4 ++++
2 files changed, 25 insertions(+)
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index a5d3f7a..cc80f24 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -822,6 +822,27 @@ static int cpu_smpboot_alloc_common(unsigned int cpu)
if ( rc )
goto out;
+ /* Allocate space for the GDT/LDT L1e's... */
+ rc = percpu_alloc_l1t(cpu, PERCPU_GDT_MAPPING, &pg);
+ if ( rc )
+ goto out;
+
+ /* ... and map the L1t so it can be used... */
+ rc = percpu_map_frame(cpu, PERCPU_GDT_LDT_L1ES, pg, PAGE_HYPERVISOR_RW);
+ if ( rc )
+ goto out;
+
+ /* ... and map Xen-reserved GDT frames. */
+ rc = percpu_map_frame(cpu, PERCPU_GDT_MAPPING + FIRST_RESERVED_GDT_BYTE,
+ virt_to_page(per_cpu(gdt_table, cpu)),
+ PAGE_HYPERVISOR_RW);
+ if ( rc )
+ goto out;
+ rc = percpu_map_frame(cpu, PERCPU_GDT_MAPPING + FIRST_RESERVED_GDT_BYTE +
PAGE_SIZE,
+ virt_to_page(zero_page), __PAGE_HYPERVISOR_RO);
+ if ( rc )
+ goto out;
+
rc = 0; /* Success */
out:
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index c7503ad..dfe1f03 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -302,6 +302,10 @@ extern unsigned long xen_phys_start;
#define PERCPU_XLAT_START (PERCPU_LINEAR_START + MB(6) + KB(8))
+#define PERCPU_GDT_LDT_L1ES (PERCPU_LINEAR_START + MB(8) + KB(12))
+#define PERCPU_GDT_MAPPING (PERCPU_LINEAR_START + MB(10))
+#define PERCPU_LDT_MAPPING (PERCPU_LINEAR_START + MB(11))
+
/* GDT/LDT shadow mapping area. The first per-domain-mapping sub-area. */
#define GDT_LDT_VCPU_SHIFT 5
#define GDT_LDT_VCPU_VA_SHIFT (GDT_LDT_VCPU_SHIFT + PAGE_SHIFT)
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |