From 4d4a2e9d227a6a87ae61d4a62f1831bdaf8e8c2b Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Thu, 9 Feb 2006 08:48:47 -0700 Subject: [PATCH 01/14] [IA64] added multicall This patch added multicall hypercall. Signed-off-by: Masaki Kanno --- xen/arch/ia64/xen/hypercall.c | 43 +++++++++++++++++++++++++++++++- xen/include/asm-ia64/multicall.h | 24 +++++++++++++++++- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/xen/arch/ia64/xen/hypercall.c b/xen/arch/ia64/xen/hypercall.c index 34ebd0b355..355fbd6b7e 100644 --- a/xen/arch/ia64/xen/hypercall.c +++ b/xen/arch/ia64/xen/hypercall.c @@ -9,6 +9,7 @@ #include #include #include +#include #include /* FOR EFI_UNIMPLEMENTED */ #include /* FOR struct ia64_sal_retval */ @@ -23,6 +24,42 @@ extern unsigned long translate_domain_mpaddr(unsigned long); unsigned long idle_when_pending = 0; unsigned long pal_halt_light_count = 0; +hypercall_t ia64_hypercall_table[] = + { + (hypercall_t)do_ni_hypercall, /* do_set_trap_table */ /* 0 */ + (hypercall_t)do_ni_hypercall, /* do_mmu_update */ + (hypercall_t)do_ni_hypercall, /* do_set_gdt */ + (hypercall_t)do_ni_hypercall, /* do_stack_switch */ + (hypercall_t)do_ni_hypercall, /* do_set_callbacks */ + (hypercall_t)do_ni_hypercall, /* do_fpu_taskswitch */ /* 5 */ + (hypercall_t)do_ni_hypercall, /* do_sched_op */ + (hypercall_t)do_dom0_op, + (hypercall_t)do_ni_hypercall, /* do_set_debugreg */ + (hypercall_t)do_ni_hypercall, /* do_get_debugreg */ + (hypercall_t)do_ni_hypercall, /* do_update_descriptor */ /* 10 */ + (hypercall_t)do_ni_hypercall, /* do_ni_hypercall */ + (hypercall_t)do_memory_op, + (hypercall_t)do_multicall, + (hypercall_t)do_ni_hypercall, /* do_update_va_mapping */ + (hypercall_t)do_ni_hypercall, /* do_set_timer_op */ /* 15 */ + (hypercall_t)do_event_channel_op, + (hypercall_t)do_xen_version, + (hypercall_t)do_console_io, + (hypercall_t)do_ni_hypercall, /* do_physdev_op */ + (hypercall_t)do_grant_table_op, /* 20 */ + (hypercall_t)do_ni_hypercall, /* do_vm_assist */ + (hypercall_t)do_ni_hypercall, /* do_update_va_mapping_otherdomain */ + (hypercall_t)do_ni_hypercall, /* (x86 only) */ + (hypercall_t)do_ni_hypercall, /* do_vcpu_op */ + (hypercall_t)do_ni_hypercall, /* (x86_64 only) */ /* 25 */ + (hypercall_t)do_ni_hypercall, /* do_mmuext_op */ + (hypercall_t)do_ni_hypercall, /* do_acm_op */ + (hypercall_t)do_ni_hypercall, /* do_nmi_op */ + (hypercall_t)do_ni_hypercall, /* */ + (hypercall_t)do_ni_hypercall, /* */ /* 30 */ + (hypercall_t)do_ni_hypercall /* */ + }; + int ia64_hypercall (struct pt_regs *regs) { @@ -181,9 +218,13 @@ ia64_hypercall (struct pt_regs *regs) regs->r8 = do_xen_version(regs->r14, regs->r15); break; + case __HYPERVISOR_multicall: + regs->r8 = do_multicall(regs->r14, regs->r15); + break; + default: printf("unknown hypercall %x\n", regs->r2); - regs->r8 = (unsigned long)-1; + regs->r8 = do_ni_hypercall(); } return 1; } diff --git a/xen/include/asm-ia64/multicall.h b/xen/include/asm-ia64/multicall.h index 8e7953bece..53bb171c32 100644 --- a/xen/include/asm-ia64/multicall.h +++ b/xen/include/asm-ia64/multicall.h @@ -1,5 +1,27 @@ #ifndef __ASM_IA64_MULTICALL_H__ #define __ASM_IA64_MULTICALL_H__ -#define do_multicall_call(_call) BUG() +#include + +typedef unsigned long (*hypercall_t)( + unsigned long arg0, + unsigned long arg1, + unsigned long arg2, + unsigned long arg3, + unsigned long arg4, + unsigned long arg5); + +extern hypercall_t ia64_hypercall_table[]; + +static inline void do_multicall_call(multicall_entry_t *call) +{ + call->result = (*ia64_hypercall_table[call->op])( + call->args[0], + call->args[1], + call->args[2], + call->args[3], + call->args[4], + call->args[5]); +} + #endif /* __ASM_IA64_MULTICALL_H__ */ From c9260ffa7b6f2d0f12449d8a7c8646c92b3a2544 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Thu, 9 Feb 2006 08:51:29 -0700 Subject: [PATCH 02/14] [IA64] remove set_gpfn_from_mfn from config.h set_gpfn_from_mfn() in config.h (was dummy set_pfn_from_mfn) is now defined in mm.h. Remove from config.h to eliminate a bunch of compile warnings. Signed-off-by: Alex Williamson --- xen/include/asm-ia64/config.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/xen/include/asm-ia64/config.h b/xen/include/asm-ia64/config.h index 7f5fe58261..dd85bc716d 100644 --- a/xen/include/asm-ia64/config.h +++ b/xen/include/asm-ia64/config.h @@ -215,9 +215,6 @@ void sort_main_extable(void); // see include/asm-ia64/mm.h, handle remaining page_info uses until gone #define page_info page -// see common/memory.c -#define set_gpfn_from_mfn(x,y) do { } while (0) - // see common/keyhandler.c #define nop() asm volatile ("nop 0") From aee7503c6c3cf92e0682d9a4cba80844649d69a4 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Thu, 9 Feb 2006 12:59:50 -0700 Subject: [PATCH 03/14] [IA64] remove CLONE_DOMAIN0 and DOMU_AUTO_RESTART for simplicity. These were used only for debugging in early stage and aren't used now. Signed-off-by: Isaku Yamahata --- xen/arch/ia64/xen/domain.c | 70 ----------------------------------- xen/arch/ia64/xen/hypercall.c | 7 ---- xen/arch/ia64/xen/xensetup.c | 36 ------------------ xen/include/asm-ia64/config.h | 3 -- xen/include/asm-ia64/domain.h | 5 --- 5 files changed, 121 deletions(-) diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index bfa29b679e..e9ba5f04db 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -655,15 +655,9 @@ void loaddomainelfimage(struct domain *d, unsigned long image_start) else #endif while (memsz > 0) { -#ifdef DOMU_AUTO_RESTART - pteval = lookup_domain_mpa(d,dom_mpaddr); - if (pteval) dom_imva = __va(pteval & _PFN_MASK); - else { printf("loaddomainelfimage: BAD!\n"); while(1); } -#else p = map_new_domain_page(d,dom_mpaddr); if (unlikely(!p)) BUG(); dom_imva = __va(page_to_maddr(p)); -#endif if (filesz > 0) { if (filesz >= PAGE_SIZE) copy_memory(dom_imva,elfaddr,PAGE_SIZE); @@ -792,12 +786,10 @@ int construct_dom0(struct domain *d, //printf("construct_dom0: starting\n"); -#ifndef CLONE_DOMAIN0 /* Sanity! */ BUG_ON(d != dom0); BUG_ON(d->vcpu[0] == NULL); BUG_ON(test_bit(_VCPUF_initialised, &v->vcpu_flags)); -#endif memset(&dsi, 0, sizeof(struct domain_setup_info)); @@ -962,9 +954,6 @@ int construct_dom0(struct domain *d, sync_split_caches(); // FIXME: Hack for keyboard input -#ifdef CLONE_DOMAIN0 -if (d == dom0) -#endif serial_input_init(); if (d == dom0) { VCPU(v, delivery_mask[0]) = -1L; @@ -977,65 +966,6 @@ if (d == dom0) return 0; } -// FIXME: When dom0 can construct domains, this goes away (or is rewritten) -int construct_domU(struct domain *d, - unsigned long image_start, unsigned long image_len, - unsigned long initrd_start, unsigned long initrd_len, - char *cmdline) -{ - int i, rc; - struct vcpu *v = d->vcpu[0]; - unsigned long pkern_entry; - -#ifndef DOMU_AUTO_RESTART - BUG_ON(test_bit(_VCPUF_initialised, &v->vcpu_flags)); -#endif - - printk("*** LOADING DOMAIN %d ***\n",d->domain_id); - - d->max_pages = dom0_size/PAGE_SIZE; // FIXME: use dom0 size - // FIXME: use domain0 command line - rc = parsedomainelfimage(image_start, image_len, &pkern_entry); - printk("parsedomainelfimage returns %d\n",rc); - if ( rc != 0 ) return rc; - - /* Mask all upcalls... */ - for ( i = 0; i < MAX_VIRT_CPUS; i++ ) - d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1; - - /* Copy the OS image. */ - printk("calling loaddomainelfimage(%p,%p)\n",d,image_start); - loaddomainelfimage(d,image_start); - printk("loaddomainelfimage returns\n"); - - set_bit(_VCPUF_initialised, &v->vcpu_flags); - - printk("calling new_thread, entry=%p\n",pkern_entry); -#ifdef DOMU_AUTO_RESTART - v->domain->arch.image_start = image_start; - v->domain->arch.image_len = image_len; - v->domain->arch.entry = pkern_entry; -#endif - new_thread(v, pkern_entry, 0, 0); - printk("new_thread returns\n"); - sync_split_caches(); - __set_bit(0x30, VCPU(v, delivery_mask)); - - return 0; -} - -#ifdef DOMU_AUTO_RESTART -void reconstruct_domU(struct vcpu *v) -{ - /* re-copy the OS image to reset data values to original */ - printk("reconstruct_domU: restarting domain %d...\n", - v->domain->domain_id); - loaddomainelfimage(v->domain,v->domain->arch.image_start); - new_thread(v, v->domain->arch.entry, 0, 0); - sync_split_caches(); -} -#endif - void machine_restart(char * __unused) { if (platform_is_hp_ski()) dummy(); diff --git a/xen/arch/ia64/xen/hypercall.c b/xen/arch/ia64/xen/hypercall.c index 355fbd6b7e..707f9083ed 100644 --- a/xen/arch/ia64/xen/hypercall.c +++ b/xen/arch/ia64/xen/hypercall.c @@ -131,15 +131,8 @@ ia64_hypercall (struct pt_regs *regs) printf("(by dom0)\n "); (*efi.reset_system)(EFI_RESET_WARM,0,0,NULL); } -#ifdef DOMU_AUTO_RESTART - else { - reconstruct_domU(current); - return 0; // don't increment ip! - } -#else printf("(not supported for non-0 domain)\n"); regs->r8 = EFI_UNSUPPORTED; -#endif break; case FW_HYPERCALL_EFI_GET_TIME: tv = vcpu_get_gr(v,32); diff --git a/xen/arch/ia64/xen/xensetup.c b/xen/arch/ia64/xen/xensetup.c index 12a9fd4820..8b1d408946 100644 --- a/xen/arch/ia64/xen/xensetup.c +++ b/xen/arch/ia64/xen/xensetup.c @@ -31,9 +31,6 @@ struct vcpu *idle_vcpu[NR_CPUS]; cpumask_t cpu_present_map; -#ifdef CLONE_DOMAIN0 -struct domain *clones[CLONE_DOMAIN0]; -#endif extern unsigned long domain0_ready; int find_max_pfn (unsigned long, unsigned long, void *); @@ -342,16 +339,6 @@ printk("About to call sort_main_extable()\n"); 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] = domain_create(i+1, 0); - if ( clones[i] == NULL ) - panic("Error creating domain0 clone %d\n",i); - } - } -#endif if ( dom0 == NULL ) panic("Error creating domain 0\n"); @@ -376,22 +363,6 @@ printk("About to call domain_create()\n"); /* PIN domain0 on CPU 0. */ dom0->vcpu[0]->cpu_affinity = cpumask_of_cpu(0); -#ifdef CLONE_DOMAIN0 - { - int i; - dom0_memory_start = __va(ia64_boot_param->domain_start); - dom0_memory_size = ia64_boot_param->domain_size; - - for (i = 0; i < CLONE_DOMAIN0; i++) { - printk("CONSTRUCTING DOMAIN0 CLONE #%d\n",i+1); - if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_size, - dom0_initrd_start,dom0_initrd_size, - 0) != 0) - panic("Could not set up DOM0 clone %d\n",i); - } - } -#endif - /* The stash space for the initial kernel image can now be freed up. */ init_domheap_pages(ia64_boot_param->domain_start, ia64_boot_param->domain_size); @@ -412,13 +383,6 @@ printk("About to call init_trace_bufs()\n"); console_endboot(cmdline && strstr(cmdline, "tty0")); #endif -#ifdef CLONE_DOMAIN0 - { - int i; - for (i = 0; i < CLONE_DOMAIN0; i++) - domain_unpause_by_systemcontroller(clones[i]); - } -#endif domain0_ready = 1; local_irq_enable(); diff --git a/xen/include/asm-ia64/config.h b/xen/include/asm-ia64/config.h index dd85bc716d..f1f15683e5 100644 --- a/xen/include/asm-ia64/config.h +++ b/xen/include/asm-ia64/config.h @@ -3,11 +3,8 @@ #undef USE_PAL_EMULATOR // control flags for turning on/off features under test -#undef CLONE_DOMAIN0 -//#define CLONE_DOMAIN0 1 #undef DOMU_BUILD_STAGING #define VHPT_GLOBAL -#define DOMU_AUTO_RESTART #undef DEBUG_PFMON diff --git a/xen/include/asm-ia64/domain.h b/xen/include/asm-ia64/domain.h index 4d4c17c8e7..a812ac5576 100644 --- a/xen/include/asm-ia64/domain.h +++ b/xen/include/asm-ia64/domain.h @@ -32,11 +32,6 @@ struct arch_domain { u64 xen_vastart; u64 xen_vaend; u64 shared_info_va; -#ifdef DOMU_AUTO_RESTART - u64 image_start; - u64 image_len; - u64 entry; -#endif unsigned long initrd_start; unsigned long initrd_len; char *cmdline; From c9b85549314ec57d9b3c07610b8d0b9d3cc21706 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Thu, 9 Feb 2006 13:35:11 -0700 Subject: [PATCH 04/14] [IA64] fix name conflict(map_domain_page) one is defined in xen/include/xen/domain_page.h. another is defined in xen/arch/ia64/xen/domain.c. this patch renames one defined in xen/arch/ia64/xen/domain.c. For consistency its family is also renamed. map_new_domain_page() -> assign_new_domain_page() map_domain_page() -> assign_domain_page() map_domain_io_page() -> assign_domain_io_page() Signed-off-by: Isaku Yamahata --- xen/arch/ia64/vmx/vmx_init.c | 12 ++++++------ xen/arch/ia64/xen/domain.c | 26 +++++++++++++------------- xen/include/asm-ia64/grant_table.h | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/xen/arch/ia64/vmx/vmx_init.c b/xen/arch/ia64/vmx/vmx_init.c index 16aa37c078..a00c463246 100644 --- a/xen/arch/ia64/vmx/vmx_init.c +++ b/xen/arch/ia64/vmx/vmx_init.c @@ -317,7 +317,7 @@ int vmx_alloc_contig_pages(struct domain *d) for (j = io_ranges[i].start; j < io_ranges[i].start + io_ranges[i].size; j += PAGE_SIZE) - map_domain_page(d, j, io_ranges[i].type); + assign_domain_page(d, j, io_ranges[i].type); } conf_nr = VMX_CONFIG_PAGES(d); @@ -334,14 +334,14 @@ int vmx_alloc_contig_pages(struct domain *d) for (i = 0; i < (end < MMIO_START ? end : MMIO_START); i += PAGE_SIZE, pgnr++) - map_domain_page(d, i, pgnr << PAGE_SHIFT); + assign_domain_page(d, i, pgnr << PAGE_SHIFT); /* Map normal memory beyond 4G */ if (unlikely(end > MMIO_START)) { start = 4 * MEM_G; end = start + (end - 3 * MEM_G); for (i = start; i < end; i += PAGE_SIZE, pgnr++) - map_domain_page(d, i, pgnr << PAGE_SHIFT); + assign_domain_page(d, i, pgnr << PAGE_SHIFT); } d->arch.max_pfn = end >> PAGE_SHIFT; @@ -356,7 +356,7 @@ int vmx_alloc_contig_pages(struct domain *d) /* Map guest firmware */ pgnr = page_to_mfn(page); for (i = GFW_START; i < GFW_START + GFW_SIZE; i += PAGE_SIZE, pgnr++) - map_domain_page(d, i, pgnr << PAGE_SHIFT); + assign_domain_page(d, i, pgnr << PAGE_SHIFT); if (unlikely((page = alloc_domheap_pages(d, 1, 0)) == NULL)) { printk("Could not allocate order=1 pages for vmx contig alloc\n"); @@ -365,9 +365,9 @@ int vmx_alloc_contig_pages(struct domain *d) /* Map for shared I/O page and xenstore */ pgnr = page_to_mfn(page); - map_domain_page(d, IO_PAGE_START, pgnr << PAGE_SHIFT); + assign_domain_page(d, IO_PAGE_START, pgnr << PAGE_SHIFT); pgnr++; - map_domain_page(d, STORE_PAGE_START, pgnr << PAGE_SHIFT); + assign_domain_page(d, STORE_PAGE_START, pgnr << PAGE_SHIFT); set_bit(ARCH_VMX_CONTIG_MEM, &v->arch.arch_vmx.flags); return 0; diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index e9ba5f04db..ce67b49bec 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -389,7 +389,7 @@ printk("map_new_domain0_page: start=%p,end=%p!\n",dom0_start,dom0_start+dom0_siz } /* allocate new page for domain and map it to the specified metaphysical addr */ -struct page * map_new_domain_page(struct domain *d, unsigned long mpaddr) +struct page * assign_new_domain_page(struct domain *d, unsigned long mpaddr) { struct mm_struct *mm = d->arch.mm; struct page *p = (struct page *)0; @@ -400,7 +400,7 @@ struct page * map_new_domain_page(struct domain *d, unsigned long mpaddr) extern unsigned long vhpt_paddr, vhpt_pend; if (!mm->pgd) { - printk("map_new_domain_page: domain pgd must exist!\n"); + printk("assign_new_domain_page: domain pgd must exist!\n"); return(p); } pgd = pgd_offset(mm,mpaddr); @@ -428,21 +428,21 @@ extern unsigned long vhpt_paddr, vhpt_pend; if (p) memset(__va(page_to_maddr(p)),0,PAGE_SIZE); } if (unlikely(!p)) { -printf("map_new_domain_page: Can't alloc!!!! Aaaargh!\n"); +printf("assign_new_domain_page: Can't alloc!!!! Aaaargh!\n"); return(p); } if (unlikely(page_to_maddr(p) > vhpt_paddr && page_to_maddr(p) < vhpt_pend)) { - printf("map_new_domain_page: reassigned vhpt page %p!!\n",page_to_maddr(p)); + printf("assign_new_domain_page: reassigned vhpt page %p!!\n",page_to_maddr(p)); } set_pte(pte, pfn_pte(page_to_maddr(p) >> PAGE_SHIFT, __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX))); } - else printk("map_new_domain_page: mpaddr %lx already mapped!\n",mpaddr); + else printk("assign_new_domain_page: mpaddr %lx already mapped!\n",mpaddr); return p; } /* map a physical address to the specified metaphysical addr */ -void map_domain_page(struct domain *d, unsigned long mpaddr, unsigned long physaddr) +void assign_domain_page(struct domain *d, unsigned long mpaddr, unsigned long physaddr) { struct mm_struct *mm = d->arch.mm; pgd_t *pgd; @@ -451,7 +451,7 @@ void map_domain_page(struct domain *d, unsigned long mpaddr, unsigned long physa pte_t *pte; if (!mm->pgd) { - printk("map_domain_page: domain pgd must exist!\n"); + printk("assign_domain_page: domain pgd must exist!\n"); return; } pgd = pgd_offset(mm,mpaddr); @@ -472,11 +472,11 @@ void map_domain_page(struct domain *d, unsigned long mpaddr, unsigned long physa set_pte(pte, pfn_pte(physaddr >> PAGE_SHIFT, __pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX))); } - else printk("map_domain_page: mpaddr %lx already mapped!\n",mpaddr); + else printk("assign_domain_page: mpaddr %lx already mapped!\n",mpaddr); } #if 0 /* map a physical address with specified I/O flag */ -void map_domain_io_page(struct domain *d, unsigned long mpaddr, unsigned long flags) +void assign_domain_io_page(struct domain *d, unsigned long mpaddr, unsigned long flags) { struct mm_struct *mm = d->arch.mm; pgd_t *pgd; @@ -486,7 +486,7 @@ void map_domain_io_page(struct domain *d, unsigned long mpaddr, unsigned long fl pte_t io_pte; if (!mm->pgd) { - printk("map_domain_page: domain pgd must exist!\n"); + printk("assign_domain_page: domain pgd must exist!\n"); return; } ASSERT(flags & GPFN_IO_MASK); @@ -509,7 +509,7 @@ void map_domain_io_page(struct domain *d, unsigned long mpaddr, unsigned long fl pte_val(io_pte) = flags; set_pte(pte, io_pte); } - else printk("map_domain_page: mpaddr %lx already mapped!\n",mpaddr); + else printk("assign_domain_page: mpaddr %lx already mapped!\n",mpaddr); } #endif void mpafoo(unsigned long mpaddr) @@ -557,7 +557,7 @@ tryagain: } /* if lookup fails and mpaddr is "legal", "create" the page */ if ((mpaddr >> PAGE_SHIFT) < d->max_pages) { - if (map_new_domain_page(d,mpaddr)) goto tryagain; + if (assign_new_domain_page(d,mpaddr)) goto tryagain; } printk("lookup_domain_mpa: bad mpa %p (> %p\n", mpaddr,d->max_pages< 0) { - p = map_new_domain_page(d,dom_mpaddr); + p = assign_new_domain_page(d,dom_mpaddr); if (unlikely(!p)) BUG(); dom_imva = __va(page_to_maddr(p)); if (filesz > 0) { diff --git a/xen/include/asm-ia64/grant_table.h b/xen/include/asm-ia64/grant_table.h index 7e3ad4c550..14b9456409 100644 --- a/xen/include/asm-ia64/grant_table.h +++ b/xen/include/asm-ia64/grant_table.h @@ -17,7 +17,7 @@ #define gnttab_shared_gmfn(d, t, i) \ ( ((d) == dom0) ? \ ((virt_to_maddr((t)->shared) >> PAGE_SHIFT) + (i)) : \ - (map_domain_page((d), 1UL<<40, virt_to_maddr((t)->shared)), \ + (assign_domain_page((d), 1UL<<40, virt_to_maddr((t)->shared)), \ 1UL << (40 - PAGE_SHIFT)) \ ) From d9ba64283e5587c29755e65c49356e7ed93a72dc Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Thu, 9 Feb 2006 13:43:39 -0700 Subject: [PATCH 05/14] [IA64] zero clear page for pgd, pmd, pte. xen heap page are not always zero cleared, so that explicit zeroing is needed. Signed-off-by: Isaku Yamahata --- xen/arch/ia64/xen/xenmisc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/arch/ia64/xen/xenmisc.c b/xen/arch/ia64/xen/xenmisc.c index e73fab753e..923f254ad4 100644 --- a/xen/arch/ia64/xen/xenmisc.c +++ b/xen/arch/ia64/xen/xenmisc.c @@ -168,7 +168,11 @@ void __free_pages(struct page *page, unsigned int order) void *pgtable_quicklist_alloc(void) { - return alloc_xenheap_pages(0); + void *p; + p = alloc_xenheap_pages(0); + if (p) + clear_page(p); + return p; } void pgtable_quicklist_free(void *pgtable_entry) From 77e844ac767e132727d5b8af9d928fec6546ad5e Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Thu, 9 Feb 2006 13:48:05 -0700 Subject: [PATCH 06/14] [IA64] evtchn_ia64 spin lock - fix dead lock added spin_unlock() in case error occurs. Signed-off-by: Isaku Yamahata --- .../arch/ia64/xen/drivers/evtchn_ia64.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c index 0dde420095..fa753e512b 100644 --- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c @@ -106,8 +106,10 @@ int bind_virq_to_irqhandler( BUG_ON(HYPERVISOR_event_channel_op(&op) != 0 ); evtchn = op.u.bind_virq.port; - if (!unbound_irq(evtchn)) - return -EINVAL; + if (!unbound_irq(evtchn)) { + evtchn = -EINVAL; + goto out; + } evtchns[evtchn].handler = handler; evtchns[evtchn].dev_id = dev_id; @@ -115,6 +117,7 @@ int bind_virq_to_irqhandler( irq_info[evtchn] = mk_irq_info(IRQT_VIRQ, virq, evtchn); unmask_evtchn(evtchn); +out: spin_unlock(&irq_mapping_update_lock); return evtchn; } @@ -125,8 +128,10 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn, { spin_lock(&irq_mapping_update_lock); - if (!unbound_irq(evtchn)) - return -EINVAL; + if (!unbound_irq(evtchn)) { + evtchn = -EINVAL; + goto out; + } evtchns[evtchn].handler = handler; evtchns[evtchn].dev_id = dev_id; @@ -134,6 +139,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn, irq_info[evtchn] = mk_irq_info(IRQT_EVTCHN, 0, evtchn); unmask_evtchn(evtchn); +out: spin_unlock(&irq_mapping_update_lock); return evtchn; } @@ -158,7 +164,7 @@ void unbind_from_irqhandler(unsigned int irq, void *dev_id) spin_lock(&irq_mapping_update_lock); if (unbound_irq(irq)) - return; + goto out; op.cmd = EVTCHNOP_close; op.u.close.port = evtchn; @@ -179,6 +185,7 @@ void unbind_from_irqhandler(unsigned int irq, void *dev_id) evtchns[evtchn].handler = NULL; evtchns[evtchn].opened = 0; +out: spin_unlock(&irq_mapping_update_lock); } From c8bc83284a247d87885fb62a1ac17fa08c237158 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Thu, 9 Feb 2006 13:55:03 -0700 Subject: [PATCH 07/14] [IA64] take start_info page from dom0 page not from xen heap. start_info page is used for xen to pass start up information to domain0 and the page is used only by dom0 so that it should belong to dom0. Signed-off-by: Isaku Yamahata --- linux-2.6-xen-sparse/arch/ia64/kernel/setup.c | 9 +++++++++ xen/arch/ia64/xen/domain.c | 14 ++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c index 03177e2d1d..361d71172c 100644 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c @@ -61,6 +61,9 @@ #include #include #include +#ifdef CONFIG_XEN +#include +#endif #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE) # error "struct cpuinfo_ia64 too big!" @@ -241,6 +244,12 @@ reserve_memory (void) rsvd_region[n].end = (unsigned long) ia64_imva(_end); n++; +#ifdef CONFIG_XEN + rsvd_region[n].start = (unsigned long) (HYPERVISOR_shared_info->arch.start_info_pfn << PAGE_SHIFT); + rsvd_region[n].end = rsvd_region[n].start + PAGE_SIZE; + n++; +#endif + #ifdef CONFIG_BLK_DEV_INITRD if (ia64_boot_param->initrd_start) { rsvd_region[n].start = (unsigned long)__va(ia64_boot_param->initrd_start); diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index ce67b49bec..5fcafa83aa 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -782,6 +782,7 @@ int construct_dom0(struct domain *d, unsigned long pkern_entry; unsigned long pkern_end; unsigned long pinitrd_start = 0; + unsigned long pstart_info; unsigned long ret, progress = 0; //printf("construct_dom0: starting\n"); @@ -839,13 +840,18 @@ int construct_dom0(struct domain *d, (PAGE_ALIGN(initrd_len) + 4*1024*1024); memcpy(__va(pinitrd_start),initrd_start,initrd_len); + pstart_info = PAGE_ALIGN(pinitrd_start + initrd_len); + } else { + pstart_info = PAGE_ALIGN(pkern_end); } printk("METAPHYSICAL MEMORY ARRANGEMENT:\n" " Kernel image: %lx->%lx\n" " Entry address: %lx\n" - " Init. ramdisk: %lx len %lx\n", - pkern_start, pkern_end, pkern_entry, pinitrd_start, initrd_len); + " Init. ramdisk: %lx len %lx\n" + " Start info.: %lx->%lx\n", + pkern_start, pkern_end, pkern_entry, pinitrd_start, initrd_len, + pstart_info, pstart_info + PAGE_SIZE); if ( (pkern_end - pkern_start) > (d->max_pages * PAGE_SIZE) ) { @@ -900,9 +906,9 @@ int construct_dom0(struct domain *d, /* Set up start info area. */ - si = (start_info_t *)alloc_xenheap_page(); + d->shared_info->arch.start_info_pfn = pstart_info >> PAGE_SHIFT; + si = __va(pstart_info); memset(si, 0, PAGE_SIZE); - d->shared_info->arch.start_info_pfn = __pa(si) >> PAGE_SHIFT; sprintf(si->magic, "xen-%i.%i-ia64", XEN_VERSION, XEN_SUBVERSION); si->nr_pages = d->tot_pages; From 8ec46856982714508969cf77c1e52961cca265f0 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Fri, 10 Feb 2006 16:16:33 -0700 Subject: [PATCH 08/14] [IA64] cleanup extraneous function name change from upstream irq_exit() was briefly renamed to xen_irq_exit(), but the change is no longer necessary. Reverting to original name and parameters. Signed-off-by: Alex Williamson --- xen/arch/ia64/linux-xen/irq_ia64.c | 2 +- xen/arch/ia64/xen/xenirq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/ia64/linux-xen/irq_ia64.c b/xen/arch/ia64/linux-xen/irq_ia64.c index e5adfa6869..346de4c167 100644 --- a/xen/arch/ia64/linux-xen/irq_ia64.c +++ b/xen/arch/ia64/linux-xen/irq_ia64.c @@ -169,7 +169,7 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs) * handler needs to be able to wait for further keyboard interrupts, which can't * come through until ia64_eoi() has been done. */ - xen_irq_exit(regs); + irq_exit(); } #ifdef CONFIG_HOTPLUG_CPU diff --git a/xen/arch/ia64/xen/xenirq.c b/xen/arch/ia64/xen/xenirq.c index e40daeb832..23d761c0c5 100644 --- a/xen/arch/ia64/xen/xenirq.c +++ b/xen/arch/ia64/xen/xenirq.c @@ -59,7 +59,7 @@ xen_do_IRQ(ia64_vector vector) /* * Exit an interrupt context. Process softirqs if needed and possible: */ -void xen_irq_exit(struct pt_regs *regs) +void irq_exit(void) { sub_preempt_count(IRQ_EXIT_OFFSET); } From 1c79b8d7a8c5d85c1000f350aa1b7d901a4a8cc7 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Wed, 15 Feb 2006 21:33:52 -0700 Subject: [PATCH 09/14] [IA64] Cleanup README.origin files Add missing/moved files, fixup paths, fix inconsistent formatting Signed-off-by: Alex Williamson --- xen/arch/ia64/linux-xen/README.origin | 37 ++++++------ xen/arch/ia64/linux/README.origin | 5 +- .../asm-ia64/linux-xen/asm/README.origin | 1 + xen/include/asm-ia64/linux/README.origin | 56 +++++++++---------- xen/include/asm-ia64/linux/asm/README.origin | 2 +- .../asm-ia64/linux/byteorder/README.origin | 6 +- 6 files changed, 57 insertions(+), 50 deletions(-) diff --git a/xen/arch/ia64/linux-xen/README.origin b/xen/arch/ia64/linux-xen/README.origin index 870044d163..08f1e8c231 100644 --- a/xen/arch/ia64/linux-xen/README.origin +++ b/xen/arch/ia64/linux-xen/README.origin @@ -5,19 +5,24 @@ # (e.g. with #ifdef XEN or XEN in a comment) so that they can be # easily updated to future versions of the corresponding Linux files. -efi.c -> linux/arch/ia64/kernel/efi.c -entry.h -> linux/arch/ia64/kernel/entry.h -entry.S -> linux/arch/ia64/kernel/entry.S -hpsim_ssc.h -> linux/arch/ia64/hp/sim/hpsim_ssc.h -irq_ia64.c -> linux/arch/ia64/kernel/irq_ia64.c -minstate.h -> linux/arch/ia64/kernel/minstate.h -mm_contig.c -> linux/arch/ia64/mm/contig.c -pal.S -> linux/arch/ia64/kernel/pal.S -sal.c -> linux/arch/ia64/kernel/sal.c -setup.c -> linux/arch/ia64/kernel/setup.c -smp.c -> linux/arch/ia64/kernel/smp.c -smpboot.c -> linux/arch/ia64/kernel/smpboot.c -sort.c -> linux/lib/sort.c -time.c -> linux/arch/ia64/kernel/time.c -tlb.c -> linux/arch/ia64/mm/tlb.c -unaligned.c -> linux/arch/ia64/kernel/unaligned.c +efi.c -> linux/arch/ia64/kernel/efi.c +entry.h -> linux/arch/ia64/kernel/entry.h +entry.S -> linux/arch/ia64/kernel/entry.S +head.S -> linux/arch/ia64/kernel/head.S +hpsim_ssc.h -> linux/arch/ia64/hp/sim/hpsim_ssc.h +irq_ia64.c -> linux/arch/ia64/kernel/irq_ia64.c +minstate.h -> linux/arch/ia64/kernel/minstate.h +mm_contig.c -> linux/arch/ia64/mm/contig.c +pal.S -> linux/arch/ia64/kernel/pal.S +process-linux-xen.c -> linux/arch/ia64/kernel/process.c +sal.c -> linux/arch/ia64/kernel/sal.c +setup.c -> linux/arch/ia64/kernel/setup.c +smp.c -> linux/arch/ia64/kernel/smp.c +smpboot.c -> linux/arch/ia64/kernel/smpboot.c +sort.c -> linux/lib/sort.c +time.c -> linux/arch/ia64/kernel/time.c +tlb.c -> linux/arch/ia64/mm/tlb.c +unaligned.c -> linux/arch/ia64/kernel/unaligned.c +unwind.c -> linux/arch/ia64/kernel/unwind.c +unwind_decoder.c -> linux/arch/ia64/kernel/unwind_decoder.c +unwind_i.h -> linux/arch/ia64/kernel/unwind_i.h diff --git a/xen/arch/ia64/linux/README.origin b/xen/arch/ia64/linux/README.origin index 2dceb999f2..66ef299d7d 100644 --- a/xen/arch/ia64/linux/README.origin +++ b/xen/arch/ia64/linux/README.origin @@ -5,14 +5,15 @@ needs to be changed, move it to ../linux-xen and follow the instructions in the README there. cmdline.c -> linux/lib/cmdline.c -efi_stub.S -> linux/arch/ia64/efi_stub.S +efi_stub.S -> linux/arch/ia64/kernel/efi_stub.S extable.c -> linux/arch/ia64/mm/extable.c hpsim.S -> linux/arch/ia64/hp/sim/hpsim.S ia64_ksyms.c -> linux/arch/ia64/kernel/ia64_ksyms.c +irq_lsapic.c -> linux/arch/ia64/kernel/irq_lsapic.c linuxextable.c -> linux/kernel/extable.c machvec.c -> linux/arch/ia64/kernel/machvec.c patch.c -> linux/arch/ia64/kernel/patch.c -pcdp.h -> drivers/firmware/pcdp.h +pcdp.h -> linux/drivers/firmware/pcdp.h bitop.c -> linux/arch/ia64/lib/bitop.c clear_page.S -> linux/arch/ia64/lib/clear_page.S diff --git a/xen/include/asm-ia64/linux-xen/asm/README.origin b/xen/include/asm-ia64/linux-xen/asm/README.origin index 7bd87353cd..1073f4d63f 100644 --- a/xen/include/asm-ia64/linux-xen/asm/README.origin +++ b/xen/include/asm-ia64/linux-xen/asm/README.origin @@ -5,6 +5,7 @@ # (e.g. with #ifdef XEN or XEN in a comment) so that they can be # easily updated to future versions of the corresponding Linux files. +cache.h -> linux/include/asm-ia64/cache.h gcc_intrin.h -> linux/include/asm-ia64/gcc_intrin.h ia64regs.h -> linux/include/asm-ia64/ia64regs.h io.h -> linux/include/asm-ia64/io.h diff --git a/xen/include/asm-ia64/linux/README.origin b/xen/include/asm-ia64/linux/README.origin index 9daa422935..82b6be4422 100644 --- a/xen/include/asm-ia64/linux/README.origin +++ b/xen/include/asm-ia64/linux/README.origin @@ -4,31 +4,31 @@ # needs to be changed, move it to ../linux-xen and follow # the instructions in the README there. -bcd.h ->linux/include/linux/bcd.h -bitmap.h ->linux/include/linux/bitmap.h -bitops.h ->linux/include/linux/bitops.h -dma-mapping.h ->linux/include/linux/dma-mapping.h -efi.h ->linux/include/linux/efi.h -err.h ->linux/include/linux/err.h -initrd.h ->linux/include/linux/initrd.h -jiffies.h ->linux/include/linux/jiffies.h -kmalloc_sizes.h ->linux/include/linux/kmalloc_sizes.h -linkage.h ->linux/include/linux/linkage.h -mmzone.h ->linux/include/linux/mmzone.h -notifier.h ->linux/include/linux/notifier.h -numa.h ->linux/include/linux/numa.h -page-flags.h ->linux/include/linux/page-flags.h -percpu.h ->linux/include/linux/percpu.h -preempt.h ->linux/include/linux/preempt.h -rbtree.h ->linux/include/linux/rbtree.h -rwsem.h ->linux/include/linux/rwsem.h -seqlock.h ->linux/include/linux/seqlock.h -slab.h ->linux/include/linux/slab.h -sort.h ->linux/include/linux/sort.h -stddef.h ->linux/include/linux/stddef.h -thread_info.h ->linux/include/linux/thread_info.h -threads.h ->linux/include/linux/threads.h -time.h ->linux/include/linux/time.h -timex.h ->linux/include/linux/timex.h -topology.h ->linux/include/linux/topology.h -wait.h ->linux/include/linux/wait.h +bcd.h -> linux/include/linux/bcd.h +bitmap.h -> linux/include/linux/bitmap.h +bitops.h -> linux/include/linux/bitops.h +dma-mapping.h -> linux/include/linux/dma-mapping.h +efi.h -> linux/include/linux/efi.h +err.h -> linux/include/linux/err.h +initrd.h -> linux/include/linux/initrd.h +jiffies.h -> linux/include/linux/jiffies.h +kmalloc_sizes.h -> linux/include/linux/kmalloc_sizes.h +linkage.h -> linux/include/linux/linkage.h +mmzone.h -> linux/include/linux/mmzone.h +notifier.h -> linux/include/linux/notifier.h +numa.h -> linux/include/linux/numa.h +page-flags.h -> linux/include/linux/page-flags.h +percpu.h -> linux/include/linux/percpu.h +preempt.h -> linux/include/linux/preempt.h +rbtree.h -> linux/include/linux/rbtree.h +rwsem.h -> linux/include/linux/rwsem.h +seqlock.h -> linux/include/linux/seqlock.h +slab.h -> linux/include/linux/slab.h +sort.h -> linux/include/linux/sort.h +stddef.h -> linux/include/linux/stddef.h +thread_info.h -> linux/include/linux/thread_info.h +threads.h -> linux/include/linux/threads.h +time.h -> linux/include/linux/time.h +timex.h -> linux/include/linux/timex.h +topology.h -> linux/include/linux/topology.h +wait.h -> linux/include/linux/wait.h diff --git a/xen/include/asm-ia64/linux/asm/README.origin b/xen/include/asm-ia64/linux/asm/README.origin index b4dcd4d147..5d23602d61 100644 --- a/xen/include/asm-ia64/linux/asm/README.origin +++ b/xen/include/asm-ia64/linux/asm/README.origin @@ -4,6 +4,7 @@ # needs to be changed, move it to ../linux-xen and follow # the instructions in the README there. +acpi.h -> linux/include/asm-ia64/acpi.h asmmacro.h -> linux/include/asm-ia64/asmmacro.h atomic.h -> linux/include/asm-ia64/atomic.h bitops.h -> linux/include/asm-ia64/bitops.h @@ -11,7 +12,6 @@ break.h -> linux/include/asm-ia64/break.h bug.h -> linux/include/asm-ia64/bug.h byteorder.h -> linux/include/asm-ia64/byteorder.h cacheflush.h -> linux/include/asm-ia64/cacheflush.h -cache.h -> linux/include/asm-ia64/cache.h checksum.h -> linux/include/asm-ia64/checksum.h current.h -> linux/include/asm-ia64/current.h delay.h -> linux/include/asm-ia64/delay.h diff --git a/xen/include/asm-ia64/linux/byteorder/README.origin b/xen/include/asm-ia64/linux/byteorder/README.origin index d530c753a1..ba92292a39 100644 --- a/xen/include/asm-ia64/linux/byteorder/README.origin +++ b/xen/include/asm-ia64/linux/byteorder/README.origin @@ -4,6 +4,6 @@ # needs to be changed, move it to ../linux-xen and follow # the instructions in the README there. -generic.h -> linux/include/byteorder/generic.h -little_endian.h -> linux/include/byteorder/little_endian.h -swab.h -> linux/include/byteorder/swab.h +generic.h -> linux/include/linux/byteorder/generic.h +little_endian.h -> linux/include/linux/byteorder/little_endian.h +swab.h -> linux/include/linux/byteorder/swab.h From 90a1cd66c1a68232bf723aaa0d3e531dc27dc9ca Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Fri, 17 Feb 2006 14:34:17 -0700 Subject: [PATCH 10/14] [IA64] Fixed arch_domain_create This patch fixed the process when xenheap shortage occurred in arch_domain_create(). Signed-off-by: Masaki Kanno --- xen/arch/ia64/xen/domain.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index 5fcafa83aa..273821187e 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -251,9 +251,12 @@ int arch_domain_create(struct domain *d) return 0; fail_nomem: - free_xenheap_page(d->shared_info); - xfree(d->arch.mm); - pgd_free(d->arch.mm->pgd); + if (d->arch.mm->pgd != NULL) + pgd_free(d->arch.mm->pgd); + if (d->arch.mm != NULL) + xfree(d->arch.mm); + if (d->shared_info != NULL) + free_xenheap_page(d->shared_info); return -ENOMEM; } From b090bb926721b8110c2e8f48a4c8f31e1dcc1867 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Fri, 17 Feb 2006 14:42:02 -0700 Subject: [PATCH 11/14] [IA64] declaration of metaphysical_rr I'm making a patch for domain destruction. While I tested my patch by repeatedly creating/destructing domains, a reserved register/field fault occurred in load_region_regs(). The cause of this fault is rr0 value overflow(0xFFFFFFFF********) because metaphysical_rr0 in the arch_domain struct is declared as integer (should be unsigned long). The attached patch fixes the problem. Signed-off-by: Masaki Kanno --- xen/arch/ia64/xen/hyperprivop.S | 6 +++--- xen/include/asm-ia64/domain.h | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/xen/arch/ia64/xen/hyperprivop.S b/xen/arch/ia64/xen/hyperprivop.S index 0f6c37b433..7aa1eadc78 100644 --- a/xen/arch/ia64/xen/hyperprivop.S +++ b/xen/arch/ia64/xen/hyperprivop.S @@ -1336,7 +1336,7 @@ ENTRY(hyper_ssm_dt) movl r22=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;; ld8 r22=[r22];; adds r22=IA64_VCPU_META_SAVED_RR0_OFFSET,r22;; - ld4 r23=[r22];; + ld8 r23=[r22];; mov rr[r0]=r23;; srlz.i;; st4 [r20]=r0 ;; @@ -1372,7 +1372,7 @@ ENTRY(hyper_rsm_dt) movl r22=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;; ld8 r22=[r22];; adds r22=IA64_VCPU_META_RR0_OFFSET,r22;; - ld4 r23=[r22];; + ld8 r23=[r22];; mov rr[r0]=r23;; srlz.i;; adds r21=1,r0 ;; @@ -1733,7 +1733,7 @@ ENTRY(hyper_set_rr) dep r23=r28,r23,16,8;; dep r23=r29,r23,8,8 cmp.eq p6,p0=r25,r0;; // if rr0, save for metaphysical -(p6) st4 [r24]=r23 +(p6) st8 [r24]=r23 mov rr[r8]=r23;; // done, mosey on back 1: mov r24=cr.ipsr diff --git a/xen/include/asm-ia64/domain.h b/xen/include/asm-ia64/domain.h index a812ac5576..36318027d1 100644 --- a/xen/include/asm-ia64/domain.h +++ b/xen/include/asm-ia64/domain.h @@ -15,8 +15,8 @@ extern void domain_relinquish_resources(struct domain *); struct arch_domain { struct mm_struct *active_mm; struct mm_struct *mm; - int metaphysical_rr0; - int metaphysical_rr4; + unsigned long metaphysical_rr0; + unsigned long metaphysical_rr4; int starting_rid; /* first RID assigned to domain */ int ending_rid; /* one beyond highest RID assigned to domain */ int rid_bits; /* number of virtual rid bits (default: 18) */ @@ -61,10 +61,10 @@ struct arch_vcpu { unsigned long xen_timer_interval; #endif mapped_regs_t *privregs; /* save the state of vcpu */ - int metaphysical_rr0; // from arch_domain (so is pinned) - int metaphysical_rr4; // from arch_domain (so is pinned) - int metaphysical_saved_rr0; // from arch_domain (so is pinned) - int metaphysical_saved_rr4; // from arch_domain (so is pinned) + unsigned long metaphysical_rr0; // from arch_domain (so is pinned) + unsigned long metaphysical_rr4; // from arch_domain (so is pinned) + unsigned long metaphysical_saved_rr0; // from arch_domain (so is pinned) + unsigned long metaphysical_saved_rr4; // from arch_domain (so is pinned) int breakimm; // from arch_domain (so is pinned) int starting_rid; /* first RID assigned to domain */ int ending_rid; /* one beyond highest RID assigned to domain */ From 4914aeed91bda2a0e6c65d7b3d6fd9e709f98714 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Fri, 17 Feb 2006 14:49:58 -0700 Subject: [PATCH 12/14] [IA64] wrong type cast in ia64_hypercall This is wrong type cast. This patch fix warnning of incompatible pointer type. Signed-off-by: Akio Takebe --- xen/arch/ia64/xen/hypercall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/ia64/xen/hypercall.c b/xen/arch/ia64/xen/hypercall.c index 707f9083ed..76ebec31f5 100644 --- a/xen/arch/ia64/xen/hypercall.c +++ b/xen/arch/ia64/xen/hypercall.c @@ -63,7 +63,7 @@ hypercall_t ia64_hypercall_table[] = int ia64_hypercall (struct pt_regs *regs) { - struct vcpu *v = (struct domain *) current; + struct vcpu *v = current; struct sal_ret_values x; unsigned long *tv, *tc; int pi; From 1dc171610812257fff8a46f1cd89fadabec9aaa7 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Fri, 17 Feb 2006 14:57:19 -0700 Subject: [PATCH 13/14] [IA64] different type of argument in vcpu_set_gr() Fix Reserved Register/Field fault in sal_emulate(). This bug is occurred by a wrong type argument. Signed-off-by: Akio Takebe --- xen/arch/ia64/xen/vcpu.c | 8 ++++---- xen/include/asm-ia64/vcpu.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/arch/ia64/xen/vcpu.c b/xen/arch/ia64/xen/vcpu.c index 4e56524dd9..a15b09981a 100644 --- a/xen/arch/ia64/xen/vcpu.c +++ b/xen/arch/ia64/xen/vcpu.c @@ -81,7 +81,7 @@ unsigned long vcpu_verbose = 0; **************************************************************************/ #ifdef XEN UINT64 -vcpu_get_gr(VCPU *vcpu, unsigned reg) +vcpu_get_gr(VCPU *vcpu, unsigned long reg) { REGS *regs = vcpu_regs(vcpu); UINT64 val; @@ -90,7 +90,7 @@ vcpu_get_gr(VCPU *vcpu, unsigned reg) return val; } IA64FAULT -vcpu_get_gr_nat(VCPU *vcpu, unsigned reg, UINT64 *val) +vcpu_get_gr_nat(VCPU *vcpu, unsigned long reg, UINT64 *val) { REGS *regs = vcpu_regs(vcpu); int nat; @@ -104,7 +104,7 @@ vcpu_get_gr_nat(VCPU *vcpu, unsigned reg, UINT64 *val) // IA64_ILLOP_FAULT if the register would cause an Illegal Operation fault // IA64_NO_FAULT otherwise IA64FAULT -vcpu_set_gr(VCPU *vcpu, unsigned reg, UINT64 value, int nat) +vcpu_set_gr(VCPU *vcpu, unsigned long reg, UINT64 value, int nat) { REGS *regs = vcpu_regs(vcpu); if (!reg) return IA64_ILLOP_FAULT; @@ -118,7 +118,7 @@ vcpu_set_gr(VCPU *vcpu, unsigned reg, UINT64 value, int nat) // IA64_ILLOP_FAULT if the register would cause an Illegal Operation fault // IA64_NO_FAULT otherwise IA64FAULT -vcpu_set_gr(VCPU *vcpu, unsigned reg, UINT64 value) +vcpu_set_gr(VCPU *vcpu, unsigned long reg, UINT64 value) { REGS *regs = vcpu_regs(vcpu); long sof = (regs->cr_ifs) & 0x7f; diff --git a/xen/include/asm-ia64/vcpu.h b/xen/include/asm-ia64/vcpu.h index 812e91cae2..18ec988891 100644 --- a/xen/include/asm-ia64/vcpu.h +++ b/xen/include/asm-ia64/vcpu.h @@ -34,9 +34,9 @@ struct privop_addr_count { #endif /* general registers */ -extern UINT64 vcpu_get_gr(VCPU *vcpu, unsigned reg); -extern IA64FAULT vcpu_get_gr_nat(VCPU *vcpu, unsigned reg, UINT64 *val); -extern IA64FAULT vcpu_set_gr(VCPU *vcpu, unsigned reg, UINT64 value, int nat); +extern UINT64 vcpu_get_gr(VCPU *vcpu, unsigned long reg); +extern IA64FAULT vcpu_get_gr_nat(VCPU *vcpu, unsigned long reg, UINT64 *val); +extern IA64FAULT vcpu_set_gr(VCPU *vcpu, unsigned long reg, UINT64 value, int nat); /* application registers */ extern IA64FAULT vcpu_set_ar(VCPU *vcpu, UINT64 reg, UINT64 val); /* psr */ From e814b1b7743c149fec0e1d5ad51fef0f43d9c86d Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Fri, 17 Feb 2006 15:02:40 -0700 Subject: [PATCH 14/14] [IA64] fixed switch to idle domain bug Previously when switching to idle domain, cr.pta is set to dom0's VHPT, then when switching from VTIdomain to idle domain, cr.pta is set to dom0's VHPT, and in idle domain, VHPT will be not remapped by TR, so there may be unexpected vhpt fault in idle domain, which may cause domain crash. Above only happens in host smp platform not host up platform. This patch is intended to fix this bug. Signed-off-by: Kevin Tian Signed-off-by: Anthony Xu --- xen/arch/ia64/xen/xenmisc.c | 29 ++++++++++++------- .../asm-ia64/linux-xen/asm/processor.h | 13 +++++++++ 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/xen/arch/ia64/xen/xenmisc.c b/xen/arch/ia64/xen/xenmisc.c index 923f254ad4..fddfffdc0e 100644 --- a/xen/arch/ia64/xen/xenmisc.c +++ b/xen/arch/ia64/xen/xenmisc.c @@ -295,6 +295,7 @@ unsigned long context_switch_count = 0; void context_switch(struct vcpu *prev, struct vcpu *next) { uint64_t spsr; + uint64_t pta; local_irq_save(spsr); if(VMX_DOMAIN(prev)){ @@ -302,9 +303,9 @@ void context_switch(struct vcpu *prev, struct vcpu *next) } context_switch_count++; switch_to(prev,next,prev); - if(VMX_DOMAIN(current)){ - vtm_domain_in(current); - } +// if(VMX_DOMAIN(current)){ +// vtm_domain_in(current); +// } // leave this debug for now: it acts as a heartbeat when more than // one domain is active @@ -317,18 +318,26 @@ if (!i--) { printk("+",id); i = 1000000; } } if (VMX_DOMAIN(current)){ + vtm_domain_in(current); vmx_load_all_rr(current); }else{ - extern char ia64_ivt; - ia64_set_iva(&ia64_ivt); - ia64_set_pta(VHPT_ADDR | (1 << 8) | (VHPT_SIZE_LOG2 << 2) | - VHPT_ENABLED); + extern char ia64_ivt; + ia64_set_iva(&ia64_ivt); if (!is_idle_domain(current->domain)) { + ia64_set_pta(VHPT_ADDR | (1 << 8) | (VHPT_SIZE_LOG2 << 2) | + VHPT_ENABLED); load_region_regs(current); vcpu_load_kernel_regs(current); - if (vcpu_timer_expired(current)) vcpu_pend_timer(current); - } - if (vcpu_timer_expired(current)) vcpu_pend_timer(current); + if (vcpu_timer_expired(current)) + vcpu_pend_timer(current); + }else { + /* When switching to idle domain, only need to disable vhpt + * walker. Then all accesses happen within idle context will + * be handled by TR mapping and identity mapping. + */ + pta = ia64_get_pta(); + ia64_set_pta(pta & ~VHPT_ENABLED); + } } local_irq_restore(spsr); diff --git a/xen/include/asm-ia64/linux-xen/asm/processor.h b/xen/include/asm-ia64/linux-xen/asm/processor.h index 4b7f22da94..2d2642f666 100644 --- a/xen/include/asm-ia64/linux-xen/asm/processor.h +++ b/xen/include/asm-ia64/linux-xen/asm/processor.h @@ -639,6 +639,19 @@ ia64_get_ivr (void) return r; } +#ifdef XEN +/* Get the page table address and control bits. */ +static inline __u64 +ia64_get_pta (void) +{ + __u64 r; + ia64_srlz_d(); + r = ia64_getreg(_IA64_REG_CR_PTA); + ia64_srlz_d(); + return r; +} +#endif + static inline void ia64_set_dbr (__u64 regnum, __u64 value) {