|
@@ -44,6 +44,19 @@ extern unsigned long __FIXADDR_TOP;
|
|
|
PAGE_SIZE)
|
|
|
#endif
|
|
|
|
|
|
+/*
|
|
|
+ * cpu_entry_area is a percpu region in the fixmap that contains things
|
|
|
+ * needed by the CPU and early entry/exit code. Real types aren't used
|
|
|
+ * for all fields here to avoid circular header dependencies.
|
|
|
+ *
|
|
|
+ * Every field is a virtual alias of some other allocated backing store.
|
|
|
+ * There is no direct allocation of a struct cpu_entry_area.
|
|
|
+ */
|
|
|
+struct cpu_entry_area {
|
|
|
+ char gdt[PAGE_SIZE];
|
|
|
+};
|
|
|
+
|
|
|
+#define CPU_ENTRY_AREA_PAGES (sizeof(struct cpu_entry_area) / PAGE_SIZE)
|
|
|
|
|
|
/*
|
|
|
* Here we define all the compile-time 'special' virtual
|
|
@@ -101,8 +114,8 @@ enum fixed_addresses {
|
|
|
FIX_LNW_VRTC,
|
|
|
#endif
|
|
|
/* Fixmap entries to remap the GDTs, one per processor. */
|
|
|
- FIX_GDT_REMAP_BEGIN,
|
|
|
- FIX_GDT_REMAP_END = FIX_GDT_REMAP_BEGIN + NR_CPUS - 1,
|
|
|
+ FIX_CPU_ENTRY_AREA_TOP,
|
|
|
+ FIX_CPU_ENTRY_AREA_BOTTOM = FIX_CPU_ENTRY_AREA_TOP + (CPU_ENTRY_AREA_PAGES * NR_CPUS) - 1,
|
|
|
|
|
|
#ifdef CONFIG_ACPI_APEI_GHES
|
|
|
/* Used for GHES mapping from assorted contexts */
|
|
@@ -191,5 +204,25 @@ void __init *early_memremap_decrypted_wp(resource_size_t phys_addr,
|
|
|
void __early_set_fixmap(enum fixed_addresses idx,
|
|
|
phys_addr_t phys, pgprot_t flags);
|
|
|
|
|
|
+static inline unsigned int __get_cpu_entry_area_page_index(int cpu, int page)
|
|
|
+{
|
|
|
+ BUILD_BUG_ON(sizeof(struct cpu_entry_area) % PAGE_SIZE != 0);
|
|
|
+
|
|
|
+ return FIX_CPU_ENTRY_AREA_BOTTOM - cpu*CPU_ENTRY_AREA_PAGES - page;
|
|
|
+}
|
|
|
+
|
|
|
+#define __get_cpu_entry_area_offset_index(cpu, offset) ({ \
|
|
|
+ BUILD_BUG_ON(offset % PAGE_SIZE != 0); \
|
|
|
+ __get_cpu_entry_area_page_index(cpu, offset / PAGE_SIZE); \
|
|
|
+ })
|
|
|
+
|
|
|
+#define get_cpu_entry_area_index(cpu, field) \
|
|
|
+ __get_cpu_entry_area_offset_index((cpu), offsetof(struct cpu_entry_area, field))
|
|
|
+
|
|
|
+static inline struct cpu_entry_area *get_cpu_entry_area(int cpu)
|
|
|
+{
|
|
|
+ return (struct cpu_entry_area *)__fix_to_virt(__get_cpu_entry_area_page_index(cpu, 0));
|
|
|
+}
|
|
|
+
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
#endif /* _ASM_X86_FIXMAP_H */
|