On Fri, Mar 28, 2008 at 03:14:58PM -0600, Alex Williamson wrote:
I'm not a fan of adding these ia64 headers directly into common code.
Couldn't we at least put these in xenctrl.h, or maybe include them via
xen.h or arch-ia64.h? Thanks,
Hi,
new version of the patch. memmap.h is now included by arch-ia64.h
Tristan.
# HG changeset patch
# User Tristan Gingold [EMAIL PROTECTED]
# Date 1206855549 -7200
# Node ID 00953116e1010f0d7b2b9adbe96f081591307fee
# Parent 7a919cd832fd27bb36586d3231b58b93d3328953
Use ppn to store io type.
Instead of using 3 extra bits in pte to store the io type, only one bit
is used to mark the page as an IO page and the type is stored in the ppn
field. This both save 2 bits and allow many more io types.
Move the VTi memory map to arch-ia64/hvm/memmap.h
Signed-off-by: Tristan Gingold [EMAIL PROTECTED]
diff -r 7a919cd832fd -r 00953116e101 xen/arch/ia64/vmx/mmio.c
--- a/xen/arch/ia64/vmx/mmio.c Thu Feb 07 06:29:34 2008 +0100
+++ b/xen/arch/ia64/vmx/mmio.c Sun Mar 30 07:39:09 2008 +0200
@@ -39,6 +39,7 @@
#include asm/hvm/vacpi.h
#include asm/hvm/support.h
#include public/hvm/save.h
+#include public/arch-ia64/hvm/memmap.h
#include public/arch-ia64/sioemu.h
#include asm/sioemu.h
@@ -352,11 +353,9 @@ static void legacy_io_access(VCPU *vcpu,
return;
}
-static void mmio_access(VCPU *vcpu, u64 src_pa, u64 *dest, size_t s, int ma,
int dir, u64 pte)
-{
-unsigned long iot = pte GPFN_IO_MASK;
-
-perfc_incra(vmx_mmio_access, iot 56);
+static void mmio_access(VCPU *vcpu, u64 src_pa, u64 *dest, size_t s, int ma,
int dir, u64 iot)
+{
+perfc_incra(vmx_mmio_access, iot 0x7);
switch (iot) {
case GPFN_PIB:
if (ma != 4)
@@ -366,8 +365,6 @@ static void mmio_access(VCPU *vcpu, u64
vlsapic_write(vcpu, src_pa, s, *dest);
else
*dest = vlsapic_read(vcpu, src_pa, s);
-break;
-case GPFN_GFW:
break;
case GPFN_IOSAPIC:
if (!dir)
@@ -394,7 +391,7 @@ enum inst_type_en { SL_INTEGER, SL_FLOAT
/*
dir 1: read 0:write
*/
-void emulate_io_inst(VCPU *vcpu, u64 padr, u64 ma, u64 pte)
+void emulate_io_inst(VCPU *vcpu, u64 padr, u64 ma, u64 iot)
{
REGS *regs;
IA64_BUNDLE bundle;
@@ -536,8 +533,6 @@ void emulate_io_inst(VCPU *vcpu, u64 pad
}
if (vcpu-domain-arch.is_sioemu) {
-unsigned long iot = pte GPFN_IO_MASK;
-
if (iot != GPFN_PIB iot != GPFN_IOSAPIC) {
sioemu_io_emulate(padr, data, data1, update_word);
return;
@@ -545,10 +540,10 @@ void emulate_io_inst(VCPU *vcpu, u64 pad
}
if (size == 4) {
-mmio_access(vcpu, padr + 8, data1, 1 3, ma, dir, pte);
+mmio_access(vcpu, padr + 8, data1, 1 3, ma, dir, iot);
size = 3;
}
-mmio_access(vcpu, padr, data, 1 size, ma, dir, pte);
+mmio_access(vcpu, padr, data, 1 size, ma, dir, iot);
emulate_io_update(vcpu, update_word, data, data1);
}
diff -r 7a919cd832fd -r 00953116e101 xen/arch/ia64/vmx/sioemu.c
--- a/xen/arch/ia64/vmx/sioemu.cThu Feb 07 06:29:34 2008 +0100
+++ b/xen/arch/ia64/vmx/sioemu.cSun Mar 30 07:39:09 2008 +0200
@@ -166,8 +166,11 @@ sioemu_add_io_physmap (struct domain *d,
unsigned long i;
int res;
+/* Convert to ppn. */
+type = PAGE_SHIFT;
+
/* Check type. */
-if (type == 0 || (type GPFN_IO_MASK) != type)
+if (type == 0 || (type _PAGE_PPN_MASK) != type)
return -EINVAL;
if ((start (PAGE_SIZE -1)) || (size (PAGE_SIZE - 1)))
return -EINVAL;
@@ -180,7 +183,7 @@ sioemu_add_io_physmap (struct domain *d,
/* Set. */
for (i = start; i start + size; i += PAGE_SIZE) {
-res = __assign_domain_page(d, i, type, ASSIGN_writable);
+res = __assign_domain_page(d, i, type, ASSIGN_writable | ASSIGN_io);
if (res != 0)
return res;
}
diff -r 7a919cd832fd -r 00953116e101 xen/arch/ia64/vmx/vlsapic.c
--- a/xen/arch/ia64/vmx/vlsapic.c Thu Feb 07 06:29:34 2008 +0100
+++ b/xen/arch/ia64/vmx/vlsapic.c Sun Mar 30 07:39:09 2008 +0200
@@ -47,6 +47,7 @@
#include xen/domain.h
#include asm/hvm/support.h
#include public/hvm/save.h
+#include public/arch-ia64/hvm/memmap.h
#ifdef IPI_DEBUG
#define IPI_DPRINTK(x...) printk(x)
diff -r 7a919cd832fd -r 00953116e101 xen/arch/ia64/vmx/vmmu.c
--- a/xen/arch/ia64/vmx/vmmu.c Thu Feb 07 06:29:34 2008 +0100
+++ b/xen/arch/ia64/vmx/vmmu.c Sun Mar 30 07:39:09 2008 +0200
@@ -314,7 +314,7 @@ IA64FAULT vmx_vcpu_itr_d(VCPU *vcpu, u64
thash_purge_entries(vcpu, va, ps);
gpfn = (pte _PAGE_PPN_MASK) PAGE_SHIFT;
gpte = lookup_domain_mpa(vcpu-domain, gpfn, NULL);
-if (gpte GPFN_IO_MASK)
+if (gpte _PAGE_IO)
pte |= VTLB_PTE_IO;
vcpu_get_rr(vcpu, va, rid);
rid = RR_RID_MASK;
diff -r 7a919cd832fd -r 00953116e101 xen/arch/ia64/vmx/vmx_fault.c
--- a/xen/arch/ia64/vmx/vmx_fault.c Thu Feb 07 06:29:34 2008 +0100
+++