From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Keir Fraser <keir@xen.org>, Jan Beulich <JBeulich@suse.com>,
Tim Deegan <tim@xen.org>
Subject: [PATCH RFC 5/9] x86/traps: Functional prep work
Date: Thu, 15 May 2014 10:48:15 +0100 [thread overview]
Message-ID: <1400147299-31772-6-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1400147299-31772-1-git-send-email-andrew.cooper3@citrix.com>
* Promote certain actions to earlier in __start_xen().
* Declare double_fault and early_page_fault as standard trap handlers.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>
---
It would be nice if the linker could sort the exception tables, and the Xen
check could be one for sanity.
---
xen/arch/x86/setup.c | 11 ++++++-----
xen/arch/x86/x86_64/traps.c | 1 -
xen/include/asm-x86/processor.h | 2 ++
xen/include/asm-x86/setup.h | 1 -
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a864b9f..a69e25e 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -558,6 +558,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
.stop_bits = 1
};
+ set_processor_id(0);
+ set_current((struct vcpu *)0xfffff000); /* debug sanity */
+ this_cpu(curr_vcpu) = idle_vcpu[0] = current;
+
+ sort_exception_tables();
+
percpu_init_areas();
set_intr_gate(TRAP_page_fault, &early_page_fault);
@@ -588,9 +594,6 @@ void __init noreturn __start_xen(unsigned long mbi_p)
parse_video_info();
- set_current((struct vcpu *)0xfffff000); /* debug sanity */
- idle_vcpu[0] = current;
- set_processor_id(0); /* needed early, for smp_processor_id() */
if ( cpu_has_efer )
rdmsrl(MSR_EFER, this_cpu(efer));
asm volatile ( "mov %%cr4,%0" : "=r" (this_cpu(cr4)) );
@@ -1212,8 +1215,6 @@ void __init noreturn __start_xen(unsigned long mbi_p)
if ( opt_watchdog )
nmi_watchdog = NMI_LOCAL_APIC;
- sort_exception_tables();
-
find_smp_config();
dmi_scan_machine();
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index e1c7b3b..e6c66a0 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -223,7 +223,6 @@ void show_page_walk(unsigned long addr)
l1_table_offset(addr), l1e_get_intpte(l1e), pfn);
}
-void double_fault(void);
void do_double_fault(struct cpu_user_regs *regs)
{
unsigned int cpu;
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index 35b2433..c9051be 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -500,12 +500,14 @@ DECLARE_TRAP_HANDLER(overflow);
DECLARE_TRAP_HANDLER(bounds);
DECLARE_TRAP_HANDLER(invalid_op);
DECLARE_TRAP_HANDLER(device_not_available);
+DECLARE_TRAP_HANDLER(double_fault);
DECLARE_TRAP_HANDLER(coprocessor_segment_overrun);
DECLARE_TRAP_HANDLER(invalid_TSS);
DECLARE_TRAP_HANDLER(segment_not_present);
DECLARE_TRAP_HANDLER(stack_segment);
DECLARE_TRAP_HANDLER(general_protection);
DECLARE_TRAP_HANDLER(page_fault);
+DECLARE_TRAP_HANDLER(early_page_fault);
DECLARE_TRAP_HANDLER(coprocessor_error);
DECLARE_TRAP_HANDLER(simd_coprocessor_error);
DECLARE_TRAP_HANDLER(machine_check);
diff --git a/xen/include/asm-x86/setup.h b/xen/include/asm-x86/setup.h
index 3039e1b..8f8c6f3 100644
--- a/xen/include/asm-x86/setup.h
+++ b/xen/include/asm-x86/setup.h
@@ -7,7 +7,6 @@ extern unsigned long xenheap_initial_phys_start;
void early_cpu_init(void);
void early_time_init(void);
-void early_page_fault(void);
int intel_cpu_init(void);
int amd_init_cpu(void);
--
1.7.10.4
next prev parent reply other threads:[~2014-05-15 9:48 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-15 9:48 [PATCH RFC 0/9] x86: Improvements to trap handling Andrew Cooper
2014-05-15 9:48 ` [PATCH RFC 1/9] x86/traps: Names for system descriptor types Andrew Cooper
2014-05-15 9:56 ` Andrew Cooper
2014-05-15 10:08 ` Jan Beulich
2014-05-15 10:26 ` Andrew Cooper
2014-05-15 12:10 ` Jan Beulich
2014-05-15 9:48 ` [PATCH RFC 2/9] x86/traps: Make panic and reboot paths safe during early boot Andrew Cooper
2014-05-15 10:19 ` Jan Beulich
2014-05-15 10:53 ` Andrew Cooper
2014-05-15 12:12 ` Jan Beulich
2014-05-15 15:46 ` Andrew Cooper
2014-05-15 15:59 ` Jan Beulich
2014-05-15 9:48 ` [PATCH RFC 3/9] x86/traps: Make the main trap handlers safe for use early during Xen boot Andrew Cooper
2014-05-15 10:20 ` Jan Beulich
2014-05-15 9:48 ` [PATCH RFC 4/9] x86/misc: Early cleanup Andrew Cooper
2014-05-15 10:32 ` Jan Beulich
2014-05-15 10:38 ` Andrew Cooper
2014-05-15 9:48 ` Andrew Cooper [this message]
2014-05-15 10:36 ` [PATCH RFC 5/9] x86/traps: Functional prep work Jan Beulich
2014-05-15 10:45 ` Andrew Cooper
2014-05-15 12:15 ` Jan Beulich
2014-05-15 12:42 ` Andrew Cooper
2014-05-15 9:48 ` [PATCH RFC 6/9] x86/boot: Install trap handlers much earlier on boot Andrew Cooper
2014-05-15 10:53 ` Jan Beulich
2014-05-15 11:05 ` Andrew Cooper
2014-05-15 12:21 ` Jan Beulich
2014-05-15 9:48 ` [PATCH RFC 7/9] x86/boot: Drop pre-C IDT patching Andrew Cooper
2014-05-15 9:48 ` [PATCH RFC 8/9] x86/irqs: Move interrupt-stub generation out of C Andrew Cooper
2014-05-15 13:06 ` Jan Beulich
2014-05-15 9:48 ` [PATCH RFC 9/9] x86/misc: Post cleanup Andrew Cooper
2014-05-15 13:14 ` Jan Beulich
2014-05-15 13:17 ` Andrew Cooper
2014-05-16 8:49 ` [PATCH RFC 0/9] x86: Improvements to trap handling Wu, Feng
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=1400147299-31772-6-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).