diff options
Diffstat (limited to 'linux-2.6-xen-sparse/include/asm-i386/mach-xen')
11 files changed, 143 insertions, 38 deletions
diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h index a6f3e9ea79..a9c3cc28fd 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h @@ -27,7 +27,6 @@ extern unsigned long __FIXADDR_TOP; #include <asm/acpi.h> #include <asm/apicdef.h> #include <asm/page.h> -#include <xen/gnttab.h> #ifdef CONFIG_HIGHMEM #include <linux/threads.h> #include <asm/kmap_types.h> @@ -99,7 +98,7 @@ enum fixed_addresses { extern void __set_fixmap(enum fixed_addresses idx, maddr_t phys, pgprot_t flags); -extern void set_fixaddr_top(unsigned long top); +extern void set_fixaddr_top(void); #define set_fixmap(idx, phys) \ __set_fixmap(idx, phys, PAGE_KERNEL) diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h index 2e6d1fa596..a12e349016 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h @@ -260,6 +260,8 @@ HYPERVISOR_event_channel_op( int cmd, void *arg) { int rc = _hypercall2(int, event_channel_op, cmd, arg); + +#ifdef CONFIG_XEN_COMPAT_030002 if (unlikely(rc == -ENOSYS)) { struct evtchn_op op; op.cmd = cmd; @@ -267,6 +269,8 @@ HYPERVISOR_event_channel_op( rc = _hypercall1(int, event_channel_op_compat, &op); memcpy(arg, &op.u, sizeof(op.u)); } +#endif + return rc; } @@ -296,6 +300,8 @@ HYPERVISOR_physdev_op( int cmd, void *arg) { int rc = _hypercall2(int, physdev_op, cmd, arg); + +#ifdef CONFIG_XEN_COMPAT_030002 if (unlikely(rc == -ENOSYS)) { struct physdev_op op; op.cmd = cmd; @@ -303,6 +309,8 @@ HYPERVISOR_physdev_op( rc = _hypercall1(int, physdev_op_compat, &op); memcpy(arg, &op.u, sizeof(op.u)); } +#endif + return rc; } @@ -350,9 +358,11 @@ HYPERVISOR_suspend( int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown, &sched_shutdown, srec); +#ifdef CONFIG_XEN_COMPAT_030002 if (rc == -ENOSYS) rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown, SHUTDOWN_suspend, srec); +#endif return rc; } diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h index 47586d22f9..f7904ac0b0 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h @@ -56,6 +56,10 @@ extern shared_info_t *HYPERVISOR_shared_info; +#ifdef CONFIG_X86_32 +extern unsigned long hypervisor_virt_start; +#endif + /* arch/xen/i386/kernel/setup.c */ extern start_info_t *xen_start_info; #ifdef CONFIG_XEN_PRIVILEGED_GUEST @@ -94,7 +98,6 @@ void xen_pgd_pin(unsigned long ptr); void xen_pgd_unpin(unsigned long ptr); void xen_set_ldt(unsigned long ptr, unsigned long bytes); -void xen_machphys_update(unsigned long mfn, unsigned long pfn); #ifdef CONFIG_SMP #include <linux/cpumask.h> @@ -131,8 +134,10 @@ HYPERVISOR_yield( { int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL); +#ifdef CONFIG_XEN_COMPAT_030002 if (rc == -ENOSYS) rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0); +#endif return rc; } @@ -143,8 +148,10 @@ HYPERVISOR_block( { int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL); +#ifdef CONFIG_XEN_COMPAT_030002 if (rc == -ENOSYS) rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0); +#endif return rc; } @@ -159,8 +166,10 @@ HYPERVISOR_shutdown( int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown); +#ifdef CONFIG_XEN_COMPAT_030002 if (rc == -ENOSYS) rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason); +#endif return rc; } @@ -177,8 +186,10 @@ HYPERVISOR_poll( set_xen_guest_handle(sched_poll.ports, ports); rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll); +#ifdef CONFIG_XEN_COMPAT_030002 if (rc == -ENOSYS) rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0); +#endif return rc; } diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h index 7f9b7cdd36..ed5203a573 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/io.h @@ -54,7 +54,8 @@ * Convert a physical pointer to a virtual kernel pointer for /dev/mem * access */ -#define xlate_dev_mem_ptr(p) __va(p) +#define xlate_dev_mem_ptr(p, sz) ioremap(p, sz) +#define xlate_dev_mem_ptr_unmap(p) iounmap(p) /* * Convert a virtual cached pointer to an uncached pointer diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h index b467320d5c..f805d6ea60 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/maddr.h @@ -9,6 +9,15 @@ #define FOREIGN_FRAME_BIT (1UL<<31) #define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT) +/* Definitions for machine and pseudophysical addresses. */ +#ifdef CONFIG_X86_PAE +typedef unsigned long long paddr_t; +typedef unsigned long long maddr_t; +#else +typedef unsigned long paddr_t; +typedef unsigned long maddr_t; +#endif + #ifdef CONFIG_XEN extern unsigned long *phys_to_machine_mapping; @@ -101,32 +110,13 @@ static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn) phys_to_machine_mapping[pfn] = mfn; } - -#else /* !CONFIG_XEN */ - -#define pfn_to_mfn(pfn) (pfn) -#define mfn_to_pfn(mfn) (mfn) -#define mfn_to_local_pfn(mfn) (mfn) -#define set_phys_to_machine(pfn, mfn) BUG_ON((pfn) != (mfn)) -#define phys_to_machine_mapping_valid(pfn) (1) - -#endif /* !CONFIG_XEN */ - -/* Definitions for machine and pseudophysical addresses. */ -#ifdef CONFIG_X86_PAE -typedef unsigned long long paddr_t; -typedef unsigned long long maddr_t; -#else -typedef unsigned long paddr_t; -typedef unsigned long maddr_t; -#endif - static inline maddr_t phys_to_machine(paddr_t phys) { maddr_t machine = pfn_to_mfn(phys >> PAGE_SHIFT); machine = (machine << PAGE_SHIFT) | (phys & ~PAGE_MASK); return machine; } + static inline paddr_t machine_to_phys(maddr_t machine) { paddr_t phys = mfn_to_pfn(machine >> PAGE_SHIFT); @@ -134,6 +124,32 @@ static inline paddr_t machine_to_phys(maddr_t machine) return phys; } +static inline paddr_t pte_machine_to_phys(maddr_t machine) +{ + /* + * In PAE mode, the NX bit needs to be dealt with in the value + * passed to mfn_to_pfn(). On x86_64, we need to mask it off, + * but for i386 the conversion to ulong for the argument will + * clip it off. + */ + paddr_t phys = mfn_to_pfn(machine >> PAGE_SHIFT); + phys = (phys << PAGE_SHIFT) | (machine & ~PHYSICAL_PAGE_MASK); + return phys; +} + +#else /* !CONFIG_XEN */ + +#define pfn_to_mfn(pfn) (pfn) +#define mfn_to_pfn(mfn) (mfn) +#define mfn_to_local_pfn(mfn) (mfn) +#define set_phys_to_machine(pfn, mfn) BUG_ON((pfn) != (mfn)) +#define phys_to_machine_mapping_valid(pfn) (1) +#define phys_to_machine(phys) ((maddr_t)(phys)) +#define machine_to_phys(mach) ((paddr_t)(mach)) +#define pte_machine_to_phys(mach) ((paddr_t)(mach)) + +#endif /* !CONFIG_XEN */ + /* VIRT <-> MACHINE conversion */ #define virt_to_machine(v) (phys_to_machine(__pa(v))) #define virt_to_mfn(v) (pfn_to_mfn(__pa(v) >> PAGE_SHIFT)) diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h index 0f829c8cd3..ff183db39e 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h @@ -6,6 +6,16 @@ #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) +#ifdef CONFIG_X86_PAE +#define __PHYSICAL_MASK_SHIFT 36 +#define __PHYSICAL_MASK ((1ULL << __PHYSICAL_MASK_SHIFT) - 1) +#define PHYSICAL_PAGE_MASK (~((1ULL << PAGE_SHIFT) - 1) & __PHYSICAL_MASK) +#else +#define __PHYSICAL_MASK_SHIFT 32 +#define __PHYSICAL_MASK (~0UL) +#define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK) +#endif + #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT) @@ -85,7 +95,7 @@ static inline unsigned long long pte_val(pte_t x) if (x.pte_low) { ret = x.pte_low | (unsigned long long)x.pte_high << 32; - ret = machine_to_phys(ret) | 1; + ret = pte_machine_to_phys(ret) | 1; } else { ret = 0; } @@ -94,13 +104,13 @@ static inline unsigned long long pte_val(pte_t x) static inline unsigned long long pmd_val(pmd_t x) { unsigned long long ret = x.pmd; - if (ret) ret = machine_to_phys(ret) | 1; + if (ret) ret = pte_machine_to_phys(ret) | 1; return ret; } static inline unsigned long long pgd_val(pgd_t x) { unsigned long long ret = x.pgd; - if (ret) ret = machine_to_phys(ret) | 1; + if (ret) ret = pte_machine_to_phys(ret) | 1; return ret; } static inline unsigned long long pte_val_ma(pte_t x) @@ -115,7 +125,8 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define pgprot_val(x) ((x).pgprot) #include <asm/maddr.h> #define boot_pte_t pte_t /* or would you rather have a typedef */ -#define pte_val(x) (((x).pte_low & 1) ? machine_to_phys((x).pte_low) : \ +#define pte_val(x) (((x).pte_low & 1) ? \ + pte_machine_to_phys((x).pte_low) : \ (x).pte_low) #define pte_val_ma(x) ((x).pte_low) #define __pte(x) ({ unsigned long _x = (x); \ @@ -125,7 +136,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; static inline unsigned long pgd_val(pgd_t x) { unsigned long ret = x.pgd; - if (ret) ret = machine_to_phys(ret) | 1; + if (ret) ret = pte_machine_to_phys(ret) | 1; return ret; } #define HPAGE_SHIFT 22 diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h index 3791d2de39..bd6346f410 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-2level-defs.h @@ -9,7 +9,6 @@ #define PGDIR_SHIFT 22 #define PTRS_PER_PGD 1024 -#define PTRS_PER_PGD_NO_HV (HYPERVISOR_VIRT_START >> PGDIR_SHIFT) /* * the i386 is two-level, so we don't really have any diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h index 10445c142c..148c8d9e78 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/pgtable-3level-defs.h @@ -8,7 +8,6 @@ */ #define PGDIR_SHIFT 30 #define PTRS_PER_PGD 4 -#define PTRS_PER_PGD_NO_HV 4 /* * PMD_SHIFT determines the size of the area a middle-level diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h index 6a4e5e4508..807ca388c5 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h @@ -9,6 +9,10 @@ #include <linux/config.h> +#ifdef HAVE_XEN_PLATFORM_COMPAT_H +#include <xen/platform-compat.h> +#endif + #define ADDR (*(volatile long *) addr) static __inline__ void synch_set_bit(int nr, volatile void * addr) diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h new file mode 100644 index 0000000000..2733e00ee4 --- /dev/null +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h @@ -0,0 +1,48 @@ +/****************************************************************************** + * asm-i386/mach-xen/asm/xenoprof.h + * + * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp> + * VA Linux Systems Japan K.K. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#ifndef __ASM_XENOPROF_H__ +#define __ASM_XENOPROF_H__ +#ifdef CONFIG_XEN + +struct super_block; +struct dentry; +int xenoprof_create_files(struct super_block * sb, struct dentry * root); +#define HAVE_XENOPROF_CREATE_FILES + +struct xenoprof_init; +void xenoprof_arch_init_counter(struct xenoprof_init *init); +void xenoprof_arch_counter(void); +void xenoprof_arch_start(void); +void xenoprof_arch_stop(void); + +struct xenoprof_arch_shared_buffer { + /* nothing */ +}; +struct xenoprof_shared_buffer; +void xenoprof_arch_unmap_shared_buffer(struct xenoprof_shared_buffer* sbuf); +struct xenoprof_get_buffer; +int xenoprof_arch_map_shared_buffer(struct xenoprof_get_buffer* get_buffer, struct xenoprof_shared_buffer* sbuf); +struct xenoprof_passive; +int xenoprof_arch_set_passive(struct xenoprof_passive* pdomain, struct xenoprof_shared_buffer* sbuf); + +#endif /* CONFIG_XEN */ +#endif /* __ASM_XENOPROF_H__ */ diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h index 0f1caa0604..bed1e1d211 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h @@ -56,15 +56,15 @@ static void __init machine_specific_arch_setup(void) struct xen_machphys_mapping mapping; unsigned long machine_to_phys_nr_ents; struct xen_platform_parameters pp; - struct callback_register event = { + static struct callback_register __initdata event = { .type = CALLBACKTYPE_event, .address = { __KERNEL_CS, (unsigned long)hypervisor_callback }, }; - struct callback_register failsafe = { + static struct callback_register __initdata failsafe = { .type = CALLBACKTYPE_failsafe, .address = { __KERNEL_CS, (unsigned long)failsafe_callback }, }; - struct callback_register nmi_cb = { + static struct callback_register __initdata nmi_cb = { .type = CALLBACKTYPE_nmi, .address = { __KERNEL_CS, (unsigned long)nmi }, }; @@ -72,23 +72,30 @@ static void __init machine_specific_arch_setup(void) ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event); if (ret == 0) ret = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe); +#ifdef CONFIG_XEN_COMPAT_030002 if (ret == -ENOSYS) ret = HYPERVISOR_set_callbacks( event.address.cs, event.address.eip, failsafe.address.cs, failsafe.address.eip); +#endif BUG_ON(ret); ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb); +#ifdef CONFIG_XEN_COMPAT_030002 if (ret == -ENOSYS) { - struct xennmi_callback cb; + static struct xennmi_callback __initdata cb = { + .handler_address = (unsigned long)nmi + }; - cb.handler_address = nmi_cb.address.eip; HYPERVISOR_nmi_op(XENNMI_register_callback, &cb); } +#endif if (HYPERVISOR_xen_version(XENVER_platform_parameters, - &pp) == 0) - set_fixaddr_top(pp.virt_start - PAGE_SIZE); + &pp) == 0) { + hypervisor_virt_start = pp.virt_start; + set_fixaddr_top(); + } machine_to_phys_mapping = (unsigned long *)MACH2PHYS_VIRT_START; machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES; |