[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [IA64] Change ioports_permit_access interface().
# HG changeset patch # User Isaku Yamahata <yamahata@xxxxxxxxxxxxx> # Date 1224232815 -32400 # Node ID f27787b9f8d7131918cb763acfe7d33e12e6b6e9 # Parent 7db30bf36b0ef5ea95237cef2a4533e4c87b3317 [IA64] Change ioports_permit_access interface(). use VTD to assing device, guest port may not be equal to host port. Change ioports_permit_access interface to get guest pseudo physical address. Signed-off-by: Anthony Xu <anthony.xu@xxxxxxxxx> --- xen/arch/ia64/xen/dom0_ops.c | 4 +-- xen/arch/ia64/xen/domain.c | 2 - xen/arch/ia64/xen/mm.c | 55 +++++++++++++++++++++++++------------------ xen/include/asm-ia64/iocap.h | 2 - 4 files changed, 37 insertions(+), 26 deletions(-) diff -r 7db30bf36b0e -r f27787b9f8d7 xen/arch/ia64/xen/dom0_ops.c --- a/xen/arch/ia64/xen/dom0_ops.c Fri Oct 17 15:33:03 2008 +0900 +++ b/xen/arch/ia64/xen/dom0_ops.c Fri Oct 17 17:40:15 2008 +0900 @@ -203,7 +203,7 @@ long arch_do_domctl(xen_domctl_t *op, XE ret = 0; else { if (op->u.ioport_permission.allow_access) - ret = ioports_permit_access(d, fp, lp); + ret = ioports_permit_access(d, fp, fp, lp); else ret = ioports_deny_access(d, fp, lp); } @@ -522,7 +522,7 @@ dom0vp_add_io_space(struct domain *d, un fp = space_number << IO_SPACE_BITS; lp = fp | 0xffff; - return ioports_permit_access(d, fp, lp); + return ioports_permit_access(d, fp, fp, lp); } unsigned long diff -r 7db30bf36b0e -r f27787b9f8d7 xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Fri Oct 17 15:33:03 2008 +0900 +++ b/xen/arch/ia64/xen/domain.c Fri Oct 17 17:40:15 2008 +0900 @@ -1993,7 +1993,7 @@ static void __init physdev_init_dom0(str BUG(); if (irqs_permit_access(d, 0, NR_IRQS-1)) BUG(); - if (ioports_permit_access(d, 0, 0xffff)) + if (ioports_permit_access(d, 0, 0, 0xffff)) BUG(); } diff -r 7db30bf36b0e -r f27787b9f8d7 xen/arch/ia64/xen/mm.c --- a/xen/arch/ia64/xen/mm.c Fri Oct 17 15:33:03 2008 +0900 +++ b/xen/arch/ia64/xen/mm.c Fri Oct 17 17:40:15 2008 +0900 @@ -983,15 +983,22 @@ assign_domain_page(struct domain *d, ASSIGN_writable | ASSIGN_pgc_allocated); } +/* + * Inpurt + * fgp: first guest port + * fmp: first machine port + * lmp: last machine port + */ int -ioports_permit_access(struct domain *d, unsigned int fp, unsigned int lp) +ioports_permit_access(struct domain *d, unsigned int fgp, + unsigned int fmp, unsigned int lmp) { struct io_space *space; - unsigned long mmio_start, mmio_end, mach_start; + unsigned long mmio_start, mach_start, mach_end; int ret; - if (IO_SPACE_NR(fp) >= num_io_spaces) { - dprintk(XENLOG_WARNING, "Unknown I/O Port range 0x%x - 0x%x\n", fp, lp); + if (IO_SPACE_NR(fmp) >= num_io_spaces) { + dprintk(XENLOG_WARNING, "Unknown I/O Port range 0x%x - 0x%x\n", fmp, lmp); return -EFAULT; } @@ -1005,42 +1012,44 @@ ioports_permit_access(struct domain *d, * I/O port spaces and thus will number port spaces differently. * This is ok, they don't make use of this interface. */ - ret = rangeset_add_range(d->arch.ioport_caps, fp, lp); + ret = rangeset_add_range(d->arch.ioport_caps, fmp, lmp); if (ret != 0) return ret; - space = &io_space[IO_SPACE_NR(fp)]; + space = &io_space[IO_SPACE_NR(fmp)]; /* Legacy I/O on dom0 is already setup */ if (d == dom0 && space == &io_space[0]) return 0; - fp = IO_SPACE_PORT(fp); - lp = IO_SPACE_PORT(lp); + fmp = IO_SPACE_PORT(fmp); + lmp = IO_SPACE_PORT(lmp); if (space->sparse) { - mmio_start = IO_SPACE_SPARSE_ENCODING(fp) & PAGE_MASK; - mmio_end = PAGE_ALIGN(IO_SPACE_SPARSE_ENCODING(lp)); + mach_start = IO_SPACE_SPARSE_ENCODING(fmp) & PAGE_MASK; + mach_end = PAGE_ALIGN(IO_SPACE_SPARSE_ENCODING(lmp)); } else { - mmio_start = fp & PAGE_MASK; - mmio_end = PAGE_ALIGN(lp); + mach_start = fmp & PAGE_MASK; + mach_end = PAGE_ALIGN(lmp); } /* * The "machine first port" is not necessarily identity mapped * to the guest first port. At least for the legacy range. */ - mach_start = mmio_start | __pa(space->mmio_base); - - if (space == &io_space[0]) { + mach_start = mach_start | __pa(space->mmio_base); + mach_end = mach_end | __pa(space->mmio_base); + + mmio_start = IO_SPACE_SPARSE_ENCODING(fgp) & PAGE_MASK; + + if (VMX_DOMAIN(d->vcpu[0])) + mmio_start |= LEGACY_IO_START; + else if (space == &io_space[0]) mmio_start |= IO_PORTS_PADDR; - mmio_end |= IO_PORTS_PADDR; - } else { + else mmio_start |= __pa(space->mmio_base); - mmio_end |= __pa(space->mmio_base); - } - - while (mmio_start <= mmio_end) { + + while (mach_start < mach_end) { (void)__assign_domain_page(d, mmio_start, mach_start, ASSIGN_nocache); mmio_start += PAGE_SIZE; mach_start += PAGE_SIZE; @@ -1089,7 +1098,9 @@ ioports_deny_access(struct domain *d, un mmio_end = PAGE_ALIGN(lp_base); } - if (space == &io_space[0] && d != dom0) + if (VMX_DOMAIN(d->vcpu[0])) + mmio_base = LEGACY_IO_START; + else if (space == &io_space[0] && d != dom0) mmio_base = IO_PORTS_PADDR; else mmio_base = __pa(space->mmio_base); diff -r 7db30bf36b0e -r f27787b9f8d7 xen/include/asm-ia64/iocap.h --- a/xen/include/asm-ia64/iocap.h Fri Oct 17 15:33:03 2008 +0900 +++ b/xen/include/asm-ia64/iocap.h Fri Oct 17 17:40:15 2008 +0900 @@ -7,7 +7,7 @@ #ifndef __IA64_IOCAP_H__ #define __IA64_IOCAP_H__ -extern int ioports_permit_access(struct domain *d, +extern int ioports_permit_access(struct domain *d, unsigned int gs, unsigned int s, unsigned int e); extern int ioports_deny_access(struct domain *d, unsigned int s, unsigned int e); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |