bitkeeper revision 1.1159.258.107 (4270fc89Gyl1f0UFludQff4kq09XvQ)

reboot.c, init.c, hypervisor.h, evtchn.h, tlbflush.h, pgtable-2level.h:
  sync w/ unstable.
system.h:
  Fix typo.
pgtable.h, fixup.c, irq.c, direct.c, timer_tsc.c, pci-dma.c, init.c, fault.c:
  Cleanup whitespace.
page.h:
  Turn __pte and __pgd into #define's like the original definitions.
  Add casts to unsigned long for phys_to_machine_mapping and
  machine_to_phys_mapping.
fixmap.h, Makefile:
  gnttab is not used in 2.0.
.del-gnttab.c~4461d10e936c37ab:
  Delete: linux-2.6.11-xen-sparse/arch/xen/kernel/gnttab.c
.del-gnttab.h~974eaf5d22418ecd:
  Delete: linux-2.6.11-xen-sparse/include/asm-xen/gnttab.h
setup.c:
  Add panic notification handler.
  Change phys_to_machine_mapping from unsigned long * to unsigned int *.
  Whitespace cleanups.
page.h:
  Change phys_to_machine_mapping from unsigned long * to unsigned int *.
process.c:
  UTSNAME -> system_utsname.release as in plain Linux.
  Disable preemption before reading smp_processor_id.
head.S:
  sync w/ unstable for maintenance -- backport SMP-guest support bits.
  Break __xen_guest definition up in several lines.
ldt.c, desc.h, common.c:
  Move queue flush into load_LDT().
common.c:
  g/c unused code.
Kconfig:
  Fix whitespace for microcode option.
This commit is contained in:
cl349@firebug.cl.cam.ac.uk committed 2005-04-28 15:08:57 +00:00
1 parent d7b51cdac7
commit 9aa2d9a549
27 files changed
+135 -325

No files matched your search

-2
View File
@@ -246,7 +246,6 @@
41ab6fa06JdF7jxUsuDcjN3UhuIAxg linux-2.6.11-xen-sparse/arch/xen/kernel/devmem.c
40f56238xFQe9T7M_U_FItM-bZIpLw linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c
4110f478aeQWllIN7J4kouAHiAqrPw linux-2.6.11-xen-sparse/arch/xen/kernel/fixup.c
412dfae9eA3_6e6bCGUtg1mj8b56fQ linux-2.6.11-xen-sparse/arch/xen/kernel/gnttab.c
40f562392LBhwmOxVPsYdkYXMxI_ZQ linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c
414c113396tK1HTVeUalm3u-1DF16g linux-2.6.11-xen-sparse/arch/xen/kernel/skbuff.c
3f68905c5eiA-lBMQSvXLMWS1ikDEA linux-2.6.11-xen-sparse/arch/xen/kernel/xen_proc.c
@@ -314,7 +313,6 @@
40f5623bYNP7tHE2zX6YQxp9Zq2utQ linux-2.6.11-xen-sparse/include/asm-xen/ctrl_if.h
40f5623b3Eqs8pAc5WpPX8_jTzV2qw linux-2.6.11-xen-sparse/include/asm-xen/evtchn.h
419b4e9367PjTEvdjwavWN12BeBBXg linux-2.6.11-xen-sparse/include/asm-xen/foreign_page.h
412dfaeazclyNDM0cpnp60Yo4xulpQ linux-2.6.11-xen-sparse/include/asm-xen/gnttab.h
40f5623aGPlsm0u1LTO-NVZ6AGzNRQ linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h
3f108af1ylCIm82H052FVTfXACBHrw linux-2.6.11-xen-sparse/include/asm-xen/linux-public/privcmd.h
3fa8e3f0kBLeE4To2vpdi3cpJbIkbQ linux-2.6.11-xen-sparse/include/asm-xen/linux-public/suspend.h
+13 -13
View File
@@ -456,22 +456,22 @@ config PREEMPT_BKL
# enters thermal throttling.
config MICROCODE
tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support"
tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support"
depends on XEN_PRIVILEGED_GUEST
---help---
If you say Y here and also to "/dev file system support" in the
'File systems' section, you will be able to update the microcode on
Intel processors in the IA32 family, e.g. Pentium Pro, Pentium II,
Pentium III, Pentium 4, Xeon etc. You will obviously need the
actual microcode binary data itself which is not shipped with the
Linux kernel.
---help---
If you say Y here and also to "/dev file system support" in the
'File systems' section, you will be able to update the microcode on
Intel processors in the IA32 family, e.g. Pentium Pro, Pentium II,
Pentium III, Pentium 4, Xeon etc. You will obviously need the
actual microcode binary data itself which is not shipped with the
Linux kernel.
For latest news and information on obtaining all the required
ingredients for this driver, check:
<http://www.urbanmyth.org/microcode/>.
For latest news and information on obtaining all the required
ingredients for this driver, check:
<http://www.urbanmyth.org/microcode/>.
To compile this driver as a module, choose M here: the
module will be called microcode.
To compile this driver as a module, choose M here: the
module will be called microcode.
#config X86_MSR
# tristate "/dev/cpu/*/msr - Model-specific register support"
@@ -597,22 +597,11 @@ void __init cpu_init (void)
set_in_cr4(X86_CR4_TSD);
}
/*
* Initialize the per-CPU GDT with the boot GDT,
* and set up the GDT descriptor:
*/
if (cpu) {
cpu_gdt_descr[cpu].size = GDT_SIZE;
cpu_gdt_descr[cpu].address = 0; /* XXXcl alloc page */
BUG(); /* XXXcl SMP */
memcpy((void *)cpu_gdt_descr[cpu].address,
(void *)cpu_gdt_descr[0].address, GDT_SIZE);
}
/*
* Set up the per-thread TLS descriptor cache:
*/
memcpy(thread->tls_array, &get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN],
GDT_ENTRY_TLS_ENTRIES * 8);
GDT_ENTRY_TLS_ENTRIES * 8);
cpu_gdt_init(&cpu_gdt_descr[cpu]);
@@ -633,7 +622,6 @@ void __init cpu_init (void)
load_esp0(t, thread);
load_LDT(&init_mm.context);
flush_page_update_queue();
/* Clear %fs and %gs. */
asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs");
@@ -2,7 +2,9 @@
#include <linux/config.h>
.section __xen_guest
.ascii "GUEST_OS=linux,GUEST_VER=2.6,XEN_VER=2.0,VIRT_BASE=0xC0000000"
.ascii "GUEST_OS=linux,GUEST_VER=2.6"
.ascii ",XEN_VER=2.0"
.ascii ",VIRT_BASE=0xC0000000"
.ascii ",LOADER=generic"
.ascii ",PT_MODE_WRITABLE"
.byte 0
@@ -31,14 +33,19 @@
ENTRY(startup_32)
cld
/* Set up the stack pointer */
lss stack_start,%esp
/* Copy the necessary stuff from xen_start_info structure. */
mov $xen_start_info_union,%edi
mov $128,%ecx
rep movsl
#ifdef CONFIG_SMP
ENTRY(startup_32_smp)
cld
#endif /* CONFIG_SMP */
/* Set up the stack pointer */
lss stack_start,%esp
checkCPUtype:
/* get vendor info */
@@ -61,11 +68,22 @@ checkCPUtype:
movb %cl,X86_MASK
movl %edx,X86_CAPABILITY
xorl %eax,%eax # Clear FS/GS and LDT
incb ready
xorl %eax,%eax # Clear FS/GS and LDT
movl %eax,%fs
movl %eax,%gs
cld # gcc2 wants the direction flag cleared at all times
cld # gcc2 wants the direction flag cleared at all times
#ifdef CONFIG_SMP
movb ready, %cl
cmpb $1,%cl
je 1f # the first CPU calls start_kernel
# all other CPUs call initialize_secondary
call initialize_secondary
jmp L6
1:
#endif /* CONFIG_SMP */
call start_kernel
L6:
jmp L6 # main should never return here, but
@@ -88,6 +106,8 @@ ENTRY(stack_start)
.long init_thread_union+THREAD_SIZE
.long __BOOT_DS
ready: .byte 0
.globl idt_descr
.globl cpu_gdt_descr
@@ -22,10 +22,8 @@
#ifdef CONFIG_SMP /* avoids "defined but not used" warnig */
static void flush_ldt(void *null)
{
if (current->active_mm) {
if (current->active_mm)
load_LDT(&current->active_mm->context);
flush_page_update_queue();
}
}
#endif
@@ -64,7 +62,6 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
PAGE_SIZE);
load_LDT(pc);
flush_page_update_queue();
#ifdef CONFIG_SMP
mask = cpumask_of_cpu(smp_processor_id());
if (!cpus_equal(current->mm->cpu_vm_mask, mask))
@@ -49,11 +49,11 @@ xen_contig_memory(unsigned long vstart, unsigned int order)
/* 1. Zap current PTEs, giving away the underlying pages. */
for (i = 0; i < (1<<order); i++) {
pgd = pgd_offset_k( (vstart + (i*PAGE_SIZE)));
pud = pud_offset(pgd, (vstart + (i*PAGE_SIZE)));
pmd = pmd_offset(pud, (vstart + (i*PAGE_SIZE)));
pte = pte_offset_kernel(pmd, (vstart + (i*PAGE_SIZE)));
pfn = pte->pte_low >> PAGE_SHIFT;
pgd = pgd_offset_k(vstart + (i*PAGE_SIZE));
pud = pud_offset(pgd, vstart + (i*PAGE_SIZE));
pmd = pmd_offset(pud, vstart + (i*PAGE_SIZE));
pte = pte_offset_kernel(pmd, vstart + (i*PAGE_SIZE));
pfn = pte_val_ma(*pte) >> PAGE_SHIFT;
queue_l1_entry_update(pte, 0);
phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
INVALID_P2M_ENTRY;
@@ -66,21 +66,19 @@ xen_contig_memory(unsigned long vstart, unsigned int order)
&pfn, 1, order) != 1) BUG();
/* 3. Map the new extent in place of old pages. */
for (i = 0; i < (1<<order); i++) {
pgd = pgd_offset_k( (vstart + (i*PAGE_SIZE)));
pud = pud_offset(pgd, (vstart + (i*PAGE_SIZE)));
pmd = pmd_offset(pud, (vstart + (i*PAGE_SIZE)));
pte = pte_offset_kernel(pmd, (vstart + (i*PAGE_SIZE)));
queue_l1_entry_update(
pte, ((pfn+i)<<PAGE_SHIFT)|__PAGE_KERNEL);
queue_machphys_update(
pfn+i, (__pa(vstart)>>PAGE_SHIFT)+i);
phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
pfn+i;
pgd = pgd_offset_k(vstart + (i*PAGE_SIZE));
pud = pud_offset(pgd, vstart + (i*PAGE_SIZE));
pmd = pmd_offset(pud, vstart + (i*PAGE_SIZE));
pte = pte_offset_kernel(pmd, vstart + (i*PAGE_SIZE));
queue_l1_entry_update(pte,
((pfn+i)<<PAGE_SHIFT)|__PAGE_KERNEL);
queue_machphys_update(pfn+i, (__pa(vstart)>>PAGE_SHIFT)+i);
phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = pfn+i;
}
/* Flush updates through and flush the TLB. */
xen_tlb_flush();
balloon_unlock(flags);
balloon_unlock(flags);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
@@ -125,14 +123,13 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
vstart = __get_free_pages(gfp, order);
ret = (void *)vstart;
if (ret == NULL)
return ret;
xen_contig_memory(vstart, order);
memset(ret, 0, size);
*dma_handle = virt_to_bus(ret);
if (ret != NULL) {
xen_contig_memory(vstart, order);
memset(ret, 0, size);
*dma_handle = virt_to_bus(ret);
}
return ret;
}
@@ -94,10 +94,11 @@ EXPORT_SYMBOL(enable_hlt);
extern int set_timeout_timer(void);
void xen_idle(void)
{
int cpu = smp_processor_id();
int cpu;
local_irq_disable();
cpu = smp_processor_id();
if (rcu_pending(cpu))
rcu_check_callbacks(cpu, 0);
@@ -167,7 +168,7 @@ void show_regs(struct pt_regs * regs)
if (regs->xcs & 2)
printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
printk(" EFLAGS: %08lx %s (%s)\n",
regs->eflags, print_tainted(),UTS_RELEASE);
regs->eflags, print_tainted(), system_utsname.release);
printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
regs->eax,regs->ebx,regs->ecx,regs->edx);
printk("ESI: %08lx EDI: %08lx EBP: %08lx",
@@ -40,6 +40,8 @@
#include <linux/efi.h>
#include <linux/init.h>
#include <linux/edd.h>
#include <linux/kernel.h>
#include <linux/notifier.h>
#include <video/edid.h>
#include <asm/e820.h>
#include <asm/mpspec.h>
@@ -56,6 +58,11 @@
/* Allows setting of maximum possible memory size */
static unsigned long xen_override_max_pfn;
static int xen_panic_event(struct notifier_block *, unsigned long, void *);
static struct notifier_block xen_panic_block = {
xen_panic_event, NULL, 0 /* try to go last */
};
int disable_pse __initdata = 0;
/*
@@ -347,7 +354,7 @@ static void __init probe_roms(void)
shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
EXPORT_SYMBOL(HYPERVISOR_shared_info);
unsigned long *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
unsigned int *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
EXPORT_SYMBOL(phys_to_machine_mapping);
multicall_entry_t multicall_list[8];
@@ -892,6 +899,7 @@ efi_find_max_pfn(unsigned long start, unsigned long end, void *arg)
return 0;
}
/*
* Find the highest page frame number we have available
*/
@@ -1151,7 +1159,7 @@ static unsigned long __init setup_memory(void)
}
#endif
phys_to_machine_mapping = (unsigned long *)xen_start_info.mfn_list;
phys_to_machine_mapping = (unsigned int *)xen_start_info.mfn_list;
return max_low_pfn;
}
@@ -1388,17 +1396,18 @@ static void set_mca_bus(int x) { }
*/
void __init setup_arch(char **cmdline_p)
{
int i,j;
unsigned long max_low_pfn;
int i, j;
unsigned long max_low_pfn;
/* Force a quick death if the kernel panics. */
extern int panic_timeout;
if ( panic_timeout == 0 )
if (panic_timeout == 0)
panic_timeout = 1;
HYPERVISOR_vm_assist(VMASST_CMD_enable,
VMASST_TYPE_4gb_segments);
/* Register a call for panic conditions. */
notifier_chain_register(&panic_notifier_list, &xen_panic_block);
HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
early_cpu_init();
@@ -1464,7 +1473,8 @@ void __init setup_arch(char **cmdline_p)
init_mm.start_code = (unsigned long) _text;
init_mm.end_code = (unsigned long) _etext;
init_mm.end_data = (unsigned long) _edata;
init_mm.brk = (PFN_UP(__pa(xen_start_info.pt_base)) + xen_start_info.nr_pt_frames) << PAGE_SHIFT;
init_mm.brk = (PFN_UP(__pa(xen_start_info.pt_base)) +
xen_start_info.nr_pt_frames) << PAGE_SHIFT;
/* XEN: This is nonsense: kernel may not even be contiguous in RAM. */
/*code_resource.start = virt_to_phys(_text);*/
@@ -1497,7 +1507,7 @@ void __init setup_arch(char **cmdline_p)
max_pfn * sizeof(unsigned long));
if (max_pfn > xen_start_info.nr_pages) {
/* set to INVALID_P2M_ENTRY */
/* set to INVALID_P2M_ENTRY */
memset(phys_to_machine_mapping, ~0,
max_pfn * sizeof(unsigned long));
memcpy(phys_to_machine_mapping,
@@ -1610,6 +1620,14 @@ void __init setup_arch(char **cmdline_p)
}
}
static int
xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
{
HYPERVISOR_crash();
/* we're never actually going to get here... */
return NOTIFY_DONE;
}
#include "setup_arch_post.h"
/*
* Local Variables:
@@ -266,7 +266,7 @@ static unsigned long cpu_khz_ref = 0;
static int
time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
void *data)
void *data)
{
struct cpufreq_freqs *freq = data;
@@ -338,7 +338,7 @@ static int init_tsc(char* override)
/* (10^6 * 2^32) / cpu_hz = (10^3 * 2^32) / cpu_khz =
(2^32 * 1 / (clocks/us)) */
{
{
unsigned long eax=0, edx=1000;
__asm__("divl %2"
:"=a" (fast_gettimeoffset_quotient), "=d" (edx)
@@ -228,10 +228,10 @@ fastcall void do_page_fault(struct pt_regs *regs, unsigned long error_code,
error_code |= (regs->xcs & 2) << 1;
if (regs->eflags & X86_EFLAGS_VM)
error_code |= 4;
if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
SIGSEGV) == NOTIFY_STOP)
return;
if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
SIGSEGV) == NOTIFY_STOP)
return;
#if 0
/* It's safe to allow irq's after cr2 has been saved */
if (regs->eflags & (X86_EFLAGS_IF|VM_MASK))
+11 -12
View File
@@ -195,7 +195,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
flush_page_update_queue();
}
pmd_idx = 0;
}
}
}
static inline int page_kills_ppro(unsigned long pagenr)
@@ -327,8 +327,8 @@ extern void __init remap_numa_kva(void);
static void __init pagetable_init (void)
{
unsigned long vaddr;
pgd_t *pgd_base = swapper_pg_dir;
pgd_t *old_pgd = (pgd_t *)xen_start_info.pt_base;
pgd_t *new_pgd = swapper_pg_dir;
#ifdef CONFIG_X86_PAE
int i;
@@ -354,17 +354,16 @@ static void __init pagetable_init (void)
* page directory, write-protect the new page directory, then switch to
* it. We clean up by write-enabling and then freeing the old page dir.
*/
memcpy(new_pgd, old_pgd, PTRS_PER_PGD_NO_HV*sizeof(pgd_t));
make_page_readonly(new_pgd);
queue_pgd_pin(__pa(new_pgd));
load_cr3(new_pgd);
memcpy(pgd_base, old_pgd, PTRS_PER_PGD_NO_HV*sizeof(pgd_t));
make_page_readonly(pgd_base);
queue_pgd_pin(__pa(pgd_base));
load_cr3(pgd_base);
queue_pgd_unpin(__pa(old_pgd));
__flush_tlb_all(); /* implicit flush */
make_page_writable(old_pgd);
flush_page_update_queue();
__flush_tlb_all();
free_bootmem(__pa(old_pgd), PAGE_SIZE);
kernel_physical_mapping_init(new_pgd);
kernel_physical_mapping_init(pgd_base);
remap_numa_kva();
/*
@@ -372,9 +371,9 @@ static void __init pagetable_init (void)
* created - mappings will be set by set_fixmap():
*/
vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
page_table_range_init(vaddr, 0, new_pgd);
page_table_range_init(vaddr, 0, pgd_base);
permanent_kmaps_init(new_pgd);
permanent_kmaps_init(pgd_base);
#ifdef CONFIG_X86_PAE
/*
@@ -384,7 +383,7 @@ static void __init pagetable_init (void)
* All user-space mappings are explicitly cleared after
* SMP startup.
*/
new_pgd[0] = new_pgd[USER_PTRS_PER_PGD];
pgd_base[0] = pgd_base[USER_PTRS_PER_PGD];
#endif
}
@@ -71,13 +71,11 @@ struct pci_raw_ops pci_direct_xen = {
.write = pci_conf_write,
};
static int __init pci_direct_init(void)
{
printk(KERN_INFO "PCI: Using configuration type Xen\n");
raw_pci_ops = &pci_direct_xen;
return 0;
printk(KERN_INFO "PCI: Using configuration type Xen\n");
raw_pci_ops = &pci_direct_xen;
return 0;
}
arch_initcall(pci_direct_init);
@@ -93,7 +93,7 @@ void pcibios_penalize_isa_irq(int irq)
static int pirq_enable_irq(struct pci_dev *dev)
{
int err;
u8 pin;
u8 pin;
physdev_op_t op;
/* Inform Xen that we are going to use this device. */
@@ -11,4 +11,4 @@ $(obj)/vmlinux.lds.S:
extra-y += vmlinux.lds
obj-y := ctrl_if.o evtchn.o fixup.o reboot.o xen_proc.o gnttab.o skbuff.o devmem.o
obj-y := ctrl_if.o evtchn.o fixup.o reboot.o xen_proc.o skbuff.o devmem.o
@@ -77,8 +77,7 @@ __LINKAGE void do_fixup_4gb_segment(struct pt_regs *regs, long error_code)
static int __init fixup_init(void)
{
HYPERVISOR_vm_assist(VMASST_CMD_enable,
VMASST_TYPE_4gb_segments_notify);
HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments_notify);
return 0;
}
__initcall(fixup_init);
@@ -1,163 +0,0 @@
/******************************************************************************
* gnttab.c
*
* Two sets of functionality:
* 1. Granting foreign access to our memory reservation.
* 2. Accessing others' memory reservations via grant references.
* (i.e., mechanisms for both sender and recipient of grant references)
*
* Copyright (c) 2004, K A Fraser
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <asm/pgtable.h>
#include <asm/fixmap.h>
#include <asm-xen/gnttab.h>
#ifndef set_fixmap_ma
#define set_fixmap_ma set_fixmap
#endif
#if 1
#define ASSERT(_p) \
if ( !(_p) ) { printk(KERN_ALERT"Assertion '%s': line %d, file %s\n", \
#_p , __LINE__, __FILE__); *(int*)0=0; }
#else
#define ASSERT(_p) ((void)0)
#endif
EXPORT_SYMBOL(gnttab_grant_foreign_access);
EXPORT_SYMBOL(gnttab_end_foreign_access);
EXPORT_SYMBOL(gnttab_grant_foreign_transfer);
EXPORT_SYMBOL(gnttab_end_foreign_transfer);
#define NR_GRANT_REFS 512
static grant_ref_t gnttab_free_list[NR_GRANT_REFS];
static grant_ref_t gnttab_free_head;
static grant_entry_t *shared;
/*
* Lock-free grant-entry allocator
*/
static inline int
get_free_entry(
void)
{
grant_ref_t fh, nfh = gnttab_free_head;
do { if ( unlikely((fh = nfh) == NR_GRANT_REFS) ) return -1; }
while ( unlikely((nfh = cmpxchg(&gnttab_free_head, fh,
gnttab_free_list[fh])) != fh) );
return fh;
}
static inline void
put_free_entry(
grant_ref_t ref)
{
grant_ref_t fh, nfh = gnttab_free_head;
do { gnttab_free_list[ref] = fh = nfh; wmb(); }
while ( unlikely((nfh = cmpxchg(&gnttab_free_head, fh, ref)) != fh) );
}
/*
* Public grant-issuing interface functions
*/
int
gnttab_grant_foreign_access(
domid_t domid, unsigned long frame, int readonly)
{
int ref;
if ( unlikely((ref = get_free_entry()) == -1) )
return -ENOSPC;
shared[ref].frame = frame;
shared[ref].domid = domid;
wmb();
shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0);
return ref;
}
void
gnttab_end_foreign_access(
grant_ref_t ref, int readonly)
{
u16 flags, nflags;
nflags = shared[ref].flags;
do {
if ( (flags = nflags) & (GTF_reading|GTF_writing) )
printk(KERN_ALERT "WARNING: g.e. still in use!\n");
}
while ( (nflags = cmpxchg(&shared[ref].flags, flags, 0)) != flags );
put_free_entry(ref);
}
int
gnttab_grant_foreign_transfer(
domid_t domid)
{
int ref;
if ( unlikely((ref = get_free_entry()) == -1) )
return -ENOSPC;
shared[ref].frame = 0;
shared[ref].domid = domid;
wmb();
shared[ref].flags = GTF_accept_transfer;
return ref;
}
unsigned long
gnttab_end_foreign_transfer(
grant_ref_t ref)
{
unsigned long frame = 0;
u16 flags;
flags = shared[ref].flags;
ASSERT(flags == (GTF_accept_transfer | GTF_transfer_committed));
/*
* If a transfer is committed then wait for the frame address to appear.
* Otherwise invalidate the grant entry against future use.
*/
if ( likely(flags != GTF_accept_transfer) ||
(cmpxchg(&shared[ref].flags, flags, 0) != GTF_accept_transfer) )
while ( unlikely((frame = shared[ref].frame) == 0) )
cpu_relax();
put_free_entry(ref);
return frame;
}
void __init gnttab_init(void)
{
gnttab_setup_table_t setup;
unsigned long frame;
int i;
for ( i = 0; i < NR_GRANT_REFS; i++ )
gnttab_free_list[i] = i + 1;
setup.dom = DOMID_SELF;
setup.nr_frames = 1;
setup.frame_list = &frame;
if ( HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1) != 0 )
BUG();
if ( setup.status != 0 )
BUG();
set_fixmap_ma(FIX_GNTTAB, frame << PAGE_SHIFT);
shared = (grant_entry_t *)fix_to_virt(FIX_GNTTAB);
}
@@ -80,7 +80,7 @@ static void __do_suspend(void)
extern void time_suspend(void);
extern void time_resume(void);
extern unsigned long max_pfn;
extern unsigned long *pfn_to_mfn_frame_list;
extern unsigned int *pfn_to_mfn_frame_list;
suspend_record = (suspend_record_t *)__get_free_page(GFP_KERNEL);
if ( suspend_record == NULL )
@@ -103,7 +103,8 @@ static void __do_suspend(void)
HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
clear_fixmap(FIX_SHARED_INFO);
memcpy(&suspend_record->resume_info, &xen_start_info, sizeof(xen_start_info));
memcpy(&suspend_record->resume_info, &xen_start_info,
sizeof(xen_start_info));
HYPERVISOR_suspend(virt_to_machine(suspend_record) >> PAGE_SHIFT);
@@ -116,7 +117,8 @@ static void __do_suspend(void)
shutting_down = -1;
memcpy(&xen_start_info, &suspend_record->resume_info, sizeof(xen_start_info));
memcpy(&xen_start_info, &suspend_record->resume_info,
sizeof(xen_start_info));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
set_fixmap_ma(FIX_SHARED_INFO, xen_start_info.shared_info);
@@ -125,6 +125,7 @@ static inline void load_LDT(mm_context_t *pc)
{
int cpu = get_cpu();
load_LDT_nolock(pc, cpu);
flush_page_update_queue();
put_cpu();
}
@@ -84,7 +84,6 @@ enum fixed_addresses {
FIX_PCIE_MCFG,
#endif
FIX_SHARED_INFO,
FIX_GNTTAB,
#ifdef CONFIG_XEN_PHYSDEV_ACCESS
#define NR_FIX_ISAMAPS 256
FIX_ISAMAP_END,
@@ -58,9 +58,9 @@
#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
extern unsigned long *phys_to_machine_mapping;
#define pfn_to_mfn(_pfn) (phys_to_machine_mapping[(_pfn)])
#define mfn_to_pfn(_mfn) (machine_to_phys_mapping[(_mfn)])
extern unsigned int *phys_to_machine_mapping;
#define pfn_to_mfn(_pfn) ((unsigned long)(phys_to_machine_mapping[(_pfn)]))
#define mfn_to_pfn(_mfn) ((unsigned long)(machine_to_phys_mapping[(_mfn)]))
static inline unsigned long phys_to_machine(unsigned long phys)
{
unsigned long machine = pfn_to_mfn(phys >> PAGE_SHIFT);
@@ -116,17 +116,11 @@ static inline unsigned long pgd_val(pgd_t x)
}
#define pgprot_val(x) ((x).pgprot)
static inline pte_t __pte(unsigned long x)
{
if (x & 1) x = phys_to_machine(x);
return ((pte_t) { (x) });
}
#define __pte(x) ({ unsigned long _x = (x); \
(((_x)&1) ? ((pte_t) {phys_to_machine(_x)}) : ((pte_t) {(_x)})); })
#define __pte_ma(x) ((pte_t) { (x) } )
static inline pgd_t __pgd(unsigned long x)
{
if ((x & 1)) x = phys_to_machine(x);
return ((pgd_t) { (x) });
}
#define __pgd(x) ({ unsigned long _x = (x); \
(((_x)&1) ? ((pgd_t) {phys_to_machine(_x)}) : ((pgd_t) {(_x)})); })
#define __pgprot(x) ((pgprot_t) { (x) } )
#endif /* !__ASSEMBLY__ */
@@ -57,7 +57,7 @@ static inline pte_t ptep_get_and_clear(pte_t *xp)
* require. In all the cases we care about, the high bit gets shifted out
* (e.g., phys_to_machine()) so behaviour there is correct.
*/
#define INVALID_P2M_ENTRY (~0UL)
#define INVALID_P2M_ENTRY (~0U)
#define FOREIGN_FRAME(_m) ((_m) | (1UL<<((sizeof(unsigned long)*8)-1)))
#define pte_pfn(_pte) \
({ \
@@ -416,7 +416,6 @@ extern void noexec_setup(const char *str);
*/
#define update_mmu_cache(vma,address,pte) do { } while (0)
#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
do { \
if (__dirty) { \
@@ -444,7 +444,7 @@ struct alt_instr {
/*
* The use of 'barrier' in the following reflects their use as local-lock
* operations. Reentrancy must be prevented (e.g., __cli()) /before/ following
* critical operations are executed. All critical operatiosn must complete
* critical operations are executed. All critical operations must complete
* /before/ reentrancy is permitted (e.g., __sti()). Alpha architecture also
* includes these barriers, for example.
*/
@@ -6,11 +6,6 @@
#include <asm/processor.h>
#define __flush_tlb() xen_tlb_flush()
/*
* Global pages have to be flushed a bit differently. Not a real
* performance problem because this does not happen often.
*/
#define __flush_tlb_global() xen_tlb_flush()
extern unsigned long pgkern_mask;
@@ -41,9 +41,6 @@
* LOW-LEVEL DEFINITIONS
*/
/* Force a proper event-channel callback from Xen. */
void force_evtchn_callback(void);
/* Entry point for notifications into Linux subsystems. */
asmlinkage void evtchn_do_upcall(struct pt_regs *regs);
@@ -1,35 +0,0 @@
/******************************************************************************
* gnttab.h
*
* Two sets of functionality:
* 1. Granting foreign access to our memory reservation.
* 2. Accessing others' memory reservations via grant references.
* (i.e., mechanisms for both sender and recipient of grant references)
*
* Copyright (c) 2004, K A Fraser
*/
#ifndef __ASM_GNTTAB_H__
#define __ASM_GNTTAB_H__
#include <linux/config.h>
#include <asm-xen/hypervisor.h>
#include <asm-xen/xen-public/grant_table.h>
int
gnttab_grant_foreign_access(
domid_t domid, unsigned long frame, int readonly);
void
gnttab_end_foreign_access(
grant_ref_t ref, int readonly);
int
gnttab_grant_foreign_transfer(
domid_t domid);
unsigned long
gnttab_end_foreign_transfer(
grant_ref_t ref);
#endif /* __ASM_GNTTAB_H__ */
@@ -39,9 +39,11 @@
#include <asm-xen/xen-public/io/domain_controller.h>
#include <asm/ptrace.h>
#include <asm/page.h>
#if defined(__i386__)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <asm-generic/pgtable-nopmd.h>
#endif
#endif
/* arch/xen/i386/kernel/setup.c */
union xen_start_info_union
@@ -52,6 +54,10 @@ union xen_start_info_union
extern union xen_start_info_union xen_start_info_union;
#define xen_start_info (xen_start_info_union.xen_start_info)
/* arch/xen/kernel/evtchn.c */
/* Force a proper event-channel callback from Xen. */
void force_evtchn_callback(void);
/* arch/xen/kernel/process.c */
void xen_cpu_idle (void);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.