Commit 47c54205 authored by Julien Grall's avatar Julien Grall Committed by Stefano Stabellini

xen/gnttab: Use phys_addr_t to describe the grant frame base address

On ARM, address size can be 32 bits or 64 bits (if CONFIG_ARCH_PHYS_ADDR_T_64BIT
is enabled).
We can't assume that the grant frame base address will always fits in an
unsigned long. Use phys_addr_t instead of unsigned long as argument for
gnttab_setup_auto_xlat_frames.
Signed-off-by: default avatarJulien Grall <julien.grall@linaro.org>
Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: default avatarIan Campbell <ian.campbell@citrix.com>
Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
parent e17b2f11
...@@ -234,7 +234,7 @@ static int __init xen_guest_init(void) ...@@ -234,7 +234,7 @@ static int __init xen_guest_init(void)
const char *version = NULL; const char *version = NULL;
const char *xen_prefix = "xen,xen-"; const char *xen_prefix = "xen,xen-";
struct resource res; struct resource res;
unsigned long grant_frames; phys_addr_t grant_frames;
node = of_find_compatible_node(NULL, NULL, "xen,xen"); node = of_find_compatible_node(NULL, NULL, "xen,xen");
if (!node) { if (!node) {
...@@ -253,8 +253,8 @@ static int __init xen_guest_init(void) ...@@ -253,8 +253,8 @@ static int __init xen_guest_init(void)
return 0; return 0;
grant_frames = res.start; grant_frames = res.start;
xen_events_irq = irq_of_parse_and_map(node, 0); xen_events_irq = irq_of_parse_and_map(node, 0);
pr_info("Xen %s support found, events_irq=%d gnttab_frame_pfn=%lx\n", pr_info("Xen %s support found, events_irq=%d gnttab_frame=%pa\n",
version, xen_events_irq, (grant_frames >> PAGE_SHIFT)); version, xen_events_irq, &grant_frames);
if (xen_events_irq < 0) if (xen_events_irq < 0)
return -ENODEV; return -ENODEV;
......
...@@ -837,7 +837,7 @@ unsigned int gnttab_max_grant_frames(void) ...@@ -837,7 +837,7 @@ unsigned int gnttab_max_grant_frames(void)
} }
EXPORT_SYMBOL_GPL(gnttab_max_grant_frames); EXPORT_SYMBOL_GPL(gnttab_max_grant_frames);
int gnttab_setup_auto_xlat_frames(unsigned long addr) int gnttab_setup_auto_xlat_frames(phys_addr_t addr)
{ {
xen_pfn_t *pfn; xen_pfn_t *pfn;
unsigned int max_nr_gframes = __max_nr_grant_frames(); unsigned int max_nr_gframes = __max_nr_grant_frames();
...@@ -849,8 +849,8 @@ int gnttab_setup_auto_xlat_frames(unsigned long addr) ...@@ -849,8 +849,8 @@ int gnttab_setup_auto_xlat_frames(unsigned long addr)
vaddr = xen_remap(addr, PAGE_SIZE * max_nr_gframes); vaddr = xen_remap(addr, PAGE_SIZE * max_nr_gframes);
if (vaddr == NULL) { if (vaddr == NULL) {
pr_warn("Failed to ioremap gnttab share frames (addr=0x%08lx)!\n", pr_warn("Failed to ioremap gnttab share frames (addr=%pa)!\n",
addr); &addr);
return -ENOMEM; return -ENOMEM;
} }
pfn = kcalloc(max_nr_gframes, sizeof(pfn[0]), GFP_KERNEL); pfn = kcalloc(max_nr_gframes, sizeof(pfn[0]), GFP_KERNEL);
......
...@@ -185,7 +185,7 @@ struct grant_frames { ...@@ -185,7 +185,7 @@ struct grant_frames {
}; };
extern struct grant_frames xen_auto_xlat_grant_frames; extern struct grant_frames xen_auto_xlat_grant_frames;
unsigned int gnttab_max_grant_frames(void); unsigned int gnttab_max_grant_frames(void);
int gnttab_setup_auto_xlat_frames(unsigned long addr); int gnttab_setup_auto_xlat_frames(phys_addr_t addr);
void gnttab_free_auto_xlat_frames(void); void gnttab_free_auto_xlat_frames(void);
#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment