From: Thomas Gleixner <tglx@linutronix.de> To: LKML <linux-kernel@vger.kernel.org> Cc: Ingo Molnar <mingo@kernel.org>, Peter Anvin <hpa@zytor.com>, Peter Zijlstra <peterz@infradead.org>, Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>, Steven Rostedt <rostedt@goodmis.org> Subject: [patch V3 33/44] x86/idt: Move early IDT setup out of 32bit asm Date: Mon, 28 Aug 2017 08:47:48 +0200 Message-ID: <20170828064958.757980775@linutronix.de> (raw) In-Reply-To: <20170828064715.802987421@linutronix.de> [-- Attachment #0: x86-idt--Move-early-idt-setup-out-of-32bit-asm.patch --] [-- Type: text/plain, Size: 3280 bytes --] The early IDT setup can be done in C code like it's done on 64 bit. Reuse the 64 bit version. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- arch/x86/include/asm/segment.h | 1 + arch/x86/kernel/head32.c | 4 ++++ arch/x86/kernel/head_32.S | 36 ++---------------------------------- arch/x86/kernel/idt.c | 4 ++++ 4 files changed, 11 insertions(+), 34 deletions(-) --- a/arch/x86/include/asm/segment.h +++ b/arch/x86/include/asm/segment.h @@ -238,6 +238,7 @@ #ifndef __ASSEMBLY__ extern const char early_idt_handler_array[NUM_EXCEPTION_VECTORS][EARLY_IDT_HANDLER_SIZE]; +extern void early_ignore_irq(void); /* * Load a segment. Fall back on loading the zero segment if something goes --- a/arch/x86/kernel/head32.c +++ b/arch/x86/kernel/head32.c @@ -10,6 +10,7 @@ #include <linux/mm.h> #include <linux/memblock.h> +#include <asm/desc.h> #include <asm/setup.h> #include <asm/sections.h> #include <asm/e820/api.h> @@ -30,6 +31,9 @@ static void __init i386_default_early_se asmlinkage __visible void __init i386_start_kernel(void) { cr4_init_shadow(); + + idt_setup_early_handler(); + sanitize_boot_params(&boot_params); x86_early_init_platform_quirks(); --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S @@ -345,7 +345,6 @@ ENTRY(startup_32_smp) movl %eax,%cr0 lgdt early_gdt_descr - lidt idt_descr ljmp $(__KERNEL_CS),$1f 1: movl $(__KERNEL_DS),%eax # reload all the segment registers movl %eax,%ss # after changing gdt. @@ -378,37 +377,6 @@ ENDPROC(startup_32_smp) */ __INIT setup_once: - /* - * Set up a idt with 256 interrupt gates that push zero if there - * is no error code and then jump to early_idt_handler_common. - * It doesn't actually load the idt - that needs to be done on - * each CPU. Interrupts are enabled elsewhere, when we can be - * relatively sure everything is ok. - */ - - movl $idt_table,%edi - movl $early_idt_handler_array,%eax - movl $NUM_EXCEPTION_VECTORS,%ecx -1: - movl %eax,(%edi) - movl %eax,4(%edi) - /* interrupt gate, dpl=0, present */ - movl $(0x8E000000 + __KERNEL_CS),2(%edi) - addl $EARLY_IDT_HANDLER_SIZE,%eax - addl $8,%edi - loop 1b - - movl $256 - NUM_EXCEPTION_VECTORS,%ecx - movl $ignore_int,%edx - movl $(__KERNEL_CS << 16),%eax - movw %dx,%ax /* selector = 0x0010 = cs */ - movw $0x8E00,%dx /* interrupt gate - dpl=0, present */ -2: - movl %eax,(%edi) - movl %edx,4(%edi) - addl $8,%edi - loop 2b - #ifdef CONFIG_CC_STACKPROTECTOR /* * Configure the stack canary. The linker can't handle this by @@ -498,7 +466,7 @@ ENDPROC(early_idt_handler_common) /* This is the default interrupt "handler" :-) */ ALIGN -ignore_int: +ENTRY(early_ignore_irq) cld #ifdef CONFIG_PRINTK pushl %eax @@ -533,7 +501,7 @@ ENDPROC(early_idt_handler_common) hlt_loop: hlt jmp hlt_loop -ENDPROC(ignore_int) +ENDPROC(early_ignore_irq) __INITDATA .align 4 GLOBAL(early_recursion_flag) --- a/arch/x86/kernel/idt.c +++ b/arch/x86/kernel/idt.c @@ -34,6 +34,10 @@ void __init idt_setup_early_handler(void for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) set_intr_gate(i, early_idt_handler_array[i]); +#ifdef CONFIG_X86_32 + for ( ; i < NR_VECTORS; i++) + set_intr_gate(i, early_ignore_irq); +#endif load_idt(&idt_descr); }
next prev parent reply index Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-08-28 6:47 [patch V3 00/44] x86: Cleanup IDT code Thomas Gleixner 2017-08-28 6:47 ` [patch V3 01/44] x86/irq: Remove vector_used_by_percpu_irq() Thomas Gleixner 2017-08-29 11:04 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 02/44] x86/irq: Unexport used_vectors Thomas Gleixner 2017-08-29 11:04 ` [tip:x86/apic] x86/irq: Unexport used_vectors[] tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 03/44] x86/irq: Get rid of the first_system_vector bogisity Thomas Gleixner 2017-08-29 11:04 ` [tip:x86/apic] x86/irq: Get rid of the 'first_system_vector' indirection bogosity tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 04/44] x86/irq: Remove duplicated used_vectors definition Thomas Gleixner 2017-08-29 11:05 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 05/44] x86/boot: Move EISA setup to a proper place Thomas Gleixner 2017-08-29 11:05 ` [tip:x86/apic] x86/boot: Move EISA setup to a separate file tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 06/44] x86/tracing: Introduce a static key for exception tracing Thomas Gleixner 2017-08-29 11:06 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 07/44] x86/traps: Simplify pagefault tracing logic Thomas Gleixner 2017-08-29 11:06 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 08/44] x86/apic: Remove the duplicated tracing version of local_timer_interrupt Thomas Gleixner 2017-08-29 11:07 ` [tip:x86/apic] x86/apic: Remove the duplicated tracing version of local_timer_interrupt() tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 09/44] x86/apic: Use this_cpu_ptr in local_timer_interrupt Thomas Gleixner 2017-08-29 11:07 ` [tip:x86/apic] x86/apic: Use this_cpu_ptr() in local_timer_interrupt() tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 10/44] x86/irq: Get rid of duplicated trace_x86_platform_ipi() code Thomas Gleixner 2017-08-29 11:07 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 11/44] x86/apic: Remove the duplicated tracing versions of interrupts Thomas Gleixner 2017-08-29 11:08 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 12/44] x86/irqwork: Get rid of duplicated tracing interrupt code Thomas Gleixner 2017-08-29 11:08 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 13/44] x86/mce: Remove " Thomas Gleixner 2017-08-29 11:08 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 14/44] x86/smp: Remove pointless duplicated " Thomas Gleixner 2017-08-29 11:09 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 15/44] x86/smp: Use static key for reschedule interrupt tracing Thomas Gleixner 2017-08-29 11:09 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 16/44] x86/idt: Remove tracing idt completely Thomas Gleixner 2017-08-29 11:10 ` [tip:x86/apic] x86/idt: Remove the tracing IDT completely tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 17/44] x86/idt: Cleanup the i386 low level entry macros Thomas Gleixner 2017-08-29 11:10 ` [tip:x86/apic] x86/idt: Clean up " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 18/44] x86/tracing: Disentangle pagefault and resched IPI tracing key Thomas Gleixner 2017-08-29 11:10 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 19/44] x86/ipi: Make platform IPI depend on APIC Thomas Gleixner 2017-08-29 11:11 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 20/44] x86/irq_work: Make it " Thomas Gleixner 2017-08-29 11:11 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 21/44] x86/tracing: Build tracepoints only when they are used Thomas Gleixner 2017-08-29 11:12 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 22/44] x86/idt: Unify gate_struct handling for 32/64bit Thomas Gleixner 2017-08-29 11:12 ` [tip:x86/apic] x86/idt: Unify gate_struct handling for 32/64-bit kernels tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 23/44] x86/percpu: Use static initializer for GDT entry Thomas Gleixner 2017-08-29 11:13 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 24/44] x86/fpu: Use bitfield accessors for desc_struct Thomas Gleixner 2017-08-29 11:13 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 25/44] x86: Replace access to desc_struct:a/b fields Thomas Gleixner 2017-08-29 11:13 ` [tip:x86/apic] x86/asm: " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 26/44] x86/gdt: Use bitfields for initialization Thomas Gleixner 2017-08-29 11:14 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 27/44] x86/ldttss: Cleanup 32bit descriptors Thomas Gleixner 2017-08-29 11:14 ` [tip:x86/apic] x86/ldttss: Clean up 32-bit descriptors tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 28/44] x86/idt: Create file for IDT related code Thomas Gleixner 2017-08-29 11:15 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 29/44] x86/idt: Move 32bit idt_descr to C code Thomas Gleixner 2017-08-29 11:15 ` [tip:x86/apic] x86/idt: Move 32-bit " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 30/44] x86/idt: Remove unused set_trap_gate() Thomas Gleixner 2017-08-29 11:16 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 31/44] x86/idt: Consolidate IDT invalidation Thomas Gleixner 2017-08-29 11:16 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 32/44] x86/idt: Move early IDT handler setup to IDT code Thomas Gleixner 2017-08-29 11:16 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` Thomas Gleixner [this message] 2017-08-29 11:17 ` [tip:x86/apic] x86/idt: Move early IDT setup out of 32-bit asm tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 34/44] x86/idt: Prepare for table based init Thomas Gleixner 2017-08-29 11:17 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 35/44] x86/idt: Switch early trap init to IDT tables Thomas Gleixner 2017-08-29 11:18 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 36/44] x86/idt: Move debug stack init to table based Thomas Gleixner 2017-08-29 11:18 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 37/44] x86/idt: Move ist stack based traps to table init Thomas Gleixner 2017-08-29 11:18 ` [tip:x86/apic] x86/idt: Move IST " tip-bot for Thomas Gleixner 2017-09-01 6:28 ` Andrei Vagin 2017-09-01 8:26 ` [PATCH] x86/idt: Fix the X86_TRAP_BP gate Ingo Molnar 2017-09-01 8:59 ` Thomas Gleixner 2017-09-01 9:09 ` [tip:x86/apic] " tip-bot for Ingo Molnar 2017-09-01 14:39 ` [PATCH] " Andrei Vagin 2017-08-28 6:47 ` [patch V3 38/44] x86/idt: Move regular trap init to tables Thomas Gleixner 2017-08-29 11:19 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 39/44] x86/idt: Move APIC gate initialization " Thomas Gleixner 2017-08-29 11:19 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 40/44] x86/idt: Move interrupt gate initialization to IDT code Thomas Gleixner 2017-08-29 11:20 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 41/44] x86/idt: Remove unused functions/inlines Thomas Gleixner 2017-08-29 11:20 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 42/44] x86/idt: Deinline setup functions Thomas Gleixner 2017-08-29 11:20 ` [tip:x86/apic] " tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 43/44] x86/idt: Simplify alloc_intr_gate Thomas Gleixner 2017-08-28 14:35 ` KY Srinivasan 2017-08-29 11:21 ` [tip:x86/apic] x86/idt: Simplify alloc_intr_gate() tip-bot for Thomas Gleixner 2017-08-28 6:47 ` [patch V3 44/44] x86/idt: Hide set_intr_gate() Thomas Gleixner 2017-08-29 11:21 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20170828064958.757980775@linutronix.de \ --to=tglx@linutronix.de \ --cc=bp@alien8.de \ --cc=hpa@zytor.com \ --cc=linux-kernel@vger.kernel.org \ --cc=luto@kernel.org \ --cc=mingo@kernel.org \ --cc=peterz@infradead.org \ --cc=rostedt@goodmis.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ linux-kernel@vger.kernel.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git