# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Node ID dc23c3042cdfa38c37ca60128eb13fb54973b739 # Parent 81bc9e9fb40ddd5c4366da8f7b667363005b1f92 make grant table map/unmap argument, host_addr, arch-apecific. introduce an arch-specific macro virt_to_host_addr(). diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Mon Apr 10 19:18:19 2006 +0900 @@ -186,7 +186,7 @@ static void fast_flush_area(pending_req_ handle = pending_handle(req, i); if (handle == BLKBACK_INVALID_HANDLE) continue; - unmap[invcount].host_addr = vaddr(req, i); + unmap[invcount].host_addr = virt_to_host_addr(vaddr(req, i)); unmap[invcount].dev_bus_addr = 0; unmap[invcount].handle = handle; pending_handle(req, i) = BLKBACK_INVALID_HANDLE; @@ -392,7 +392,7 @@ static void dispatch_rw_block_io(blkif_t goto fail_response; preq.nr_sects += seg[i].nsec; - map[i].host_addr = vaddr(pending_req, i); + map[i].host_addr = virt_to_host_addr(vaddr(pending_req, i)); map[i].dom = blkif->domid; map[i].ref = req->seg[i].gref; map[i].flags = GNTMAP_host_map; diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/drivers/xen/blkback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Mon Apr 10 19:18:19 2006 +0900 @@ -58,7 +58,7 @@ static int map_frontend_page(blkif_t *bl struct gnttab_map_grant_ref op; int ret; - op.host_addr = (unsigned long)blkif->blk_ring_area->addr; + op.host_addr = virt_to_host_addr((unsigned long)blkif->blk_ring_area->addr); op.flags = GNTMAP_host_map; op.ref = shared_page; op.dom = blkif->domid; @@ -90,7 +90,7 @@ static void unmap_frontend_page(blkif_t struct gnttab_unmap_grant_ref op; int ret; - op.host_addr = (unsigned long)blkif->blk_ring_area->addr; + op.host_addr = virt_to_host_addr((unsigned long)blkif->blk_ring_area->addr); op.handle = blkif->shmem_handle; op.dev_bus_addr = 0; diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c Mon Apr 10 19:18:19 2006 +0900 @@ -418,7 +418,7 @@ static void fast_flush_area(int idx, int if (BLKTAP_INVALID_HANDLE(handle)) continue; - unmap[op].host_addr = MMAP_VADDR(mmap_vstart, idx, i); + unmap[op].host_addr = virt_to_host_addr(MMAP_VADDR(mmap_vstart, idx, i)); unmap[op].dev_bus_addr = 0; unmap[op].handle = handle->kernel; op++; @@ -430,7 +430,7 @@ static void fast_flush_area(int idx, int DPRINTK("Couldn't get a pte addr!\n"); return; } - unmap[op].host_addr = ptep; + unmap[op].host_addr = virt_to_host_addr(ptep); unmap[op].dev_bus_addr = 0; unmap[op].handle = handle->user; op++; @@ -708,7 +708,7 @@ static void dispatch_rw_block_io(blkif_t kvaddr = MMAP_VADDR(mmap_vstart, pending_idx, i); /* Map the remote page to kernel. */ - map[op].host_addr = kvaddr; + map[op].host_addr = virt_to_host_addr(kvaddr); map[op].dom = blkif->domid; map[op].ref = req->seg[i].gref; map[op].flags = GNTMAP_host_map; @@ -728,7 +728,7 @@ static void dispatch_rw_block_io(blkif_t goto bad_descriptor; } - map[op].host_addr = ptep; + map[op].host_addr = virt_to_host_addr(ptep); map[op].dom = blkif->domid; map[op].ref = req->seg[i].gref; map[op].flags = GNTMAP_host_map | GNTMAP_application_map diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/drivers/xen/blktap/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/blktap/interface.c Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/interface.c Mon Apr 10 19:18:19 2006 +0900 @@ -33,7 +33,7 @@ static int map_frontend_page(blkif_t *bl struct gnttab_map_grant_ref op; int ret; - op.host_addr = (unsigned long)blkif->blk_ring_area->addr; + op.host_addr = virt_to_host_addr((unsigned long)blkif->blk_ring_area->addr); op.flags = GNTMAP_host_map; op.ref = shared_page; op.dom = blkif->domid; @@ -59,7 +59,7 @@ static void unmap_frontend_page(blkif_t struct gnttab_unmap_grant_ref op; int ret; - op.host_addr = (unsigned long)blkif->blk_ring_area->addr; + op.host_addr = virt_to_host_addr((unsigned long)blkif->blk_ring_area->addr); op.handle = blkif->shmem_handle; op.dev_bus_addr = 0; diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/drivers/xen/netback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Mon Apr 10 19:18:19 2006 +0900 @@ -150,7 +150,7 @@ static int map_frontend_pages( struct gnttab_map_grant_ref op; int ret; - op.host_addr = (unsigned long)netif->tx_comms_area->addr; + op.host_addr = virt_to_host_addr((unsigned long)netif->tx_comms_area->addr); op.flags = GNTMAP_host_map; op.ref = tx_ring_ref; op.dom = netif->domid; @@ -168,7 +168,7 @@ static int map_frontend_pages( netif->tx_shmem_ref = tx_ring_ref; netif->tx_shmem_handle = op.handle; - op.host_addr = (unsigned long)netif->rx_comms_area->addr; + op.host_addr = virt_to_host_addr((unsigned long)netif->rx_comms_area->addr); op.flags = GNTMAP_host_map; op.ref = rx_ring_ref; op.dom = netif->domid; @@ -194,7 +194,7 @@ static void unmap_frontend_pages(netif_t struct gnttab_unmap_grant_ref op; int ret; - op.host_addr = (unsigned long)netif->tx_comms_area->addr; + op.host_addr = virt_to_host_addr((unsigned long)netif->tx_comms_area->addr); op.handle = netif->tx_shmem_handle; op.dev_bus_addr = 0; @@ -203,7 +203,7 @@ static void unmap_frontend_pages(netif_t unlock_vm_area(netif->tx_comms_area); BUG_ON(ret); - op.host_addr = (unsigned long)netif->rx_comms_area->addr; + op.host_addr = virt_to_host_addr((unsigned long)netif->rx_comms_area->addr); op.handle = netif->rx_shmem_handle; op.dev_bus_addr = 0; diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/drivers/xen/netback/netback.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Mon Apr 10 19:18:19 2006 +0900 @@ -453,7 +453,7 @@ inline static void net_tx_action_dealloc gop = tx_unmap_ops; while (dc != dp) { pending_idx = dealloc_ring[MASK_PEND_IDX(dc++)]; - gop->host_addr = MMAP_VADDR(pending_idx); + gop->host_addr = virt_to_host_addr(MMAP_VADDR(pending_idx)); gop->dev_bus_addr = 0; gop->handle = grant_tx_handle[pending_idx]; gop++; @@ -579,7 +579,7 @@ static void net_tx_action(unsigned long /* Packets passed to netif_rx() must have some headroom. */ skb_reserve(skb, 16); - mop->host_addr = MMAP_VADDR(pending_idx); + mop->host_addr = virt_to_host_addr(MMAP_VADDR(pending_idx)); mop->dom = netif->domid; mop->ref = txreq.gref; mop->flags = GNTMAP_host_map | GNTMAP_readonly; diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c Mon Apr 10 19:18:19 2006 +0900 @@ -73,7 +73,7 @@ static int map_frontend_page(tpmif_t *tp { int ret; struct gnttab_map_grant_ref op = { - .host_addr = (unsigned long)tpmif->tx_area->addr, + .host_addr = virt_to_host_addr((unsigned long)tpmif->tx_area->addr), .flags = GNTMAP_host_map, .ref = shared_page, .dom = tpmif->domid, @@ -100,7 +100,7 @@ static void unmap_frontend_page(tpmif_t struct gnttab_unmap_grant_ref op; int ret; - op.host_addr = (unsigned long)tpmif->tx_area->addr; + op.host_addr = virt_to_host_addr((unsigned long)tpmif->tx_area->addr); op.handle = tpmif->shmem_handle; op.dev_bus_addr = 0; diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c Mon Apr 10 19:18:19 2006 +0900 @@ -278,7 +278,7 @@ int _packet_write(struct packet *pak, return 0; } - map_op.host_addr = MMAP_VADDR(tpmif, i); + map_op.host_addr = virt_to_host_addr(MMAP_VADDR(tpmif, i)); map_op.flags = GNTMAP_host_map; map_op.ref = tx->ref; map_op.dom = tpmif->domid; @@ -308,7 +308,7 @@ int _packet_write(struct packet *pak, } tx->size = tocopy; - unmap_op.host_addr = MMAP_VADDR(tpmif, i); + unmap_op.host_addr = virt_to_host_addr(MMAP_VADDR(tpmif, i)); unmap_op.handle = handle; unmap_op.dev_bus_addr = 0; @@ -422,7 +422,7 @@ static int packet_read_shmem(struct pack tx = &tpmif->tx->ring[i].req; - map_op.host_addr = MMAP_VADDR(tpmif, i); + map_op.host_addr = virt_to_host_addr(MMAP_VADDR(tpmif, i)); map_op.flags = GNTMAP_host_map; map_op.ref = tx->ref; map_op.dom = tpmif->domid; @@ -461,7 +461,7 @@ static int packet_read_shmem(struct pack tpmif->domid, buffer[offset], buffer[offset + 1], buffer[offset + 2], buffer[offset + 3]); - unmap_op.host_addr = MMAP_VADDR(tpmif, i); + unmap_op.host_addr = virt_to_host_addr(MMAP_VADDR(tpmif, i)); unmap_op.handle = handle; unmap_op.dev_bus_addr = 0; diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c Mon Apr 10 19:18:19 2006 +0900 @@ -277,7 +277,7 @@ int xenbus_map_ring_valloc(struct xenbus if (!area) return -ENOMEM; - op.host_addr = (unsigned long)area->addr; + op.host_addr = virt_to_host_addr((unsigned long)area->addr); lock_vm_area(area); BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1)); @@ -304,7 +304,7 @@ int xenbus_map_ring(struct xenbus_device grant_handle_t *handle, void *vaddr) { struct gnttab_map_grant_ref op = { - .host_addr = (unsigned long)vaddr, + .host_addr = virt_to_host_addr((unsigned long)vaddr), .flags = GNTMAP_host_map, .ref = gnt_ref, .dom = dev->otherend_id, @@ -329,7 +329,7 @@ int xenbus_unmap_ring_vfree(struct xenbu { struct vm_struct *area; struct gnttab_unmap_grant_ref op = { - .host_addr = (unsigned long)vaddr, + .host_addr = virt_to_host_addr((unsigned long)vaddr), }; /* It'd be nice if linux/vmalloc.h provided a find_vm_area(void *addr) @@ -373,7 +373,7 @@ int xenbus_unmap_ring(struct xenbus_devi grant_handle_t handle, void *vaddr) { struct gnttab_unmap_grant_ref op = { - .host_addr = (unsigned long)vaddr, + .host_addr = virt_to_host_addr((unsigned long)vaddr), .handle = handle, }; diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/page.h Mon Apr 10 19:18:19 2006 +0900 @@ -318,6 +318,9 @@ extern int page_is_ram(unsigned long pag #define virt_to_mfn(v) (pfn_to_mfn(__pa(v) >> PAGE_SHIFT)) #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) +/* virt <-> grant table host addr conversion */ +#define virt_to_host_addr(v) (v) + #define __HAVE_ARCH_GATE_AREA 1 #endif /* __KERNEL__ */ diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/include/asm-ia64/hypercall.h --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Mon Apr 10 19:18:19 2006 +0900 @@ -43,6 +43,8 @@ #define machine_to_virt(m) __va(m) #define virt_to_mfn(v) ((__pa(v)) >> PAGE_SHIFT) #define mfn_to_virt(m) (__va((m) << PAGE_SHIFT)) +/* virt <-> grant table host addr conversion */ +#define virt_to_host_addr(v) (v) /* * Assembler stubs for hyper-calls. diff -r 81bc9e9fb40d -r dc23c3042cdf linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h Sun Apr 9 18:23:16 2006 +0100 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/page.h Mon Apr 10 19:18:19 2006 +0900 @@ -305,6 +305,9 @@ static inline pgd_t __pgd(unsigned long #define virt_to_mfn(v) (pfn_to_mfn(__pa(v) >> PAGE_SHIFT)) #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) +/* virt <-> grant table host addr conversion */ +#define virt_to_host_addr(v) (v) + #define VM_DATA_DEFAULT_FLAGS \ (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)