This commit is contained in:
emellor@leeni.uk.xensource.com committed 2006-01-24 17:54:34 +01:00
commit 1c74b18b4d
165 files changed
+3744 -1870

No files matched your search

+1 -1
View File
@@ -163,6 +163,7 @@
^tools/xenstore/xenstore-read$
^tools/xenstore/xenstore-rm$
^tools/xenstore/xenstore-write$
^tools/xenstore/xenstore-ls$
^tools/xenstore/xenstored$
^tools/xenstore/xenstored_test$
^tools/xenstore/xs_crashme$
@@ -171,7 +172,6 @@
^tools/xenstore/xs_tdb_dump$
^tools/xenstore/xs_test$
^tools/xenstore/xs_watch_stress$
^tools/xenstore/xsls$
^tools/xentrace/setsize$
^tools/xentrace/tbctl$
^tools/xentrace/xenctx$
+1 -1
View File
@@ -374,7 +374,7 @@ Attempting to set-vcpus to a number larger than the initially
configured VCPU count is an error. Trying to set-vcpus to < 1 will be
quietly ignored.
=item B<vpcu-list> I<[domain-id]>
=item B<vcpu-list> I<[domain-id]>
Lists VCPU information for a specific domain. If no domain is
specified, VCPU information for all domains will be provided.
@@ -91,8 +91,7 @@ CONFIG_IA64_PAGE_SIZE_16KB=y
# CONFIG_IA64_PAGE_SIZE_64KB is not set
CONFIG_IA64_L1_CACHE_SHIFT=7
# CONFIG_NUMA is not set
CONFIG_VIRTUAL_MEM_MAP=y
CONFIG_HOLES_IN_ZONE=y
CONFIG_VIRTUAL_MEM_MAP=n
CONFIG_IA64_CYCLONE=y
CONFIG_IOSAPIC=y
CONFIG_FORCE_MAX_ZONEORDER=18
@@ -76,7 +76,9 @@ IF_MASK = 0x00000200
DF_MASK = 0x00000400
NT_MASK = 0x00004000
VM_MASK = 0x00020000
/* Pseudo-eflags. */
NMI_MASK = 0x80000000
/* Offsets into shared_info_t. */
#define evtchn_upcall_pending /* 0 */
#define evtchn_upcall_mask 1
@@ -305,8 +307,8 @@ restore_all:
je ldt_ss # returning to user-space with LDT SS
#endif /* XEN */
restore_nocheck:
testl $VM_MASK, EFLAGS(%esp)
jnz resume_vm86
testl $(VM_MASK|NMI_MASK), EFLAGS(%esp)
jnz hypervisor_iret
movb EVENT_MASK(%esp), %al
notb %al # %al == ~saved_mask
XEN_GET_VCPU_INFO(%esi)
@@ -328,11 +330,11 @@ iret_exc:
.long 1b,iret_exc
.previous
resume_vm86:
XEN_UNBLOCK_EVENTS(%esi)
hypervisor_iret:
andl $~NMI_MASK, EFLAGS(%esp)
RESTORE_REGS
movl %eax,(%esp)
movl $__HYPERVISOR_switch_vm86,%eax
movl $__HYPERVISOR_iret,%eax
int $0x82
ud2
@@ -691,6 +693,15 @@ debug_stack_correct:
call do_debug
jmp ret_from_exception
ENTRY(nmi)
pushl %eax
SAVE_ALL
xorl %edx,%edx # zero error code
movl %esp,%eax # pt_regs pointer
call do_nmi
orl $NMI_MASK, EFLAGS(%esp)
jmp restore_all
#if 0 /* XEN */
/*
* NMI is doubly nasty. It can happen _while_ we're handling
@@ -622,9 +622,11 @@ static int balanced_irq(void *unused)
try_to_freeze(PF_FREEZE);
if (time_after(jiffies,
prev_balance_time+balanced_irq_interval)) {
preempt_disable();
do_irq_balance();
prev_balance_time = jiffies;
time_remaining = balanced_irq_interval;
preempt_enable();
}
}
return 0;
@@ -506,18 +506,11 @@ static void mem_parity_error(unsigned char reason, struct pt_regs * regs)
static void io_check_error(unsigned char reason, struct pt_regs * regs)
{
unsigned long i;
printk("NMI: IOCK error (debug interrupt?)\n");
show_registers(regs);
/* Re-enable the IOCK line, wait for a few seconds */
reason = (reason & 0xf) | 8;
outb(reason, 0x61);
i = 2000;
while (--i) udelay(1000);
reason &= ~8;
outb(reason, 0x61);
clear_io_check_error(reason);
}
static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
@@ -648,12 +641,6 @@ fastcall void do_int3(struct pt_regs *regs, long error_code)
}
#endif
static inline void conditional_sti(struct pt_regs *regs)
{
if (regs->eflags & (X86_EFLAGS_IF|VM_MASK))
local_irq_enable();
}
/*
* Our handling of the processor debug registers is non-trivial.
* We do not clear them on entry and exit from the kernel. Therefore
@@ -686,9 +673,9 @@ fastcall void do_debug(struct pt_regs * regs, long error_code)
if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
SIGTRAP) == NOTIFY_STOP)
return;
/* It's safe to allow irq's after DR6 has been saved */
conditional_sti(regs);
if (regs->eflags & X86_EFLAGS_IF)
local_irq_enable();
/* Mask out spurious debug traps due to lazy DR7 setting */
if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) {
+1 -1
View File
@@ -65,7 +65,7 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)
{
pud_t *pud;
pmd_t *pmd_table;
#ifdef CONFIG_X86_PAE
pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
make_lowmem_page_readonly(pmd_table);
@@ -290,15 +290,15 @@ static void shutdown_handler(struct xenbus_watch *watch,
const char **vec, unsigned int len)
{
char *str;
struct xenbus_transaction *xbt;
xenbus_transaction_t xbt;
int err;
if (shutting_down != SHUTDOWN_INVALID)
return;
again:
xbt = xenbus_transaction_start();
if (IS_ERR(xbt))
err = xenbus_transaction_start(&xbt);
if (err)
return;
str = (char *)xenbus_read(xbt, "control", "shutdown", NULL);
/* Ignore read errors and empty reads. */
@@ -339,12 +339,12 @@ static void sysrq_handler(struct xenbus_watch *watch, const char **vec,
unsigned int len)
{
char sysrq_key = '\0';
struct xenbus_transaction *xbt;
xenbus_transaction_t xbt;
int err;
again:
xbt = xenbus_transaction_start();
if (IS_ERR(xbt))
err = xenbus_transaction_start(&xbt);
if (err)
return;
if (!xenbus_scanf(xbt, "control", "sysrq", "%c", &sysrq_key)) {
printk(KERN_ERR "Unable to read sysrq code in "
@@ -526,7 +526,7 @@ extern union xen_start_info_union xen_start_info_union;
unsigned long __init e820_end_of_ram(void)
{
unsigned long max_end_pfn;
unsigned long max_end_pfn;
if (xen_override_max_pfn == 0) {
max_end_pfn = xen_start_info->nr_pages;
@@ -612,7 +612,7 @@ void __init parse_memopt(char *p, char **from)
{
end_user_pfn = memparse(p, from);
end_user_pfn >>= PAGE_SHIFT;
xen_override_max_pfn = (unsigned long) end_user_pfn;
xen_override_max_pfn = (unsigned long) end_user_pfn;
}
/*
@@ -57,7 +57,7 @@
#ifndef CONFIG_PREEMPT
#define retint_kernel retint_restore_args
#endif
/*
* C code is not supposed to know about undefined top of stack. Every time
* a C function with an pt_regs argument is called from the SYSCALL based
@@ -65,7 +65,7 @@
* RESTORE_TOP_OF_STACK syncs the syscall state after any possible ptregs
* manipulation.
*/
/* %rsp:at FRAMEEND */
.macro FIXUP_TOP_OF_STACK tmp
movq $__USER_CS,CS(%rsp)
@@ -121,19 +121,19 @@
.endm
/*
* Must be consistent with the definition in arch_x86_64.h:
* struct switch_to_user {
* Must be consistent with the definition in arch-x86_64.h:
* struct iret_context {
* u64 rax, r11, rcx, flags, rip, cs, rflags, rsp, ss;
* };
* #define VGCF_IN_SYSCALL (1<<8)
*/
.macro SWITCH_TO_USER flag
.macro HYPERVISOR_IRET flag
subq $8*4,%rsp # reuse rip, cs, rflags, rsp, ss in the stack
movq %rax,(%rsp)
movq %r11,1*8(%rsp)
movq %rcx,2*8(%rsp) # we saved %rcx upon exceptions
movq $\flag,3*8(%rsp)
movq $__HYPERVISOR_switch_to_user,%rax
movq $__HYPERVISOR_iret,%rax
syscall
.endm
@@ -225,7 +225,7 @@ sysret_check:
jnz sysret_careful
XEN_UNBLOCK_EVENTS(%rsi)
RESTORE_ARGS 0,8,0
SWITCH_TO_USER VGCF_IN_SYSCALL
HYPERVISOR_IRET VGCF_IN_SYSCALL
/* Handle reschedules */
/* edx: work, edi: workmask */
@@ -418,7 +418,6 @@ ENTRY(stub_rt_sigreturn)
jmp int_ret_from_sys_call
CFI_ENDPROC
/*
* Interrupt entry/exit.
*
@@ -479,7 +478,7 @@ kernel_mode:
orb $3,1*8(%rsp)
iretq
user_mode:
SWITCH_TO_USER 0
HYPERVISOR_IRET 0
/* edi: workmask, edx: work */
retint_careful:
@@ -720,6 +719,18 @@ ENTRY(do_hypervisor_callback) # do_hyperviosr_callback(struct *pt_regs)
call evtchn_do_upcall
jmp error_exit
#ifdef CONFIG_X86_LOCAL_APIC
ENTRY(nmi)
zeroentry do_nmi_callback
ENTRY(do_nmi_callback)
addq $8, %rsp
call do_nmi
RESTORE_REST
XEN_BLOCK_EVENTS(%rsi)
GET_THREAD_INFO(%rcx)
jmp retint_restore_args
#endif
ALIGN
restore_all_enable_events:
XEN_UNBLOCK_EVENTS(%rsi) # %rsi is already set up...
@@ -734,7 +745,7 @@ scrit: /**** START OF CRITICAL REGION ****/
orb $3,1*8(%rsp)
iretq
crit_user_mode:
SWITCH_TO_USER 0
HYPERVISOR_IRET 0
14: XEN_LOCKED_BLOCK_EVENTS(%rsi)
XEN_PUT_VCPU_INFO(%rsi)
@@ -68,13 +68,13 @@ static void __init copy_bootdata(char *real_mode_data)
static void __init setup_boot_cpu_data(void)
{
int dummy, eax;
unsigned int dummy, eax;
/* get vendor info */
cpuid(0, &boot_cpu_data.cpuid_level,
(int *)&boot_cpu_data.x86_vendor_id[0],
(int *)&boot_cpu_data.x86_vendor_id[8],
(int *)&boot_cpu_data.x86_vendor_id[4]);
cpuid(0, (unsigned int *)&boot_cpu_data.cpuid_level,
(unsigned int *)&boot_cpu_data.x86_vendor_id[0],
(unsigned int *)&boot_cpu_data.x86_vendor_id[8],
(unsigned int *)&boot_cpu_data.x86_vendor_id[4]);
/* get cpu type */
cpuid(1, &eax, &dummy, &dummy,
@@ -109,7 +109,6 @@ void __init x86_64_start_kernel(char * real_mode_data)
if (s != NULL)
setup_early_printk(s);
#endif
#ifdef CONFIG_DISCONTIGMEM
s = strstr(saved_command_line, "numa=");
if (s != NULL)
@@ -255,11 +255,9 @@ static int __init enable_ioapic_setup(char *str)
return 1;
}
__setup("noapic", disable_ioapic_setup);
__setup("apic", enable_ioapic_setup);
#include <asm/pci-direct.h>
#include <linux/pci_ids.h>
#include <linux/pci.h>
@@ -1146,6 +1144,7 @@ void __apicdebuginit print_PIC(void)
v = inb(0x4d1) << 8 | inb(0x4d0);
printk(KERN_DEBUG "... PIC ELCR: %04x\n", v);
}
#endif /* 0 */
#else
@@ -1191,6 +1190,7 @@ void disable_IO_APIC(void)
* Clear the IO-APIC before rebooting:
*/
clear_IO_APIC();
#ifndef CONFIG_XEN
disconnect_bsp_APIC();
#endif
@@ -1202,6 +1202,7 @@ void disable_IO_APIC(void)
*
* by Matt Domsch <Matt_Domsch@dell.com> Tue Dec 21 12:25:05 CST 1999
*/
#ifndef CONFIG_XEN
static void __init setup_ioapic_ids_from_mpc (void)
{
@@ -9,18 +9,15 @@
* x86_64-specific irq controller code. (e.g. i8259.c and
* io_apic.c.)
*/
#include <asm/uaccess.h>
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
/*
* Interrupt statistics:
*/
#include <linux/kernel_stat.h>
#include <linux/interrupt.h>
#include <linux/seq_file.h>
#include <linux/module.h>
#include <asm/uaccess.h>
#include <asm/io_apic.h>
atomic_t irq_err_count;
#ifdef CONFIG_X86_IO_APIC
#ifdef APIC_MISMATCH_DEBUG
atomic_t irq_mis_count;
@@ -62,6 +62,7 @@ static int alloc_ldt(mm_context_t *pc, unsigned mincount, int reload)
if (reload) {
#ifdef CONFIG_SMP
cpumask_t mask;
preempt_disable();
#endif
make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
@@ -201,6 +202,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
struct user_desc ldt_info;
error = -EINVAL;
if (bytecount != sizeof(ldt_info))
goto out;
error = -EFAULT;
@@ -62,6 +62,7 @@
#include <asm-xen/xen-public/physdev.h>
#include "setup_arch_pre.h"
#include <asm/hypervisor.h>
#include <asm-xen/xen-public/nmi.h>
#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
#define end_pfn_map end_pfn
@@ -304,7 +305,6 @@ static void __init probe_roms(void)
}
#endif
static __init void parse_cmdline_early (char ** cmdline_p)
{
char c = ' ', *to = command_line, *from = COMMAND_LINE;
@@ -379,6 +379,7 @@ static __init void parse_cmdline_early (char ** cmdline_p)
acpi_skip_timer_override = 1;
#endif
#endif
#ifndef CONFIG_XEN
if (!memcmp(from, "nolapic", 7) ||
!memcmp(from, "disableapic", 11))
@@ -391,7 +392,8 @@ static __init void parse_cmdline_early (char ** cmdline_p)
skip_ioapic_setup = 0;
ioapic_force = 1;
}
#endif
#endif
if (!memcmp(from, "mem=", 4))
parse_memopt(from+4, &from);
@@ -588,7 +590,7 @@ void __init setup_arch(char **cmdline_p)
HYPERVISOR_vm_assist(VMASST_CMD_enable,
VMASST_TYPE_writable_pagetables);
ARCH_SETUP
ARCH_SETUP
#else
ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
drive_info = DRIVE_INFO;
@@ -612,7 +614,7 @@ void __init setup_arch(char **cmdline_p)
init_mm.end_code = (unsigned long) &_etext;
init_mm.end_data = (unsigned long) &_edata;
#ifdef CONFIG_XEN
init_mm.brk = start_pfn << PAGE_SHIFT;
init_mm.brk = start_pfn << PAGE_SHIFT;
#else
init_mm.brk = (unsigned long) &_end;
@@ -668,7 +670,6 @@ void __init setup_arch(char **cmdline_p)
reserve_ebda_region();
#endif
#ifdef CONFIG_SMP
/*
* But first pinch a few for the stack/trampoline stuff
@@ -790,8 +791,6 @@ void __init setup_arch(char **cmdline_p)
}
if ( ! (xen_start_info->flags & SIF_INITDOMAIN))
{
acpi_disabled = 1;
@@ -835,7 +834,7 @@ void __init setup_arch(char **cmdline_p)
* and also for regions reported as reserved by the e820.
*/
probe_roms();
e820_reserve_resources();
e820_reserve_resources();
#endif
request_resource(&iomem_resource, &video_ram_resource);
@@ -33,6 +33,7 @@
#ifdef CONFIG_XEN
#include <asm/hypervisor.h>
#endif
char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
@@ -165,7 +166,6 @@ void __init cpu_gdt_init(struct desc_ptr *gdt_descr)
}
#endif
void pda_init(int cpu)
{
struct x8664_pda *pda = &cpu_pda[cpu];
@@ -175,9 +175,10 @@ void pda_init(int cpu)
#ifndef CONFIG_XEN
wrmsrl(MSR_GS_BASE, cpu_pda + cpu);
#else
HYPERVISOR_set_segment_base(SEGBASE_GS_KERNEL,
(unsigned long)(cpu_pda + cpu));
HYPERVISOR_set_segment_base(SEGBASE_GS_KERNEL,
(unsigned long)(cpu_pda + cpu));
#endif
pda->me = pda;
pda->cpunumber = cpu;
pda->irqcount = -1;
@@ -201,6 +202,7 @@ void pda_init(int cpu)
}
switch_pt();
pda->irqstackptr += IRQSTACKSIZE-64;
}
@@ -30,8 +30,9 @@
#include <asm/apicdef.h>
#ifdef CONFIG_XEN
#include <asm-xen/evtchn.h>
#endif
#else
#ifndef CONFIG_XEN
/*
* Smarter SMP flushing macros.
* c/o Linus Torvalds.
@@ -559,9 +559,11 @@ static void mem_parity_error(unsigned char reason, struct pt_regs * regs)
printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n");
printk("You probably have a hardware problem with your RAM chips\n");
#if 0 /* XEN */
/* Clear and disable the memory parity error line. */
reason = (reason & 0xf) | 4;
outb(reason, 0x61);
#endif /* XEN */
}
static void io_check_error(unsigned char reason, struct pt_regs * regs)
@@ -569,12 +571,14 @@ static void io_check_error(unsigned char reason, struct pt_regs * regs)
printk("NMI: IOCK error (debug interrupt?)\n");
show_registers(regs);
#if 0 /* XEN */
/* Re-enable the IOCK line, wait for a few seconds */
reason = (reason & 0xf) | 8;
outb(reason, 0x61);
mdelay(2000);
reason &= ~8;
outb(reason, 0x61);
#endif /* XEN */
}
static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
@@ -890,7 +894,6 @@ asmlinkage void __attribute__((weak)) smp_thermal_interrupt(void)
asmlinkage void math_state_restore(void)
{
struct task_struct *me = current;
/* clts(); */ /* 'clts' is done for us by Xen during virtual trap. */
if (!used_math())
@@ -153,7 +153,6 @@ void dump_pagetable(unsigned long address)
pgd = (pgd_t *)per_cpu(cur_pgd, smp_processor_id());
preempt_enable();
pgd += pgd_index(address);
printk("PGD %lx ", pgd_val(*pgd));
if (bad_address(pgd)) goto bad;
if (!pgd_present(*pgd)) goto ret;
@@ -258,7 +257,6 @@ static int vmalloc_fault(unsigned long address)
pgd = (pgd_t *)per_cpu(cur_pgd, smp_processor_id());
preempt_enable();
pgd += pgd_index(address);
pgd_ref = pgd_offset_k(address);
if (pgd_none(*pgd_ref))
return -1;
+77 -88
View File
@@ -40,16 +40,16 @@
#include <asm/proto.h>
#include <asm/smp.h>
#ifndef Dprintk
#define Dprintk(x...)
#endif
extern unsigned long *contiguous_bitmap;
#if defined(CONFIG_SWIOTLB)
extern void swiotlb_init(void);
#endif
#ifndef Dprintk
#define Dprintk(x...)
#endif
extern char _stext[];
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -200,9 +200,9 @@ static void *spp_getpage(void)
static inline pud_t *pud_offset_u(unsigned long address)
{
pud_t *pud = level3_user_pgt;
pud_t *pud = level3_user_pgt;
return pud + pud_index(address);
return pud + pud_index(address);
}
static void set_pte_phys(unsigned long vaddr,
@@ -215,34 +215,27 @@ static void set_pte_phys(unsigned long vaddr,
Dprintk("set_pte_phys %lx to %lx\n", vaddr, phys);
pgd = (user_mode ? pgd_offset_u(vaddr) : pgd_offset_k(vaddr));
pgd = (user_mode ? pgd_offset_u(vaddr) : pgd_offset_k(vaddr));
if (pgd_none(*pgd)) {
printk("PGD FIXMAP MISSING, it should be setup in head.S!\n");
return;
}
pud = (user_mode ? pud_offset_u(vaddr) : pud_offset(pgd, vaddr));
pud = (user_mode ? pud_offset_u(vaddr) : pud_offset(pgd, vaddr));
if (pud_none(*pud)) {
pmd = (pmd_t *) spp_getpage();
make_page_readonly(pmd);
xen_pmd_pin(__pa(pmd));
make_page_readonly(pmd);
xen_pmd_pin(__pa(pmd));
set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER));
if (pmd != pmd_offset(pud, 0)) {
printk("PAGETABLE BUG #01! %p <-> %p\n", pmd, pmd_offset(pud,0));
return;
}
}
pmd = pmd_offset(pud, vaddr);
if (pmd_none(*pmd)) {
pte = (pte_t *) spp_getpage();
make_page_readonly(pte);
xen_pte_pin(__pa(pte));
make_page_readonly(pte);
xen_pte_pin(__pa(pte));
set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER));
if (pte != pte_offset_kernel(pmd, 0)) {
printk("PAGETABLE BUG #02!\n");
@@ -252,11 +245,10 @@ static void set_pte_phys(unsigned long vaddr,
new_pte = pfn_pte(phys >> PAGE_SHIFT, prot);
pte = pte_offset_kernel(pmd, vaddr);
if (!pte_none(*pte) &&
pte_val(*pte) != (pte_val(new_pte) & __supported_pte_mask))
pte_ERROR(*pte);
set_pte(pte, new_pte);
set_pte(pte, new_pte);
/*
* It's enough to flush this one mapping.
@@ -284,11 +276,11 @@ static void set_pte_phys_ma(unsigned long vaddr,
if (pud_none(*pud)) {
pmd = (pmd_t *) spp_getpage();
make_page_readonly(pmd);
xen_pmd_pin(__pa(pmd));
make_page_readonly(pmd);
xen_pmd_pin(__pa(pmd));
set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER));
if (pmd != pmd_offset(pud, 0)) {
printk("PAGETABLE BUG #01! %p <-> %p\n", pmd, pmd_offset(pud,0));
return;
@@ -298,8 +290,8 @@ static void set_pte_phys_ma(unsigned long vaddr,
if (pmd_none(*pmd)) {
pte = (pte_t *) spp_getpage();
make_page_readonly(pte);
xen_pte_pin(__pa(pte));
make_page_readonly(pte);
xen_pte_pin(__pa(pte));
set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER));
if (pte != pte_offset_kernel(pmd, 0)) {
@@ -311,12 +303,12 @@ static void set_pte_phys_ma(unsigned long vaddr,
new_pte = pfn_pte_ma(phys >> PAGE_SHIFT, prot);
pte = pte_offset_kernel(pmd, vaddr);
/*
* Note that the pte page is already RO, thus we want to use
* xen_l1_entry_update(), not set_pte().
*/
xen_l1_entry_update(pte,
pfn_pte_ma(phys >> PAGE_SHIFT, prot));
/*
* Note that the pte page is already RO, thus we want to use
* xen_l1_entry_update(), not set_pte().
*/
xen_l1_entry_update(pte,
pfn_pte_ma(phys >> PAGE_SHIFT, prot));
/*
* It's enough to flush this one mapping.
@@ -347,7 +339,6 @@ void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
}
}
/*
* At this point it only supports vsyscall area.
*/
@@ -360,18 +351,18 @@ void __set_fixmap_user (enum fixed_addresses idx, unsigned long phys, pgprot_t p
return;
}
set_pte_phys(address, phys, prot, SET_FIXMAP_USER);
set_pte_phys(address, phys, prot, SET_FIXMAP_USER);
}
unsigned long __initdata table_start, tables_space;
unsigned long get_machine_pfn(unsigned long addr)
{
pud_t* pud = pud_offset_k(addr);
pmd_t* pmd = pmd_offset(pud, addr);
pte_t *pte = pte_offset_kernel(pmd, addr);
return pte_mfn(*pte);
pud_t* pud = pud_offset_k(addr);
pmd_t* pmd = pmd_offset(pud, addr);
pte_t *pte = pte_offset_kernel(pmd, addr);
return pte_mfn(*pte);
}
static __init void *alloc_static_page(unsigned long *phys)
@@ -411,12 +402,11 @@ static inline int make_readonly(unsigned long paddr)
static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
{
long i, j, k;
unsigned long paddr;
long i, j, k;
unsigned long paddr;
i = pud_index(address);
pud = pud + i;
for (; i < PTRS_PER_PUD; pud++, i++) {
unsigned long pmd_phys;
pmd_t *pmd;
@@ -429,38 +419,37 @@ static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned lon
}
pmd = alloc_static_page(&pmd_phys);
early_make_page_readonly(pmd);
xen_pmd_pin(pmd_phys);
early_make_page_readonly(pmd);
xen_pmd_pin(pmd_phys);
set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE));
for (j = 0; j < PTRS_PER_PMD; pmd++, j++) {
unsigned long pte_phys;
pte_t *pte, *pte_save;
unsigned long pte_phys;
pte_t *pte, *pte_save;
if (paddr >= end) {
for (; j < PTRS_PER_PMD; j++, pmd++)
set_pmd(pmd, __pmd(0));
break;
}
pte = alloc_static_page(&pte_phys);
pte_save = pte;
for (k = 0; k < PTRS_PER_PTE; pte++, k++, paddr += PTE_SIZE) {
if ((paddr >= end) ||
((paddr >> PAGE_SHIFT) >=
xen_start_info->nr_pages)) {
__set_pte(pte, __pte(0));
continue;
}
if (make_readonly(paddr)) {
__set_pte(pte,
__pte(paddr | (_KERNPG_TABLE & ~_PAGE_RW)));
continue;
}
__set_pte(pte, __pte(paddr | _KERNPG_TABLE));
}
pte = pte_save;
early_make_page_readonly(pte);
xen_pte_pin(pte_phys);
pte = alloc_static_page(&pte_phys);
pte_save = pte;
for (k = 0; k < PTRS_PER_PTE; pte++, k++, paddr += PTE_SIZE) {
if ((paddr >= end) ||
((paddr >> PAGE_SHIFT) >=
xen_start_info->nr_pages)) {
__set_pte(pte, __pte(0));
continue;
}
if (make_readonly(paddr)) {
__set_pte(pte,
__pte(paddr | (_KERNPG_TABLE & ~_PAGE_RW)));
continue;
}
__set_pte(pte, __pte(paddr | _KERNPG_TABLE));
}
pte = pte_save;
early_make_page_readonly(pte);
xen_pte_pin(pte_phys);
set_pmd(pmd, __pmd(pte_phys | _KERNPG_TABLE));
}
}
@@ -506,7 +495,7 @@ void __init xen_init_pt(void)
level3_kernel_pgt[pud_index(__START_KERNEL_map)] =
__pud(__pa_symbol(level2_kernel_pgt) |
_KERNPG_TABLE | _PAGE_USER);
memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);
memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);
early_make_page_readonly(init_level4_pgt);
early_make_page_readonly(init_level4_user_pgt);
@@ -618,7 +607,7 @@ extern struct x8664_pda cpu_pda[NR_CPUS];
void zap_low_mappings(void)
{
/* this is not required for Xen */
/* this is not required for Xen */
#if 0
swap_low_mappings();
#endif
@@ -629,11 +618,11 @@ void __init paging_init(void)
{
{
unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
/* unsigned int max_dma; */
/* max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; */
/* if (end_pfn < max_dma) */
/* unsigned int max_dma; */
/* max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; */
/* if (end_pfn < max_dma) */
zones_size[ZONE_DMA] = end_pfn;
#if 0
#if 0
else {
zones_size[ZONE_DMA] = max_dma;
zones_size[ZONE_NORMAL] = end_pfn - max_dma;
@@ -642,16 +631,16 @@ void __init paging_init(void)
free_area_init(zones_size);
}
set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
memset(empty_zero_page, 0, sizeof(empty_zero_page));
memset(empty_zero_page, 0, sizeof(empty_zero_page));
init_mm.context.pinned = 1;
#ifdef CONFIG_XEN_PHYSDEV_ACCESS
{
int i;
/* Setup mapping of lower 1st MB */
/* Setup mapping of lower 1st MB */
for (i = 0; i < NR_FIX_ISAMAPS; i++)
if (xen_start_info->flags & SIF_PRIVILEGED)
set_fixmap(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
@@ -701,7 +690,7 @@ void __init clear_kernel_mapping(unsigned long address, unsigned long size)
static inline int page_is_ram (unsigned long pagenr)
{
return 1;
return 1;
}
static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
@@ -790,10 +779,10 @@ extern char __initdata_begin[], __initdata_end[];
void free_initmem(void)
{
#ifdef __DO_LATER__
/*
* Some pages can be pinned, but some are not. Unpinning such pages
* triggers BUG().
*/
/*
* Some pages can be pinned, but some are not. Unpinning such pages
* triggers BUG().
*/
unsigned long addr;
addr = (unsigned long)(&__init_begin);
@@ -801,12 +790,12 @@ void free_initmem(void)
ClearPageReserved(virt_to_page(addr));
set_page_count(virt_to_page(addr), 1);
memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE);
xen_pte_unpin(__pa(addr));
make_page_writable(__va(__pa(addr)));
/*
* Make pages from __PAGE_OFFSET address as well
*/
make_page_writable((void *)addr);
xen_pte_unpin(__pa(addr));
make_page_writable(__va(__pa(addr)));
/*
* Make pages from __PAGE_OFFSET address as well
*/
make_page_writable((void *)addr);
free_page(addr);
totalram_pages++;
}
@@ -856,7 +845,7 @@ int kern_addr_valid(unsigned long addr)
if (pgd_none(*pgd))
return 0;
pud = pud_offset_k(addr);
pud = pud_offset_k(addr);
if (pud_none(*pud))
return 0;
@@ -544,7 +544,7 @@ static int __init blkif_init(void)
kfree(pending_grant_handles);
kfree(pending_vaddrs);
printk("%s: out of memory\n", __FUNCTION__);
return -1;
return -ENOMEM;
}
blkif_interface_init();
@@ -19,16 +19,8 @@
#include <asm-xen/gnttab.h>
#include <asm-xen/driver_util.h>
#if 0
#define ASSERT(_p) \
if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
__LINE__, __FILE__); *(int*)0=0; }
#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
#else
#define ASSERT(_p) ((void)0)
#define DPRINTK(_f, _a...) ((void)0)
#endif
#define DPRINTK(_f, _a...) pr_debug("(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
struct vbd {
blkif_vdev_t handle; /* what the domain refers to this vbd as */
@@ -11,7 +11,6 @@
#define vbd_sz(_v) ((_v)->bdev->bd_part ? \
(_v)->bdev->bd_part->nr_sects : (_v)->bdev->bd_disk->capacity)
#define bdev_put(_b) blkdev_put(_b)
unsigned long vbd_size(struct vbd *vbd)
{
@@ -69,7 +68,7 @@ int vbd_create(blkif_t *blkif, blkif_vdev_t handle, unsigned major,
void vbd_free(struct vbd *vbd)
{
if (vbd->bdev)
bdev_put(vbd->bdev);
blkdev_put(vbd->bdev);
vbd->bdev = NULL;
}
@@ -24,12 +24,9 @@
#include <asm-xen/xenbus.h>
#include "common.h"
#if 0
#undef DPRINTK
#define DPRINTK(fmt, args...) \
printk("blkback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
#endif
pr_debug("blkback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
struct backend_info
@@ -302,7 +299,7 @@ static void maybe_connect(struct backend_info *be)
*/
static void connect(struct backend_info *be)
{
struct xenbus_transaction *xbt;
xenbus_transaction_t xbt;
int err;
struct xenbus_device *dev = be->dev;
@@ -310,10 +307,9 @@ static void connect(struct backend_info *be)
/* Supply the information about the device the frontend needs */
again:
xbt = xenbus_transaction_start();
err = xenbus_transaction_start(&xbt);
if (IS_ERR(xbt)) {
err = PTR_ERR(xbt);
if (err) {
xenbus_dev_fatal(dev, err, "starting transaction");
return;
}
@@ -1,6 +0,0 @@
config XENBLOCK
tristate "Block device driver"
depends on ARCH_XEN
help
Block device driver for Xen
@@ -35,14 +35,6 @@
* IN THE SOFTWARE.
*/
#if 1
#define ASSERT(p) \
if (!(p)) { printk("Assertion '%s' failed, line %d, file %s", #p , \
__LINE__, __FILE__); *(int*)0=0; }
#else
#define ASSERT(_p)
#endif
#include <linux/version.h>
#include "block.h"
#include <linux/cdrom.h>
@@ -161,7 +153,7 @@ static int talk_to_backend(struct xenbus_device *dev,
struct blkfront_info *info)
{
const char *message = NULL;
struct xenbus_transaction *xbt;
xenbus_transaction_t xbt;
int err;
/* Create shared ring, alloc event channel. */
@@ -170,8 +162,8 @@ static int talk_to_backend(struct xenbus_device *dev,
goto out;
again:
xbt = xenbus_transaction_start();
if (IS_ERR(xbt)) {
err = xenbus_transaction_start(&xbt);
if (err) {
xenbus_dev_fatal(dev, err, "starting transaction");
goto destroy_blkring;
}
@@ -551,7 +543,7 @@ static int blkif_queue_request(struct request *req)
lsect = fsect + (bvec->bv_len >> 9) - 1;
/* install a grant reference. */
ref = gnttab_claim_grant_reference(&gref_head);
ASSERT(ref != -ENOSPC);
BUG_ON(ref == -ENOSPC);
gnttab_grant_foreign_access_ref(
ref,
@@ -69,11 +69,7 @@
#define WPRINTK(fmt, args...) ((void)0)
#endif
#if 0
#define DPRINTK(_f, _a...) printk ( KERN_ALERT _f , ## _a )
#else
#define DPRINTK(_f, _a...) ((void)0)
#endif
#define DPRINTK(_f, _a...) pr_debug ( _f , ## _a )
#if 0
#define DPRINTK_IOCTL(_f, _a...) printk ( KERN_ALERT _f , ## _a )
@@ -19,16 +19,8 @@
#include <asm-xen/gnttab.h>
#include <asm-xen/driver_util.h>
#if 0
#define ASSERT(_p) \
if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
__LINE__, __FILE__); *(int*)0=0; }
#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
#else
#define ASSERT(_p) ((void)0)
#define DPRINTK(_f, _a...) ((void)0)
#endif
#define DPRINTK(_f, _a...) pr_debug("(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
#define WPRINTK(fmt, args...) printk(KERN_WARNING "blk_tap: " fmt, ##args)
@@ -22,16 +22,8 @@
#include <asm-xen/gnttab.h>
#include <asm-xen/driver_util.h>
#if 0
#define ASSERT(_p) \
if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
__LINE__, __FILE__); *(int*)0=0; }
#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
#else
#define ASSERT(_p) ((void)0)
#define DPRINTK(_f, _a...) ((void)0)
#endif
#define DPRINTK(_f, _a...) pr_debug("(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
#define IPRINTK(fmt, args...) \
printk(KERN_INFO "xen_net: " fmt, ##args)
#define WPRINTK(fmt, args...) \
@@ -27,6 +27,7 @@
#include <linux/inetdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/ethtool.h>
#include <net/dst.h>
static int nloopbacks = 8;
@@ -122,6 +123,12 @@ static void loopback_construct(struct net_device *dev, struct net_device *lo)
/*dev->mtu = 16*1024;*/
}
static struct ethtool_ops network_ethtool_ops =
{
.get_tx_csum = ethtool_op_get_tx_csum,
.set_tx_csum = ethtool_op_set_tx_csum,
};
static int __init make_loopback(int i)
{
struct net_device *dev1, *dev2;
@@ -141,6 +148,8 @@ static int __init make_loopback(int i)
dev1->features |= NETIF_F_NO_CSUM;
dev2->features |= NETIF_F_IP_CSUM;
SET_ETHTOOL_OPS(dev2, &network_ethtool_ops);
/*
* Initialise a dummy MAC address for the 'dummy backend' interface. We
* choose the numerically largest non-broadcast address to prevent the
@@ -120,7 +120,7 @@ int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
netif_t *netif = netdev_priv(dev);
ASSERT(skb->dev == dev);
BUG_ON(skb->dev != dev);
/* Drop the packet if the target domain has no receive buffers. */
if (!netif->active ||
@@ -1,6 +0,0 @@
config XENNET
tristate "Xen network driver"
depends on NETDEVICES && ARCH_XEN
help
Network driver for Xen
@@ -154,13 +154,8 @@ static char *be_state_name[] = {
};
#endif
#ifdef DEBUG
#define DPRINTK(fmt, args...) \
printk(KERN_ALERT "netfront (%s:%d) " fmt, __FUNCTION__, \
__LINE__, ##args)
#else
#define DPRINTK(fmt, args...) ((void)0)
#endif
#define DPRINTK(fmt, args...) pr_debug("netfront (%s:%d) " fmt, \
__FUNCTION__, __LINE__, ##args)
#define IPRINTK(fmt, args...) \
printk(KERN_INFO "netfront: " fmt, ##args)
#define WPRINTK(fmt, args...) \
@@ -260,7 +255,7 @@ static int talk_to_backend(struct xenbus_device *dev,
struct netfront_info *info)
{
const char *message;
struct xenbus_transaction *xbt;
xenbus_transaction_t xbt;
int err;
err = xen_net_read_mac(dev, info->mac);
@@ -275,8 +270,8 @@ static int talk_to_backend(struct xenbus_device *dev,
goto out;
again:
xbt = xenbus_transaction_start();
if (IS_ERR(xbt)) {
err = xenbus_transaction_start(&xbt);
if (err) {
xenbus_dev_fatal(dev, err, "starting transaction");
goto destroy_ring;
}
@@ -17,16 +17,8 @@
#include <asm/io.h>
#include <asm/pgalloc.h>
#if 0
#define ASSERT(_p) \
if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
__LINE__, __FILE__); *(int*)0=0; }
#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
#else
#define ASSERT(_p) ((void)0)
#define DPRINTK(_f, _a...) ((void)0)
#endif
#define DPRINTK(_f, _a...) pr_debug("(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
typedef struct tpmif_st {
struct list_head tpmif_list;
@@ -84,11 +76,6 @@ extern int num_frontends;
#define MMAP_VADDR(t,_req) ((t)->mmap_vstart + ((_req) * PAGE_SIZE))
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#endif /* __TPMIF__BACKEND__COMMON_H__ */
/*
@@ -78,7 +78,7 @@ static int tpmback_probe(struct xenbus_device *dev,
memset(be, 0, sizeof(*be));
be->is_instance_set = FALSE;
be->is_instance_set = 0;
be->dev = dev;
dev->data = be;
@@ -89,7 +89,7 @@ static int tpmback_probe(struct xenbus_device *dev,
goto fail;
}
err = xenbus_switch_state(dev, NULL, XenbusStateInitWait);
err = xenbus_switch_state(dev, XBT_NULL, XenbusStateInitWait);
if (err) {
goto fail;
}
@@ -109,7 +109,7 @@ static void backend_changed(struct xenbus_watch *watch,
= container_of(watch, struct backend_info, backend_watch);
struct xenbus_device *dev = be->dev;
err = xenbus_scanf(NULL, dev->nodename,
err = xenbus_scanf(XBT_NULL, dev->nodename,
"instance","%li", &instance);
if (XENBUS_EXIST_ERR(err)) {
return;
@@ -120,7 +120,7 @@ static void backend_changed(struct xenbus_watch *watch,
return;
}
if (be->is_instance_set != FALSE && be->instance != instance) {
if (be->is_instance_set != 0 && be->instance != instance) {
printk(KERN_WARNING
"tpmback: changing instance (from %ld to %ld) "
"not allowed.\n",
@@ -128,7 +128,7 @@ static void backend_changed(struct xenbus_watch *watch,
return;
}
if (be->is_instance_set == FALSE) {
if (be->is_instance_set == 0) {
be->tpmif = tpmif_find(dev->otherend_id,
instance);
if (IS_ERR(be->tpmif)) {
@@ -138,7 +138,7 @@ static void backend_changed(struct xenbus_watch *watch,
return;
}
be->instance = instance;
be->is_instance_set = TRUE;
be->is_instance_set = 1;
/*
* There's an unfortunate problem:
@@ -177,7 +177,7 @@ static void frontend_changed(struct xenbus_device *dev,
break;
case XenbusStateClosing:
xenbus_switch_state(dev, NULL, XenbusStateClosing);
xenbus_switch_state(dev, XBT_NULL, XenbusStateClosing);
break;
case XenbusStateClosed:
@@ -230,15 +230,14 @@ static void maybe_connect(struct backend_info *be)
static void connect(struct backend_info *be)
{
struct xenbus_transaction *xbt;
xenbus_transaction_t xbt;
int err;
struct xenbus_device *dev = be->dev;
unsigned long ready = 1;
again:
xbt = xenbus_transaction_start();
if (IS_ERR(xbt)) {
err = PTR_ERR(xbt);
err = xenbus_transaction_start(&xbt);
if (err) {
xenbus_dev_fatal(be->dev, err, "starting transaction");
return;
}
@@ -54,14 +54,6 @@
#undef DEBUG
#if 1
#define ASSERT(_p) \
if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
__LINE__, __FILE__); *(int*)0=0; }
#else
#define ASSERT(_p)
#endif
/* locally visible variables */
static grant_ref_t gref_head;
static struct tpm_private my_private;
@@ -80,12 +72,8 @@ static int tpm_xmit(struct tpm_private *tp,
const u8 * buf, size_t count, int userbuffer,
void *remember);
#if DEBUG
#define DPRINTK(fmt, args...) \
printk(KERN_ALERT "xen_tpm_fr (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args)
#else
#define DPRINTK(fmt, args...) ((void)0)
#endif
pr_debug("xen_tpm_fr (%s:%d) " fmt, __FUNCTION__, __LINE__, ##args)
#define IPRINTK(fmt, args...) \
printk(KERN_INFO "xen_tpm_fr: " fmt, ##args)
#define WPRINTK(fmt, args...) \
@@ -102,11 +90,8 @@ tx_buffer_copy(struct tx_buffer *txb, const u8 * src, int len,
copied = txb->size;
}
if (isuserbuffer) {
if (copy_from_user(txb->data,
src,
copied)) {
if (copy_from_user(txb->data, src, copied))
return -EFAULT;
}
} else {
memcpy(txb->data, src, copied);
}
@@ -196,15 +181,12 @@ EXPORT_SYMBOL(tpm_fe_unregister_receiver);
static int tpm_fe_send_upperlayer(const u8 * buf, size_t count,
const void *ptr)
{
int rc;
int rc = 0;
down(&upperlayer_lock);
if (upperlayer_tpmfe && upperlayer_tpmfe->receive) {
if (upperlayer_tpmfe && upperlayer_tpmfe->receive)
rc = upperlayer_tpmfe->receive(buf, count, ptr);
} else {
rc = 0;
}
up(&upperlayer_lock);
return rc;
@@ -253,8 +235,8 @@ fail:
static void destroy_tpmring(struct tpmfront_info *info, struct tpm_private *tp)
{
tpmif_set_connected_state(tp, FALSE);
if ( tp->tx != NULL ) {
tpmif_set_connected_state(tp, 0);
if (tp->tx != NULL) {
gnttab_end_foreign_access(info->ring_ref, 0,
(unsigned long)tp->tx);
tp->tx = NULL;
@@ -271,7 +253,7 @@ static int talk_to_backend(struct xenbus_device *dev,
{
const char *message = NULL;
int err;
struct xenbus_transaction *xbt;
xenbus_transaction_t xbt;
err = setup_tpmring(dev, info);
if (err) {
@@ -280,8 +262,8 @@ static int talk_to_backend(struct xenbus_device *dev,
}
again:
xbt = xenbus_transaction_start();
if (IS_ERR(xbt)) {
err = xenbus_transaction_start(&xbt);
if (err) {
xenbus_dev_fatal(dev, err, "starting transaction");
goto destroy_tpmring;
}
@@ -341,15 +323,15 @@ static void backend_changed(struct xenbus_device *dev,
break;
case XenbusStateConnected:
tpmif_set_connected_state(tp, TRUE);
tpmif_set_connected_state(tp, 1);
break;
case XenbusStateClosing:
tpmif_set_connected_state(tp, FALSE);
tpmif_set_connected_state(tp, 0);
break;
case XenbusStateClosed:
if (tp->is_suspended == FALSE) {
if (tp->is_suspended == 0) {
device_unregister(&dev->dev);
}
break;
@@ -364,7 +346,7 @@ static int tpmfront_probe(struct xenbus_device *dev,
struct tpmfront_info *info;
int handle;
err = xenbus_scanf(NULL, dev->nodename,
err = xenbus_scanf(XBT_NULL, dev->nodename,
"handle", "%i", &handle);
if (XENBUS_EXIST_ERR(err))
return err;
@@ -409,20 +391,19 @@ static int
tpmfront_suspend(struct xenbus_device *dev)
{
struct tpm_private *tp = &my_private;
u32 ctr = 0;
u32 ctr;
/* lock, so no app can send */
down(&suspend_lock);
tp->is_suspended = TRUE;
tp->is_suspended = 1;
while (atomic_read(&tp->tx_busy) && ctr <= 25) {
for (ctr = 0; atomic_read(&tp->tx_busy) && ctr <= 25; ctr++) {
if ((ctr % 10) == 0)
printk("TPM-FE [INFO]: Waiting for outstanding request.\n");
/*
* Wait for a request to be responded to.
*/
interruptible_sleep_on_timeout(&tp->wait_q, 100);
ctr++;
}
if (atomic_read(&tp->tx_busy)) {
@@ -440,16 +421,13 @@ static int
tpmfront_resume(struct xenbus_device *dev)
{
struct tpmfront_info *info = dev->data;
int err = talk_to_backend(dev, info);
return err;
return talk_to_backend(dev, info);
}
static void
tpmif_connect(u16 evtchn, domid_t domid)
{
int err = 0;
int err;
struct tpm_private *tp = &my_private;
tp->evtchn = evtchn;
@@ -493,12 +471,8 @@ tpm_allocate_buffers(struct tpm_private *tp)
{
unsigned int i;
i = 0;
while (i < TPMIF_TX_RING_SIZE) {
for (i = 0; i < TPMIF_TX_RING_SIZE; i++)
tp->tx_buffers[i] = tx_buffer_alloc();
i++;
}
return 1;
}
@@ -521,9 +495,7 @@ tpmif_rx_action(unsigned long unused)
goto exit;
}
i = 0;
while (i < TPMIF_TX_RING_SIZE &&
offset < received) {
for (i = 0; i < TPMIF_TX_RING_SIZE && offset < received; i++) {
struct tx_buffer *txb = tp->tx_buffers[i];
tpmif_tx_request_t *tx;
unsigned int tocopy;
@@ -539,7 +511,6 @@ tpmif_rx_action(unsigned long unused)
gnttab_release_grant_reference(&gref_head, tx->ref);
offset += tocopy;
i++;
}
tpm_fe_send_upperlayer(buffer, received, tp->tx_remember);
@@ -583,19 +554,18 @@ tpm_xmit(struct tpm_private *tp,
return -EBUSY;
}
if (tp->is_connected != TRUE) {
if (tp->is_connected != 1) {
spin_unlock_irq(&tp->tx_lock);
return -EIO;
}
i = 0;
while (count > 0 && i < TPMIF_TX_RING_SIZE) {
for (i = 0; count > 0 && i < TPMIF_TX_RING_SIZE; i++) {
struct tx_buffer *txb = tp->tx_buffers[i];
int copied;
if (NULL == txb) {
DPRINTK("txb (i=%d) is NULL. buffers initilized?\n", i);
DPRINTK("Not transmitting anything!\n");
DPRINTK("txb (i=%d) is NULL. buffers initilized?\n"
"Not transmitting anything!\n", i);
spin_unlock_irq(&tp->tx_lock);
return -EFAULT;
}
@@ -603,6 +573,7 @@ tpm_xmit(struct tpm_private *tp,
isuserbuffer);
if (copied < 0) {
/* An error occurred */
spin_unlock_irq(&tp->tx_lock);
return copied;
}
count -= copied;
@@ -618,9 +589,10 @@ tpm_xmit(struct tpm_private *tp,
txb->data[0],txb->data[1],txb->data[2],txb->data[3]);
/* get the granttable reference for this page */
tx->ref = gnttab_claim_grant_reference( &gref_head );
tx->ref = gnttab_claim_grant_reference(&gref_head);
if(-ENOSPC == tx->ref ) {
if (-ENOSPC == tx->ref) {
spin_unlock_irq(&tp->tx_lock);
DPRINTK(" Grant table claim reference failed in func:%s line:%d file:%s\n", __FUNCTION__, __LINE__, __FILE__);
return -ENOSPC;
}
@@ -628,7 +600,6 @@ tpm_xmit(struct tpm_private *tp,
tp->backend_id,
(tx->addr >> PAGE_SHIFT),
0 /*RW*/);
i++;
wmb();
}
@@ -672,7 +643,7 @@ static void tpmif_set_connected_state(struct tpm_private *tp, u8 is_connected)
* should disconnect - assumption is that we will resume
* The semaphore keeps apps from sending.
*/
if (is_connected == FALSE && tp->is_suspended == TRUE) {
if (is_connected == 0 && tp->is_suspended == 1) {
return;
}
@@ -681,8 +652,8 @@ static void tpmif_set_connected_state(struct tpm_private *tp, u8 is_connected)
* after being suspended - now resuming.
* This also removes the suspend state.
*/
if (is_connected == TRUE && tp->is_suspended == TRUE) {
tp->is_suspended = FALSE;
if (is_connected == 1 && tp->is_suspended == 1) {
tp->is_suspended = 0;
/* unlock, so apps can resume sending */
up(&suspend_lock);
}
@@ -1,11 +1,6 @@
#ifndef TPM_FRONT_H
#define TPM_FRONT_H
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
struct tpm_private {
tpmif_tx_interface_t *tx;
unsigned int evtchn;
@@ -34,13 +34,8 @@
/* xenbus_probe.c */
extern char *kasprintf(const char *fmt, ...);
#if 0
#define DPRINTK(fmt, args...) \
printk("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
#else
#define DPRINTK(fmt, args...) ((void)0)
#endif
pr_debug("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
int xenbus_watch_path(struct xenbus_device *dev, const char *path,
struct xenbus_watch *watch,
@@ -87,7 +82,7 @@ EXPORT_SYMBOL(xenbus_watch_path2);
int xenbus_switch_state(struct xenbus_device *dev,
struct xenbus_transaction *xbt,
xenbus_transaction_t xbt,
XenbusState state)
{
/* We check whether the state is currently set to the given value, and
@@ -47,7 +47,7 @@
struct xenbus_dev_transaction {
struct list_head list;
struct xenbus_transaction *handle;
xenbus_transaction_t handle;
};
struct xenbus_dev_data {
@@ -147,13 +147,11 @@ static ssize_t xenbus_dev_write(struct file *filp,
}
if (u->u.msg.type == XS_TRANSACTION_START) {
trans->handle = (struct xenbus_transaction *)
simple_strtoul(reply, NULL, 0);
trans->handle = simple_strtoul(reply, NULL, 0);
list_add(&trans->list, &u->transactions);
} else if (u->u.msg.type == XS_TRANSACTION_END) {
list_for_each_entry(trans, &u->transactions, list)
if ((unsigned long)trans->handle ==
(unsigned long)u->u.msg.tx_id)
if (trans->handle == u->u.msg.tx_id)
break;
BUG_ON(&trans->list == &u->transactions);
list_del(&trans->list);
@@ -27,12 +27,8 @@
* IN THE SOFTWARE.
*/
#if 0
#define DPRINTK(fmt, args...) \
printk("xenbus_probe (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
#else
#define DPRINTK(fmt, args...) ((void)0)
#endif
pr_debug("xenbus_probe (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
#include <linux/kernel.h>
#include <linux/err.h>
@@ -470,12 +466,17 @@ static int cleanup_dev(struct device *dev, void *data)
DPRINTK("%s", info->nodename);
if (!strncmp(xendev->nodename, info->nodename, len)) {
info->dev = xendev;
get_device(dev);
return 1;
}
return 0;
/* Match the info->nodename path, or any subdirectory of that path. */
if (strncmp(xendev->nodename, info->nodename, len))
return 0;
/* If the node name is longer, ensure it really is a subdirectory. */
if ((strlen(xendev->nodename) > len) && (xendev->nodename[len] != '/'))
return 0;
info->dev = xendev;
get_device(dev);
return 1;
}
static void xenbus_cleanup_devices(const char *path, struct bus_type *bus)
@@ -190,7 +190,7 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg)
}
/* Send message to xs, get kmalloc'ed reply. ERR_PTR() on error. */
static void *xs_talkv(struct xenbus_transaction *t,
static void *xs_talkv(xenbus_transaction_t t,
enum xsd_sockmsg_type type,
const struct kvec *iovec,
unsigned int num_vecs,
@@ -201,7 +201,7 @@ static void *xs_talkv(struct xenbus_transaction *t,
unsigned int i;
int err;
msg.tx_id = (u32)(unsigned long)t;
msg.tx_id = t;
msg.req_id = 0;
msg.type = type;
msg.len = 0;
@@ -242,7 +242,7 @@ static void *xs_talkv(struct xenbus_transaction *t,
}
/* Simplified version of xs_talkv: single message. */
static void *xs_single(struct xenbus_transaction *t,
static void *xs_single(xenbus_transaction_t t,
enum xsd_sockmsg_type type,
const char *string,
unsigned int *len)
@@ -309,7 +309,7 @@ static char **split(char *strings, unsigned int len, unsigned int *num)
return ret;
}
char **xenbus_directory(struct xenbus_transaction *t,
char **xenbus_directory(xenbus_transaction_t t,
const char *dir, const char *node, unsigned int *num)
{
char *strings, *path;
@@ -329,7 +329,7 @@ char **xenbus_directory(struct xenbus_transaction *t,
EXPORT_SYMBOL(xenbus_directory);
/* Check if a path exists. Return 1 if it does. */
int xenbus_exists(struct xenbus_transaction *t,
int xenbus_exists(xenbus_transaction_t t,
const char *dir, const char *node)
{
char **d;
@@ -347,7 +347,7 @@ EXPORT_SYMBOL(xenbus_exists);
* Returns a kmalloced value: call free() on it after use.
* len indicates length in bytes.
*/
void *xenbus_read(struct xenbus_transaction *t,
void *xenbus_read(xenbus_transaction_t t,
const char *dir, const char *node, unsigned int *len)
{
char *path;
@@ -366,7 +366,7 @@ EXPORT_SYMBOL(xenbus_read);
/* Write the value of a single file.
* Returns -err on failure.
*/
int xenbus_write(struct xenbus_transaction *t,
int xenbus_write(xenbus_transaction_t t,
const char *dir, const char *node, const char *string)
{
const char *path;
@@ -389,7 +389,7 @@ int xenbus_write(struct xenbus_transaction *t,
EXPORT_SYMBOL(xenbus_write);
/* Create a new directory. */
int xenbus_mkdir(struct xenbus_transaction *t,
int xenbus_mkdir(xenbus_transaction_t t,
const char *dir, const char *node)
{
char *path;
@@ -406,7 +406,7 @@ int xenbus_mkdir(struct xenbus_transaction *t,
EXPORT_SYMBOL(xenbus_mkdir);
/* Destroy a file or directory (directories must be empty). */
int xenbus_rm(struct xenbus_transaction *t, const char *dir, const char *node)
int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node)
{
char *path;
int ret;
@@ -424,30 +424,28 @@ EXPORT_SYMBOL(xenbus_rm);
/* Start a transaction: changes by others will not be seen during this
* transaction, and changes will not be visible to others until end.
*/
struct xenbus_transaction *xenbus_transaction_start(void)
int xenbus_transaction_start(xenbus_transaction_t *t)
{
char *id_str;
unsigned long id;
down_read(&xs_state.suspend_mutex);
id_str = xs_single(XBT_NULL, XS_TRANSACTION_START, "", NULL);
if (IS_ERR(id_str)) {
up_read(&xs_state.suspend_mutex);
return (struct xenbus_transaction *)id_str;
return PTR_ERR(id_str);
}
id = simple_strtoul(id_str, NULL, 0);
*t = simple_strtoul(id_str, NULL, 0);
kfree(id_str);
return (struct xenbus_transaction *)id;
return 0;
}
EXPORT_SYMBOL(xenbus_transaction_start);
/* End a transaction.
* If abandon is true, transaction is discarded instead of committed.
*/
int xenbus_transaction_end(struct xenbus_transaction *t, int abort)
int xenbus_transaction_end(xenbus_transaction_t t, int abort)
{
char abortstr[2];
int err;
@@ -466,7 +464,7 @@ int xenbus_transaction_end(struct xenbus_transaction *t, int abort)
EXPORT_SYMBOL(xenbus_transaction_end);
/* Single read and scanf: returns -errno or num scanned. */
int xenbus_scanf(struct xenbus_transaction *t,
int xenbus_scanf(xenbus_transaction_t t,
const char *dir, const char *node, const char *fmt, ...)
{
va_list ap;
@@ -489,7 +487,7 @@ int xenbus_scanf(struct xenbus_transaction *t,
EXPORT_SYMBOL(xenbus_scanf);
/* Single printf and write: returns -errno or 0. */
int xenbus_printf(struct xenbus_transaction *t,
int xenbus_printf(xenbus_transaction_t t,
const char *dir, const char *node, const char *fmt, ...)
{
va_list ap;
@@ -515,7 +513,7 @@ int xenbus_printf(struct xenbus_transaction *t,
EXPORT_SYMBOL(xenbus_printf);
/* Takes tuples of names, scanf-style args, and void **, NULL terminated. */
int xenbus_gather(struct xenbus_transaction *t, const char *dir, ...)
int xenbus_gather(xenbus_transaction_t t, const char *dir, ...)
{
va_list ap;
const char *name;
@@ -32,6 +32,7 @@
#include <asm-xen/xen-public/xen.h>
#include <asm-xen/xen-public/sched.h>
#include <asm-xen/xen-public/nmi.h>
#define _hypercall0(type, name) \
({ \
@@ -300,6 +301,14 @@ HYPERVISOR_suspend(
SHUTDOWN_suspend, srec);
}
static inline int
HYPERVISOR_nmi_op(
unsigned long op,
unsigned long arg)
{
return _hypercall2(int, nmi_op, op, arg);
}
#endif /* __HYPERCALL_H__ */
/*
@@ -0,0 +1,33 @@
/*
* include/asm-xen/asm-i386/mach-xen/mach_traps.h
*
* Machine specific NMI handling for Xen
*/
#ifndef _MACH_TRAPS_H
#define _MACH_TRAPS_H
#include <linux/bitops.h>
#include <asm-xen/xen-public/nmi.h>
static inline void clear_mem_error(unsigned char reason) {}
static inline void clear_io_check_error(unsigned char reason) {}
static inline unsigned char get_nmi_reason(void)
{
shared_info_t *s = HYPERVISOR_shared_info;
unsigned char reason = 0;
/* construct a value which looks like it came from
* port 0x61.
*/
if (test_bit(_XEN_NMIREASON_io_error, &s->arch.nmi_reason))
reason |= 0x40;
if (test_bit(_XEN_NMIREASON_parity_error, &s->arch.nmi_reason))
reason |= 0x80;
return reason;
}
static inline void reassert_nmi(void) {}
#endif /* !_MACH_TRAPS_H */
@@ -29,6 +29,7 @@ void __init machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c)
extern void hypervisor_callback(void);
extern void failsafe_callback(void);
extern void nmi(void);
static void __init machine_specific_arch_setup(void)
{
@@ -36,5 +37,7 @@ static void __init machine_specific_arch_setup(void)
__KERNEL_CS, (unsigned long)hypervisor_callback,
__KERNEL_CS, (unsigned long)failsafe_callback);
HYPERVISOR_nmi_op(XENNMI_register_callback, (unsigned long)&nmi);
machine_specific_modify_cpu_capabilities(&boot_cpu_data);
}
@@ -287,9 +287,9 @@ HYPERVISOR_vcpu_op(
}
static inline int
HYPERVISOR_switch_to_user(void)
HYPERVISOR_iret(void)
{
return _hypercall0(int, switch_to_user);
return _hypercall0(int, iret);
}
static inline int
@@ -307,6 +307,14 @@ HYPERVISOR_suspend(
SHUTDOWN_suspend, srec);
}
static inline int
HYPERVISOR_nmi_op(
unsigned long op,
unsigned long arg)
{
return _hypercall2(int, nmi_op, op, arg);
}
#endif /* __HYPERCALL_H__ */
/*
@@ -35,6 +35,7 @@ void __init machine_specific_modify_cpu_capabilities(struct cpuinfo_x86 *c)
extern void hypervisor_callback(void);
extern void failsafe_callback(void);
extern void nmi(void);
static void __init machine_specific_arch_setup(void)
{
@@ -43,5 +44,9 @@ static void __init machine_specific_arch_setup(void)
(unsigned long) failsafe_callback,
(unsigned long) system_call);
#ifdef CONFIG_X86_LOCAL_APIC
HYPERVISOR_nmi_op(XENNMI_register_callback, (unsigned long)&nmi);
#endif
machine_specific_modify_cpu_capabilities(&boot_cpu_data);
}
@@ -0,0 +1,75 @@
/*
* linux/include/asm-i386/nmi.h
*/
#ifndef ASM_NMI_H
#define ASM_NMI_H
#include <linux/pm.h>
#include <asm-xen/xen-public/nmi.h>
struct pt_regs;
typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu);
/**
* set_nmi_callback
*
* Set a handler for an NMI. Only one handler may be
* set. Return 1 if the NMI was handled.
*/
void set_nmi_callback(nmi_callback_t callback);
/**
* unset_nmi_callback
*
* Remove the handler previously set.
*/
void unset_nmi_callback(void);
#ifdef CONFIG_PM
/** Replace the PM callback routine for NMI. */
struct pm_dev * set_nmi_pm_callback(pm_callback callback);
/** Unset the PM callback routine back to the default. */
void unset_nmi_pm_callback(struct pm_dev * dev);
#else
static inline struct pm_dev * set_nmi_pm_callback(pm_callback callback)
{
return 0;
}
static inline void unset_nmi_pm_callback(struct pm_dev * dev)
{
}
#endif /* CONFIG_PM */
extern void default_do_nmi(struct pt_regs *);
extern void die_nmi(char *str, struct pt_regs *regs);
static inline unsigned char get_nmi_reason(void)
{
shared_info_t *s = HYPERVISOR_shared_info;
unsigned char reason = 0;
/* construct a value which looks like it came from
* port 0x61.
*/
if (test_bit(_XEN_NMIREASON_io_error, &s->arch.nmi_reason))
reason |= 0x40;
if (test_bit(_XEN_NMIREASON_parity_error, &s->arch.nmi_reason))
reason |= 0x80;
return reason;
}
extern int panic_on_timeout;
extern int unknown_nmi_panic;
extern int check_nmi_watchdog(void);
#endif /* ASM_NMI_H */
@@ -417,12 +417,7 @@ static inline pud_t *__pud_offset_k(pud_t *pud, unsigned long address)
Other CPUs get synced lazily via the page fault handler. */
static inline pud_t *pud_offset_k(unsigned long address)
{
unsigned long addr;
addr = pgd_val(init_level4_pgt[pud_index(address)]);
addr &= PHYSICAL_PAGE_MASK; /* machine physical */
addr = machine_to_phys(addr);
return __pud_offset_k((pud_t *)__va(addr), address);
return pud_offset(pgd_offset_k(address), address);
}
/* PMD - Level 2 access */
+14 -14
View File
@@ -37,7 +37,7 @@
#include <asm-xen/xen-public/io/xenbus.h>
#include <asm-xen/xen-public/io/xs_wire.h>
#define XBT_NULL NULL
#define XBT_NULL 0
/* Register callback to watch this node. */
struct xenbus_watch
@@ -102,35 +102,35 @@ int xenbus_register_frontend(struct xenbus_driver *drv);
int xenbus_register_backend(struct xenbus_driver *drv);
void xenbus_unregister_driver(struct xenbus_driver *drv);
struct xenbus_transaction;
typedef u32 xenbus_transaction_t;
char **xenbus_directory(struct xenbus_transaction *t,
char **xenbus_directory(xenbus_transaction_t t,
const char *dir, const char *node, unsigned int *num);
void *xenbus_read(struct xenbus_transaction *t,
void *xenbus_read(xenbus_transaction_t t,
const char *dir, const char *node, unsigned int *len);
int xenbus_write(struct xenbus_transaction *t,
int xenbus_write(xenbus_transaction_t t,
const char *dir, const char *node, const char *string);
int xenbus_mkdir(struct xenbus_transaction *t,
int xenbus_mkdir(xenbus_transaction_t t,
const char *dir, const char *node);
int xenbus_exists(struct xenbus_transaction *t,
int xenbus_exists(xenbus_transaction_t t,
const char *dir, const char *node);
int xenbus_rm(struct xenbus_transaction *t, const char *dir, const char *node);
struct xenbus_transaction *xenbus_transaction_start(void);
int xenbus_transaction_end(struct xenbus_transaction *t, int abort);
int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node);
int xenbus_transaction_start(xenbus_transaction_t *t);
int xenbus_transaction_end(xenbus_transaction_t t, int abort);
/* Single read and scanf: returns -errno or num scanned if > 0. */
int xenbus_scanf(struct xenbus_transaction *t,
int xenbus_scanf(xenbus_transaction_t t,
const char *dir, const char *node, const char *fmt, ...)
__attribute__((format(scanf, 4, 5)));
/* Single printf and write: returns -errno or 0. */
int xenbus_printf(struct xenbus_transaction *t,
int xenbus_printf(xenbus_transaction_t t,
const char *dir, const char *node, const char *fmt, ...)
__attribute__((format(printf, 4, 5)));
/* Generic read function: NULL-terminated triples of name,
* sprintf-style type string, and pointer. Returns 0 or errno.*/
int xenbus_gather(struct xenbus_transaction *t, const char *dir, ...);
int xenbus_gather(xenbus_transaction_t t, const char *dir, ...);
/* notifer routines for when the xenstore comes up */
int register_xenstore_notifier(struct notifier_block *nb);
@@ -196,7 +196,7 @@ int xenbus_watch_path2(struct xenbus_device *dev, const char *path,
* XenbusStateClosing, and the error will be saved in the store.
*/
int xenbus_switch_state(struct xenbus_device *dev,
struct xenbus_transaction *xbt,
xenbus_transaction_t xbt,
XenbusState new_state);
@@ -0,0 +1,43 @@
--- ref-linux-2.6.12/arch/i386/kernel/traps.c 2005-12-19 09:23:44.000000000 +0000
+++ linux-2.6.12-xen0/arch/i386/kernel/traps.c 2006-01-05 15:51:52.000000000 +0000
@@ -521,18 +521,11 @@
static void io_check_error(unsigned char reason, struct pt_regs * regs)
{
- unsigned long i;
-
printk("NMI: IOCK error (debug interrupt?)\n");
show_registers(regs);
/* Re-enable the IOCK line, wait for a few seconds */
- reason = (reason & 0xf) | 8;
- outb(reason, 0x61);
- i = 2000;
- while (--i) udelay(1000);
- reason &= ~8;
- outb(reason, 0x61);
+ clear_io_check_error(reason);
}
static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
--- ref-linux-2.6.12/include/asm-i386/mach-default/mach_traps.h 2005-06-17 20:48:29.000000000 +0100
+++ linux-2.6.12-xen0/include/asm-i386/mach-default/mach_traps.h 2006-01-05 15:52:33.000000000 +0000
@@ -15,6 +15,18 @@
outb(reason, 0x61);
}
+static inline void clear_io_check_error(unsigned char reason)
+{
+ unsigned long i;
+
+ reason = (reason & 0xf) | 8;
+ outb(reason, 0x61);
+ i = 2000;
+ while (--i) udelay(1000);
+ reason &= ~8;
+ outb(reason, 0x61);
+}
+
static inline unsigned char get_nmi_reason(void)
{
return inb(0x61);
+7 -3
View File
@@ -21,7 +21,7 @@ builder='vmx'
memory = 256
# A name for your domain. All domains must have different names.
name = "ExampleVMXDomain"
name = "ExampleVTIDomain"
# List of which CPUS this domain is allowed to use, default Xen picks
#cpus = "" # leave to Xen to pick
@@ -30,7 +30,11 @@ name = "ExampleVMXDomain"
# Optionally define mac and/or bridge for the network interfaces.
# Random MACs are assigned if not given.
#vif = [ 'mac=00:16:3e:00:00:11, bridge=xen-br0' ]
#vif = [ 'type=ioemu, mac=00:16:3e:00:00:11, bridge=xenbr0' ]
# type=ioemu specify the NIC is an ioemu device not netfront
vif = [ 'type=ioemu, bridge=xenbr0' ]
# for multiple NICs in device model, 3 in this example
#vif = [ 'type=ioemu, bridge=xenbr0', 'type=ioemu', 'type=ioemu']
#----------------------------------------------------------------------------
# Define the disk devices you want the domain to have access to, and
@@ -53,7 +57,7 @@ disk = [ 'file:/var/images/xenia64.img,ioemu:hda,w' ]
#============================================================================
# New stuff
device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm.debug'
device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
# Advanced users only. Don't touch if you don't know what you're doing
memmap = '/usr/lib/xen/boot/mem-map.sxp'
-1
View File
@@ -55,7 +55,6 @@ static struct hvm_info_table *
get_hvm_info_table(void)
{
struct hvm_info_table *t;
int i;
if (table != NULL)
return table;
+2 -2
View File
@@ -257,11 +257,11 @@ void pcm_hw_clear (HWVoice *hw, void *buf, int len)
switch (hw->fmt) {
case AUD_FMT_S16:
case AUD_FMT_S8:
memset (buf, len << hw->shift, 0x00);
memset (buf, 0x00, len << hw->shift);
break;
case AUD_FMT_U8:
memset (buf, len << hw->shift, 0x80);
memset (buf, 0x80, len << hw->shift);
break;
case AUD_FMT_U16:
-2
View File
@@ -41,7 +41,6 @@ static void no_hw_run (HWVoice *hw)
{
NoVoice *no = (NoVoice *) hw;
int rpos, live, decr, samples;
uint8_t *dst;
st_sample_t *src;
int64_t now = qemu_get_clock (vm_clock);
int64_t ticks = now - no->old_ticks;
@@ -82,7 +81,6 @@ static int no_hw_write (SWVoice *sw, void *buf, int len)
static int no_hw_init (HWVoice *hw, int freq, int nchannels, audfmt_e fmt)
{
NoVoice *no = (NoVoice *) hw;
hw->freq = freq;
hw->nchannels = nchannels;
hw->fmt = fmt;
+3
View File
@@ -63,6 +63,9 @@ int cpu_get_pic_interrupt(CPUX86State *s);
/* MSDOS compatibility mode FPU exception support */
void cpu_set_ferr(CPUX86State *s);
/* helper2.c */
void cpu_x86_set_a20(CPUX86State *env, int a20_state);
#if defined(__i386__) || defined(__x86_64__)
#define TARGET_PAGE_BITS 12
#elif defined(__ia64__)
-2
View File
@@ -382,8 +382,6 @@ void pc_init(uint64_t ram_size, int vga_ram_size, int boot_device,
{
char buf[1024];
int ret, linux_boot, initrd_size, i, nb_nics1;
unsigned long bios_offset, vga_bios_offset;
int bios_size, isa_bios_size;
PCIBus *pci_bus;
extern void * shared_vram;
+1 -1
View File
@@ -1204,7 +1204,7 @@ int store_console_dev(int domid, char *pts)
return -1;
}
strcat(path, "/console/tty");
if (!xs_write(xs, NULL, path, pts, strlen(pts))) {
if (!xs_write(xs, XBT_NULL, path, pts, strlen(pts))) {
fprintf(logfile, "xs_write for console fail");
return -1;
}
+3
View File
@@ -354,6 +354,9 @@ int register_savevm(const char *idstr,
void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
/* port-e9.c */
void port_e9_init(void);
/* block.c */
typedef struct BlockDriverState BlockDriverState;
typedef struct BlockDriver BlockDriver;
+3 -10
View File
@@ -23,7 +23,8 @@ unsigned long xc_ia64_fpsr_default(void)
}
int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
uint32_t max_factor, uint32_t flags, int (*suspend)(void))
uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
int (*suspend)(int domid))
{
PERROR("xc_linux_save not implemented\n");
return -1;
@@ -664,15 +665,7 @@ int xc_vmx_build(int xc_handle,
goto error_out;
}
if ( xc_vcpu_getcontext(xc_handle, domid, 0, ctxt) ){
PERROR("Could not get vcpu context");
goto error_out;
}
if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ) {
ERROR("Domain is already constructed");
goto error_out;
}
memset(ctxt, 0, sizeof(*ctxt));
if ( setup_guest(xc_handle, domid, (unsigned long)memsize, image, image_size,
control_evtchn, store_evtchn, store_mfn ) < 0 ){
+3 -13
View File
@@ -33,10 +33,8 @@
#endif
#ifdef __ia64__
#define already_built(ctxt) (0)
#define get_tot_pages xc_get_max_pages
#else
#define already_built(ctxt) ((ctxt)->ctrlreg[3] != 0)
#define get_tot_pages xc_get_tot_pages
#endif
@@ -800,17 +798,7 @@ int xc_linux_build(int xc_handle,
goto error_out;
}
if ( xc_vcpu_getcontext(xc_handle, domid, 0, ctxt) )
{
PERROR("Could not get vcpu context");
goto error_out;
}
if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) || already_built(ctxt) )
{
ERROR("Domain is already constructed");
goto error_out;
}
memset(ctxt, 0, sizeof(*ctxt));
if ( setup_guest(xc_handle, domid, image, image_size,
initrd_gfd, initrd_size, nr_pages,
@@ -865,6 +853,8 @@ int xc_linux_build(int xc_handle,
ctxt->user_regs.esi = vstartinfo_start;
ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */
ctxt->flags = VGCF_IN_KERNEL;
/* FPU is set up to default initial state. */
memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
-7
View File
@@ -170,13 +170,6 @@ int xc_linux_restore(int xc_handle, int io_fd,
}
/* Only have to worry about vcpu 0 even for SMP */
if (xc_vcpu_getcontext( xc_handle, dom, 0, &ctxt)) {
ERR("Could not get vcpu context");
goto out;
}
/* Read the saved P2M frame list */
if(!(p2m_frame_list = malloc(P2M_FL_SIZE))) {
ERR("Couldn't allocate p2m_frame_list array");
+1 -12
View File
@@ -651,18 +651,7 @@ int xc_vmx_build(int xc_handle,
goto error_out;
}
if ( xc_vcpu_getcontext(xc_handle, domid, 0, ctxt) )
{
PERROR("Could not get vcpu context");
goto error_out;
}
if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
(ctxt->ctrlreg[3] != 0) )
{
ERROR("Domain is already constructed");
goto error_out;
}
memset(ctxt, 0, sizeof(*ctxt));
if ( setup_guest(xc_handle, domid, memsize, image, image_size, nr_pages,
ctxt, op.u.getdomaininfo.shared_info_frame, control_evtchn,
+2 -2
View File
@@ -21,9 +21,9 @@
* @parm dom the id of the domain
* @return 0 on success, -1 on failure
*/
int xc_linux_save(int xc_handle, int fd, uint32_t dom, uint32_t max_iters,
int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
int (*suspend)(int));
int (*suspend)(int domid));
/**
+17 -17
View File
@@ -66,7 +66,7 @@ static PyObject *none(bool result);
static int parse_transaction_path(XsHandle *self, PyObject *args,
struct xs_handle **xh,
struct xs_transaction_handle **th,
xs_transaction_t *th,
char **path);
@@ -83,7 +83,7 @@ static int parse_transaction_path(XsHandle *self, PyObject *args,
static PyObject *xspy_read(XsHandle *self, PyObject *args)
{
struct xs_handle *xh;
struct xs_transaction_handle *th;
xs_transaction_t th;
char *path;
char *xsval;
@@ -120,7 +120,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
{
static char *arg_spec = "sss#";
struct xs_handle *xh = xshandle(self);
struct xs_transaction_handle *th;
xs_transaction_t th;
char *thstr;
char *path;
char *data;
@@ -132,7 +132,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path, &data, &data_n))
return NULL;
th = (struct xs_transaction_handle *)strtoul(thstr, NULL, 16);
th = strtoul(thstr, NULL, 16);
Py_BEGIN_ALLOW_THREADS
result = xs_write(xh, th, path, data, data_n);
@@ -155,7 +155,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
static PyObject *xspy_ls(XsHandle *self, PyObject *args)
{
struct xs_handle *xh;
struct xs_transaction_handle *th;
xs_transaction_t th;
char *path;
char **xsval;
@@ -193,7 +193,7 @@ static PyObject *xspy_ls(XsHandle *self, PyObject *args)
static PyObject *xspy_mkdir(XsHandle *self, PyObject *args)
{
struct xs_handle *xh;
struct xs_transaction_handle *th;
xs_transaction_t th;
char *path;
bool result;
@@ -221,7 +221,7 @@ static PyObject *xspy_mkdir(XsHandle *self, PyObject *args)
static PyObject *xspy_rm(XsHandle *self, PyObject *args)
{
struct xs_handle *xh;
struct xs_transaction_handle *th;
xs_transaction_t th;
char *path;
bool result;
@@ -256,7 +256,7 @@ static PyObject *xspy_get_permissions(XsHandle *self, PyObject *args)
unsigned int perms_n = 0;
int i;
struct xs_transaction_handle *th;
xs_transaction_t th;
char *thstr;
if (!xh)
@@ -264,7 +264,7 @@ static PyObject *xspy_get_permissions(XsHandle *self, PyObject *args)
if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path))
return NULL;
th = (struct xs_transaction_handle *)strtoul(thstr, NULL, 16);
th = strtoul(thstr, NULL, 16);
Py_BEGIN_ALLOW_THREADS
perms = xs_get_permissions(xh, th, path, &perms_n);
@@ -312,7 +312,7 @@ static PyObject *xspy_set_permissions(XsHandle *self, PyObject *args)
int xsperms_n;
PyObject *tuple0 = NULL;
struct xs_transaction_handle *th;
xs_transaction_t th;
char *thstr;
if (!xh)
@@ -320,7 +320,7 @@ static PyObject *xspy_set_permissions(XsHandle *self, PyObject *args)
if (!PyArg_ParseTuple(args, "ssO", &thstr, &path, &perms))
goto exit;
th = (struct xs_transaction_handle *)strtoul(thstr, NULL, 16);
th = strtoul(thstr, NULL, 16);
if (!PyList_Check(perms)) {
PyErr_SetString(PyExc_RuntimeError, "perms must be a list");
@@ -509,7 +509,7 @@ static PyObject *xspy_unwatch(XsHandle *self, PyObject *args)
static PyObject *xspy_transaction_start(XsHandle *self)
{
struct xs_handle *xh = xshandle(self);
struct xs_transaction_handle *th;
xs_transaction_t th;
char thstr[MAX_STRLEN(unsigned long) + 1];
if (!xh)
@@ -519,7 +519,7 @@ static PyObject *xspy_transaction_start(XsHandle *self)
th = xs_transaction_start(xh);
Py_END_ALLOW_THREADS
if (th == NULL) {
if (th == XBT_NULL) {
PyErr_SetFromErrno(PyExc_RuntimeError);
return NULL;
}
@@ -547,7 +547,7 @@ static PyObject *xspy_transaction_end(XsHandle *self, PyObject *args,
struct xs_handle *xh = xshandle(self);
bool result;
struct xs_transaction_handle *th;
xs_transaction_t th;
char *thstr;
if (!xh)
@@ -556,7 +556,7 @@ static PyObject *xspy_transaction_end(XsHandle *self, PyObject *args,
&thstr, &abort))
return NULL;
th = (struct xs_transaction_handle *)strtoul(thstr, NULL, 16);
th = strtoul(thstr, NULL, 16);
Py_BEGIN_ALLOW_THREADS
result = xs_transaction_end(xh, th, abort);
@@ -727,7 +727,7 @@ static void remove_watch(XsHandle *self, PyObject *token)
*/
static int parse_transaction_path(XsHandle *self, PyObject *args,
struct xs_handle **xh,
struct xs_transaction_handle **th,
xs_transaction_t *th,
char **path)
{
char *thstr;
@@ -740,7 +740,7 @@ static int parse_transaction_path(XsHandle *self, PyObject *args,
if (!PyArg_ParseTuple(args, "ss", &thstr, path))
return 0;
*th = (struct xs_transaction_handle *)strtoul(thstr, NULL, 16);
*th = strtoul(thstr, NULL, 16);
return 1;
}
+11 -2
View File
@@ -11,6 +11,8 @@ VTPM_DIR = vtpm
# Emulator tarball name
TPM_EMULATOR_TARFILE = tpm_emulator-0.2b.tar.gz
GMP_HEADER = /usr/include/gmp.h
all: build
build: $(TPM_EMULATOR_DIR) $(VTPM_DIR) build_sub
@@ -55,5 +57,12 @@ $(VTPM_DIR): $(TPM_EMULATOR_TARFILE)
patch -p1 <../vtpm.patch
build_sub:
$(MAKE) -C $(TPM_EMULATOR_DIR)
$(MAKE) -C $(VTPM_DIR)
if [ -e $(GMP_HEADER) ]; then \
$(MAKE) -C $(VTPM_DIR); \
if [ "$(BUILD_EMULATOR)" = "y" ]; then \
$(MAKE) -C $(TPM_EMULATOR_DIR); \
fi \
else \
echo "*** Unable to build VTPMs. libgmp could not be found."; \
fi
+2
View File
@@ -33,5 +33,7 @@ $(OBJS): $(SRCS)
-include $(DEP_FILES)
BUILD_EMULATOR = n
# Make sure these are just rules
.PHONY : all build install clean
+8 -3
View File
@@ -4,13 +4,18 @@ XEN_ROOT = ../..
include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
SUBDIRS = crypto tcs util manager
OPENSSL_HEADER = /usr/include/openssl/crypto.h
all: build
build:
@set -e; for subdir in $(SUBDIRS); do \
$(MAKE) -C $$subdir $@; \
done
if [ -e $(OPENSSL_HEADER) ]; then \
@set -e; for subdir in $(SUBDIRS); do \
$(MAKE) -C $$subdir $@; \
done; \
else \
echo "*** Cannot build vtpm_manager: OpenSSL developement files missing."; \
fi
install: build
@set -e; for subdir in $(SUBDIRS); do \
@@ -151,9 +151,6 @@ TPM_RESULT VTPM_Create_Service(){
&osap) );
// Generate boot key's auth
Crypto_GetRandom( &vtpm_globals->storage_key_usage_auth,
sizeof(TPM_AUTHDATA) );
TPM_AUTHDATA bootKeyWrapAuth;
memset(&bootKeyWrapAuth, 0, sizeof(bootKeyWrapAuth));
+2 -5
View File
@@ -13,12 +13,9 @@
INSTALL = install
INSTALL_PROG = $(INSTALL) -m0755
INSTALL_DIR = $(INSTALL) -d -m0755
INSTALL_DATA = $(INSTALL) -m064
INSTALL_DATA = $(INSTALL) -m0644
prefix=/usr/local
mandir=$(prefix)/share/man
man1dir=$(mandir)/man1
sbindir=$(prefix)/sbin
sbindir=/usr/sbin
XEN_ROOT=../..
include $(XEN_ROOT)/tools/Rules.mk
+1 -1
View File
@@ -705,7 +705,7 @@ static char *xenstat_get_domain_name(xenstat_handle *handle, unsigned int domain
snprintf(path, sizeof(path),"/local/domain/%i/name", domain_id);
name = xs_read(handle->xshandle, NULL, path, NULL);
name = xs_read(handle->xshandle, XBT_NULL, path, NULL);
if (name == NULL)
name = strdup(" ");
+5 -5
View File
@@ -27,7 +27,7 @@ CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm
CLIENTS += xenstore-write
CLIENTS_OBJS := $(patsubst xenstore-%,xenstore_%.o,$(CLIENTS))
all: libxenstore.so xenstored $(CLIENTS) xs_tdb_dump xsls
all: libxenstore.so xenstored $(CLIENTS) xs_tdb_dump xenstore-ls
testcode: xs_test xenstored_test xs_random
@@ -40,7 +40,7 @@ $(CLIENTS): xenstore-%: xenstore_%.o libxenstore.so
$(CLIENTS_OBJS): xenstore_%.o: xenstore_client.c
$(COMPILE.c) -DCLIENT_$(*F) -o $@ $<
xsls: xsls.o libxenstore.so
xenstore-ls: xsls.o libxenstore.so
$(LINK.o) $< $(LOADLIBES) $(LDLIBS) -lxenctrl -L. -lxenstore -o $@
xenstored_test: xenstored_core_test.o xenstored_watch_test.o xenstored_domain_test.o xenstored_transaction_test.o xs_lib.o talloc_test.o fake_libxc.o utils.o tdb.o
@@ -77,7 +77,7 @@ libxenstore.so: xs.opic xs_lib.opic
clean: testsuite-clean
rm -f *.o *.opic *.so
rm -f xenstored xs_random xs_stress xs_crashme
rm -f xs_test xenstored_test xs_tdb_dump xsls $(CLIENTS)
rm -f xs_test xenstored_test xs_tdb_dump xenstore-ls $(CLIENTS)
$(RM) $(PROG_DEP)
print-dir:
@@ -129,7 +129,7 @@ TAGS:
tarball: clean
cd .. && tar -c -j -v -h -f xenstore.tar.bz2 xenstore/
install: libxenstore.so xenstored xsls $(CLIENTS)
install: libxenstore.so xenstored xenstore-ls $(CLIENTS)
$(INSTALL_DIR) -p $(DESTDIR)/var/run/xenstored
$(INSTALL_DIR) -p $(DESTDIR)/var/lib/xenstored
$(INSTALL_DIR) -p $(DESTDIR)/usr/bin
@@ -137,7 +137,7 @@ install: libxenstore.so xenstored xsls $(CLIENTS)
$(INSTALL_DIR) -p $(DESTDIR)/usr/include
$(INSTALL_PROG) xenstored $(DESTDIR)/usr/sbin
$(INSTALL_PROG) $(CLIENTS) $(DESTDIR)/usr/bin
$(INSTALL_PROG) xsls $(DESTDIR)/usr/bin
$(INSTALL_PROG) xenstore-ls $(DESTDIR)/usr/bin
$(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)
$(INSTALL_DATA) libxenstore.so $(DESTDIR)/usr/$(LIBDIR)
$(INSTALL_DATA) xs.h $(DESTDIR)/usr/include
+18 -8
View File
@@ -92,23 +92,33 @@ void *grab_file(const char *filename, unsigned long *size)
else
fd = open(filename, O_RDONLY, 0);
if (fd < 0)
if (fd == -1)
return NULL;
buffer = malloc(max+1);
if (!buffer)
goto error;
*size = 0;
while ((ret = read(fd, buffer + *size, max - *size)) > 0) {
*size += ret;
if (*size == max)
buffer = realloc(buffer, max *= 2 + 1);
if (*size == max) {
void *nbuffer;
max *= 2;
nbuffer = realloc(buffer, max + 1);
if (!nbuffer)
goto error;
buffer = nbuffer;
}
}
if (ret < 0) {
free(buffer);
buffer = NULL;
} else
((char *)buffer)[*size] = '\0';
if (ret < 0)
goto error;
((char *)buffer)[*size] = '\0';
close(fd);
return buffer;
error:
free(buffer);
close(fd);
return NULL;
}
void release_file(void *data, unsigned long size __attribute__((unused)))
+4 -4
View File
@@ -66,7 +66,7 @@ usage(const char *progname)
#if defined(CLIENT_rm)
static int
do_rm(char *path, struct xs_handle *xsh, struct xs_transaction_handle *xth)
do_rm(char *path, struct xs_handle *xsh, xs_transaction_t xth)
{
if (xs_rm(xsh, xth, path)) {
return 0;
@@ -81,7 +81,7 @@ do_rm(char *path, struct xs_handle *xsh, struct xs_transaction_handle *xth)
static int
perform(int optind, int argc, char **argv, struct xs_handle *xsh,
struct xs_transaction_handle *xth, int prefix, int tidy)
xs_transaction_t xth, int prefix, int tidy)
{
while (optind < argc) {
#if defined(CLIENT_read)
@@ -179,7 +179,7 @@ int
main(int argc, char **argv)
{
struct xs_handle *xsh;
struct xs_transaction_handle *xth;
xs_transaction_t xth;
int ret = 0, socket = 0;
int prefix = 0;
int tidy = 0;
@@ -243,7 +243,7 @@ main(int argc, char **argv)
again:
xth = xs_transaction_start(xsh);
if (xth == NULL)
if (xth == XBT_NULL)
errx(1, "couldn't start transaction");
ret = perform(optind, argc, argv, xsh, xth, prefix, tidy);
+39 -50
View File
@@ -174,11 +174,38 @@ static char *sockmsg_string(enum xsd_sockmsg_type type)
}
}
void trace(const char *fmt, ...)
{
va_list arglist;
char *str;
char sbuf[1024];
int ret;
if (tracefd < 0)
return;
/* try to use a static buffer */
va_start(arglist, fmt);
ret = vsnprintf(sbuf, 1024, fmt, arglist);
va_end(arglist);
if (ret <= 1024) {
write(tracefd, sbuf, ret);
return;
}
/* fail back to dynamic allocation */
va_start(arglist, fmt);
str = talloc_vasprintf(NULL, fmt, arglist);
va_end(arglist);
write(tracefd, str, strlen(str));
talloc_free(str);
}
static void trace_io(const struct connection *conn,
const char *prefix,
const struct buffered_data *data)
{
char string[64];
unsigned int i;
time_t now;
struct tm *tm;
@@ -189,62 +216,25 @@ static void trace_io(const struct connection *conn,
now = time(NULL);
tm = localtime(&now);
write(tracefd, prefix, strlen(prefix));
sprintf(string, " %p %02d:%02d:%02d ", conn, tm->tm_hour, tm->tm_min,
tm->tm_sec);
write(tracefd, string, strlen(string));
write(tracefd, sockmsg_string(data->hdr.msg.type),
strlen(sockmsg_string(data->hdr.msg.type)));
write(tracefd, " (", 2);
for (i = 0; i < data->hdr.msg.len; i++) {
if (data->buffer[i] == '\0')
write(tracefd, " ", 1);
else
write(tracefd, data->buffer + i, 1);
}
write(tracefd, ")\n", 2);
trace("%s %p %02d:%02d:%02d %s (", prefix, conn,
tm->tm_hour, tm->tm_min, tm->tm_sec,
sockmsg_string(data->hdr.msg.type));
for (i = 0; i < data->hdr.msg.len; i++)
trace("%c", (data->buffer[i] != '\0') ? data->buffer[i] : ' ');
trace(")\n");
}
void trace_create(const void *data, const char *type)
{
char string[64];
if (tracefd < 0)
return;
write(tracefd, "CREATE ", strlen("CREATE "));
write(tracefd, type, strlen(type));
sprintf(string, " %p\n", data);
write(tracefd, string, strlen(string));
trace("CREATE %s %p\n", type, data);
}
void trace_destroy(const void *data, const char *type)
{
char string[64];
if (tracefd < 0)
return;
write(tracefd, "DESTROY ", strlen("DESTROY "));
write(tracefd, type, strlen(type));
sprintf(string, " %p\n", data);
write(tracefd, string, strlen(string));
trace("DESTROY %s %p\n", type, data);
}
void trace(const char *fmt, ...)
{
va_list arglist;
char *str;
if (tracefd < 0)
return;
va_start(arglist, fmt);
str = talloc_vasprintf(NULL, fmt, arglist);
va_end(arglist);
write(tracefd, str, strlen(str));
talloc_free(str);
}
/**
* Signal handler for SIGHUP, which requests that the trace log is reopened
* (in the main loop). A single byte is written to reopen_log_pipe, to awaken
@@ -268,7 +258,7 @@ static void reopen_log()
if (tracefd < 0)
perror("Could not open tracefile");
else
write(tracefd, "\n***\n", strlen("\n***\n"));
trace("\n***\n");
}
}
@@ -1311,11 +1301,10 @@ struct connection *new_connection(connwritefn_t *write, connreadfn_t *read)
{
struct connection *new;
new = talloc(talloc_autofree_context(), struct connection);
new = talloc_zero(talloc_autofree_context(), struct connection);
if (!new)
return NULL;
memset(new, 0, sizeof(*new));
new->fd = -1;
new->write = write;
new->read = read;
+49 -39
View File
@@ -278,12 +278,12 @@ static struct domain *new_domain(void *context, unsigned int domid,
talloc_set_destructor(domain, destroy_domain);
/* Tell kernel we're interested in this event. */
bind.remote_domain = domid;
bind.remote_port = port;
rc = ioctl(eventchn_fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
if (rc == -1)
return NULL;
domain->port = rc;
bind.remote_domain = domid;
bind.remote_port = port;
rc = ioctl(eventchn_fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
if (rc == -1)
return NULL;
domain->port = rc;
domain->conn = new_connection(writechn, readchn);
domain->conn->domain = domain;
@@ -426,10 +426,10 @@ void do_is_domain_introduced(struct connection *conn, const char *domid_str)
int result;
unsigned int domid;
if (!domid_str) {
send_error(conn, EINVAL);
return;
}
if (!domid_str) {
send_error(conn, EINVAL);
return;
}
domid = atoi(domid_str);
if (domid == DOMID_SELF)
@@ -461,35 +461,45 @@ void restore_existing_connections(void)
static int dom0_init(void)
{
int rc, fd;
int rc, fd;
evtchn_port_t port;
unsigned long mfn;
char str[20];
struct domain *dom0;
fd = open(XENSTORED_PROC_MFN, O_RDONLY);
rc = read(fd, str, sizeof(str));
str[rc] = '\0';
mfn = strtoul(str, NULL, 0);
close(fd);
fd = open(XENSTORED_PROC_PORT, O_RDONLY);
rc = read(fd, str, sizeof(str));
str[rc] = '\0';
port = strtoul(str, NULL, 0);
close(fd);
dom0 = new_domain(NULL, 0, mfn, port);
talloc_steal(dom0->conn, dom0);
unsigned long mfn;
char str[20];
struct domain *dom0;
evtchn_notify(dom0->port);
fd = open(XENSTORED_PROC_MFN, O_RDONLY);
if (fd == -1)
return -1;
return 0;
rc = read(fd, str, sizeof(str));
if (rc == -1)
goto outfd;
str[rc] = '\0';
mfn = strtoul(str, NULL, 0);
close(fd);
fd = open(XENSTORED_PROC_PORT, O_RDONLY);
if (fd == -1)
return -1;
rc = read(fd, str, sizeof(str));
if (rc == -1)
goto outfd;
str[rc] = '\0';
port = strtoul(str, NULL, 0);
close(fd);
dom0 = new_domain(NULL, 0, mfn, port);
talloc_steal(dom0->conn, dom0);
evtchn_notify(dom0->port);
return 0;
outfd:
close(fd);
return -1;
}
@@ -539,9 +549,9 @@ int domain_init(void)
if (eventchn_fd < 0)
barf_perror("Failed to open evtchn device");
if (dom0_init() != 0)
barf_perror("Failed to initialize dom0 state");
if (dom0_init() != 0)
barf_perror("Failed to initialize dom0 state");
bind.virq = VIRQ_DOM_EXC;
rc = ioctl(eventchn_fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
if (rc == -1)
+16 -16
View File
@@ -292,7 +292,7 @@ static void *read_reply(
}
/* Send message to xs, get malloc'ed reply. NULL and set errno on error. */
static void *xs_talkv(struct xs_handle *h, struct xs_transaction_handle *t,
static void *xs_talkv(struct xs_handle *h, xs_transaction_t t,
enum xsd_sockmsg_type type,
const struct iovec *iovec,
unsigned int num_vecs,
@@ -304,7 +304,7 @@ static void *xs_talkv(struct xs_handle *h, struct xs_transaction_handle *t,
unsigned int i;
struct sigaction ignorepipe, oldact;
msg.tx_id = (uint32_t)(unsigned long)t;
msg.tx_id = t;
msg.req_id = 0;
msg.type = type;
msg.len = 0;
@@ -368,7 +368,7 @@ static void free_no_errno(void *p)
}
/* Simplified version of xs_talkv: single message. */
static void *xs_single(struct xs_handle *h, struct xs_transaction_handle *t,
static void *xs_single(struct xs_handle *h, xs_transaction_t t,
enum xsd_sockmsg_type type,
const char *string,
unsigned int *len)
@@ -388,7 +388,7 @@ static bool xs_bool(char *reply)
return true;
}
char **xs_directory(struct xs_handle *h, struct xs_transaction_handle *t,
char **xs_directory(struct xs_handle *h, xs_transaction_t t,
const char *path, unsigned int *num)
{
char *strings, *p, **ret;
@@ -420,7 +420,7 @@ char **xs_directory(struct xs_handle *h, struct xs_transaction_handle *t,
* Returns a malloced value: call free() on it after use.
* len indicates length in bytes, not including the nul.
*/
void *xs_read(struct xs_handle *h, struct xs_transaction_handle *t,
void *xs_read(struct xs_handle *h, xs_transaction_t t,
const char *path, unsigned int *len)
{
return xs_single(h, t, XS_READ, path, len);
@@ -429,7 +429,7 @@ void *xs_read(struct xs_handle *h, struct xs_transaction_handle *t,
/* Write the value of a single file.
* Returns false on failure.
*/
bool xs_write(struct xs_handle *h, struct xs_transaction_handle *t,
bool xs_write(struct xs_handle *h, xs_transaction_t t,
const char *path, const void *data, unsigned int len)
{
struct iovec iovec[2];
@@ -446,7 +446,7 @@ bool xs_write(struct xs_handle *h, struct xs_transaction_handle *t,
/* Create a new directory.
* Returns false on failure, or success if it already exists.
*/
bool xs_mkdir(struct xs_handle *h, struct xs_transaction_handle *t,
bool xs_mkdir(struct xs_handle *h, xs_transaction_t t,
const char *path)
{
return xs_bool(xs_single(h, t, XS_MKDIR, path, NULL));
@@ -455,7 +455,7 @@ bool xs_mkdir(struct xs_handle *h, struct xs_transaction_handle *t,
/* Destroy a file or directory (directories must be empty).
* Returns false on failure, or success if it doesn't exist.
*/
bool xs_rm(struct xs_handle *h, struct xs_transaction_handle *t,
bool xs_rm(struct xs_handle *h, xs_transaction_t t,
const char *path)
{
return xs_bool(xs_single(h, t, XS_RM, path, NULL));
@@ -465,7 +465,7 @@ bool xs_rm(struct xs_handle *h, struct xs_transaction_handle *t,
* Returns malloced array, or NULL: call free() after use.
*/
struct xs_permissions *xs_get_permissions(struct xs_handle *h,
struct xs_transaction_handle *t,
xs_transaction_t t,
const char *path, unsigned int *num)
{
char *strings;
@@ -499,7 +499,7 @@ struct xs_permissions *xs_get_permissions(struct xs_handle *h,
* Returns false on failure.
*/
bool xs_set_permissions(struct xs_handle *h,
struct xs_transaction_handle *t,
xs_transaction_t t,
const char *path,
struct xs_permissions *perms,
unsigned int num_perms)
@@ -634,21 +634,21 @@ bool xs_unwatch(struct xs_handle *h, const char *path, const char *token)
/* Start a transaction: changes by others will not be seen during this
* transaction, and changes will not be visible to others until end.
* You can only have one transaction at any time.
* Returns NULL on failure.
* Returns XBT_NULL on failure.
*/
struct xs_transaction_handle *xs_transaction_start(struct xs_handle *h)
xs_transaction_t xs_transaction_start(struct xs_handle *h)
{
char *id_str;
unsigned long id;
xs_transaction_t id;
id_str = xs_single(h, XBT_NULL, XS_TRANSACTION_START, "", NULL);
if (id_str == NULL)
return NULL;
return XBT_NULL;
id = strtoul(id_str, NULL, 0);
free(id_str);
return (struct xs_transaction_handle *)id;
return id;
}
/* End a transaction.
@@ -656,7 +656,7 @@ struct xs_transaction_handle *xs_transaction_start(struct xs_handle *h)
* Returns false on failure, which indicates an error: transactions will
* not fail spuriously.
*/
bool xs_transaction_end(struct xs_handle *h, struct xs_transaction_handle *t,
bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
bool abort)
{
char abortstr[2];
+11 -11
View File
@@ -22,10 +22,10 @@
#include <xs_lib.h>
#define XBT_NULL NULL
#define XBT_NULL 0
struct xs_handle;
struct xs_transaction_handle;
typedef uint32_t xs_transaction_t;
/* On failure, these routines set errno. */
@@ -47,45 +47,45 @@ void xs_daemon_close(struct xs_handle *);
* Returns a malloced array: call free() on it after use.
* Num indicates size.
*/
char **xs_directory(struct xs_handle *h, struct xs_transaction_handle *t,
char **xs_directory(struct xs_handle *h, xs_transaction_t t,
const char *path, unsigned int *num);
/* Get the value of a single file, nul terminated.
* Returns a malloced value: call free() on it after use.
* len indicates length in bytes, not including terminator.
*/
void *xs_read(struct xs_handle *h, struct xs_transaction_handle *t,
void *xs_read(struct xs_handle *h, xs_transaction_t t,
const char *path, unsigned int *len);
/* Write the value of a single file.
* Returns false on failure.
*/
bool xs_write(struct xs_handle *h, struct xs_transaction_handle *t,
bool xs_write(struct xs_handle *h, xs_transaction_t t,
const char *path, const void *data, unsigned int len);
/* Create a new directory.
* Returns false on failure, or success if it already exists.
*/
bool xs_mkdir(struct xs_handle *h, struct xs_transaction_handle *t,
bool xs_mkdir(struct xs_handle *h, xs_transaction_t t,
const char *path);
/* Destroy a file or directory (and children).
* Returns false on failure, or if it doesn't exist.
*/
bool xs_rm(struct xs_handle *h, struct xs_transaction_handle *t,
bool xs_rm(struct xs_handle *h, xs_transaction_t t,
const char *path);
/* Get permissions of node (first element is owner, first perms is "other").
* Returns malloced array, or NULL: call free() after use.
*/
struct xs_permissions *xs_get_permissions(struct xs_handle *h,
struct xs_transaction_handle *t,
xs_transaction_t t,
const char *path, unsigned int *num);
/* Set permissions of node (must be owner).
* Returns false on failure.
*/
bool xs_set_permissions(struct xs_handle *h, struct xs_transaction_handle *t,
bool xs_set_permissions(struct xs_handle *h, xs_transaction_t t,
const char *path, struct xs_permissions *perms,
unsigned int num_perms);
@@ -115,14 +115,14 @@ bool xs_unwatch(struct xs_handle *h, const char *path, const char *token);
* You can only have one transaction at any time.
* Returns NULL on failure.
*/
struct xs_transaction_handle *xs_transaction_start(struct xs_handle *h);
xs_transaction_t xs_transaction_start(struct xs_handle *h);
/* End a transaction.
* If abandon is true, transaction is discarded instead of committed.
* Returns false on failure: if errno == EAGAIN, you have to restart
* transaction.
*/
bool xs_transaction_end(struct xs_handle *h, struct xs_transaction_handle *t,
bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
bool abort);
/* Introduce a new domain.
+2 -2
View File
@@ -43,7 +43,7 @@
#define XSTEST
static struct xs_handle *handles[10] = { NULL };
static struct xs_transaction_handle *txh[10] = { XBT_NULL };
static xs_transaction_t txh[10] = { XBT_NULL };
static unsigned int timeout_ms = 500;
static bool timeout_suppressed = true;
@@ -535,7 +535,7 @@ static void do_introduce(unsigned int handle,
*(uint16_t *)((void *)interface + 36) = atoi(eventchn);
if (!xs_introduce_domain(handles[handle], atoi(domid),
atol(mfn), atoi(eventchn), path)) {
atol(mfn), atoi(eventchn))) {
failed(handle);
munmap(interface, getpagesize());
return;
+2 -2
View File
@@ -33,14 +33,14 @@ build: $(BIN) $(LIBBIN)
install: build
[ -d $(DESTDIR)/usr/bin ] || $(INSTALL_DIR) $(DESTDIR)/usr/bin
[ -z "$(LIBBIN)"] || [ -d $(DESTDIR)/usr/$(LIBDIR)/xen/bin ] || \
[ -z "$(LIBBIN)" ] || [ -d $(DESTDIR)/usr/$(LIBDIR)/xen/bin ] || \
$(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)/xen/bin
[ -d $(DESTDIR)/usr/share/man/man1 ] || \
$(INSTALL_DIR) $(DESTDIR)/usr/share/man/man1
[ -d $(DESTDIR)/usr/share/man/man8 ] || \
$(INSTALL_DIR) $(DESTDIR)/usr/share/man/man8
$(INSTALL_PROG) $(BIN) $(SCRIPTS) $(DESTDIR)/usr/bin
[ -z "$(LIBBIN)"] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)/usr/$(LIBDIR)/xen/bin
[ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)/usr/$(LIBDIR)/xen/bin
$(INSTALL_DATA) $(MAN1) $(DESTDIR)/usr/share/man/man1
$(INSTALL_DATA) $(MAN8) $(DESTDIR)/usr/share/man/man8
+4
View File
@@ -23,6 +23,10 @@ OBJS += bitop.o clear_page.o flush.o copy_page_mck.o \
__divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \
__divdi3.o __udivdi3.o __moddi3.o __umoddi3.o
ifeq ($(crash_debug),y)
OBJS += gdbstub.o
endif
# xen stack unwinder
# unwind_decoder.c is included in unwind.c
OBJS += unwind.o
+2 -2
View File
@@ -23,10 +23,10 @@ CFLAGS += -I$(BASEDIR)/include/asm-ia64 -I$(BASEDIR)/include/asm-ia64/linux \
-I$(BASEDIR)/include/asm-ia64/linux-xen \
-I$(BASEDIR)/include/asm-ia64/linux-null \
-I$(BASEDIR)/arch/ia64/linux -I$(BASEDIR)/arch/ia64/linux-xen
CFLAGS += -Wno-pointer-arith -Wredundant-decls
#CFLAGS += -Wno-pointer-arith -Wredundant-decls
CFLAGS += -DIA64 -DXEN -DLINUX_2_6 -DV_IOSAPIC_READY
CFLAGS += -ffixed-r13 -mfixed-range=f12-f15,f32-f127
CFLAGS += -w -g
CFLAGS += -g
#CFLAGS += -DVTI_DEBUG
ifeq ($(VALIDATE_VT),y)
CFLAGS += -DVALIDATE_VT
+1 -1
View File
@@ -15,7 +15,7 @@
#define task_struct vcpu
#define DEFINE(sym, val) \
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
asm volatile("\n->" #sym " (%0) " #val : : "i" (val))
#define BLANK() asm volatile("\n->" : : )
+1 -1
View File
@@ -38,7 +38,7 @@
#define task_struct vcpu
#define DEFINE(sym, val) \
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
asm volatile("\n->" #sym " (%0) " #val : : "i" (val))
#define BLANK() asm volatile("\n->" : : )
+1
View File
@@ -16,6 +16,7 @@
#ifdef XEN
#include <linux/smp.h>
#include <xen/lib.h>
#endif
#include <asm/page.h>
#include <asm/sal.h>
+15 -2
View File
@@ -57,8 +57,21 @@
void flush_tlb_mask(cpumask_t mask)
{
#ifdef CONFIG_SMP
printf("flush_tlb_mask called, not implemented for SMP\n");
dummy();
int cpu;
cpu = smp_processor_id();
if (cpu_isset (cpu, mask)) {
cpu_clear(cpu, mask);
local_flush_tlb_all ();
}
if (cpus_empty(mask))
return;
for (cpu = 0; cpu < NR_CPUS; ++cpu)
if (cpu_isset(cpu, mask))
smp_call_function_single
(cpu, (void (*)(void *))local_flush_tlb_all, NULL, 1, 1);
#endif
}
//#if CONFIG_SMP || IA64
+6 -3
View File
@@ -64,6 +64,10 @@
#ifdef XEN
#include <asm/hw_irq.h>
int ht_per_core = 1;
#ifndef CONFIG_SMP
cpumask_t cpu_online_map = CPU_MASK_CPU0;
EXPORT_SYMBOL(cpu_online_map);
#endif
#endif
#ifdef CONFIG_SMP /* ifdef XEN */
@@ -482,9 +486,8 @@ do_rest:
struct vcpu *v;
void *stack;
if ( (idle = do_createdomain(IDLE_DOMAIN_ID, cpu)) == NULL )
panic("failed 'createdomain' for CPU %d", cpu);
v = idle->vcpu[0];
v = idle_vcpu[cpu] = alloc_vcpu(idle_vcpu[0]->domain, cpu, cpu);
BUG_ON(v == NULL);
printf ("do_boot_cpu: cpu=%d, domain=%p, vcpu=%p\n", cpu, idle, v);
+9 -9
View File
@@ -119,7 +119,7 @@ void vtm_init(VCPU *vcpu)
itc_freq = local_cpu_data->itc_freq;
vtm->cfg_max_jump=itc_freq*MAX_JUMP_STEP/1000;
vtm->cfg_min_grun=itc_freq*MIN_GUEST_RUNNING_TIME/1000;
init_ac_timer(&vtm->vtm_timer, vtm_timer_fn, vcpu, 0);
init_timer(&vtm->vtm_timer, vtm_timer_fn, vcpu, 0);
vtm_reset(vcpu);
}
@@ -163,20 +163,20 @@ void vtm_set_itv(VCPU *vcpu)
local_irq_save(spsr);
itv = VCPU(vcpu, itv);
if ( ITV_IRQ_MASK(itv) )
rem_ac_timer(&vtm->vtm_timer);
stop_timer(&vtm->vtm_timer);
vtm_interruption_update(vcpu, vtm);
local_irq_restore(spsr);
}
/*
* Update interrupt or hook the vtm ac_timer for fire
* Update interrupt or hook the vtm timer for fire
* At this point vtm_timer should be removed if itv is masked.
*/
/* Interrupt must be disabled at this point */
extern u64 cycle_to_ns(u64 cyle);
#define TIMER_SLOP (50*1000) /* ns */ /* copy from ac_timer.c */
#define TIMER_SLOP (50*1000) /* ns */ /* copy from timer.c */
void vtm_interruption_update(VCPU *vcpu, vtime_t* vtm)
{
uint64_t cur_itc,vitm,vitv;
@@ -198,7 +198,7 @@ void vtm_interruption_update(VCPU *vcpu, vtime_t* vtm)
if ( diff_last >= 0 ) {
// interrupt already fired.
rem_ac_timer(&vtm->vtm_timer);
stop_timer(&vtm->vtm_timer);
}
else if ( diff_now >= 0 ) {
// ITV is fired.
@@ -207,24 +207,24 @@ void vtm_interruption_update(VCPU *vcpu, vtime_t* vtm)
/* Both last_itc & cur_itc < itm, wait for fire condition */
else {
expires = NOW() + cycle_to_ns(0-diff_now) + TIMER_SLOP;
set_ac_timer(&vtm->vtm_timer, expires);
set_timer(&vtm->vtm_timer, expires);
}
local_irq_restore(spsr);
}
/*
* Action for vtm when the domain is scheduled out.
* Remove the ac_timer for vtm.
* Remove the timer for vtm.
*/
void vtm_domain_out(VCPU *vcpu)
{
if(!is_idle_domain(vcpu->domain))
rem_ac_timer(&vcpu->arch.arch_vmx.vtm.vtm_timer);
stop_timer(&vcpu->arch.arch_vmx.vtm.vtm_timer);
}
/*
* Action for vtm when the domain is scheduled in.
* Fire vtm IRQ or add the ac_timer for vtm.
* Fire vtm IRQ or add the timer for vtm.
*/
void vtm_domain_in(VCPU *vcpu)
{
+9
View File
@@ -41,6 +41,7 @@
#include <asm/regionreg.h>
#include <asm/privop.h>
#include <asm/ia64_int.h>
#include <asm/debugger.h>
//#include <asm/hpsim_ssc.h>
#include <asm/dom_fw.h>
#include <asm/vmx_vcpu.h>
@@ -107,6 +108,14 @@ vmx_ia64_handle_break (unsigned long ifa, struct pt_regs *regs, unsigned long is
if (running_on_sim) do_ssc(vcpu_get_gr_nat(current,36), regs);
else do_ssc(vcpu_get_gr_nat(current,36), regs);
}
#endif
#ifdef CRASH_DEBUG
if ((iim == 0 || iim == CDB_BREAK_NUM) && !user_mode(regs) &&
IS_VMM_ADDRESS(regs->cr_iip)) {
if (iim == 0)
show_registers(regs);
debugger_trap_fatal(0 /* don't care */, regs);
} else
#endif
if (iim == d->arch.breakimm) {
struct ia64_pal_retval y;
+62 -59
View File
@@ -65,12 +65,14 @@ extern int readelfimage_base_and_size(char *, unsigned long,
unsigned long map_domain_page0(struct domain *);
extern unsigned long dom_fw_setup(struct domain *, char *, int);
static void init_switch_stack(struct vcpu *v);
/* this belongs in include/asm, but there doesn't seem to be a suitable place */
void free_perdomain_pt(struct domain *d)
void arch_domain_destroy(struct domain *d)
{
printf("free_perdomain_pt: not implemented\n");
printf("arch_domain_destroy: not implemented\n");
//free_page((unsigned long)d->mm.perdomain_pt);
free_xenheap_page(d->shared_info);
}
static void default_idle(void)
@@ -87,7 +89,6 @@ static void continue_cpu_idle_loop(void)
int cpu = smp_processor_id();
for ( ; ; )
{
printf ("idle%dD\n", cpu);
#ifdef IA64
// __IRQ_STAT(cpu, idle_timestamp) = jiffies
#else
@@ -145,16 +146,45 @@ void startup_cpu_idle_loop(void)
struct vcpu *alloc_vcpu_struct(struct domain *d, unsigned int vcpu_id)
{
struct vcpu *v;
struct thread_info *ti;
if ((v = alloc_xenheap_pages(KERNEL_STACK_SIZE_ORDER)) == NULL)
/* Still keep idle vcpu0 static allocated at compilation, due
* to some code from Linux still requires it in early phase.
*/
if (is_idle_domain(d) && !vcpu_id)
v = idle_vcpu[0];
else {
if ((v = alloc_xenheap_pages(KERNEL_STACK_SIZE_ORDER)) == NULL)
return NULL;
memset(v, 0, sizeof(*v));
}
memset(v, 0, sizeof(*v));
memcpy(&v->arch, &idle0_vcpu.arch, sizeof(v->arch));
v->arch.privregs =
ti = alloc_thread_info(v);
/* Clear thread_info to clear some important fields, like
* preempt_count
*/
memset(ti, 0, sizeof(struct thread_info));
init_switch_stack(v);
if (!is_idle_domain(d)) {
v->arch.privregs =
alloc_xenheap_pages(get_order(sizeof(mapped_regs_t)));
printf("arch_vcpu_info=%p\n", v->arch.privregs);
memset(v->arch.privregs, 0, PAGE_SIZE);
BUG_ON(v->arch.privregs == NULL);
memset(v->arch.privregs, 0, PAGE_SIZE);
if (!vcpu_id)
memset(&d->shared_info->evtchn_mask[0], 0xff,
sizeof(d->shared_info->evtchn_mask));
v->vcpu_info = &(d->shared_info->vcpu_info[0]);
v->arch.metaphysical_rr0 = d->arch.metaphysical_rr0;
v->arch.metaphysical_rr4 = d->arch.metaphysical_rr4;
v->arch.metaphysical_saved_rr0 = d->arch.metaphysical_rr0;
v->arch.metaphysical_saved_rr4 = d->arch.metaphysical_rr4;
v->arch.starting_rid = d->arch.starting_rid;
v->arch.ending_rid = d->arch.ending_rid;
v->arch.breakimm = d->arch.breakimm;
}
return v;
}
@@ -182,34 +212,21 @@ static void init_switch_stack(struct vcpu *v)
memset(v->arch._thread.fph,0,sizeof(struct ia64_fpreg)*96);
}
int arch_do_createdomain(struct vcpu *v)
int arch_domain_create(struct domain *d)
{
struct domain *d = v->domain;
struct thread_info *ti = alloc_thread_info(v);
// the following will eventually need to be negotiated dynamically
d->xen_vastart = XEN_START_ADDR;
d->xen_vaend = XEN_END_ADDR;
d->shared_info_va = SHAREDINFO_ADDR;
/* Clear thread_info to clear some important fields, like preempt_count */
memset(ti, 0, sizeof(struct thread_info));
init_switch_stack(v);
if (is_idle_domain(d))
return 0;
d->shared_info = (void *)alloc_xenheap_page();
if (!d->shared_info) {
printk("ERROR/HALTING: CAN'T ALLOC PAGE\n");
while (1);
}
if ((d->shared_info = (void *)alloc_xenheap_page()) == NULL)
goto fail_nomem;
memset(d->shared_info, 0, PAGE_SIZE);
if (v == d->vcpu[0])
memset(&d->shared_info->evtchn_mask[0], 0xff,
sizeof(d->shared_info->evtchn_mask));
#if 0
d->vcpu[0].arch.privregs =
alloc_xenheap_pages(get_order(sizeof(mapped_regs_t)));
printf("arch_vcpu_info=%p\n", d->vcpu[0].arch.privregs);
memset(d->vcpu.arch.privregs, 0, PAGE_SIZE);
#endif
v->vcpu_info = &(d->shared_info->vcpu_info[0]);
d->max_pages = (128UL*1024*1024)/PAGE_SIZE; // 128MB default // FIXME
/* We may also need emulation rid for region4, though it's unlikely
* to see guest issue uncacheable access in metaphysical mode. But
* keep such info here may be more sane.
@@ -217,41 +234,27 @@ int arch_do_createdomain(struct vcpu *v)
if (((d->arch.metaphysical_rr0 = allocate_metaphysical_rr()) == -1UL)
|| ((d->arch.metaphysical_rr4 = allocate_metaphysical_rr()) == -1UL))
BUG();
// VCPU(v, metaphysical_mode) = 1;
v->arch.metaphysical_rr0 = d->arch.metaphysical_rr0;
v->arch.metaphysical_rr4 = d->arch.metaphysical_rr4;
v->arch.metaphysical_saved_rr0 = d->arch.metaphysical_rr0;
v->arch.metaphysical_saved_rr4 = d->arch.metaphysical_rr4;
#define DOMAIN_RID_BITS_DEFAULT 18
if (!allocate_rid_range(d,DOMAIN_RID_BITS_DEFAULT)) // FIXME
BUG();
v->arch.starting_rid = d->arch.starting_rid;
v->arch.ending_rid = d->arch.ending_rid;
// the following will eventually need to be negotiated dynamically
d->xen_vastart = XEN_START_ADDR;
d->xen_vaend = XEN_END_ADDR;
d->shared_info_va = SHAREDINFO_ADDR;
d->arch.breakimm = 0x1000;
v->arch.breakimm = d->arch.breakimm;
d->arch.sys_pgnr = 0;
if (d->domain_id != IDLE_DOMAIN_ID) {
d->arch.mm = xmalloc(struct mm_struct);
if (unlikely(!d->arch.mm)) {
printk("Can't allocate mm_struct for domain %d\n",d->domain_id);
return -ENOMEM;
}
memset(d->arch.mm, 0, sizeof(*d->arch.mm));
d->arch.mm->pgd = pgd_alloc(d->arch.mm);
if (unlikely(!d->arch.mm->pgd)) {
printk("Can't allocate pgd for domain %d\n",d->domain_id);
return -ENOMEM;
}
} else
d->arch.mm = NULL;
printf ("arch_do_create_domain: domain=%p\n", d);
if ((d->arch.mm = xmalloc(struct mm_struct)) == NULL)
goto fail_nomem;
memset(d->arch.mm, 0, sizeof(*d->arch.mm));
if ((d->arch.mm->pgd = pgd_alloc(d->arch.mm)) == NULL)
goto fail_nomem;
printf ("arch_domain_create: domain=%p\n", d);
return 0;
fail_nomem:
free_xenheap_page(d->shared_info);
xfree(d->arch.mm);
pgd_free(d->arch.mm->pgd);
return -ENOMEM;
}
void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c)
+811
View File
@@ -0,0 +1,811 @@
/*
* ia64-specific cdb routines
* cdb xen/ia64 by Isaku Yamahta <yamahata at valinux co jp>
* VA Linux Systems Japan K.K.
* some routines are stolen from kgdb/ia64.
*/
/*
*
* 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, 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.
*
*/
/*
* Copyright (C) 2000-2001 VERITAS Software Corporation.
*/
/*
* Contributor: Lake Stevens Instrument Division$
* Written by: Glenn Engel $
* Updated by: Amit Kale<akale@veritas.com>
* Modified for 386 by Jim Kingdon, Cygnus Support.
* Origianl kgdb, compatibility with 2.1.xx kernel by David Grothe <dave@gcom.com>
*
*/
#include <xen/lib.h>
#include <asm/byteorder.h>
#include <asm/debugger.h>
#include <asm/uaccess.h>
#define USE_UNWIND
#ifdef USE_UNWIND
#include <asm/unwind.h>
#endif
/* Printk isn't particularly safe just after we've trapped to the
debugger. so avoid it. */
#define dbg_printk(...)
//#define dbg_printk(...) printk(__VA_ARGS__)
u16
gdb_arch_signal_num(struct cpu_user_regs *regs, unsigned long cookie)
{
/* XXX */
return 1;
}
void
gdb_arch_read_reg_array(struct cpu_user_regs *regs, struct gdb_context *ctx)
{
gdb_send_reply("", ctx);
}
void
gdb_arch_write_reg_array(struct cpu_user_regs *regs, const char* buf,
struct gdb_context *ctx)
{
/* XXX TODO */
gdb_send_reply("E02", ctx);
}
/* Like copy_from_user, but safe to call with interrupts disabled.
Trust me, and don't look behind the curtain. */
unsigned
gdb_arch_copy_from_user(void *dest, const void *src, unsigned len)
{
int val;
__asm__ __volatile__(
"cmp4.eq p6, p0 = r0, %1\n"
"(p6) br.cond.dptk 2f\n"
"[1:]\n"
".xdata4 \"__ex_table\", 99f-., 2f-.;\n"
"[99:] ld1 %0 = [%3], 1\n"
";;\n"
".xdata4 \"__ex_table\", 99f-., 2f-.;\n"
"[99:] st1 [%2] = %0, 1\n"
"adds %1 = -1, %1\n"
";;\n"
"cmp4.eq p0, p6 = r0, %1\n"
"(p6) br.cond.dptk 1b\n"
"[2:]\n"
: "=r"(val), "=r"(len), "=r"(dest), "=r"(src)
: "1"(len), "2"(dest), "3"(src)
: "memory", "p6");
return len;
}
unsigned int
gdb_arch_copy_to_user(void *dest, const void *src, unsigned len)
{
/* XXX */
return len;
}
#define NUM_REGS 590
#define REGISTER_BYTES (NUM_REGS*8+128*8)
#define REGISTER_BYTE(N) (((N) * 8) \
+ ((N) <= IA64_FR0_REGNUM ? \
0 : 8 * (((N) > IA64_FR127_REGNUM) ? 128 : (N) - IA64_FR0_REGNUM)))
#define REGISTER_SIZE(N) \
(((N) >= IA64_FR0_REGNUM && (N) <= IA64_FR127_REGNUM) ? 16 : 8)
#define IA64_GR0_REGNUM 0
#define IA64_FR0_REGNUM 128
#define IA64_FR127_REGNUM (IA64_FR0_REGNUM+127)
#define IA64_PR0_REGNUM 256
#define IA64_BR0_REGNUM 320
#define IA64_VFP_REGNUM 328
#define IA64_PR_REGNUM 330
#define IA64_IP_REGNUM 331
#define IA64_PSR_REGNUM 332
#define IA64_CFM_REGNUM 333
#define IA64_AR0_REGNUM 334
#define IA64_NAT0_REGNUM 462
#define IA64_NAT31_REGNUM (IA64_NAT0_REGNUM+31)
#define IA64_NAT32_REGNUM (IA64_NAT0_REGNUM+32)
#define IA64_RSC_REGNUM (IA64_AR0_REGNUM+16)
#define IA64_BSP_REGNUM (IA64_AR0_REGNUM+17)
#define IA64_BSPSTORE_REGNUM (IA64_AR0_REGNUM+18)
#define IA64_RNAT_REGNUM (IA64_AR0_REGNUM+19)
#define IA64_FCR_REGNUM (IA64_AR0_REGNUM+21)
#define IA64_EFLAG_REGNUM (IA64_AR0_REGNUM+24)
#define IA64_CSD_REGNUM (IA64_AR0_REGNUM+25)
#define IA64_SSD_REGNUM (IA64_AR0_REGNUM+26)
#define IA64_CFLG_REGNUM (IA64_AR0_REGNUM+27)
#define IA64_FSR_REGNUM (IA64_AR0_REGNUM+28)
#define IA64_FIR_REGNUM (IA64_AR0_REGNUM+29)
#define IA64_FDR_REGNUM (IA64_AR0_REGNUM+30)
#define IA64_CCV_REGNUM (IA64_AR0_REGNUM+32)
#define IA64_UNAT_REGNUM (IA64_AR0_REGNUM+36)
#define IA64_FPSR_REGNUM (IA64_AR0_REGNUM+40)
#define IA64_ITC_REGNUM (IA64_AR0_REGNUM+44)
#define IA64_PFS_REGNUM (IA64_AR0_REGNUM+64)
#define IA64_LC_REGNUM (IA64_AR0_REGNUM+65)
#define IA64_EC_REGNUM (IA64_AR0_REGNUM+66)
#ifndef USE_UNWIND
struct regs_to_cpu_user_resgs_index {
unsigned int reg;
unsigned int ptregoff;
};
#define ptoff(V) ((unsigned int)&((struct cpu_user_regs*)0x0)->V)
// gr
static const struct regs_to_cpu_user_resgs_index
gr_reg_to_cpu_user_regs_index[] = {
{IA64_GR0_REGNUM + 8, ptoff(r8)},
{IA64_GR0_REGNUM + 9, ptoff(r9)},
{IA64_GR0_REGNUM + 10, ptoff(r10)},
{IA64_GR0_REGNUM + 11, ptoff(r11)},
{IA64_GR0_REGNUM + 1, ptoff(r1)},
{IA64_GR0_REGNUM + 12, ptoff(r12)},
{IA64_GR0_REGNUM + 13, ptoff(r13)},
{IA64_GR0_REGNUM + 15, ptoff(r15)},
{IA64_GR0_REGNUM + 14, ptoff(r14)},
{IA64_GR0_REGNUM + 2, ptoff(r2)},
{IA64_GR0_REGNUM + 3, ptoff(r3)},
{IA64_GR0_REGNUM + 16, ptoff(r16)},
{IA64_GR0_REGNUM + 17, ptoff(r17)},
{IA64_GR0_REGNUM + 18, ptoff(r18)},
{IA64_GR0_REGNUM + 19, ptoff(r19)},
{IA64_GR0_REGNUM + 20, ptoff(r20)},
{IA64_GR0_REGNUM + 21, ptoff(r21)},
{IA64_GR0_REGNUM + 22, ptoff(r22)},
{IA64_GR0_REGNUM + 23, ptoff(r23)},
{IA64_GR0_REGNUM + 24, ptoff(r24)},
{IA64_GR0_REGNUM + 25, ptoff(r25)},
{IA64_GR0_REGNUM + 26, ptoff(r26)},
{IA64_GR0_REGNUM + 27, ptoff(r27)},
{IA64_GR0_REGNUM + 28, ptoff(r28)},
{IA64_GR0_REGNUM + 29, ptoff(r29)},
{IA64_GR0_REGNUM + 30, ptoff(r30)},
{IA64_GR0_REGNUM + 31, ptoff(r31)},
{IA64_GR0_REGNUM + 4, ptoff(r4)},
{IA64_GR0_REGNUM + 5, ptoff(r5)},
{IA64_GR0_REGNUM + 6, ptoff(r6)},
{IA64_GR0_REGNUM + 7, ptoff(r7)},
};
static const int gr_reg_to_cpu_user_regs_index_max =
sizeof(gr_reg_to_cpu_user_regs_index) /
sizeof(gr_reg_to_cpu_user_regs_index[0]);
// br
static const struct regs_to_cpu_user_resgs_index
br_reg_to_cpu_user_regs_index[] = {
{IA64_BR0_REGNUM + 0, ptoff(b0)},
{IA64_BR0_REGNUM + 6, ptoff(b6)},
{IA64_BR0_REGNUM + 7, ptoff(b7)},
};
static const int br_reg_to_cpu_user_regs_index_max =
sizeof(br_reg_to_cpu_user_regs_index) /
sizeof(br_reg_to_cpu_user_regs_index[0]);
// f
static const struct regs_to_cpu_user_resgs_index
fr_reg_to_cpu_user_regs_index[] = {
{IA64_FR0_REGNUM + 6, ptoff(f6)},
{IA64_FR0_REGNUM + 7, ptoff(f7)},
{IA64_FR0_REGNUM + 8, ptoff(f8)},
{IA64_FR0_REGNUM + 9, ptoff(f9)},
{IA64_FR0_REGNUM + 10, ptoff(f10)},
{IA64_FR0_REGNUM + 11, ptoff(f11)},
};
static const int fr_reg_to_cpu_user_regs_index_max =
sizeof(fr_reg_to_cpu_user_regs_index) /
sizeof(fr_reg_to_cpu_user_regs_index[0]);
void
gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs,
struct gdb_context *ctx)
{
unsigned long reg = IA64_IP_REGNUM;
char buf[9];
int i;
dbg_printk("Register read regnum = 0x%lx\n", regnum);
if (IA64_GR0_REGNUM <= regnum && regnum <= IA64_GR0_REGNUM + 31) {
for (i = 0; i < gr_reg_to_cpu_user_regs_index_max; i++) {
if (gr_reg_to_cpu_user_regs_index[i].reg == regnum) {
reg = *(unsigned long*)(((char*)regs) + gr_reg_to_cpu_user_regs_index[i].ptregoff);
break;
}
}
if (i == gr_reg_to_cpu_user_regs_index_max) {
goto out_err;
}
} else if (IA64_BR0_REGNUM <= regnum && regnum <= IA64_BR0_REGNUM + 7) {
for (i = 0; i < br_reg_to_cpu_user_regs_index_max; i++) {
if (br_reg_to_cpu_user_regs_index[i].reg == regnum) {
reg = *(unsigned long*)(((char*)regs) + br_reg_to_cpu_user_regs_index[i].ptregoff);
break;
}
}
if (i == br_reg_to_cpu_user_regs_index_max) {
goto out_err;
}
} else if (IA64_FR0_REGNUM + 6 <= regnum && regnum <= IA64_FR0_REGNUM + 11) {
for (i = 0; i < fr_reg_to_cpu_user_regs_index_max; i++) {
if (fr_reg_to_cpu_user_regs_index[i].reg == regnum) {
reg = *(unsigned long*)(((char*)regs) + fr_reg_to_cpu_user_regs_index[i].ptregoff);
break;
}
}
if (i == fr_reg_to_cpu_user_regs_index_max) {
goto out_err;
}
} else if (regnum == IA64_CSD_REGNUM) {
reg = regs->ar_csd;
} else if (regnum == IA64_SSD_REGNUM) {
reg = regs->ar_ssd;
} else if (regnum == IA64_PSR_REGNUM) {
reg = regs->cr_ipsr;
} else if (regnum == IA64_IP_REGNUM) {
reg = regs->cr_iip;
} else if (regnum == IA64_CFM_REGNUM) {
reg = regs->cr_ifs;
} else if (regnum == IA64_UNAT_REGNUM) {
reg = regs->ar_unat;
} else if (regnum == IA64_PFS_REGNUM) {
reg = regs->ar_pfs;
} else if (regnum == IA64_RSC_REGNUM) {
reg = regs->ar_rsc;
} else if (regnum == IA64_RNAT_REGNUM) {
reg = regs->ar_rnat;
} else if (regnum == IA64_BSPSTORE_REGNUM) {
reg = regs->ar_bspstore;
} else if (regnum == IA64_PR_REGNUM) {
reg = regs->pr;
} else if (regnum == IA64_FPSR_REGNUM) {
reg = regs->ar_fpsr;
} else if (regnum == IA64_CCV_REGNUM) {
reg = regs->ar_ccv;
} else {
// emul_unat, rfi_pfs
goto out_err;
}
dbg_printk("Register read regnum = 0x%lx, val = 0x%lx\n", regnum, reg);
sprintf(buf, "%.08lx", swab64(reg));
out:
return gdb_send_reply(buf, ctx);
out_err:
dbg_printk("Register read unsupported regnum = 0x%lx\n", regnum);
sprintf(buf, "%s", "x");
goto out;
}
#else
#define ptoff(V) ((unsigned int) &((struct pt_regs *)0x0)->V)
struct reg_to_ptreg_index {
unsigned int reg;
unsigned int ptregoff;
};
static struct reg_to_ptreg_index gr_reg_to_ptreg_index[] = {
{IA64_GR0_REGNUM + 1, ptoff(r1)},
{IA64_GR0_REGNUM + 2, ptoff(r2)},
{IA64_GR0_REGNUM + 3, ptoff(r3)},
{IA64_GR0_REGNUM + 8, ptoff(r8)},
{IA64_GR0_REGNUM + 9, ptoff(r9)},
{IA64_GR0_REGNUM + 10, ptoff(r10)},
{IA64_GR0_REGNUM + 11, ptoff(r11)},
{IA64_GR0_REGNUM + 12, ptoff(r12)},
{IA64_GR0_REGNUM + 13, ptoff(r13)},
{IA64_GR0_REGNUM + 14, ptoff(r14)},
{IA64_GR0_REGNUM + 15, ptoff(r15)},
{IA64_GR0_REGNUM + 16, ptoff(r16)},
{IA64_GR0_REGNUM + 17, ptoff(r17)},
{IA64_GR0_REGNUM + 18, ptoff(r18)},
{IA64_GR0_REGNUM + 19, ptoff(r19)},
{IA64_GR0_REGNUM + 20, ptoff(r20)},
{IA64_GR0_REGNUM + 21, ptoff(r21)},
{IA64_GR0_REGNUM + 22, ptoff(r22)},
{IA64_GR0_REGNUM + 23, ptoff(r23)},
{IA64_GR0_REGNUM + 24, ptoff(r24)},
{IA64_GR0_REGNUM + 25, ptoff(r25)},
{IA64_GR0_REGNUM + 26, ptoff(r26)},
{IA64_GR0_REGNUM + 27, ptoff(r27)},
{IA64_GR0_REGNUM + 28, ptoff(r28)},
{IA64_GR0_REGNUM + 29, ptoff(r29)},
{IA64_GR0_REGNUM + 30, ptoff(r30)},
{IA64_GR0_REGNUM + 31, ptoff(r31)},
};
static struct reg_to_ptreg_index br_reg_to_ptreg_index[] = {
{IA64_BR0_REGNUM, ptoff(b0)},
{IA64_BR0_REGNUM + 6, ptoff(b6)},
{IA64_BR0_REGNUM + 7, ptoff(b7)},
};
static struct reg_to_ptreg_index ar_reg_to_ptreg_index[] = {
{IA64_PFS_REGNUM, ptoff(ar_pfs)},
{IA64_UNAT_REGNUM, ptoff(ar_unat)},
{IA64_RNAT_REGNUM, ptoff(ar_rnat)},
{IA64_BSPSTORE_REGNUM, ptoff(ar_bspstore)},
{IA64_RSC_REGNUM, ptoff(ar_rsc)},
{IA64_CSD_REGNUM, ptoff(ar_csd)},
{IA64_SSD_REGNUM, ptoff(ar_ssd)},
{IA64_FPSR_REGNUM, ptoff(ar_fpsr)},
{IA64_CCV_REGNUM, ptoff(ar_ccv)},
};
#ifndef XEN
extern atomic_t cpu_doing_single_step;
#endif
static int kgdb_gr_reg(int regnum, struct unw_frame_info *info,
unsigned long *reg, int rw)
{
char nat;
if ((regnum >= IA64_GR0_REGNUM && regnum <= (IA64_GR0_REGNUM + 1)) ||
(regnum >= (IA64_GR0_REGNUM + 4) &&
regnum <= (IA64_GR0_REGNUM + 7)))
return !unw_access_gr(info, regnum - IA64_GR0_REGNUM,
reg, &nat, rw);
else
return 0;
}
static int kgdb_gr_ptreg(int regnum, struct pt_regs * ptregs,
struct unw_frame_info *info, unsigned long *reg, int rw)
{
int i, result = 1;
char nat;
if (!((regnum >= (IA64_GR0_REGNUM + 2) &&
regnum <= (IA64_GR0_REGNUM + 3)) ||
(regnum >= (IA64_GR0_REGNUM + 8) &&
regnum <= (IA64_GR0_REGNUM + 15)) ||
(regnum >= (IA64_GR0_REGNUM + 16) &&
regnum <= (IA64_GR0_REGNUM + 31))))
return 0;
else if (rw && ptregs) {
for (i = 0; i < ARRAY_SIZE(gr_reg_to_ptreg_index); i++)
if (gr_reg_to_ptreg_index[i].reg == regnum) {
*((unsigned long *)(((void *)ptregs) +
gr_reg_to_ptreg_index[i].ptregoff)) = *reg;
break;
}
} else if (!rw && ptregs) {
for (i = 0; i < ARRAY_SIZE(gr_reg_to_ptreg_index); i++)
if (gr_reg_to_ptreg_index[i].reg == regnum) {
*reg = *((unsigned long *)
(((void *)ptregs) +
gr_reg_to_ptreg_index[i].ptregoff));
break;
}
} else
result = !unw_access_gr(info, regnum - IA64_GR0_REGNUM,
reg, &nat, rw);
return result;
}
static int kgdb_br_reg(int regnum, struct pt_regs * ptregs,
struct unw_frame_info *info, unsigned long *reg, int rw)
{
int i, result = 1;
if (!(regnum >= IA64_BR0_REGNUM && regnum <= (IA64_BR0_REGNUM + 7)))
return 0;
switch (regnum) {
case IA64_BR0_REGNUM:
case IA64_BR0_REGNUM + 6:
case IA64_BR0_REGNUM + 7:
if (rw) {
for (i = 0; i < ARRAY_SIZE(br_reg_to_ptreg_index); i++)
if (br_reg_to_ptreg_index[i].reg == regnum) {
*((unsigned long *)
(((void *)ptregs) +
br_reg_to_ptreg_index[i].ptregoff)) =
*reg;
break;
}
} else
for (i = 0; i < ARRAY_SIZE(br_reg_to_ptreg_index); i++)
if (br_reg_to_ptreg_index[i].reg == regnum) {
*reg = *((unsigned long *)
(((void *)ptregs) +
br_reg_to_ptreg_index[i].
ptregoff));
break;
}
break;
case IA64_BR0_REGNUM + 1:
case IA64_BR0_REGNUM + 2:
case IA64_BR0_REGNUM + 3:
case IA64_BR0_REGNUM + 4:
case IA64_BR0_REGNUM + 5:
result = !unw_access_br(info, regnum - IA64_BR0_REGNUM,
reg, rw);
break;
}
return result;
}
static int kgdb_fr_reg(int regnum, char *inbuffer, struct pt_regs * ptregs,
struct unw_frame_info *info, unsigned long *reg,
struct ia64_fpreg *freg, int rw)
{
int result = 1;
if (!(regnum >= IA64_FR0_REGNUM && regnum <= (IA64_FR0_REGNUM + 127)))
return 0;
switch (regnum) {
case IA64_FR0_REGNUM + 6:
case IA64_FR0_REGNUM + 7:
case IA64_FR0_REGNUM + 8:
case IA64_FR0_REGNUM + 9:
case IA64_FR0_REGNUM + 10:
case IA64_FR0_REGNUM + 11:
case IA64_FR0_REGNUM + 12:
if (rw) {
#ifndef XEN
char *ptr = inbuffer;
freg->u.bits[0] = *reg;
kgdb_hex2long(&ptr, &freg->u.bits[1]);
*(&ptregs->f6 + (regnum - (IA64_FR0_REGNUM + 6))) =
*freg;
#else
printk("%s: %d: writing to fpreg is not supported.\n",
__func__, __LINE__);
#endif
break;
} else if (!ptregs)
result = !unw_access_fr(info, regnum - IA64_FR0_REGNUM,
freg, rw);
else
#ifndef XEN
*freg =
*(&ptregs->f6 + (regnum - (IA64_FR0_REGNUM + 6)));
#else
//XXX struct ia64_fpreg and struct pt_fpreg are same.
*freg = *((struct ia64_fpreg*)(&ptregs->f6 +
(regnum - (IA64_FR0_REGNUM + 6))));
#endif
break;
default:
if (!rw)
result = !unw_access_fr(info, regnum - IA64_FR0_REGNUM,
freg, rw);
else
result = 0;
break;
}
return result;
}
static int kgdb_ar_reg(int regnum, struct pt_regs * ptregs,
struct unw_frame_info *info, unsigned long *reg, int rw)
{
int result = 0, i;
if (!(regnum >= IA64_AR0_REGNUM && regnum <= IA64_EC_REGNUM))
return 0;
if (rw && ptregs) {
for (i = 0; i < ARRAY_SIZE(ar_reg_to_ptreg_index); i++)
if (ar_reg_to_ptreg_index[i].reg == regnum) {
*((unsigned long *) (((void *)ptregs) +
ar_reg_to_ptreg_index[i].ptregoff)) =
*reg;
result = 1;
break;
}
} else if (ptregs) {
for (i = 0; i < ARRAY_SIZE(ar_reg_to_ptreg_index); i++)
if (ar_reg_to_ptreg_index[i].reg == regnum) {
*reg = *((unsigned long *) (((void *)ptregs) +
ar_reg_to_ptreg_index[i].ptregoff));
result = 1;
break;
}
}
if (result)
return result;
result = 1;
switch (regnum) {
case IA64_CSD_REGNUM:
result = !unw_access_ar(info, UNW_AR_CSD, reg, rw);
break;
case IA64_SSD_REGNUM:
result = !unw_access_ar(info, UNW_AR_SSD, reg, rw);
break;
case IA64_UNAT_REGNUM:
result = !unw_access_ar(info, UNW_AR_RNAT, reg, rw);
break;
case IA64_RNAT_REGNUM:
result = !unw_access_ar(info, UNW_AR_RNAT, reg, rw);
break;
case IA64_BSPSTORE_REGNUM:
result = !unw_access_ar(info, UNW_AR_RNAT, reg, rw);
break;
case IA64_PFS_REGNUM:
result = !unw_access_ar(info, UNW_AR_RNAT, reg, rw);
break;
case IA64_LC_REGNUM:
result = !unw_access_ar(info, UNW_AR_LC, reg, rw);
break;
case IA64_EC_REGNUM:
result = !unw_access_ar(info, UNW_AR_EC, reg, rw);
break;
case IA64_FPSR_REGNUM:
result = !unw_access_ar(info, UNW_AR_FPSR, reg, rw);
break;
case IA64_RSC_REGNUM:
result = !unw_access_ar(info, UNW_AR_RSC, reg, rw);
break;
case IA64_CCV_REGNUM:
result = !unw_access_ar(info, UNW_AR_CCV, reg, rw);
break;
default:
result = 0;
}
return result;
}
#ifndef XEN
void kgdb_get_reg(char *outbuffer, int regnum, struct unw_frame_info *info,
struct pt_regs *ptregs)
#else
static int
kgdb_get_reg(int regnum, struct unw_frame_info *info,
struct cpu_user_regs* ptregs,
unsigned long* __reg, struct ia64_fpreg* __freg)
#endif
{
unsigned long reg, size = 0, *mem = &reg;
struct ia64_fpreg freg;
if (kgdb_gr_reg(regnum, info, &reg, 0) ||
kgdb_gr_ptreg(regnum, ptregs, info, &reg, 0) ||
kgdb_br_reg(regnum, ptregs, info, &reg, 0) ||
kgdb_ar_reg(regnum, ptregs, info, &reg, 0))
size = sizeof(reg);
else if (kgdb_fr_reg(regnum, NULL, ptregs, info, &reg, &freg, 0)) {
size = sizeof(freg);
mem = (unsigned long *)&freg;
} else if (regnum == IA64_IP_REGNUM) {
if (!ptregs) {
unw_get_ip(info, &reg);
size = sizeof(reg);
} else {
reg = ptregs->cr_iip;
size = sizeof(reg);
}
} else if (regnum == IA64_CFM_REGNUM) {
if (!ptregs)
unw_get_cfm(info, &reg);
else
reg = ptregs->cr_ifs;
size = sizeof(reg);
} else if (regnum == IA64_PSR_REGNUM) {
#ifndef XEN
if (!ptregs && kgdb_usethread)
ptregs = (struct pt_regs *)
((unsigned long)kgdb_usethread +
IA64_STK_OFFSET) - 1;
#endif
if (ptregs)
reg = ptregs->cr_ipsr;
size = sizeof(reg);
} else if (regnum == IA64_PR_REGNUM) {
if (ptregs)
reg = ptregs->pr;
else
unw_access_pr(info, &reg, 0);
size = sizeof(reg);
} else if (regnum == IA64_BSP_REGNUM) {
unw_get_bsp(info, &reg);
size = sizeof(reg);
}
#ifndef XEN
if (size) {
kgdb_mem2hex((char *) mem, outbuffer, size);
outbuffer[size*2] = 0;
}
else
strcpy(outbuffer, "E0");
return;
#else
if (size) {
if (size == sizeof(reg)) {
*__reg = reg;
} else {
BUG_ON(size != sizeof(freg));
*__freg = freg;
}
return 0;
}
return -1;
#endif
}
#ifndef XEN
static int inline kgdb_get_blocked_state(struct task_struct *p,
struct unw_frame_info *unw)
#else
static int
kgdb_get_blocked_state(struct vcpu *p,
struct cpu_user_regs *regs,
struct unw_frame_info *unw)
#endif
{
unsigned long ip;
int count = 0;
#ifndef XEN
unw_init_from_blocked_task(unw, p);
#endif
ip = 0UL;
do {
if (unw_unwind(unw) < 0)
return -1;
unw_get_ip(unw, &ip);
#ifndef XEN
if (!in_sched_functions(ip))
break;
#else
dbg_printk("ip 0x%lx cr_iip 0x%lx\n", ip, regs->cr_iip);
if (ip == regs->cr_iip)
break;
#endif
} while (count++ < 16);
if (!ip)
return -1;
else
return 0;
}
struct gdb_callback_arg
{
struct cpu_user_regs* regs;
unsigned long regnum;
unsigned long* reg;
struct pt_fpreg* freg;
int error;
// 1: not supported
// 0: success
// -1: failure
};
static void
gdb_get_reg_callback(struct unw_frame_info* info, void* __arg)
{
struct gdb_callback_arg* arg = (struct gdb_callback_arg*)__arg;
if (kgdb_get_blocked_state(current, arg->regs, info) < 0) {
dbg_printk("%s: kgdb_get_blocked_state failed\n", __func__);
arg->error = -1;
return;
}
//XXX struct ia64_fpreg and struct pt_fpreg are same.
if (kgdb_get_reg(arg->regnum, info, arg->regs, arg->reg,
(struct ia64_fpreg*)arg->freg) < 0) {
dbg_printk("%s: kgdb_get_reg failed\n", __func__);
arg->error = 1;
return;
}
arg->error = 0;
return;
}
void
gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs,
struct gdb_context *ctx)
{
struct gdb_callback_arg arg;
unsigned long reg;
struct pt_fpreg freg;
char buf[16 * 2 + 1];
if (regnum >= NUM_REGS) {
dbg_printk("%s: regnum %ld\n", __func__, regnum);
goto out_err;
}
arg.regs = regs;
arg.regnum = regnum;
arg.reg = &reg;
arg.freg = &freg;
arg.error = 0;
unw_init_running(&gdb_get_reg_callback, (void*)&arg);
if (arg.error < 0) {
dbg_printk("%s: gdb_get_reg_callback failed\n", __func__);
goto out_err;
}
if (arg.error > 0) {
// notify gdb that this register is not supported.
// see fetch_register_using_p() in gdb/remote.c.
sprintf(buf, "%s", "x");
} else if (IA64_FR0_REGNUM <= regnum && regnum <= IA64_FR0_REGNUM + 127) {
sprintf(buf, "%.016lx", swab64(freg.u.bits[0]));
sprintf(buf + 16, "%.016lx", swab64(freg.u.bits[1]));
} else {
sprintf(buf, "%.016lx", swab64(reg));
}
out:
return gdb_send_reply(buf, ctx);
out_err:
dbg_printk("Register read unsupported regnum = 0x%lx\n", regnum);
sprintf(buf, "%s", "E0");
goto out;
}
#endif
void
gdb_arch_resume(struct cpu_user_regs *regs,
unsigned long addr, unsigned long type,
struct gdb_context *ctx)
{
/* XXX */
if (type == GDB_STEP) {
gdb_send_reply("S01", ctx);
}
}
void
gdb_arch_print_state(struct cpu_user_regs *regs)
{
/* XXX */
}
void
gdb_arch_enter(struct cpu_user_regs *regs)
{
/* nothing */
}
void
gdb_arch_exit(struct cpu_user_regs *regs)
{
/* nothing */
}
/*
* Local variables:
* mode: C
* c-set-style: "BSD"
* c-basic-offset: 4
* tab-width: 4
* End:
*/
+7 -1
View File
@@ -12,6 +12,7 @@
#include <asm/offsets.h>
#include <asm/processor.h>
#include <asm/system.h>
#include <asm/debugger.h>
#include <public/arch-ia64.h>
@@ -549,7 +550,12 @@ GLOBAL_ENTRY(fast_break_reflect)
(p7) br.spnt.many 1f ;;
cmp.eq p7,p0=r17,r0
(p7) br.spnt.few dispatch_break_fault ;;
1:
#ifdef CRASH_DEBUG
movl r21=CDB_BREAK_NUM ;;
cmp.eq p7,p0=r17,r21
(p7) br.spnt.few dispatch_break_fault ;;
#endif
1:
#if 1 /* special handling in case running on simulator */
movl r20=first_break;;
ld4 r23=[r20];;
+6 -24
View File
@@ -11,30 +11,15 @@
.mmlist = LIST_HEAD_INIT(name.mmlist), \
}
#define IDLE0_EXEC_DOMAIN(_ed,_d) \
#define IDLE_VCPU(_v) \
{ \
processor: 0, \
mm: 0, \
thread: INIT_THREAD, \
domain: (_d) \
}
#define IDLE0_DOMAIN(_t) \
{ \
domain_id: IDLE_DOMAIN_ID, \
refcnt: ATOMIC_INIT(1) \
domain: 0 \
}
struct mm_struct init_mm = INIT_MM(init_mm);
EXPORT_SYMBOL(init_mm);
struct domain idle0_domain = IDLE0_DOMAIN(idle0_domain);
#if 0
struct vcpu idle0_vcpu = IDLE0_EXEC_DOMAIN(idle0_vcpu,
&idle0_domain);
#endif
/*
* Initial task structure.
*
@@ -43,15 +28,12 @@ struct vcpu idle0_vcpu = IDLE0_EXEC_DOMAIN(idle0_vcpu,
*/
union {
struct {
struct domain task;
struct vcpu task;
} s;
unsigned long stack[KERNEL_STACK_SIZE/sizeof (unsigned long)];
} init_task_mem asm ("init_task") __attribute__((section(".data.init_task")));
// = {{
;
//.task = IDLE0_EXEC_DOMAIN(init_task_mem.s.task,&idle0_domain),
//};
//};
} init_task_mem asm ("init_task") __attribute__((section(".data.init_task"))) = {{
.task = IDLE_VCPU(init_task_mem.s.task)
}};
EXPORT_SYMBOL(init_task);
+8
View File
@@ -15,6 +15,7 @@
#define sys_call_table 0
#define sys_ni_syscall 0
#include <asm/vhpt.h>
#include <asm/debugger.h>
#endif
/*
* arch/ia64/kernel/ivt.S
@@ -841,6 +842,13 @@ ENTRY(break_fault)
;;
cmp.eq p7,p0=r17,r0
(p7) br.spnt.few dispatch_break_fault ;;
#ifdef CRASH_DEBUG
// panic can occur before domain0 is created.
// in such case referencing XSI_PSR_IC causes nested_dtlb_miss
movl r18=CDB_BREAK_NUM ;;
cmp.eq p7,p0=r17,r18 ;;
(p7) br.spnt.few dispatch_break_fault ;;
#endif
movl r18=XSI_PSR_IC
;;
ld8 r19=[r18]
+2
View File
@@ -502,6 +502,7 @@ find_largest_hole (u64 start, u64 end, void *arg)
}
#endif /* CONFIG_VIRTUAL_MEM_MAP */
#ifndef XEN
static int
count_reserved_pages (u64 start, u64 end, void *arg)
{
@@ -514,6 +515,7 @@ count_reserved_pages (u64 start, u64 end, void *arg)
*count += num_reserved;
return 0;
}
#endif
/*
* Boot command-line option "nolwsys" can be used to disable the use of any light-weight
+10 -2
View File
@@ -31,6 +31,7 @@
#include <asm/dom_fw.h>
#include "hpsim_ssc.h"
#include <xen/multicall.h>
#include <asm/debugger.h>
extern unsigned long vcpu_get_itir_on_fault(struct vcpu *, UINT64);
extern void die_if_kernel(char *str, struct pt_regs *regs, long err);
@@ -652,7 +653,7 @@ void
ia64_handle_break (unsigned long ifa, struct pt_regs *regs, unsigned long isr, unsigned long iim)
{
struct domain *d = (struct domain *) current->domain;
struct vcpu *v = (struct domain *) current;
struct vcpu *v = current;
extern unsigned long running_on_sim;
if (first_break) {
@@ -663,7 +664,14 @@ ia64_handle_break (unsigned long ifa, struct pt_regs *regs, unsigned long isr, u
if (iim == 0x80001 || iim == 0x80002) { //FIXME: don't hardcode constant
if (running_on_sim) do_ssc(vcpu_get_gr(current,36), regs);
else do_ssc(vcpu_get_gr(current,36), regs);
}
}
#ifdef CRASH_DEBUG
else if ((iim == 0 || iim == CDB_BREAK_NUM) && !user_mode(regs)) {
if (iim == 0)
show_registers(regs);
debugger_trap_fatal(0 /* don't care */, regs);
}
#endif
else if (iim == d->arch.breakimm) {
/* by default, do not continue */
v->arch.hypercall_continuation = 0;
+1
View File
@@ -4,6 +4,7 @@
* Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
*/
#include <xen/lib.h>
#include <asm/acpi.h>
#include <asm/sn/sn_sal.h>
#include <xen/serial.h>
+9 -1
View File
@@ -18,6 +18,7 @@
#include <xen/softirq.h>
#include <public/sched.h>
#include <asm/vhpt.h>
#include <asm/debugger.h>
efi_memory_desc_t ia64_efi_io_md;
EXPORT_SYMBOL(ia64_efi_io_md);
@@ -75,7 +76,7 @@ struct pt_regs *guest_cpu_user_regs(void) { return vcpu_regs(current); }
void raise_actimer_softirq(void)
{
raise_softirq(AC_TIMER_SOFTIRQ);
raise_softirq(TIMER_SOFTIRQ);
}
unsigned long
@@ -203,6 +204,8 @@ void dump_pageframe_info(struct domain *d)
printk("dump_pageframe_info not implemented\n");
}
int nmi_count(int x) { return x; }
///////////////////////////////
// called from arch/ia64/head.S
///////////////////////////////
@@ -354,6 +357,11 @@ loop:
va_end(args);
printf(buf);
if (regs) show_registers(regs);
if (regs) {
debugger_trap_fatal(0 /* don't care */, regs);
} else {
debugger_trap_immediate();
}
domain_pause_by_systemcontroller(current->domain);
v->domain->shutdown_code = SHUTDOWN_crash;
set_bit(_DOMF_shutdown, v->domain->domain_flags);
+20 -27
View File
@@ -21,12 +21,13 @@
#include <asm/page.h>
#include <asm/setup.h>
#include <xen/string.h>
#include <asm/vmx.h>
unsigned long xenheap_phys_end;
char saved_command_line[COMMAND_LINE_SIZE];
struct vcpu *idle_vcpu[NR_CPUS] = { &idle0_vcpu };
struct vcpu *idle_vcpu[NR_CPUS];
cpumask_t cpu_present_map;
@@ -156,16 +157,12 @@ void start_kernel(void)
unsigned long dom0_memory_start, dom0_memory_size;
unsigned long dom0_initrd_start, dom0_initrd_size;
unsigned long initial_images_start, initial_images_end;
struct domain *idle_domain;
running_on_sim = is_platform_hp_ski();
/* Kernel may be relocated by EFI loader */
xen_pstart = ia64_tpa(KERNEL_START);
/* Must do this early -- e.g., spinlocks rely on get_current(). */
//set_current(&idle0_vcpu);
ia64_r13 = (void *)&idle0_vcpu;
idle0_vcpu.domain = &idle0_domain;
early_setup_arch(&cmdline);
/* We initialise the serial devices very early so we can get debugging. */
@@ -281,18 +278,22 @@ void start_kernel(void)
(xenheap_phys_end-__pa(heap_start)) >> 20,
(xenheap_phys_end-__pa(heap_start)) >> 10);
printk("About to call scheduler_init()\n");
scheduler_init();
idle_vcpu[0] = (struct vcpu*) ia64_r13;
idle_domain = domain_create(IDLE_DOMAIN_ID, 0);
BUG_ON(idle_domain == NULL);
late_setup_arch(&cmdline);
setup_per_cpu_areas();
mem_init();
printk("About to call scheduler_init()\n");
scheduler_init();
local_irq_disable();
init_IRQ ();
printk("About to call init_xen_time()\n");
init_xen_time(); /* initialise the time */
printk("About to call ac_timer_init()\n");
ac_timer_init();
printk("About to call timer_init()\n");
timer_init();
#ifdef CONFIG_XEN_CONSOLE_INPUT /* CONFIG_SERIAL_8250_CONSOLE=n in dom0! */
initialize_keytable();
@@ -308,14 +309,10 @@ printk("About to call ac_timer_init()\n");
}
smp_prepare_cpus(max_cpus);
/* We aren't hotplug-capable yet. */
//BUG_ON(!cpus_empty(cpu_present_map));
for_each_cpu ( i )
cpu_set(i, cpu_present_map);
//BUG_ON(!local_irq_is_enabled());
/* Enable IRQ to receive IPI (needed for ITC sync). */
local_irq_enable();
@@ -342,19 +339,14 @@ printk("About to call sort_main_extable()\n");
/* Create initial domain 0. */
printk("About to call do_createdomain()\n");
dom0 = do_createdomain(0, 0);
init_task.domain = &idle0_domain;
init_task.processor = 0;
// init_task.mm = &init_mm;
init_task.domain->arch.mm = &init_mm;
// init_task.thread = INIT_THREAD;
//arch_do_createdomain(current);
printk("About to call domain_create()\n");
dom0 = domain_create(0, 0);
#ifdef CLONE_DOMAIN0
{
int i;
for (i = 0; i < CLONE_DOMAIN0; i++) {
clones[i] = do_createdomain(i+1, 0);
clones[i] = domain_create(i+1, 0);
if ( clones[i] == NULL )
panic("Error creating domain0 clone %d\n",i);
}
@@ -431,8 +423,8 @@ printk("About to call init_trace_bufs()\n");
local_irq_enable();
printf("About to call schedulers_start dom0=%p, idle0_dom=%p\n",
dom0, &idle0_domain);
printf("About to call schedulers_start dom0=%p, idle_dom=%p\n",
dom0, &idle_domain);
schedulers_start();
domain_unpause_by_systemcontroller(dom0);
@@ -445,9 +437,10 @@ void arch_get_xen_caps(xen_capabilities_info_t info)
{
char *p=info;
*p=0;
p += sprintf(p,"xen-%d.%d-ia64 ", XEN_VERSION, XEN_SUBVERSION);
p+=sprintf(p,"xen_%d.%d_ia64 ",XEN_VERSION,XEN_SUBVERSION);
if (vmx_enabled)
p += sprintf(p,"hvm-%d.%d-ia64 ", XEN_VERSION, XEN_SUBVERSION);
*(p-1) = 0;
+2 -2
View File
@@ -196,7 +196,7 @@ xen_timer_interrupt (int irq, void *dev_id, struct pt_regs *regs)
//#endif
/* double check, in case we got hit by a (slow) PMI: */
} while (time_after_eq(ia64_get_itc(), new_itm));
raise_softirq(AC_TIMER_SOFTIRQ);
raise_softirq(TIMER_SOFTIRQ);
return IRQ_HANDLED;
}
@@ -235,7 +235,7 @@ int __init init_xen_time()
return 0;
}
int reprogram_ac_timer(s_time_t timeout)
int reprogram_timer(s_time_t timeout)
{
struct vcpu *v = current;
s_time_t expire;
+1 -1
View File
@@ -32,7 +32,7 @@ OBJS := $(subst $(TARGET_SUBARCH)/asm-offsets.o,,$(OBJS))
OBJS := $(subst $(TARGET_SUBARCH)/xen.lds.o,,$(OBJS))
ifneq ($(crash_debug),y)
OBJS := $(patsubst cdb%.o,,$(OBJS))
OBJS := $(patsubst gdbstub%.o,,$(OBJS))
endif
default: $(TARGET)
Loaded 100 of 165 files, more files were not shown because too many files have changed in this diff. Show more
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.