Skip to content

Commit

Permalink
xen: grant: use xen_pfn_t type for frame_list.
Browse files Browse the repository at this point in the history
This correctly sizes it as 64 bit on ARM but leaves it as unsigned
long on x86 (therefore no intended change on x86).

The long and ulong guest handles are now unused (and a bit dangerous)
so remove them.

Acked-by: Stefano Stabellini <[email protected]>
Signed-off-by: Ian Campbell <[email protected]>
Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
  • Loading branch information
Ian Campbell authored and konradwilk committed Oct 19, 2012
1 parent bf86ad8 commit ef32f89
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
2 changes: 0 additions & 2 deletions arch/arm/include/asm/xen/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ typedef uint64_t xen_ulong_t;
/* Guest handles for primitive C types. */
__DEFINE_GUEST_HANDLE(uchar, unsigned char);
__DEFINE_GUEST_HANDLE(uint, unsigned int);
__DEFINE_GUEST_HANDLE(ulong, unsigned long);
DEFINE_GUEST_HANDLE(char);
DEFINE_GUEST_HANDLE(int);
DEFINE_GUEST_HANDLE(long);
DEFINE_GUEST_HANDLE(void);
DEFINE_GUEST_HANDLE(uint64_t);
DEFINE_GUEST_HANDLE(uint32_t);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/xen/grant-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <xen/page.h>
#include <xen/grant_table.h>

int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes,
unsigned long max_nr_gframes,
void **__shared)
{
Expand Down
2 changes: 0 additions & 2 deletions arch/x86/include/asm/xen/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ typedef unsigned long xen_ulong_t;
/* Guest handles for primitive C types. */
__DEFINE_GUEST_HANDLE(uchar, unsigned char);
__DEFINE_GUEST_HANDLE(uint, unsigned int);
__DEFINE_GUEST_HANDLE(ulong, unsigned long);
DEFINE_GUEST_HANDLE(char);
DEFINE_GUEST_HANDLE(int);
DEFINE_GUEST_HANDLE(long);
DEFINE_GUEST_HANDLE(void);
DEFINE_GUEST_HANDLE(uint64_t);
DEFINE_GUEST_HANDLE(uint32_t);
Expand Down
8 changes: 4 additions & 4 deletions drivers/xen/grant-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct gnttab_ops {
* nr_gframes is the number of frames to map grant table. Returning
* GNTST_okay means success and negative value means failure.
*/
int (*map_frames)(unsigned long *frames, unsigned int nr_gframes);
int (*map_frames)(xen_pfn_t *frames, unsigned int nr_gframes);
/*
* Release a list of frames which are mapped in map_frames for grant
* entry status.
Expand Down Expand Up @@ -958,7 +958,7 @@ static unsigned nr_status_frames(unsigned nr_grant_frames)
return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP;
}

static int gnttab_map_frames_v1(unsigned long *frames, unsigned int nr_gframes)
static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes)
{
int rc;

Expand All @@ -975,7 +975,7 @@ static void gnttab_unmap_frames_v1(void)
arch_gnttab_unmap(gnttab_shared.addr, nr_grant_frames);
}

static int gnttab_map_frames_v2(unsigned long *frames, unsigned int nr_gframes)
static int gnttab_map_frames_v2(xen_pfn_t *frames, unsigned int nr_gframes)
{
uint64_t *sframes;
unsigned int nr_sframes;
Expand Down Expand Up @@ -1027,7 +1027,7 @@ static void gnttab_unmap_frames_v2(void)
static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
{
struct gnttab_setup_table setup;
unsigned long *frames;
xen_pfn_t *frames;
unsigned int nr_gframes = end_idx + 1;
int rc;

Expand Down
2 changes: 1 addition & 1 deletion include/xen/grant_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
unmap->dev_bus_addr = 0;
}

int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes,
unsigned long max_nr_gframes,
void **__shared);
int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
Expand Down
2 changes: 1 addition & 1 deletion include/xen/interface/grant_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ struct gnttab_setup_table {
uint32_t nr_frames;
/* OUT parameters. */
int16_t status; /* GNTST_* */
GUEST_HANDLE(ulong) frame_list;
GUEST_HANDLE(xen_pfn_t) frame_list;
};
DEFINE_GUEST_HANDLE_STRUCT(gnttab_setup_table);

Expand Down

0 comments on commit ef32f89

Please sign in to comment.