aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Grall <julien.grall@citrix.com>2015-05-05 11:37:49 -0400
committerDavid Vrabel <david.vrabel@citrix.com>2015-10-23 09:20:39 -0400
commit5ed5451d997f7a86c62a5557efc00dc3836dc559 (patch)
treebd75362553a4f57a9d6b38ae3ad73bdeed16856f
parenta001c9d95c4ea96589461d58e77c96416a303e2c (diff)
xen/grant-table: Make it running on 64KB granularity
The Xen interface is using 4KB page granularity. This means that each grant is 4KB. The current implementation allocates a Linux page per grant. On Linux using 64KB page granularity, only the first 4KB of the page will be used. We could decrease the memory wasted by sharing the page with multiple grant. It will require some care with the {Set,Clear}ForeignPage macro. Note that no changes has been made in the x86 code because both Linux and Xen will only use 4KB page granularity. Signed-off-by: Julien Grall <julien.grall@citrix.com> Reviewed-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
-rw-r--r--arch/arm/xen/p2m.c6
-rw-r--r--drivers/xen/grant-table.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
index 887596c67b12..0ed01f2d5ee4 100644
--- a/arch/arm/xen/p2m.c
+++ b/arch/arm/xen/p2m.c
@@ -93,8 +93,8 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
93 for (i = 0; i < count; i++) { 93 for (i = 0; i < count; i++) {
94 if (map_ops[i].status) 94 if (map_ops[i].status)
95 continue; 95 continue;
96 set_phys_to_machine(map_ops[i].host_addr >> PAGE_SHIFT, 96 set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT,
97 map_ops[i].dev_bus_addr >> PAGE_SHIFT); 97 map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT);
98 } 98 }
99 99
100 return 0; 100 return 0;
@@ -108,7 +108,7 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
108 int i; 108 int i;
109 109
110 for (i = 0; i < count; i++) { 110 for (i = 0; i < count; i++) {
111 set_phys_to_machine(unmap_ops[i].host_addr >> PAGE_SHIFT, 111 set_phys_to_machine(unmap_ops[i].host_addr >> XEN_PAGE_SHIFT,
112 INVALID_P2M_ENTRY); 112 INVALID_P2M_ENTRY);
113 } 113 }
114 114
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index dbeaa67dec47..72d633962095 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -642,7 +642,7 @@ int gnttab_setup_auto_xlat_frames(phys_addr_t addr)
642 if (xen_auto_xlat_grant_frames.count) 642 if (xen_auto_xlat_grant_frames.count)
643 return -EINVAL; 643 return -EINVAL;
644 644
645 vaddr = xen_remap(addr, PAGE_SIZE * max_nr_gframes); 645 vaddr = xen_remap(addr, XEN_PAGE_SIZE * max_nr_gframes);
646 if (vaddr == NULL) { 646 if (vaddr == NULL) {
647 pr_warn("Failed to ioremap gnttab share frames (addr=%pa)!\n", 647 pr_warn("Failed to ioremap gnttab share frames (addr=%pa)!\n",
648 &addr); 648 &addr);
@@ -654,7 +654,7 @@ int gnttab_setup_auto_xlat_frames(phys_addr_t addr)
654 return -ENOMEM; 654 return -ENOMEM;
655 } 655 }
656 for (i = 0; i < max_nr_gframes; i++) 656 for (i = 0; i < max_nr_gframes; i++)
657 pfn[i] = PFN_DOWN(addr) + i; 657 pfn[i] = XEN_PFN_DOWN(addr) + i;
658 658
659 xen_auto_xlat_grant_frames.vaddr = vaddr; 659 xen_auto_xlat_grant_frames.vaddr = vaddr;
660 xen_auto_xlat_grant_frames.pfn = pfn; 660 xen_auto_xlat_grant_frames.pfn = pfn;
@@ -1004,7 +1004,7 @@ static void gnttab_request_version(void)
1004{ 1004{
1005 /* Only version 1 is used, which will always be available. */ 1005 /* Only version 1 is used, which will always be available. */
1006 grant_table_version = 1; 1006 grant_table_version = 1;
1007 grefs_per_grant_frame = PAGE_SIZE / sizeof(struct grant_entry_v1); 1007 grefs_per_grant_frame = XEN_PAGE_SIZE / sizeof(struct grant_entry_v1);
1008 gnttab_interface = &gnttab_v1_ops; 1008 gnttab_interface = &gnttab_v1_ops;
1009 1009
1010 pr_info("Grant tables using version %d layout\n", grant_table_version); 1010 pr_info("Grant tables using version %d layout\n", grant_table_version);