mini-os: initial ARM support
v5 cover mini-os: initial ARM support
This series is based on Karim's ARM support commits, further broken up into smaller patches.
The comments from last time should be addressed now, plus a few other things:
- The biggest change in this roll is that it can now cope with being loaded at different addresses, and so works on Xen 4.4 and Xen/unstable. It does this by configuring the MMU to map virtual address x to physical address (x + physical_address_offset), where physical_address_offset is calculated to make everything appear where the linker is expecting it.
- The GIC code has moved into the arm directory.
- To make review easier (as requested), libfdt support is now added before the main ARM commit, which now uses the FDT immediately rather than adding support in later commits.
- I also re-enabled test_xenbus. The old code said "Xenbus tests disabled, because of a Xend bug". Since xend doesn't exist any longer, we can enable these again.
This patch roll is also available here:
https://github.com/talex5/xen/commits/sent-Jun-26
Please include Karim in any reply as I am not the author of much of this code.
Karim Raslan (4):
mini-os: switched initial C entry point to arch_init
mini-os: added arch_init_gnttab
mini-os: headers for ARM
mini-os: import libfdt
Thomas Leonard (16):
mini-os: build fixes
mini-os: fixed shutdown thread
mini-os: fixed format string error in unbind_evtchn
mini-os: use unbind_evtchn in unbind_all_ports
mini-os: made off_t type signed
mini-os: whitespace
mini-os: don't require XEN_HAVE_PV_UPCALL_MASK
mini-os: add missing casts to MM printk
mini-os: added HYPERVISOR_xsm_op
mini-os: added arch_unbind_ports
mini-os: moved __pte to x86
mini-os: moved unlikely/likely macros to new compiler.h
mini-os: enable test_xenbus again
mini-os: use irqs_disabled() helper in schedule
mini-os: initial ARM support
mini-os: arm: show registers, stack and exception vector on fault
extras/mini-os/ARM-TODO.txt | 5 + extras/mini-os/COPYING | 27 + extras/mini-os/Config.mk | 2 + extras/mini-os/Makefile | 45 +- extras/mini-os/arch/arm/Makefile | 32 + extras/mini-os/arch/arm/arch.mk | 7 + extras/mini-os/arch/arm/arm32.S | 332 +++++ extras/mini-os/arch/arm/events.c | 30 + extras/mini-os/arch/arm/gic.c | 222 +++ extras/mini-os/arch/arm/hypercalls32.S | 75 + extras/mini-os/arch/arm/minios-arm32.lds | 75 + extras/mini-os/arch/arm/mm.c | 134 ++ extras/mini-os/arch/arm/panic.c | 99 ++ extras/mini-os/arch/arm/sched.c | 37 + extras/mini-os/arch/arm/setup.c | 116 ++ extras/mini-os/arch/arm/time.c | 202 +++ extras/mini-os/arch/x86/events.c | 4 + extras/mini-os/arch/x86/mm.c | 13 + extras/mini-os/arch/x86/setup.c | 44 +- extras/mini-os/arch/x86/x86_32.S | 2 +- extras/mini-os/arch/x86/x86_64.S | 2 +- extras/mini-os/events.c | 39 +- extras/mini-os/gnttab.c | 11 +- extras/mini-os/hypervisor.c | 12 +- extras/mini-os/include/arm/arch_endian.h | 7 + extras/mini-os/include/arm/arch_limits.h | 9 + extras/mini-os/include/arm/arch_mm.h | 35 + extras/mini-os/include/arm/arch_sched.h | 19 + extras/mini-os/include/arm/arch_spinlock.h | 36 + extras/mini-os/include/arm/arm32/arch_wordsize.h | 1 + extras/mini-os/include/arm/gic.h | 1 + extras/mini-os/include/arm/hypercall-arm.h | 98 ++ extras/mini-os/include/arm/os.h | 215 +++ extras/mini-os/include/arm/traps.h | 20 + extras/mini-os/include/compiler.h | 5 + extras/mini-os/include/events.h | 4 + extras/mini-os/include/fdt.h | 60 + extras/mini-os/include/gnttab.h | 1 + extras/mini-os/include/hypervisor.h | 2 + extras/mini-os/include/kernel.h | 6 +- extras/mini-os/include/lib.h | 4 +- extras/mini-os/include/libfdt.h | 1478 ++++++++++++++++++++ extras/mini-os/include/libfdt_env.h | 37 + extras/mini-os/include/mm.h | 2 + extras/mini-os/include/types.h | 24 +- extras/mini-os/include/x86/os.h | 16 +- .../mini-os/include/x86/x86_32/hypercall-x86_32.h | 5 + .../mini-os/include/x86/x86_64/hypercall-x86_64.h | 4 + extras/mini-os/kernel.c | 49 +- extras/mini-os/lib/fdt/fdt.c | 222 +++ extras/mini-os/lib/fdt/fdt_empty_tree.c | 84 ++ extras/mini-os/lib/fdt/fdt_ro.c | 574 ++++++++ extras/mini-os/lib/fdt/fdt_rw.c | 492 +++++++ extras/mini-os/lib/fdt/fdt_strerror.c | 96 ++ extras/mini-os/lib/fdt/fdt_sw.c | 256 ++++ extras/mini-os/lib/fdt/fdt_wip.c | 118 ++ extras/mini-os/lib/fdt/libfdt_internal.h | 95 ++ extras/mini-os/lib/memmove.c | 45 + extras/mini-os/lib/string.c | 12 + extras/mini-os/main.c | 2 +- extras/mini-os/mm.c | 4 +- extras/mini-os/sched.c | 36 +- extras/mini-os/test.c | 3 +- 63 files changed, 5606 insertions(+), 138 deletions(-) create mode 100644 extras/mini-os/ARM-TODO.txt create mode 100755 extras/mini-os/arch/arm/Makefile create mode 100644 extras/mini-os/arch/arm/arch.mk create mode 100644 extras/mini-os/arch/arm/arm32.S create mode 100644 extras/mini-os/arch/arm/events.c create mode 100644 extras/mini-os/arch/arm/gic.c create mode 100644 extras/mini-os/arch/arm/hypercalls32.S create mode 100755 extras/mini-os/arch/arm/minios-arm32.lds create mode 100644 extras/mini-os/arch/arm/mm.c create mode 100644 extras/mini-os/arch/arm/panic.c create mode 100644 extras/mini-os/arch/arm/sched.c create mode 100644 extras/mini-os/arch/arm/setup.c create mode 100644 extras/mini-os/arch/arm/time.c create mode 100644 extras/mini-os/include/arm/arch_endian.h create mode 100644 extras/mini-os/include/arm/arch_limits.h create mode 100644 extras/mini-os/include/arm/arch_mm.h create mode 100644 extras/mini-os/include/arm/arch_sched.h create mode 100755 extras/mini-os/include/arm/arch_spinlock.h create mode 100644 extras/mini-os/include/arm/arm32/arch_wordsize.h create mode 100644 extras/mini-os/include/arm/gic.h create mode 100644 extras/mini-os/include/arm/hypercall-arm.h create mode 100644 extras/mini-os/include/arm/os.h create mode 100644 extras/mini-os/include/arm/traps.h create mode 100644 extras/mini-os/include/compiler.h create mode 100644 extras/mini-os/include/fdt.h create mode 100644 extras/mini-os/include/libfdt.h create mode 100644 extras/mini-os/include/libfdt_env.h create mode 100644 extras/mini-os/lib/fdt/fdt.c create mode 100644 extras/mini-os/lib/fdt/fdt_empty_tree.c create mode 100644 extras/mini-os/lib/fdt/fdt_ro.c create mode 100644 extras/mini-os/lib/fdt/fdt_rw.c create mode 100644 extras/mini-os/lib/fdt/fdt_strerror.c create mode 100644 extras/mini-os/lib/fdt/fdt_sw.c create mode 100644 extras/mini-os/lib/fdt/fdt_wip.c create mode 100644 extras/mini-os/lib/fdt/libfdt_internal.h create mode 100644 extras/mini-os/lib/memmove.c
Signature · 1 line
2.0.0
PATCH v5 1/20 mini-os: build fixes
Make .o rules depend on the includes. Before, only the final link step depended on setting up the includes directory, making parallel builds unreliable.
Make symlinks use explicit make rules instead of using a phony target. Avoids unnecessary rebuilds.
--- extras/mini-os/Makefile | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
extras/mini-os/Makefile +17 -6
@@ -50,6 +50,11 @@ flags-$(CONFIG_XENBUS) += -DCONFIG_XENBUS DEF_CFLAGS += $(flags-y) +# Symlinks and headers that must be created before building the C files +GENERATED_HEADERS := include/list.h $(ARCH_LINKS) include/mini-os include/xen include/$(TARGET_ARCH_FAM)/mini-os + +EXTRA_DEPS += $(GENERATED_HEADERS) + # Include common mini-os makerules. include minios.mk
@@ -124,11 +129,18 @@ include/list.h: $(XEN_ROOT)/tools/include/xen-external/bsd-sys-queue-h-seddery $ perl $^ --prefix=minios >[email protected] $(call move-if-changed,[email protected],$@) +# Used by stubdom's Makefile .PHONY: links -links: include/list.h $(ARCH_LINKS) - [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen - [ -e include/mini-os ] || ln -sf . include/mini-os - [ -e include/$(TARGET_ARCH_FAM)/mini-os ] || ln -sf . include/$(TARGET_ARCH_FAM)/mini-os +links: $(GENERATED_HEADERS) + +include/xen: + ln -sf ../../../xen/include/public $@ + +include/mini-os: + ln -sf . $@ + +include/$(TARGET_ARCH_FAM)/mini-os: + ln -sf . $@ .PHONY: arch_lib arch_lib:
@@ -174,7 +186,7 @@ ifneq ($(APP_OBJS),) APP_O=$(OBJ_DIR)/$(TARGET)_app.o endif -$(OBJ_DIR)/$(TARGET): links include/list.h $(OBJS) $(APP_O) arch_lib +$(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o [email protected] $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start [email protected] [email protected] $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) [email protected] $(EXTRA_OBJS) -o $@
@@ -212,4 +224,3 @@ tags: .PHONY: TAGS TAGS: $(all_sources) | xargs etags -
Signature · 1 line
2.0.0
PATCH v5 2/20 mini-os: fixed shutdown thread
In reply to Thomas LeonardBefore, it read "" and started a shutdown immediately. Now, it waits for a non-empty value and then actually shuts down.
--- extras/mini-os/kernel.c | 10 +++++++--- extras/mini-os/main.c | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-)
extras/mini-os/kernel.c +7 -3
@@ -68,7 +68,9 @@ void setup_xen_features(void)/* This should be overridden by the application we are linked against. */ __attribute__((weak))void app_shutdown (unsigned reason) { +struct sched_shutdown sched_shutdown = { .reason = reason };printk ("Shutdown requested: %d\n" , reason); +HYPERVISOR_sched_op (SCHEDOP_shutdown, &sched_shutdown); }static void shutdown_thread (void *p)
@@ -76,12 +78,14 @@ static void shutdown_thread(void *p)const char *path ="control/shutdown" ;const char *token = path;xenbus_event_queue events =NULL ; -char *shutdown, *err; +char *shutdown =NULL , *err;unsigned int shutdown_reason;xenbus_watch_path_token (XBT_NIL , path, token, &events); -while ((err =xenbus_read (XBT_NIL , path, &shutdown)) !=NULL ) +while ((err =xenbus_read (XBT_NIL , path, &shutdown)) !=NULL || !strcmp (shutdown,"" )) {free (err); +free (shutdown); + shutdown =NULL ;xenbus_wait_for_watch (&events); } err =xenbus_unwatch_path_token (XBT_NIL , path, token);
@@ -106,7 +110,7 @@ static void shutdown_thread(void *p)/* This should be overridden by the application we are linked against. */ __attribute__((weak))int app_main (start_info_t *si) { -printk ("Dummy main: start_info=%p\n" , si); +printk ("kernel.c: dummy main: start_info=%p\n" , si);return 0 ; }
extras/mini-os/main.c +1 -1
@@ -185,7 +185,7 @@ void _exit(int ret)int app_main (start_info_t *si) { -printk ("Dummy main: start_info=%p\n" , si); +printk ("main.c: dummy main: start_info=%p\n" , si); main_thread =create_thread ("main" , call_main, si);return 0 ; }
Signature · 1 line
2.0.0
PATCH v5 3/20 mini-os: fixed format string error in unbind_evtchn
In reply to Thomas LeonardWould crash if HYPERVISOR_event_channel_op returned an error code. The other changes in this commit are just fixing indentation.
--- extras/mini-os/events.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
extras/mini-os/events.c +12 -13
@@ -109,24 +109,23 @@ evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,void unbind_evtchn (evtchn_port_t port ) { -struct evtchn_close close; +struct evtchn_close close;int rc; -if ( ev_actions[port].handler == default_handler ) -printk ("WARN: No handler for port %d when unbinding\n" , port); -mask_evtchn (port); -clear_evtchn (port); +if ( ev_actions[port].handler == default_handler ) +printk ("WARN: No handler for port %d when unbinding\n" , port); +mask_evtchn (port); +clear_evtchn (port); - ev_actions[port].handler = default_handler; -wmb (); - ev_actions[port].data =NULL ; -clear_bit (port, bound_ports); + ev_actions[port].handler = default_handler; +wmb (); + ev_actions[port].data =NULL ; +clear_bit (port, bound_ports); - close.port = port; - rc =HYPERVISOR_event_channel_op (EVTCHNOP_close, &close); + close.port = port; + rc =HYPERVISOR_event_channel_op (EVTCHNOP_close, &close);if ( rc ) -printk ("WARN: close_port %s failed rc=%d. ignored\n" , port, rc); - +printk ("WARN: close_port %d failed rc=%d. ignored\n" , port, rc); }evtchn_port_t bind_virq (uint32_t virq,evtchn_handler_t handler,void *data)
Signature · 1 line
2.0.0
PATCH v5 4/20 mini-os: use unbind_evtchn in unbind_all_ports
In reply to Thomas LeonardThis marks the channel as closed, in case someone tries to use it again.
--- extras/mini-os/events.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
extras/mini-os/events.c +1 -8
@@ -43,7 +43,6 @@ void unbind_all_ports(void)int cpu =0 ;shared_info_t *s = HYPERVISOR_shared_info;vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; -int rc;for ( i =0 ; i <NR_EVS ; i++ ) {
@@ -53,14 +52,8 @@ void unbind_all_ports(void)if (test_and_clear_bit (i, bound_ports) ) { -struct evtchn_close close;printk ("port %d still bound!\n" , i); -mask_evtchn (i); - close.port = i; - rc =HYPERVISOR_event_channel_op (EVTCHNOP_close, &close); -if ( rc ) -printk ("WARN: close_port %s failed rc=%d. ignored\n" , i, rc); -clear_evtchn (i); +unbind_evtchn (i); } } vcpu_info->evtchn_upcall_pending =0 ;
Signature · 1 line
2.0.0
PATCH v5 5/20 mini-os: made off_t type signed
In reply to Thomas LeonardPOSIX requires this.
--- extras/mini-os/include/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
extras/mini-os/include/types.h +1 -1
@@ -73,7 +73,7 @@ typedef unsigned long uint64_t;#endif typedef uint64_t uintmax_t ;typedef int64_t intmax_t ; -typedef uint64_t off_t ; +typedef int64_t off_t ;#endif typedef intptr_t ptrdiff_t ;
Signature · 1 line
2.0.0
PATCH v5 6/20 mini-os: switched initial C entry point to arch_init
In reply to Thomas LeonardFrom: Karim Raslan <[email protected]>
--- extras/mini-os/arch/x86/setup.c | 44 ++++++++++++++++++++++++++++++++-------- extras/mini-os/arch/x86/x86_32.S | 2 +- extras/mini-os/arch/x86/x86_64.S | 2 +- extras/mini-os/include/kernel.h | 6 ++++-- extras/mini-os/include/x86/os.h | 2 -- extras/mini-os/kernel.c | 37 ++++----------------------------- 6 files changed, 46 insertions(+), 47 deletions(-)
extras/mini-os/arch/x86/setup.c +36 -8
@@ -28,6 +28,8 @@#include <mini-os/os.h> #include <mini-os/lib.h> /* for printk, memcpy */ +#include <mini-os/kernel.h> +#include <xen/xen.h> /* * Shared page for communicating with the hypervisor.
@@ -87,20 +89,45 @@ static inline void sse_init(void) {#define sse_init ()#endif + +/* +* INITIAL C ENTRY POINT. +*/ void arch_init (start_info_t *si) { +static char hello[] ="Bootstrapping...\n" ; + + (void )HYPERVISOR_console_io (CONSOLEIO_write,strlen (hello), hello); + +trap_init (); +/*Initialize floating point unit */ -fpu_init (); +fpu_init (); -/* Initialize SSE */ -sse_init (); +/* Initialize SSE */ +sse_init ();/* Copy the start_info struct to a globally-accessible area. */ /* WARN: don't do printk before here, it uses information from shared_info. Use xprintk instead. */ memcpy (&start_info, si,sizeof (*si)); +/* print out some useful information */ +printk ("Xen Minimal OS!\n" ); +printk (" start_info: %p(VA)\n" , si); +printk (" nr_pages: 0x%lx\n" , si->nr_pages); +printk (" shared_inf: 0x%08lx(MA)\n" , si->shared_info); +printk (" pt_base: %p(VA)\n" , (void *)si->pt_base); +printk ("nr_pt_frames: 0x%lx\n" , si->nr_pt_frames); +printk (" mfn_list: %p(VA)\n" , (void *)si->mfn_list); +printk (" mod_start: 0x%lx(VA)\n" , si->mod_start); +printk (" mod_len: %lu\n" , si->mod_len); +printk (" flags: 0x%x\n" , (unsigned int )si->flags); +printk (" cmd_line: %s\n" , + si->cmd_line ? (const char *)si->cmd_line :"NULL" ); +printk (" stack: %p-%p\n" , stack, stack +sizeof (stack)); +/* set up minimal memory infos */ phys_to_machine_mapping = (unsigned long *)start_info.mfn_list;
@@ -118,12 +145,15 @@ arch_init(start_info_t *si) (unsigned long)failsafe_callback, 0);#endif - +start_kernel (); }void arch_fini (void ) { +/* Reset traps */ +trap_fini (); +#ifdef __i386__HYPERVISOR_set_callbacks (0 ,0 ,0 ,0 );#else
@@ -132,9 +162,7 @@ arch_fini(void) }void -arch_print_info (void ) +arch_do_exit (void ) { -printk (" stack: %p-%p\n" , stack, stack +sizeof (stack)); +stack_walk (); } - -
extras/mini-os/arch/x86/x86_32.S +1 -1
@@ -20,7 +20,7 @@ _start: lss stack_start,%esp andl $(~(__STACK_SIZE-1)), %esp push %esi - call start_kernel + call arch_init stack_start: .long stack+(2*__STACK_SIZE), __KERNEL_SS
extras/mini-os/arch/x86/x86_64.S +1 -1
@@ -21,7 +21,7 @@ _start: movq stack_start(%rip),%rsp andq $(~(__STACK_SIZE-1)), %rsp movq %rsi,%rdi - call start_kernel + call arch_init stack_start: .quad stack+(2*__STACK_SIZE)
extras/mini-os/include/kernel.h +4 -2
@@ -1,7 +1,9 @@#ifndef _KERNEL_H_#define _KERNEL_H_ -extern void do_exit (void ) __attribute__((noreturn)); -extern void stop_kernel (void ); +void start_kernel (void ); +void do_exit (void ) __attribute__((noreturn)); +void arch_do_exit (void ); +void stop_kernel (void );#endif /* _KERNEL_H_ */
extras/mini-os/include/x86/os.h +0 -2
@@ -64,8 +64,6 @@ extern shared_info_t *HYPERVISOR_shared_info;void trap_init (void );void trap_fini (void ); -void arch_init (start_info_t *si); -void arch_print_info (void );void arch_fini (void );
extras/mini-os/kernel.c +4 -33
@@ -28,6 +28,7 @@*/ #include <mini-os/os.h> +#include <mini-os/kernel.h> #include <mini-os/hypervisor.h> #include <mini-os/mm.h> #include <mini-os/events.h>
@@ -114,41 +115,14 @@ __attribute__((weak)) int app_main(start_info_t *si)return 0 ; } -/* -* INITIAL C ENTRY POINT. -*/ -void start_kernel (start_info_t *si) +void start_kernel (void ) { -static char hello[] ="Bootstrapping...\n" ; - - (void )HYPERVISOR_console_io (CONSOLEIO_write,strlen (hello), hello); - -arch_init (si); - -trap_init (); - -/* print out some useful information */ -printk ("Xen Minimal OS!\n" ); -printk (" start_info: %p(VA)\n" , si); -printk (" nr_pages: 0x%lx\n" , si->nr_pages); -printk (" shared_inf: 0x%08lx(MA)\n" , si->shared_info); -printk (" pt_base: %p(VA)\n" , (void *)si->pt_base); -printk ("nr_pt_frames: 0x%lx\n" , si->nr_pt_frames); -printk (" mfn_list: %p(VA)\n" , (void *)si->mfn_list); -printk (" mod_start: 0x%lx(VA)\n" , si->mod_start); -printk (" mod_len: %lu\n" , si->mod_len); -printk (" flags: 0x%x\n" , (unsigned int )si->flags); -printk (" cmd_line: %s\n" , - si->cmd_line ? (const char *)si->cmd_line :"NULL" ); -/* Set up events. */ init_events (); - +/* ENABLE EVENT DELIVERY. This is disabled at start of day. */ __sti (); -arch_print_info (); -setup_xen_features ();/* Init memory management. */
@@ -201,9 +175,6 @@ void stop_kernel(void)/* Reset events. */ fini_events (); -/* Reset traps */ -trap_fini (); -/* Reset arch details */ arch_fini (); }
@@ -218,7 +189,7 @@ void stop_kernel(void)void do_exit (void ) {printk ("Do_exit called!\n" ); -stack_walk (); +arch_do_exit ();for ( ;; ) {struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_crash };
Signature · 1 line
2.0.0
PATCH v5 7/20 mini-os: whitespace
In reply to Thomas Leonard--- extras/mini-os/gnttab.c | 2 +- extras/mini-os/hypervisor.c | 2 +- extras/mini-os/sched.c | 26 +++++++++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-)
extras/mini-os/gnttab.c +1 -1
@@ -164,7 +164,7 @@ gnttabop_error(int16_t status) { status = -status;if (status <0 || status >=ARRAY_SIZE (gnttabop_error_msgs)) -return "bad status" ; +return "bad status" ;else return gnttabop_error_msgs[status]; }
extras/mini-os/hypervisor.c +1 -1
@@ -64,7 +64,7 @@ void do_hypervisor_callback(struct pt_regs *regs) l2 &= ~(1UL << l2i); port = (l1i * (sizeof (unsigned long ) *8 )) + l2i; -do_event (port, regs); +do_event (port, regs); } }
extras/mini-os/sched.c +13 -13
@@ -165,28 +165,28 @@ struct _reent *__getreent(void)struct _reent *_reent;if (!threads_started) - _reent = _impure_ptr; + _reent = _impure_ptr;else if (in_callback) - _reent = &callback_reent; + _reent = &callback_reent;else - _reent = &get_current ()->reent; + _reent = &get_current ()->reent;#ifndef NDEBUG #if defined(__x86_64__) || defined(__x86__) {#ifdef __x86_64__ - registerunsigned long sp asm ("rsp" ); + registerunsigned long sp asm ("rsp" );#else - registerunsigned long sp asm ("esp" ); + registerunsigned long sp asm ("esp" );#endif -if ((sp & (STACK_SIZE -1 )) <STACK_SIZE /16 ) { -static int overflowing; -if (!overflowing) { - overflowing =1 ; -printk ("stack overflow\n" ); -BUG (); - } - } +if ((sp & (STACK_SIZE -1 )) <STACK_SIZE /16 ) { +static int overflowing; +if (!overflowing) { + overflowing =1 ; +printk ("stack overflow\n" ); +BUG (); + } + } }#endif #else
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 07/20] mini-os: whitespace
Quoted 1 line · Thomas Leonard, le Thu 26 Jun 2014 12:28:24 +0100, a écrit :
Signed-off-by Thomas Leonard <[email protected]>
Quoted 81 lines
--- extras/mini-os/gnttab.c | 2 +- extras/mini-os/hypervisor.c | 2 +- extras/mini-os/sched.c | 26 +++++++++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-)extras/mini-os/gnttab.c +1
-1@@ -164,7 +164,7 @@ gnttabop_error(int16_t status) { status = -status;if (status <0 || status >=ARRAY_SIZE (gnttabop_error_msgs)) -return "bad status" ; +return "bad status" ;else return gnttabop_error_msgs[status]; }extras/mini-os/hypervisor.c +1
-1@@ -64,7 +64,7 @@ void do_hypervisor_callback(struct pt_regs *regs) l2 &= ~(1UL << l2i); port = (l1i * (sizeof (unsigned long ) *8 )) + l2i; -do_event (port, regs); +do_event (port, regs); } }extras/mini-os/sched.c +13
-13@@ -165,28 +165,28 @@ struct _reent *__getreent(void)struct _reent *_reent;if (!threads_started) - _reent = _impure_ptr; + _reent = _impure_ptr;else if (in_callback) - _reent = &callback_reent; + _reent = &callback_reent;else - _reent = &get_current ()->reent; + _reent = &get_current ()->reent;#ifndef NDEBUG #if defined(__x86_64__) || defined(__x86__) {#ifdef __x86_64__ - registerunsigned long sp asm ("rsp" ); + registerunsigned long sp asm ("rsp" );#else - registerunsigned long sp asm ("esp" ); + registerunsigned long sp asm ("esp" );#endif -if ((sp & (STACK_SIZE -1 )) <STACK_SIZE /16 ) { -static int overflowing; -if (!overflowing) { - overflowing =1 ; -printk ("stack overflow\n" ); -BUG (); - } - } +if ((sp & (STACK_SIZE -1 )) <STACK_SIZE /16 ) { +static int overflowing; +if (!overflowing) { + overflowing =1 ; +printk ("stack overflow\n" ); +BUG (); + } + } }#endif #else Signature · 1 line
2.0.0
Signature · 3 lines
Samuel I am the "ILOVEGNU" signature virus. Just copy me to your signature. This email was infected under the terms of the GNU General Public License.
PATCH v5 8/20 mini-os: added arch_init_gnttab
In reply to Thomas LeonardFrom: Karim Raslan <[email protected]>
Moves some x86-specific code into arch/x86.
--- extras/mini-os/arch/x86/mm.c | 13 +++++++++++++ extras/mini-os/gnttab.c | 9 +-------- extras/mini-os/include/gnttab.h | 1 + 3 files changed, 15 insertions(+), 8 deletions(-)
extras/mini-os/arch/x86/mm.c +13 -0
@@ -942,3 +942,16 @@ void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p) *start_pfn_p = start_pfn; *max_pfn_p = max_pfn; } + +grant_entry_t *arch_init_gnttab (int nr_grant_frames) +{ +struct gnttab_setup_table setup; +unsigned long frames[nr_grant_frames]; + + setup.dom =DOMID_SELF ; + setup.nr_frames = nr_grant_frames; +set_xen_guest_handle (setup.frame_list, frames); + +HYPERVISOR_grant_table_op (GNTTABOP_setup_table, &setup,1 ); +return map_frames (frames, nr_grant_frames); +}
extras/mini-os/gnttab.c +1 -8
@@ -172,8 +172,6 @@ gnttabop_error(int16_t status)void init_gnttab (void ) { -struct gnttab_setup_table setup; -unsigned long frames[NR_GRANT_FRAMES ];int i;#ifdef GNT_DEBUG
@@ -182,12 +180,7 @@ init_gnttab(void)for (i =NR_RESERVED_ENTRIES ; i <NR_GRANT_ENTRIES ; i++)put_free_entry (i); - setup.dom =DOMID_SELF ; - setup.nr_frames =NR_GRANT_FRAMES ; -set_xen_guest_handle (setup.frame_list, frames); - -HYPERVISOR_grant_table_op (GNTTABOP_setup_table, &setup,1 ); - gnttab_table =map_frames (frames,NR_GRANT_FRAMES ); + gnttab_table =arch_init_gnttab (NR_GRANT_FRAMES );printk ("gnttab_table mapped at %p.\n" , gnttab_table); }
extras/mini-os/include/gnttab.h +1 -0
@@ -12,5 +12,6 @@ unsigned long gnttab_end_transfer(grant_ref_t gref);int gnttab_end_access (grant_ref_t ref);const char *gnttabop_error (int16_t status);void fini_gnttab (void ); +grant_entry_t *arch_init_gnttab (int nr_grant_frames);#endif /* !__GNTTAB_H__ */
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 08/20] mini-os: added arch_init_gnttab
Quoted 7 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:25 +0100, a écrit :
From: Karim Raslan <[email protected]>
Moves some x86-specific code into
arch/x86.Signed-off-by Karim Allah Ahmed <[email protected]>[[email protected]: split into multiple patches]Signed-off-by Thomas Leonard <[email protected]>
Quoted 68 lines
--- extras/mini-os/arch/x86/mm.c | 13 +++++++++++++ extras/mini-os/gnttab.c | 9 +-------- extras/mini-os/include/gnttab.h | 1 + 3 files changed, 15 insertions(+), 8 deletions(-)extras/mini-os/arch/x86/mm.c +13
-0@@ -942,3 +942,16 @@ void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p) *start_pfn_p = start_pfn; *max_pfn_p = max_pfn; } + +grant_entry_t *arch_init_gnttab (int nr_grant_frames) +{ +struct gnttab_setup_table setup; +unsigned long frames[nr_grant_frames]; + + setup.dom =DOMID_SELF ; + setup.nr_frames = nr_grant_frames; +set_xen_guest_handle (setup.frame_list, frames); + +HYPERVISOR_grant_table_op (GNTTABOP_setup_table, &setup,1 ); +return map_frames (frames, nr_grant_frames); +}extras/mini-os/gnttab.c +1
-8@@ -172,8 +172,6 @@ gnttabop_error(int16_t status)void init_gnttab (void ) { -struct gnttab_setup_table setup; -unsigned long frames[NR_GRANT_FRAMES ];int i;#ifdef GNT_DEBUG @@ -182,12 +180,7 @@ init_gnttab(void)for (i =NR_RESERVED_ENTRIES ; i <NR_GRANT_ENTRIES ; i++)put_free_entry (i); - setup.dom =DOMID_SELF ; - setup.nr_frames =NR_GRANT_FRAMES ; -set_xen_guest_handle (setup.frame_list, frames); - -HYPERVISOR_grant_table_op (GNTTABOP_setup_table, &setup,1 ); - gnttab_table =map_frames (frames,NR_GRANT_FRAMES ); + gnttab_table =arch_init_gnttab (NR_GRANT_FRAMES );printk ("gnttab_table mapped at %p.\n" , gnttab_table); }extras/mini-os/include/gnttab.h +1
-0@@ -12,5 +12,6 @@ unsigned long gnttab_end_transfer(grant_ref_t gref);int gnttab_end_access (grant_ref_t ref);const char *gnttabop_error (int16_t status);void fini_gnttab (void ); +grant_entry_t *arch_init_gnttab (int nr_grant_frames);#endif /* !__GNTTAB_H__ */ Signature · 1 line
2.0.0
Signature · 5 lines
Samuel "And the next time you consider complaining that running Lucid Emacs 19.05 via NFS from a remote Linux machine in Paraguay doesn't seem to get the background colors right, you'll know who to thank." (By Matt Welsh)
PATCH v5 9/20 mini-os: don't require XEN_HAVE_PV_UPCALL_MASK
In reply to Thomas LeonardThis isn't available on ARM.
--- extras/mini-os/hypervisor.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
extras/mini-os/hypervisor.c +10 -0
@@ -73,18 +73,26 @@ void do_hypervisor_callback(struct pt_regs *regs)void force_evtchn_callback (void ) { +#ifdef XEN_HAVE_PV_UPCALL_MASK int save; +#endif vcpu_info_t *vcpu; vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id ()]; +#ifdef XEN_HAVE_PV_UPCALL_MASK save = vcpu->evtchn_upcall_mask; +#endif while (vcpu->evtchn_upcall_pending) { +#ifdef XEN_HAVE_PV_UPCALL_MASK vcpu->evtchn_upcall_mask =1 ; +#endif barrier ();do_hypervisor_callback (NULL );barrier (); +#ifdef XEN_HAVE_PV_UPCALL_MASK vcpu->evtchn_upcall_mask = save;barrier (); +#endif }; }
@@ -110,7 +118,9 @@ inline void unmask_evtchn(uint32_t port) &vcpu_info->evtchn_pending_sel) ) { vcpu_info->evtchn_upcall_pending =1 ; +#ifdef XEN_HAVE_PV_UPCALL_MASK if ( !vcpu_info->evtchn_upcall_mask ) +#endif force_evtchn_callback (); } }
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 09/20] mini-os: don't require XEN_HAVE_PV_UPCALL_MASK
Quoted 3 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:26 +0100, a écrit :
This isn't available on ARM.
Signed-off-by Thomas Leonard <[email protected]>
Quoted 48 lines
--- extras/mini-os/hypervisor.c | 10 ++++++++++ 1 file changed, 10 insertions(+)extras/mini-os/hypervisor.c +10
-0@@ -73,18 +73,26 @@ void do_hypervisor_callback(struct pt_regs *regs)void force_evtchn_callback (void ) { +#ifdef XEN_HAVE_PV_UPCALL_MASK int save; +#endif vcpu_info_t *vcpu; vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id ()]; +#ifdef XEN_HAVE_PV_UPCALL_MASK save = vcpu->evtchn_upcall_mask; +#endif while (vcpu->evtchn_upcall_pending) { +#ifdef XEN_HAVE_PV_UPCALL_MASK vcpu->evtchn_upcall_mask =1 ; +#endif barrier ();do_hypervisor_callback (NULL );barrier (); +#ifdef XEN_HAVE_PV_UPCALL_MASK vcpu->evtchn_upcall_mask = save;barrier (); +#endif }; }@@ -110,7 +118,9 @@ inline void unmask_evtchn(uint32_t port) &vcpu_info->evtchn_pending_sel) ) { vcpu_info->evtchn_upcall_pending =1 ; +#ifdef XEN_HAVE_PV_UPCALL_MASK if ( !vcpu_info->evtchn_upcall_mask ) +#endif force_evtchn_callback (); } }Signature · 1 line
2.0.0
Signature · 4 lines
Samuel Créer une hiérarchie supplementaire pour remedier à un problème (?) de dispersion est d'une logique digne des Shadocks. * BT in: Guide du Cabaliste Usenet - La Cabale vote oui (les Shadocks aussi) *
PATCH v5 10/20 mini-os: add missing casts to MM printk
In reply to Thomas LeonardThe code previously assumed that a long was 64-bits.
--- extras/mini-os/mm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
extras/mini-os/mm.c +2 -2
@@ -409,8 +409,8 @@ void init_mm(void)* now we can initialise the page allocator */ printk ("MM: Initialise page allocator for %lx(%lx)-%lx(%lx)\n" , - (u_long )to_virt (PFN_PHYS (start_pfn)),PFN_PHYS (start_pfn), - (u_long )to_virt (PFN_PHYS (max_pfn)),PFN_PHYS (max_pfn)); + (u_long )to_virt (PFN_PHYS (start_pfn)), (u_long )PFN_PHYS (start_pfn), + (u_long )to_virt (PFN_PHYS (max_pfn)), (u_long )PFN_PHYS (max_pfn));init_page_allocator (PFN_PHYS (start_pfn),PFN_PHYS (max_pfn));printk ("MM: done\n" );
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 10/20] mini-os: add missing casts to MM printk
Quoted 3 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:27 +0100, a écrit :
The code previously assumed that a long was 64-bits.
Signed-off-by Thomas Leonard <[email protected]>
Quoted 22 lines
--- extras/mini-os/mm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)extras/mini-os/mm.c +2
-2@@ -409,8 +409,8 @@ void init_mm(void)* now we can initialise the page allocator */ printk ("MM: Initialise page allocator for %lx(%lx)-%lx(%lx)\n" , - (u_long )to_virt (PFN_PHYS (start_pfn)),PFN_PHYS (start_pfn), - (u_long )to_virt (PFN_PHYS (max_pfn)),PFN_PHYS (max_pfn)); + (u_long )to_virt (PFN_PHYS (start_pfn)), (u_long )PFN_PHYS (start_pfn), + (u_long )to_virt (PFN_PHYS (max_pfn)), (u_long )PFN_PHYS (max_pfn));init_page_allocator (PFN_PHYS (start_pfn),PFN_PHYS (max_pfn));printk ("MM: done\n" );Signature · 1 line
2.0.0
Signature · 4 lines
Samuel Moralité : le modem et le cablerouteur font comme les filles, ils papotent toute la journée. -+- RB in NPC : Et en plus, ils ne parlent que de bits -+-
PATCH v5 11/20 mini-os: added HYPERVISOR_xsm_op
In reply to Thomas LeonardAvoids using _hypercall1 in events.c.
--- extras/mini-os/events.c | 4 ++-- extras/mini-os/include/x86/os.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-)
extras/mini-os/events.c +2 -2
@@ -244,7 +244,7 @@ int evtchn_get_peercontext(evtchn_port_t local_port, char *ctx, int size) op.cmd =FLASK_GET_PEER_SID ; op.interface_version =XEN_FLASK_INTERFACE_VERSION ; op.u.peersid.evtchn = local_port; - rc =_hypercall1 (int, xsm_op, &op); + rc =HYPERVISOR_xsm_op (&op);if (rc)return rc; sid = op.u.peersid.sid;
@@ -252,7 +252,7 @@ int evtchn_get_peercontext(evtchn_port_t local_port, char *ctx, int size) op.u.sid_context.sid = sid; op.u.sid_context.size = size;set_xen_guest_handle (op.u.sid_context.context, ctx); - rc =_hypercall1 (int, xsm_op, &op); + rc =HYPERVISOR_xsm_op (&op);return rc; }
extras/mini-os/include/x86/os.h +7 -0
@@ -20,6 +20,7 @@#include <mini-os/types.h> #include <mini-os/hypervisor.h> #include <mini-os/kernel.h> +#include <xen/xsm/flask_op.h> #define USED __attribute__ ((used))
@@ -563,6 +564,12 @@ static __inline__ int synch_var_test_bit(int nr, volatile void * addr) synch_const_test_bit((nr),(addr)) : \ synch_var_test_bit((nr),(addr))) +static inline int +HYPERVISOR_xsm_op ( +struct xen_flask_op *op) +{ +return _hypercall1 (int, xsm_op, op); +}#undef ADDR
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 11/20] mini-os: added HYPERVISOR_xsm_op
Quoted 3 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:28 +0100, a écrit :
Avoids using
_hypercall1inevents.c.Signed-off-by Thomas Leonard <[email protected]>
Quoted 55 lines
--- extras/mini-os/events.c | 4 ++-- extras/mini-os/include/x86/os.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-)extras/mini-os/events.c +2
-2@@ -244,7 +244,7 @@ int evtchn_get_peercontext(evtchn_port_t local_port, char *ctx, int size) op.cmd =FLASK_GET_PEER_SID ; op.interface_version =XEN_FLASK_INTERFACE_VERSION ; op.u.peersid.evtchn = local_port; - rc =_hypercall1 (int, xsm_op, &op); + rc =HYPERVISOR_xsm_op (&op);if (rc)return rc; sid = op.u.peersid.sid;@@ -252,7 +252,7 @@ int evtchn_get_peercontext(evtchn_port_t local_port, char *ctx, int size) op.u.sid_context.sid = sid; op.u.sid_context.size = size;set_xen_guest_handle (op.u.sid_context.context, ctx); - rc =_hypercall1 (int, xsm_op, &op); + rc =HYPERVISOR_xsm_op (&op);return rc; }extras/mini-os/include/x86/os.h +7
-0@@ -20,6 +20,7 @@#include <mini-os/types.h> #include <mini-os/hypervisor.h> #include <mini-os/kernel.h> +#include <xen/xsm/flask_op.h> #define USED __attribute__ ((used))@@ -563,6 +564,12 @@ static __inline__ int synch_var_test_bit(int nr, volatile void * addr) synch_const_test_bit((nr),(addr)) : \ synch_var_test_bit((nr),(addr))) +static inline int +HYPERVISOR_xsm_op ( +struct xen_flask_op *op) +{ +return _hypercall1 (int, xsm_op, op); +}#undef ADDRSignature · 1 line
2.0.0
Signature · 3 lines
Samuel <s> T'as pas de portable ? <m> J'ai un nokia, dans le bassin d'arcachon
Re: [PATCH ARM v5 11/20] mini-os: added HYPERVISOR_xsm_op
Quoted 6 lines · Samuel Thibault
Quoted 3 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:28 +0100, a écrit :
Avoids using
_hypercall1inevents.c.Signed-off-by Thomas Leonard <[email protected]>Acked-by Samuel Thibault <[email protected]>
On x86 this results in
In file included from stubdom/../extras/mini-os/include/mini-os/gntmap.h:4:0,
from stubdom/../extras/mini-os/include/mini-os/lib.h:55,
from stubdom/../extras/mini-os/include/mini-os/mm.h:36,
from stubdom/../extras/mini-os/include/x86/x86_64/hypercall-x86_64.h:39,
from stubdom/../extras/mini-os/include/hypervisor.h:20,
from mini-os.c:13:stubdom/../extras/mini-os/include/x86/os.h: In function ‘HYPERVISOR_xsm_op’:stubdom/../extras/mini-os/include/x86/os.h:566:21: error: expected expression before ‘int’
I'm not sure why.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH ARM v5 11/20] mini-os: added HYPERVISOR_xsm_op
Quoted 16 lines · Ian Campbell
Quoted 6 lines · Samuel Thibault
Quoted 3 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:28 +0100, a écrit :
Avoids using
_hypercall1inevents.c.Signed-off-by Thomas Leonard <[email protected]>Acked-by Samuel Thibault <[email protected]>On x86 this results in
In file included from
stubdom/../extras/mini-os/include/mini-os/gntmap.h:4:0,from stubdom/../extras/mini-os/include/mini-os/lib.h:55, from stubdom/../extras/mini-os/include/mini-os/mm.h:36, from stubdom/../extras/mini-os/include/x86/x86_64/hypercall-x86_64.h:39, from stubdom/../extras/mini-os/include/hypervisor.h:20, from mini-os.c:13:
Quoted 4 lines
stubdom/../extras/mini-os/include/x86/os.h: In function ‘HYPERVISOR_xsm_op’:stubdom/../extras/mini-os/include/x86/os.h:566:21: error: expected expression before ‘int’I'm not sure why.
That's strange. It compiles for me on x86_64 (running "make" in the mini-os directory and also running "make" in "stubdom").
If you tell me the compiler/OS/arch you're on I can try to reproduce it.
Signature · 8 lines
Dr Thomas Leonard http://0install.net/ GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH ARM v5 11/20] mini-os: added HYPERVISOR_xsm_op
Quoted 20 lines · Thomas Leonard
Quoted 19 lines · Ian Campbell
Quoted 6 lines · Samuel Thibault
Quoted 3 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:28 +0100, a écrit :
Avoids using
_hypercall1inevents.c.Signed-off-by Thomas Leonard <[email protected]>Acked-by Samuel Thibault <[email protected]>On x86 this results in
In file included from
stubdom/../extras/mini-os/include/mini-os/gntmap.h:4:0,from stubdom/../extras/mini-os/include/mini-os/lib.h:55, from stubdom/../extras/mini-os/include/mini-os/mm.h:36, from stubdom/../extras/mini-os/include/x86/x86_64/hypercall-x86_64.h:39, from stubdom/../extras/mini-os/include/hypervisor.h:20, from mini-os.c:13:
stubdom/../extras/mini-os/include/x86/os.h: In function ‘HYPERVISOR_xsm_op’:stubdom/../extras/mini-os/include/x86/os.h:566:21: error: expected expression before ‘int’
Quoted 6 lines
Quoted 1 line
I'm not sure why.
That's strange. It compiles for me on
x86_64(running "make" in the mini-os directory and also running "make" in "stubdom").If you tell me the compiler/OS/arch you're on I can try to reproduce it.
OK, I see this on x86_32. There's a (pre-existing) cycle in the includes:
hypervisor.h -> hypercall-x86_32.h -> mm.h -> lib.h -> gntmap.h -> os.h -> hypervisor.h
I could break it at the mm.h -> lib.h link. I can't see why the low-level MM code needs libc, and it seems to compile without it (adding some lib.h includes in various C files instead). Any objections?
Signature · 8 lines
Dr Thomas Leonard http://0install.net/ GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH ARM v5 11/20] mini-os: added HYPERVISOR_xsm_op
Hello,
Quoted 2 lines · Thomas Leonard, le Fri 27 Jun 2014 16:43:51 +0100, a écrit :
I could break it at the
mm.h->lib.hlink. I can't see why the low-level MM code needs libc,
I guess the reason has disappeared now
Quoted 2 lines
and it seems to compile without it (adding some
lib.hincludes in various C files instead). Any objections?
It looks good to me.
Samuel
Re: [PATCH ARM v5 11/20] mini-os: added HYPERVISOR_xsm_op
In reply to Thomas LeonardQuoted 20 lines · Thomas Leonard
Quoted 19 lines · Ian Campbell
Quoted 6 lines · Samuel Thibault
Quoted 3 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:28 +0100, a écrit :
Avoids using
_hypercall1inevents.c.Signed-off-by Thomas Leonard <[email protected]>Acked-by Samuel Thibault <[email protected]>On x86 this results in
In file included from
stubdom/../extras/mini-os/include/mini-os/gntmap.h:4:0,from stubdom/../extras/mini-os/include/mini-os/lib.h:55, from stubdom/../extras/mini-os/include/mini-os/mm.h:36, from stubdom/../extras/mini-os/include/x86/x86_64/hypercall-x86_64.h:39, from stubdom/../extras/mini-os/include/hypervisor.h:20, from mini-os.c:13:
stubdom/../extras/mini-os/include/x86/os.h: In function ‘HYPERVISOR_xsm_op’:stubdom/../extras/mini-os/include/x86/os.h:566:21: error: expected expression before ‘int’
Quoted 6 lines
Quoted 1 line
I'm not sure why.
That's strange. It compiles for me on
x86_64(running "make" in the mini-os directory and also running "make" in "stubdom").If you tell me the compiler/OS/arch you're on I can try to reproduce it.
Debian Wheezy. I run pre-commit build tests for both 32- and 64-bit but I'm afraid I don't recall which one had this issue (I should have been more specific with "x86" above, sorry).
Oh wait, does the fact that it is including hypercall-x86_64.h give us a clue? I'm not sure if we cross compile stubdoms or not...
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v5 12/20 mini-os: added arch_unbind_ports
In reply to Thomas LeonardThis allows closing any ports opened by the arch-specific code. ARM will use it for the debug port.
--- extras/mini-os/arch/x86/events.c | 4 ++++ extras/mini-os/events.c | 1 + extras/mini-os/include/events.h | 4 ++++ 3 files changed, 9 insertions(+)
extras/mini-os/arch/x86/events.c +4 -0
@@ -23,6 +23,10 @@ void arch_init_events(void)#endif } +void arch_unbind_ports (void ) +{ +} +void arch_fini_events (void ) {#if defined(__x86_64__)
extras/mini-os/events.c +1 -0
@@ -179,6 +179,7 @@ void init_events(void)void fini_events (void ) {/* Dealloc all events */ +arch_unbind_ports ();unbind_all_ports ();arch_fini_events (); }
extras/mini-os/include/events.h +4 -0
@@ -26,6 +26,10 @@ typedef void (*evtchn_handler_t)(evtchn_port_t, struct pt_regs *, void *);/* prototypes */ void arch_init_events (void ); + +/* Called by fini_events to close any ports opened by arch-specific code. */ +void arch_unbind_ports (void ); +void arch_fini_events (void );int do_event (evtchn_port_t port,struct pt_regs *regs);
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 12/20] mini-os: added arch_unbind_ports
Quoted 4 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:29 +0100, a écrit :
This allows closing any ports opened by the arch-specific code. ARM will use it for the debug port.
Signed-off-by Thomas Leonard <[email protected]>
Quoted 51 lines
--- extras/mini-os/arch/x86/events.c | 4 ++++ extras/mini-os/events.c | 1 + extras/mini-os/include/events.h | 4 ++++ 3 files changed, 9 insertions(+)extras/mini-os/arch/x86/events.c +4
-0@@ -23,6 +23,10 @@ void arch_init_events(void)#endif } +void arch_unbind_ports (void ) +{ +} +void arch_fini_events (void ) {#if defined(__x86_64__)extras/mini-os/events.c +1
-0@@ -179,6 +179,7 @@ void init_events(void)void fini_events (void ) {/* Dealloc all events */ +arch_unbind_ports ();unbind_all_ports ();arch_fini_events (); }extras/mini-os/include/events.h +4
-0@@ -26,6 +26,10 @@ typedef void (*evtchn_handler_t)(evtchn_port_t, struct pt_regs *, void *);/* prototypes */ void arch_init_events (void ); + +/* Called by fini_events to close any ports opened by arch-specific code. */ +void arch_unbind_ports (void ); +void arch_fini_events (void );int do_event (evtchn_port_t port,struct pt_regs *regs);Signature · 1 line
2.0.0
Signature · 1 line
Samuel
Quoted 1 line
Quelqu'un aurait-il une solution pour réinitialiser un MBR
Si tu veux qu'il soit complètement blanc (pas souhaitable, à mon avis) :
dd if=/dev/zero of=/dev/hda bs=512 count=1 (sous Linux)
-+- OT in Guide du linuxien (très) pervers - "Pour les K difficiles" -+-
PATCH v5 13/20 mini-os: moved __pte to x86
In reply to Thomas LeonardWe don't need to define this on ARM. Suggested by Julien Grall.
--- extras/mini-os/include/types.h | 12 ------------ extras/mini-os/include/x86/x86_32/hypercall-x86_32.h | 5 +++++ extras/mini-os/include/x86/x86_64/hypercall-x86_64.h | 4 ++++ 3 files changed, 9 insertions(+), 12 deletions(-)
extras/mini-os/include/types.h +0 -12
@@ -30,23 +30,11 @@ typedef unsigned long u_long;#ifdef __i386__typedef long long quad_t ;typedef unsigned long long u_quad_t ; - -typedef struct {unsigned long pte_low, pte_high; }pte_t ; -#elif defined(__x86_64__)typedef long quad_t ;typedef unsigned long u_quad_t ; - -typedef struct {unsigned long pte; }pte_t ;#endif /* __i386__ || __x86_64__ */ -#ifdef __x86_64__ -#define __pte (x) ((pte_t) { (x) } ) -#else -#define __pte (x) ({ unsigned long long _x = (x); \ - ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); }) -#endif -#ifdef HAVE_LIBC #include <limits.h> #include <stdint.h>
extras/mini-os/include/x86/x86_32/hypercall-x86_32.h +5 -0
@@ -35,6 +35,11 @@#include <xen/nmi.h> #include <mini-os/mm.h> +typedef struct {unsigned long pte_low, pte_high; }pte_t ; + +#define __pte (x) ({ unsigned long long _x = (x); \ + ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); }) +#define __STR (x) #x#define STR (x) __STR(x)
extras/mini-os/include/x86/x86_64/hypercall-x86_64.h +4 -0
@@ -38,6 +38,10 @@#include <xen/sched.h> #include <mini-os/mm.h> +typedef struct {unsigned long pte; }pte_t ; + +#define __pte (x) ((pte_t) { (x) } ) +#define __STR (x) #x#define STR (x) __STR(x)
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 13/20] mini-os: moved __pte to x86
Quoted 3 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:30 +0100, a écrit :
We don't need to define this on ARM. Suggested by Julien Grall.
Signed-off-by Thomas Leonard <[email protected]>
Quoted 68 lines
--- extras/mini-os/include/types.h | 12 ------------ extras/mini-os/include/x86/x86_32/hypercall-x86_32.h | 5 +++++ extras/mini-os/include/x86/x86_64/hypercall-x86_64.h | 4 ++++ 3 files changed, 9 insertions(+), 12 deletions(-)extras/mini-os/include/types.h +0
-12@@ -30,23 +30,11 @@ typedef unsigned long u_long;#ifdef __i386__typedef long long quad_t ;typedef unsigned long long u_quad_t ; - -typedef struct {unsigned long pte_low, pte_high; }pte_t ; -#elif defined(__x86_64__)typedef long quad_t ;typedef unsigned long u_quad_t ; - -typedef struct {unsigned long pte; }pte_t ;#endif /* __i386__ || __x86_64__ */ -#ifdef __x86_64__ -#define __pte (x) ((pte_t) { (x) } ) -#else -#define __pte (x) ({ unsigned long long _x = (x); \ - ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); }) -#endif -#ifdef HAVE_LIBC #include <limits.h> #include <stdint.h> extras/mini-os/include/x86/x86_32/hypercall-x86_32.h +5
-0@@ -35,6 +35,11 @@#include <xen/nmi.h> #include <mini-os/mm.h> +typedef struct {unsigned long pte_low, pte_high; }pte_t ; + +#define __pte (x) ({ unsigned long long _x = (x); \ + ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); }) +#define __STR (x) #x#define STR (x) __STR(x)extras/mini-os/include/x86/x86_64/hypercall-x86_64.h +4
-0@@ -38,6 +38,10 @@#include <xen/sched.h> #include <mini-os/mm.h> +typedef struct {unsigned long pte; }pte_t ; + +#define __pte (x) ((pte_t) { (x) } ) +#define __STR (x) #x#define STR (x) __STR(x)Signature · 1 line
2.0.0
Signature · 5 lines
Samuel Actually, typing random strings in the Finder does the equivalent of filename completion. (Discussion in comp.os.linux.misc on the intuitiveness of commands: file completion vs. the Mac Finder.)
PATCH v5 14/20 mini-os: moved unlikely/likely macros to new compiler.h
In reply to Thomas LeonardRequested by Julien Grall.
--- extras/mini-os/include/compiler.h | 5 +++++ extras/mini-os/include/x86/os.h | 7 +------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 extras/mini-os/include/compiler.h
extras/mini-os/include/compiler.h new file +5 -0
@@ -0,0 +1,5 @@ +#if __GNUC__ ==2 && __GNUC_MINOR__ <96 +#define __builtin_expect (x, expected_value) (x) +#endif +#define unlikely (x) __builtin_expect((x),0) +#define likely (x) __builtin_expect((x),1)
extras/mini-os/include/x86/os.h +1 -6
@@ -7,16 +7,11 @@#ifndef _OS_H_#define _OS_H_ -#if __GNUC__ ==2 && __GNUC_MINOR__ <96 -#define __builtin_expect (x, expected_value) (x) -#endif -#define unlikely (x) __builtin_expect((x),0) -#define likely (x) __builtin_expect((x),1) -#define smp_processor_id () 0#ifndef __ASSEMBLY__ +#include <mini-os/compiler.h> #include <mini-os/types.h> #include <mini-os/hypervisor.h> #include <mini-os/kernel.h>
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 14/20] mini-os: moved unlikely/likely macros to new compiler.h
Quoted 3 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:31 +0100, a écrit :
Requested by Julien Grall.
Signed-off-by Thomas Leonard <[email protected]>
Quoted 42 lines
--- extras/mini-os/include/compiler.h | 5 +++++ extras/mini-os/include/x86/os.h | 7 +------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 extras/mini-os/include/compiler.hextras/mini-os/include/compiler.h new file +5
-0@@ -0,0 +1,5 @@ +#if __GNUC__ ==2 && __GNUC_MINOR__ <96 +#define __builtin_expect (x, expected_value) (x) +#endif +#define unlikely (x) __builtin_expect((x),0) +#define likely (x) __builtin_expect((x),1)extras/mini-os/include/x86/os.h +1
-6@@ -7,16 +7,11 @@#ifndef _OS_H_#define _OS_H_ -#if __GNUC__ ==2 && __GNUC_MINOR__ <96 -#define __builtin_expect (x, expected_value) (x) -#endif -#define unlikely (x) __builtin_expect((x),0) -#define likely (x) __builtin_expect((x),1) -#define smp_processor_id () 0#ifndef __ASSEMBLY__ +#include <mini-os/compiler.h> #include <mini-os/types.h> #include <mini-os/hypervisor.h> #include <mini-os/kernel.h> Signature · 1 line
2.0.0
Signature · 4 lines
Samuel jr> J'ai fait. Ne bougez pas, l'aide soignante va venir nettoyer. -+- FF in GNU - Le vieil homme et la merde -+-
PATCH v5 15/20 mini-os: enable test_xenbus again
In reply to Thomas LeonardThe old code said "Xenbus tests disabled, because of a Xend bug". Since xend doesn't exist any longer, we can enable these again.
--- extras/mini-os/test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
extras/mini-os/test.c +1 -2
@@ -56,8 +56,7 @@ void test_xenbus(void);static void xenbus_tester (void *p) { -printk ("Xenbus tests disabled, because of a Xend bug.\n" ); -/* test_xenbus(); */ +test_xenbus (); }#endif
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 15/20] mini-os: enable test_xenbus again
Quoted 4 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:32 +0100, a écrit :
The old code said "Xenbus tests disabled, because of a Xend bug". Since xend doesn't exist any longer, we can enable these again.
Signed-off-by Thomas Leonard <[email protected]>
Quoted 21 lines
--- extras/mini-os/test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)extras/mini-os/test.c +1
-2@@ -56,8 +56,7 @@ void test_xenbus(void);static void xenbus_tester (void *p) { -printk ("Xenbus tests disabled, because of a Xend bug.\n" ); -/* test_xenbus(); */ +test_xenbus (); }#endif Signature · 1 line
2.0.0
Signature · 3 lines
Samuel <D> N: j'aime bien Cut d'un truc enorme... ca montre de quel cote de l'ecran sont les couilles :))) -+- #ens-mim et la peufeupeu -+-
Re: [PATCH ARM v5 15/20] mini-os: enable test_xenbus again
In reply to Thomas LeonardQuoted 2 lines · Thomas Leonard
The old code said "Xenbus tests disabled, because of a Xend bug". Since xend doesn't exist any longer, we can enable these again.
Out of curiosity, do you know if they work now? (I don't think the answer should block this patch either way).
Quoted 20 lines
Signed-off-by Thomas Leonard <[email protected]>--- extras/mini-os/test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)extras/mini-os/test.c +1
-2@@ -56,8 +56,7 @@ void test_xenbus(void);static void xenbus_tester (void *p) { -printk ("Xenbus tests disabled, because of a Xend bug.\n" ); -/* test_xenbus(); */ +test_xenbus (); }#endif
Re: [PATCH ARM v5 15/20] mini-os: enable test_xenbus again
Quoted 6 lines · Ian Campbell
Quoted 2 lines · Thomas Leonard
The old code said "Xenbus tests disabled, because of a Xend bug". Since xend doesn't exist any longer, we can enable these again.
Out of curiosity, do you know if they work now? (I don't think the answer should block this patch either way).
On ARM, with all the patches I sent applied, the output is:
[...]
Doing xenbus test.
Periodic thread started.
T(s=0 us=1253)
Got a reply, type 16, id 1, len 7.
Doing ls test.
ls device...
ls device[0] -> suspend
ls device[1] -> vbd
ls device[2] -> vif
ls device/vif...
ls device/vif[0] -> 0
ls device/vif/0...
ls device/vif/0[0] -> backend
ls device/vif/0[1] -> backend-id
ls device/vif/0[2] -> state
ls device/vif/0[3] -> handle
ls device/vif/0[4] -> mac
Doing read test.
Read device/vif/0/mac...
Read device/vif/0/mac -> 00:16:3e:7d:69:0d.
Read device/vif/0/backend...
Read device/vif/0/backend -> /local/domain/0/backend/vif/1/0. Doing write test.
Write flobble to device/vif/0/flibble...
Success.
Read device/vif/0/flibble...
Read device/vif/0/flibble -> flobble.
Write widget to device/vif/0/flibble...
Success.
Read device/vif/0/flibble...
Read device/vif/0/flibble -> widget.
Doing rm test.
rm device/vif/0/flibble...
Success.
Read device/vif/0/flibble...
Error in xenbus read: ENOENT
(Should have said ENOENT)
Thread "xenbus_tester" exited.
T(s=1 us=1543)
[...]
Quoted 21 lines
Quoted 19 lines
Signed-off-by Thomas Leonard <[email protected]>--- extras/mini-os/test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)extras/mini-os/test.c +1
-2@@ -56,8 +56,7 @@ void test_xenbus(void);static void xenbus_tester (void *p) { -printk ("Xenbus tests disabled, because of a Xend bug.\n" ); -/* test_xenbus(); */ +test_xenbus (); }#endif
Signature · 3 lines
Dr Thomas Leonard http://0install.net/ GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA
Re: [PATCH ARM v5 15/20] mini-os: enable test_xenbus again
Quoted 9 lines · Thomas Leonard
Quoted 6 lines · Ian Campbell
Quoted 2 lines · Thomas Leonard
The old code said "Xenbus tests disabled, because of a Xend bug". Since xend doesn't exist any longer, we can enable these again.
Out of curiosity, do you know if they work now? (I don't think the answer should block this patch either way).
On ARM, with all the patches I sent applied, the output is:
Which I suppose looks like success despite the messages towards the end. Anywya, thanks.
Quoted 67 lines
[...]
Doing xenbus test.
Periodic thread started.
T(s=0 us=1253)
Got a reply, type 16, id 1, len 7.
Doing ls test.
ls device...
ls device[0] -> suspend
ls device[1] -> vbd
ls device[2] -> vif
ls device/vif...
ls device/vif[0] -> 0
ls device/vif/0...
ls device/vif/0[0] -> backend
ls device/vif/0[1] -> backend-id
ls device/vif/0[2] -> state
ls device/vif/0[3] -> handle
ls device/vif/0[4] -> mac
Doing read test.
Read device/vif/0/mac...
Read device/vif/0/mac -> 00:16:3e:7d:69:0d.
Read device/vif/0/backend...
Read device/vif/0/backend -> /local/domain/0/backend/vif/1/0. Doing write test.
Write flobble to device/vif/0/flibble...
Success.
Read device/vif/0/flibble...
Read device/vif/0/flibble -> flobble.
Write widget to device/vif/0/flibble...
Success.
Read device/vif/0/flibble...
Read device/vif/0/flibble -> widget.
Doing rm test.
rm device/vif/0/flibble...
Success.
Read device/vif/0/flibble...
Error in xenbus read: ENOENT
(Should have said ENOENT)
Thread "xenbus_tester" exited.
T(s=1 us=1543)
[...]Quoted 21 lines
Quoted 19 lines
Signed-off-by Thomas Leonard <[email protected]>--- extras/mini-os/test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)extras/mini-os/test.c +1
-2@@ -56,8 +56,7 @@ void test_xenbus(void);static void xenbus_tester (void *p) { -printk ("Xenbus tests disabled, because of a Xend bug.\n" ); -/* test_xenbus(); */ +test_xenbus (); }#endif
PATCH v5 16/20 mini-os: use irqs_disabled() helper in schedule
In reply to Thomas LeonardTesting whether the result of local_irq_save is zero doesn't work on ARM.
Suggested by Julien Grall.
--- extras/mini-os/sched.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
extras/mini-os/sched.c +5 -5
@@ -78,6 +78,11 @@ void schedule(void)struct thread *prev, *next, *thread, *tmp;unsigned long flags; +if (irqs_disabled ()) { +printk ("Must not call schedule() with IRQs disabled\n" ); +BUG (); + } + prev = current;local_irq_save (flags);
@@ -86,11 +91,6 @@ void schedule(void)BUG (); } -if (flags) { -printk ("Must not call schedule() with IRQs disabled\n" ); -BUG (); - } - do { /* Examine all threads. Find a runnable thread, but also wake up expired ones and find the
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 16/20] mini-os: use irqs_disabled() helper in schedule
Quoted 5 lines · Thomas Leonard, le Thu 26 Jun 2014 12:28:33 +0100, a écrit :
Testing whether the result of
local_irq_saveis zero doesn't work on ARM.Suggested by Julien Grall.
Signed-off-by Thomas Leonard <[email protected]>
Quoted 35 lines
--- extras/mini-os/sched.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)extras/mini-os/sched.c +5
-5@@ -78,6 +78,11 @@ void schedule(void)struct thread *prev, *next, *thread, *tmp;unsigned long flags; +if (irqs_disabled ()) { +printk ("Must not call schedule() with IRQs disabled\n" ); +BUG (); + } + prev = current;local_irq_save (flags);@@ -86,11 +91,6 @@ void schedule(void)BUG (); } -if (flags) { -printk ("Must not call schedule() with IRQs disabled\n" ); -BUG (); - } - do { /* Examine all threads. Find a runnable thread, but also wake up expired ones and find theSignature · 1 line
2.0.0
Signature · 6 lines
Samuel
if (argc > 1 && strcmp(argv[1], "-advice") == 0) {
printf("Don't Panic!\n");
exit(42);
}
-- Arnold Robbins in the LJ of February '95, describing RCSPATCH v5 17/20 mini-os: headers for ARM
In reply to Thomas LeonardFrom: Karim Raslan <[email protected]>
Adds header files for future ARM support.
[[email protected]: fixes suggested by Julien Grall:
- Removed old x86 comment from arm/arch_spinlock.h.
- Removed unimplemented _raw_spin_lock_flags.
- Renamed __cli/__sti to local_irq_disable/local_irq_enable.
- Cleaned up interrupt macros.
- Avoid disabling the Asynchronous Abort exception.
- Added memory clobber to barriers.
- Enable barriers on __aarch64__ too.
- Use compiler.h for likely/unlikely macros.
- Replaced dmb with slower but safer dsb for now.] [[email protected]: made image relocatable] [[email protected]: added mfn_to_pfn and pfn_to_mfn]
--- extras/mini-os/include/arm/arch_endian.h | 7 + extras/mini-os/include/arm/arch_limits.h | 9 + extras/mini-os/include/arm/arch_mm.h | 35 ++++ extras/mini-os/include/arm/arch_sched.h | 19 ++ extras/mini-os/include/arm/arch_spinlock.h | 36 ++++ extras/mini-os/include/arm/arm32/arch_wordsize.h | 1 + extras/mini-os/include/arm/gic.h | 1 + extras/mini-os/include/arm/hypercall-arm.h | 98 +++++++++++ extras/mini-os/include/arm/os.h | 215 +++++++++++++++++++++++ extras/mini-os/include/arm/traps.h | 20 +++ extras/mini-os/include/hypervisor.h | 2 + extras/mini-os/include/mm.h | 2 + extras/mini-os/include/types.h | 10 +- 13 files changed, 450 insertions(+), 5 deletions(-) create mode 100644 extras/mini-os/include/arm/arch_endian.h create mode 100644 extras/mini-os/include/arm/arch_limits.h create mode 100644 extras/mini-os/include/arm/arch_mm.h create mode 100644 extras/mini-os/include/arm/arch_sched.h create mode 100755 extras/mini-os/include/arm/arch_spinlock.h create mode 100644 extras/mini-os/include/arm/arm32/arch_wordsize.h create mode 100644 extras/mini-os/include/arm/gic.h create mode 100644 extras/mini-os/include/arm/hypercall-arm.h create mode 100644 extras/mini-os/include/arm/os.h create mode 100644 extras/mini-os/include/arm/traps.h
extras/mini-os/include/arm/arch_endian.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef ARCH_ENDIAN_H +#error "Do not include arch_endian by itself, include endian.h" +#else + +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif
extras/mini-os/include/arm/arch_limits.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef __ARCH_LIMITS_H__ +#define __ARCH_LIMITS_H__ + +#include <mm.h> + +#define __STACK_SIZE_PAGE_ORDER 2 +#define __STACK_SIZE (4 * PAGE_SIZE) + +#endif
extras/mini-os/include/arm/arch_mm.h new file +35 -0
@@ -0,0 +1,35 @@ +#ifndef _ARCH_MM_H_ +#define _ARCH_MM_H_ + +extern char _text, _etext, _erodata, _edata, _end, __bss_start; +extern int stack[]; +extern int physical_address_offset;/* Add this to a virtual address to get the physical address (wraps) */ + +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1 << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +#define L1_PAGETABLE_SHIFT 12 + +#define to_phys (x) ((unsigned long)(x)+physical_address_offset) +#define to_virt (x) ((void *)((unsigned long)(x)-physical_address_offset)) + +#define PFN_UP (x) (((x) + PAGE_SIZE-1) >> L1_PAGETABLE_SHIFT) +#define PFN_DOWN (x) ((x) >> L1_PAGETABLE_SHIFT) +#define PFN_PHYS (x) ((uint64_t)(x) << L1_PAGETABLE_SHIFT) +#define PHYS_PFN (x) ((x) >> L1_PAGETABLE_SHIFT) + +#define virt_to_pfn (_virt) (PFN_DOWN(to_phys(_virt))) +#define virt_to_mfn (_virt) (PFN_DOWN(to_phys(_virt))) +#define mfn_to_virt (_mfn) (to_virt(PFN_PHYS(_mfn))) +#define pfn_to_virt (_pfn) (to_virt(PFN_PHYS(_pfn))) + +#define mfn_to_pfn (x) (x) +#define pfn_to_mfn (x) (x) + +#define virtual_to_mfn (_virt) virt_to_mfn(_virt) + +// FIXME +#define map_frames (f, n) (NULL) + +#endif
extras/mini-os/include/arm/arch_sched.h new file +19 -0
@@ -0,0 +1,19 @@ +#ifndef __ARCH_SCHED_H__ +#define __ARCH_SCHED_H__ + +#include "arch_limits.h" + +static inline struct thread *get_current (void ) +{ +struct thread **current; +unsigned long sp; + __asm__ __volatile__ ("mov %0, sp" :"=r" (sp)); + current = (void *)(unsigned long )(sp & ~(__STACK_SIZE-1 )); +return *current; +} + +void __arch_switch_threads (unsigned long *prevctx,unsigned long *nextctx); + +#define arch_switch_threads (prev,next) __arch_switch_threads(&(prev)->sp, &(next)->sp) + +#endif /* __ARCH_SCHED_H__ */
extras/mini-os/include/arm/arch_spinlock.h new file +36 -0
@@ -0,0 +1,36 @@ +#ifndef __ARCH_ASM_SPINLOCK_H +#define __ARCH_ASM_SPINLOCK_H + +#include "os.h" + +#define ARCH_SPIN_LOCK_UNLOCKED { 1 } + +/* +* Simple spin lock operations. There are two variants, one clears IRQ's +* on the local processor, one does not. +* +* We make no fairness assumptions. They have a cost. +*/ + +#define arch_spin_is_locked (x) (*(volatile signed char *)(&(x)->slock) <= 0) +#define arch_spin_unlock_wait (x) do { barrier(); } while(spin_is_locked(x)) + +static inline void _raw_spin_unlock (spinlock_t *lock) +{ +xchg (&lock->slock,1 ); +} + +static inline int _raw_spin_trylock (spinlock_t *lock) +{ +return xchg (&lock->slock,0 ) !=0 ?1 :0 ; +} + +static inline void _raw_spin_lock (spinlock_t *lock) +{ +volatile int was_locked; +do { + was_locked =xchg (&lock->slock,0 ) ==0 ?1 :0 ; + }while (was_locked); +} + +#endif
extras/mini-os/include/arm/arm32/arch_wordsize.h new file +1 -0
@@ -0,0 +1 @@ +#define __WORDSIZE 32
extras/mini-os/include/arm/gic.h new file +1 -0
@@ -0,0 +1 @@ +void gic_init (void );
extras/mini-os/include/arm/hypercall-arm.h new file +98 -0
98 lines not on this page · raw message
extras/mini-os/include/arm/os.h new file +215 -0
215 lines not on this page · raw message
extras/mini-os/include/arm/traps.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef _TRAPS_H_ +#define _TRAPS_H_ + +struct pt_regs { +unsigned long r0; +unsigned long r1; +unsigned long r2; +unsigned long r3; +unsigned long r4; +unsigned long r5; +unsigned long r6; +unsigned long r7; +unsigned long r8; +unsigned long r9; +unsigned long r10; +unsigned long r11; +unsigned long r12; +}; + +#endif
extras/mini-os/include/hypervisor.h +2 -0
@@ -18,6 +18,8 @@#include <hypercall-x86_32.h> #elif defined(__x86_64__)#include <hypercall-x86_64.h> +#elif defined(__arm__) || defined(__aarch64__) +#include <hypercall-arm.h> #else #error "Unsupported architecture"#endif
extras/mini-os/include/mm.h +2 -0
@@ -29,6 +29,8 @@#include <xen/arch-x86_32.h> #elif defined(__x86_64__)#include <xen/arch-x86_64.h> +#elif defined(__arm__) || defined(__aarch64__) +#include <xen/arch-arm.h> #else #error "Unsupported architecture"#endif
extras/mini-os/include/types.h +5 -5
@@ -27,7 +27,7 @@ typedef unsigned char u_char;typedef unsigned int u_int ;typedef unsigned long u_long ;#endif -#ifdef __i386__ +#if defined(__i386__) || defined(__arm__)typedef long long quad_t ;typedef unsigned long long u_quad_t ;#elif defined(__x86_64__)
@@ -39,10 +39,10 @@ typedef unsigned long u_quad_t;#include <limits.h> #include <stdint.h> #else -#ifdef __i386__ +#if defined(__i386__) || defined(__arm__)typedef unsigned int uintptr_t ;typedef int intptr_t ; -#elif defined(__x86_64__) +#elif defined(__x86_64__) || defined(__aarch64__)typedef unsigned long uintptr_t ;typedef long intptr_t ;#endif /* __i386__ || __x86_64__ */
@@ -52,10 +52,10 @@ typedef unsigned short uint16_t;typedef signed short int16_t ;typedef unsigned int uint32_t ;typedef signed int int32_t ; -#ifdef __i386__ +#if defined(__i386__) || defined(__arm__)typedef signed long long int64_t ;typedef unsigned long long uint64_t ; -#elif defined(__x86_64__) +#elif defined(__x86_64__) || defined(__aarch64__)typedef signed long int64_t ;typedef unsigned long uint64_t ;#endif
Signature · 1 line
2.0.0
Re: [PATCH ARM v5 17/20] mini-os: headers for ARM
Hi Thomas,
extras/mini-os/include/arm/hypercall-arm.h line 40
Quoted 12 lines · Thomas Leonard
extras/mini-os/include/arm/hypercall-arm.h new file +7
-0+#ifndef __HYPERCALL_ARM_H__ +#define __HYPERCALL_ARM_H__ + +#include <xen/xen.h> +#include <xen/sched.h> +#include <xen/xsm/flask_op.h> +#include <mini-os/mm.h>
Does all those includes relevant for hypercall-arm?
Quoted 5 lines
extras/mini-os/include/arm/os.h new file +0
-0
[..]
Quoted 1 line
+#define
BUG()while(1){}
It looks odd to use onely while (1). Shouldn't you call do_exit as x86 does?
Signature · 1 line
Julien Grall
Re: [PATCH ARM v5 17/20] mini-os: headers for ARM
Quoted 17 lines · Julien Grall
Hi Thomas,
extras/mini-os/include/arm/hypercall-arm.h line 40
Quoted 12 lines · Thomas Leonard
extras/mini-os/include/arm/hypercall-arm.h new file +7
-0+#ifndef __HYPERCALL_ARM_H__ +#define __HYPERCALL_ARM_H__ + +#include <xen/xen.h> +#include <xen/sched.h> +#include <xen/xsm/flask_op.h> +#include <mini-os/mm.h> Does all those includes relevant for hypercall-arm?
Removing any line except xen.h makes Mini-OS not compile.
hypercall-arm.h is normally included via hypervisor.h, which includes xen.h itself, so that's perhaps not necessary, but it doesn't do any harm.
Note that the x86 versions have the same include. There are a couple of places where I've included other files in the ARM version of an include just because the corresponding x86 file had it. Otherwise, code that compiles on x86 may fail on ARM.
Quoted 11 lines
Quoted 5 lines
extras/mini-os/include/arm/os.h new file +0
-0[..]
Quoted 1 line
+#define
BUG()while(1){}It looks odd to use onely while (1). Shouldn't you call
do_exitas x86 does?
Note that patch #20 changes this to dump the registers and stack.
[ also, exiting on BUG is annoying because you may lose the console output if the VM dies before xl attaches to it. ]
Signature · 3 lines
Dr Thomas Leonard http://0install.net/ GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA
Re: [PATCH ARM v5 17/20] mini-os: headers for ARM
Quoted 8 lines · Thomas Leonard
Quoted 3 lines
Quoted 1 line
+#define
BUG()while(1){}It looks odd to use onely while (1). Shouldn't you call
do_exitas x86 does?Note that patch #20 changes this to dump the registers and stack.
[ also, exiting on BUG is annoying because you may lose the console output if the VM dies before xl attaches to it. ]
That's what on_crash=preserve and xenconsoled's logging capabilities are for. I expect SCHEDOP_crash is probably better than exiting though.
Ian.
PATCH v5 18/20 mini-os: import libfdt
In reply to Thomas LeonardFrom: Karim Raslan <[email protected]>
Looks like this is revision v1.3.0-47-gbe60268 from
http://git.jdl.com/gitweb/?p=dtc.git
The memmove implementation is from FreeBSD'scontrib/ldns/compat/memmove.c
--- extras/mini-os/COPYING | 27 + extras/mini-os/Makefile | 13 + extras/mini-os/include/fdt.h | 60 ++ extras/mini-os/include/lib.h | 4 +- extras/mini-os/include/libfdt.h | 1478 ++++++++++++++++++++++++++++++ extras/mini-os/include/libfdt_env.h | 37 + extras/mini-os/lib/fdt/fdt.c | 222 +++++ extras/mini-os/lib/fdt/fdt_empty_tree.c | 84 ++ extras/mini-os/lib/fdt/fdt_ro.c | 574 ++++++++++++ extras/mini-os/lib/fdt/fdt_rw.c | 492 ++++++++++ extras/mini-os/lib/fdt/fdt_strerror.c | 96 ++ extras/mini-os/lib/fdt/fdt_sw.c | 256 ++++++ extras/mini-os/lib/fdt/fdt_wip.c | 118 +++ extras/mini-os/lib/fdt/libfdt_internal.h | 95 ++ extras/mini-os/lib/memmove.c | 45 + extras/mini-os/lib/string.c | 12 + 16 files changed, 3612 insertions(+), 1 deletion(-) create mode 100644 extras/mini-os/include/fdt.h create mode 100644 extras/mini-os/include/libfdt.h create mode 100644 extras/mini-os/include/libfdt_env.h create mode 100644 extras/mini-os/lib/fdt/fdt.c create mode 100644 extras/mini-os/lib/fdt/fdt_empty_tree.c create mode 100644 extras/mini-os/lib/fdt/fdt_ro.c create mode 100644 extras/mini-os/lib/fdt/fdt_rw.c create mode 100644 extras/mini-os/lib/fdt/fdt_strerror.c create mode 100644 extras/mini-os/lib/fdt/fdt_sw.c create mode 100644 extras/mini-os/lib/fdt/fdt_wip.c create mode 100644 extras/mini-os/lib/fdt/libfdt_internal.h create mode 100644 extras/mini-os/lib/memmove.c
extras/mini-os/COPYING +27 -0
@@ -34,3 +34,30 @@ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Copyright (c) 2005,2006, NLnetLabs +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of NLnetLabs nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE.
extras/mini-os/Makefile +13 -0
@@ -77,6 +77,18 @@ TARGET := mini-os # Subdirectories common to mini-os SUBDIRS := lib xenbus console +ifeq ($(XEN_TARGET_ARCH),arm32) +# Device tree support +SUBDIRS += lib/fdt +src-y += lib/fdt/fdt.c +src-y += lib/fdt/fdt_empty_tree.c +src-y += lib/fdt/fdt_ro.c +src-y += lib/fdt/fdt_rw.c +src-y += lib/fdt/fdt_strerror.c +src-y += lib/fdt/fdt_sw.c +src-y += lib/fdt/fdt_wip.c +endif + src-$(CONFIG_BLKFRONT) += blkfront.c src-$(CONFIG_TPMFRONT) += tpmfront.c src-$(CONFIG_TPM_TIS) += tpm_tis.c
@@ -101,6 +113,7 @@ src-y += lib/math.c src-y += lib/printf.c src-y += lib/stack_chk_fail.c src-y += lib/string.c +src-y += lib/memmove.c src-y += lib/sys.c src-y += lib/xmalloc.c src-$(CONFIG_XENBUS) += lib/xs.c
extras/mini-os/include/fdt.h new file +60 -0
60 lines not on this page · raw message
extras/mini-os/include/lib.h +3 -1
@@ -86,6 +86,7 @@ char *strncpy(char * __restrict, const char * __restrict, size_t);char *strstr (const char *,const char *); +void *memmove (void * dest,const void *src,size_t count);void *memset (void *,int ,size_t );char *strchr (const char *p,int ch);
@@ -95,7 +96,8 @@ char *strrchr(const char *p, int ch);* @(#)systm.h 8.7 (Berkeley) 3/29/95 * $FreeBSD$ */ -void *memcpy (void *to,const void *from,size_t len); +void *memcpy (void *to,const void *from,size_t len); +void *memchr (const void *s,int c,size_t n);size_t strnlen (const char *,size_t );#endif
extras/mini-os/include/libfdt.h new file +1478 -0
1,478 lines not on this page · raw message
extras/mini-os/include/libfdt_env.h new file +37 -0
@@ -0,0 +1,37 @@ +#ifndef _LIBFDT_ENV_H +#define _LIBFDT_ENV_H + +#ifdef _KERNEL +#include <sys/cdefs.h> +#include <sys/param.h> +#include <sys/types.h> +#include <sys/systm.h> +#include <sys/stdint.h> +#else +#include <stddef.h> +#include <stdint.h> +#include <string.h> +#endif + +#define EXTRACT_BYTE (n) ((unsigned long long)((uint8_t *)&x)[n]) +static inline uint16_t fdt16_to_cpu (uint16_t x) +{ +return (EXTRACT_BYTE (0 ) <<8 ) |EXTRACT_BYTE (1 ); +} +#define cpu_to_fdt16 (x) fdt16_to_cpu(x) + +static inline uint32_t fdt32_to_cpu (uint32_t x) +{ +return (EXTRACT_BYTE (0 ) <<24 ) | (EXTRACT_BYTE (1 ) <<16 ) | (EXTRACT_BYTE (2 ) <<8 ) |EXTRACT_BYTE (3 ); +} +#define cpu_to_fdt32 (x) fdt32_to_cpu(x) + +static inline uint64_t fdt64_to_cpu (uint64_t x) +{ +return (EXTRACT_BYTE (0 ) <<56 ) | (EXTRACT_BYTE (1 ) <<48 ) | (EXTRACT_BYTE (2 ) <<40 ) | (EXTRACT_BYTE (3 ) <<32 ) + | (EXTRACT_BYTE (4 ) <<24 ) | (EXTRACT_BYTE (5 ) <<16 ) | (EXTRACT_BYTE (6 ) <<8 ) |EXTRACT_BYTE (7 ); +} +#define cpu_to_fdt64 (x) fdt64_to_cpu(x) +#undef EXTRACT_BYTE + +#endif /* _LIBFDT_ENV_H */
extras/mini-os/lib/fdt/fdt.c new file +222 -0
222 lines not on this page · raw message
extras/mini-os/lib/fdt/fdt_empty_tree.c new file +84 -0
84 lines not on this page · raw message
extras/mini-os/lib/fdt/fdt_ro.c new file +574 -0
574 lines not on this page · raw message
extras/mini-os/lib/fdt/fdt_rw.c new file +492 -0
474 lines not on this page · raw message
extras/mini-os/lib/fdt/fdt_strerror.c new file +96 -0
96 lines not on this page · raw message
extras/mini-os/lib/fdt/fdt_sw.c new file +256 -0
256 lines not on this page · raw message
extras/mini-os/lib/fdt/fdt_wip.c new file +118 -0
118 lines not on this page · raw message
extras/mini-os/lib/fdt/libfdt_internal.h new file +95 -0
95 lines not on this page · raw message
extras/mini-os/lib/memmove.c new file +45 -0
45 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.0.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH ARM v5 18/20] mini-os: import libfdt
Hi Thomas,
Quoted 4 lines · Thomas Leonard
From: Karim Raslan <[email protected]>
Looks like this is revision v1.3.0-47-gbe60268 from
http://git.jdl.com/gitweb/?p=dtc.git
Unfortunately I can find this commit in the git tree. Do you have the full sha1?
AFAIU, you are using the version 1.3.0, right? If so, why didn't you get the latest version (i.e 1.4.0)?
Quoted 2 lines
The memmove implementation is from FreeBSD's
contrib/ldns/compat/memmove.c
Can you add a commit number just for tracking purpose?
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH ARM v5 18/20] mini-os: import libfdt
Quoted 5 lines · Julien Grall
Hi Thomas,
Quoted 1 line · Thomas Leonard
Quoted 8 lines
Quoted 4 lines
From: Karim Raslan <[email protected]>
Looks like this is revision v1.3.0-47-gbe60268 from
http://git.jdl.com/gitweb/?p=dtc.gitUnfortunately I can find this commit in the git tree. Do you have the full sha1?
It works for me:
$ git clone git://git.jdl.com/software/dtc.git $ cd dtc $ git show be60268 commit be6026838e45b67800ac803f4ad8cca3cde57d6d Author: David Gibson <[email protected]> Date: Fri Jun 1 14:12:38 2012 +1000
libfdt: Add helper function to create a trivial, empty tree
Quoted 2 lines
AFAIU, you are using the version 1.3.0, right? If so, why didn't you get the latest version (i.e 1.4.0)?
I don't know why this particular version was chosen. I could upgrade it if you want. I don't think there are any functional changes (uint32_t has been replaced by fdt32_t all over the place, and there are a couple of extra functions, which we don't need).
Quoted 5 lines
Quoted 2 lines
The memmove implementation is from FreeBSD's
contrib/ldns/compat/memmove.cCan you add a commit number just for tracking purpose?
OK.
Signature · 3 lines
Dr Thomas Leonard http://0install.net/ GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA
Re: [PATCH ARM v5 18/20] mini-os: import libfdt
Quoted 8 lines · Thomas Leonard
Quoted 7 lines · Julien Grall
Hi Thomas,
Quoted 3 lines · Thomas Leonard
From: Karim Raslan <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Looks like this is revision v1.3.0-47-gbe60268 from
http://git.jdl.com/gitweb/?p=dtc.gitUnfortunately I can find this commit in the git tree. Do you have the full sha1?
It works for me:
Hmmm right, sorry for the noise. Even though, you shell command below show a tag but a commit ;).
Quoted 9 lines
$ git clone git://git.jdl.com/software/dtc.git $ cd dtc $ git show be60268 commit be6026838e45b67800ac803f4ad8cca3cde57d6d Author: David Gibson <[email protected]> Date: Fri Jun 1 14:12:38 2012 +1000libfdt: Add helper function to create a trivial, empty tree
Quoted 7 lines
Quoted 2 lines
AFAIU, you are using the version 1.3.0, right? If so, why didn't you get the latest version (i.e 1.4.0)?
I don't know why this particular version was chosen. I could upgrade it if you want. I don't think there are any functional changes (
uint32_thas been replaced byfdt32_tall over the place, and there are a couple of extra functions, which we don't need).
Just looking to the libfdt already embedded in xen (xen/common/libfdt) and it looks like we are using the same version.
I'm wondering if you could share the same code and avoid to have the libfdt imported twice in Xen. Any thoughts?
Regards,
Signature · 1 line
Julien Grall
Re: [PATCH ARM v5 18/20] mini-os: import libfdt
Quoted 36 lines · Julien Grall
Quoted 12 lines · Thomas Leonard
Quoted 8 lines · Julien Grall
Hi Thomas,
Quoted 4 lines · Thomas Leonard
From: Karim Raslan <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Looks like this is revision v1.3.0-47-gbe60268 from
http://git.jdl.com/gitweb/?p=dtc.gitUnfortunately I can find this commit in the git tree. Do you have the full sha1?
It works for me:
Hmmm right, sorry for the noise. Even though, you shell command below show a tag but a commit ;).
Quoted 12 lines
$ git clone git://git.jdl.com/software/dtc.git $ cd dtc $ git show be60268 commit be6026838e45b67800ac803f4ad8cca3cde57d6d Author: David Gibson <[email protected]> Date: Fri Jun 1 14:12:38 2012 +1000libfdt: Add helper function to create a trivial, empty tree
Quoted 2 lines
AFAIU, you are using the version 1.3.0, right? If so, why didn't you get the latest version (i.e 1.4.0)?
Quoted 8 lines
Quoted 4 lines
I don't know why this particular version was chosen. I could upgrade it if you want. I don't think there are any functional changes (
uint32_thas been replaced byfdt32_tall over the place, and there are a couple of extra functions, which we don't need).Just looking to the libfdt already embedded in xen (xen/common/libfdt) and it looks like we are using the same version.
I'm wondering if you could share the same code and avoid to have the libfdt imported twice in Xen. Any thoughts?
MiniOS really needs to be able to compile as a standalone repository and not depend on Xen's source code if at all possible. This also came up at the recent hackathon in the context of splitting it out of the main repository in the future.
-Anil
Re: [PATCH ARM v5 18/20] mini-os: import libfdt
Hi Anil,
Quoted 8 lines · Anil Madhavapeddy
Quoted 8 lines · Julien Grall
Quoted 6 lines · Thomas Leonard
Quoted 1 line · Julien Grall
I don't know why this particular version was chosen. I could upgrade it if you want. I don't think there are any functional changes (
uint32_thas been replaced byfdt32_tall over the place, and there are a couple of extra functions, which we don't need).
Quoted 5 lines
Quoted 3 lines
Just looking to the libfdt already embedded in xen (xen/common/libfdt) and it looks like we are using the same version.
I'm wondering if you could share the same code and avoid to have the libfdt imported twice in Xen. Any thoughts?
MiniOS really needs to be able to compile as a standalone repository and not depend on Xen's source code if at all possible. This also came up at the recent hackathon in the context of splitting it out of the main repository in the future.
Thanks for the answer, I didn't follow this session at the Hackthon so I wasn't not aware about this plan.
Regards,
Signature · 1 line
Julien Grall
PATCH v5 19/20 mini-os: initial ARM support
In reply to Thomas LeonardOn ARM, Mini-OS will boot and display some output on the console. Tested with:
make XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- \ CONFIG_TEST=y CONFIG_START_NETWORK=n CONFIG_BLKFRONT=n \ CONFIG_NETFRONT=n CONFIG_FBFRONT=n CONFIG_KBDFRONT=n \ CONFIG_CONSFRONT=n CONFIG_XC=n -j4
[[email protected]: fixed initialisation code:
- Configure write-back caching in page table. This is needed for reliable hypercalls to Xen (thanks to Julien Grall).
- Use "client mode" for access control (domains are deprecated, according to ARM Cortex-A Series Programmer’s Guide version 4.0, section 9.6.4).
- Enable more SCTLR features (icache, branch prediction)] [[email protected]: use Virtual Count register for monotonic time] [[email protected]: fixed HYPERVISOR_shutdown] [[email protected]: get xenstore details from hypervisor] [[email protected]: use GCC implementation of division] [[email protected]: cleaned up interrupt handlers and threading] [[email protected]: call exit_thread when a thread returns] [[email protected]: implemented block_domain for ARM] [[email protected]: fixed hang when enabling interrupts] [[email protected]: added -march=armv7-a to flags] [[email protected]: CLREX after handling IRQs] [[email protected]: unbind debug port at shutdown] [[email protected]: allow unaligned accesses] [[email protected]: fix zImage header for XSA-95] [[email protected]: get RAM base and size from the FDT] [[email protected]: get GIC addresses from FDT] [[email protected]: added ARM grant table initialisation] [[email protected]: added missing copyright header to hypercalls32.S] [[email protected]: moved GIC driver to arm directory] [[email protected]: fixes suggested by Julien Grall:
- Removed unnecessary isb.
- Renamed GICD_PRIORITY to GICD_IPRIORITYR.
- Change IRQ number type from unsigned char to int.
- Added volatile to {set,clear}_bit_non_atomic.
- Fixed some comments.
- Check compatible properties in DTB.]
--- extras/mini-os/ARM-TODO.txt | 6 + extras/mini-os/Config.mk | 2 + extras/mini-os/Makefile | 9 ++ extras/mini-os/arch/arm/Makefile | 32 ++++ extras/mini-os/arch/arm/arch.mk | 7 + extras/mini-os/arch/arm/arm32.S | 266 +++++++++++++++++++++++++++++++ extras/mini-os/arch/arm/events.c | 30 ++++ extras/mini-os/arch/arm/gic.c | 222 ++++++++++++++++++++++++++ extras/mini-os/arch/arm/hypercalls32.S | 75 +++++++++ extras/mini-os/arch/arm/minios-arm32.lds | 75 +++++++++ extras/mini-os/arch/arm/mm.c | 134 ++++++++++++++++ extras/mini-os/arch/arm/sched.c | 37 +++++ extras/mini-os/arch/arm/setup.c | 116 ++++++++++++++ extras/mini-os/arch/arm/time.c | 202 +++++++++++++++++++++++ extras/mini-os/kernel.c | 2 +- 15 files changed, 1214 insertions(+), 1 deletion(-) create mode 100644 extras/mini-os/ARM-TODO.txt create mode 100755 extras/mini-os/arch/arm/Makefile create mode 100644 extras/mini-os/arch/arm/arch.mk create mode 100644 extras/mini-os/arch/arm/arm32.S create mode 100644 extras/mini-os/arch/arm/events.c create mode 100644 extras/mini-os/arch/arm/gic.c create mode 100644 extras/mini-os/arch/arm/hypercalls32.S create mode 100755 extras/mini-os/arch/arm/minios-arm32.lds create mode 100644 extras/mini-os/arch/arm/mm.c create mode 100644 extras/mini-os/arch/arm/sched.c create mode 100644 extras/mini-os/arch/arm/setup.c create mode 100644 extras/mini-os/arch/arm/time.c
extras/mini-os/ARM-TODO.txt new file +6 -0
@@ -0,0 +1,6 @@ +* support abort exception handling ( and others ) +* gic request_irq implementation, currently all IRQs all hardcoded in gic irq handler. +* bind_* +* add multiple cpu support (?) +* map_frames +* make sure that wallclock is functioning properly
extras/mini-os/Config.mk +2 -0
@@ -12,6 +12,8 @@ export XEN_INTERFACE_VERSION # If not x86 then use $(XEN_TARGET_ARCH) ifeq ($(findstring x86_,$(XEN_TARGET_ARCH)),x86_) TARGET_ARCH_FAM = x86 +else ifeq ($(findstring arm,$(XEN_TARGET_ARCH)),arm) +TARGET_ARCH_FAM = arm else TARGET_ARCH_FAM = $(XEN_TARGET_ARCH) endif
extras/mini-os/Makefile +9 -0
@@ -78,6 +78,9 @@ TARGET := mini-os SUBDIRS := lib xenbus console ifeq ($(XEN_TARGET_ARCH),arm32) +# Need libgcc.a for division helpers +LDLIBS += `$(CC) -print-libgcc-file-name` + # Device tree support SUBDIRS += lib/fdt src-y += lib/fdt/fdt.c
@@ -109,7 +112,9 @@ src-y += sched.c src-$(CONFIG_TEST) += test.c src-y += lib/ctype.c +ifneq ($(XEN_TARGET_ARCH),arm32) src-y += lib/math.c +endif src-y += lib/printf.c src-y += lib/stack_chk_fail.c src-y += lib/string.c
@@ -203,7 +208,11 @@ $(OBJ_DIR)/$(TARGET): $(OBJS) $(APP_O) arch_lib $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(APP_O) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o [email protected] $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start [email protected] [email protected] $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) [email protected] $(EXTRA_OBJS) -o $@ +ifeq ($(XEN_TARGET_ARCH),arm32) + $(OBJCOPY) -O binary $@ [email protected] +else gzip -f -9 -c $@ >[email protected] +endif .PHONY: clean arch_clean
extras/mini-os/arch/arm/Makefile new file +32 -0
@@ -0,0 +1,32 @@ +# +# ARM architecture specific makefiles. +# + +XEN_ROOT = $(CURDIR)/../../../.. +include $(XEN_ROOT)/Config.mk +include ../../Config.mk + +# include arch.mk has to be before minios.mk! + +include arch.mk +include ../../minios.mk + +# Sources here are all *.c (without $(XEN_TARGET_ARCH).S) +# This is handled in $(HEAD_ARCH_OBJ) +ARCH_SRCS := $(wildcard *.c) + +# The objects built from the sources. +ARCH_OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(ARCH_SRCS)) + +ARCH_OBJS += hypercalls32.o + +all: $(OBJ_DIR)/$(ARCH_LIB) + +# $(HEAD_ARCH_OBJ) is only built here, needed on linking +# in ../../Makefile. +$(OBJ_DIR)/$(ARCH_LIB): $(ARCH_OBJS) $(OBJ_DIR)/$(HEAD_ARCH_OBJ) + $(AR) rv $(OBJ_DIR)/$(ARCH_LIB) $(ARCH_OBJS) + +clean: + rm -f $(OBJ_DIR)/$(ARCH_LIB) $(ARCH_OBJS) $(OBJ_DIR)/$(HEAD_ARCH_OBJ) +
extras/mini-os/arch/arm/arch.mk new file +7 -0
@@ -0,0 +1,7 @@ +ifeq ($(XEN_TARGET_ARCH),arm32) +DEF_ASFLAGS += -march=armv7-a +ARCH_CFLAGS := -march=armv7-a -marm -fms-extensions -D__arm__ -DXEN_HAVE_PV_GUEST_ENTRY #-DCPU_EXCLUSIVE_LDST +EXTRA_INC += $(TARGET_ARCH_FAM)/$(XEN_TARGET_ARCH) +EXTRA_SRC += arch/$(EXTRA_INC) +endif +
extras/mini-os/arch/arm/arm32.S new file +266 -0
266 lines not on this page · raw message
extras/mini-os/arch/arm/events.c new file +30 -0
@@ -0,0 +1,30 @@ +#include <mini-os/os.h> +#include <mini-os/events.h> +#include <mini-os/hypervisor.h> + +static void virq_debug (evtchn_port_t port,struct pt_regs *regs,void *params) +{ +printk ("Received a virq_debug event\n" ); +} + +evtchn_port_t debug_port =-1 ; +void arch_init_events (void ) +{ + debug_port =bind_virq (VIRQ_DEBUG , (evtchn_handler_t )virq_debug,0 ); +if (debug_port ==-1 ) +BUG (); +unmask_evtchn (debug_port); +} + +void arch_unbind_ports (void ) +{ +if (debug_port !=-1 ) + { +mask_evtchn (debug_port); +unbind_evtchn (debug_port); + } +} + +void arch_fini_events (void ) +{ +}
extras/mini-os/arch/arm/gic.c new file +222 -0
222 lines not on this page · raw message
extras/mini-os/arch/arm/hypercalls32.S new file +75 -0
75 lines not on this page · raw message
extras/mini-os/arch/arm/minios-arm32.lds new file +75 -0
75 lines not on this page · raw message
extras/mini-os/arch/arm/mm.c new file +134 -0
134 lines not on this page · raw message
extras/mini-os/arch/arm/sched.c new file +37 -0
@@ -0,0 +1,37 @@ +#include <mini-os/sched.h> +#include <mini-os/xmalloc.h> + +void arm_start_thread (void ); + +/* Architecture specific setup of thread creation */ +struct thread *arch_create_thread (char *name,void (*function)(void *), +void *data) +{ +struct thread *thread; + + thread = xmalloc(struct thread); +/* We can't use lazy allocation here since the trap handler runs on the stack */ + thread->stack = (char *)alloc_pages (STACK_SIZE_PAGE_ORDER ); + thread->name = name; +printk ("Thread \"%s\": pointer: 0x%lx, stack: 0x%lx\n" , name, thread, + thread->stack); + +/* Save pointer to the thread on the stack, used by current macro */ + *((unsigned long *)thread->stack) = (unsigned long )thread; + +/* Push the details to pass to arm_start_thread onto the stack */ +int *sp = (int *) (thread->stack +STACK_SIZE ); + *(--sp) = (int ) function; + *(--sp) = (int ) data; + thread->sp = (unsigned long ) sp; + + thread->ip = (unsigned long ) arm_start_thread; + +return thread; +} + +void run_idle_thread (void ) +{ + __asm__ __volatile__ ("mov sp, %0; mov pc, %1" ::"r" (idle_thread->sp),"r" (idle_thread->ip)); +/* Never arrive here! */ +}
extras/mini-os/arch/arm/setup.c new file +116 -0
116 lines not on this page · raw message
extras/mini-os/arch/arm/time.c new file +202 -0
202 lines not on this page · raw message
extras/mini-os/kernel.c +1 -1
@@ -121,7 +121,7 @@ void start_kernel(void)init_events ();/* ENABLE EVENT DELIVERY. This is disabled at start of day. */ -__sti (); +local_irq_enable ();setup_xen_features ();
Signature · 7 lines
2.0.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 39 lines · Thomas Leonard
On ARM, Mini-OS will boot and display some output on the console. Tested with:
make XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- \ CONFIG_TEST=y CONFIG_START_NETWORK=n CONFIG_BLKFRONT=n \ CONFIG_NETFRONT=n CONFIG_FBFRONT=n CONFIG_KBDFRONT=n \ CONFIG_CONSFRONT=n CONFIG_XC=n -j4Signed-off-by Karim Allah Ahmed <[email protected]>[[email protected]: made x86_64 support work again][[email protected]: split into multiple patches][[email protected]: re-enabled force_evtchn_callback][[email protected]: enable regular console][[email protected]: fixed initialisation code:
- Configure write-back caching in page table. This is needed for reliable hypercalls to Xen (thanks to Julien Grall).
- Use "client mode" for access control (domains are deprecated, according to ARM Cortex-A Series Programmer’s Guide version 4.0, section 9.6.4).
- Enable more SCTLR features (icache, branch prediction)] [[email protected]: use Virtual Count register for monotonic time] [[email protected]: fixedHYPERVISOR_shutdown] [[email protected]: get xenstore details from hypervisor] [[email protected]: use GCC implementation of division] [[email protected]: cleaned up interrupt handlers and threading] [[email protected]: callexit_threadwhen a thread returns] [[email protected]: implementedblock_domainfor ARM] [[email protected]: fixed hang when enabling interrupts] [[email protected]: added -march=armv7-a to flags] [[email protected]: CLREX after handling IRQs] [[email protected]: unbind debug port at shutdown] [[email protected]: allow unaligned accesses] [[email protected]: fix zImage header for XSA-95] [[email protected]: get RAM base and size from the FDT] [[email protected]: get GIC addresses from FDT] [[email protected]: added ARM grant table initialisation] [[email protected]: added missing copyright header tohypercalls32.S] [[email protected]: moved GIC driver to arm directory] [[email protected]: fixes suggested by Julien Grall:
Quoted 8 lines
- Removed unnecessary isb.
- RenamedGICD_PRIORITYtoGICD_IPRIORITYR.
- Change IRQ number type from unsigned char to int.
- Added volatile to {set,clear}_bit_non_atomic.
- Fixed some comments.
- Check compatible properties in DTB.] [[email protected]: made image relocatable] [[email protected]: addedmfn_to_pfnandpfn_to_mfn]
IHMO all these changes doesn't belong to the commit message, i.e should not appear in the commit message when Ian will apply your commit message.
I would move them in a changelog. You can separate the commit message and the changelog by --- and a newline. Everything after the --- will be removed by git am.
Quoted 49 lines
Signed-off-by Thomas Leonard <[email protected]>--- extras/mini-os/ARM-TODO.txt | 6 + extras/mini-os/Config.mk | 2 + extras/mini-os/Makefile | 9 ++ extras/mini-os/arch/arm/Makefile | 32 ++++ extras/mini-os/arch/arm/arch.mk | 7 + extras/mini-os/arch/arm/arm32.S | 266 +++++++++++++++++++++++++++++++ extras/mini-os/arch/arm/events.c | 30 ++++ extras/mini-os/arch/arm/gic.c | 222 ++++++++++++++++++++++++++ extras/mini-os/arch/arm/hypercalls32.S | 75 +++++++++ extras/mini-os/arch/arm/minios-arm32.lds | 75 +++++++++ extras/mini-os/arch/arm/mm.c | 134 ++++++++++++++++ extras/mini-os/arch/arm/sched.c | 37 +++++ extras/mini-os/arch/arm/setup.c | 116 ++++++++++++++ extras/mini-os/arch/arm/time.c | 202 +++++++++++++++++++++++ extras/mini-os/kernel.c | 2 +- 15 files changed, 1214 insertions(+), 1 deletion(-)create mode 100644
extras/mini-os/ARM-TODO.txtcreate mode 100755 extras/mini-os/arch/arm/Makefile create mode 100644extras/mini-os/arch/arm/arch.mkcreate mode 100644extras/mini-os/arch/arm/arm32.Screate mode 100644extras/mini-os/arch/arm/events.ccreate mode 100644extras/mini-os/arch/arm/gic.ccreate mode 100644extras/mini-os/arch/arm/hypercalls32.Screate mode 100755extras/mini-os/arch/arm/minios-arm32.ldscreate mode 100644extras/mini-os/arch/arm/mm.ccreate mode 100644extras/mini-os/arch/arm/sched.ccreate mode 100644extras/mini-os/arch/arm/setup.ccreate mode 100644extras/mini-os/arch/arm/time.cextras/mini-os/Config.mk +2
-0@@ -12,6 +12,8 @@ export XEN_INTERFACE_VERSION # If not x86 then use $(XEN_TARGET_ARCH) ifeq ($(findstring x86_,$(XEN_TARGET_ARCH)),x86_) TARGET_ARCH_FAM = x86 +else ifeq ($(findstring arm,$(XEN_TARGET_ARCH)),arm) +TARGET_ARCH_FAM = arm else TARGET_ARCH_FAM = $(XEN_TARGET_ARCH) endifextras/mini-os/Makefile +0
-0
extras/mini-os/Makefile TARGET := mini-os · line 82
Quoted 5 lines
extras/mini-os/Makefile +2
-0@@ -78,6 +78,9 @@ TARGET := mini-os SUBDIRS := lib xenbus console ifeq ($(XEN_TARGET_ARCH),arm32) +# Need libgcc.a for division helpers +LDLIBS += `$(CC) -print-libgcc-file-name`
OOI, how much code does add libgcc for the division helpers?
Quoted 57 lines
extras/mini-os/arch/arm/Makefile new file +32
-0@@ -0,0 +1,32 @@ +# +# ARM architecture specific makefiles. +# + +XEN_ROOT = $(CURDIR)/../../../.. +include $(XEN_ROOT)/Config.mk +include ../../Config.mk + +# include arch.mk has to be before minios.mk! + +include arch.mk +include ../../minios.mk + +# Sources here are all *.c (without $(XEN_TARGET_ARCH).S) +# This is handled in $(HEAD_ARCH_OBJ) +ARCH_SRCS := $(wildcard *.c) + +# The objects built from the sources. +ARCH_OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(ARCH_SRCS)) + +ARCH_OBJS += hypercalls32.o + +all: $(OBJ_DIR)/$(ARCH_LIB) + +# $(HEAD_ARCH_OBJ) is only built here, needed on linking +# in ../../Makefile. +$(OBJ_DIR)/$(ARCH_LIB): $(ARCH_OBJS) $(OBJ_DIR)/$(HEAD_ARCH_OBJ) + $(AR) rv $(OBJ_DIR)/$(ARCH_LIB) $(ARCH_OBJS) + +clean: + rm -f $(OBJ_DIR)/$(ARCH_LIB) $(ARCH_OBJS) $(OBJ_DIR)/$(HEAD_ARCH_OBJ) +extras/mini-os/arch/arm/arch.mk new file +7
-0@@ -0,0 +1,7 @@ +ifeq ($(XEN_TARGET_ARCH),arm32) +DEF_ASFLAGS += -march=armv7-a +ARCH_CFLAGS := -march=armv7-a -marm -fms-extensions -D__arm__ -DXEN_HAVE_PV_GUEST_ENTRY #-DCPU_EXCLUSIVE_LDST +EXTRA_INC += $(TARGET_ARCH_FAM)/$(XEN_TARGET_ARCH) +EXTRA_SRC += arch/$(EXTRA_INC) +endif +extras/mini-os/arch/arm/arm32.S new file +0
-0
extras/mini-os/arch/arm/arm32.S line 7
Quoted 7 lines
extras/mini-os/arch/arm/arm32.S new file +7
-0@@ -0,0 +1,266 @@ +@ Virtual address of the start of RAM (any value will do, but it must be +@ section-aligned). Update the lds script if changed. +#define VIRT_BASE 0x400000 + +@ Offset of the kernel within the RAM. This is a zImage convention which we +@ rely on. +#define ZIMAGE_KERNEL_OFFSET 0x8000
Hmmm... this is not a zImage convention... IIRC Linux is using this offset to have enough space to create startup page table during boot.
The Linux zImage is able to relocate itself in the memory to respect this convention. But the zImage itself can be loaded anywhere in the memory.
By looking to your code below your are relying that the kernel will be loaded at 0xXXXX8000 which is incorrect. This offset is odd and make other kernel (such as FreeBSD) requiring the same trick which is not part of the Linux boot protocol.
I plan to send a patch to require the start address to be 2MB aligned, so kernels will be able to use 2MB (for LPAE) and 1MB section for there early page table.
If the kernel wants another alignment, then you will have to relocate yourself. Even though in your case, you don't need this odd 0xXXXX8000.
[..]
extras/mini-os/arch/arm/arm32.S line 145
Quoted 11 lines
extras/mini-os/arch/arm/arm32.S new file +11
-0+ @ Fill in the whole top-level translation table (at page_dir). + @ Populate the whole pagedir with 1MB section descriptors. + + mov r1, r7 @ r1 -> first section entry + add r3, r1, #4*4*1024 @ limit (4 GB address space, 4 byte entries) + orr r0, r8, r9 @ r0 = entry mapping section zero to start of physical RAM +1: + str r0, [r1],#4 @ write the section entry + add r0, r0, #1 << 20 @ next physical page (wraps) + cmp r1, r3 + bne 1b
I would document a bit more this part. It took me a bit of time to understand that you mapping the whole address space in an odd manner.
While it's fine for a first version of Mini-OS support for ARM. It think at long term you want to map only necessary bank rank. It will be easier to catch programming error and avoid to trap in the hypervisor because the physical address doesn't exist.
Futhermore, the data abort sent by the hypervisor is odd (debug smth).
Quoted 19 lines
extras/mini-os/arch/arm/arm32.S new file +19
-0+.pushsection .data +_data: +.align 14 +.globl page_dir +@ Each word maps one 1MB virtual section to a physical section +page_dir: + .fill (4*1024), 4, 0x0 + +.align 12 +.globl shared_info_page +shared_info_page: + .fill (1024), 4, 0x0 + +.align 3 +.globl stack +stack: + .fill (4*1024), 4, 0x0 +stack_end: +
extras/mini-os/arch/arm/arm32.S line 202
Quoted 10 lines
extras/mini-os/arch/arm/arm32.S new file +10
-0+.align 3 +irqstack: + .fill (1024), 4, 0x0 +irqstack_end: + +.globl physical_address_offset +physical_address_offset: + .long 0 + +.popsection
Any reason to define theses variables in ASM rather than C?
Quoted 6 lines
extras/mini-os/arch/arm/gic.c new file +0
-0
extras/mini-os/arch/arm/gic.c line 10
Quoted 10 lines
extras/mini-os/arch/arm/gic.c new file +10
-0@@ -0,0 +1,222 @@ +// ARM GIC implementation + +#include <mini-os/os.h> +#include <mini-os/hypervisor.h> +#include <libfdt.h> + +//#define VGIC_DEBUG +#ifdef VGIC_DEBUG +#define DEBUG(_f, _a...) \ + DEBUG("MINI_OS(file=vgic.c, line=%d) " _f , __LINE__, ## _a)
Did you intend to use printk here?
[..]
Quoted 5 lines
extras/mini-os/arch/arm/gic.c new file +5
-0+void gic_init (void ) { + gic.gicd_base =NULL ; +int node =0 ; +int depth =0 ; +for (;;)
extras/mini-os/arch/arm/gic.c line 187
Quoted 10 lines
extras/mini-os/arch/arm/gic.c new file +10
-0+ { + node =fdt_next_node (device_tree, node, &depth); +if (node <=0 || depth <0 ) +break ; + +if (fdt_getprop (device_tree, node,"interrupt-controller" ,NULL )) { +int len =0 ; + + if (fdt_node_check_compatible(device_tree, node, "arm,cortex-a15-gic") && + fdt_node_check_compatible(device_tree, node, "arm,cortex-a9-gic") &&
I don't think this compatible is necessary. Cortex A9 doesn't support virtualisation.
extras/mini-os/arch/arm/gic.c line 194
Quoted 7 lines
extras/mini-os/arch/arm/gic.c new file +7
-0+ fdt_node_check_compatible(device_tree, node, "arm,cortex-a7-gic")) { +printk ("Skipping incompatible interrupt-controller node\n" ); +continue ; + } + +const uint64_t *reg =fdt_getprop (device_tree, node,"reg" , &len); +if (reg ==NULL || len !=32 ) {
As asked on the previous version, if you plan to assume specific range size for the time-being, please explain the 32.
extras/mini-os/arch/arm/gic.c line 200
Quoted 6 lines
extras/mini-os/arch/arm/gic.c new file +6
-0+/* TODO: support other formats */ +printk ("Bad 'reg' property: %p %d\n" , reg, len); +continue ; + } + gic.gicd_base =to_virt ((long )fdt64_to_cpu (reg[0 ])); + gic.gicc_base =to_virt ((long )fdt64_to_cpu (reg[2 ]));
AFAIU, your are mapping the GIC region with normal attribute. With this attribute, the processor may reorder the write in the device memory, preload memory, caching.... Which is completely wrong in this case. I'm sa bit surprised that it works correctly. You have to map thoses regions as device memory.
[..]
Quoted 5 lines
extras/mini-os/arch/arm/hypercalls32.S new file +0
-0
[..]
extras/mini-os/arch/arm/hypercalls32.S line 44
Quoted 12 lines
extras/mini-os/arch/arm/hypercalls32.S new file +12
-0+#define __HYPERVISOR_memory_op 12 +#define __HYPERVISOR_xen_version 17 +#define __HYPERVISOR_console_io 18 +#define __HYPERVISOR_grant_table_op 20 +#define __HYPERVISOR_vcpu_op 24 +#define __HYPERVISOR_xsm_op 27 +#define __HYPERVISOR_sched_op 29 +#define __HYPERVISOR_event_channel_op 32 +#define __HYPERVISOR_physdev_op 33 +#define __HYPERVISOR_hvm_op 34 +#define __HYPERVISOR_sysctl 35 +#define __HYPERVISOR_domctl 36
Hmmm... why do you hardcode those numbers here? Can't you include the correct header?
[..]
extras/mini-os/arch/arm/minios-arm32.lds line 5
Quoted 11 lines
extras/mini-os/arch/arm/minios-arm32.lds new file +5
-0@@ -0,0 +1,75 @@ +OUTPUT_ARCH(arm) +ENTRY(_start) +SECTIONS +{ + . = 0x408000;
I would use the preprocessor to avoid hardcoding address here. It will help later if someone wants to change the virtual address of the kernel.
[..]
Quoted 1 line
extras/mini-os/arch/arm/mm.c +0
-0
[..]
Quoted 1 line
+void
arch_init_mm(unsigned long *start_pfn_p, unsigned long *max_pfn_p)
[..]
extras/mini-os/arch/arm/mm.c line 39
Quoted 5 lines
extras/mini-os/arch/arm/mm.c +5
-0+ +/* Xen will always provide us at least one bank of memory. +* Mini-OS will use the first bank for the time-being. */ + regs =fdt_getprop (device_tree, memory,"reg" , &prop_len); +if (regs ==NULL || prop_len !=16 ) {
Same remark as in gic_init. Please explain where does come from the 16.
[..]
extras/mini-os/arch/arm/mm.c line 47
Quoted 8 lines
extras/mini-os/arch/arm/mm.c +8
-0+/* TODO: support other formats */ +printk ("Bad 'reg' property: %p %d\n" , regs, prop_len); +BUG (); + } + +unsigned int end = (unsigned int ) &_end; +unsigned int mem_base =fdt64_to_cpu (regs[0 ]); +unsigned int mem_size =fdt64_to_cpu (regs[1 ]);
In general if you have to cast/create a variable to contain a physical address. Please make create a type paddr_t and use it.
When someone will implement arm64 support it will have less trouble because we cast correctly cast the value.
IIRC, there is few other place where it's the same problem.
Quoted 4 lines
extras/mini-os/arch/arm/mm.c +4
-0+/* Get Xen's suggested physical page assignments for the grant table. */ +static unsigned long get_gnttab_base (void ) +{ +int hypervisor;
extras/mini-os/arch/arm/mm.c line 90
Quoted 10 lines
extras/mini-os/arch/arm/mm.c +10
-0+int len =0 ; +const uint64_t *regs; +unsigned int gnttab_base; + + hypervisor =fdt_node_offset_by_compatible (device_tree,-1 ,"xen,xen" ); +BUG_ON (hypervisor <0 ); + + regs =fdt_getprop (device_tree, hypervisor,"reg" , &len); +if (regs ==NULL || len !=16 ) { +/* TODO: support other formats */
Please explain why the 16.
extras/mini-os/arch/arm/mm.c line 95
Quoted 5 lines
extras/mini-os/arch/arm/mm.c +5
-0+printk ("Bad 'reg' property: %p %d\n" , regs, len); +BUG (); + } + + gnttab_base =fdt64_to_cpu (regs[0 ]);
This look odd... you are using unsigned int for the variable but the function is return unsigned long.
extras/mini-os/arch/arm/mm.c line 100
Quoted 4 lines
extras/mini-os/arch/arm/mm.c +4
-0+printk ("FDT suggests grant table base %lx\n" , gnttab_base); + +return gnttab_base; +}
[..]
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 53 lines · Julien Grall
Quoted 40 lines · Thomas Leonard
On ARM, Mini-OS will boot and display some output on the console. Tested with:
make XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- \ CONFIG_TEST=y CONFIG_START_NETWORK=n CONFIG_BLKFRONT=n \ CONFIG_NETFRONT=n CONFIG_FBFRONT=n CONFIG_KBDFRONT=n \ CONFIG_CONSFRONT=n CONFIG_XC=n -j4Signed-off-by Karim Allah Ahmed <[email protected]>[[email protected]: made x86_64 support work again][[email protected]: split into multiple patches][[email protected]: re-enabled force_evtchn_callback][[email protected]: enable regular console][[email protected]: fixed initialisation code:
- Configure write-back caching in page table. This is needed for reliable hypercalls to Xen (thanks to Julien Grall).
- Use "client mode" for access control (domains are deprecated, according to ARM Cortex-A Series Programmer’s Guide version 4.0, section 9.6.4).
- Enable more SCTLR features (icache, branch prediction)] [[email protected]: use Virtual Count register for monotonic time] [[email protected]: fixedHYPERVISOR_shutdown] [[email protected]: get xenstore details from hypervisor] [[email protected]: use GCC implementation of division] [[email protected]: cleaned up interrupt handlers and threading] [[email protected]: callexit_threadwhen a thread returns] [[email protected]: implementedblock_domainfor ARM] [[email protected]: fixed hang when enabling interrupts] [[email protected]: added -march=armv7-a to flags] [[email protected]: CLREX after handling IRQs] [[email protected]: unbind debug port at shutdown] [[email protected]: allow unaligned accesses] [[email protected]: fix zImage header for XSA-95] [[email protected]: get RAM base and size from the FDT] [[email protected]: get GIC addresses from FDT] [[email protected]: added ARM grant table initialisation] [[email protected]: added missing copyright header tohypercalls32.S] [[email protected]: moved GIC driver to arm directory] [[email protected]: fixes suggested by Julien Grall:Quoted 8 lines
- Removed unnecessary isb.
- RenamedGICD_PRIORITYtoGICD_IPRIORITYR.
- Change IRQ number type from unsigned char to int.
- Added volatile to {set,clear}_bit_non_atomic.
- Fixed some comments.
- Check compatible properties in DTB.] [[email protected]: made image relocatable] [[email protected]: addedmfn_to_pfnandpfn_to_mfn]
Quoted 2 lines
IHMO all these changes doesn't belong to the commit message, i.e should not appear in the commit message when Ian will apply your commit message.
As I understand it, as I'm not the author of the patch, it's polite to indicate how I have modified it. I'm trying to follow the guidelines here:
"Rule (b) allows you to adjust the code, but then it is very impolite to change one submitter's code and make him endorse your bugs. To solve this problem, it is recommended that you add a line between the last Signed-off-by header and yours, indicating the nature of your changes."
Quoted 57 lines
I would move them in a changelog. You can separate the commit message and the changelog by --- and a newline. Everything after the --- will be removed by git am.
Quoted 53 lines
Signed-off-by Thomas Leonard <[email protected]>--- extras/mini-os/ARM-TODO.txt | 6 + extras/mini-os/Config.mk | 2 + extras/mini-os/Makefile | 9 ++ extras/mini-os/arch/arm/Makefile | 32 ++++ extras/mini-os/arch/arm/arch.mk | 7 + extras/mini-os/arch/arm/arm32.S | 266 +++++++++++++++++++++++++++++++ extras/mini-os/arch/arm/events.c | 30 ++++ extras/mini-os/arch/arm/gic.c | 222 ++++++++++++++++++++++++++ extras/mini-os/arch/arm/hypercalls32.S | 75 +++++++++ extras/mini-os/arch/arm/minios-arm32.lds | 75 +++++++++ extras/mini-os/arch/arm/mm.c | 134 ++++++++++++++++ extras/mini-os/arch/arm/sched.c | 37 +++++ extras/mini-os/arch/arm/setup.c | 116 ++++++++++++++ extras/mini-os/arch/arm/time.c | 202 +++++++++++++++++++++++ extras/mini-os/kernel.c | 2 +- 15 files changed, 1214 insertions(+), 1 deletion(-)create mode 100644
extras/mini-os/ARM-TODO.txtcreate mode 100755 extras/mini-os/arch/arm/Makefile create mode 100644extras/mini-os/arch/arm/arch.mkcreate mode 100644extras/mini-os/arch/arm/arm32.Screate mode 100644extras/mini-os/arch/arm/events.ccreate mode 100644extras/mini-os/arch/arm/gic.ccreate mode 100644extras/mini-os/arch/arm/hypercalls32.Screate mode 100755extras/mini-os/arch/arm/minios-arm32.ldscreate mode 100644extras/mini-os/arch/arm/mm.ccreate mode 100644extras/mini-os/arch/arm/sched.ccreate mode 100644extras/mini-os/arch/arm/setup.ccreate mode 100644extras/mini-os/arch/arm/time.cextras/mini-os/Config.mk +2
-0@@ -12,6 +12,8 @@ export XEN_INTERFACE_VERSION # If not x86 then use $(XEN_TARGET_ARCH) ifeq ($(findstring x86_,$(XEN_TARGET_ARCH)),x86_) TARGET_ARCH_FAM = x86 +else ifeq ($(findstring arm,$(XEN_TARGET_ARCH)),arm) +TARGET_ARCH_FAM = arm else TARGET_ARCH_FAM = $(XEN_TARGET_ARCH) endifextras/mini-os/Makefile +0
-0@@ -78,6 +78,9 @@ TARGET := mini-os SUBDIRS := lib xenbus console
Quoted 6 lines
extras/mini-os/Makefile TARGET := mini-os · line 82
Quoted 3 lines
extras/mini-os/Makefile +2
-0ifeq ($(XEN_TARGET_ARCH),arm32) +# Need libgcc.a for division helpers +LDLIBS += `$(CC) -print-libgcc-file-name`OOI, how much code does add libgcc for the division helpers?
Hard to say. libgcc.a contains many files, but the ones with "div" in the name come to about 67K, so probably less than that.
Quoted 66 lines
Quoted 66 lines
extras/mini-os/arch/arm/Makefile new file +31
-0@@ -0,0 +1,32 @@ +# +# ARM architecture specific makefiles. +# + +XEN_ROOT = $(CURDIR)/../../../.. +include $(XEN_ROOT)/Config.mk +include ../../Config.mk + +# include arch.mk has to be before minios.mk! + +include arch.mk +include ../../minios.mk + +# Sources here are all *.c (without $(XEN_TARGET_ARCH).S) +# This is handled in $(HEAD_ARCH_OBJ) +ARCH_SRCS := $(wildcard *.c) + +# The objects built from the sources. +ARCH_OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(ARCH_SRCS)) + +ARCH_OBJS += hypercalls32.o + +all: $(OBJ_DIR)/$(ARCH_LIB) + +# $(HEAD_ARCH_OBJ) is only built here, needed on linking +# in ../../Makefile. +$(OBJ_DIR)/$(ARCH_LIB): $(ARCH_OBJS) $(OBJ_DIR)/$(HEAD_ARCH_OBJ) + $(AR) rv $(OBJ_DIR)/$(ARCH_LIB) $(ARCH_OBJS) + +clean: + rm -f $(OBJ_DIR)/$(ARCH_LIB) $(ARCH_OBJS)$(OBJ_DIR)/$(HEAD_ARCH_OBJ)
extras/mini-os/arch/arm/Makefile new file +1
-0+extras/mini-os/arch/arm/arch.mk new file +7
-1@@ -0,0 +1,7 @@ +ifeq ($(XEN_TARGET_ARCH),arm32) +DEF_ASFLAGS += -march=armv7-a +ARCH_CFLAGS := -march=armv7-a -marm -fms-extensions -D__arm__ -DXEN_HAVE_PV_GUEST_ENTRY #-DCPU_EXCLUSIVE_LDST +EXTRA_INC += $(TARGET_ARCH_FAM)/$(XEN_TARGET_ARCH) +EXTRA_SRC += arch/$(EXTRA_INC) +endif +extras/mini-os/arch/arm/arm32.S new file +4
-0@@ -0,0 +1,266 @@ +@ Virtual address of the start of RAM (any value will do, but it must be +@ section-aligned). Update the lds script if changed. +#define VIRT_BASE 0x400000 +
Quoted 8 lines
Quoted 4 lines
extras/mini-os/arch/arm/arm32.S new file +1
-0+@ Offset of the kernel within the RAM. This is a zImage convention whichwe
+@ rely on.
+#defineZIMAGE_KERNEL_OFFSET0x8000Hmmm... this is not a zImage convention... IIRC Linux is using this offset to have enough space to create startup page table during boot.
OK, so this is a convention of Linux only? I found this reference:
http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html
"Despite the ability to place zImage anywhere within memory, convention has it that it is loaded at the base of physical RAM plus an offset of 0x8000 (32K). This leaves space for the parameter block usually placed at offset 0x100, zero page exception vectors and page tables. This convention is *very* common."
Quoted 7 lines
The Linux zImage is able to relocate itself in the memory to respect this convention. But the zImage itself can be loaded anywhere in the memory.
By looking to your code below your are relying that the kernel will be loaded at 0xXXXX8000 which is incorrect. This offset is odd and make other kernel (such as FreeBSD) requiring the same trick which is not part of the Linux boot protocol.
Sorry, I don't understand this. You're saying that Xen's choice of 0x8000 forces FreeBSD to support this offset too? But that isn't caused by anything in Mini-OS.
Quoted 6 lines
I plan to send a patch to require the start address to be 2MB aligned, so kernels will be able to use 2MB (for LPAE) and 1MB section for there early page table.
If the kernel wants another alignment, then you will have to relocate yourself. Even though in your case, you don't need this odd 0xXXXX8000.
It's very convenient to know at least the offset where we will be loaded. Otherwise, we have to move the image around in memory with loads and stores. I think there is some work going on to share images between VMs (for running large numbers of VMs on one machine). I don't know the details, but presumably it would be easier to support that if the image's text section can be mapped read-only.
Quoted 18 lines
[..]
extras/mini-os/arch/arm/arm32.S line 145
Quoted 13 lines
extras/mini-os/arch/arm/arm32.S new file +5
-0+ @ Fill in the whole top-level translation table (at page_dir). + @ Populate the whole pagedir with 1MB section descriptors. + + mov r1, r7 @ r1 -> first section entry + add r3, r1, #4*4*1024 @ limit (4 GB address space, 4byte entries)
+ orr r0, r8, r9 @ r0 = entry mapping section zero
to start of physical RAM
+1:extras/mini-os/arch/arm/arm32.S new file +4
-0+ str r0, [r1],#4 @ write the section entry + add r0, r0, #1 << 20 @ next physical page (wraps) + cmp r1, r3 + bne 1b
Quoted 2 lines
I would document a bit more this part. It took me a bit of time to understand that you mapping the whole address space in an odd manner.
Could you suggest something? It's hard to know what other people will find confusing. For reference, here's the existing comment in the code where I tried to explain the scheme:
@ Problem: the C code wants to be at a known address (VIRT_BASE),
but Xen might
@ load us anywhere. We initialise the MMU (mapping virtual to
physical @ addresses)
@ so everything ends up where the code expects it to be. @
@ We calculate the offet between where the linker thought _start
would be and where
@ it actually is and initialise the page tables to have that
offset for every page.
@
@ When we turn on the MMU, we're still executing at the old
address. We don't want
@ the code to disappear from under us. So we have to do the
mapping in stages:
@
@ 1. set up a mapping to our current page from both its current
and desired addresses
@ 2. enable the MMU
@ 3. jump to the new address
@ 4. remap all the other pages with the calculated offset
Quoted 4 lines
While it's fine for a first version of Mini-OS support for ARM. It think at long term you want to map only necessary bank rank. It will be easier to catch programming error and avoid to trap in the hypervisor because the physical address doesn't exist.
Yes, this is just the boot code. Eventually, the C code should make the .text read-only (and unmap pages that don't exist, although I don't think there's currently any disadvantage to having the trap caused by the second stage page tables). I also want to add guard pages to the thread stacks once these initial patches are in.
Quoted 1 line
Futhermore, the data abort sent by the hypervisor is odd (debug smth).
Could you explain what you mean by "odd" here?
Quoted 24 lines
Quoted 24 lines
+.pushsection .data
extras/mini-os/arch/arm/arm32.S new file +23
-0+_data: +.align 14 +.globl page_dir +@ Each word maps one 1MB virtual section to a physical section +page_dir: + .fill (4*1024), 4, 0x0 + +.align 12 +.globl shared_info_page +shared_info_page: + .fill (1024), 4, 0x0 + +.align 3 +.globl stack +stack: + .fill (4*1024), 4, 0x0 +stack_end: + +.align 3 +irqstack: + .fill (1024), 4, 0x0 +irqstack_end: +
Quoted 8 lines
extras/mini-os/arch/arm/arm32.S line 202
Quoted 5 lines
+.globl
physical_address_offsetextras/mini-os/arch/arm/arm32.S new file +4
-0+physical_address_offset: + .long 0 + +.popsectionAny reason to define theses variables in ASM rather than C?
I normally prefer to define variables in the module that sets them, but it doesn't make much difference to me.
Though perhaps they should be moved to the .bss section (except for the page table, which could be moved to the start of RAM to simplify things).
Quoted 11 lines
Quoted 11 lines
extras/mini-os/arch/arm/gic.c new file +5
-0@@ -0,0 +1,222 @@ +// ARM GIC implementation + +#include <mini-os/os.h> +#include <mini-os/hypervisor.h> +#include <libfdt.h>
Quoted 8 lines
extras/mini-os/arch/arm/gic.c line 10
Quoted 5 lines
extras/mini-os/arch/arm/gic.c new file +5
-0+ +//#define VGIC_DEBUG +#ifdef VGIC_DEBUG +#define DEBUG(_f, _a...) \ + DEBUG("MINI_OS(file=vgic.c, line=%d) " _f , __LINE__, ## _a)Did you intend to use printk here?
It does look odd. I'll take a look.
Quoted 17 lines
[..]
Quoted 14 lines
extras/mini-os/arch/arm/gic.c new file +11
-0+void gic_init (void ) { + gic.gicd_base =NULL ; +int node =0 ; +int depth =0 ; +for (;;) + { + node =fdt_next_node (device_tree, node, &depth); +if (node <=0 || depth <0 ) +break ; + +if (fdt_getprop (device_tree, node,"interrupt-controller" ,NULL )){
extras/mini-os/arch/arm/gic.c new file +2
-0+int len =0 ; +
Quoted 8 lines
Quoted 4 lines
+ if (fdt_node_check_compatible(device_tree, node,
"arm,cortex-a15-gic") &&
+ fdt_node_check_compatible(device_tree, node,
"arm,cortex-a9-gic") &&I don't think this compatible is necessary. Cortex A9 doesn't support virtualisation.
OK. I was just matching on the values that Xen provides. a15-gic should be fine on its own, though.
Quoted 12 lines
Quoted 10 lines
+ fdt_node_check_compatible(device_tree, node,
"arm,cortex-a7-gic")) {
+ printk("Skipping incompatible interrupt-controller
node\n");extras/mini-os/arch/arm/gic.c new file +4
-0+continue ; + } + + const uint64_t *reg = fdt_getprop(device_tree, node, "reg",&len);
+ if (reg == NULL || len != 32) {
Quoted 2 lines
As asked on the previous version, if you plan to assume specific range size for the time-being, please explain the 32.
OK, so we have two registers (GICC and GICD), each of which contains two parts (an address and a size), each of which is a 64-bit value (8 bytes). So 2 * 2 * 8 = 32. Should I check this as a minimum, or require it to match exactly?
Quoted 8 lines
extras/mini-os/arch/arm/gic.c line 200
Quoted 6 lines
extras/mini-os/arch/arm/gic.c new file +6
-0+/* TODO: support other formats */ +printk ("Bad 'reg' property: %p %d\n" , reg, len); +continue ; + } + gic.gicd_base =to_virt ((long )fdt64_to_cpu (reg[0 ])); + gic.gicc_base =to_virt ((long )fdt64_to_cpu (reg[2 ]));
Quoted 5 lines
AFAIU, your are mapping the GIC region with normal attribute. With this attribute, the processor may reorder the write in the device memory, preload memory, caching.... Which is completely wrong in this case. I'm sa bit surprised that it works correctly. You have to map thoses regions as device memory.
I believe that the ARM uses the most restrictive memory type from the two stages of the translation table, so if Xen maps it as device memory then it will work. We can set it here as well, though.
(see "Overlaying the memory type attribute" in the Architecture Reference Manual)
Quoted 14 lines
[..]
Quoted 6 lines
extras/mini-os/arch/arm/hypercalls32.S new file +0
-0[..]
Quoted 16 lines
extras/mini-os/arch/arm/hypercalls32.S line 44
Quoted 12 lines
extras/mini-os/arch/arm/hypercalls32.S new file +12
-0+#define __HYPERVISOR_memory_op 12 +#define __HYPERVISOR_xen_version 17 +#define __HYPERVISOR_console_io 18 +#define __HYPERVISOR_grant_table_op 20 +#define __HYPERVISOR_vcpu_op 24 +#define __HYPERVISOR_xsm_op 27 +#define __HYPERVISOR_sched_op 29 +#define __HYPERVISOR_event_channel_op 32 +#define __HYPERVISOR_physdev_op 33 +#define __HYPERVISOR_hvm_op 34 +#define __HYPERVISOR_sysctl 35 +#define __HYPERVISOR_domctl 36Hmmm... why do you hardcode those numbers here? Can't you include the correct header?
Good idea.
Quoted 19 lines
[..]
extras/mini-os/arch/arm/minios-arm32.lds line 5
Quoted 12 lines
extras/mini-os/arch/arm/minios-arm32.lds new file +5
-0@@ -0,0 +1,75 @@ +OUTPUT_ARCH(arm) +ENTRY(_start) +SECTIONS +{ + . = 0x408000;I would use the preprocessor to avoid hardcoding address here. It will help later if someone wants to change the virtual address of the kernel.
OK.
Quoted 15 lines
[..]
Quoted 1 line
extras/mini-os/arch/arm/mm.c +0
-0[..]
Quoted 1 line
+void
arch_init_mm(unsigned long *start_pfn_p, unsigned long *max_pfn_p)[..]
Quoted 8 lines
extras/mini-os/arch/arm/mm.c line 39
Quoted 5 lines
extras/mini-os/arch/arm/mm.c +5
-0+ +/* Xen will always provide us at least one bank of memory. +* Mini-OS will use the first bank for the time-being. */ + regs =fdt_getprop (device_tree, memory,"reg" , &prop_len); +if (regs ==NULL || prop_len !=16 ) {Same remark as in
gic_init. Please explain where does come from the 16.
OK.
Quoted 13 lines
[..]
extras/mini-os/arch/arm/mm.c line 47
Quoted 8 lines
extras/mini-os/arch/arm/mm.c +8
-0+/* TODO: support other formats */ +printk ("Bad 'reg' property: %p %d\n" , regs, prop_len); +BUG (); + } + +unsigned int end = (unsigned int ) &_end; +unsigned int mem_base =fdt64_to_cpu (regs[0 ]); +unsigned int mem_size =fdt64_to_cpu (regs[1 ]);
Quoted 5 lines
In general if you have to cast/create a variable to contain a physical address. Please make create a type
paddr_tand use it.When someone will implement arm64 support it will have less trouble because we cast correctly cast the value.
Good idea.
Quoted 13 lines
IIRC, there is few other place where it's the same problem.
Quoted 10 lines
extras/mini-os/arch/arm/mm.c +9
-0+/* Get Xen's suggested physical page assignments for the grant table. */ +static unsigned long get_gnttab_base (void ) +{ +int hypervisor; +int len =0 ; +const uint64_t *regs; +unsigned int gnttab_base; + + hypervisor = fdt_node_offset_by_compatible(device_tree, -1,"xen,xen");
Quoted 8 lines
extras/mini-os/arch/arm/mm.c line 90
Quoted 5 lines
extras/mini-os/arch/arm/mm.c +5
-0+BUG_ON (hypervisor <0 ); + + regs =fdt_getprop (device_tree, hypervisor,"reg" , &len); +if (regs ==NULL || len !=16 ) { +/* TODO: support other formats */ Please explain why the 16.
OK.
Quoted 9 lines
extras/mini-os/arch/arm/mm.c line 95
Quoted 5 lines
extras/mini-os/arch/arm/mm.c +5
-0+printk ("Bad 'reg' property: %p %d\n" , regs, len); +BUG (); + } + + gnttab_base =fdt64_to_cpu (regs[0 ]);This look odd... you are using unsigned int for the variable but the function is return unsigned long.
OK.
Quoted 8 lines
Quoted 4 lines
extras/mini-os/arch/arm/mm.c +4
-0+printk ("FDT suggests grant table base %lx\n" , gnttab_base); + +return gnttab_base; +}[..]
Quoted 4 lines
Regards,
--
Julien Grall
Thanks,
Signature · 8 lines
Dr Thomas Leonard http://0install.net/ GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Hi Thomas,
Quoted 57 lines · Thomas Leonard
Quoted 53 lines · Julien Grall
Quoted 40 lines · Thomas Leonard
On ARM, Mini-OS will boot and display some output on the console. Tested with:
make XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- \ CONFIG_TEST=y CONFIG_START_NETWORK=n CONFIG_BLKFRONT=n \ CONFIG_NETFRONT=n CONFIG_FBFRONT=n CONFIG_KBDFRONT=n \ CONFIG_CONSFRONT=n CONFIG_XC=n -j4Signed-off-by Karim Allah Ahmed <[email protected]>[[email protected]: made x86_64 support work again][[email protected]: split into multiple patches][[email protected]: re-enabled force_evtchn_callback][[email protected]: enable regular console][[email protected]: fixed initialisation code:
- Configure write-back caching in page table. This is needed for reliable hypercalls to Xen (thanks to Julien Grall).
- Use "client mode" for access control (domains are deprecated, according to ARM Cortex-A Series Programmer’s Guide version 4.0, section 9.6.4).
- Enable more SCTLR features (icache, branch prediction)] [[email protected]: use Virtual Count register for monotonic time] [[email protected]: fixedHYPERVISOR_shutdown] [[email protected]: get xenstore details from hypervisor] [[email protected]: use GCC implementation of division] [[email protected]: cleaned up interrupt handlers and threading] [[email protected]: callexit_threadwhen a thread returns] [[email protected]: implementedblock_domainfor ARM] [[email protected]: fixed hang when enabling interrupts] [[email protected]: added -march=armv7-a to flags] [[email protected]: CLREX after handling IRQs] [[email protected]: unbind debug port at shutdown] [[email protected]: allow unaligned accesses] [[email protected]: fix zImage header for XSA-95] [[email protected]: get RAM base and size from the FDT] [[email protected]: get GIC addresses from FDT] [[email protected]: added ARM grant table initialisation] [[email protected]: added missing copyright header tohypercalls32.S] [[email protected]: moved GIC driver to arm directory] [[email protected]: fixes suggested by Julien Grall:Quoted 8 lines
- Removed unnecessary isb.
- RenamedGICD_PRIORITYtoGICD_IPRIORITYR.
- Change IRQ number type from unsigned char to int.
- Added volatile to {set,clear}_bit_non_atomic.
- Fixed some comments.
- Check compatible properties in DTB.] [[email protected]: made image relocatable] [[email protected]: addedmfn_to_pfnandpfn_to_mfn]Quoted 2 lines
IHMO all these changes doesn't belong to the commit message, i.e should not appear in the commit message when Ian will apply your commit message.
Quoted 8 lines
As I understand it, as I'm not the author of the patch, it's polite to indicate how I have modified it. I'm trying to follow the guidelines here:
"Rule (b) allows you to adjust the code, but then it is very impolite to change one submitter's code and make him endorse your bugs. To solve this problem, it is recommended that you add a line between the last Signed-off-by header and yours, indicating the nature of your changes."
I agree with it. But you modify so much things in this patch, that I think it's not necessary to specify all of them.
Anyway it was only a suggestion.
Quoted 60 lines
Quoted 53 lines
Quoted 53 lines
Signed-off-by Thomas Leonard <[email protected]>--- extras/mini-os/ARM-TODO.txt | 6 + extras/mini-os/Config.mk | 2 + extras/mini-os/Makefile | 9 ++ extras/mini-os/arch/arm/Makefile | 32 ++++ extras/mini-os/arch/arm/arch.mk | 7 + extras/mini-os/arch/arm/arm32.S | 266 +++++++++++++++++++++++++++++++ extras/mini-os/arch/arm/events.c | 30 ++++ extras/mini-os/arch/arm/gic.c | 222 ++++++++++++++++++++++++++ extras/mini-os/arch/arm/hypercalls32.S | 75 +++++++++ extras/mini-os/arch/arm/minios-arm32.lds | 75 +++++++++ extras/mini-os/arch/arm/mm.c | 134 ++++++++++++++++ extras/mini-os/arch/arm/sched.c | 37 +++++ extras/mini-os/arch/arm/setup.c | 116 ++++++++++++++ extras/mini-os/arch/arm/time.c | 202 +++++++++++++++++++++++ extras/mini-os/kernel.c | 2 +- 15 files changed, 1214 insertions(+), 1 deletion(-)create mode 100644
extras/mini-os/ARM-TODO.txtcreate mode 100755 extras/mini-os/arch/arm/Makefile create mode 100644extras/mini-os/arch/arm/arch.mkcreate mode 100644extras/mini-os/arch/arm/arm32.Screate mode 100644extras/mini-os/arch/arm/events.ccreate mode 100644extras/mini-os/arch/arm/gic.ccreate mode 100644extras/mini-os/arch/arm/hypercalls32.Screate mode 100755extras/mini-os/arch/arm/minios-arm32.ldscreate mode 100644extras/mini-os/arch/arm/mm.ccreate mode 100644extras/mini-os/arch/arm/sched.ccreate mode 100644extras/mini-os/arch/arm/setup.ccreate mode 100644extras/mini-os/arch/arm/time.cextras/mini-os/Config.mk +2
-0@@ -12,6 +12,8 @@ export XEN_INTERFACE_VERSION # If not x86 then use $(XEN_TARGET_ARCH) ifeq ($(findstring x86_,$(XEN_TARGET_ARCH)),x86_) TARGET_ARCH_FAM = x86 +else ifeq ($(findstring arm,$(XEN_TARGET_ARCH)),arm) +TARGET_ARCH_FAM = arm else TARGET_ARCH_FAM = $(XEN_TARGET_ARCH) endifextras/mini-os/Makefile +0
-0@@ -78,6 +78,9 @@ TARGET := mini-os SUBDIRS := lib xenbus consoleQuoted 6 lines
extras/mini-os/Makefile TARGET := mini-os · line 82
Quoted 3 lines
extras/mini-os/Makefile +2
-0ifeq ($(XEN_TARGET_ARCH),arm32) +# Need libgcc.a for division helpers +LDLIBS += `$(CC) -print-libgcc-file-name`OOI, how much code does add libgcc for the division helpers?
Quoted 2 lines
Hard to say. libgcc.a contains many files, but the ones with "div" in the name come to about 67K, so probably less than that.
Ok.
Quoted 22 lines
Quoted 11 lines
Quoted 11 lines
extras/mini-os/arch/arm/arm32.S new file +4
-0@@ -0,0 +1,266 @@ +@ Virtual address of the start of RAM (any value will do, but it must be +@ section-aligned). Update the lds script if changed. +#define VIRT_BASE 0x400000 +Quoted 8 lines
Quoted 4 lines
extras/mini-os/arch/arm/arm32.S new file +1
-0+@ Offset of the kernel within the RAM. This is a zImage convention whichwe
+@ rely on.
+#defineZIMAGE_KERNEL_OFFSET0x8000Hmmm... this is not a zImage convention... IIRC Linux is using this offset to have enough space to create startup page table during boot.
OK, so this is a convention of Linux only? I found this reference:
Quoted 7 lines
http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html
"Despite the ability to place zImage anywhere within memory, convention has it that it is loaded at the base of physical RAM plus an offset of
0x8000(32K). This leaves space for the parameter block usually placed at offset0x100, zero page exception vectors and page tables. This convention is *very* common."
I think this convention is for kernel which are able to load only in a specific address (i.e CONFIG_AUTO_ZRELADDR=n). Linux Xen guest need to have this option set to be able to boot. So Linux will calculate the relocation address itself:
#ifdef CONFIG_AUTO_ZRELADDR
@ determine final kernel image address
mov r4, pc
and r4, r4, #0xf8000000
add r4, r4, #TEXT_OFFSET
#else
ldr r4, =zreladdr
#endif
TEXT_OFFSET is equal to 0x8000 here.
This code lives in Linux since at least 2010 (last commit in git blame arch/arm/boot/compressed/head.S).
Futhermore, for DOM0 we are using a 2MB-aligned address. I think it's time to make the same thing for the guest (see the patch I sent earlier today: https://patches.linaro.org/32742/).
This will also help to add support more easily for Xen in new OS.
Quoted 19 lines
Quoted 7 lines
The Linux zImage is able to relocate itself in the memory to respect this convention. But the zImage itself can be loaded anywhere in the memory.
By looking to your code below your are relying that the kernel will be loaded at 0xXXXX8000 which is incorrect. This offset is odd and make other kernel (such as FreeBSD) requiring the same trick which is not part of the Linux boot protocol.
Sorry, I don't understand this. You're saying that Xen's choice of
0x8000forces FreeBSD to support this offset too? But that isn't caused by anything in Mini-OS.Quoted 6 lines
I plan to send a patch to require the start address to be 2MB aligned, so kernels will be able to use 2MB (for LPAE) and 1MB section for there early page table.
If the kernel wants another alignment, then you will have to relocate yourself. Even though in your case, you don't need this odd 0xXXXX8000.
Quoted 6 lines
It's very convenient to know at least the offset where we will be loaded. Otherwise, we have to move the image around in memory with loads and stores. I think there is some work going on to share images between VMs (for running large numbers of VMs on one machine). I don't know the details, but presumably it would be easier to support that if the image's text section can be mapped read-only.
I sent a patch to handle 2MB-align with is less odd than the 0x8000. IHMO, the latter offset has no sense as it's not part of the ABI.
Quoted 38 lines
Quoted 18 lines
[..]
extras/mini-os/arch/arm/arm32.S line 145
Quoted 13 lines
extras/mini-os/arch/arm/arm32.S new file +5
-0+ @ Fill in the whole top-level translation table (at page_dir). + @ Populate the whole pagedir with 1MB section descriptors. + + mov r1, r7 @ r1 -> first section entry + add r3, r1, #4*4*1024 @ limit (4 GB address space, 4byte entries)
+ orr r0, r8, r9 @ r0 = entry mapping section zero
to start of physical RAM
+1:extras/mini-os/arch/arm/arm32.S new file +4
-0+ str r0, [r1],#4 @ write the section entry + add r0, r0, #1 << 20 @ next physical page (wraps) + cmp r1, r3 + bne 1bQuoted 2 lines
I would document a bit more this part. It took me a bit of time to understand that you mapping the whole address space in an odd manner.
Could you suggest something? It's hard to know what other people will find confusing. For reference, here's the existing comment in the code where I tried to explain the scheme:
@ Problem: the C code wants to be at a known address (
VIRT_BASE),
but Xen might
@ load us anywhere. We initialise the MMU (mapping virtual to
physical @ addresses)
@ so everything ends up where the code expects it to be. @
@ We calculate the offet between where the linker thought_start
would be and where
@ it actually is and initialise the page tables to have that
offset for every page.
@
@ When we turn on the MMU, we're still executing at the old
address. We don't want
Quoted 8 lines
@ the code to disappear from under us. So we have to do the
mapping in stages:
@
@ 1. set up a mapping to our current page from both its current
and desired addresses
@ 2. enable the MMU
@ 3. jump to the new address
@ 4. remap all the other pages with the calculated offset
Actually, I like the existing comment. It tell the problems and explain how to solve it. Can you keep it?
Quoted 11 lines
Quoted 4 lines
While it's fine for a first version of Mini-OS support for ARM. It think at long term you want to map only necessary bank rank. It will be easier to catch programming error and avoid to trap in the hypervisor because the physical address doesn't exist.
Yes, this is just the boot code. Eventually, the C code should make the .text read-only (and unmap pages that don't exist, although I don't think there's currently any disadvantage to having the trap caused by the second stage page tables). I also want to add guard pages to the thread stacks once these initial patches are in.
Quoted 3 lines
Quoted 1 line
Futhermore, the data abort sent by the hypervisor is odd (debug smth).
Could you explain what you mean by "odd" here?
Xen is injecting a debug fault when it needs to send a data abort to the guest. It may be confusing for the developer that doesn't know Xen internal.
Anyway, I'm fine with the current solution.
Quoted 33 lines
Quoted 24 lines
Quoted 24 lines
+.pushsection .data
extras/mini-os/arch/arm/arm32.S new file +23
-0+_data: +.align 14 +.globl page_dir +@ Each word maps one 1MB virtual section to a physical section +page_dir: + .fill (4*1024), 4, 0x0 + +.align 12 +.globl shared_info_page +shared_info_page: + .fill (1024), 4, 0x0 + +.align 3 +.globl stack +stack: + .fill (4*1024), 4, 0x0 +stack_end: + +.align 3 +irqstack: + .fill (1024), 4, 0x0 +irqstack_end: +Quoted 8 lines
extras/mini-os/arch/arm/arm32.S line 202
Quoted 5 lines
+.globl
physical_address_offsetextras/mini-os/arch/arm/arm32.S new file +4
-0+physical_address_offset: + .long 0 + +.popsectionAny reason to define theses variables in ASM rather than C?
Quoted 6 lines
I normally prefer to define variables in the module that sets them, but it doesn't make much difference to me.
Though perhaps they should be moved to the .bss section (except for the page table, which could be moved to the start of RAM to simplify things).
It would help for ARM64 port as I don't think those variables is 32bit specific.
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
extras/mini-os/arch/arm/gic.c new file +5
-0@@ -0,0 +1,222 @@ +// ARM GIC implementation + +#include <mini-os/os.h> +#include <mini-os/hypervisor.h> +#include <libfdt.h> Quoted 8 lines
extras/mini-os/arch/arm/gic.c line 10
Quoted 5 lines
extras/mini-os/arch/arm/gic.c new file +5
-0+ +//#define VGIC_DEBUG +#ifdef VGIC_DEBUG +#define DEBUG(_f, _a...) \ + DEBUG("MINI_OS(file=vgic.c, line=%d) " _f , __LINE__, ## _a)Did you intend to use printk here?
Quoted 1 line
It does look odd. I'll take a look.
Thanks.
Quoted 26 lines
Quoted 17 lines
[..]
Quoted 14 lines
extras/mini-os/arch/arm/gic.c new file +11
-0+void gic_init (void ) { + gic.gicd_base =NULL ; +int node =0 ; +int depth =0 ; +for (;;) + { + node =fdt_next_node (device_tree, node, &depth); +if (node <=0 || depth <0 ) +break ; + +if (fdt_getprop (device_tree, node,"interrupt-controller" ,NULL )){
extras/mini-os/arch/arm/gic.c new file +2
-0+int len =0 ; +Quoted 8 lines
Quoted 4 lines
+ if (fdt_node_check_compatible(device_tree, node,
"arm,cortex-a15-gic") &&
+ fdt_node_check_compatible(device_tree, node,
"arm,cortex-a9-gic") &&I don't think this compatible is necessary. Cortex A9 doesn't support virtualisation.
Quoted 2 lines
OK. I was just matching on the values that Xen provides. a15-gic should be fine on its own, though.
IIRC, the toolstack doesn't provide arm,cortex-a9-gic :).
Quoted 12 lines
Quoted 12 lines
Quoted 10 lines
+ fdt_node_check_compatible(device_tree, node,
"arm,cortex-a7-gic")) {
+ printk("Skipping incompatible interrupt-controller
node\n");extras/mini-os/arch/arm/gic.c new file +4
-0+continue ; + } + + const uint64_t *reg = fdt_getprop(device_tree, node, "reg",&len);
+ if (reg == NULL || len != 32) {
Quoted 7 lines
Quoted 2 lines
As asked on the previous version, if you plan to assume specific range size for the time-being, please explain the 32.
OK, so we have two registers (GICC and GICD), each of which contains two parts (an address and a size), each of which is a 64-bit value (8 bytes). So 2 * 2 * 8 = 32. Should I check this as a minimum, or require it to match exactly?
Match exactly is better. It will catch easily any change in the device tree provided by the toolstack.
Can you add what you said as a comment?
Quoted 14 lines
Quoted 8 lines
extras/mini-os/arch/arm/gic.c line 200
Quoted 6 lines
extras/mini-os/arch/arm/gic.c new file +6
-0+/* TODO: support other formats */ +printk ("Bad 'reg' property: %p %d\n" , reg, len); +continue ; + } + gic.gicd_base =to_virt ((long )fdt64_to_cpu (reg[0 ])); + gic.gicc_base =to_virt ((long )fdt64_to_cpu (reg[2 ]));Quoted 5 lines
AFAIU, your are mapping the GIC region with normal attribute. With this attribute, the processor may reorder the write in the device memory, preload memory, caching.... Which is completely wrong in this case. I'm sa bit surprised that it works correctly. You have to map thoses regions as device memory.
Quoted 6 lines
I believe that the ARM uses the most restrictive memory type from the two stages of the translation table, so if Xen maps it as device memory then it will work. We can set it here as well, though.
(see "Overlaying the memory type attribute" in the Architecture Reference Manual)
I don't really want to see this such assumption in Mini-OS. Let say, we decide to change the memory type attribute in Xen 4.x to "Normal". Then we screw Mini-OS, and it would be very hard to debug.
Regards,
Signature · 1 line
Julien Grall
Quoted 22 lines · Julien Grall
Quoted 22 lines
Quoted 11 lines
Quoted 11 lines
extras/mini-os/arch/arm/arm32.S new file +4
-0@@ -0,0 +1,266 @@ +@ Virtual address of the start of RAM (any value will do, but it must be +@ section-aligned). Update the lds script if changed. +#define VIRT_BASE 0x400000 +Quoted 8 lines
Quoted 4 lines
extras/mini-os/arch/arm/arm32.S new file +1
-0+@ Offset of the kernel within the RAM. This is a zImage convention whichwe
+@ rely on.
+#defineZIMAGE_KERNEL_OFFSET0x8000Hmmm... this is not a zImage convention... IIRC Linux is using this offset to have enough space to create startup page table during boot.
OK, so this is a convention of Linux only? I found this reference:
Quoted 7 lines
Quoted 7 lines
http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html
"Despite the ability to place zImage anywhere within memory, convention has it that it is loaded at the base of physical RAM plus an offset of
0x8000(32K). This leaves space for the parameter block usually placed at offset0x100, zero page exception vectors and page tables. This convention is *very* common."
Documentation/arm/Booting is the more canonical reference here.
Quoted 14 lines
I think this convention is for kernel which are able to load only in a specific address (i.e
CONFIG_AUTO_ZRELADDR=n). Linux Xen guest need to have this option set to be able to boot. So Linux will calculate the relocation address itself:#ifdef
CONFIG_AUTO_ZRELADDR
@ determine final kernel image address
mov r4, pc
and r4, r4, #0xf8000000
add r4, r4, #TEXT_OFFSET
#else
ldr r4, =zreladdr
#endif
Quoted 7 lines
TEXT_OFFSETis equal to0x8000here.This code lives in Linux since at least 2010 (last commit in git blame
arch/arm/boot/compressed/head.S).Futhermore, for DOM0 we are using a 2MB-aligned address. I think it's time to make the same thing for the guest
Guest OSes are entitled to expect that we will load them in accordance with the Linux zImage protocol, nothing more or less. Likewise a guest which relies on something which is not guaranteed by that spec is buggy.
(By spec I mean the combination of Documentation/arm/Booting and the various comments in the Linux code, which are the closest we come to a formal spec here)
So it would be wrong for a guest kernel to indicate (via offset 0x24 in the header) that it is relocatable while at the same time assuming that it is loaded at either a 0x8000 offset or a 2MB aligned address. It's either PIC on entry or it isn't (in which case offset 0x24 should give an explicit load address).
(Xen itself probably violates this, by assuming 2MB alignment. We are in the wrong and I expect that eventually it will bite us in the ass on some platform/bootloader and then we'll have to fix it, not complain that it used to work with older platforms/bootloaders. The same is true of any guests which make similar assumptions IMHO -- i.e. it's their bug when it breaks because we changed Xen)
Quoted 16 lines
(see the patch I sent earlier
today: https://patches.linaro.org/32742/).This will also help to add support more easily for Xen in new OS.
Quoted 11 lines
Quoted 7 lines
The Linux zImage is able to relocate itself in the memory to respect this convention. But the zImage itself can be loaded anywhere in the memory.
By looking to your code below your are relying that the kernel will be loaded at 0xXXXX8000 which is incorrect. This offset is odd and make other kernel (such as FreeBSD) requiring the same trick which is not part of the Linux boot protocol.
Sorry, I don't understand this. You're saying that Xen's choice of
0x8000forces FreeBSD to support this offset too? But that isn't caused by anything in Mini-OS.
I don't know what Julien was saying, but as far as I'm concerned FreeBSD needs to either be PIC on entry or give a specific load address (or make buggy assumptions about Xen's current guest loader behaviour).
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines
+ fdt_node_check_compatible(device_tree, node,
"arm,cortex-a7-gic")) {
+ printk("Skipping incompatible interrupt-controller
node\n");extras/mini-os/arch/arm/arm32.S new file +4
-0+ continue; + } + + const uint64_t *reg = fdt_getprop(device_tree, node, "reg",&len);
+ if (reg == NULL || len != 32) {As asked on the previous version, if you plan to assume specific range size for the time-being, please explain the 32.
Quoted 7 lines
Quoted 4 lines
OK, so we have two registers (GICC and GICD), each of which contains two parts (an address and a size), each of which is a 64-bit value (8 bytes). So 2 * 2 * 8 = 32. Should I check this as a minimum, or require it to match exactly?
Match exactly is better. It will catch easily any change in the device tree provided by the toolstack.
It would be perfectly reasonable in the future for a DT binding to be enhanced such that a new compatiblity string was defined which had a superset of the registers of the existing string.
You should check for whatever minimum the compatibility string you actually know about says and ignore any additional registers.
(I don't know how likely this is for the GIC, but as a general principal it's what should be done)
Ian.
Quoted 6 lines · Thomas Leonard
Quoted 2 lines
IHMO all these changes doesn't belong to the commit message, i.e should not appear in the commit message when Ian will apply your commit message.
As I understand it, as I'm not the author of the patch, it's polite to indicate how I have modified it. I'm trying to follow the guidelines here:
I'm not suggesting you change what you've done here at this stage, but for next time:
It's a bit of a judgement call based on the scale of the changes. For the number of changes you have done I might have considered making myself the "Author" and saying in the commit log "Based on an initial patch by Karim, but heavily modified, bugs are all mine" or something along those lines etc.
Or if you felt your changes weren't sufficient to justify a change of the primary author then a single "Extensively/slightly* modified" (* delete as applicable) note would be OK.
The full intra-patch changelog could still usefully go after the "---" break to aid reviewers.
Ian.
Quoted 17 lines · Ian Campbell
Quoted 6 lines · Thomas Leonard
Quoted 2 lines
IHMO all these changes doesn't belong to the commit message, i.e should not appear in the commit message when Ian will apply your commit message.
As I understand it, as I'm not the author of the patch, it's polite to indicate how I have modified it. I'm trying to follow the guidelines here:
I'm not suggesting you change what you've done here at this stage, but for next time:
It's a bit of a judgement call based on the scale of the changes. For the number of changes you have done I might have considered making myself the "Author" and saying in the commit log "Based on an initial patch by Karim, but heavily modified, bugs are all mine" or something along those lines etc.
Quoted 6 lines
Or if you felt your changes weren't sufficient to justify a change of the primary author then a single "Extensively/slightly* modified" (* delete as applicable) note would be OK.
The full intra-patch changelog could still usefully go after the "---" break to aid reviewers.
I do agree with Ian.
Thomas, feel free to drop me as the author of the patch since you are heavily modifying the patch anyway. :)
Quoted 8 lines
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Signature · 1 line
Karim Allah Ahmed.
PATCH v5 20/20 mini-os: arm: show registers, stack and exception vector on fault
In reply to Thomas Leonard--- extras/mini-os/ARM-TODO.txt | 1 - extras/mini-os/arch/arm/arm32.S | 80 ++++++++++++++++++++++++++++++--- extras/mini-os/arch/arm/panic.c | 99 +++++++++++++++++++++++++++++++++++++++++ extras/mini-os/include/arm/os.h | 2 +- 4 files changed, 173 insertions(+), 9 deletions(-) create mode 100644 extras/mini-os/arch/arm/panic.c
extras/mini-os/ARM-TODO.txt +0 -1
@@ -1,4 +1,3 @@ -* support abort exception handling ( and others ) * gic request_irq implementation, currently all IRQs all hardcoded in gic irq handler. * bind_* * add multiple cpu support (?)
extras/mini-os/arch/arm/arm32.S +73 -7
105 lines not on this page · raw message
extras/mini-os/arch/arm/panic.c new file +99 -0
99 lines not on this page · raw message
extras/mini-os/include/arm/os.h +1 -1
@@ -13,7 +13,7 @@ void timer_handler(evtchn_port_t port, struct pt_regs *regs, void *ign);extern void *device_tree; -#define BUG () while(1){} +#define BUG () while(1){asm volatile (".word 0xe7f000f0\n");}/* Undefined instruction; will call our fault handler. */ #define smp_processor_id () 0
Signature · 7 lines
2.0.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 4 lines · Thomas Leonard
Karim Raslan (4):
mini-os: switched initial C entry point toarch_init
mini-os: addedarch_init_gnttab
Quoted 14 lines
Thomas Leonard (16):
mini-os: build fixes
mini-os: fixed shutdown thread
mini-os: fixed format string error inunbind_evtchn
mini-os: useunbind_evtchninunbind_all_ports
mini-os: madeoff_ttype signed
mini-os: whitespace
mini-os: don't requireXEN_HAVE_PV_UPCALL_MASK
mini-os: add missing casts to MM printk
mini-os: addedarch_unbind_ports
mini-os: moved__pteto x86
mini-os: moved unlikely/likely macros to newcompiler.h
mini-os: enabletest_xenbusagain
mini-os: useirqs_disabled()helper in schedule
I've applied all these. Skipping:
Quoted 1 line
mini-os: added
HYPERVISOR_xsm_op
(compile failure, YHM)
Quoted 1 line
mini-os: headers for ARM
This had a comment or two. So I stopped at that point.
Quoted 4 lines
mini-os: import libfdt
mini-os: initial ARM support
mini-os: arm: show registers, stack and exception vector on fault