aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/debugger/xenitp/xenitp.c1
-rw-r--r--tools/libxc/ia64/xc_ia64_linux_save.c57
-rwxr-xr-xunmodified_drivers/linux-2.6/mkbuildtree1
-rw-r--r--unmodified_drivers/linux-2.6/overrides.mk1
-rw-r--r--unmodified_drivers/linux-2.6/platform-pci/Kbuild2
-rw-r--r--xen/arch/ia64/vmx/vmmu.c76
-rw-r--r--xen/arch/ia64/vmx/vmx_fault.c1
-rw-r--r--xen/arch/ia64/xen/domain.c31
-rw-r--r--xen/arch/ia64/xen/faults.c1
-rw-r--r--xen/arch/ia64/xen/mm.c2
-rw-r--r--xen/arch/ia64/xen/vcpu.c12
-rw-r--r--xen/arch/ia64/xen/vhpt.c25
-rw-r--r--xen/arch/ia64/xen/xenpatch.c1
-rw-r--r--xen/include/asm-ia64/linux-xen/asm/ptrace.h9
-rw-r--r--xen/include/asm-ia64/tlbflush.h3
-rw-r--r--xen/include/asm-ia64/vmmu.h39
16 files changed, 98 insertions, 164 deletions
diff --git a/tools/debugger/xenitp/xenitp.c b/tools/debugger/xenitp/xenitp.c
index bc82ee6a23..5bd366e4fa 100644
--- a/tools/debugger/xenitp/xenitp.c
+++ b/tools/debugger/xenitp/xenitp.c
@@ -1577,6 +1577,7 @@ void xenitp (int vcpu)
int len;
printf ("XenITP> ");
+ fflush (stdout);
if (fgets (buf, sizeof (buf), stdin) == NULL)
break;
diff --git a/tools/libxc/ia64/xc_ia64_linux_save.c b/tools/libxc/ia64/xc_ia64_linux_save.c
index 007da95d10..2009da781e 100644
--- a/tools/libxc/ia64/xc_ia64_linux_save.c
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c
@@ -52,33 +52,6 @@ static inline void set_bit(int nr, volatile void * addr)
BITMAP_ENTRY(nr, addr) |= (1UL << BITMAP_SHIFT(nr));
}
-static int xc_ia64_shadow_control(int xc_handle,
- uint32_t domid,
- unsigned int sop,
- unsigned long *dirty_bitmap,
- unsigned long pages,
- xc_shadow_op_stats_t *stats)
-{
- if (dirty_bitmap != NULL && pages > 0) {
- int i;
- unsigned char *bmap = (unsigned char *)dirty_bitmap;
- unsigned long bmap_bytes =
- ((pages + BITS_PER_LONG - 1) & ~(BITS_PER_LONG - 1)) / 8;
- unsigned int bmap_pages = (bmap_bytes + PAGE_SIZE - 1) / PAGE_SIZE;
-
- /* Touch the page so that it is in the TC.
- FIXME: use a more reliable method. */
- for (i = 0 ; i < bmap_pages ; i++)
- bmap[i * PAGE_SIZE] = 0;
- /* Because bmap is not page aligned (allocated by malloc), be sure the
- last page is touched. */
- bmap[bmap_bytes - 1] = 0;
- }
-
- return xc_shadow_control(xc_handle, domid, sop,
- dirty_bitmap, pages, NULL, 0, stats);
-}
-
static int
suspend_and_state(int (*suspend)(int), int xc_handle, int io_fd,
int dom, xc_dominfo_t *info)
@@ -485,7 +458,7 @@ xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
goto out;
}
- p2m_size = xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &dom);
+ p2m_size = xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &dom) + 1;
/* This is expected by xm restore. */
if (write_exact(io_fd, &p2m_size, sizeof(unsigned long))) {
@@ -523,9 +496,9 @@ xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
/* Domain is still running at this point */
if (live) {
- if (xc_ia64_shadow_control(xc_handle, dom,
- XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
- NULL, 0, NULL ) < 0) {
+ if (xc_shadow_control(xc_handle, dom,
+ XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
+ NULL, 0, NULL, 0, NULL ) < 0) {
ERROR("Couldn't enable shadow mode");
goto out;
}
@@ -621,9 +594,10 @@ xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
slightly wasteful to peek the whole array evey time,
but this is fast enough for the moment. */
if (!last_iter) {
- if (xc_ia64_shadow_control(xc_handle, dom,
- XEN_DOMCTL_SHADOW_OP_PEEK,
- to_skip, p2m_size, NULL) != p2m_size) {
+ if (xc_shadow_control(xc_handle, dom,
+ XEN_DOMCTL_SHADOW_OP_PEEK,
+ to_skip, p2m_size,
+ NULL, 0, NULL) != p2m_size) {
ERROR("Error peeking shadow bitmap");
goto out;
}
@@ -652,6 +626,9 @@ xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
skip_this_iter++;
if (test_bit(N, to_skip) || !test_bit(N, to_send))
continue;
+ } else if (live) {
+ if (!test_bit(N, to_send))
+ continue;
}
if (debug)
@@ -708,9 +685,10 @@ xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
}
/* Pages to be sent are pages which were dirty. */
- if (xc_ia64_shadow_control(xc_handle, dom,
- XEN_DOMCTL_SHADOW_OP_CLEAN,
- to_send, p2m_size, NULL ) != p2m_size) {
+ if (xc_shadow_control(xc_handle, dom,
+ XEN_DOMCTL_SHADOW_OP_CLEAN,
+ to_send, p2m_size,
+ NULL, 0, NULL ) != p2m_size) {
ERROR("Error flushing shadow PT");
goto out;
}
@@ -768,8 +746,9 @@ xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
out:
if (live) {
- if (xc_ia64_shadow_control(xc_handle, dom, XEN_DOMCTL_SHADOW_OP_OFF,
- NULL, 0, NULL ) < 0) {
+ if (xc_shadow_control(xc_handle, dom,
+ XEN_DOMCTL_SHADOW_OP_OFF,
+ NULL, 0, NULL, 0, NULL ) < 0) {
DPRINTF("Warning - couldn't disable shadow mode");
}
}
diff --git a/unmodified_drivers/linux-2.6/mkbuildtree b/unmodified_drivers/linux-2.6/mkbuildtree
index 88985a5063..9d0f04907e 100755
--- a/unmodified_drivers/linux-2.6/mkbuildtree
+++ b/unmodified_drivers/linux-2.6/mkbuildtree
@@ -77,6 +77,7 @@ i[34567]86|x86_64)
ln -sf ${XL}/include/asm-ia64/xen/xcom_hcall.h include/asm/xen
ln -sf ${XL}/include/asm-ia64/xen/xencomm.h include/asm/xen
ln -sf ${XL}/arch/ia64/xen/xcom_hcall.c platform-pci/
+ ln -sf ${XL}/arch/ia64/xen/xcom_asm.S platform-pci/
ln -sf ${XL}/arch/ia64/xen/xencomm.c platform-pci/xencomm_arch.c
ln -sf ${XL}/drivers/xen/core/xencomm.c platform-pci
;;
diff --git a/unmodified_drivers/linux-2.6/overrides.mk b/unmodified_drivers/linux-2.6/overrides.mk
index 643d814c56..ea0738c1e2 100644
--- a/unmodified_drivers/linux-2.6/overrides.mk
+++ b/unmodified_drivers/linux-2.6/overrides.mk
@@ -12,3 +12,4 @@ ifeq ($(ARCH),ia64)
endif
EXTRA_CFLAGS += -include $(objtree)/include/linux/autoconf.h
+EXTRA_AFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_XEN_PLATFORM_COMPAT_H
diff --git a/unmodified_drivers/linux-2.6/platform-pci/Kbuild b/unmodified_drivers/linux-2.6/platform-pci/Kbuild
index de3e50bca0..7b332ee804 100644
--- a/unmodified_drivers/linux-2.6/platform-pci/Kbuild
+++ b/unmodified_drivers/linux-2.6/platform-pci/Kbuild
@@ -18,5 +18,5 @@ xen-platform-pci-objs += ../xenbus/xen_proc.o
# Can we do better ?
ifeq ($(ARCH),ia64)
- xen-platform-pci-objs += xencomm.o xencomm_arch.o xcom_hcall.o
+ xen-platform-pci-objs += xencomm.o xencomm_arch.o xcom_hcall.o xcom_asm.o
endif
diff --git a/xen/arch/ia64/vmx/vmmu.c b/xen/arch/ia64/vmx/vmmu.c
index 3028f5d0ec..ee03f6fc63 100644
--- a/xen/arch/ia64/vmx/vmmu.c
+++ b/xen/arch/ia64/vmx/vmmu.c
@@ -51,37 +51,6 @@ static void __init parse_vhpt_size(char *s)
custom_param("vti_vtlb_size", parse_vtlb_size);
custom_param("vti_vhpt_size", parse_vhpt_size);
-/*
- * Get the machine page frame number in 16KB unit
- * Input:
- * d:
- */
-static u64 get_mfn(struct domain *d, u64 gpfn)
-{
-// struct domain *d;
- u64 xen_gppn, xen_mppn, mpfn;
-/*
- if ( domid == DOMID_SELF ) {
- d = current->domain;
- }
- else {
- d = get_domain_by_id(domid);
- }
- */
- xen_gppn = arch_to_xen_ppn(gpfn);
- xen_mppn = gmfn_to_mfn(d, xen_gppn);
-/*
- for (i=0; i<pages; i++) {
- if ( gmfn_to_mfn(d, gpfn+i) == INVALID_MFN ) {
- return INVALID_MFN;
- }
- }
-*/
- mpfn= xen_to_arch_ppn(xen_mppn);
- mpfn = mpfn | (((1UL <<(PAGE_SHIFT-ARCH_PAGE_SHIFT))-1)&gpfn);
- return mpfn;
-
-}
static int init_domain_vhpt(struct vcpu *v)
{
@@ -131,51 +100,6 @@ void free_domain_tlb(struct vcpu *v)
free_domain_vhpt(v);
}
-/*
- * Insert guest TLB to machine TLB.
- * data: In TLB format
- */
-void machine_tlb_insert(struct vcpu *v, thash_data_t *tlb)
-{
- u64 psr;
- thash_data_t mtlb;
- unsigned int cl = tlb->cl;
- unsigned long mtlb_ppn;
- mtlb.ifa = tlb->vadr;
- mtlb.itir = tlb->itir & ~ITIR_RV_MASK;
- mtlb.page_flags = tlb->page_flags & ~PAGE_FLAGS_RV_MASK;
- mtlb.ppn = get_mfn(v->domain, tlb->ppn);
- mtlb_ppn=mtlb.ppn;
-
-#if 0
- if (mtlb_ppn == INVALID_MFN)
- panic_domain(vcpu_regs(v), "Machine tlb insert with invalid mfn number.\n");
-#endif
-
- psr = ia64_clear_ic();
- if ( cl == ISIDE_TLB ) {
- ia64_itc(1, mtlb.ifa, mtlb.page_flags, IA64_ITIR_PS_KEY(mtlb.ps, 0));
- }
- else {
- ia64_itc(2, mtlb.ifa, mtlb.page_flags, IA64_ITIR_PS_KEY(mtlb.ps, 0));
- }
- ia64_set_psr(psr);
- ia64_srlz_i();
- return;
-}
-
-/*
- * Purge machine tlb.
- * INPUT
- * rr: guest rr.
- * va: only bits 0:60 is valid
- * size: bits format (1<<size) for the address range to purge.
- *
- */
-void machine_tlb_purge(u64 va, u64 ps)
-{
- ia64_ptcl(va, ps << 2);
-}
int vhpt_enabled(VCPU *vcpu, uint64_t vadr, vhpt_ref_t ref)
{
diff --git a/xen/arch/ia64/vmx/vmx_fault.c b/xen/arch/ia64/vmx/vmx_fault.c
index c015bf4ea0..c7bacf3376 100644
--- a/xen/arch/ia64/vmx/vmx_fault.c
+++ b/xen/arch/ia64/vmx/vmx_fault.c
@@ -181,6 +181,7 @@ vmx_ia64_handle_break (unsigned long ifa, struct pt_regs *regs, unsigned long is
if (iim == 0)
show_registers(regs);
debugger_trap_fatal(0 /* don't care */, regs);
+ regs_increment_iip(regs);
} else
#endif
{
diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c
index 0e54987a34..ffca9533c5 100644
--- a/xen/arch/ia64/xen/domain.c
+++ b/xen/arch/ia64/xen/domain.c
@@ -398,7 +398,7 @@ void relinquish_vcpu_resources(struct vcpu *v)
if (HAS_PERVCPU_VHPT(v->domain))
pervcpu_vhpt_free(v);
if (v->arch.privregs != NULL) {
- free_domheap_pages(virt_to_page(v->arch.privregs),
+ free_xenheap_pages(v->arch.privregs,
get_order_from_shift(XMAPPEDREGS_SHIFT));
v->arch.privregs = NULL;
}
@@ -500,7 +500,6 @@ static void vcpu_share_privregs_with_guest(struct vcpu *v)
int vcpu_late_initialise(struct vcpu *v)
{
struct domain *d = v->domain;
- struct page_info *page;
int rc, order;
if (HAS_PERVCPU_VHPT(d)) {
@@ -511,11 +510,9 @@ int vcpu_late_initialise(struct vcpu *v)
/* Create privregs page. */
order = get_order_from_shift(XMAPPEDREGS_SHIFT);
- page = alloc_domheap_pages(NULL, order, 0);
- if (page == NULL)
+ v->arch.privregs = alloc_xenheap_pages(order);
+ if (v->arch.privregs == NULL)
return -ENOMEM;
-
- v->arch.privregs = page_to_virt(page);
BUG_ON(v->arch.privregs == NULL);
memset(v->arch.privregs, 0, 1 << XMAPPEDREGS_SHIFT);
vcpu_share_privregs_with_guest(v);
@@ -562,8 +559,7 @@ integer_param("pervcpu_vhpt", opt_pervcpu_vhpt);
int arch_domain_create(struct domain *d, unsigned int domcr_flags)
{
int i;
- struct page_info *page = NULL;
-
+
// the following will eventually need to be negotiated dynamically
d->arch.shared_info_va = DEFAULT_SHAREDINFO_ADDR;
d->arch.breakimm = 0x1000;
@@ -582,10 +578,9 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
#endif
if (tlb_track_create(d) < 0)
goto fail_nomem1;
- page = alloc_domheap_pages(NULL, get_order_from_shift(XSI_SHIFT), 0);
- if (page == NULL)
+ d->shared_info = alloc_xenheap_pages(get_order_from_shift(XSI_SHIFT));
+ if (d->shared_info == NULL)
goto fail_nomem;
- d->shared_info = page_to_virt(page);
BUG_ON(d->shared_info == NULL);
memset(d->shared_info, 0, XSI_SIZE);
for (i = 0; i < XSI_SIZE; i += PAGE_SIZE)
@@ -628,8 +623,9 @@ fail_nomem:
fail_nomem1:
if (d->arch.mm.pgd != NULL)
pgd_free(d->arch.mm.pgd);
- if (page != NULL)
- free_domheap_pages(page, get_order_from_shift(XSI_SHIFT));
+ if (d->shared_info != NULL)
+ free_xenheap_pages(d->shared_info,
+ get_order_from_shift(XSI_SHIFT));
return -ENOMEM;
}
@@ -638,7 +634,7 @@ void arch_domain_destroy(struct domain *d)
mm_final_teardown(d);
if (d->shared_info != NULL)
- free_domheap_pages(virt_to_page(d->shared_info),
+ free_xenheap_pages(d->shared_info,
get_order_from_shift(XSI_SHIFT));
tlb_track_destroy(d);
@@ -1772,8 +1768,8 @@ int shadow_mode_control(struct domain *d, xen_domctl_shadow_op_t *sc)
atomic64_set(&d->arch.shadow_dirty_count, 0);
d->arch.shadow_bitmap_size =
- ((d->arch.convmem_end >> PAGE_SHIFT) +
- BITS_PER_LONG - 1) & ~(BITS_PER_LONG - 1);
+ (domain_get_maximum_gpfn(d) + BITS_PER_LONG) &
+ ~(BITS_PER_LONG - 1);
d->arch.shadow_bitmap = xmalloc_array(unsigned long,
d->arch.shadow_bitmap_size / BITS_PER_LONG);
if (d->arch.shadow_bitmap == NULL) {
@@ -1789,7 +1785,7 @@ int shadow_mode_control(struct domain *d, xen_domctl_shadow_op_t *sc)
v->arch.shadow_bitmap = d->arch.shadow_bitmap;
/* Flush vhtp and tlb to enable dirty bit
virtualization. */
- domain_flush_tlb_vhpt(d);
+ flush_tlb_for_log_dirty(d);
}
break;
@@ -1828,6 +1824,7 @@ int shadow_mode_control(struct domain *d, xen_domctl_shadow_op_t *sc)
memset((uint8_t *)d->arch.shadow_bitmap + i, 0, size);
}
+ flush_tlb_for_log_dirty(d);
break;
}
diff --git a/xen/arch/ia64/xen/faults.c b/xen/arch/ia64/xen/faults.c
index bf75b630cf..946eb28e4b 100644
--- a/xen/arch/ia64/xen/faults.c
+++ b/xen/arch/ia64/xen/faults.c
@@ -515,6 +515,7 @@ ia64_handle_break(unsigned long ifa, struct pt_regs *regs, unsigned long isr,
if (iim == 0)
show_registers(regs);
debugger_trap_fatal(0 /* don't care */ , regs);
+ regs_increment_iip(regs);
}
#endif
else if (iim == d->arch.breakimm &&
diff --git a/xen/arch/ia64/xen/mm.c b/xen/arch/ia64/xen/mm.c
index 782d12ae97..b984ad44c7 100644
--- a/xen/arch/ia64/xen/mm.c
+++ b/xen/arch/ia64/xen/mm.c
@@ -430,7 +430,7 @@ mm_final_teardown(struct domain* d)
unsigned long
domain_get_maximum_gpfn(struct domain *d)
{
- return (d->arch.convmem_end + PAGE_SIZE - 1) >> PAGE_SHIFT;
+ return (d->arch.convmem_end - 1) >> PAGE_SHIFT;
}
// stolen from share_xen_page_with_guest() in xen/arch/x86/mm.c
diff --git a/xen/arch/ia64/xen/vcpu.c b/xen/arch/ia64/xen/vcpu.c
index 36c9bb2d81..c8d4118f4b 100644
--- a/xen/arch/ia64/xen/vcpu.c
+++ b/xen/arch/ia64/xen/vcpu.c
@@ -804,12 +804,7 @@ IA64FAULT vcpu_set_iip(VCPU * vcpu, u64 val)
IA64FAULT vcpu_increment_iip(VCPU * vcpu)
{
REGS *regs = vcpu_regs(vcpu);
- struct ia64_psr *ipsr = (struct ia64_psr *)&regs->cr_ipsr;
- if (ipsr->ri == 2) {
- ipsr->ri = 0;
- regs->cr_iip += 16;
- } else
- ipsr->ri++;
+ regs_increment_iip(regs);
return IA64_NO_FAULT;
}
@@ -1693,7 +1688,7 @@ vcpu_get_domain_bundle(VCPU * vcpu, REGS * regs, u64 gip,
IA64FAULT vcpu_translate(VCPU * vcpu, u64 address, BOOLEAN is_data,
u64 * pteval, u64 * itir, u64 * iha)
{
- unsigned long region = address >> 61;
+ unsigned long region = REGION_NUMBER(address);
unsigned long pta, rid, rr, key = 0;
union pte_flags pte;
TR_ENTRY *trp;
@@ -1780,7 +1775,8 @@ IA64FAULT vcpu_translate(VCPU * vcpu, u64 address, BOOLEAN is_data,
/* Optimization for identity mapped region 7 OS (linux) */
if (optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7_FLG &&
- region == 7 && ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL) {
+ region == 7 && ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL &&
+ REGION_OFFSET(address) < _PAGE_PPN_MASK) {
pte.val = address & _PAGE_PPN_MASK;
pte.val = pte.val | optf->im_reg7.pgprot;
key = optf->im_reg7.key;
diff --git a/xen/arch/ia64/xen/vhpt.c b/xen/arch/ia64/xen/vhpt.c
index e5aac9aa43..19d91f5505 100644
--- a/xen/arch/ia64/xen/vhpt.c
+++ b/xen/arch/ia64/xen/vhpt.c
@@ -521,6 +521,31 @@ void domain_flush_tlb_vhpt(struct domain *d)
cpus_clear (d->domain_dirty_cpumask);
}
+void flush_tlb_for_log_dirty(struct domain *d)
+{
+ struct vcpu *v;
+
+ /* NB. There is no race because all vcpus are paused. */
+ if (is_hvm_domain(d)) {
+ for_each_vcpu (d, v) {
+ /* XXX: local_flush_tlb_all is called redundantly */
+ thash_purge_all(v);
+ }
+ smp_call_function((void (*)(void *))local_flush_tlb_all,
+ NULL, 1, 1);
+ } else if (HAS_PERVCPU_VHPT(d)) {
+ for_each_vcpu (d, v) {
+ vcpu_purge_tr_entry(&PSCBX(v,dtlb));
+ vcpu_purge_tr_entry(&PSCBX(v,itlb));
+ vcpu_vhpt_flush(v);
+ }
+ on_each_cpu((void (*)(void *))local_flush_tlb_all, NULL, 1, 1);
+ } else {
+ on_each_cpu((void (*)(void *))flush_tlb_vhpt_all, d, 1, 1);
+ }
+ cpus_clear (d->domain_dirty_cpumask);
+}
+
void flush_tlb_mask(cpumask_t mask)
{
int cpu;
diff --git a/xen/arch/ia64/xen/xenpatch.c b/xen/arch/ia64/xen/xenpatch.c
index f9c9f9cafc..4ecab74ebb 100644
--- a/xen/arch/ia64/xen/xenpatch.c
+++ b/xen/arch/ia64/xen/xenpatch.c
@@ -103,6 +103,7 @@ static void __init xen_patch_frametable_miss(u64 offset)
addr = (u64)&frametable_miss;
val = get_imm64(addr) + offset;
ia64_patch_imm64(addr, val);
+ ia64_fc(addr);
#endif
}
diff --git a/xen/include/asm-ia64/linux-xen/asm/ptrace.h b/xen/include/asm-ia64/linux-xen/asm/ptrace.h
index d44b1da3d5..97ab9cf15a 100644
--- a/xen/include/asm-ia64/linux-xen/asm/ptrace.h
+++ b/xen/include/asm-ia64/linux-xen/asm/ptrace.h
@@ -281,6 +281,15 @@ struct switch_stack {
# define guest_mode(regs) (ia64_psr(regs)->cpl != 0)
# define guest_kernel_mode(regs) (ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL)
# define vmx_guest_kernel_mode(regs) (ia64_psr(regs)->cpl == 0)
+# define regs_increment_iip(regs) \
+do { \
+ struct ia64_psr *ipsr = ia64_psr(regs); \
+ if (ipsr->ri == 2) { \
+ ipsr->ri = 0; \
+ regs->cr_iip += 16; \
+ } else \
+ ipsr->ri++; \
+} while (0)
#else
# define user_mode(regs) (((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0)
#endif
diff --git a/xen/include/asm-ia64/tlbflush.h b/xen/include/asm-ia64/tlbflush.h
index a659f6a0e4..00b72235e0 100644
--- a/xen/include/asm-ia64/tlbflush.h
+++ b/xen/include/asm-ia64/tlbflush.h
@@ -34,6 +34,9 @@ void domain_flush_vtlb_track_entry(struct domain* d,
/* Flush vhpt and mTLB on every dirty cpus. */
void domain_flush_tlb_vhpt(struct domain *d);
+/* Flush vhpt and mTLB for log-dirty mode. */
+void flush_tlb_for_log_dirty(struct domain *d);
+
/* Flush v-tlb on cpus set in mask for current domain. */
void flush_tlb_mask(cpumask_t mask);
diff --git a/xen/include/asm-ia64/vmmu.h b/xen/include/asm-ia64/vmmu.h
index d9d535b3f1..1fd3411676 100644
--- a/xen/include/asm-ia64/vmmu.h
+++ b/xen/include/asm-ia64/vmmu.h
@@ -50,6 +50,10 @@ enum {
#define VTLB_PTE_IO (1UL<<VTLB_PTE_IO_BIT)
#define VTLB_PTE_P (1UL<<VTLB_PTE_P_BIT)
+#define ITIR_RV_MASK (((1UL<<32)-1)<<32 | 0x3)
+#define PAGE_FLAGS_RV_MASK (0x2 | (0x3UL<<50)|(((1UL<<11)-1)<<53))
+#define PAGE_FLAGS_AR_PL_MASK ((0x7UL<<9)|(0x3UL<<7))
+
#ifndef __ASSEMBLY__
typedef struct thash_data {
union {
@@ -126,20 +130,6 @@ typedef struct thash_data {
#define INVALID_ENTRY(hcb, hdata) INVALID_VHPT(hdata)
-/*
- * Architecture ppn is in 4KB unit while XEN
- * page may be different(1<<PAGE_SHIFT).
- */
-static inline u64 arch_to_xen_ppn(u64 appn)
-{
- return (appn >>(PAGE_SHIFT-ARCH_PAGE_SHIFT));
-}
-
-static inline u64 xen_to_arch_ppn(u64 xppn)
-{
- return (xppn <<(PAGE_SHIFT- ARCH_PAGE_SHIFT));
-}
-
typedef struct thash_cb {
/* THASH base information */
thash_data_t *hash; // hash table pointer, aligned at thash_sz.
@@ -202,17 +192,9 @@ extern void thash_purge_all(struct vcpu *v);
extern thash_data_t *vtlb_lookup(struct vcpu *v,u64 va,int is_data);
-#define ITIR_RV_MASK (((1UL<<32)-1)<<32 | 0x3)
-#define PAGE_FLAGS_RV_MASK (0x2 | (0x3UL<<50)|(((1UL<<11)-1)<<53))
-#define PAGE_FLAGS_AR_PL_MASK ((0x7UL<<9)|(0x3UL<<7))
-extern u64 machine_ttag(PTA pta, u64 va);
-extern u64 machine_thash(PTA pta, u64 va);
-extern void machine_tlb_insert(struct vcpu *v, thash_data_t *tlb);
-extern ia64_rr vmmu_get_rr(struct vcpu *vcpu, u64 va);
extern int init_domain_tlb(struct vcpu *v);
extern void free_domain_tlb(struct vcpu *v);
extern thash_data_t * vhpt_lookup(u64 va);
-extern void machine_tlb_purge(u64 va, u64 ps);
extern unsigned long fetch_code(struct vcpu *vcpu, u64 gip, IA64_BUNDLE *pbundle);
extern void emulate_io_inst(struct vcpu *vcpu, u64 padr, u64 ma);
extern int vhpt_enabled(struct vcpu *vcpu, uint64_t vadr, vhpt_ref_t ref);
@@ -222,6 +204,19 @@ extern void thash_vhpt_insert(struct vcpu *v, u64 pte, u64 itir, u64 ifa,
extern u64 guest_vhpt_lookup(u64 iha, u64 *pte);
extern int vhpt_access_rights_fixup(struct vcpu *v, u64 ifa, int is_data);
+/*
+ * Purge machine tlb.
+ * INPUT
+ * rr: guest rr.
+ * va: only bits 0:60 is valid
+ * size: bits format (1<<size) for the address range to purge.
+ *
+ */
+static inline void machine_tlb_purge(u64 va, u64 ps)
+{
+ ia64_ptcl(va, ps << 2);
+}
+
static inline void vmx_vcpu_set_tr (thash_data_t *trp, u64 pte, u64 itir, u64 va, u64 rid)
{
trp->page_flags = pte;