mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/IDT: Rename idt_table[] to bsp_idt[]
Having variables named idt_table[] and idt_tables[] is not ideal. Use X86_IDT_VECTORS and remove IDT_ENTRIES. State the size of bsp_idt[] in idt.h so that load_system_tables() and cpu_smpboot_alloc() can use sizeof() rather than opencoding the calculation. Move the variable into a new traps-setup.c, to make a start at splitting traps.c in half. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
4d4725901e
commit
b7cfb45aaf
7 files changed
+20
-15
No files matched your search
@@ -65,6 +65,7 @@ obj-y += spec_ctrl.o
|
||||
obj-y += srat.o
|
||||
obj-y += string.o
|
||||
obj-y += time.o
|
||||
obj-y += traps-setup.o
|
||||
obj-y += traps.o
|
||||
obj-$(CONFIG_INTEL) += tsx.o
|
||||
obj-y += usercopy.o
|
||||
|
||||
@@ -831,7 +831,7 @@ void load_system_tables(void)
|
||||
};
|
||||
const struct desc_ptr idtr = {
|
||||
.base = (unsigned long)idt_tables[cpu],
|
||||
.limit = (IDT_ENTRIES * sizeof(idt_entry_t)) - 1,
|
||||
.limit = sizeof(bsp_idt) - 1,
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -28,8 +28,7 @@ typedef union {
|
||||
};
|
||||
} idt_entry_t;
|
||||
|
||||
#define IDT_ENTRIES 256
|
||||
extern idt_entry_t idt_table[];
|
||||
extern idt_entry_t bsp_idt[X86_IDT_VECTORS];
|
||||
extern idt_entry_t *idt_tables[];
|
||||
|
||||
/*
|
||||
|
||||
@@ -148,12 +148,12 @@ void __init pv_trap_init(void)
|
||||
{
|
||||
#ifdef CONFIG_PV32
|
||||
/* The 32-on-64 hypercall vector is only accessible from ring 1. */
|
||||
_set_gate(idt_table + HYPERCALL_VECTOR,
|
||||
_set_gate(bsp_idt + HYPERCALL_VECTOR,
|
||||
SYS_DESC_irq_gate, 1, entry_int82);
|
||||
#endif
|
||||
|
||||
/* Fast trap for int80 (faster than taking the #GP-fixup path). */
|
||||
_set_gate(idt_table + LEGACY_SYSCALL_VECTOR, SYS_DESC_irq_gate, 3,
|
||||
_set_gate(bsp_idt + LEGACY_SYSCALL_VECTOR, SYS_DESC_irq_gate, 3,
|
||||
&entry_int80);
|
||||
|
||||
open_softirq(NMI_SOFTIRQ, nmi_softirq);
|
||||
|
||||
@@ -1080,7 +1080,7 @@ static int cpu_smpboot_alloc(unsigned int cpu)
|
||||
idt_tables[cpu] = alloc_xenheap_pages(0, memflags);
|
||||
if ( idt_tables[cpu] == NULL )
|
||||
goto out;
|
||||
memcpy(idt_tables[cpu], idt_table, IDT_ENTRIES * sizeof(idt_entry_t));
|
||||
memcpy(idt_tables[cpu], bsp_idt, sizeof(bsp_idt));
|
||||
disable_each_ist(idt_tables[cpu]);
|
||||
|
||||
for ( stub_page = 0, i = cpu & ~(STUBS_PER_PAGE - 1);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* Configuration of event handling for all CPUs.
|
||||
*/
|
||||
#include <asm/idt.h>
|
||||
#include <asm/page.h>
|
||||
|
||||
idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
|
||||
bsp_idt[X86_IDT_VECTORS];
|
||||
@@ -98,10 +98,6 @@ DEFINE_PER_CPU_READ_MOSTLY(seg_desc_t *, compat_gdt);
|
||||
DEFINE_PER_CPU_READ_MOSTLY(l1_pgentry_t, compat_gdt_l1e);
|
||||
#endif
|
||||
|
||||
/* Master table, used by CPU0. */
|
||||
idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
|
||||
idt_table[IDT_ENTRIES];
|
||||
|
||||
/* Pointer to the IDT of every CPU. */
|
||||
idt_entry_t *idt_tables[NR_CPUS] __read_mostly;
|
||||
|
||||
@@ -1874,7 +1870,7 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
|
||||
static void __init noinline __set_intr_gate(unsigned int n,
|
||||
uint32_t dpl, void *addr)
|
||||
{
|
||||
_set_gate(&idt_table[n], SYS_DESC_irq_gate, dpl, addr);
|
||||
_set_gate(&bsp_idt[n], SYS_DESC_irq_gate, dpl, addr);
|
||||
}
|
||||
|
||||
static void __init set_swint_gate(unsigned int n, void *addr)
|
||||
@@ -1940,10 +1936,10 @@ void __init init_idt_traps(void)
|
||||
set_intr_gate (X86_EXC_CP, entry_CP);
|
||||
|
||||
/* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
|
||||
enable_each_ist(idt_table);
|
||||
enable_each_ist(bsp_idt);
|
||||
|
||||
/* CPU0 uses the master IDT. */
|
||||
idt_tables[0] = idt_table;
|
||||
idt_tables[0] = bsp_idt;
|
||||
|
||||
this_cpu(gdt) = boot_gdt;
|
||||
if ( IS_ENABLED(CONFIG_PV32) )
|
||||
@@ -2001,13 +1997,13 @@ void __init trap_init(void)
|
||||
if ( autogen_entrypoints[vector] )
|
||||
{
|
||||
/* Found autogen entry: check we won't clobber an existing trap. */
|
||||
ASSERT(idt_table[vector].b == 0);
|
||||
ASSERT(bsp_idt[vector].b == 0);
|
||||
set_intr_gate(vector, autogen_entrypoints[vector]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No entry point: confirm we have an existing trap in place. */
|
||||
ASSERT(idt_table[vector].b != 0);
|
||||
ASSERT(bsp_idt[vector].b != 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||