xen: ARMv7 with virtualization extensions
v6 cover xen: ARMv7 with virtualization extensions
Hello everyone,
this is the sixth version of the patch series that introduces ARMv7 with virtualization extensions support in Xen.
The series allows Xen and Dom0 to boot on a Cortex-A15 based Versatile Express simulator.
See the following announce email for more informations about what we are trying to achieve, as well as the original git history:
See http://marc.info/?l=xen-devel&m=132257857628098&w=2
The first 7 patches affect generic Xen code and are not ARM specific; often they fix real issues, hidden in the default X86 configuration.
The following 20 patches introduce ARMv7 with virtualization extensions
support: makefiles first, then the asm-arm header files and finally everything else, ordered in a way that should make the patches easier to read.
Changes in v6:
- fix compilation after rebase;
- pull Linux'es ia64 clear_user.S;
- add David Vrabel's "support zImage kernels for dom0" two patches at the bottom of the series.
Changes in v5:
- fix compilation after rebase;
- route interrupt 34 (peripheral timer) to dom0;
- GICD_ICFGR ... GICD_ICFGRN return 1;
- expand tabs;
- keep the diff of arch/arm/lib with Linux's equivalents small;
- check the size of the arguments of elf_load_image;
Changes in v4:
- fix arm build after rebasing on xen-unstable87c607efbfece009360f615b2bf98959f4ea48e8;
- use ABS() in __ldivmod_helper;
- return a negative integer in case of errors in elf_load_image.
Changes in v3:
- introduce clear_guest for x86 and ia64 (I kept ia64 version of clear_user for symmetry but it is not actually used anywhere);
- rename the current ARM *_user functions to *_guest;
- use raw_clear_guest and raw_copy_to_guest in elf_load_image.
Changes in v2:
- introduce CONFIG_XENOPROF;
- make _srodata and _erodata const char[];
- do not include p2m.h ifdef __ia64__;
- remove wrong comment about pfn.h;
- introduce HAS_KEXEC and CONFIG_KEXEC;
- use long in __do_clear_user;
- remove the div64 patch, implement __aeabi_ldivmod and __aeabi_uldivmod instead;
- move "arm: makefiles" at the end of the series.
David Vrabel (2):
ARM: support zImage format kernels for dom0
ARM: copy DTB appended to zImage
Stefano Stabellini (25):
Move cpufreq option parsing to cpufreq.c
Include some header files that are not automatically included on all archs
A collection of fixes to Xen common files
xen: implement an signed 64 bit division helper function
Introduce clear_user and clear_guest
libelf-loader: introduce elf_load_image
xen/common/Makefile: introduce HAS_CPUFREQ, HAS_PCI, HAS_PASSTHROUGH, HAS_NS16550, HAS_KEXEC
arm: compile tmem
arm: header files
arm: bit manipulation, copy and division libraries
arm: entry.S and head.S
arm: domain
arm: domain_build
arm: driver for CoreLink GIC-400 Generic Interrupt Controller
arm: mmio handlers
arm: irq
arm: mm and p2m
arm: pl011 UART driver
arm: early setup code
arm: shutdown, smp and smpboot
arm: driver for the generic timer for ARMv7
arm: trap handlers
arm: vgic emulation
arm: vtimer
arm: makefiles
config/arm.mk | 18 + tools/libxc/xc_dom_elfloader.c | 8 +- tools/libxc/xc_hvm_build.c | 5 +- xen/arch/arm/Makefile | 77 ++++ xen/arch/arm/Rules.mk | 29 ++ xen/arch/arm/asm-offsets.c | 76 ++++ xen/arch/arm/domain.c | 269 ++++++++++++++ xen/arch/arm/domain_build.c | 173 +++++++++ xen/arch/arm/dummy.S | 72 ++++ xen/arch/arm/entry.S | 107 ++++++ xen/arch/arm/gic.c | 473 +++++++++++++++++++++++++ xen/arch/arm/gic.h | 154 ++++++++ xen/arch/arm/guestcopy.c | 81 +++++ xen/arch/arm/head.S | 298 ++++++++++++++++ xen/arch/arm/io.c | 51 +++ xen/arch/arm/io.h | 55 +++ xen/arch/arm/irq.c | 180 ++++++++++ xen/arch/arm/kernel.c | 192 ++++++++++ xen/arch/arm/kernel.h | 37 ++ xen/arch/arm/lib/Makefile | 5 + xen/arch/arm/lib/assembler.h | 49 +++ xen/arch/arm/lib/bitops.h | 87 +++++ xen/arch/arm/lib/changebit.S | 18 + xen/arch/arm/lib/clearbit.S | 19 + xen/arch/arm/lib/copy_template.S | 267 ++++++++++++++ xen/arch/arm/lib/div64.S | 211 +++++++++++ xen/arch/arm/lib/findbit.S | 198 +++++++++++ xen/arch/arm/lib/lib1funcs.S | 389 ++++++++++++++++++++ xen/arch/arm/lib/memcpy.S | 63 ++++ xen/arch/arm/lib/memmove.S | 200 +++++++++++ xen/arch/arm/lib/memset.S | 129 +++++++ xen/arch/arm/lib/memzero.S | 127 +++++++ xen/arch/arm/lib/setbit.S | 18 + xen/arch/arm/lib/testchangebit.S | 18 + xen/arch/arm/lib/testclearbit.S | 18 + xen/arch/arm/lib/testsetbit.S | 18 + xen/arch/arm/mm.c | 321 +++++++++++++++++ xen/arch/arm/p2m.c | 214 +++++++++++ xen/arch/arm/setup.c | 206 +++++++++++ xen/arch/arm/shutdown.c | 23 ++ xen/arch/arm/smp.c | 29 ++ xen/arch/arm/smpboot.c | 50 +++ xen/arch/arm/time.c | 181 ++++++++++ xen/arch/arm/traps.c | 609 ++++++++++++++++++++++++++++++++ xen/arch/arm/vgic.c | 605 +++++++++++++++++++++++++++++++ xen/arch/arm/vtimer.c | 148 ++++++++ xen/arch/arm/vtimer.h | 35 ++ xen/arch/arm/xen.lds.S | 141 ++++++++ xen/arch/ia64/Rules.mk | 5 + xen/arch/ia64/linux/Makefile | 1 + xen/arch/ia64/linux/README.origin | 1 + xen/arch/ia64/linux/clear_user.S | 209 +++++++++++ xen/arch/x86/Rules.mk | 5 + xen/arch/x86/domain_build.c | 7 +- xen/arch/x86/hvm/hvm.c | 107 ++++++ xen/arch/x86/usercopy.c | 36 ++ xen/common/Makefile | 2 +- xen/common/domain.c | 37 +-- xen/common/domctl.c | 1 + xen/common/grant_table.c | 1 + xen/common/irq.c | 1 + xen/common/keyhandler.c | 1 + xen/common/lib.c | 19 + xen/common/libelf/libelf-dominfo.c | 6 + xen/common/libelf/libelf-loader.c | 30 ++- xen/common/memory.c | 4 +- xen/common/sched_credit2.c | 6 - xen/common/shutdown.c | 4 + xen/common/spinlock.c | 1 + xen/common/tmem.c | 3 +- xen/common/tmem_xen.c | 4 +- xen/common/wait.c | 1 + xen/common/xencomm.c | 111 ++++++ xen/drivers/Makefile | 6 +- xen/drivers/char/Makefile | 3 +- xen/drivers/char/console.c | 5 + xen/drivers/char/pl011.c | 266 ++++++++++++++ xen/drivers/cpufreq/cpufreq.c | 31 ++ xen/include/asm-arm/asm_defns.h | 18 + xen/include/asm-arm/atomic.h | 236 ++++++++++++ xen/include/asm-arm/bitops.h | 213 +++++++++++ xen/include/asm-arm/bug.h | 15 + xen/include/asm-arm/byteorder.h | 16 + xen/include/asm-arm/cache.h | 20 + xen/include/asm-arm/config.h | 125 +++++++ xen/include/asm-arm/cpregs.h | 207 +++++++++++ xen/include/asm-arm/current.h | 60 ++++ xen/include/asm-arm/debugger.h | 15 + xen/include/asm-arm/delay.h | 15 + xen/include/asm-arm/desc.h | 12 + xen/include/asm-arm/div64.h | 235 ++++++++++++ xen/include/asm-arm/domain.h | 82 +++++ xen/include/asm-arm/elf.h | 33 ++ xen/include/asm-arm/event.h | 41 +++ xen/include/asm-arm/flushtlb.h | 31 ++ xen/include/asm-arm/grant_table.h | 35 ++ xen/include/asm-arm/guest_access.h | 131 +++++++ xen/include/asm-arm/hardirq.h | 28 ++ xen/include/asm-arm/hypercall.h | 14 + xen/include/asm-arm/init.h | 12 + xen/include/asm-arm/io.h | 12 + xen/include/asm-arm/iocap.h | 20 + xen/include/asm-arm/irq.h | 30 ++ xen/include/asm-arm/mm.h | 315 +++++++++++++++++ xen/include/asm-arm/multicall.h | 23 ++ xen/include/asm-arm/nmi.h | 15 + xen/include/asm-arm/numa.h | 21 ++ xen/include/asm-arm/p2m.h | 88 +++++ xen/include/asm-arm/page.h | 335 ++++++++++++++++++ xen/include/asm-arm/paging.h | 13 + xen/include/asm-arm/pci.h | 7 + xen/include/asm-arm/percpu.h | 28 ++ xen/include/asm-arm/processor.h | 269 ++++++++++++++ xen/include/asm-arm/regs.h | 43 +++ xen/include/asm-arm/setup.h | 20 + xen/include/asm-arm/smp.h | 25 ++ xen/include/asm-arm/softirq.h | 15 + xen/include/asm-arm/spinlock.h | 144 ++++++++ xen/include/asm-arm/string.h | 38 ++ xen/include/asm-arm/system.h | 202 +++++++++++ xen/include/asm-arm/time.h | 26 ++ xen/include/asm-arm/trace.h | 12 + xen/include/asm-arm/types.h | 57 +++ xen/include/asm-arm/xenoprof.h | 12 + xen/include/asm-ia64/config.h | 2 + xen/include/asm-ia64/uaccess.h | 12 + xen/include/asm-x86/config.h | 3 + xen/include/asm-x86/guest_access.h | 18 + xen/include/asm-x86/hvm/guest_access.h | 1 + xen/include/asm-x86/uaccess.h | 1 + xen/include/public/arch-arm.h | 125 +++++++ xen/include/public/xen.h | 2 + xen/include/xen/domain.h | 2 + xen/include/xen/grant_table.h | 1 + xen/include/xen/guest_access.h | 6 + xen/include/xen/irq.h | 13 + xen/include/xen/kernel.h | 12 +- xen/include/xen/libelf.h | 4 +- xen/include/xen/list.h | 1 + xen/include/xen/paging.h | 2 +- xen/include/xen/sched.h | 4 + xen/include/xen/serial.h | 2 + xen/include/xen/time.h | 1 + xen/include/xen/timer.h | 1 + xen/include/xen/tmem_xen.h | 1 + xen/include/xen/xencomm.h | 24 ++ 146 files changed, 11206 insertions(+), 61 deletions(-)
A git branch is available here, based on xen-unstable (git CS 63fa1cf01f1cfebe9b632b663127579b7aa9edc4):
git://xenbits.xen.org/people/sstabellini/xen-unstable.git arm-v6
Cheers,
Stefano
PATCH v6 1/27 Move cpufreq option parsing to cpufreq.c
--- xen/common/domain.c | 35 ++--------------------------------- xen/drivers/cpufreq/cpufreq.c | 31 +++++++++++++++++++++++++++++++ xen/include/xen/domain.h | 2 ++ 3 files changed, 35 insertions(+), 33 deletions(-)
xen/common/domain.c +2 -33
@@ -31,8 +31,8 @@#include <xen/grant_table.h> #include <xen/xenoprof.h> #include <xen/irq.h> -#include <acpi/cpufreq/cpufreq.h> #include <asm/debugger.h> +#include <asm/processor.h> #include <public/sched.h> #include <public/sysctl.h> #include <public/vcpu.h>
@@ -45,40 +45,9 @@unsigned int xen_processor_pmbits =XEN_PROCESSOR_PM_PX ;/* opt_dom0_vcpus_pin: If true, dom0 VCPUs are pinned. */ -static bool_t opt_dom0_vcpus_pin; +bool_t opt_dom0_vcpus_pin;boolean_param ("dom0_vcpus_pin" , opt_dom0_vcpus_pin); -/* set xen as default cpufreq */ -enum cpufreq_controller cpufreq_controller = FREQCTL_xen; - -static void __init setup_cpufreq_option (char *str) -{ -char *arg; - -if ( !strcmp (str,"dom0-kernel" ) ) - { - xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX ; - cpufreq_controller = FREQCTL_dom0_kernel; - opt_dom0_vcpus_pin =1 ; -return ; - } - -if ( !strcmp (str,"none" ) ) - { - xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX ; - cpufreq_controller = FREQCTL_none; -return ; - } - -if ( (arg =strpbrk (str,",:" )) !=NULL ) - *arg++ ='\0' ; - -if ( !strcmp (str,"xen" ) ) -if ( arg && *arg ) -cpufreq_cmdline_parse (arg); -} -custom_param ("cpufreq" , setup_cpufreq_option); -/* Protect updates/reads (resp.) of domain_list and domain_hash. */ DEFINE_SPINLOCK (domlist_update_lock);DEFINE_RCU_READ_LOCK (domlist_read_lock);
xen/drivers/cpufreq/cpufreq.c +31 -0
@@ -60,6 +60,37 @@ static LIST_HEAD_READ_MOSTLY(cpufreq_dom_list_head);struct cpufreq_governor *__read_mostly cpufreq_opt_governor;LIST_HEAD_READ_MOSTLY (cpufreq_governor_list); +/* set xen as default cpufreq */ +enum cpufreq_controller cpufreq_controller = FREQCTL_xen; + +static void __init setup_cpufreq_option (char *str) +{ +char *arg; + +if ( !strcmp (str,"dom0-kernel" ) ) + { + xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX ; + cpufreq_controller = FREQCTL_dom0_kernel; + opt_dom0_vcpus_pin =1 ; +return ; + } + +if ( !strcmp (str,"none" ) ) + { + xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX ; + cpufreq_controller = FREQCTL_none; +return ; + } + +if ( (arg =strpbrk (str,",:" )) !=NULL ) + *arg++ ='\0' ; + +if ( !strcmp (str,"xen" ) ) +if ( arg && *arg ) +cpufreq_cmdline_parse (arg); +} +custom_param ("cpufreq" , setup_cpufreq_option); +bool_t __read_mostly cpufreq_verbose;struct cpufreq_governor *__find_governor (const char *governor)
xen/include/xen/domain.h +2 -0
@@ -85,4 +85,6 @@ int continue_hypercall_on_cpu(extern unsigned int xen_processor_pmbits; +extern bool_t opt_dom0_vcpus_pin; +#endif /* __XEN_DOMAIN_H__ */
Signature · 1 line
1.7.2.5
PATCH v6 2/27 Include some header files that are not automatically included on all archs
In reply to Stefano StabelliniChanges in v2:
- include asm header files after xen header files;
- remove incorrect comment;
- do not include asm/p2m.h under ia64.
--- xen/common/domctl.c | 1 + xen/common/grant_table.c | 1 + xen/common/irq.c | 1 + xen/common/keyhandler.c | 1 + xen/common/memory.c | 4 ++-- xen/common/spinlock.c | 1 + xen/common/wait.c | 1 + xen/drivers/char/console.c | 1 + xen/include/xen/grant_table.h | 1 + xen/include/xen/list.h | 1 + xen/include/xen/sched.h | 4 ++++ xen/include/xen/timer.h | 1 + xen/include/xen/tmem_xen.h | 1 + 13 files changed, 17 insertions(+), 2 deletions(-)
xen/common/domctl.c +1 -0
@@ -24,6 +24,7 @@#include <xen/paging.h> #include <xen/hypercall.h> #include <asm/current.h> +#include <asm/page.h> #include <public/domctl.h> #include <xsm/xsm.h>
xen/common/grant_table.c +1 -0
@@ -38,6 +38,7 @@#include <xen/paging.h> #include <xen/keyhandler.h> #include <xsm/xsm.h> +#include <asm/flushtlb.h> #ifndef max_nr_grant_framesunsigned int max_nr_grant_frames =DEFAULT_MAX_NR_GRANT_FRAMES ;
xen/common/irq.c +1 -0
@@ -1,5 +1,6 @@#include <xen/config.h> #include <xen/irq.h> +#include <xen/errno.h> int init_one_irq_desc (struct irq_desc *desc) {
xen/common/keyhandler.c +1 -0
@@ -15,6 +15,7 @@#include <xen/compat.h> #include <xen/ctype.h> #include <xen/perfc.h> +#include <xen/init.h> #include <asm/debugger.h> #include <asm/div64.h>
xen/common/memory.c +2 -2
@@ -23,8 +23,8 @@#include <xen/tmem_xen.h> #include <asm/current.h> #include <asm/hardirq.h> -#ifdef CONFIG_X86 -# include <asm/p2m.h> +#ifndef __ia64__ +#include <asm/p2m.h> #endif #include <xen/numa.h> #include <public/memory.h>
xen/common/spinlock.c +1 -0
@@ -8,6 +8,7 @@#include <xen/preempt.h> #include <public/sysctl.h> #include <asm/processor.h> +#include <asm/atomic.h> #ifndef NDEBUG
xen/common/wait.c +1 -0
@@ -23,6 +23,7 @@#include <xen/config.h> #include <xen/sched.h> #include <xen/wait.h> +#include <xen/errno.h> struct waitqueue_vcpu {struct list_head list;
xen/drivers/char/console.c +1 -0
@@ -12,6 +12,7 @@#include <xen/version.h> #include <xen/lib.h> +#include <xen/init.h> #include <xen/event.h> #include <xen/console.h> #include <xen/serial.h>
xen/include/xen/grant_table.h +1 -0
@@ -25,6 +25,7 @@#define __XEN_GRANT_TABLE_H__#include <public/grant_table.h> +#include <asm/page.h> #include <asm/grant_table.h> /* Active grant entry - used for shadowing GTF_permit_access grants. */
xen/include/xen/list.h +1 -0
@@ -8,6 +8,7 @@#define __XEN_LIST_H__#include <xen/lib.h> +#include <xen/prefetch.h> #include <asm/system.h> /* These are non-NULL pointers that will result in page faults
xen/include/xen/sched.h +4 -0
@@ -13,6 +13,10 @@#include <xen/nodemask.h> #include <xen/radix-tree.h> #include <xen/multicall.h> +#include <xen/tasklet.h> +#include <xen/mm.h> +#include <xen/smp.h> +#include <asm/atomic.h> #include <xen/wait.h> #include <public/xen.h> #include <public/domctl.h>
xen/include/xen/timer.h +1 -0
@@ -12,6 +12,7 @@#include <xen/time.h> #include <xen/string.h> #include <xen/list.h> +#include <xen/percpu.h> struct timer {/* System time expiry value (nanoseconds since boot). */
xen/include/xen/tmem_xen.h +1 -0
@@ -10,6 +10,7 @@#define __XEN_TMEM_XEN_H__#include <xen/mm.h> /* heap alloc/free */ +#include <xen/pfn.h> #include <xen/xmalloc.h> /* xmalloc/xfree */ #include <xen/sched.h> /* struct domain */ #include <xen/guest_access.h> /* copy_from_guest */
Signature · 1 line
1.7.2.5
PATCH v6 3/27 A collection of fixes to Xen common files
In reply to Stefano Stabellini- call free_xenoprof_pages only ifdef CONFIG_XENOPROF;
- define PRI_stime as PRId64 in an header file;
- respect boundaries in is_kernel_*;
- implement is_kernel_rodata;
- guest_physmap_add_page should be ((void)0).
Changes in v4:
- fix guest_physmap_add_page;
Changes in v2:
- introduce CONFIG_XENOPROF;
- define _srodata and _erodata as const char*.
--- xen/common/domain.c | 2 ++ xen/common/sched_credit2.c | 6 ------ xen/include/asm-ia64/config.h | 1 + xen/include/asm-x86/config.h | 2 ++ xen/include/xen/kernel.h | 12 +++++++++--- xen/include/xen/paging.h | 2 +- xen/include/xen/time.h | 1 + 7 files changed, 16 insertions(+), 10 deletions(-)
xen/common/domain.c +2 -0
@@ -635,7 +635,9 @@ static void complete_domain_destroy(struct rcu_head *head)sched_destroy_domain (d);/* Free page used by xen oprofile buffer. */ +#ifdef CONFIG_XENOPROF free_xenoprof_pages (d); +#endif xfree (d->mem_event);
xen/common/sched_credit2.c +0 -6
@@ -26,12 +26,6 @@#include <xen/trace.h> #include <xen/cpu.h> -#if __i386__ -#define PRI_stime "lld" -#else -#define PRI_stime "ld" -#endif - #define d2printk(x...)//#define d2printk printk
xen/include/asm-ia64/config.h +1 -0
@@ -20,6 +20,7 @@#define CONFIG_EFI #define CONFIG_EFI_PCDP #define CONFIG_SERIAL_SGI_L1_CONSOLE +#define CONFIG_XENOPROF 1#define CONFIG_XEN_SMP
xen/include/asm-x86/config.h +2 -0
@@ -48,6 +48,8 @@#define CONFIG_HOTPLUG 1#define CONFIG_HOTPLUG_CPU 1 +#define CONFIG_XENOPROF 1 +#define HZ 100#define OPT_CONSOLE_STR "vga"
xen/include/xen/kernel.h +9 -3
@@ -66,19 +66,25 @@extern char _start[], _end[];#define is_kernel (p) ({ \ char *__p = (char *)(unsigned long)(p); \ - (__p >= _start) && (__p <= _end); \ + (__p >= _start) && (__p < _end); \ })extern char _stext[], _etext[];#define is_kernel_text (p) ({ \ char *__p = (char *)(unsigned long)(p); \ - (__p >= _stext) && (__p <= _etext); \ + (__p >= _stext) && (__p < _etext); \ +}) + +extern const char _srodata[], _erodata[]; +#define is_kernel_rodata (p) ({ \ + const char *__p = (const char *)(unsigned long)(p); \ + (__p >= _srodata) && (__p < _erodata); \ })extern char _sinittext[], _einittext[];#define is_kernel_inittext (p) ({ \ char *__p = (char *)(unsigned long)(p); \ - (__p >= _sinittext) && (__p <= _einittext); \ + (__p >= _sinittext) && (__p < _einittext); \ })#endif /* _LINUX_KERNEL_H */
xen/include/xen/paging.h +1 -1
@@ -18,7 +18,7 @@#define paging_mode_translate (d) (0)#define paging_mode_external (d) (0) -#define guest_physmap_add_page (d, p, m, o) (0) +#define guest_physmap_add_page (d, p, m, o) ((void)0)#define guest_physmap_remove_page (d, p, m, o) ((void)0)#endif
xen/include/xen/time.h +1 -0
@@ -30,6 +30,7 @@ struct vcpu;*/ typedef s64 s_time_t ; +#define PRI_stime PRId64s_time_t get_s_time (void );unsigned long get_localtime (struct domain *d);
Signature · 1 line
1.7.2.5
PATCH v6 4/27 xen: implement an signed 64 bit division helper function
In reply to Stefano StabelliniImplement a C function to perform 64 bit signed division and return both quotient and remainder.
Useful as an helper function to implement __aeabi_ldivmod.
Changes in v4:
- use ABS().
--- xen/common/lib.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
xen/common/lib.c +19 -0
@@ -399,6 +399,25 @@ s64 __moddi3(s64 a, s64 b) return (neg ? -urem : urem); } +/* +* Quotient and remainder of unsigned long long division +*/ +s64 __ldivmod_helper (s64 a,s64 b,s64 *r) +{ +u64 ua, ub, rem, quot; + + ua =ABS (a); + ub =ABS (b); + quot =__qdivrem (ua, ub, &rem); +if ( a <0 ) + *r = -rem; +else + *r = rem; +if ( (a <0 ) ^ (b <0 ) ) +return -quot; +else +return quot; +}#endif /* BITS_PER_LONG == 32 */ /* Compute with 96 bit intermediate result: (a*b)/c */
Signature · 1 line
1.7.2.5
PATCH v6 5/27 Introduce clear_user and clear_guest
In reply to Stefano StabelliniIntroduce clear_user for x86 and ia64, shamelessly taken from Linux. The x86 version is the 32 bit clear_user implementation. Introduce clear_guest for x86 and ia64. The x86 implementation is based on clear_user and a new clear_user_hvm function.
The ia64 implementation is actually in xencomm and it is based on xencomm_copy_to_guest.
Changes in v6:
- pull Linux'es ia64 clear_user.S.
Changes in v3:
- introduce clear_guest.
Changes in v2:
- change d0 to be a long;
- cast addr to long.
--- xen/arch/ia64/linux/Makefile | 1 + xen/arch/ia64/linux/README.origin | 1 + xen/arch/ia64/linux/clear_user.S | 209 ++++++++++++++++++++++++++++++++ xen/arch/x86/hvm/hvm.c | 107 ++++++++++++++++ xen/arch/x86/usercopy.c | 36 ++++++ xen/common/xencomm.c | 111 +++++++++++++++++ xen/include/asm-ia64/uaccess.h | 12 ++ xen/include/asm-x86/guest_access.h | 18 +++ xen/include/asm-x86/hvm/guest_access.h | 1 + xen/include/asm-x86/uaccess.h | 1 + xen/include/xen/guest_access.h | 6 + xen/include/xen/xencomm.h | 24 ++++ 12 files changed, 527 insertions(+), 0 deletions(-) create mode 100644 xen/arch/ia64/linux/clear_user.S
xen/arch/ia64/linux/Makefile +1 -0
@@ -4,6 +4,7 @@ subdir-y += sn obj-y += bitop.o obj-y += clear_page.o +obj-y += clear_user.o obj-y += copy_page_mck.o obj-y += efi_stub.o obj-y += extable.o
xen/arch/ia64/linux/README.origin +1 -0
@@ -15,6 +15,7 @@ pcdp.h -> linux/drivers/firmware/pcdp.h bitop.c -> linux/arch/ia64/lib/bitop.c clear_page.S -> linux/arch/ia64/lib/clear_page.S +clear_user.S -> linux/arch/ia64/lib/clear_user.S copy_page_mck.S -> linux/arch/ia64/lib/copy_page_mck.S flush.S -> linux/arch/ia64/lib/flush.S idiv32.S -> linux/arch/ia64/lib/idiv32.S
xen/arch/ia64/linux/clear_user.S new file +209 -0
209 lines not on this page · raw message
xen/arch/x86/hvm/hvm.c +107 -0
119 lines not on this page · raw message
xen/arch/x86/usercopy.c +36 -0
@@ -110,6 +110,42 @@ copy_to_user(void __user *to, const void *from, unsigned n)return n; } +#define __do_clear_user (addr,size) \ +do { \ + long __d0; \ + __asm__ __volatile__( \ + "0: rep; stosl\n" \ + " movl %2,%0\n" \ + "1: rep; stosb\n" \ + "2:\n" \ + ".section .fixup,\"ax\"\n" \ + "3: lea 0(%2,%0,4),%0\n" \ + " jmp 2b\n" \ + ".previous\n" \ + _ASM_EXTABLE(0b,3b) \ + _ASM_EXTABLE(1b,2b) \ + : "=&c"(size), "=&D" (__d0) \ + : "r"(size & 3), "0"(size / 4), "1"((long)addr), "a"(0)); \ +} while (0) + +/** +* clear_user: - Zero a block of memory in user space. +* @to: Destination address, in user space. +* @n: Number of bytes to zero. +* +* Zero a block of memory in user space. +* +* Returns number of bytes that could not be cleared. +* On success, this will be zero. +*/ +unsigned long +clear_user (void __user *to,unsigned n) +{ +if (access_ok (to, n) ) +__do_clear_user (to, n); +return n; +} +/** * copy_from_user: - Copy a block of data from user space. * @to: Destination address, in kernel space.
xen/common/xencomm.c +111 -0
117 lines not on this page · raw message
xen/include/asm-ia64/uaccess.h +12 -0
@@ -236,6 +236,18 @@ __copy_from_user (void *to, const void __user *from, unsigned long count) __cu_len; \ }) +extern unsigned long __do_clear_user (void __user * to,unsigned long count); + +#define clear_user (to, n) \ +({ \ + void __user *__cu_to = (to); \ + long __cu_len = (n); \ + \ + if (__access_ok(__cu_to)) \ + __cu_len = __do_clear_user(__cu_to, __cu_len); \ + __cu_len; \ +}) +#define copy_from_user (to, from, n) \ ({ \ void *__cu_to = (to); \
xen/include/asm-x86/guest_access.h +18 -0
@@ -21,6 +21,10 @@ (is_hvm_vcpu (current) ? \copy_from_user_hvm ((dst), (src), (len)) : \ copy_from_user((dst), (src), (len))) +#define raw_clear_guest (dst, len) \ + (is_hvm_vcpu(current) ? \ + clear_user_hvm((dst), (len)) : \ + clear_user((dst), (len)))#define __raw_copy_to_guest (dst, src, len) \ (is_hvm_vcpu(current) ? \ copy_to_user_hvm((dst), (src), (len)) : \
@@ -29,6 +33,10 @@ (is_hvm_vcpu (current) ? \copy_from_user_hvm ((dst), (src), (len)) : \ __copy_from_user((dst), (src), (len))) +#define __raw_clear_guest (dst, len) \ + (is_hvm_vcpu(current) ? \ + clear_user_hvm((dst), (len)) : \ + clear_user((dst), (len)))/* Is the guest handle a NULL reference? */ #define guest_handle_is_null (hnd) ((hnd).p == NULL)
@@ -69,6 +77,11 @@raw_copy_from_guest (_d, _s+(off),sizeof (*_d)*(nr));\ }) +#define clear_guest_offset (hnd, off, nr) ({ \ + void *_d = (hnd).p; \ + raw_clear_guest(_d+(off), nr); \ +}) +/* Copy sub-field of a structure to guest context via a guest handle. */ #define copy_field_to_guest (hnd, ptr, field) ({ \ const typeof(&(ptr)->field) _s = &(ptr)->field; \
@@ -110,6 +123,11 @@__raw_copy_from_guest (_d, _s+(off),sizeof (*_d)*(nr));\ }) +#define __clear_guest_offset (hnd, off, nr) ({ \ + void *_d = (hnd).p; \ + __raw_clear_guest(_d+(off), nr); \ +}) +#define __copy_field_to_guest (hnd, ptr, field) ({ \ const typeof(&(ptr)->field) _s = &(ptr)->field; \ void *_d = &(hnd).p->field; \
xen/include/asm-x86/hvm/guest_access.h +1 -0
@@ -2,6 +2,7 @@#define __ASM_X86_HVM_GUEST_ACCESS_H__unsigned long copy_to_user_hvm (void *to,const void *from,unsigned len); +unsigned long clear_user_hvm (void *to,unsigned int len);unsigned long copy_from_user_hvm (void *to,const void *from,unsigned len);#endif /* __ASM_X86_HVM_GUEST_ACCESS_H__ */
xen/include/asm-x86/uaccess.h +1 -0
@@ -16,6 +16,7 @@#endif unsigned long copy_to_user (void *to,const void *from,unsigned len); +unsigned long clear_user (void *to,unsigned len);unsigned long copy_from_user (void *to,const void *from,unsigned len);/* Handles exceptions in both to and from, but doesn't do access_ok */ unsigned long __copy_to_user_ll (void *to,const void *from,unsigned n);
xen/include/xen/guest_access.h +6 -0
@@ -15,10 +15,16 @@#define copy_from_guest (ptr, hnd, nr) \ copy_from_guest_offset(ptr, hnd, 0, nr) +#define clear_guest (hnd, nr) \ + clear_guest_offset(hnd, 0, nr) +#define __copy_to_guest (hnd, ptr, nr) \ __copy_to_guest_offset(hnd, 0, ptr, nr)#define __copy_from_guest (ptr, hnd, nr) \ __copy_from_guest_offset(ptr, hnd, 0, nr) +#define __clear_guest (hnd, nr) \ + __clear_guest_offset(hnd, 0, nr) +#endif /* __XEN_GUEST_ACCESS_H__ */
xen/include/xen/xencomm.h +24 -0
@@ -27,6 +27,8 @@ unsigned long xencomm_copy_to_guest( void *to, const void *from, unsigned int len, unsigned int skip);unsigned long xencomm_copy_from_guest (void *to,const void *from,unsigned int len,unsigned int skip); +unsigned long xencomm_clear_guest ( +void *to,unsigned int n,unsigned int skip);int xencomm_add_offset (void **handle,unsigned int bytes);int xencomm_handle_is_null (void *ptr);
@@ -41,6 +43,16 @@ static inline unsigned long xencomm_inline_addr(const void *handle)return (unsigned long )handle & ~XENCOMM_INLINE_FLAG ; } +#define raw_copy_to_guest (dst, src, len) \ + xencomm_copy_to_guest(dst, src, len, 0) +#define raw_copy_from_guest (dst, src, len) \ + xencomm_copy_from_guest(dst, src, nr, 0) +#define raw_clear_guest (dst, len) \ + xencomm_clear_guest(dst, len, 0) +#define __raw_copy_to_guest raw_copy_to_guest +#define __raw_copy_from_guest raw_copy_from_guest +#define __raw_clear_guest raw_clear_guest +/* Is the guest handle a NULL reference? */ #define guest_handle_is_null (hnd) \ ((hnd).p == NULL || xencomm_handle_is_null((hnd).p))
@@ -82,6 +94,13 @@ static inline unsigned long xencomm_inline_addr(const void *handle)#define copy_from_guest_offset (ptr, hnd, idx, nr) \ __copy_from_guest_offset(ptr, hnd, idx, nr) +/* +* Clear an array of objects in guest context via a guest handle. +* Optionally specify an offset into the guest array. +*/ +#define clear_guest_offset (hnd, idx, nr) \ + __clear_guest_offset(hnd, idx, nr) +/* Copy sub-field of a structure from guest context via a guest handle. */ #define copy_field_from_guest (ptr, hnd, field) \ __copy_field_from_guest(ptr, hnd, field)
@@ -115,6 +134,11 @@ static inline unsigned long xencomm_inline_addr(const void *handle)xencomm_copy_from_guest (_d, _s,sizeof (*_d), _off); \ }) +#define __clear_guest_offset (hnd, idx, nr) ({ \ + void *_d = (hnd).p; \ + xencomm_clear_guest(_d, nr, idx); \ +}) +#ifdef CONFIG_XENCOMM_MARK_DIRTY extern void xencomm_mark_dirty (unsigned long addr,unsigned int len);#else
Signature · 1 line
1.7.2.5
PATCH v6 6/27 libelf-loader: introduce elf_load_image
In reply to Stefano StabelliniImplement a new function, called elf_load_image, to perform the actually copy of the elf image and clearing the padding.
The function is implemented as memcpy and memset when the library is built as part of the tools, but it is implemented as raw_copy_to_guest and raw_clear_guest when built as part of Xen, so that it can be safely called with an HVM style dom0.
Changes in v5:
- check the size of the arguments of elf_load_image.
Changes in v4:
- return a negative integer in case of errors in elf_load_image; propagate errors to elf_load_binary and further up the call chain.
Changes in v3:
- switch to raw_copy_to_guest and raw_clear_guest.
Changes in v2:
- remove CONFIG_KERNEL_NO_RELOC.
--- tools/libxc/xc_dom_elfloader.c | 8 +++++++- tools/libxc/xc_hvm_build.c | 5 +++-- xen/arch/x86/domain_build.c | 7 ++++++- xen/common/libelf/libelf-loader.c | 30 +++++++++++++++++++++++++++--- xen/include/xen/libelf.h | 2 +- 5 files changed, 44 insertions(+), 8 deletions(-)
tools/libxc/xc_dom_elfloader.c +7 -1
@@ -310,9 +310,15 @@ static int xc_dom_parse_elf_kernel(struct xc_dom_image *dom)static int xc_dom_load_elf_kernel (struct xc_dom_image *dom) {struct elf_binary *elf = dom->private_loader; +int rc; elf->dest =xc_dom_seg_to_ptr (dom, &dom->kernel_seg); -elf_load_binary (elf); + rc =elf_load_binary (elf); +if ( rc <0 ) + { +DOMPRINTF ("%s: failed to load elf binary" , __FUNCTION__); +return rc; + }if ( dom->parms.bsd_symtab )xc_dom_load_elf_symtab (dom, elf,1 );return 0 ;
tools/libxc/xc_hvm_build.c +3 -2
@@ -109,8 +109,9 @@ static int loadelfimage( elf->dest += elf->pstart & (PAGE_SIZE -1 );/* Load the initial elf image. */ -elf_load_binary (elf); - rc =0 ; + rc =elf_load_binary (elf); +if ( rc <0 ) +PERROR ("Failed to load elf binary\n" );munmap (elf->dest, pages <<PAGE_SHIFT ); elf->dest =NULL ;
xen/arch/x86/domain_build.c +6 -1
@@ -903,7 +903,12 @@ int __init construct_dom0(/* Copy the OS image and free temporary buffer. */ elf.dest = (void *)vkern_start; -elf_load_binary (&elf); + rc =elf_load_binary (&elf); +if ( rc <0 ) + { +printk ("Failed to load the kernel binary\n" ); +return rc; + }bootstrap_map (NULL );if (UNSET_ADDR != parms.virt_hypercall )
xen/common/libelf/libelf-loader.c +27 -3
@@ -107,11 +107,34 @@ void elf_set_log(struct elf_binary *elf, elf_log_callback *log_callback, elf->log_caller_data = log_caller_data; elf->verbose = verbose; } + +static int elf_load_image (void *dst,const void *src,uint64_t filesz,uint64_t memsz) +{ +memcpy (dst, src, filesz); +memset (dst + filesz,0 , memsz - filesz); +return 0 ; +}#else +#include <asm/guest_access.h> +void elf_set_verbose (struct elf_binary *elf) { elf->verbose =1 ; } + +static int elf_load_image (void *dst,const void *src,uint64_t filesz,uint64_t memsz) +{ +int rc; +if ( filesz >ULONG_MAX || memsz >ULONG_MAX ) +return -1 ; + rc =raw_copy_to_guest (dst, src, filesz); +if ( rc !=0 ) +return -1 ; + rc =raw_clear_guest (dst + filesz, memsz - filesz); +if ( rc !=0 ) +return -1 ; +return 0 ; +}#endif /* Calculate the required additional kernel space for the elf image */
@@ -237,7 +260,7 @@ void elf_parse_binary(struct elf_binary *elf) __FUNCTION__, elf->pstart, elf->pend); } -void elf_load_binary (struct elf_binary *elf) +int elf_load_binary (struct elf_binary *elf) {const elf_phdr *phdr;uint64_t i, count, paddr, offset, filesz, memsz;
@@ -256,11 +279,12 @@ void elf_load_binary(struct elf_binary *elf) dest =elf_get_ptr (elf, paddr);elf_msg (elf,"%s: phdr %" PRIu64" at 0x%p -> 0x%p\n" , __func__, i, dest, dest + filesz); -memcpy (dest, elf->image + offset, filesz); -memset (dest + filesz,0 , memsz - filesz); +if (elf_load_image (dest, elf->image + offset, filesz, memsz) !=0 ) +return -1 ; }elf_load_bsdsyms (elf); +return 0 ; }void *elf_get_ptr (struct elf_binary *elf,unsigned long addr)
xen/include/xen/libelf.h +1 -1
@@ -198,7 +198,7 @@ void elf_set_log(struct elf_binary *elf, elf_log_callback*,#endif void elf_parse_binary (struct elf_binary *elf); -void elf_load_binary (struct elf_binary *elf); +int elf_load_binary (struct elf_binary *elf);void *elf_get_ptr (struct elf_binary *elf,unsigned long addr);uint64_t elf_lookup_addr (struct elf_binary *elf,const char *symbol);
Signature · 1 line
1.7.2.5
PATCH v6 7/27 xen/common/Makefile: introduce HAS_CPUFREQ, HAS_PCI, HAS_PASSTHROUGH, HAS_NS16550, HAS_KEXEC
In reply to Stefano Stabellini- make the compilation of ns16550.c depend upon HAS_NS16550;
- make the compilation of cpufreq depend upon HAS_CPUFREQ;
- make the compilation of pci depend upon HAS_PCI;
- make the compilation of passthrough depend upon HAS_PASSTHROUGH;
- make the compilation of kexec depend upon HAS_KEXEC.
Changes in v2:
- introduce HAS_KEXEC and CONFIG_KEXEC kexec.
--- xen/arch/ia64/Rules.mk | 5 +++++ xen/arch/x86/Rules.mk | 5 +++++ xen/common/Makefile | 2 +- xen/common/shutdown.c | 4 ++++ xen/drivers/Makefile | 6 +++--- xen/drivers/char/Makefile | 2 +- xen/drivers/char/console.c | 4 ++++ xen/include/asm-ia64/config.h | 1 + xen/include/asm-x86/config.h | 1 + 9 files changed, 25 insertions(+), 5 deletions(-)
xen/arch/ia64/Rules.mk +5 -0
@@ -4,6 +4,11 @@ ia64 := y HAS_ACPI := y HAS_VGA := y +HAS_CPUFREQ := y +HAS_PCI := y +HAS_PASSTHROUGH := y +HAS_NS16550 := y +HAS_KEXEC := y xenoprof := y no_warns ?= n vti_debug ?= n
xen/arch/x86/Rules.mk +5 -0
@@ -3,6 +3,11 @@ HAS_ACPI := y HAS_VGA := y +HAS_CPUFREQ := y +HAS_PCI := y +HAS_PASSTHROUGH := y +HAS_NS16550 := y +HAS_KEXEC := y xenoprof := y #
xen/common/Makefile +1 -1
@@ -8,7 +8,7 @@ obj-y += grant_table.o obj-y += irq.o obj-y += kernel.o obj-y += keyhandler.o -obj-y += kexec.o +obj-$(HAS_KEXEC) += kexec.o obj-y += lib.o obj-y += memory.o obj-y += multicall.o
xen/common/shutdown.c +4 -0
@@ -6,7 +6,9 @@#include <xen/delay.h> #include <xen/shutdown.h> #include <xen/console.h> +#ifdef CONFIG_KEXEC #include <xen/kexec.h> +#endif #include <asm/debugger.h> #include <public/sched.h>
@@ -58,7 +60,9 @@ void dom0_shutdown(u8 reason)case SHUTDOWN_watchdog: {printk ("Domain 0 shutdown: watchdog rebooting machine.\n" ); +#ifdef CONFIG_KEXEC kexec_crash (); +#endif machine_restart (0 );break ;/* not reached */ }
xen/drivers/Makefile +3 -3
@@ -1,6 +1,6 @@ subdir-y += char -subdir-y += cpufreq -subdir-y += pci -subdir-y += passthrough +subdir-$(HAS_CPUFREQ) += cpufreq +subdir-$(HAS_PCI) += pci +subdir-$(HAS_PASSTHROUGH) += passthrough subdir-$(HAS_ACPI) += acpi subdir-$(HAS_VGA) += video
xen/drivers/char/Makefile +1 -1
@@ -1,3 +1,3 @@ obj-y += console.o -obj-y += ns16550.o +obj-$(HAS_NS16550) += ns16550.o obj-y += serial.o
xen/drivers/char/console.c +4 -0
@@ -22,7 +22,9 @@#include <xen/guest_access.h> #include <xen/shutdown.h> #include <xen/vga.h> +#ifdef CONFIG_KEXEC #include <xen/kexec.h> +#endif #include <asm/debugger.h> #include <asm/div64.h> #include <xen/hypercall.h> /* for do_console_io */
@@ -961,7 +963,9 @@ void panic(const char *fmt, ...)debugger_trap_immediate (); +#ifdef CONFIG_KEXEC kexec_crash (); +#endif if ( opt_noreboot ) {
xen/include/asm-ia64/config.h +1 -0
@@ -20,6 +20,7 @@#define CONFIG_EFI #define CONFIG_EFI_PCDP #define CONFIG_SERIAL_SGI_L1_CONSOLE +#define CONFIG_KEXEC 1#define CONFIG_XENOPROF 1#define CONFIG_XEN_SMP
xen/include/asm-x86/config.h +1 -0
@@ -49,6 +49,7 @@#define CONFIG_HOTPLUG_CPU 1#define CONFIG_XENOPROF 1 +#define CONFIG_KEXEC 1#define HZ 100
Signature · 1 line
1.7.2.5
Re: [PATCH v6 07/27] xen/common/Makefile: introduce HAS_CPUFREQ, HAS_PCI, HAS_PASSTHROUGH, HAS_NS16550, HAS_KEXEC
Quoted 9 lines · Stefano Stabellini
- make the compilation of
ns16550.cdepend uponHAS_NS16550;- make the compilation of cpufreq depend upon
HAS_CPUFREQ;- make the compilation of pci depend upon
HAS_PCI;- make the compilation of passthrough depend upon
HAS_PASSTHROUGH;- make the compilation of kexec depend upon
HAS_KEXEC.
This appears to be the only non-ARM patch in this series which hasn't gone in.
Is there a problem with it or was it overlooked?
Quoted 162 lines
Changes in v2:
- introduce
HAS_KEXECandCONFIG_KEXECkexec.Signed-off-by Stefano Stabellini <[email protected]>Signed-off-by Ian Campbell <[email protected]>Signed-off-by Tim Deegan <[email protected]>--- xen/arch/ia64/Rules.mk | 5 +++++ xen/arch/x86/Rules.mk | 5 +++++ xen/common/Makefile | 2 +- xen/common/shutdown.c | 4 ++++ xen/drivers/Makefile | 6 +++--- xen/drivers/char/Makefile | 2 +- xen/drivers/char/console.c | 4 ++++ xen/include/asm-ia64/config.h | 1 + xen/include/asm-x86/config.h | 1 + 9 files changed, 25 insertions(+), 5 deletions(-)xen/arch/ia64/Rules.mk +5
-0@@ -4,6 +4,11 @@ ia64 := y HAS_ACPI := y HAS_VGA := y +HAS_CPUFREQ := y +HAS_PCI := y +HAS_PASSTHROUGH := y +HAS_NS16550 := y +HAS_KEXEC := y xenoprof := y no_warns ?= n vti_debug ?= nxen/arch/x86/Rules.mk +5
-0@@ -3,6 +3,11 @@ HAS_ACPI := y HAS_VGA := y +HAS_CPUFREQ := y +HAS_PCI := y +HAS_PASSTHROUGH := y +HAS_NS16550 := y +HAS_KEXEC := y xenoprof := y #xen/common/Makefile +1
-1@@ -8,7 +8,7 @@ obj-y += grant_table.o obj-y += irq.o obj-y += kernel.o obj-y += keyhandler.o -obj-y += kexec.o +obj-$(HAS_KEXEC) += kexec.o obj-y += lib.o obj-y += memory.o obj-y += multicall.oxen/common/shutdown.c +4
-0@@ -6,7 +6,9 @@#include <xen/delay.h> #include <xen/shutdown.h> #include <xen/console.h> +#ifdef CONFIG_KEXEC #include <xen/kexec.h> +#endif #include <asm/debugger.h> #include <public/sched.h> @@ -58,7 +60,9 @@ void dom0_shutdown(u8 reason)case SHUTDOWN_watchdog: {printk ("Domain 0 shutdown: watchdog rebooting machine.\n" ); +#ifdef CONFIG_KEXEC kexec_crash (); +#endif machine_restart (0 );break ;/* not reached */ }xen/drivers/Makefile +3
-3@@ -1,6 +1,6 @@ subdir-y += char -subdir-y += cpufreq -subdir-y += pci -subdir-y += passthrough +subdir-$(HAS_CPUFREQ) += cpufreq +subdir-$(HAS_PCI) += pci +subdir-$(HAS_PASSTHROUGH) += passthrough subdir-$(HAS_ACPI) += acpi subdir-$(HAS_VGA) += videoxen/drivers/char/Makefile +1
-1@@ -1,3 +1,3 @@ obj-y += console.o -obj-y += ns16550.o +obj-$(HAS_NS16550) += ns16550.o obj-y += serial.oxen/drivers/char/console.c +4
-0@@ -22,7 +22,9 @@#include <xen/guest_access.h> #include <xen/shutdown.h> #include <xen/vga.h> +#ifdef CONFIG_KEXEC #include <xen/kexec.h> +#endif #include <asm/debugger.h> #include <asm/div64.h> #include <xen/hypercall.h> /* for do_console_io */ @@ -961,7 +963,9 @@ void panic(const char *fmt, ...)debugger_trap_immediate (); +#ifdef CONFIG_KEXEC kexec_crash (); +#endif if ( opt_noreboot ) {xen/include/asm-ia64/config.h +1
-0@@ -20,6 +20,7 @@#define CONFIG_EFI #define CONFIG_EFI_PCDP #define CONFIG_SERIAL_SGI_L1_CONSOLE +#define CONFIG_KEXEC 1#define CONFIG_XENOPROF 1#define CONFIG_XEN_SMP xen/include/asm-x86/config.h +1
-0@@ -49,6 +49,7 @@#define CONFIG_HOTPLUG_CPU 1#define CONFIG_XENOPROF 1 +#define CONFIG_KEXEC 1#define HZ 100
Re: [PATCH v6 07/27] xen/common/Makefile: introduce HAS_CPUFREQ, HAS_PCI, HAS_PASSTHROUGH, HAS_NS16550, HAS_KEXEC
In reply to Stefano StabelliniQuoted 11 lines · Stefano Stabellini
- make the compilation of
ns16550.cdepend uponHAS_NS16550;- make the compilation of cpufreq depend upon
HAS_CPUFREQ;- make the compilation of pci depend upon
HAS_PCI;- make the compilation of passthrough depend upon
HAS_PASSTHROUGH;- make the compilation of kexec depend upon
HAS_KEXEC.
Quoted 8 lines
Changes in v2:
- introduce
HAS_KEXECandCONFIG_KEXECkexec.Signed-off-by Stefano Stabellini <[email protected]>Signed-off-by Ian Campbell <[email protected]>Signed-off-by Tim Deegan <[email protected]>
Quoted 152 lines
--- xen/arch/ia64/Rules.mk | 5 +++++ xen/arch/x86/Rules.mk | 5 +++++ xen/common/Makefile | 2 +- xen/common/shutdown.c | 4 ++++ xen/drivers/Makefile | 6 +++--- xen/drivers/char/Makefile | 2 +- xen/drivers/char/console.c | 4 ++++ xen/include/asm-ia64/config.h | 1 + xen/include/asm-x86/config.h | 1 + 9 files changed, 25 insertions(+), 5 deletions(-)xen/arch/ia64/Rules.mk +5
-0@@ -4,6 +4,11 @@ ia64 := y HAS_ACPI := y HAS_VGA := y +HAS_CPUFREQ := y +HAS_PCI := y +HAS_PASSTHROUGH := y +HAS_NS16550 := y +HAS_KEXEC := y xenoprof := y no_warns ?= n vti_debug ?= nxen/arch/x86/Rules.mk +5
-0@@ -3,6 +3,11 @@ HAS_ACPI := y HAS_VGA := y +HAS_CPUFREQ := y +HAS_PCI := y +HAS_PASSTHROUGH := y +HAS_NS16550 := y +HAS_KEXEC := y xenoprof := y #xen/common/Makefile +1
-1@@ -8,7 +8,7 @@ obj-y += grant_table.o obj-y += irq.o obj-y += kernel.o obj-y += keyhandler.o -obj-y += kexec.o +obj-$(HAS_KEXEC) += kexec.o obj-y += lib.o obj-y += memory.o obj-y += multicall.oxen/common/shutdown.c +4
-0@@ -6,7 +6,9 @@#include <xen/delay.h> #include <xen/shutdown.h> #include <xen/console.h> +#ifdef CONFIG_KEXEC #include <xen/kexec.h> +#endif #include <asm/debugger.h> #include <public/sched.h> @@ -58,7 +60,9 @@ void dom0_shutdown(u8 reason)case SHUTDOWN_watchdog: {printk ("Domain 0 shutdown: watchdog rebooting machine.\n" ); +#ifdef CONFIG_KEXEC kexec_crash (); +#endif machine_restart (0 );break ;/* not reached */ }xen/drivers/Makefile +3
-3@@ -1,6 +1,6 @@ subdir-y += char -subdir-y += cpufreq -subdir-y += pci -subdir-y += passthrough +subdir-$(HAS_CPUFREQ) += cpufreq +subdir-$(HAS_PCI) += pci +subdir-$(HAS_PASSTHROUGH) += passthrough subdir-$(HAS_ACPI) += acpi subdir-$(HAS_VGA) += videoxen/drivers/char/Makefile +1
-1@@ -1,3 +1,3 @@ obj-y += console.o -obj-y += ns16550.o +obj-$(HAS_NS16550) += ns16550.o obj-y += serial.oxen/drivers/char/console.c +4
-0@@ -22,7 +22,9 @@#include <xen/guest_access.h> #include <xen/shutdown.h> #include <xen/vga.h> +#ifdef CONFIG_KEXEC #include <xen/kexec.h> +#endif #include <asm/debugger.h> #include <asm/div64.h> #include <xen/hypercall.h> /* for do_console_io */ @@ -961,7 +963,9 @@ void panic(const char *fmt, ...)debugger_trap_immediate (); +#ifdef CONFIG_KEXEC kexec_crash (); +#endif if ( opt_noreboot ) {xen/include/asm-ia64/config.h +1
-0@@ -20,6 +20,7 @@#define CONFIG_EFI #define CONFIG_EFI_PCDP #define CONFIG_SERIAL_SGI_L1_CONSOLE +#define CONFIG_KEXEC 1#define CONFIG_XENOPROF 1#define CONFIG_XEN_SMP xen/include/asm-x86/config.h +1
-0@@ -49,6 +49,7 @@#define CONFIG_HOTPLUG_CPU 1#define CONFIG_XENOPROF 1 +#define CONFIG_KEXEC 1#define HZ 100
PATCH v6 8/27 arm: compile tmem
In reply to Stefano StabelliniInclude few missing header files; introduce defined(CONFIG_ARM) where required.
--- xen/common/tmem.c | 3 ++- xen/common/tmem_xen.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)
xen/common/tmem.c +2 -1
@@ -22,6 +22,7 @@#include <xen/rbtree.h> #include <xen/radix-tree.h> #include <xen/list.h> +#include <xen/init.h> #define EXPORT /* indicates code other modules are dependent upon */ #define FORWARD
@@ -49,7 +50,7 @@#define INVERT_SENTINEL (_x,_y) _x->sentinel = ~_y##_SENTINEL#define ASSERT_SENTINEL (_x,_y) \ ASSERT(_x->sentinel != ~_y##_SENTINEL);ASSERT(_x->sentinel == _y##_SENTINEL) -#ifdef __i386__ +#if defined(__i386__) || defined(CONFIG_ARM )#define POOL_SENTINEL 0x87658765#define OBJ_SENTINEL 0x12345678#define OBJNODE_SENTINEL 0xfedcba09
xen/common/tmem_xen.c +3 -1
@@ -12,6 +12,8 @@#include <xen/paging.h> #include <xen/domain_page.h> #include <xen/cpu.h> +#include <xen/init.h> +#include <asm/p2m.h> #define EXPORT /* indicates code other modules are dependent upon */
@@ -87,7 +89,7 @@ void tmh_copy_page(char *to, char*from)#endif } -#ifdef __ia64__ +#if defined(__ia64__) || defined (CONFIG_ARM )static inline void *cli_get_page (tmem_cli_mfn_t cmfn,unsigned long *pcli_mfn,pfp_t **pcli_pfp,bool_t cli_write) {
Signature · 1 line
1.7.2.5
PATCH v6 9/27 arm: header files
In reply to Stefano StabelliniA simple implementation of everything under asm-arm and arch-arm.h; some of these files are shamelessly taken from Linux.
Changes in v6:
- remove arch_do_vcpu_op ansd arch_do_sysctl from asm-arm/hypercall.h;
Changes in v4:
- bring atomic access routines in line with upstream changes;
- fix build for -wunused-values;
Changes in v2:
- remove div64.
--- xen/include/asm-arm/atomic.h | 236 ++++++++++++++++++++++++++++++++ xen/include/asm-arm/bitops.h | 213 +++++++++++++++++++++++++++++ xen/include/asm-arm/bug.h | 15 ++ xen/include/asm-arm/byteorder.h | 16 +++ xen/include/asm-arm/cache.h | 20 +++ xen/include/asm-arm/config.h | 122 +++++++++++++++++ xen/include/asm-arm/cpregs.h | 207 ++++++++++++++++++++++++++++ xen/include/asm-arm/current.h | 60 ++++++++ xen/include/asm-arm/debugger.h | 15 ++ xen/include/asm-arm/delay.h | 15 ++ xen/include/asm-arm/desc.h | 12 ++ xen/include/asm-arm/div64.h | 235 ++++++++++++++++++++++++++++++++ xen/include/asm-arm/elf.h | 33 +++++ xen/include/asm-arm/event.h | 41 ++++++ xen/include/asm-arm/flushtlb.h | 31 +++++ xen/include/asm-arm/grant_table.h | 35 +++++ xen/include/asm-arm/hardirq.h | 28 ++++ xen/include/asm-arm/hypercall.h | 14 ++ xen/include/asm-arm/init.h | 12 ++ xen/include/asm-arm/io.h | 12 ++ xen/include/asm-arm/iocap.h | 20 +++ xen/include/asm-arm/multicall.h | 23 +++ xen/include/asm-arm/nmi.h | 15 ++ xen/include/asm-arm/numa.h | 21 +++ xen/include/asm-arm/paging.h | 13 ++ xen/include/asm-arm/pci.h | 7 + xen/include/asm-arm/percpu.h | 28 ++++ xen/include/asm-arm/processor.h | 269 +++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/regs.h | 43 ++++++ xen/include/asm-arm/setup.h | 16 +++ xen/include/asm-arm/smp.h | 25 ++++ xen/include/asm-arm/softirq.h | 15 ++ xen/include/asm-arm/spinlock.h | 144 ++++++++++++++++++++ xen/include/asm-arm/string.h | 38 +++++ xen/include/asm-arm/system.h | 202 ++++++++++++++++++++++++++++ xen/include/asm-arm/trace.h | 12 ++ xen/include/asm-arm/types.h | 57 ++++++++ xen/include/asm-arm/xenoprof.h | 12 ++ xen/include/public/arch-arm.h | 125 +++++++++++++++++ xen/include/public/xen.h | 2 + 40 files changed, 2459 insertions(+), 0 deletions(-) create mode 100644 xen/include/asm-arm/atomic.h create mode 100644 xen/include/asm-arm/bitops.h create mode 100644 xen/include/asm-arm/bug.h create mode 100644 xen/include/asm-arm/byteorder.h create mode 100644 xen/include/asm-arm/cache.h create mode 100644 xen/include/asm-arm/config.h create mode 100644 xen/include/asm-arm/cpregs.h create mode 100644 xen/include/asm-arm/current.h create mode 100644 xen/include/asm-arm/debugger.h create mode 100644 xen/include/asm-arm/delay.h create mode 100644 xen/include/asm-arm/desc.h create mode 100644 xen/include/asm-arm/div64.h create mode 100644 xen/include/asm-arm/elf.h create mode 100644 xen/include/asm-arm/event.h create mode 100644 xen/include/asm-arm/flushtlb.h create mode 100644 xen/include/asm-arm/grant_table.h create mode 100644 xen/include/asm-arm/hardirq.h create mode 100644 xen/include/asm-arm/hypercall.h create mode 100644 xen/include/asm-arm/init.h create mode 100644 xen/include/asm-arm/io.h create mode 100644 xen/include/asm-arm/iocap.h create mode 100644 xen/include/asm-arm/multicall.h create mode 100644 xen/include/asm-arm/nmi.h create mode 100644 xen/include/asm-arm/numa.h create mode 100644 xen/include/asm-arm/paging.h create mode 100644 xen/include/asm-arm/pci.h create mode 100644 xen/include/asm-arm/percpu.h create mode 100644 xen/include/asm-arm/processor.h create mode 100644 xen/include/asm-arm/regs.h create mode 100644 xen/include/asm-arm/setup.h create mode 100644 xen/include/asm-arm/smp.h create mode 100644 xen/include/asm-arm/softirq.h create mode 100644 xen/include/asm-arm/spinlock.h create mode 100644 xen/include/asm-arm/string.h create mode 100644 xen/include/asm-arm/system.h create mode 100644 xen/include/asm-arm/trace.h create mode 100644 xen/include/asm-arm/types.h create mode 100644 xen/include/asm-arm/xenoprof.h create mode 100644 xen/include/public/arch-arm.h
xen/include/asm-arm/atomic.h new file +236 -0
@@ -0,0 +1,236 @@ +/* +* arch/arm/include/asm/atomic.h +* +* Copyright (C) 1996 Russell King. +* Copyright (C) 2002 Deep Blue Solutions Ltd. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef __ARCH_ARM_ATOMIC__ +#define __ARCH_ARM_ATOMIC__ + +#include <xen/config.h> +#include <asm/system.h> + +#define build_atomic_read (name, size, type, reg) \ +static inline type name(const volatile type *addr) \ +{ \ + type ret; \ + asm volatile("ldr" size " %0,%1" \ + : reg (ret) \ + : "m" (*(volatile type *)addr)); \ + return ret; \ +} + +#define build_atomic_write (name, size, type, reg) \ +static inline void name(volatile type *addr, type val) \ +{ \ + asm volatile("str" size " %1,%0" \ + : "=m" (*(volatile type *)addr) \ + : reg (val)); \ +} + +build_atomic_read(read_u8_atomic, "b", uint8_t, "=q") +build_atomic_read(read_u16_atomic, "h", uint16_t, "=r") +build_atomic_read (read_u32_atomic,"" , uint32_t,"=r" ) +//build_atomic_read(read_u64_atomic, "d", uint64_t, "=r") +build_atomic_read(read_int_atomic, "", int, "=r") + +build_atomic_write(write_u8_atomic, "b", uint8_t, "q") +build_atomic_write(write_u16_atomic, "h", uint16_t, "r") +build_atomic_write (write_u32_atomic,"" , uint32_t,"r" ) +//build_atomic_write(write_u64_atomic, "d", uint64_t, "r") +build_atomic_write(write_int_atomic, "", int, "r") + +void __bad_atomic_size (void ); + +#define read_atomic (p) ({ \ + typeof(*p) __x; \ + switch ( sizeof(*p) ) { \ + case 1: __x = (typeof(*p))read_u8_atomic((uint8_t *)p); break; \ + case 2: __x = (typeof(*p))read_u16_atomic((uint16_t *)p); break; \ + case 4: __x = (typeof(*p))read_u32_atomic((uint32_t *)p); break; \ + default: __x = 0; __bad_atomic_size(); break; \ + } \ + __x; \ +}) + +#define write_atomic (p, x) ({ \ + typeof(*p) __x = (x); \ + switch ( sizeof(*p) ) { \ + case 1: write_u8_atomic((uint8_t *)p, (uint8_t)__x); break; \ + case 2: write_u16_atomic((uint16_t *)p, (uint16_t)__x); break; \ + case 4: write_u32_atomic((uint32_t *)p, (uint32_t)__x); break; \ + default: __bad_atomic_size(); break; \ + } \ + __x; \ +}) + +/* +* NB. I've pushed the volatile qualifier into the operations. This allows +* fast accessors such as _atomic_read() and _atomic_set() which don't give +* the compiler a fit. +*/ +typedef struct {int counter; }atomic_t ; + +#define ATOMIC_INIT (i) { (i) } + +/* +* On ARM, ordinary assignment (str instruction) doesn't clear the local +* strex/ldrex monitor on some implementations. The reason we can use it for +* atomic_set() is the clrex or dummy strex done on every exception return. +*/ +#define _atomic_read (v) ((v).counter) +#define atomic_read (v) (*(volatile int *)&(v)->counter) + +#define _atomic_set (v,i) (((v).counter) = (i)) +#define atomic_set (v,i) (((v)->counter) = (i)) + +/* +* ARMv6 UP and SMP safe atomic ops. We use load exclusive and +* store exclusive to ensure that these are atomic. We may loop +* to ensure that the update happens. +*/ +static inline void atomic_add (int i,atomic_t *v) +{ +unsigned long tmp; +int result; + + __asm__ __volatile__("@ atomic_add\n" +"1: ldrex %0, [%3]\n" +" add %0, %0, %4\n" +" strex %1, %0, [%3]\n" +" teq %1, #0\n" +" bne 1b" + :"=&r" (result),"=&r" (tmp),"+Qo" (v->counter) + :"r" (&v->counter),"Ir" (i) + :"cc" ); +} + +static inline int atomic_add_return (int i,atomic_t *v) +{ +unsigned long tmp; +int result; + +smp_mb (); + + __asm__ __volatile__("@ atomic_add_return\n" +"1: ldrex %0, [%3]\n" +" add %0, %0, %4\n" +" strex %1, %0, [%3]\n" +" teq %1, #0\n" +" bne 1b" + :"=&r" (result),"=&r" (tmp),"+Qo" (v->counter) + :"r" (&v->counter),"Ir" (i) + :"cc" ); + +smp_mb (); + +return result; +} + +static inline void atomic_sub (int i,atomic_t *v) +{ +unsigned long tmp; +int result; + + __asm__ __volatile__("@ atomic_sub\n" +"1: ldrex %0, [%3]\n" +" sub %0, %0, %4\n" +" strex %1, %0, [%3]\n" +" teq %1, #0\n" +" bne 1b" + :"=&r" (result),"=&r" (tmp),"+Qo" (v->counter) + :"r" (&v->counter),"Ir" (i) + :"cc" ); +} + +static inline int atomic_sub_return (int i,atomic_t *v) +{ +unsigned long tmp; +int result; + +smp_mb (); + + __asm__ __volatile__("@ atomic_sub_return\n" +"1: ldrex %0, [%3]\n" +" sub %0, %0, %4\n" +" strex %1, %0, [%3]\n" +" teq %1, #0\n" +" bne 1b" + :"=&r" (result),"=&r" (tmp),"+Qo" (v->counter) + :"r" (&v->counter),"Ir" (i) + :"cc" ); + +smp_mb (); + +return result; +} + +static inline int atomic_cmpxchg (atomic_t *ptr,int old,int new) +{ +unsigned long oldval, res; + +smp_mb (); + +do { + __asm__ __volatile__("@ atomic_cmpxchg\n" +"ldrex %1, [%3]\n" +"mov %0, #0\n" +"teq %1, %4\n" +"strexeq %0, %5, [%3]\n" + :"=&r" (res),"=&r" (oldval),"+Qo" (ptr->counter) + :"r" (&ptr->counter),"Ir" (old),"r" (new) + :"cc" ); + }while (res); + +smp_mb (); + +return oldval; +} + +static inline void atomic_clear_mask (unsigned long mask,unsigned long *addr) +{ +unsigned long tmp, tmp2; + + __asm__ __volatile__("@ atomic_clear_mask\n" +"1: ldrex %0, [%3]\n" +" bic %0, %0, %4\n" +" strex %1, %0, [%3]\n" +" teq %1, #0\n" +" bne 1b" + :"=&r" (tmp),"=&r" (tmp2),"+Qo" (*addr) + :"r" (addr),"Ir" (mask) + :"cc" ); +} + +#define atomic_inc (v) atomic_add(1, v) +#define atomic_dec (v) atomic_sub(1, v) + +#define atomic_inc_and_test (v) (atomic_add_return(1, v) == 0) +#define atomic_dec_and_test (v) (atomic_sub_return(1, v) == 0) +#define atomic_inc_return (v) (atomic_add_return(1, v)) +#define atomic_dec_return (v) (atomic_sub_return(1, v)) +#define atomic_sub_and_test (i, v) (atomic_sub_return(i, v) == 0) + +#define atomic_add_negative (i,v) (atomic_add_return(i, v) < 0) + +static inline atomic_t atomic_compareandswap ( +atomic_t old,atomic_t new,atomic_t *v) +{ +atomic_t rc; + rc.counter =__cmpxchg (&v->counter, old.counter, new.counter,sizeof (int )); +return rc; +} + +#endif /* __ARCH_ARM_ATOMIC__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/bitops.h new file +213 -0
213 lines not on this page · raw message
xen/include/asm-arm/bug.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef __ARM_BUG_H__ +#define __ARM_BUG_H__ + +#define BUG () __bug(__FILE__, __LINE__) +#define WARN () __warn(__FILE__, __LINE__) + +#endif /* __X86_BUG_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/byteorder.h new file +16 -0
@@ -0,0 +1,16 @@ +#ifndef __ASM_ARM_BYTEORDER_H__ +#define __ASM_ARM_BYTEORDER_H__ + +#define __BYTEORDER_HAS_U64__ + +#include <xen/byteorder/little_endian.h> + +#endif /* __ASM_ARM_BYTEORDER_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/cache.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef __ARCH_ARM_CACHE_H +#define __ARCH_ARM_CACHE_H + +#include <xen/config.h> + +/* L1 cache line size */ +#define L1_CACHE_SHIFT (CONFIG_ARM_L1_CACHE_SHIFT) +#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) + +#define __read_mostly __attribute__((__section__(".data.read_mostly"))) + +#endif +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/config.h new file +122 -0
122 lines not on this page · raw message
xen/include/asm-arm/cpregs.h new file +207 -0
207 lines not on this page · raw message
xen/include/asm-arm/current.h new file +60 -0
60 lines not on this page · raw message
xen/include/asm-arm/debugger.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef __ARM_DEBUGGER_H__ +#define __ARM_DEBUGGER_H__ + +#define debugger_trap_fatal (v, r) ((void) 0) +#define debugger_trap_immediate () ((void) 0) + +#endif /* __ARM_DEBUGGER_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/delay.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef _ARM_DELAY_H +#define _ARM_DELAY_H + +extern void __udelay (unsigned long usecs); +#define udelay (n) __udelay(n) + +#endif /* defined(_ARM_DELAY_H) */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/desc.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef __ARCH_DESC_H +#define __ARCH_DESC_H + +#endif /* __ARCH_DESC_H */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/div64.h new file +235 -0
235 lines not on this page · raw message
xen/include/asm-arm/elf.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef __ARM_ELF_H__ +#define __ARM_ELF_H__ + +typedef struct { +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; +unsigned long sp; +unsigned long lr; +unsigned long pc; +}ELF_Gregset ; + +#endif /* __ARM_ELF_H__ */ + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* tab-width: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/event.h new file +41 -0
41 lines not on this page · raw message
xen/include/asm-arm/flushtlb.h new file +31 -0
@@ -0,0 +1,31 @@ +#ifndef __FLUSHTLB_H__ +#define __FLUSHTLB_H__ + +#include <xen/cpumask.h> + +/* +* Filter the given set of CPUs, removing those that definitely flushed their +* TLB since @page_timestamp. +*/ +/* XXX lazy implementation just doesn't clear anything.... */ +#define tlbflush_filter (mask, page_timestamp) \ +do { \ +} while ( 0 ) + +#define tlbflush_current_time () (0) + +/* Flush local TLBs */ +void flush_tlb_local (void ); + +/* Flush specified CPUs' TLBs */ +void flush_tlb_mask (const cpumask_t *mask); + +#endif /* __FLUSHTLB_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/grant_table.h new file +35 -0
@@ -0,0 +1,35 @@ +#ifndef __ASM_GRANT_TABLE_H__ +#define __ASM_GRANT_TABLE_H__ + +#include <xen/grant_table.h> + +#define INVALID_GFN (-1UL) +#define INITIAL_NR_GRANT_FRAMES 1 + +void gnttab_clear_flag (unsigned long nr,uint16_t *addr); +int create_grant_host_mapping (unsigned long gpaddr, +unsigned long mfn,unsigned int flags,unsigned int + cache_flags); +#define gnttab_host_mapping_get_page_type (op, d, rd) (0) +int replace_grant_host_mapping (unsigned long gpaddr,unsigned long mfn, +unsigned long new_gpaddr,unsigned int flags); +void gnttab_mark_dirty (struct domain *d,unsigned long l); +#define gnttab_create_status_page (d, t, i) do {} while (0) +#define gnttab_create_shared_page (d, t, i) do {} while (0) +#define gnttab_shared_gmfn (d, t, i) (0) +#define gnttab_status_gmfn (d, t, i) (0) +#define gnttab_release_host_mappings (domain) 1 +static inline int replace_grant_supported (void ) +{ +return 1 ; +} + +#endif /* __ASM_GRANT_TABLE_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/hardirq.h new file +28 -0
@@ -0,0 +1,28 @@ +#ifndef __ASM_HARDIRQ_H +#define __ASM_HARDIRQ_H + +#include <xen/config.h> +#include <xen/cache.h> +#include <xen/smp.h> + +typedef struct { +unsigned long __softirq_pending; +unsigned int __local_irq_count; +} __cacheline_aligned irq_cpustat_t; + +#include <xen/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ + +#define in_irq () (local_irq_count(smp_processor_id()) != 0) + +#define irq_enter () (local_irq_count(smp_processor_id())++) +#define irq_exit () (local_irq_count(smp_processor_id())--) + +#endif /* __ASM_HARDIRQ_H */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/hypercall.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef __ASM_ARM_HYPERCALL_H__ +#define __ASM_ARM_HYPERCALL_H__ + +#include <public/domctl.h> /* for arch_do_domctl */ + +#endif /* __ASM_ARM_HYPERCALL_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/init.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef _XEN_ASM_INIT_H +#define _XEN_ASM_INIT_H + +#endif /* _XEN_ASM_INIT_H */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/io.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef _ASM_IO_H +#define _ASM_IO_H + +#endif +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/iocap.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef __X86_IOCAP_H__ +#define __X86_IOCAP_H__ + +#define cache_flush_permitted (d) \ + (!rangeset_is_empty((d)->iomem_caps)) + +#define multipage_allocation_permitted (d, order) \ + (((order) <= 9) ||/* allow 2MB superpages */ \ + !rangeset_is_empty((d)->iomem_caps)) + +#endif + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/multicall.h new file +23 -0
@@ -0,0 +1,23 @@ +#ifndef __ASM_ARM_MULTICALL_H__ +#define __ASM_ARM_MULTICALL_H__ + +#define do_multicall_call (_call) \ + do { \ + __asm__ __volatile__ ( \ + ".word 0xe7f000f0@; do_multicall_call\n" \ + " mov r0,#0; @ do_multicall_call\n" \ + " str r0, [r0];\n" \ + : \ + : \ + : ); \ + } while ( 0 ) + +#endif /* __ASM_ARM_MULTICALL_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/nmi.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef ASM_NMI_H +#define ASM_NMI_H + +#define register_guest_nmi_callback (a) (-ENOSYS) +#define unregister_guest_nmi_callback () (-ENOSYS) + +#endif /* ASM_NMI_H */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/numa.h new file +21 -0
@@ -0,0 +1,21 @@ +#ifndef __ARCH_ARM_NUMA_H +#define __ARCH_ARM_NUMA_H + +/* Fake one node for now... */ +#define cpu_to_node (cpu) 0 +#define node_to_cpumask (node) (cpu_online_map) + +static inline __attribute__((pure))int phys_to_nid (paddr_t addr) +{ +return 0 ; +} + +#endif /* __ARCH_ARM_NUMA_H */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/paging.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef _XEN_PAGING_H +#define _XEN_PAGING_H + +#endif /* XEN_PAGING_H */ + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/pci.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef __X86_PCI_H__ +#define __X86_PCI_H__ + +struct arch_pci_dev { +}; + +#endif /* __X86_PCI_H__ */
xen/include/asm-arm/percpu.h new file +28 -0
@@ -0,0 +1,28 @@ +#ifndef __ARM_PERCPU_H__ +#define __ARM_PERCPU_H__ + +#ifndef __ASSEMBLY__ +extern char __per_cpu_start[], __per_cpu_data_end[]; +extern unsigned long __per_cpu_offset[NR_CPUS ]; +void percpu_init_areas (void ); +#endif + +/* Separate out the type, so (int[3], foo) works. */ +#define __DEFINE_PER_CPU (type, name, suffix) \ + __attribute__((__section__(".bss.percpu" #suffix))) \ + __typeof__(type) per_cpu_##name + +#define per_cpu (var, cpu) ((&per_cpu__##var)[cpu?0:0]) +#define __get_cpu_var (var) per_cpu__##var + +#define DECLARE_PER_CPU (type, name) extern __typeof__(type) per_cpu__##name + +#endif /* __ARM_PERCPU_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/processor.h new file +269 -0
269 lines not on this page · raw message
xen/include/asm-arm/regs.h new file +43 -0
43 lines not on this page · raw message
xen/include/asm-arm/setup.h new file +16 -0
@@ -0,0 +1,16 @@ +#ifndef __ARM_SETUP_H_ +#define __ARM_SETUP_H_ + +#include <public/version.h> + +void arch_get_xen_caps (xen_capabilities_info_t *info); + +#endif +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/smp.h new file +25 -0
@@ -0,0 +1,25 @@ +#ifndef __ASM_SMP_H +#define __ASM_SMP_H + +#ifndef __ASSEMBLY__ +#include <xen/config.h> +#include <xen/cpumask.h> +#include <asm/current.h> +#endif + +DECLARE_PER_CPU (cpumask_var_t, cpu_sibling_mask); +DECLARE_PER_CPU (cpumask_var_t, cpu_core_mask); + +#define cpu_is_offline (cpu) unlikely(!cpu_online(cpu)) + +#define raw_smp_processor_id () (get_processor_id()) + +#endif +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/softirq.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef __ASM_SOFTIRQ_H__ +#define __ASM_SOFTIRQ_H__ + +#define VGIC_SOFTIRQ (NR_COMMON_SOFTIRQS + 0) +#define NR_ARCH_SOFTIRQS 1 + +#endif /* __ASM_SOFTIRQ_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/spinlock.h new file +144 -0
144 lines not on this page · raw message
xen/include/asm-arm/string.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef __ARM_STRING_H__ +#define __ARM_STRING_H__ + +#include <xen/config.h> + +#define __HAVE_ARCH_MEMCPY +extern void *memcpy (void *,const void *,__kernel_size_t ); + +/* Some versions of gcc don't have this builtin. It's non-critical anyway. */ +#define __HAVE_ARCH_MEMMOVE +extern void *memmove (void *dest,const void *src,size_t n); + +#define __HAVE_ARCH_MEMSET +extern void *memset (void *,int ,__kernel_size_t ); + +extern void __memzero (void *ptr,__kernel_size_t n); + +#define memset (p,v,n) \ + ({ \ + void *__p = (p); size_t __n = n; \ + if ((__n) != 0) { \ + if (__builtin_constant_p((v)) && (v) == 0) \ + __memzero((__p),(__n)); \ + else \ + memset((__p),(v),(__n)); \ + } \ + (__p); \ + }) + +#endif /* __ARM_STRING_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/system.h new file +202 -0
202 lines not on this page · raw message
xen/include/asm-arm/trace.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef __ASM_TRACE_H__ +#define __ASM_TRACE_H__ + +#endif /* __ASM_TRACE_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/types.h new file +57 -0
57 lines not on this page · raw message
xen/include/asm-arm/xenoprof.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef __ASM_XENOPROF_H__ +#define __ASM_XENOPROF_H__ + +#endif /* __ASM_XENOPROF_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/public/arch-arm.h new file +125 -0
125 lines not on this page · raw message
xen/include/public/xen.h +2 -0
@@ -33,6 +33,8 @@#include "arch-x86/xen.h" #elif defined(__ia64__)#include "arch-ia64.h" +#elif defined(__arm__) +#include "arch-arm.h" #else #error "Unsupported architecture"#endif
Signature · 1 line
1.7.2.5
PATCH v6 10/27 arm: bit manipulation, copy and division libraries
In reply to Stefano StabelliniBit manipulation, division and memcpy & friends implementations for the ARM architecture, shamelessly taken from Linux.
Changes in v5:
- keep the diff with Linux small for this library.
Changes in v2:
- implement __aeabi_uldivmod and __aeabi_ldivmod.
--- xen/arch/arm/lib/Makefile | 5 + xen/arch/arm/lib/assembler.h | 49 +++++ xen/arch/arm/lib/bitops.h | 87 +++++++++ xen/arch/arm/lib/changebit.S | 18 ++ xen/arch/arm/lib/clearbit.S | 19 ++ xen/arch/arm/lib/copy_template.S | 267 ++++++++++++++++++++++++++ xen/arch/arm/lib/div64.S | 211 +++++++++++++++++++++ xen/arch/arm/lib/findbit.S | 198 +++++++++++++++++++ xen/arch/arm/lib/lib1funcs.S | 389 ++++++++++++++++++++++++++++++++++++++ xen/arch/arm/lib/memcpy.S | 63 ++++++ xen/arch/arm/lib/memmove.S | 200 +++++++++++++++++++ xen/arch/arm/lib/memset.S | 129 +++++++++++++ xen/arch/arm/lib/memzero.S | 127 +++++++++++++ xen/arch/arm/lib/setbit.S | 18 ++ xen/arch/arm/lib/testchangebit.S | 18 ++ xen/arch/arm/lib/testclearbit.S | 18 ++ xen/arch/arm/lib/testsetbit.S | 18 ++ xen/include/asm-arm/config.h | 3 + 18 files changed, 1837 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/lib/Makefile create mode 100644 xen/arch/arm/lib/assembler.h create mode 100644 xen/arch/arm/lib/bitops.h create mode 100644 xen/arch/arm/lib/changebit.S create mode 100644 xen/arch/arm/lib/clearbit.S create mode 100644 xen/arch/arm/lib/copy_template.S create mode 100644 xen/arch/arm/lib/div64.S create mode 100644 xen/arch/arm/lib/findbit.S create mode 100644 xen/arch/arm/lib/lib1funcs.S create mode 100644 xen/arch/arm/lib/memcpy.S create mode 100644 xen/arch/arm/lib/memmove.S create mode 100644 xen/arch/arm/lib/memset.S create mode 100644 xen/arch/arm/lib/memzero.S create mode 100644 xen/arch/arm/lib/setbit.S create mode 100644 xen/arch/arm/lib/testchangebit.S create mode 100644 xen/arch/arm/lib/testclearbit.S create mode 100644 xen/arch/arm/lib/testsetbit.S
xen/arch/arm/lib/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +obj-y += memcpy.o memmove.o memset.o memzero.o +obj-y += findbit.o setbit.o +obj-y += setbit.o clearbit.o changebit.o +obj-y += testsetbit.o testclearbit.o testchangebit.o +obj-y += lib1funcs.o div64.o
xen/arch/arm/lib/assembler.h new file +49 -0
49 lines not on this page · raw message
xen/arch/arm/lib/bitops.h new file +87 -0
87 lines not on this page · raw message
xen/arch/arm/lib/changebit.S new file +18 -0
@@ -0,0 +1,18 @@ +/* + * linux/arch/arm/lib/changebit.S + * + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <xen/config.h> + +#include "assembler.h" +#include "bitops.h" + .text + +ENTRY(_change_bit) + bitop eor +ENDPROC(_change_bit)
xen/arch/arm/lib/clearbit.S new file +19 -0
@@ -0,0 +1,19 @@ +/* + * linux/arch/arm/lib/clearbit.S + * + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <xen/config.h> + +#include "assembler.h" +#include "bitops.h" + .text + +ENTRY(_clear_bit) + bitop bic +ENDPROC(_clear_bit)
xen/arch/arm/lib/copy_template.S new file +267 -0
267 lines not on this page · raw message
xen/arch/arm/lib/div64.S new file +211 -0
211 lines not on this page · raw message
xen/arch/arm/lib/findbit.S new file +198 -0
198 lines not on this page · raw message
xen/arch/arm/lib/lib1funcs.S new file +389 -0
389 lines not on this page · raw message
xen/arch/arm/lib/memcpy.S new file +63 -0
63 lines not on this page · raw message
xen/arch/arm/lib/memmove.S new file +200 -0
200 lines not on this page · raw message
xen/arch/arm/lib/memset.S new file +129 -0
129 lines not on this page · raw message
xen/arch/arm/lib/memzero.S new file +127 -0
127 lines not on this page · raw message
xen/arch/arm/lib/setbit.S new file +18 -0
@@ -0,0 +1,18 @@ +/* + * linux/arch/arm/lib/setbit.S + * + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <xen/config.h> + +#include "assembler.h" +#include "bitops.h" + .text + +ENTRY(_set_bit) + bitop orr +ENDPROC(_set_bit)
xen/arch/arm/lib/testchangebit.S new file +18 -0
@@ -0,0 +1,18 @@ +/* + * linux/arch/arm/lib/testchangebit.S + * + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <xen/config.h> + +#include "assembler.h" +#include "bitops.h" + .text + +ENTRY(_test_and_change_bit) + testop eor, str +ENDPROC(_test_and_change_bit)
xen/arch/arm/lib/testclearbit.S new file +18 -0
@@ -0,0 +1,18 @@ +/* + * linux/arch/arm/lib/testclearbit.S + * + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <xen/config.h> + +#include "assembler.h" +#include "bitops.h" + .text + +ENTRY(_test_and_clear_bit) + testop bicne, strne +ENDPROC(_test_and_clear_bit)
xen/arch/arm/lib/testsetbit.S new file +18 -0
@@ -0,0 +1,18 @@ +/* + * linux/arch/arm/lib/testsetbit.S + * + * Copyright (C) 1995-1996 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <xen/config.h> + +#include "assembler.h" +#include "bitops.h" + .text + +ENTRY(_test_and_set_bit) + testop orreq, streq +ENDPROC(_test_and_set_bit)
xen/include/asm-arm/config.h +3 -0
@@ -30,6 +30,9 @@#define asmlinkage/* Nothing needed */ +#define __LINUX_ARM_ARCH__ 7 +#define CONFIG_AEABI +/* Linkage for ARM */ #define __ALIGN .align 2#define __ALIGN_STR ".align 2"
Signature · 1 line
1.7.2.5
PATCH v6 11/27 arm: entry.S and head.S
In reply to Stefano StabelliniLow level assembly routines, including entry.S and head.S. Also the linker script and a collection of dummy functions that we plan to reduce to zero as soon as possible.
--- xen/arch/arm/asm-offsets.c | 76 ++++++++++ xen/arch/arm/dummy.S | 72 ++++++++++ xen/arch/arm/entry.S | 107 ++++++++++++++ xen/arch/arm/head.S | 298 +++++++++++++++++++++++++++++++++++++++ xen/arch/arm/xen.lds.S | 141 ++++++++++++++++++ xen/include/asm-arm/asm_defns.h | 18 +++ 6 files changed, 712 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/asm-offsets.c create mode 100644 xen/arch/arm/dummy.S create mode 100644 xen/arch/arm/entry.S create mode 100644 xen/arch/arm/head.S create mode 100644 xen/arch/arm/xen.lds.S create mode 100644 xen/include/asm-arm/asm_defns.h
xen/arch/arm/asm-offsets.c new file +76 -0
@@ -0,0 +1,76 @@ +/* +* Generate definitions needed by assembly language modules. +* This code generates raw asm output which is post-processed +* to extract and format the required data. +*/ +#define COMPILE_OFFSETS + +#include <xen/config.h> +#include <xen/types.h> +#include <public/xen.h> +#include <asm/current.h> + +#define DEFINE (_sym, _val) \ + __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) ) +#define BLANK () \ + __asm__ __volatile__ ( "\n->" : : ) +#define OFFSET (_sym, _str, _mem) \ + DEFINE(_sym, offsetof(_str, _mem)); + +/* base-2 logarithm */ +#define __L2 (_x) (((_x) & 0x00000002) ? 1 : 0) +#define __L4 (_x) (((_x) & 0x0000000c) ? ( 2 + __L2( (_x)>> 2)) : __L2( _x)) +#define __L8 (_x) (((_x) & 0x000000f0) ? ( 4 + __L4( (_x)>> 4)) : __L4( _x)) +#define __L16 (_x) (((_x) & 0x0000ff00) ? ( 8 + __L8( (_x)>> 8)) : __L8( _x)) +#define LOG_2 (_x) (((_x) & 0xffff0000) ? (16 + __L16((_x)>>16)) : __L16(_x)) + +void __dummy__ (void ) +{ + OFFSET(UREGS_sp, struct cpu_user_regs, sp); + OFFSET(UREGS_lr, struct cpu_user_regs, lr); + OFFSET(UREGS_pc, struct cpu_user_regs, pc); + OFFSET(UREGS_cpsr, struct cpu_user_regs, cpsr); + + OFFSET(UREGS_LR_usr, struct cpu_user_regs, lr_usr); + OFFSET(UREGS_SP_usr, struct cpu_user_regs, sp_usr); + + OFFSET(UREGS_SP_svc, struct cpu_user_regs, sp_svc); + OFFSET(UREGS_LR_svc, struct cpu_user_regs, lr_svc); + OFFSET(UREGS_SPSR_svc, struct cpu_user_regs, spsr_svc); + + OFFSET(UREGS_SP_abt, struct cpu_user_regs, sp_abt); + OFFSET(UREGS_LR_abt, struct cpu_user_regs, lr_abt); + OFFSET(UREGS_SPSR_abt, struct cpu_user_regs, spsr_abt); + + OFFSET(UREGS_SP_und, struct cpu_user_regs, sp_und); + OFFSET(UREGS_LR_und, struct cpu_user_regs, lr_und); + OFFSET(UREGS_SPSR_und, struct cpu_user_regs, spsr_und); + + OFFSET(UREGS_SP_irq, struct cpu_user_regs, sp_irq); + OFFSET(UREGS_LR_irq, struct cpu_user_regs, lr_irq); + OFFSET(UREGS_SPSR_irq, struct cpu_user_regs, spsr_irq); + + OFFSET(UREGS_SP_fiq, struct cpu_user_regs, sp_fiq); + OFFSET(UREGS_LR_fiq, struct cpu_user_regs, lr_fiq); + OFFSET(UREGS_SPSR_fiq, struct cpu_user_regs, spsr_fiq); + + OFFSET(UREGS_R8_fiq, struct cpu_user_regs, r8_fiq); + OFFSET(UREGS_R9_fiq, struct cpu_user_regs, r9_fiq); + OFFSET(UREGS_R10_fiq, struct cpu_user_regs, r10_fiq); + OFFSET(UREGS_R11_fiq, struct cpu_user_regs, r11_fiq); + OFFSET(UREGS_R12_fiq, struct cpu_user_regs, r12_fiq); + + OFFSET(UREGS_kernel_sizeof, struct cpu_user_regs, cpsr); +DEFINE (UREGS_user_sizeof,sizeof (struct cpu_user_regs )); +BLANK (); + +DEFINE (CPUINFO_sizeof,sizeof (struct cpu_info )); +} +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/arch/arm/dummy.S new file +72 -0
72 lines not on this page · raw message
xen/arch/arm/entry.S new file +107 -0
107 lines not on this page · raw message
xen/arch/arm/head.S new file +298 -0
298 lines not on this page · raw message
xen/arch/arm/xen.lds.S new file +141 -0
141 lines not on this page · raw message
xen/include/asm-arm/asm_defns.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef __ARM_ASM_DEFNS_H__ +#define __ARM_ASM_DEFNS_H__ + +#ifndef COMPILE_OFFSETS +/* NB. Auto-generated from arch/.../asm-offsets.c */ +#include <asm/asm-offsets.h> +#endif +#include <asm/processor.h> + +#endif /* __ARM_ASM_DEFNS_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
Signature · 1 line
1.7.2.5
PATCH v6 12/27 arm: domain
In reply to Stefano StabelliniDomain creation and destruction, vcpu initialization and destruction, arch specific scheduling functions called by common code.
--- xen/arch/arm/domain.c | 253 ++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/domain.h | 43 +++++++ 2 files changed, 296 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/domain.c create mode 100644 xen/include/asm-arm/domain.h
xen/arch/arm/domain.c new file +253 -0
@@ -0,0 +1,253 @@ +#include <xen/config.h> +#include <xen/init.h> +#include <xen/lib.h> +#include <xen/sched.h> +#include <xen/softirq.h> +#include <xen/wait.h> +#include <xen/errno.h> + +#include <asm/current.h> +#include <asm/regs.h> +#include <asm/p2m.h> +#include <asm/irq.h> + +DEFINE_PER_CPU(struct vcpu *, curr_vcpu); + +static void continue_idle_domain (struct vcpu *v) +{ +reset_stack_and_jump (idle_loop); +} + +static void continue_nonidle_domain (struct vcpu *v) +{ +/* check_wakeup_from_wait(); */ +reset_stack_and_jump (return_from_trap); +} + +void idle_loop (void ) +{ +for ( ; ; ) + { +/* TODO +if ( cpu_is_offline(smp_processor_id()) ) +play_dead(); +(*pm_idle)(); +BUG(); +*/ +do_tasklet (); +do_softirq (); + } +} + +static void ctxt_switch_from (struct vcpu *p) +{ + +} + +static void ctxt_switch_to (struct vcpu *n) +{ +p2m_load_VTTBR (n->domain); +} + +static void __context_switch (void ) +{ +struct cpu_user_regs *stack_regs =guest_cpu_user_regs (); +unsigned int cpu =smp_processor_id (); +struct vcpu *p =per_cpu (curr_vcpu, cpu); +struct vcpu *n = current; + +ASSERT (p != n); +ASSERT (cpumask_empty (n->vcpu_dirty_cpumask)); + +if ( !is_idle_vcpu (p) ) + { +memcpy (&p->arch.user_regs, stack_regs,CTXT_SWITCH_STACK_BYTES ); +ctxt_switch_from (p); + } + +if ( !is_idle_vcpu (n) ) + { +memcpy (stack_regs, &n->arch.user_regs,CTXT_SWITCH_STACK_BYTES ); +ctxt_switch_to (n); + } + +per_cpu (curr_vcpu, cpu) = n; + +} + +static void schedule_tail (struct vcpu *v) +{ +if (is_idle_vcpu (v) ) +continue_idle_domain (v); +else +continue_nonidle_domain (v); +} + +void context_switch (struct vcpu *prev,struct vcpu *next) +{ +unsigned int cpu =smp_processor_id (); + +ASSERT (local_irq_is_enabled ()); + +printk ("context switch %d:%d%s -> %d:%d%s\n" , + prev->domain->domain_id, prev->vcpu_id,is_idle_vcpu (prev) ?" (idle)" :"" , + next->domain->domain_id, next->vcpu_id,is_idle_vcpu (next) ?" (idle)" :"" ); + +/* TODO +if (prev != next) +update_runstate_area(prev); +*/ + +local_irq_disable (); + +set_current (next); + +if ( (per_cpu (curr_vcpu, cpu) == next) || + (is_idle_vcpu (next) &&cpu_online (cpu)) ) + { +local_irq_enable (); + } +else + { +__context_switch (); + +/* Re-enable interrupts before restoring state which may fault. */ +local_irq_enable (); + } + +context_saved (prev); + +/* TODO +if (prev != next) +update_runstate_area(next); +*/ + +schedule_tail (next); +BUG (); + +} + +void continue_running (struct vcpu *same) +{ +schedule_tail (same); +BUG (); +} + +int __sync_local_execstate (void ) +{ +unsigned long flags; +int switch_required; + +local_irq_save (flags); + + switch_required = (this_cpu (curr_vcpu) != current); + +if ( switch_required ) + { +ASSERT (current == idle_vcpu[smp_processor_id ()]); +__context_switch (); + } + +local_irq_restore (flags); + +return switch_required; +} + +void sync_local_execstate (void ) +{ + (void )__sync_local_execstate (); +} + +void startup_cpu_idle_loop (void ) +{ +struct vcpu *v = current; + +ASSERT (is_idle_vcpu (v)); +/* TODO +cpumask_set_cpu(v->processor, v->domain->domain_dirty_cpumask); +cpumask_set_cpu(v->processor, v->vcpu_dirty_cpumask); +*/ + +reset_stack_and_jump (idle_loop); +} + +struct domain *alloc_domain_struct (void ) +{ +struct domain *d; +BUILD_BUG_ON (sizeof (*d) >PAGE_SIZE ); + d =alloc_xenheap_pages (0 ,0 ); +if ( d !=NULL ) +clear_page (d); +return d; +} + +void free_domain_struct (struct domain *d) +{ +free_xenheap_page (d); +} + +void dump_pageframe_info (struct domain *d) +{ + +} + +struct vcpu *alloc_vcpu_struct (void ) +{ +struct vcpu *v; +BUILD_BUG_ON (sizeof (*v) >PAGE_SIZE ); + v =alloc_xenheap_pages (0 ,0 ); +if ( v !=NULL ) +clear_page (v); +return v; +} + +void free_vcpu_struct (struct vcpu *v) +{ +free_xenheap_page (v); +} + +int vcpu_initialise (struct vcpu *v) +{ +int rc =0 ; + +return rc; +} + +void vcpu_destroy (struct vcpu *v) +{ + +} + +int arch_domain_create (struct domain *d,unsigned int domcr_flags) +{ +int rc; + + d->max_vcpus =8 ; + + rc =0 ; +fail: +return rc; +} + +void arch_domain_destroy (struct domain *d) +{ +/* p2m_destroy */ +/* domain_vgic_destroy */ +} + +void arch_dump_domain_info (struct domain *d) +{ +} + +void arch_dump_vcpu_info (struct vcpu *v) +{ +} + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/domain.h new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH v6 13/27 arm: domain_build
In reply to Stefano StabelliniFunctions to build dom0: memory allocation, p2m construction, mappings of the MMIO regions, ATAG setup.
Changes in v5:
- route interrupt 34 (peripheral timer) to dom0.
Changes in v2:
- set elf.dest.
--- xen/arch/arm/domain_build.c | 213 ++++++++++++++++++++++++++++++++++++ xen/common/libelf/libelf-dominfo.c | 6 + xen/include/asm-arm/setup.h | 2 + xen/include/xen/libelf.h | 2 +- 4 files changed, 222 insertions(+), 1 deletions(-) create mode 100644 xen/arch/arm/domain_build.c
xen/arch/arm/domain_build.c new file +213 -0
@@ -0,0 +1,213 @@ +#include <xen/config.h> +#include <xen/init.h> +#include <xen/lib.h> +#include <xen/mm.h> +#include <xen/domain_page.h> +#include <xen/sched.h> +#include <xen/libelf.h> +#include <asm/irq.h> + +#include "gic.h" + +static unsigned int __initdata opt_dom0_max_vcpus; +integer_param ("dom0_max_vcpus" , opt_dom0_max_vcpus); + +struct vcpu *__init alloc_dom0_vcpu0 (void ) +{ + dom0->vcpu = xmalloc_array(struct vcpu *, opt_dom0_max_vcpus); +if ( !dom0->vcpu ) + { +printk ("failed to alloc dom0->vccpu\n" ); +return NULL ; + } +memset (dom0->vcpu,0 , opt_dom0_max_vcpus *sizeof (*dom0->vcpu)); + dom0->max_vcpus = opt_dom0_max_vcpus; + +return alloc_vcpu (dom0,0 ,0 ); +} + +extern void guest_mode_entry (void ); + +static void copy_from_flash (void *dst,paddr_t flash,unsigned long len) +{ +void *src = (void *)FIXMAP_ADDR (FIXMAP_MISC ); +unsigned long offs; + +printk ("Copying %#lx bytes from flash %" PRIpaddr" to %p-%p: [" , + len, flash, dst, dst+(1 <<23 )); +for ( offs =0 ; offs < len ; offs +=PAGE_SIZE ) + { +if ( ( offs % (1 <<20 ) ) ==0 ) +printk ("." ); +set_fixmap (FIXMAP_MISC , (flash+offs) >>PAGE_SHIFT ,DEV_SHARED ); +memcpy (dst+offs, src,PAGE_SIZE ); + } +printk ("]\n" ); + +clear_fixmap (FIXMAP_MISC ); +} + +static void setup_linux_atag (paddr_t tags,paddr_t ram_s,paddr_t ram_e) +{ +paddr_t ma =gvirt_to_maddr (tags); +void *map =map_domain_page (ma>>PAGE_SHIFT ); +void *p = map + (tags & (PAGE_SIZE -1 )); +char cmdline[] ="earlyprintk=xenboot console=ttyAMA1 root=/dev/mmcblk0 debug rw" ; + +/* not enough room on this page for all the tags */ +BUG_ON (PAGE_SIZE - (tags & (PAGE_SIZE -1 )) <8 *sizeof (uint32_t )); + +#define TAG (type, val) *(type*)p = val; p+= sizeof(type) + +/* ATAG_CORE */ +TAG (uint32_t,2 ); +TAG (uint32_t,0x54410001 ); + +/* ATAG_MEM */ +TAG (uint32_t,4 ); +TAG (uint32_t,0x54410002 ); +TAG (uint32_t, (ram_e - ram_s) &0xFFFFFFFF ); +TAG (uint32_t, ram_s &0xFFFFFFFF ); + +/* ATAG_CMDLINE */ +TAG (uint32_t,2 + ((strlen (cmdline) +4 ) >>2 )); +TAG (uint32_t,0x54410009 ); +memcpy (p, cmdline,strlen (cmdline) +1 ); + p += ((strlen (cmdline) +4 ) >>2 ) <<2 ; + +/* ATAG_NONE */ +TAG (uint32_t,0 ); +TAG (uint32_t,0 ); + +#undef TAG + +unmap_domain_page (map); +} + +/* Store kernel in first 8M of flash */ +#define KERNEL_FLASH_ADDRESS 0x00000000UL +#define KERNEL_FLASH_SIZE 0x00800000UL + +int construct_dom0 (struct domain *d) +{ +int rc, kernel_order; +void *kernel_img; + +struct vcpu *v = d->vcpu[0 ]; +struct cpu_user_regs *regs = &v->arch.user_regs; + +struct elf_binary elf; +struct elf_dom_parms parms; + +/* Sanity! */ +BUG_ON (d->domain_id !=0 ); +BUG_ON (d->vcpu[0 ] ==NULL ); +BUG_ON (v->is_initialised); + +printk ("*** LOADING DOMAIN 0 ***\n" ); + + kernel_order =get_order_from_bytes (KERNEL_FLASH_SIZE ); + kernel_img =alloc_xenheap_pages (kernel_order,0 ); +if ( kernel_img ==NULL ) +panic ("Cannot allocate temporary buffer for kernel.\n" ); + +copy_from_flash (kernel_img,KERNEL_FLASH_ADDRESS ,KERNEL_FLASH_SIZE ); + + d->max_pages = ~0U ; + +if ( (rc =elf_init (&elf, kernel_img,KERNEL_FLASH_SIZE )) !=0 ) +return rc;memset (regs,0 ,sizeof (*regs)); +#ifdef VERBOSE +elf_set_verbose (&elf); +#endif +elf_parse_binary (&elf); +if ( (rc =elf_xen_parse (&elf, &parms)) !=0 ) +return rc; + +if ( (rc =p2m_alloc_table (d)) !=0 ) +return rc; + +/* 128M at 3G physical */ +/* TODO size and location according to platform info */ +printk ("Populate P2M %#llx->%#llx\n" ,0xc0000000ULL ,0xc8000000ULL ); +p2m_populate_ram (d,0xc0000000ULL ,0xc8000000ULL ); + +printk ("Map CS2 MMIO regions 1:1 in the P2M %#llx->%#llx\n" ,0x18000000ULL ,0x1BFFFFFFULL ); +map_mmio_regions (d,0x18000000 ,0x1BFFFFFF ,0x18000000 ); +printk ("Map CS3 MMIO regions 1:1 in the P2M %#llx->%#llx\n" ,0x1C000000ULL ,0x1FFFFFFFULL ); +map_mmio_regions (d,0x1C000000 ,0x1FFFFFFF ,0x1C000000 ); +printk ("Map VGIC MMIO regions 1:1 in the P2M %#llx->%#llx\n" ,0x2C008000ULL ,0x2DFFFFFFULL ); +map_mmio_regions (d,0x2C008000 ,0x2DFFFFFF ,0x2C008000 ); + +gicv_setup (d); + +printk ("Routing peripheral interrupts to guest\n" ); +/* TODO Get from device tree */ +gic_route_irq_to_guest (d,34 ,"timer0" ); +/*gic_route_irq_to_guest(d, 37, "uart0"); -- XXX used by Xen*/ +gic_route_irq_to_guest (d,38 ,"uart1" ); +gic_route_irq_to_guest (d,39 ,"uart2" ); +gic_route_irq_to_guest (d,40 ,"uart3" ); +gic_route_irq_to_guest (d,41 ,"mmc0-1" ); +gic_route_irq_to_guest (d,42 ,"mmc0-2" ); +gic_route_irq_to_guest (d,44 ,"keyboard" ); +gic_route_irq_to_guest (d,45 ,"mouse" ); +gic_route_irq_to_guest (d,46 ,"lcd" ); +gic_route_irq_to_guest (d,47 ,"eth" ); + +/* Enable second stage translation */ +WRITE_CP32 (READ_CP32 (HCR ) |HCR_VM ,HCR );isb (); + +/* The following load uses domain's p2m */ +p2m_load_VTTBR (d); + +printk ("Loading ELF image into guest memory\n" ); + elf.dest = (void *)(unsigned long )parms.virt_kstart; +elf_load_binary (&elf); + +printk ("Free temporary kernel buffer\n" ); +free_xenheap_pages (kernel_img, kernel_order); + +setup_linux_atag (0xc0000100ULL ,0xc0000000ULL ,0xc8000000ULL ); + +clear_bit (_VPF_down, &v->pause_flags); + +memset (regs,0 ,sizeof (*regs)); + + regs->pc = (uint32_t )parms.virt_entry; + + regs->cpsr =PSR_ABT_MASK |PSR_FIQ_MASK |PSR_IRQ_MASK |PSR_MODE_SVC ; + +/* FROM LINUX head.S + +* Kernel startup entry point. +* --------------------------- +* +* This is normally called from the decompressor code. The requirements +* are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0, +* r1 = machine nr, r2 = atags or dtb pointer. +*... +*/ + + regs->r0 =0 ;/* SBZ */ + regs->r1 =2272 ;/* Machine NR: Versatile Express */ + regs->r2 =0xc0000100 ;/* ATAGS */ + +WRITE_CP32 (SCTLR_BASE ,SCTLR ); + +WRITE_CP32 (HCR_AMO |HCR_IMO |HCR_VM ,HCR ); +isb (); + +local_abort_enable (); + +return 0 ; +} + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/common/libelf/libelf-dominfo.c +6 -0
@@ -341,6 +341,12 @@ static int elf_xen_note_check(struct elf_binary *elf,return 0 ; } +if (elf_uval (elf, elf->ehdr, e_machine) ==EM_ARM ) + { +elf_msg (elf,"%s: Not bothering with notes on ARM\n" , __FUNCTION__); +return 0 ; + } +/* Check the contents of the Xen notes or guest string. */ if ( ((strlen(parms->loader) == 0) || strncmp(parms->loader, "generic", 7)) &&
xen/include/asm-arm/setup.h +2 -0
@@ -5,6 +5,8 @@void arch_get_xen_caps (xen_capabilities_info_t *info); +int construct_dom0 (struct domain *d); +#endif /* * Local variables:
xen/include/xen/libelf.h +1 -1
@@ -23,7 +23,7 @@#ifndef __XEN_LIBELF_H__#define __XEN_LIBELF_H__ -#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) +#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || defined(__arm__)#define XEN_ELF_LITTLE_ENDIAN #else #error define architectural endianness
Signature · 1 line
1.7.2.5
PATCH v6 14/27 arm: driver for CoreLink GIC-400 Generic Interrupt Controller
In reply to Stefano Stabellini- GICC, GICD and GICH initialization;
- interrupts routing, acking and EOI;
- interrupt injection into guests;
- maintenance interrupt handler, that takes care of EOI physical interrupts on behalf of the guest;
- a function to remap the virtual cpu interface into the guest address space, where the guest expect the GICC to be.
--- xen/arch/arm/domain.c | 2 + xen/arch/arm/gic.c | 473 +++++++++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/gic.h | 151 ++++++++++++++++ 3 files changed, 626 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/gic.c create mode 100644 xen/arch/arm/gic.h
xen/arch/arm/domain.c +2 -0
@@ -11,6 +11,8 @@#include <asm/p2m.h> #include <asm/irq.h> +#include "gic.h" + DEFINE_PER_CPU(struct vcpu *, curr_vcpu);static void continue_idle_domain (struct vcpu *v)
xen/arch/arm/gic.c new file +473 -0
473 lines not on this page · raw message
xen/arch/arm/gic.h new file +151 -0
151 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH v6 15/27 arm: mmio handlers
In reply to Stefano StabelliniBasic infrastructure to emulate mmio reads and writes.
--- xen/arch/arm/io.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/io.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/io.c create mode 100644 xen/arch/arm/io.h
xen/arch/arm/io.c new file +50 -0
@@ -0,0 +1,50 @@ +/* +* xen/arch/arm/io.h +* +* ARM I/O handlers +* +* Copyright (c) 2011 Citrix Systems. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <xen/config.h> +#include <xen/lib.h> +#include <asm/current.h> + +#include "io.h" + +static const struct mmio_handler *const mmio_handlers[] = +{ +}; +#define MMIO_HANDLER_NR ARRAY_SIZE(mmio_handlers) + +int handle_mmio (mmio_info_t *info) +{ +struct vcpu *v = current; +int i; + +for ( i =0 ; i <MMIO_HANDLER_NR ; i++ ) +if ( mmio_handlers[i]->check_handler (v, info->gpa) ) +return info->dabt.write ? + mmio_handlers[i]->write_handler (v, info) : + mmio_handlers[i]->read_handler (v, info); + +return 0 ; +} +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/arch/arm/io.h new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH v6 16/27 arm: irq
In reply to Stefano StabelliniA simple do_IRQ and request_irq implementation for ARM.
--- xen/arch/arm/irq.c | 179 +++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/irq.h | 30 +++++++ xen/include/asm-arm/setup.h | 2 + xen/include/xen/irq.h | 13 +++ 4 files changed, 224 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/irq.c create mode 100644 xen/include/asm-arm/irq.h
xen/arch/arm/irq.c new file +179 -0
@@ -0,0 +1,179 @@ +/* +* xen/arch/arm/irq.c +* +* ARM Interrupt support +* +* Ian Campbell <[email protected]> +* Copyright (c) 2011 Citrix Systems. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <xen/config.h> +#include <xen/lib.h> +#include <xen/spinlock.h> +#include <xen/irq.h> +#include <xen/init.h> +#include <xen/errno.h> +#include <xen/sched.h> + +#include "gic.h" + +static void enable_none (struct irq_desc *irq) { } +static unsigned int startup_none (struct irq_desc *irq) {return 0 ; } +static void disable_none (struct irq_desc *irq) { } +static void ack_none (struct irq_desc *irq) +{ +printk ("unexpected IRQ trap at irq %02x\n" , irq->irq); +} + +#define shutdown_none disable_none +#define end_none enable_none + +hw_irq_controller no_irq_type = { + .typename ="none" , + .startup = startup_none, + .shutdown = shutdown_none, + .enable = enable_none, + .disable = disable_none, + .ack = ack_none, + .end = end_none +}; + +int __init arch_init_one_irq_desc (struct irq_desc *desc) +{ +return 0 ; +} + + +static int __init init_irq_data (void ) +{ +int irq; + +for (irq =0 ; irq <NR_IRQS ; irq++) { +struct irq_desc *desc =irq_to_desc (irq); +init_one_irq_desc (desc); + desc->irq = irq; + desc->action =NULL ; + } +return 0 ; +} + +void __init init_IRQ (void ) +{ +BUG_ON (init_irq_data () <0 ); +} + +int __init request_irq (unsigned int irq, +void (*handler)(int ,void *,struct cpu_user_regs *), +unsigned long irqflags,const char * devname,void *dev_id) +{ +struct irqaction *action; +int retval; + +/* +* Sanity-check: shared interrupts must pass in a real dev-ID, +* otherwise we'll have trouble later trying to figure out +* which interrupt is which (messes up the interrupt freeing +* logic etc). +*/ +if (irq >= nr_irqs) +return -EINVAL ; +if (!handler) +return -EINVAL ; + + action = xmalloc(struct irqaction); +if (!action) +return -ENOMEM ; + + action->handler = handler; + action->name = devname; + action->dev_id = dev_id; + action->free_on_release =1 ; + + retval =setup_irq (irq, action); +if (retval) +xfree (action); + +return retval; +} + +/* Dispatch an interrupt */ +void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) +{ +struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action = desc->action; + +/* TODO: perfc_incr(irqs); */ + +/* TODO: this_cpu(irq_count)++; */ + +irq_enter (); + +spin_lock (&desc->lock); + desc->handler->ack (desc); + +if ( action ==NULL ) + { +printk ("Unknown %s %#3.3x\n" , + is_fiq ?"FIQ" :"IRQ" , irq); + goto out; + } + +if ( desc->status &IRQ_GUEST ) + { +struct domain *d = action->dev_id; + + desc->handler->end (desc); + + desc->status |=IRQ_INPROGRESS ; + +/* XXX: inject irq into the guest */ + goto out_no_end; + } + + desc->status |=IRQ_PENDING ; + +/* +* Since we set PENDING, if another processor is handling a different +* instance of this same irq, the other processor will take care of it. +*/ +if ( desc->status & (IRQ_DISABLED |IRQ_INPROGRESS ) ) + goto out; + + desc->status |=IRQ_INPROGRESS ; + + action = desc->action; +while ( desc->status &IRQ_PENDING ) + { + desc->status &= ~IRQ_PENDING ; +spin_unlock_irq (&desc->lock); + action->handler (irq, action->dev_id, regs); +spin_lock_irq (&desc->lock); + } + + desc->status &= ~IRQ_INPROGRESS ; + +out: + desc->handler->end (desc); +out_no_end: +spin_unlock (&desc->lock); +irq_exit (); +} + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/irq.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef _ASM_HW_IRQ_H +#define _ASM_HW_IRQ_H + +#include <xen/config.h> + +#define NR_VECTORS 256/* XXX */ + +typedef struct { + DECLARE_BITMAP(_bits,NR_VECTORS); +}vmask_t ; + +struct arch_pirq +{ +}; + +struct irq_cfg { +#define arch_irq_desc irq_cfg +}; + +void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq); + +#endif /* _ASM_HW_IRQ_H */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/setup.h +2 -0
@@ -7,6 +7,8 @@ void arch_get_xen_caps(xen_capabilities_info_t *info);int construct_dom0 (struct domain *d); +void init_IRQ (void ); +#endif /* * Local variables:
xen/include/xen/irq.h +13 -0
@@ -106,6 +106,19 @@ extern irq_desc_t irq_desc[NR_VECTORS];#define request_irq (irq, handler, irqflags, devname, devid) \ request_irq_vector(irq_to_vector(irq), handler, irqflags, devname, devid) + +#elif defined(__arm__) + +#define NR_IRQS 1024 +#define nr_irqs NR_IRQS +extern irq_desc_t irq_desc[NR_IRQS ]; + +extern int setup_irq (unsigned int irq,struct irqaction *); +extern void release_irq (unsigned int irq); +extern int request_irq (unsigned int irq, +void (*handler)(int ,void *,struct cpu_user_regs *), +unsigned long irqflags,const char * devname,void *dev_id); +#else extern int setup_irq (unsigned int irq,struct irqaction *);extern void release_irq (unsigned int irq);
Signature · 1 line
1.7.2.5
PATCH v6 17/27 arm: mm and p2m
In reply to Stefano StabelliniFunctions to setup pagetables, handle the p2m, map and unmap domain pages, copy data to/from guest addresses.
The implementation is based on the LPAE extension for ARMv7 and makes use of the two level transtion mechanism.
Changes in v4:
- fix build for -wunused-values;
Changes in v3:
- rename copy_to_user and copy_from_user to raw_copy_to_guest and raw_copy_from_guest.
--- xen/arch/arm/domain.c | 4 + xen/arch/arm/guestcopy.c | 81 +++++++++ xen/arch/arm/mm.c | 321 ++++++++++++++++++++++++++++++++++ xen/arch/arm/p2m.c | 214 +++++++++++++++++++++++ xen/include/asm-arm/domain.h | 2 + xen/include/asm-arm/guest_access.h | 131 ++++++++++++++ xen/include/asm-arm/mm.h | 315 +++++++++++++++++++++++++++++++++ xen/include/asm-arm/p2m.h | 88 ++++++++++ xen/include/asm-arm/page.h | 335 ++++++++++++++++++++++++++++++++++++ 9 files changed, 1491 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/guestcopy.c create mode 100644 xen/arch/arm/mm.c create mode 100644 xen/arch/arm/p2m.c create mode 100644 xen/include/asm-arm/guest_access.h create mode 100644 xen/include/asm-arm/mm.h create mode 100644 xen/include/asm-arm/p2m.h create mode 100644 xen/include/asm-arm/page.h
xen/arch/arm/domain.c +4 -0
@@ -224,6 +224,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags) {int rc; + rc = -ENOMEM ; +if ( (rc =p2m_init (d)) !=0 ) + goto fail; + d->max_vcpus =8 ; rc =0 ;
xen/arch/arm/guestcopy.c new file +81 -0
81 lines not on this page · raw message
xen/arch/arm/mm.c new file +321 -0
321 lines not on this page · raw message
xen/arch/arm/p2m.c new file +214 -0
214 lines not on this page · raw message
xen/include/asm-arm/domain.h +2 -0
@@ -16,6 +16,8 @@ struct pending_irqstruct arch_domain { +struct p2m_domain p2m; + } __cacheline_aligned;struct arch_vcpu
xen/include/asm-arm/guest_access.h new file +131 -0
131 lines not on this page · raw message
xen/include/asm-arm/mm.h new file +315 -0
315 lines not on this page · raw message
xen/include/asm-arm/p2m.h new file +88 -0
88 lines not on this page · raw message
xen/include/asm-arm/page.h new file +335 -0
335 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH v6 19/27 arm: early setup code
In reply to Stefano Stabellini--- xen/arch/arm/setup.c | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 206 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/setup.c
xen/arch/arm/setup.c new file +206 -0
@@ -0,0 +1,206 @@ +/* +* xen/arch/arm/setup.c +* +* Early bringup code for an ARMv7-A with virt extensions. +* +* Tim Deegan <[email protected]> +* Copyright (c) 2011 Citrix Systems. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <xen/config.h> +#include <xen/compile.h> +#include <xen/domain_page.h> +#include <xen/types.h> +#include <xen/string.h> +#include <xen/serial.h> +#include <xen/sched.h> +#include <xen/console.h> +#include <xen/init.h> +#include <xen/irq.h> +#include <xen/mm.h> +#include <xen/softirq.h> +#include <xen/keyhandler.h> +#include <xen/cpu.h> +#include <asm/page.h> +#include <asm/current.h> +#include <asm/setup.h> +#include "gic.h" + +/* maxcpus: maximum number of CPUs to activate. */ +static unsigned int __initdata max_cpus =NR_CPUS ; + +/* Xen stack for bringing up the first CPU. */ +unsigned char init_stack[STACK_SIZE] __attribute__((__aligned__(STACK_SIZE))); + +extern char __init_begin[], __init_end[], __bss_start[]; + +static __attribute_used__ void init_done(void) +{ +/* TODO: free (or page-protect) the init areas. +memset(__init_begin, 0xcc, __init_end - __init_begin); +free_xen_data(__init_begin, __init_end); +*/ +printk ("Freed %ldkB init memory.\n" , (long )(__init_end-__init_begin)>>10 ); + +startup_cpu_idle_loop (); +} + +static void __init init_idle_domain (void ) +{ +scheduler_init (); +set_current (idle_vcpu[0 ]); +this_cpu (curr_vcpu) = current; +/* TODO: setup_idle_pagetable(); */ +} + +void __init start_xen (unsigned long boot_phys_offset, +unsigned long arm_type, +unsigned long atag_paddr) + +{ +int i; + +setup_pagetables (boot_phys_offset); + +#ifdef EARLY_UART_ADDRESS +/* Map the UART */ +/* TODO Need to get device tree or command line for UART address */ +set_fixmap (FIXMAP_CONSOLE ,EARLY_UART_ADDRESS >>PAGE_SHIFT ,DEV_SHARED ); +pl011_init (0 ,FIXMAP_ADDR (FIXMAP_CONSOLE )); +console_init_preirq (); +#endif + +set_current ((struct vcpu *)0xfffff000 );/* debug sanity */ + idle_vcpu[0 ] = current; +set_processor_id (0 );/* needed early, for smp_processor_id() */ + +/* TODO: smp_prepare_boot_cpu(void) */ +cpumask_set_cpu (smp_processor_id (), &cpu_online_map); +cpumask_set_cpu (smp_processor_id (), &cpu_present_map); + +smp_prepare_cpus (max_cpus); + +init_xen_time (); + +/* TODO: This needs some thought, as well as device-tree mapping. +* For testing, assume that the whole xenheap is contiguous in RAM */ +setup_xenheap_mappings (0x8000000 ,0x40000 );/* 1 GB @ 512GB */ +/* Must pass a single mapped page for populating bootmem_region_list. */ +init_boot_pages (pfn_to_paddr (xenheap_mfn_start), +pfn_to_paddr (xenheap_mfn_start+1 )); + +/* Add non-xenheap memory */ +init_boot_pages (0x8040000000 ,0x80c0000000 );/* 2 GB @513GB */ + +/* TODO Make sure Xen's own pages aren't added +* -- the memory above doesn't include our relocation target. */ +/* TODO Handle payloads too */ + +/* TODO Need to find actual memory, for now use 4GB at 512GB */ +setup_frametable_mappings (0x8000000000ULL ,0x8100000000UL ); + +/* Add xenheap memory */ +init_xenheap_pages (pfn_to_paddr (xenheap_mfn_start+1 ), +pfn_to_paddr (xenheap_mfn_end)); + +end_boot_allocator (); + +/* Setup Hyp vector base */ +WRITE_CP32 ((uint32_t ) hyp_traps_vector,HVBAR ); +printk ("Set hyp vector base to %" PRIx32" (expected %p)\n" , +READ_CP32 (HVBAR ), hyp_traps_vector); + +/* Setup Stage 2 address translation */ +/* SH0=00, ORGN0=IRGN0=01 +* SL0=01 (Level-1) +* T0SZ=(1)1000 = -8 (40 bit physical addresses) +*/ +WRITE_CP32 (0x80002558 ,VTCR );isb (); + +softirq_init (); +tasklet_subsys_init (); + +init_IRQ (); + +gic_init (); + +gic_route_irqs (); + +init_maintenance_interrupt (); +init_timer_interrupt (); + +timer_init (); + +init_idle_domain (); + +rcu_init (); + +local_irq_enable (); + +initialize_keytable (); + +console_init_postirq (); + +do_presmp_initcalls (); + +for_each_present_cpu ( i ) + { +if ( (num_online_cpus () < max_cpus) && !cpu_online (i) ) + { +int ret =cpu_up (i); +if ( ret !=0 ) +printk ("Failed to bring up CPU %u (error %d)\n" , i, ret); + } + } + +printk ("Brought up %ld CPUs\n" , (long )num_online_cpus ()); +/* TODO: smp_cpus_done(); */ + +do_initcalls (); + +/* Create initial domain 0. */ + dom0 =domain_create (0 ,0 ,0 ); +if ( dom0 ==NULL ) +printk ("domain_create failed\n" ); +if ( (dom0 ==NULL ) || (alloc_dom0_vcpu0 () ==NULL ) ) +panic ("Error creating domain 0\n" ); + + dom0->is_privileged =1 ; + dom0->target =NULL ; + +if (construct_dom0 (dom0) !=0 ) +panic ("Could not set up DOM0 guest OS\n" ); + +/* Scrub RAM that is still free and so may go to an unprivileged domain. +XXX too slow in simulator +scrub_heap_pages(); +*/ + +console_endboot (); + +/* Hide UART from DOM0 if we're using it */ +serial_endboot (); + +domain_unpause_by_systemcontroller (dom0); + +reset_stack_and_jump (init_done); +} + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
Signature · 1 line
1.7.2.5
PATCH v6 20/27 arm: shutdown, smp and smpboot
In reply to Stefano StabelliniDummy implementation of machine_* and smp_*
--- xen/arch/arm/shutdown.c | 23 +++++++++++++++++++++ xen/arch/arm/smp.c | 29 +++++++++++++++++++++++++++ xen/arch/arm/smpboot.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/shutdown.c create mode 100644 xen/arch/arm/smp.c create mode 100644 xen/arch/arm/smpboot.c
xen/arch/arm/shutdown.c new file +23 -0
@@ -0,0 +1,23 @@ +#include <xen/config.h> +#include <xen/lib.h> + +void machine_halt (void ) +{ +/* TODO: halt */ +while (1 ) ; +} + +void machine_restart (unsigned int delay_millisecs) +{ +/* TODO: restart */ +printk ("Cannot restart yet\n" ); +while (1 ); +} +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/arch/arm/smp.c new file +29 -0
@@ -0,0 +1,29 @@ +#include <xen/config.h> +#include <asm/smp.h> + +void smp_call_function ( +void (*func) (void *info), +void *info, +int wait) +{ +/* TODO: No SMP just now, does not include self so nothing to do. +cpumask_t allbutself = cpu_online_map; +cpu_clear(smp_processor_id(), allbutself); +on_selected_cpus(&allbutself, func, info, wait); +*/ +} +void smp_send_event_check_mask (const cpumask_t *mask) +{ +/* TODO: No SMP just now, does not include self so nothing to do. +send_IPI_mask(mask, EVENT_CHECK_VECTOR); +*/ +} + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/arch/arm/smpboot.c new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH v6 21/27 arm: driver for the generic timer for ARMv7
In reply to Stefano StabelliniDriver for the generic timer for ARMv7 with virtualization extensions. Currently it is based on the kernel timer rather than the hypervisor timer because the latter does not work correctly on our test environment.
--- xen/arch/arm/time.c | 181 ++++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/time.h | 26 ++++++ 2 files changed, 207 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/time.c create mode 100644 xen/include/asm-arm/time.h
xen/arch/arm/time.c new file +181 -0
@@ -0,0 +1,181 @@ +/* +* xen/arch/arm/time.c +* +* Time and timer support, using the ARM Generic Timer interfaces +* +* Tim Deegan <[email protected]> +* Copyright (c) 2011 Citrix Systems. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <xen/config.h> +#include <xen/console.h> +#include <xen/init.h> +#include <xen/irq.h> +#include <xen/lib.h> +#include <xen/mm.h> +#include <xen/softirq.h> +#include <xen/time.h> +#include <asm/system.h> + +/* Unfortunately the hypervisor timer interrupt appears to be buggy */ +#define USE_HYP_TIMER 0 + +/* For fine-grained timekeeping, we use the ARM "Generic Timer", a +* register-mapped time source in the SoC. */ +static uint32_t __read_mostly cntfrq;/* Ticks per second */ +static uint64_t __read_mostly boot_count;/* Counter value at boot time */ + +/*static inline*/ s_time_t ticks_to_ns (uint64_t ticks) +{ +return muldiv64 (ticks,SECONDS (1 ), cntfrq); +} + +/*static inline*/ uint64_t ns_to_ticks (s_time_t ns) +{ +return muldiv64 (ns, cntfrq,SECONDS (1 )); +} + +/* TODO: On a real system the firmware would have set the frequency in +the CNTFRQ register. Also we'd need to use devicetree to find +the RTC. When we've seen some real systems, we can delete this. +static uint32_t calibrate_timer(void) +{ +uint32_t sec; +uint64_t start, end; +paddr_t rtc_base = 0x1C170000ull; +volatile uint32_t *rtc; + +ASSERT(!local_irq_is_enabled()); +set_fixmap(FIXMAP_MISC, rtc_base >> PAGE_SHIFT, DEV_SHARED); +rtc = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC); + +printk("Calibrating timer against RTC..."); +// Turn on the RTC +rtc[3] = 1; +// Wait for an edge +sec = rtc[0] + 1; +do {} while ( rtc[0] != sec ); +// Now time a few seconds +start = READ_CP64(CNTPCT); +do {} while ( rtc[0] < sec + 32 ); +end = READ_CP64(CNTPCT); +printk("done.\n"); + +clear_fixmap(FIXMAP_MISC); +return (end - start) / 32; +} +*/ + +/* Set up the timer on the boot CPU */ +int __init init_xen_time (void ) +{ +/* Check that this CPU supports the Generic Timer interface */ +if ( (READ_CP32 (ID_PFR1 ) &ID_PFR1_GT_MASK ) != ID_PFR1_GT_v1 ) +panic ("CPU does not support the Generic Timer v1 interface.\n" ); + + cntfrq =READ_CP32 (CNTFRQ ); + boot_count =READ_CP64 (CNTPCT ); +printk ("Using generic timer at %" PRIu32" Hz\n" , cntfrq); + +return 0 ; +} + +/* Return number of nanoseconds since boot */ +s_time_t get_s_time (void ) +{ +uint64_t ticks =READ_CP64 (CNTPCT ) - boot_count; +return ticks_to_ns (ticks); +} + +/* Set the timer to wake us up at a particular time. +* Timeout is a Xen system time (nanoseconds since boot); 0 disables the timer. +* Returns 1 on success; 0 if the timeout is too soon or is in the past. */ +int reprogram_timer (s_time_t timeout) +{ +uint64_t deadline; + +if ( timeout ==0 ) + { +#if USE_HYP_TIMER +WRITE_CP32 (0 ,CNTHP_CTL ); +#else +WRITE_CP32 (0 ,CNTP_CTL ); +#endif +return 1 ; + } + + deadline =ns_to_ticks (timeout) + boot_count; +#if USE_HYP_TIMER +WRITE_CP64 (deadline,CNTHP_CVAL ); +WRITE_CP32 (CNTx_CTL_ENABLE,CNTHP_CTL ); +#else +WRITE_CP64 (deadline,CNTP_CVAL ); +WRITE_CP32 (CNTx_CTL_ENABLE,CNTP_CTL ); +#endif +isb (); + +/* No need to check for timers in the past; the Generic Timer fires +* on a signed 63-bit comparison. */ +return 1 ; +} + +/* Handle the firing timer */ +static void timer_interrupt (int irq,void *dev_id,struct cpu_user_regs *regs) +{ +if ( irq ==26 &&READ_CP32 (CNTHP_CTL ) & CNTx_CTL_PENDING ) + { +/* Signal the generic timer code to do its work */ +raise_softirq (TIMER_SOFTIRQ ); +/* Disable the timer to avoid more interrupts */ +WRITE_CP32 (0 ,CNTHP_CTL ); + } + +if (irq ==30 &&READ_CP32 (CNTP_CTL ) & CNTx_CTL_PENDING ) + { +/* Signal the generic timer code to do its work */ +raise_softirq (TIMER_SOFTIRQ ); +/* Disable the timer to avoid more interrupts */ +WRITE_CP32 (0 ,CNTP_CTL ); + } +} + +/* Set up the timer interrupt on this CPU */ +void __cpuinit init_timer_interrupt (void ) +{ +/* Sensible defaults */ +WRITE_CP64 (0 ,CNTVOFF );/* No VM-specific offset */ +WRITE_CP32 (0 ,CNTKCTL );/* No user-mode access */ +#if USE_HYP_TIMER +/* Let the VMs read the physical counter and timer so they can tell time */ +WRITE_CP32 (CNTHCTL_PA |CNTHCTL_TA ,CNTHCTL ); +#else +/* Cannot let VMs access physical counter if we are using it */ +WRITE_CP32 (0 ,CNTHCTL ); +#endif +WRITE_CP32 (0 ,CNTP_CTL );/* Physical timer disabled */ +WRITE_CP32 (0 ,CNTHP_CTL );/* Hypervisor's timer disabled */ +isb (); + +/* XXX Need to find this IRQ number from devicetree? */ +request_irq (26 , timer_interrupt,0 ,"hyptimer" ,NULL ); +request_irq (30 , timer_interrupt,0 ,"phytimer" ,NULL ); +} + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/time.h new file +26 -0
@@ -0,0 +1,26 @@ +#ifndef __ARM_TIME_H__ +#define __ARM_TIME_H__ + +typedef unsigned long cycles_t ; + +static inline cycles_t get_cycles (void ) +{ +return 0 ; +} + +struct tm ; +struct tm wallclock_time (void ); + + +/* Set up the timer interrupt on this CPU */ +extern void __cpuinit init_timer_interrupt (void ); + +#endif /* __ARM_TIME_H__ */ +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
Signature · 1 line
1.7.2.5
PATCH v6 22/27 arm: trap handlers
In reply to Stefano StabelliniFunctions executed exiting from the guest and returning to the guest:
trap and hypercall handlers and leave_hypervisor_tail.
--- xen/arch/arm/traps.c | 609 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 609 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/traps.c
xen/arch/arm/traps.c new file +609 -0
@@ -0,0 +1,609 @@ +/* +* xen/arch/arm/traps.c +* +* ARM Trap handlers +* +* Copyright (c) 2011 Citrix Systems. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <xen/config.h> +#include <xen/init.h> +#include <xen/string.h> +#include <xen/version.h> +#include <xen/smp.h> +#include <xen/symbols.h> +#include <xen/irq.h> +#include <xen/lib.h> +#include <xen/mm.h> +#include <xen/errno.h> +#include <xen/hypercall.h> +#include <xen/softirq.h> +#include <public/xen.h> +#include <asm/regs.h> +#include <asm/cpregs.h> + +#include "io.h" +#include "vtimer.h" +#include "gic.h" + +/* The base of the stack must always be double-word aligned, which means +* that both the kernel half of struct cpu_user_regs (which is pushed in +* entry.S) and struct cpu_info (which lives at the bottom of a Xen +* stack) must be doubleword-aligned in size. */ +static inline void check_stack_alignment_constraints (void ) { +BUILD_BUG_ON ((sizeof (struct cpu_user_regs )) &0x7 ); +BUILD_BUG_ON ((offsetof(struct cpu_user_regs , r8_fiq)) &0x7 ); +BUILD_BUG_ON ((sizeof (struct cpu_info )) &0x7 ); +} + +static int debug_stack_lines =20 ; +integer_param ("debug_stack_lines" , debug_stack_lines); + +#define stack_words_per_line 8 + +asmlinkage void __div0(void) +{ +printk ("Division by zero in hypervisor.\n" ); +BUG (); +} + +/* XXX could/should be common code */ +static void print_xen_info (void ) +{ +char taint_str[TAINT_STRING_MAX_LEN ]; +char debug ='n' ; + +#ifndef NDEBUG + debug ='y' ; +#endif + +printk ("----[ Xen-%d.%d%s x86_64 debug=%c %s ]----\n" , +xen_major_version (),xen_minor_version (),xen_extra_version (), + debug,print_tainted (taint_str)); +} + +static const char *decode_fsc (uint32_t fsc,int *level) +{ +const char *msg =NULL ; + +switch ( fsc &0x3f ) + { + case FSC_FLT_TRANS ... FSC_FLT_TRANS + 3: + msg ="Translation fault" ; + *level = fsc &FSC_LL_MASK ; +break ; + case FSC_FLT_ACCESS ... FSC_FLT_ACCESS + 3: + msg ="Access fault" ; + *level = fsc &FSC_LL_MASK ; +break ; + case FSC_FLT_PERM ... FSC_FLT_PERM + 3: + msg ="Permission fault" ; + *level = fsc &FSC_LL_MASK ; +break ; + +case FSC_SEA : + msg ="Synchronous External Abort" ; +break ; +case FSC_SPE : + msg ="Memory Access Synchronous Parity Error" ; +break ; +case FSC_APE : + msg ="Memory Access Asynchronous Parity Error" ; +break ; + case FSC_SEATT ... FSC_SEATT + 3: + msg ="Sync. Ext. Abort Translation Table" ; + *level = fsc &FSC_LL_MASK ; +break ; + case FSC_SPETT ... FSC_SPETT + 3: + msg ="Sync. Parity. Error Translation Table" ; + *level = fsc &FSC_LL_MASK ; +break ; +case FSC_AF : + msg ="Alignment Fault" ; +break ; +case FSC_DE : + msg ="Debug Event" ; +break ; + +case FSC_LKD : + msg ="Implementation Fault: Lockdown Abort" ; +break ; +case FSC_CPR : + msg ="Implementation Fault: Coprocossor Abort" ; +break ; + +default : + msg ="Unknown Failure" ; +break ; + } +return msg; +} + +static const char *fsc_level_str (int level) +{ +switch ( level ) + { +case -1 :return "" ; +case 1 :return " at level 1" ; +case 2 :return " at level 2" ; +case 3 :return " at level 3" ; +default :return " (level invalid)" ; + } +} + +void panic_PAR (uint64_t par,const char *when) +{ +if ( par &PAR_F ) + { +const char *msg; +int level =-1 ; +int stage = par &PAR_STAGE2 ?2 :1 ; +int second_in_first = !!(par &PAR_STAGE21 ); + + msg =decode_fsc ( (par&PAR_FSC_MASK ) >>PAR_FSC_SHIFT , &level); + +printk ("PAR: %010" PRIx64": %s stage %d%s%s\n" , + par, msg, + stage, + second_in_first ?" during second stage lookup" :"" , +fsc_level_str (level)); + } +else + { +printk ("PAR: %010" PRIx64": paddr:%010" PRIx64 +" attr %" PRIx64" sh %" PRIx64" %s\n" , + par, par &PADDR_MASK , par >>PAR_MAIR_SHIFT , + (par &PAR_SH_MASK ) >>PAR_SH_SHIFT , + (par &PAR_NS ) ?"Non-Secure" :"Secure" ); + } +panic ("Error during %s-to-physical address translation\n" , when); +} + +void show_registers (struct cpu_user_regs *regs) +{ +static const char *mode_strings[] = { + [PSR_MODE_USR ] ="USR" , + [PSR_MODE_FIQ ] ="FIQ" , + [PSR_MODE_IRQ ] ="IRQ" , + [PSR_MODE_SVC ] ="SVC" , + [PSR_MODE_MON ] ="MON" , + [PSR_MODE_ABT ] ="ABT" , + [PSR_MODE_HYP ] ="HYP" , + [PSR_MODE_UND ] ="UND" , + [PSR_MODE_SYS ] ="SYS" + }; + +print_xen_info (); +printk ("CPU: %d\n" ,smp_processor_id ()); +printk ("PC: %08" PRIx32, regs->pc); +if ( !guest_mode (regs) ) +print_symbol (" %s" , regs->pc); +printk ("\n" ); +printk ("CPSR: %08" PRIx32" MODE:%s\n" , regs->cpsr, + mode_strings[regs->cpsr &PSR_MODE_MASK ]); +printk (" R0: %08" PRIx32" R1: %08" PRIx32" R2: %08" PRIx32" R3: %08" PRIx32"\n" , + regs->r0, regs->r1, regs->r2, regs->r3); +printk (" R4: %08" PRIx32" R5: %08" PRIx32" R6: %08" PRIx32" R7: %08" PRIx32"\n" , + regs->r4, regs->r5, regs->r6, regs->r7); +printk (" R8: %08" PRIx32" R9: %08" PRIx32" R10:%08" PRIx32" R11:%08" PRIx32" R12:%08" PRIx32"\n" , + regs->r8, regs->r9, regs->r10, regs->r11, regs->r12); + +if (guest_mode (regs) ) + { +printk ("USR: SP: %08" PRIx32" LR: %08" PRIx32" CPSR:%08" PRIx32"\n" , + regs->sp_usr, regs->lr_usr, regs->cpsr); +printk ("SVC: SP: %08" PRIx32" LR: %08" PRIx32" SPSR:%08" PRIx32"\n" , + regs->sp_svc, regs->lr_svc, regs->spsr_svc); +printk ("ABT: SP: %08" PRIx32" LR: %08" PRIx32" SPSR:%08" PRIx32"\n" , + regs->sp_abt, regs->lr_abt, regs->spsr_abt); +printk ("UND: SP: %08" PRIx32" LR: %08" PRIx32" SPSR:%08" PRIx32"\n" , + regs->sp_und, regs->lr_und, regs->spsr_und); +printk ("IRQ: SP: %08" PRIx32" LR: %08" PRIx32" SPSR:%08" PRIx32"\n" , + regs->sp_irq, regs->lr_irq, regs->spsr_irq); +printk ("FIQ: SP: %08" PRIx32" LR: %08" PRIx32" SPSR:%08" PRIx32"\n" , + regs->sp_fiq, regs->lr_fiq, regs->spsr_fiq); +printk ("FIQ: R8: %08" PRIx32" R9: %08" PRIx32" R10:%08" PRIx32" R11:%08" PRIx32" R12:%08" PRIx32"\n" , + regs->r8_fiq, regs->r9_fiq, regs->r10_fiq, regs->r11_fiq, regs->r11_fiq); +printk ("\n" ); +printk ("TTBR0 %08" PRIx32" TTBR1 %08" PRIx32" TTBCR %08" PRIx32"\n" , +READ_CP32 (TTBR0 ),READ_CP32 (TTBR1 ),READ_CP32 (TTBCR )); +printk ("SCTLR %08" PRIx32"\n" ,READ_CP32 (SCTLR )); +printk ("VTTBR %010" PRIx64"\n" ,READ_CP64 (VTTBR )); +printk ("\n" ); + } +else + { +printk (" SP: %08" PRIx32" LR: %08" PRIx32"\n" , regs->sp, regs->lr); +printk ("\n" ); + } + +printk ("HTTBR %" PRIx64"\n" ,READ_CP64 (HTTBR )); +printk ("HDFAR %" PRIx32"\n" ,READ_CP32 (HDFAR )); +printk ("HIFAR %" PRIx32"\n" ,READ_CP32 (HIFAR )); +printk ("HPFAR %" PRIx32"\n" ,READ_CP32 (HPFAR )); +printk ("HCR %08" PRIx32"\n" ,READ_CP32 (HCR )); +printk ("HSR %" PRIx32"\n" ,READ_CP32 (HSR )); +printk ("\n" ); + +printk ("DFSR %" PRIx32" DFAR %" PRIx32"\n" ,READ_CP32 (DFSR ),READ_CP32 (DFAR )); +printk ("IFSR %" PRIx32" IFAR %" PRIx32"\n" ,READ_CP32 (IFSR ),READ_CP32 (IFAR )); +printk ("\n" ); +} + +static void show_guest_stack (struct cpu_user_regs *regs) +{ +printk ("GUEST STACK GOES HERE\n" ); +} + +#define STACK_BEFORE_EXCEPTION (regs) ((uint32_t*)(regs)->sp) + +static void show_trace (struct cpu_user_regs *regs) +{ +uint32_t *frame, next, addr, low, high; + +printk ("Xen call trace:\n " ); + +printk ("[<%p>]" ,_p (regs->pc)); +print_symbol (" %s\n " , regs->pc); + +/* Bounds for range of valid frame pointer. */ + low = (uint32_t )(STACK_BEFORE_EXCEPTION (regs)/* - 2*/ ); + high = (low & ~(STACK_SIZE -1 )) + + (STACK_SIZE -sizeof (struct cpu_info )); + +/* Frame: +* (largest address) +* | cpu_info +* | [...] | +* | return addr <-----------------, | +* | fp --------------------------------+----' +* | [...] | +* | return addr <------------, | +* | fp ---------------------------+----' +* | [...] | +* | return addr <- regs->fp | +* | fp ---------------------------' +* | +* v (smallest address, sp) +*/ + +/* The initial frame pointer. */ + next = regs->fp; + +for ( ; ; ) + { +if ( (next < low) || (next >= high) ) +break ; + { +/* Ordinary stack frame. */ + frame = (uint32_t *)next; + next = frame[-1 ]; + addr = frame[0 ]; + } + +printk ("[<%p>]" ,_p (addr)); +print_symbol (" %s\n " , addr); + + low = (uint32_t )&frame[1 ]; + } + +printk ("\n" ); +} + +void show_stack (struct cpu_user_regs *regs) +{ +uint32_t *stack =STACK_BEFORE_EXCEPTION (regs), addr; +int i; + +if (guest_mode (regs) ) +return show_guest_stack (regs); + +printk ("Xen stack trace from sp=%p:\n " , stack); + +for ( i =0 ; i < (debug_stack_lines*stack_words_per_line); i++ ) + { +if ( ((long )stack & (STACK_SIZE -BYTES_PER_LONG )) ==0 ) +break ; +if ( (i !=0 ) && ((i % stack_words_per_line) ==0 ) ) +printk ("\n " ); + + addr = *stack++; +printk (" %p" ,_p (addr)); + } +if ( i ==0 ) +printk ("Stack empty." ); +printk ("\n" ); + +show_trace (regs); +} + +void show_execution_state (struct cpu_user_regs *regs) +{ +show_registers (regs); +show_stack (regs); +} + +static void do_unexpected_trap (const char *msg,struct cpu_user_regs *regs) +{ +printk ("Unexpected Trap: %s\n" , msg); +show_execution_state (regs); +while (1 ); +} + +asmlinkage void do_trap_undefined_instruction(struct cpu_user_regs *regs) +{ +do_unexpected_trap ("Undefined Instruction" , regs); +} + +asmlinkage void do_trap_supervisor_call(struct cpu_user_regs *regs) +{ +do_unexpected_trap ("Supervisor Call" , regs); +} + +asmlinkage void do_trap_prefetch_abort(struct cpu_user_regs *regs) +{ +do_unexpected_trap ("Prefetch Abort" , regs); +} + +asmlinkage void do_trap_data_abort(struct cpu_user_regs *regs) +{ +do_unexpected_trap ("Data Abort" , regs); +} + +unsigned long do_arch_0 (unsigned int cmd,unsigned long long value) +{ +printk ("do_arch_0 cmd=%x arg=%llx\n" , cmd, value); +return 0 ; +} + +typedef unsigned long arm_hypercall_t ( +unsigned int ,unsigned int ,unsigned int ,unsigned int ,unsigned int , +unsigned int ,unsigned int ,unsigned int ,unsigned int ,unsigned int ); + +#define HYPERCALL (x) \ + [ __HYPERVISOR_ ## x ] = (arm_hypercall_t *) do_ ## x + +static arm_hypercall_t *arm_hypercall_table[] = { +HYPERCALL (arch_0), +HYPERCALL (sched_op), +HYPERCALL (console_io), +}; + +static void do_debug_trap (struct cpu_user_regs *regs,unsigned int code) +{ +uint32_t reg, *r; + +switch ( code ) { + case 0xe0 ... 0xef: + reg = code -0xe0 ; + r = ®s->r0 + reg; +printk ("R%d = %#010" PRIx32" at %#010" PRIx32"\n" , reg, *r, regs->pc); +break ; +case 0xfd : +printk ("Reached %08" PRIx32"\n" , regs->pc); +break ; +case 0xfe : +printk ("%c" , (char )(regs->r0 &0xff )); +break ; +case 0xff : +printk ("DEBUG\n" ); +show_execution_state (regs); +break ; +default : +panic ("Unhandled debug trap %#x\n" , code); +break ; + } +} + +static void do_trap_hypercall (struct cpu_user_regs *regs,unsigned long iss) +{ +local_irq_enable (); + + regs->r0 = arm_hypercall_table[iss](regs->r0, + regs->r1, + regs->r2, + regs->r3, + regs->r4, + regs->r5, + regs->r6, + regs->r7, + regs->r8, + regs->r9); +} + +static void do_cp15_32 (struct cpu_user_regs *regs, +union hsr hsr) +{ +struct hsr_cp32 cp32 = hsr.cp32; +uint32_t *r = ®s->r0 + cp32.reg; + +if ( !cp32.ccvalid ) { +dprintk (XENLOG_ERR ,"cp_15(32): need to handle invalid condition codes\n" ); +domain_crash_synchronous (); + } +if ( cp32.cc !=0xe ) { +dprintk (XENLOG_ERR ,"cp_15(32): need to handle condition codes %x\n" , + cp32.cc); +domain_crash_synchronous (); + } + +switch ( hsr.bits &HSR_CP32_REGS_MASK ) + { +case HSR_CPREG32 (CLIDR ): +if ( !cp32.read ) + { +dprintk (XENLOG_ERR , +"attempt to write to read-only register CLIDR\n" ); +domain_crash_synchronous (); + } + *r =READ_CP32 (CLIDR ); +break ; +case HSR_CPREG32 (CCSIDR ): +if ( !cp32.read ) + { +dprintk (XENLOG_ERR , +"attempt to write to read-only register CSSIDR\n" ); +domain_crash_synchronous (); + } + *r =READ_CP32 (CCSIDR ); +break ; +case HSR_CPREG32 (DCCISW ): +if ( cp32.read ) + { +dprintk (XENLOG_ERR , +"attempt to read from write-only register DCCISW\n" ); +domain_crash_synchronous (); + } +WRITE_CP32 (*r,DCCISW ); +break ; +case HSR_CPREG32 (CNTP_CTL ): +case HSR_CPREG32 (CNTP_TVAL ): +/* emulate timer */ +break ; +default : +printk ("%s p15, %d, r%d, cr%d, cr%d, %d @ %#08x\n" , + cp32.read ?"mrc" :"mcr" , + cp32.op1, cp32.reg, cp32.crn, cp32.crm, cp32.op2, regs->pc); +panic ("unhandled 32-bit CP15 access %#x\n" , hsr.bits &HSR_CP32_REGS_MASK ); + } + regs->pc += cp32.len ?4 :2 ; + +} + +static void do_cp15_64 (struct cpu_user_regs *regs, +union hsr hsr) +{ +struct hsr_cp64 cp64 = hsr.cp64; + +if ( !cp64.ccvalid ) { +dprintk (XENLOG_ERR ,"cp_15(64): need to handle invalid condition codes\n" ); +domain_crash_synchronous (); + } +if ( cp64.cc !=0xe ) { +dprintk (XENLOG_ERR ,"cp_15(64): need to handle condition codes %x\n" , + cp64.cc); +domain_crash_synchronous (); + } + +switch ( hsr.bits &HSR_CP64_REGS_MASK ) + { +case HSR_CPREG64 (CNTPCT ): +/* emulate timer */ +break ; +default : +printk ("%s p15, %d, r%d, r%d, cr%d @ %#08x\n" , + cp64.read ?"mrrc" :"mcrr" , + cp64.op1, cp64.reg1, cp64.reg2, cp64.crm, regs->pc); +panic ("unhandled 64-bit CP15 access %#x\n" , hsr.bits &HSR_CP64_REGS_MASK ); + } + regs->pc += cp64.len ?4 :2 ; + +} + +static void do_trap_data_abort_guest (struct cpu_user_regs *regs, +struct hsr_dabt dabt) +{ +const char *msg; +int level =-1 ; +mmio_info_t info; + +if (dabt.s1ptw) + goto bad_data_abort; + + info.dabt = dabt; + info.gva =READ_CP32 (HDFAR ); + info.gpa =gva_to_ipa (info.gva); + +if (handle_mmio (&info)) + { + regs->pc += dabt.len ?4 :2 ; +return ; + } + +bad_data_abort: + + msg =decode_fsc ( dabt.dfsc, &level); + +printk ("Guest data abort: %s%s%s\n" +" gva=%" PRIx32" gpa=%" PRIpaddr"\n" , + msg, dabt.s1ptw ?" S2 during S1" :"" , +fsc_level_str (level), + info.gva, info.gpa); +if (dabt.valid) +printk (" size=%d sign=%d write=%d reg=%d\n" , + dabt.size, dabt.sign, dabt.write, dabt.reg); +else +printk (" instruction syndrome invalid\n" ); +printk (" eat=%d cm=%d s1ptw=%d dfsc=%d\n" , + dabt.eat, dabt.cache, dabt.s1ptw, dabt.dfsc); + +show_execution_state (regs); +panic ("Unhandled guest data abort\n" ); +} + +asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs) +{ +union hsr hsr = { .bits =READ_CP32 (HSR ) }; + +switch (hsr.ec) { +case HSR_EC_CP15_32 : +do_cp15_32 (regs, hsr); +break ; +case HSR_EC_CP15_64 : +do_cp15_64 (regs, hsr); +break ; +case HSR_EC_HVC : +if ( (hsr.iss &0xff00 ) ==0xff00 ) +return do_debug_trap (regs, hsr.iss &0x00ff ); +do_trap_hypercall (regs, hsr.iss); +break ; +case HSR_EC_DATA_ABORT_GUEST : +do_trap_data_abort_guest (regs, hsr.dabt); +break ; +default : +printk ("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=%" PRIx32"\n" , + hsr.bits, hsr.ec, hsr.len, hsr.iss); +do_unexpected_trap ("Hypervisor" , regs); + } +} + +asmlinkage void do_trap_irq(struct cpu_user_regs *regs) +{ +gic_interrupt (regs,0 ); +} + +asmlinkage void do_trap_fiq(struct cpu_user_regs *regs) +{ +gic_interrupt (regs,1 ); +} + +asmlinkage void leave_hypervisor_tail(void) +{ +while (1 ) + { +local_irq_disable (); +if (!softirq_pending (smp_processor_id ())) +return ; +local_irq_enable (); +do_softirq (); + } +} + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
Signature · 1 line
1.7.2.5
PATCH v6 23/27 arm: vgic emulation
In reply to Stefano Stabellini- emulation of the GICD interface for the guest;
- interrupt injection into the guest;
- keep track of inflight irqs using a list, ordered by priority.
Changes in v5:
- GICD_ICFGR ... GICD_ICFGRN need to return 1.
--- xen/arch/arm/domain.c | 6 + xen/arch/arm/gic.h | 3 + xen/arch/arm/io.c | 1 + xen/arch/arm/io.h | 2 + xen/arch/arm/irq.c | 3 +- xen/arch/arm/vgic.c | 605 ++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/domain.h | 30 ++ 7 files changed, 649 insertions(+), 1 deletions(-) create mode 100644 xen/arch/arm/vgic.c
xen/arch/arm/domain.c +6 -0
@@ -212,6 +212,9 @@ int vcpu_initialise(struct vcpu *v) {int rc =0 ; +if ( (rc =vcpu_vgic_init (v)) !=0 ) +return rc; +return rc; }
@@ -230,6 +233,9 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags) d->max_vcpus =8 ; +if ( (rc =domain_vgic_init (d)) !=0 ) + goto fail; + rc =0 ; fail:return rc;
xen/arch/arm/gic.h +3 -0
@@ -121,6 +121,9 @@#define GICH_LR_CPUID_SHIFT 9#define GICH_VTR_NRLRGS 0x3f +extern int domain_vgic_init (struct domain *d); +extern int vcpu_vgic_init (struct vcpu *v); +extern void vgic_vcpu_inject_irq (struct vcpu *v,unsigned int irq,int virtual);extern struct pending_irq *irq_to_pending (struct vcpu *v,unsigned int irq);extern void gic_route_irqs (void );
xen/arch/arm/io.c +1 -0
@@ -24,6 +24,7 @@static const struct mmio_handler *const mmio_handlers[] = { + &vgic_distr_mmio_handler, };#define MMIO_HANDLER_NR ARRAY_SIZE(mmio_handlers)
xen/arch/arm/io.h +2 -0
@@ -39,6 +39,8 @@ struct mmio_handler { mmio_write_t write_handler; }; +extern const struct mmio_handler vgic_distr_mmio_handler; +extern int handle_mmio (mmio_info_t *info);#endif
xen/arch/arm/irq.c +2 -1
@@ -136,7 +136,8 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) desc->status |=IRQ_INPROGRESS ; -/* XXX: inject irq into the guest */ +/* XXX: inject irq into all guest vcpus */ +vgic_vcpu_inject_irq (d->vcpu[0 ], irq,0 ); goto out_no_end; }
xen/arch/arm/vgic.c new file +605 -0
605 lines not on this page · raw message
xen/include/asm-arm/domain.h +30 -0
@@ -6,6 +6,15 @@#include <asm/page.h> #include <asm/p2m.h> +/* Represents state corresponding to a block of 32 interrupts */ +struct vgic_irq_rank { +spinlock_t lock;/* Covers access to all other members of this struct */ +uint32_t ienable, iactive, ipend, pendsgi; +uint32_t icfg[2 ]; +uint32_t ipriority[8 ]; +uint32_t itargets[8 ]; +}; +struct pending_irq {int irq;
@@ -18,6 +27,22 @@ struct arch_domain {struct p2m_domain p2m; +struct { +/* +* Covers access to other members of this struct _except_ for +* shared_irqs where each member contains its own locking. +* +* If both class of lock is required then this lock must be +* taken first. If multiple rank locks are required (including +* the per-vcpu private_irqs rank) then they must be taken in +* rank order. +*/ +spinlock_t lock; +int ctlr; +int nr_lines; +struct vgic_irq_rank *shared_irqs; +struct pending_irq *pending_irqs; + } vgic; } __cacheline_aligned;struct arch_vcpu
@@ -27,6 +52,11 @@ struct arch_vcpuuint32_t sctlr;uint32_t ttbr0, ttbr1, ttbcr; +struct { +struct vgic_irq_rank private_irqs; +struct list_head inflight_irqs; +spinlock_t lock; + } vgic; } __cacheline_aligned;void vcpu_show_execution_state (struct vcpu *);
Signature · 1 line
1.7.2.5
PATCH v6 24/27 arm: vtimer
In reply to Stefano StabelliniEmulation of the generic timer kernel registers.
--- xen/arch/arm/domain.c | 4 + xen/arch/arm/traps.c | 4 +- xen/arch/arm/vtimer.c | 148 ++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/vtimer.h | 35 ++++++++++ xen/include/asm-arm/domain.h | 7 ++ 5 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 xen/arch/arm/vtimer.c create mode 100644 xen/arch/arm/vtimer.h
xen/arch/arm/domain.c +4 -0
@@ -12,6 +12,7 @@#include <asm/irq.h> #include "gic.h" +#include "vtimer.h" DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
@@ -215,6 +216,9 @@ int vcpu_initialise(struct vcpu *v)if ( (rc =vcpu_vgic_init (v)) !=0 )return rc; +if ( (rc =vcpu_vtimer_init (v)) !=0 ) +return rc; +return rc; }
xen/arch/arm/traps.c +2 -2
@@ -468,7 +468,7 @@ static void do_cp15_32(struct cpu_user_regs *regs,break ;case HSR_CPREG32 (CNTP_CTL ):case HSR_CPREG32 (CNTP_TVAL ): -/* emulate timer */ +BUG_ON (!vtimer_emulate (regs, hsr));break ;default : printk("%s p15, %d, r%d, cr%d, cr%d, %d @ %#08x\n",
@@ -498,7 +498,7 @@ static void do_cp15_64(struct cpu_user_regs *regs,switch ( hsr.bits &HSR_CP64_REGS_MASK ) {case HSR_CPREG64 (CNTPCT ): -/* emulate timer */ +BUG_ON (!vtimer_emulate (regs, hsr));break ;default : printk("%s p15, %d, r%d, r%d, cr%d @ %#08x\n",
xen/arch/arm/vtimer.c new file +148 -0
148 lines not on this page · raw message
xen/arch/arm/vtimer.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* xen/arch/arm/vtimer.h +* +* ARM Virtual Timer emulation support +* +* Ian Campbell <[email protected]> +* Copyright (c) 2011 Citrix Systems. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __ARCH_ARM_VTIMER_H__ +#define __ARCH_ARM_VTIMER_H__ + +extern int vcpu_vtimer_init (struct vcpu *v); +extern int vtimer_emulate (struct cpu_user_regs *regs,union hsr hsr); + +#endif + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/domain.h +7 -0
@@ -57,6 +57,13 @@ struct arch_vcpustruct list_head inflight_irqs;spinlock_t lock; } vgic; + +struct { +struct timer timer; +uint32_t ctl; +s_time_t offset; +s_time_t cval; + } vtimer; } __cacheline_aligned;void vcpu_show_execution_state (struct vcpu *);
Signature · 1 line
1.7.2.5
PATCH v6 25/27 arm: makefiles
In reply to Stefano StabelliniMakefile and config options for the ARM architecture.
Changes in v2:
- move patch at the end of the series.
--- config/arm.mk | 18 +++++++++++ xen/arch/arm/Makefile | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/Rules.mk | 29 ++++++++++++++++++ 3 files changed, 123 insertions(+), 0 deletions(-) create mode 100644 config/arm.mk create mode 100644 xen/arch/arm/Makefile create mode 100644 xen/arch/arm/Rules.mk
config/arm.mk new file +18 -0
@@ -0,0 +1,18 @@ +CONFIG_ARM := y +CONFIG_ARM_32 := y +CONFIG_ARM_$(XEN_OS) := y + +# -march= -mcpu= + +# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb: +CFLAGS += -marm + +HAS_PL011 := y + +# Use only if calling $(LD) directly. +#LDFLAGS_DIRECT_OpenBSD = _obsd +#LDFLAGS_DIRECT_FreeBSD = _fbsd +LDFLAGS_DIRECT_Linux = _linux +LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi + +CONFIG_LOAD_ADDRESS ?= 0x80000000
xen/arch/arm/Makefile new file +76 -0
76 lines not on this page · raw message
xen/arch/arm/Rules.mk new file +29 -0
@@ -0,0 +1,29 @@ +######################################## +# arm-specific definitions + +# +# If you change any of these configuration options then you must +# 'make clean' before rebuilding. +# + +CFLAGS += -fno-builtin -fno-common -Wredundant-decls +CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe +CFLAGS += -I$(BASEDIR)/include + +# Prevent floating-point variables from creeping into Xen. +CFLAGS += -msoft-float + +$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) +$(call cc-option-add,CFLAGS,CC,-Wnested-externs) + +arm := y + +ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n) +CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE +endif + +CFLAGS += -march=armv7-a -mcpu=cortex-a15 + +# Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers) +check-$(gcc) = $(call cc-ver-check,CC,0x030400,"Xen requires at least gcc-3.4") +$(eval $(check-y))
Signature · 1 line
1.7.2.5
Re: [PATCH v6 25/27] arm: makefiles
Quoted 6 lines · Stefano Stabellini
Makefileand config options for the ARM architecture.Changes in v2:
- move patch at the end of the series.
The other generic patches of this series have been applied, but this one hasn't. Could you please apply this patch or tell me whether I have to change something?
Quoted 157 lines
Signed-off-by Stefano Stabellini <[email protected]>Signed-off-by Ian Campbell <[email protected]>Signed-off-by Tim Deegan <[email protected]>--- config/arm.mk | 18 +++++++++++ xen/arch/arm/Makefile | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/Rules.mk | 29 ++++++++++++++++++ 3 files changed, 123 insertions(+), 0 deletions(-) create mode 100644 config/arm.mk create mode 100644 xen/arch/arm/Makefile create mode 100644 xen/arch/arm/Rules.mkconfig/arm.mk new file +18
-0@@ -0,0 +1,18 @@ +CONFIG_ARM := y +CONFIG_ARM_32 := y +CONFIG_ARM_$(XEN_OS) := y + +# -march= -mcpu= + +# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb: +CFLAGS += -marm + +HAS_PL011 := y + +# Use only if calling $(LD) directly. +#LDFLAGS_DIRECT_OpenBSD = _obsd +#LDFLAGS_DIRECT_FreeBSD = _fbsd +LDFLAGS_DIRECT_Linux = _linux +LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi + +CONFIG_LOAD_ADDRESS ?= 0x80000000xen/arch/arm/Makefile new file +76
-0@@ -0,0 +1,76 @@ +subdir-y += lib + +obj-y += dummy.o +obj-y += entry.o +obj-y += domain.o +obj-y += domain_build.o +obj-y += gic.o +obj-y += io.o +obj-y += irq.o +obj-y += mm.o +obj-y += p2m.o +obj-y += guestcopy.o +obj-y += setup.o +obj-y += time.o +obj-y += smpboot.o +obj-y += smp.o +obj-y += shutdown.o +obj-y += traps.o +obj-y += vgic.o +obj-y += vtimer.o + +#obj-bin-y += ....o + +ALL_OBJS := head.o $(ALL_OBJS) + +$(TARGET): $(TARGET)-syms + # XXX: VE model loads by VMA so instead of + # making a proper ELF we link with LMA == VMA and adjust crudely + $(OBJCOPY) --change-addresses +0x7fe00000 $< $@ + # XXX strip it + +#$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 +# ./boot/mkelf32 $(TARGET)-syms $(TARGET) 0x100000 \ +# `$(NM) -nr $(TARGET)-syms | head -n 1 | sed -e 's/^\([^ ]*\).*/0x\1/'` + +ifeq ($(lto),y) +# Gather all LTO objects together +prelink_lto.o: $(ALL_OBJS) + $(LD_LTO) -r -o $@ $^ + +# Link it with all the binary objects +prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o + $(LD) $(LDFLAGS) -r -o $@ $^ +else +prelink.o: $(ALL_OBJS) + $(LD) $(LDFLAGS) -r -o $@ $^ +endif + +$(BASEDIR)/common/symbols-dummy.o: + $(MAKE) -f $(BASEDIR)/Rules.mk -C $(BASEDIR)/common symbols-dummy.o + +$(TARGET)-syms: prelink.o xen.lds $(BASEDIR)/common/symbols-dummy.o + $(LD) $(LDFLAGS) -T xen.lds -N prelink.o \ + $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 + $(NM) -n $(@D)/.$(@F).0 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).0.S + $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o + $(LD) $(LDFLAGS) -T xen.lds -N prelink.o \ + $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1 + $(NM) -n $(@D)/.$(@F).1 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).1.S + $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o + $(LD) $(LDFLAGS) -T xen.lds -N prelink.o \ + $(@D)/.$(@F).1.o -o $@ + rm -f $(@D)/.$(@F).[0-9]* + +asm-offsets.s: asm-offsets.c + $(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $< + +xen.lds: xen.lds.S + $(CC) -P -E -Ui386 $(AFLAGS) -DXEN_PHYS_START=$(CONFIG_LOAD_ADDRESS) -o $@ $< + sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new + mv -f .xen.lds.d.new .xen.lds.d + +.PHONY: clean +clean:: + rm -f asm-offsets.s xen.lds + rm -f $(BASEDIR)/.xen-syms.[0-9]*xen/arch/arm/Rules.mk new file +29
-0@@ -0,0 +1,29 @@ +######################################## +# arm-specific definitions + +# +# If you change any of these configuration options then you must +# 'make clean' before rebuilding. +# + +CFLAGS += -fno-builtin -fno-common -Wredundant-decls +CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe +CFLAGS += -I$(BASEDIR)/include + +# Prevent floating-point variables from creeping into Xen. +CFLAGS += -msoft-float + +$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) +$(call cc-option-add,CFLAGS,CC,-Wnested-externs) + +arm := y + +ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n) +CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE +endif + +CFLAGS += -march=armv7-a -mcpu=cortex-a15 + +# Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers) +check-$(gcc) = $(call cc-ver-check,CC,0x030400,"Xen requires at least gcc-3.4") +$(eval $(check-y))Signature · 1 line
1.7.2.5
PATCH v6 26/27 ARM: support zImage format kernels for dom0
In reply to Stefano StabelliniFrom: David Vrabel <[email protected]>
Allow a zImage format kernel to be used for dom0. zImages are (by default) hardcoded with the RAM location so adjust the RAM in the memory map to match the physical memory map (0x80000000).
Vmlinux ELF images are loaded using a hack to locate the RAM so the IPA is the same as the kernel's VA so the elf loader does the right thing. If an ELF image is loaded the RAM will be located at 0xC0000000 (as before).
--- xen/arch/arm/Makefile | 1 + xen/arch/arm/domain_build.c | 72 ++++-------------- xen/arch/arm/kernel.c | 167 +++++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/kernel.h | 37 ++++++++++ 4 files changed, 221 insertions(+), 56 deletions(-) create mode 100644 xen/arch/arm/kernel.c create mode 100644 xen/arch/arm/kernel.h
xen/arch/arm/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-y += domain_build.o obj-y += gic.o obj-y += io.o obj-y += irq.o +obj-y += kernel.o obj-y += mm.o obj-y += p2m.o obj-y += guestcopy.o
xen/arch/arm/domain_build.c +16 -56
130 lines not on this page · raw message
xen/arch/arm/kernel.c new file +167 -0
167 lines not on this page · raw message
xen/arch/arm/kernel.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Kernel image loading. +* +* Copyright (C) 2011 Citrix Systems, Inc. +*/ +#ifndef __ARCH_ARM_KERNEL_H__ +#define __ARCH_ARM_KERNEL_H__ + +#include <xen/libelf.h> + +struct kernel_info { +paddr_t entry; +paddr_t ram_start; +paddr_t ram_end; + +void *kernel_img; +unsigned kernel_order; + +union { +struct { +paddr_t load_addr; +paddr_t len; + } zimage; + +struct { +struct elf_binary elf; +struct elf_dom_parms parms; + } elf; + }; + +void (*load)(struct kernel_info *info); +}; + +int kernel_prepare (struct kernel_info *info); +void kernel_load (struct kernel_info *info); + +#endif /* #ifdef __ARCH_ARM_KERNEL_H__ */
Signature · 1 line
1.7.2.5
PATCH v6 27/27 ARM: copy DTB appended to zImage
In reply to Stefano StabelliniFrom: David Vrabel <[email protected]>
When copying a zImage from flash, also copy any appended device tree blob.
--- xen/arch/arm/kernel.c | 63 ++++++++++++++++++++++++++++++++++-------------- 1 files changed, 44 insertions(+), 19 deletions(-)
xen/arch/arm/kernel.c +44 -19
@@ -10,6 +10,7 @@#include <xen/mm.h> #include <xen/domain_page.h> #include <xen/sched.h> +#include <asm/byteorder.h> #include "kernel.h"
@@ -23,6 +24,40 @@#define ZIMAGE_MAGIC 0x016f2818 +struct minimal_dtb_header { +uint32_t magic; +uint32_t total_size; +/* There are other fields but we don't use them yet. */ +}; + +#define DTB_MAGIC 0xd00dfeed + +static void copy_from_flash (void *dst,paddr_t flash,unsigned long len) +{ +void *src = (void *)FIXMAP_ADDR (FIXMAP_MISC ); + +printk ("Copying %#lx bytes from flash %" PRIpaddr" to %p" , + len, flash, dst); + +while (len) { +paddr_t p; +unsigned long l, s; + + p = flash >>PAGE_SHIFT ; + s = flash & (PAGE_SIZE -1 ); + l =min (PAGE_SIZE - s, len); + +set_fixmap (FIXMAP_MISC , p,DEV_SHARED ); +memcpy (dst, src + s, l); + + flash += l; + dst += l; + len -= l; + } + +clear_fixmap (FIXMAP_MISC ); +} +static void kernel_zimage_load (struct kernel_info *info) {paddr_t load_addr = info->zimage.load_addr;
@@ -58,6 +93,7 @@ static int kernel_try_zimage_prepare(struct kernel_info *info) {uint32_t *zimage = (void *)FIXMAP_ADDR (FIXMAP_MISC );uint32_t start, end; +struct minimal_dtb_header dtb_hdr;set_fixmap (FIXMAP_MISC ,KERNEL_FLASH_ADDRESS >>PAGE_SHIFT ,DEV_SHARED );
@@ -69,6 +105,14 @@ static int kernel_try_zimage_prepare(struct kernel_info *info)clear_fixmap (FIXMAP_MISC ); +/* +* Check for an appended DTB. +*/ +copy_from_flash (&dtb_hdr,KERNEL_FLASH_ADDRESS + end - start,sizeof (dtb_hdr)); +if (be32_to_cpu (dtb_hdr.magic) ==DTB_MAGIC ) { + end +=be32_to_cpu (dtb_hdr.total_size); + } +/* FIXME: get RAM location from appended DTB (if there is one)? */ /*
@@ -97,25 +141,6 @@ static void kernel_elf_load(struct kernel_info *info)free_xenheap_pages (info->kernel_img, info->kernel_order); } -static void copy_from_flash (void *dst,paddr_t flash,unsigned long len) -{ -void *src = (void *)FIXMAP_ADDR (FIXMAP_MISC ); -unsigned long offs; - -printk ("Copying %#lx bytes from flash %" PRIpaddr" to %p-%p: [" , - len, flash, dst, dst+(1 <<23 )); -for ( offs =0 ; offs < len ; offs +=PAGE_SIZE ) - { -if ( ( offs % (1 <<20 ) ) ==0 ) -printk ("." ); -set_fixmap (FIXMAP_MISC , (flash+offs) >>PAGE_SHIFT ,DEV_SHARED ); -memcpy (dst+offs, src,PAGE_SIZE ); - } -printk ("]\n" ); - -clear_fixmap (FIXMAP_MISC ); -} -static int kernel_try_elf_prepare (struct kernel_info *info) {int rc;
Signature · 1 line
1.7.2.5
Quoted 8 lines · Stefano Stabellini
Hello everyone,
this is the sixth version of the patch series that introduces ARMv7 with virtualization extensions support in Xen.
The series allows Xen and Dom0 to boot on a Cortex-A15 based Versatile Express simulator.
See the following announce email for more informations about what we are trying to achieve, as well as the original git history:
Quoted 5 lines
See http://marc.info/?l=xen-devel&m=132257857628098&w=2
The first 7 patches affect generic Xen code and are not ARM specific; often they fix real issues, hidden in the default X86 configuration.
I have committed patches 7 (generic code, applied with Keir's ACK) and patches 8-24. However I stopped before applying #25 "arm: makefiles" because the full series failed to build with:
make[3]: Entering directory `/local/scratch/ianc/devel/committer.hg/xen/common'
/home/ianc/devel/cross/gcc-4.6.0-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc -O1 -fno-omit-frame-pointer -marm -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -fno-builtin -fno-common -Wredundant-decls -iwithprefix include -Werror -Wno-pointer-arith -pipe -I/local/scratch/ianc/devel/committer.hg/xen/include -msoft-float -fno-stack-protector -fno-exceptions -Wnested-externs -DGCC_HAS_VISIBILITY_ATTRIBUTE -march=armv7-a -mcpu=cortex-a15 -fno-optimize-sibling-calls -g -D__XEN__ -include /local/scratch/ianc/devel/committer.hg/xen/include/xen/config.h -DVERBOSE -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER -MMD -MF .event_channel.o.d -c event_channel.c -o event_channel.o
event_channel.c: In function 'domain_dump_evtchn_info':
event_channel.c:1297:13: error: implicit declaration of function 'domain_pirq_to_irq' [-Werror=implicit-function-declaration] event_channel.c:1297:13: error: nested extern declaration of 'domain_pirq_to_irq' [-Werror=nested-externs]
cc1: all warnings being treated as errors
domain_pirq_to_irq has been in the tree for quite some time so I guess something has changed wrt implicit #includes? Can you fixup and resend the fix plus the last three patches please.
Thanks,
Ian.
Quoted 3 lines · Ian Campbell
I have committed patches 7 (generic code, applied with Keir's ACK) and patches 8-24. However I stopped before applying #25 "arm: makefiles" because the full series failed to build with:
[...]
Quoted 3 lines
domain_pirq_to_irqhas been in the tree for quite some time so I guess something has changed wrt implicit #includes? Can you fixup and resend the fix plus the last three patches please.
I decided to do this. I'll follow up to this mail with the two patches which I needed to make this compile. Please ACK and I will insert them before "arm: makefiles" and commit the whole lot.
Ian.
PATCH 1/1 arm: define domain_pirq_to_irq
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328798112 0
# Node ID abd72cc240fa3d643541d435f3cb72b75c8a5977 # Parent 18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
arm: define domain_pirq_to_irq
xen/include/asm-arm/irq.h +3 -0
@@ -11,6 +11,7 @@ typedef struct {struct arch_pirq { +int irq; };struct irq_cfg {
@@ -19,6 +20,8 @@ struct irq_cfg {void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq); +#define domain_pirq_to_irq (d, pirq) pirq_field(d, pirq, arch.irq) +#endif /* _ASM_HW_IRQ_H */ /* * Local variables:
Re: [PATCH] arm: define domain_pirq_to_irq
Quoted 22 lines · Ian Campbell
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328798112 0
# Node IDabd72cc240fa3d643541d435f3cb72b75c8a5977# Parent18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
arm: definedomain_pirq_to_irqSigned-off-by Ian Campbell <[email protected]>diff -r
18b9ea53c8ac-rabd72cc240faxen/include/asm-arm/irq.hxen/include/asm-arm/irq.h +1
-0@@ -11,6 +11,7 @@ typedef struct {struct arch_pirq { +int irq; };struct irq_cfg {
xen/include/asm-arm/irq.h struct irq_cfg { · line 27
Quoted 8 lines
xen/include/asm-arm/irq.h +2
-0@@ -19,6 +20,8 @@ struct irq_cfg {void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq); +#define domain_pirq_to_irq (d, pirq) pirq_field(d, pirq, arch.irq) +#endif /* _ASM_HW_IRQ_H */ /* * Local variables:
At the moment we don't have a reason for having pirq != irq so we could just return irq, like ia64 does.
Otherwise I expect that we would need code to set arch.irq = pirq that at the moment we don't have.
Re: [PATCH] arm: define domain_pirq_to_irq
Quoted 25 lines · Stefano Stabellini
Quoted 24 lines · Ian Campbell
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328798112 0
# Node IDabd72cc240fa3d643541d435f3cb72b75c8a5977# Parent18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
arm: definedomain_pirq_to_irqSigned-off-by Ian Campbell <[email protected]>diff -r
18b9ea53c8ac-rabd72cc240faxen/include/asm-arm/irq.hxen/include/asm-arm/irq.h +1
-0@@ -11,6 +11,7 @@ typedef struct {struct arch_pirq { +int irq; };struct irq_cfg {@@ -19,6 +20,8 @@ struct irq_cfg {void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq);
Quoted 9 lines
xen/include/asm-arm/irq.h struct irq_cfg { · line 27
Quoted 6 lines
xen/include/asm-arm/irq.h +2
-0+#define domain_pirq_to_irq (d, pirq) pirq_field(d, pirq, arch.irq) +#endif /* _ASM_HW_IRQ_H */ /* * Local variables: At the moment we don't have a reason for having pirq != irq so we could just return irq, like ia64 does.
Good idea.
Quoted 2 lines
Otherwise I expect that we would need code to set arch.irq = pirq that at the moment we don't have.
Yes.
8<-----------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328800759 0
# Node ID daa129cac86315bad066f4c358bd02817985a8df # Parent 18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
arm: define domain_pirq_to_irq
xen/include/asm-arm/irq.h +2 -0
@@ -19,6 +19,8 @@ struct irq_cfg {void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq); +#define domain_pirq_to_irq (d, pirq) (pirq) +#endif /* _ASM_HW_IRQ_H */ /* * Local variables:
Re: [PATCH] arm: define domain_pirq_to_irq
Quoted 45 lines · Ian Campbell
Quoted 25 lines · Stefano Stabellini
Quoted 24 lines · Ian Campbell
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328798112 0
# Node IDabd72cc240fa3d643541d435f3cb72b75c8a5977# Parent18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
arm: definedomain_pirq_to_irqSigned-off-by Ian Campbell <[email protected]>diff -r
18b9ea53c8ac-rabd72cc240faxen/include/asm-arm/irq.hxen/include/asm-arm/irq.h +1
-0@@ -11,6 +11,7 @@ typedef struct {struct arch_pirq { +int irq; };struct irq_cfg {@@ -19,6 +20,8 @@ struct irq_cfg {void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq);Quoted 9 lines
xen/include/asm-arm/irq.h struct irq_cfg { · line 26
Quoted 6 lines
xen/include/asm-arm/irq.h +2
-0+#define domain_pirq_to_irq (d, pirq) pirq_field(d, pirq, arch.irq) +#endif /* _ASM_HW_IRQ_H */ /* * Local variables: At the moment we don't have a reason for having pirq != irq so we could just return irq, like ia64 does.
Good idea.
Quoted 2 lines
Otherwise I expect that we would need code to set arch.irq = pirq that at the moment we don't have.
Yes.
8<-----------------------------------
Quoted 8 lines
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328800759 0
# Node IDdaa129cac86315bad066f4c358bd02817985a8df# Parent18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
arm: definedomain_pirq_to_irqSigned-off-by Ian Campbell <[email protected]>
ack
Quoted 15 lines
diff -r
18b9ea53c8ac-rdaa129cac863xen/include/asm-arm/irq.hxen/include/asm-arm/irq.h +2
-0@@ -19,6 +19,8 @@ struct irq_cfg {void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq); +#define domain_pirq_to_irq (d, pirq) (pirq) +#endif /* _ASM_HW_IRQ_H */ /* * Local variables:
Re: [PATCH] arm: define domain_pirq_to_irq
Quoted 10 lines · Stefano Stabellini
Quoted 8 lines
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328800759 0
# Node IDdaa129cac86315bad066f4c358bd02817985a8df# Parent18b9ea53c8ac0e2d6aee68dd50a50c0b08a01a1e
arm: definedomain_pirq_to_irqSigned-off-by Ian Campbell <[email protected]>ack
Thanks. Both acks taken and pushed, along with the remainder of your series.
Ian.
PATCH 1/1 arm: define stub arch_dump_shared_mem_info
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328798113 0
# Node ID 565c304be85a6b28e6c12c9f849c07f6ee138aa4 # Parent abd72cc240fa3d643541d435f3cb72b75c8a5977
arm: define stub arch_dump_shared_mem_info
xen/arch/arm/mm.c +5 -1
@@ -1,4 +1,4 @@ -/* +/* * xen/arch/arm/mm.c * * MMU code for an ARMv7-A with virt extensions.
@@ -311,6 +311,10 @@ void __init setup_frametable_mappings(pa frametable_virt_end =FRAMETABLE_VIRT_START + (nr_pages *sizeof (struct page_info )); } +void arch_dump_shared_mem_info (void ) +{ +} +/* * Local variables: * mode: C
Re: [PATCH] arm: define stub arch_dump_shared_mem_info
Quoted 13 lines · Ian Campbell
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328798113 0
# Node ID565c304be85a6b28e6c12c9f849c07f6ee138aa4# Parentabd72cc240fa3d643541d435f3cb72b75c8a5977
arm: define stubarch_dump_shared_mem_infoSigned-off-by Ian Campbell <[email protected]>diff -r
abd72cc240fa-r565c304be85axen/arch/arm/mm.c
xen/arch/arm/mm.c line 4
Quoted 5 lines
xen/arch/arm/mm.c +1
-1@@ -1,4 +1,4 @@ -/* +/* * xen/arch/arm/mm.c * * MMU code for an ARMv7-A with virt extensions.
I don't mean to be pedantic, but this change breaks the comment indentation
Re: [PATCH] arm: define stub arch_dump_shared_mem_info
Quoted 10 lines · Stefano Stabellini
Quoted 9 lines · Ian Campbell
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328798113 0
# Node ID565c304be85a6b28e6c12c9f849c07f6ee138aa4# Parentabd72cc240fa3d643541d435f3cb72b75c8a5977
arm: define stubarch_dump_shared_mem_infoSigned-off-by Ian Campbell <[email protected]>
Quoted 11 lines
xen/arch/arm/mm.c line 4
Quoted 9 lines
diff -r
abd72cc240fa-r565c304be85axen/arch/arm/mm.cxen/arch/arm/mm.c +1
-1@@ -1,4 +1,4 @@ -/* +/* * xen/arch/arm/mm.c * * MMU code for an ARMv7-A with virt extensions. I don't mean to be pedantic, but this change breaks the comment indentation
Pedantic is good. I accidentally typed something unrelated in the wrong window and didn't clean up quite enough, I should've looked more closely at the diff before posting. Fixed version below.
8<-------------------
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328800790 0
# Node ID 2f3d6a6626146c851f5b56aa84d23237cd46d795 # Parent daa129cac86315bad066f4c358bd02817985a8df
arm: define stub arch_dump_shared_mem_info
xen/arch/arm/mm.c +4 -0
@@ -311,6 +311,10 @@ void __init setup_frametable_mappings(pa frametable_virt_end =FRAMETABLE_VIRT_START + (nr_pages *sizeof (struct page_info )); } +void arch_dump_shared_mem_info (void ) +{ +} +/* * Local variables: * mode: C
Re: [PATCH] arm: define stub arch_dump_shared_mem_info
Quoted 27 lines · Ian Campbell
Quoted 10 lines · Stefano Stabellini
Quoted 9 lines · Ian Campbell
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328798113 0
# Node ID565c304be85a6b28e6c12c9f849c07f6ee138aa4# Parentabd72cc240fa3d643541d435f3cb72b75c8a5977
arm: define stubarch_dump_shared_mem_infoSigned-off-by Ian Campbell <[email protected]>Quoted 11 lines
xen/arch/arm/mm.c line 4
Quoted 9 lines
diff -r
abd72cc240fa-r565c304be85axen/arch/arm/mm.cxen/arch/arm/mm.c +1
-1@@ -1,4 +1,4 @@ -/* +/* * xen/arch/arm/mm.c * * MMU code for an ARMv7-A with virt extensions. I don't mean to be pedantic, but this change breaks the comment indentation
Pedantic is good. I accidentally typed something unrelated in the wrong window and didn't clean up quite enough, I should've looked more closely at the diff before posting. Fixed version below.
Quoted 8 lines
8<-------------------
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1328800790 0
# Node ID2f3d6a6626146c851f5b56aa84d23237cd46d795# Parentdaa129cac86315bad066f4c358bd02817985a8df
arm: define stubarch_dump_shared_mem_info
ack
Quoted 19 lines
Signed-off-by Ian Campbell <[email protected]>diff -r
daa129cac863-r2f3d6a662614xen/arch/arm/mm.cxen/arch/arm/mm.c +4
-0@@ -311,6 +311,10 @@ void __init setup_frametable_mappings(pa frametable_virt_end =FRAMETABLE_VIRT_START + (nr_pages *sizeof (struct page_info )); } +void arch_dump_shared_mem_info (void ) +{ +} +/* * Local variables: * mode: C