64 bit ARM ABI, map foreign gmfn API, ARM grant tables
v2 cover 64 bit ARM ABI, map foreign gmfn API, ARM grant tables
This is v2 of "Sweep through arm-for-4.3 branch + a bit extra" retitled since most of the sweep through stuff has been swept through already and just the bit extra remains.
I've addressed the review comments and fixed the bisection issue. A bunch of this stuff is cross arch and/or touches common code.
The Linux side of the 64 bit ARM ABI changes are in mainline Linux already (just a few tweaks and cleanups remain).
xen: arm: implement XENMEM_add_to_physmap_range
New hypercall intended for use by both ARM (Linux patches exist) and x86 PVH (TBD)
xen/arm: grant table
Simple wiring up job. Acked but depends on XENMEM_add_to_physmap_range.
arm: tools: add arm to foreign structs checking
Fixes native tools build on ARM
xen: xen_ulong_t substitution
xen: change the limit of nr_extents to UINT_MAX >> MEMOP_EXTENT_SHIFT
xen: introduce XEN_GUEST_HANDLE_PARAM
xen: replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when appropriate
xen: more XEN_GUEST_HANDLE_PARAM substitutions
xen: remove XEN_GUEST_HANDLE(ulong)
arm: parameter guest handles are 32 bit on 32 bit hypervisor
These are the ARM 64 bit API, mostly from Stefano and posted several times already.
Ian.
PATCH v2 1/10 xen: arm: implement XENMEM_add_to_physmap_range
This allows for foreign mappings as well as batching, fitting all that into XENMEM_add_to_physmap wasn't possible.
--- xen/arch/arm/mm.c | 120 ++++++++++++++++++++++++++++++++++++++----- xen/include/public/memory.h | 40 +++++++++++--- xen/include/public/xen.h | 1 + 3 files changed, 139 insertions(+), 22 deletions(-)
xen/arch/arm/mm.c +106 -14
@@ -25,6 +25,8 @@#include <xen/mm.h> #include <xen/preempt.h> #include <xen/errno.h> +#include <xen/softirq.h> +#include <xen/event.h> #include <xen/guest_access.h> #include <xen/domain_page.h> #include <asm/page.h>
@@ -459,37 +461,96 @@ void share_xen_page_with_guest(struct page_info *page,spin_unlock (&d->page_alloc_lock); } -static int xenmem_add_to_physmap_once ( +static int xenmem_add_to_physmap_one (struct domain *d, -const struct xen_add_to_physmap *xatp) +uint16_t space, +domid_t foreign_domid, +unsigned long idx, +xen_pfn_t gpfn) {unsigned long mfn =0 ;int rc; -switch ( xatp->space ) +switch ( space ) { -case XENMAPSPACE_shared_info: -if ( xatp->idx ==0 ) - mfn =virt_to_mfn (d->shared_info); -break ; -default : -return -ENOSYS ; +case XENMAPSPACE_shared_info: +if ( idx ==0 ) + mfn =virt_to_mfn (d->shared_info); +break ; +case XENMAPSPACE_gmfn_foreign: + { +paddr_t maddr; +struct domain *od; + rc =rcu_lock_target_domain_by_id (foreign_domid, &od); +if ( rc <0 ) +return rc; + + maddr =p2m_lookup (od, idx <<PAGE_SHIFT ); +if ( maddr ==INVALID_PADDR ) + { +dump_p2m_lookup (od, idx <<PAGE_SHIFT ); +rcu_unlock_domain (od); +return -EINVAL ; + } + + mfn = maddr >>PAGE_SHIFT ; + +rcu_unlock_domain (od); +break ; + } + +default : +return -ENOSYS ; }domain_lock (d);/* Map at new location. */ - rc =guest_physmap_add_page (d, xatp->gpfn, mfn,0 ); + rc =guest_physmap_add_page (d, gpfn, mfn,0 );domain_unlock (d);return rc; } -static int xenmem_add_to_physmap (struct domain *d, -struct xen_add_to_physmap *xatp) +static int xenmem_add_to_physmap_range (struct domain *d, +struct xen_add_to_physmap_range *xatpr) { -return xenmem_add_to_physmap_once (d, xatp); +int rc; + +/* Process entries in reverse order to allow continuations */ +while ( xatpr->size >0 ) + { +xen_ulong_t idx; +xen_pfn_t gpfn; + + rc =copy_from_guest_offset (&idx, xatpr->idxs, xatpr->size-1 ,1 ); +if ( rc <0 ) + goto out; + + rc =copy_from_guest_offset (&gpfn, xatpr->gpfns, xatpr->size-1 ,1 ); +if ( rc <0 ) + goto out; + + rc =xenmem_add_to_physmap_one (d, xatpr->space, + xatpr->foreign_domid, + idx, gpfn); + + xatpr->size--; + +/* Check for continuation if it's not the last interation */ +if ( xatpr->size >0 &&hypercall_preempt_check () ) + { + rc = -EAGAIN ; + goto out; + } + } + + rc =0 ; + +out: +return rc; + }long arch_memory_op (int op,XEN_GUEST_HANDLE (void ) arg)
@@ -506,14 +567,45 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)if (copy_from_guest (&xatp, arg,1 ) )return -EFAULT ; +/* This one is only supported by add_to_physmap_range */ +if ( xatp.space == XENMAPSPACE_gmfn_foreign ) +return -EINVAL ; + rc =rcu_lock_target_domain_by_id (xatp.domid, &d);if ( rc !=0 )return rc; - rc =xenmem_add_to_physmap (d, &xatp); + rc =xenmem_add_to_physmap_one (d, xatp.space,DOMID_INVALID , + xatp.idx, xatp.gpfn); + +rcu_unlock_domain (d); + +return rc; + } + +case XENMEM_add_to_physmap_range: + { +struct xen_add_to_physmap_range xatpr; +struct domain *d; + +if (copy_from_guest (&xatpr, arg,1 ) ) +return -EFAULT ; + + rc =rcu_lock_target_domain_by_id (xatpr.domid, &d); +if ( rc !=0 ) +return rc; + + rc =xenmem_add_to_physmap_range (d, &xatpr);rcu_unlock_domain (d); +if ( rc &©_to_guest (arg, &xatpr,1 ) ) + rc = -EFAULT ; + +if ( rc == -EAGAIN ) + rc =hypercall_create_continuation ( + __HYPERVISOR_memory_op,"ih" , op, arg); +return rc; }
xen/include/public/memory.h +32 -8
@@ -198,6 +198,15 @@ struct xen_machphys_mapping {typedef struct xen_machphys_mapping xen_machphys_mapping_t ;DEFINE_XEN_GUEST_HANDLE (xen_machphys_mapping_t); +/* Source mapping space. */ +/* ` enum phys_map_space { */ +#define XENMAPSPACE_shared_info 0/* shared info page */ +#define XENMAPSPACE_grant_table 1/* grant table page */ +#define XENMAPSPACE_gmfn 2/* GMFN */ +#define XENMAPSPACE_gmfn_range 3/* GMFN range */ +#define XENMAPSPACE_gmfn_foreign 4/* GMFN from another dom */ +/* ` } */ +/* * Sets the GPFN at which a particular page appears in the specified guest's * pseudophysical address space.
@@ -211,24 +220,39 @@ struct xen_add_to_physmap {/* Number of pages to go through for gmfn_range */ uint16_t size; -/* Source mapping space. */ -#define XENMAPSPACE_shared_info 0/* shared info page */ -#define XENMAPSPACE_grant_table 1/* grant table page */ -#define XENMAPSPACE_gmfn 2/* GMFN */ -#define XENMAPSPACE_gmfn_range 3/* GMFN range */ -unsigned int space; +unsigned int space;/* => enum phys_map_space */ #define XENMAPIDX_grant_table_status 0x80000000 -/* Index into source mapping space. */ +/* Index into space being mapped. */ xen_ulong_t idx; -/* GPFN where the source mapping page should appear. */ +/* GPFN in domid where the source mapping page should appear. */ xen_pfn_t gpfn; };typedef struct xen_add_to_physmap xen_add_to_physmap_t ;DEFINE_XEN_GUEST_HANDLE (xen_add_to_physmap_t); +/* A batched version of add_to_physmap. */ +#define XENMEM_add_to_physmap_range 23 +struct xen_add_to_physmap_range { +/* Which domain to change the mapping for. */ +domid_t domid; +uint16_t space;/* => enum phys_map_space */ + +/* Number of pages to go through */ +uint16_t size; +domid_t foreign_domid;/* IFF gmfn_foreign */ + +/* Indexes into space being mapped. */ +XEN_GUEST_HANDLE (xen_ulong_t) idxs; + +/* GPFN in domdwhere the source mapping page should appear. */ +XEN_GUEST_HANDLE (xen_pfn_t) gpfns; +}; +typedef struct xen_add_to_physmap_range xen_add_to_physmap_range_t ; +DEFINE_XEN_GUEST_HANDLE (xen_add_to_physmap_range_t); +/* * Unmaps the page appearing at a particular GPFN from the specified guest's * pseudophysical address space.
xen/include/public/xen.h +1 -0
@@ -49,6 +49,7 @@ DEFINE_XEN_GUEST_HANDLE(void);DEFINE_XEN_GUEST_HANDLE (uint64_t);DEFINE_XEN_GUEST_HANDLE (xen_pfn_t); +DEFINE_XEN_GUEST_HANDLE (xen_ulong_t);#endif /*
Signature · 1 line
1.7.9.1
Re: [PATCH 01/10] xen: arm: implement XENMEM_add_to_physmap_range
xen/include/public/memory.h struct xen_machphys_mapping { · line 202
Quoted 10 lines · Ian Campbell
xen/include/public/memory.h +2
-0@@ -198,6 +198,15 @@ struct xen_machphys_mapping {typedef struct xen_machphys_mapping xen_machphys_mapping_t ;DEFINE_XEN_GUEST_HANDLE (xen_machphys_mapping_t); +/* Source mapping space. */ +/* ` enum phys_map_space { */
I don't think that these comments about the enum add any value.
In any case the patch is simple and seems correct so:
Re: [PATCH 01/10] xen: arm: implement XENMEM_add_to_physmap_range
Quoted 9 lines · Stefano Stabellini
Quoted 8 lines · Ian Campbell
xen/include/public/memory.h +0
-0@@ -198,6 +198,15 @@ struct xen_machphys_mapping {typedef struct xen_machphys_mapping xen_machphys_mapping_t ;DEFINE_XEN_GUEST_HANDLE (xen_machphys_mapping_t);
Quoted 4 lines
xen/include/public/memory.h struct xen_machphys_mapping { · line 202
Quoted 2 lines
xen/include/public/memory.h +2
-0+/* Source mapping space. */ +/* ` enum phys_map_space { */ I don't think that these comments about the enum add any value.
They are part of the infrastructure which generates useful symlinks and cross references in http://xenbits.xen.org/docs.
Quoted 4 lines
In any case the patch is simple and seems correct so:
Thanks.
PATCH v2 2/10 xen/arm: grant table
In reply to Ian CampbellFrom: Stefano Stabellini <[email protected]>
Implement XENMAPSPACE_grant_table and grant_table_op.
[ ijc -- fixed reject in traps.c, grant table op is a 3 argument
hypercall, rebased over "xen: arm: implement XENMEM_add_to_physmap_range"
]
--- xen/arch/arm/mm.c | 26 ++++++++++++++++++++++++++ xen/arch/arm/traps.c | 1 + 2 files changed, 27 insertions(+), 0 deletions(-)
xen/arch/arm/mm.c +26 -0
@@ -25,6 +25,7 @@#include <xen/mm.h> #include <xen/preempt.h> #include <xen/errno.h> +#include <xen/grant_table.h> #include <xen/softirq.h> #include <xen/event.h> #include <xen/guest_access.h>
@@ -473,6 +474,31 @@ static int xenmem_add_to_physmap_one(switch ( space ) { +case XENMAPSPACE_grant_table: +spin_lock (&d->grant_table->lock); + +if ( d->grant_table->gt_version ==0 ) + d->grant_table->gt_version =1 ; + +if ( d->grant_table->gt_version ==2 && + (idx & XENMAPIDX_grant_table_status) ) + { + idx &= ~XENMAPIDX_grant_table_status; +if ( idx <nr_status_frames (d->grant_table) ) + mfn =virt_to_mfn (d->grant_table->status[idx]); + } +else + { +if ( (idx >=nr_grant_frames (d->grant_table)) && + (idx < max_nr_grant_frames) ) +gnttab_grow_table (d, idx +1 ); + +if ( idx <nr_grant_frames (d->grant_table) ) + mfn =virt_to_mfn (d->grant_table->shared_raw[idx]); + } + +spin_unlock (&d->grant_table->lock); +break ;case XENMAPSPACE_shared_info:if ( idx ==0 ) mfn =virt_to_mfn (d->shared_info);
xen/arch/arm/traps.c +1 -0
@@ -438,6 +438,7 @@ static arm_hypercall_t arm_hypercall_table[] = {HYPERCALL (physdev_op,2 ),HYPERCALL (sysctl,2 ),HYPERCALL (hvm_op,2 ), + HYPERCALL(grant_table_op, 3), };static void do_debug_trap (struct cpu_user_regs *regs,unsigned int code)
Signature · 1 line
1.7.9.1
PATCH v2 3/10 arm: tools: add arm to foreign structs checking
In reply to Ian Campbell--- tools/include/xen-foreign/Makefile | 5 ++++- tools/include/xen-foreign/mkheader.py | 7 +++++++ tools/include/xen-foreign/reference.size | 20 ++++++++++---------- tools/include/xen-foreign/structs.py | 7 ++++++- 4 files changed, 27 insertions(+), 12 deletions(-)
tools/include/xen-foreign/Makefile +4 -1
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk ROOT = $(XEN_ROOT)/xen/include/public -architectures := x86_32 x86_64 +architectures := arm x86_32 x86_64 headers := $(patsubst %, %.h, $(architectures)) .PHONY: all clean check-headers
@@ -22,6 +22,9 @@ check-headers: checker diff -u reference.size tmp.size rm tmp.size +arm.h: mkheader.py structs.py $(ROOT)/arch-arm.h + $(PYTHON) $< $* $@ $(filter %.h,$^) + x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h $(PYTHON) $< $* $@ $(filter %.h,$^)
tools/include/xen-foreign/mkheader.py +7 -0
@@ -16,6 +16,13 @@ inttypes = {}; header = {}; footer = {}; +#arm +inttypes["arm"] = { + "unsigned long" : "uint32_t", + "long" : "uint32_t", + "xen_pfn_t" : "uint64_t", +}; + # x86_32 inttypes["x86_32"] = { "unsigned long" : "uint32_t",
tools/include/xen-foreign/reference.size +10 -10
@@ -1,13 +1,13 @@ -structs | x86_32 x86_64 +structs | arm x86_32 x86_64 -start_info | 1112 1168 -trap_info | 8 16 -cpu_user_regs | 68 200 -vcpu_guest_context | 2800 5168 -arch_vcpu_info | 24 16 -vcpu_time_info | 32 32 -vcpu_info | 64 64 -arch_shared_info | 268 280 -shared_info | 2584 3368 +start_info | - 1112 1168 +trap_info | - 8 16 +cpu_user_regs | 160 68 200 +vcpu_guest_context | 180 2800 5168 +arch_vcpu_info | - 24 16 +vcpu_time_info | - 32 32 +vcpu_info | - 64 64 +arch_shared_info | - 268 280 +shared_info | - 2584 3368
tools/include/xen-foreign/structs.py +6 -1
@@ -13,9 +13,14 @@ structs = [ "start_info", "arch_shared_info", "shared_info" ]; -defines = [ "__i386__", +defines = [ "__arm__", + "__i386__", "__x86_64__", + # arm + # None + + # x86_{32,64} "FLAT_RING1_CS", "FLAT_RING1_DS", "FLAT_RING1_SS",
Signature · 1 line
1.7.9.1
PATCH v2 4/10 xen: xen_ulong_t substitution
In reply to Ian CampbellFrom: Stefano Stabellini <[email protected]>
There is still an unwanted unsigned long in the xen public interface:
replace it with xen_ulong_t.
Also typedef xen_ulong_t to uint64_t on ARM.
---
Changes in v2:
- do not replace the unsigned long in x86 specific calls;
- do not replace the unsigned long in multicall_entry;
- add missing include "xen.h" in version.h;
- use proper printf flag for xen_ulong_t.
--- tools/python/xen/lowlevel/xc/xc.c | 2 +- xen/include/public/arch-arm.h | 3 ++- xen/include/public/arch-x86/xen.h | 1 + xen/include/public/version.h | 4 +++- 4 files changed, 7 insertions(+), 3 deletions(-)
tools/python/xen/lowlevel/xc/xc.c +1 -1
@@ -1439,7 +1439,7 @@ static PyObject *pyxc_xeninfo(XcObject *self)if (xc_version (self->xc_handle, XENVER_commandline, &xen_commandline) !=0 )return pyxc_error_to_exception (self->xc_handle); -snprintf (str,sizeof (str),"virt_start=0x%lx" , p_parms.virt_start); +snprintf (str,sizeof (str),"virt_start=0x%" PRI_xen_ulong, p_parms.virt_start); xen_pagesize =xc_version (self->xc_handle, XENVER_pagesize,NULL );if (xen_pagesize <0 )
xen/include/public/arch-arm.h +2 -1
@@ -122,7 +122,8 @@ typedef uint64_t xen_pfn_t;/* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */ #define XEN_LEGACY_MAX_VCPUS 1 -typedef uint32_t xen_ulong_t ; +typedef uint64_t xen_ulong_t ; +#define PRI_xen_ulong PRIx64struct vcpu_guest_context {#define _VGCF_online 0
xen/include/public/arch-x86/xen.h +1 -0
@@ -85,6 +85,7 @@ typedef unsigned long xen_pfn_t;#ifndef __ASSEMBLY__typedef unsigned long xen_ulong_t ; +#define PRI_xen_ulong "lx"/* * ` enum neg_errnoval
xen/include/public/version.h +3 -1
@@ -28,6 +28,8 @@#ifndef __XEN_PUBLIC_VERSION_H__#define __XEN_PUBLIC_VERSION_H__ +#include "xen.h" +/* NB. All ops return zero on success, except XENVER_{version,pagesize} */ /* arg == NULL; returns major:minor (16:16). */
@@ -58,7 +60,7 @@ typedef char xen_changeset_info_t[64];#define XENVER_platform_parameters 5struct xen_platform_parameters { -unsigned long virt_start; +xen_ulong_t virt_start; };typedef struct xen_platform_parameters xen_platform_parameters_t ;
Signature · 1 line
1.7.9.1
PATCH v2 5/10 xen: change the limit of nr_extents to UINT_MAX >> MEMOP_EXTENT_SHIFT
In reply to Ian CampbellFrom: Stefano Stabellini <[email protected]>
Currently do_memory_op has a different maximum limit for nr_extents on 32 bit and 64 bit.
Change the limit to UINT_MAX >> MEMOP_EXTENT_SHIFT, so that it is the same in both cases.
--- xen/common/memory.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
xen/common/memory.c +1 -1
@@ -540,7 +540,7 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE(void) arg)return start_extent;/* Is size too large for us to encode a continuation? */ -if ( reservation.nr_extents > (ULONG_MAX >>MEMOP_EXTENT_SHIFT ) ) +if ( reservation.nr_extents > (UINT_MAX >>MEMOP_EXTENT_SHIFT ) )return start_extent;if (unlikely (start_extent >= reservation.nr_extents) )
Signature · 1 line
1.7.9.1
PATCH v2 6/10 xen: introduce XEN_GUEST_HANDLE_PARAM
In reply to Ian CampbellFrom: Stefano Stabellini <[email protected]>
XEN_GUEST_HANDLE_PARAM is going to be used to distinguish guest pointers stored in memory from guest pointers as hypercall parameters.
guest_handle_* macros default to XEN_GUEST_HANDLE_PARAM as return type. Two new guest_handle_to_param and guest_handle_from_param macros are introduced to do conversions.
---
Changes in v2:
- add 2 missing #define _XEN_GUEST_HANDLE_PARAM for the compilation of the compat code.
Changes in v3:
- move the guest_handle_cast change into this patch;
- add a clear comment on top of guest_handle_cast;
- also s/XEN_GUEST_HANDLE/XEN_GUEST_HANDLE_PARAM in guest_handle_from_ptr and const_guest_handle_from_ptr;
- introduce guest_handle_from_param and guest_handle_to_param.
Changes in v4:
- make both XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM unions on ARM;
- simplify set_xen_guest_handle_raw on ARM;
- add type checking in guest_handle_to_param and guest_handle_from_param trivial.
Changes in v5 (ijc):
- Fix arm's set_xen_guest_handle_raw which mixed up t and _t. Use a more unique variable name for the benefit of -Wshadow.
Changes in v6 (ijc):
- Defer change of XEN_GUEST_HANDLE_PARAM on ARM until later in order to not break the build during this and subsequent transitional patches
--- xen/include/asm-arm/guest_access.h | 32 ++++++++++++++++++++++++++++---- xen/include/asm-x86/guest_access.h | 29 +++++++++++++++++++++++++---- xen/include/public/arch-arm.h | 26 ++++++++++++++++++++++---- xen/include/public/arch-x86/xen.h | 9 +++++++++ xen/include/xen/xencomm.h | 22 +++++++++++++++++++++- 5 files changed, 105 insertions(+), 13 deletions(-)
xen/include/asm-arm/guest_access.h +28 -4
@@ -27,16 +27,40 @@ unsigned long raw_clear_guest(void *to, unsigned len);#define guest_handle_add_offset (hnd, nr) ((hnd).p += (nr))#define guest_handle_subtract_offset (hnd, nr) ((hnd).p -= (nr)) -/* Cast a guest handle to the specified type of handle. */ +/* Cast a guest handle (either XEN_GUEST_HANDLE or XEN_GUEST_HANDLE_PARAM) +* to the specified type of XEN_GUEST_HANDLE_PARAM. */ #define guest_handle_cast (hnd, type) ({ \ type *_x = (hnd).p; \ - (XEN_GUEST_HANDLE(type)) { _x }; \ + (XEN_GUEST_HANDLE_PARAM(type)) { _x }; \ +}) + +/* Cast a XEN_GUEST_HANDLE to XEN_GUEST_HANDLE_PARAM */ +#define guest_handle_to_param (hnd, type) ({ \ + typeof((hnd).p) _x = (hnd).p; \ + XEN_GUEST_HANDLE_PARAM(type) _y = { _x }; \ +/* type checking: make sure that the pointers inside \ +* XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ +* the same type, then return hnd */ \ + (void )(&_x == &_y.p); \ + _y; \ +}) + + +/* Cast a XEN_GUEST_HANDLE_PARAM to XEN_GUEST_HANDLE */ +#define guest_handle_from_param (hnd, type) ({ \ + typeof((hnd).p) _x = (hnd).p; \ + XEN_GUEST_HANDLE(type) _y = { _x }; \ +/* type checking: make sure that the pointers inside \ +* XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ +* the same type, then return hnd */ \ + (void )(&_x == &_y.p); \ + _y; \ })#define guest_handle_from_ptr (ptr, type) \ - ((XEN_GUEST_HANDLE(type)) { (type *)ptr }) + ((XEN_GUEST_HANDLE_PARAM(type)) { (type *)ptr })#define const_guest_handle_from_ptr (ptr, type) \ - ((XEN_GUEST_HANDLE(const_##type)) { (const type *)ptr }) + ((XEN_GUEST_HANDLE_PARAM(const_##type)) { (const type *)ptr })/* * Copy an array of objects to guest context via a guest handle,
xen/include/asm-x86/guest_access.h +25 -4
@@ -45,19 +45,40 @@#define guest_handle_add_offset (hnd, nr) ((hnd).p += (nr))#define guest_handle_subtract_offset (hnd, nr) ((hnd).p -= (nr)) -/* Cast a guest handle to the specified type of handle. */ +/* Cast a guest handle (either XEN_GUEST_HANDLE or XEN_GUEST_HANDLE_PARAM) +* to the specified type of XEN_GUEST_HANDLE_PARAM. */ #define guest_handle_cast (hnd, type) ({ \ type *_x = (hnd).p; \ - (XEN_GUEST_HANDLE(type)) { _x }; \ + (XEN_GUEST_HANDLE_PARAM(type)) { _x }; \ +}) + +/* Cast a XEN_GUEST_HANDLE to XEN_GUEST_HANDLE_PARAM */ +#define guest_handle_to_param (hnd, type) ({ \ +/* type checking: make sure that the pointers inside \ +* XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ +* the same type, then return hnd */ \ + (void)((typeof(&(hnd).p)) 0 == \ + (typeof(&((XEN_GUEST_HANDLE_PARAM(type)) {}).p)) 0); \ + (hnd); \ +}) + +/* Cast a XEN_GUEST_HANDLE_PARAM to XEN_GUEST_HANDLE */ +#define guest_handle_from_param (hnd, type) ({ \ +/* type checking: make sure that the pointers inside \ +* XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ +* the same type, then return hnd */ \ + (void)((typeof(&(hnd).p)) 0 == \ + (typeof(&((XEN_GUEST_HANDLE_PARAM(type)) {}).p)) 0); \ + (hnd); \ })#define guest_handle_for_field (hnd, type, fld) \ ((XEN_GUEST_HANDLE(type)) { &(hnd).p->fld })#define guest_handle_from_ptr (ptr, type) \ - ((XEN_GUEST_HANDLE(type)) { (type *)ptr }) + ((XEN_GUEST_HANDLE_PARAM(type)) { (type *)ptr })#define const_guest_handle_from_ptr (ptr, type) \ - ((XEN_GUEST_HANDLE(const_##type)) { (const type *)ptr }) + ((XEN_GUEST_HANDLE_PARAM(const_##type)) { (const type *)ptr })/* * Copy an array of objects to guest context via a guest handle,
xen/include/public/arch-arm.h +22 -4
@@ -51,18 +51,36 @@#define XEN_HYPERCALL_TAG 0XEA1 +#define uint64_aligned_t uint64_t __attribute__((aligned(8)))#ifndef __ASSEMBLY__ -#define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ - typedef struct { type *p; } __guest_handle_ ## name +#define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ + typedef union { type *p; unsigned long q; } \ + __guest_handle_ ## name; \ + typedef union { type *p; uint64_aligned_t q; } \ + __guest_handle_64_ ## name; +/* +* XEN_GUEST_HANDLE represents a guest pointer, when passed as a field +* in a struct in memory. On ARM is always 8 bytes sizes and 8 bytes +* aligned. +* XEN_GUEST_HANDLE_PARAM represent a guest pointer, when passed as an +* hypercall argument. It is 4 bytes on aarch and 8 bytes on aarch64. +*/ #define __DEFINE_XEN_GUEST_HANDLE (name, type) \ ___DEFINE_XEN_GUEST_HANDLE(name, type); \ ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)#define DEFINE_XEN_GUEST_HANDLE (name) __DEFINE_XEN_GUEST_HANDLE(name, name) -#define __XEN_GUEST_HANDLE (name) __guest_handle_ ## name +#define __XEN_GUEST_HANDLE (name) __guest_handle_64_ ## name#define XEN_GUEST_HANDLE (name) __XEN_GUEST_HANDLE(name) -#define set_xen_guest_handle_raw (hnd, val) do { (hnd).p = val; } while (0) +/* this is going to be changed on 64 bit */ +#define XEN_GUEST_HANDLE_PARAM (name) XEN_GUEST_HANDLE(name) +#define set_xen_guest_handle_raw (hnd, val) \ + do { \ + typeof(&(hnd)) _sxghr_tmp = &(hnd); \ + _sxghr_tmp->q = 0; \ + _sxghr_tmp->p = val; \ + } while ( 0 )#ifdef __XEN_TOOLS__#define get_xen_guest_handle (val, hnd) do { val = (hnd).p; } while (0)#endif
xen/include/public/arch-x86/xen.h +9 -0
@@ -38,12 +38,21 @@ typedef type * __guest_handle_ ## name#endif +/* +* XEN_GUEST_HANDLE represents a guest pointer, when passed as a field +* in a struct in memory. +* XEN_GUEST_HANDLE_PARAM represent a guest pointer, when passed as an +* hypercall argument. +* XEN_GUEST_HANDLE_PARAM and XEN_GUEST_HANDLE are the same on X86 but +* they might not be on other architectures. +*/ #define __DEFINE_XEN_GUEST_HANDLE (name, type) \ ___DEFINE_XEN_GUEST_HANDLE(name, type); \ ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)#define DEFINE_XEN_GUEST_HANDLE (name) __DEFINE_XEN_GUEST_HANDLE(name, name)#define __XEN_GUEST_HANDLE (name) __guest_handle_ ## name#define XEN_GUEST_HANDLE (name) __XEN_GUEST_HANDLE(name) +#define XEN_GUEST_HANDLE_PARAM (name) XEN_GUEST_HANDLE(name)#define set_xen_guest_handle_raw (hnd, val) do { (hnd).p = val; } while (0)#ifdef __XEN_TOOLS__#define get_xen_guest_handle (val, hnd) do { val = (hnd).p; } while (0)
xen/include/xen/xencomm.h +21 -1
@@ -66,11 +66,31 @@ static inline unsigned long xencomm_inline_addr(const void *handle)/* Cast a guest handle to the specified type of handle. */ #define guest_handle_cast (hnd, type) ({ \ type *_x = (hnd).p; \ - XEN_GUEST_HANDLE(type) _y; \ + XEN_GUEST_HANDLE_PARAM(type) _y; \ set_xen_guest_handle(_y, _x); \ _y; \ }) +/* Cast a XEN_GUEST_HANDLE to XEN_GUEST_HANDLE_PARAM */ +#define guest_handle_to_param (hnd, type) ({ \ +/* type checking: make sure that the pointers inside \ +* XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ +* the same type, then return hnd */ \ + (void)((typeof(&(hnd).p)) 0 == \ + (typeof(&((XEN_GUEST_HANDLE_PARAM(type)) {}).p)) 0); \ + (hnd); \ +}) + +/* Cast a XEN_GUEST_HANDLE_PARAM to XEN_GUEST_HANDLE */ +#define guest_handle_from_param (hnd, type) ({ \ +/* type checking: make sure that the pointers inside \ +* XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ +* the same type, then return hnd */ \ + (void)((typeof(&(hnd).p)) 0 == \ + (typeof(&((XEN_GUEST_HANDLE_PARAM(type)) {}).p)) 0); \ + (hnd); \ +}) +/* Since we run in real mode, we can safely access all addresses. That also * means our __routines are identical to our "normal" routines. */ #define guest_handle_okay (hnd, nr) 1
Signature · 1 line
1.7.9.1
PATCH v2 7/10 xen: replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when appropriate
In reply to Ian CampbellFrom: Stefano Stabellini <[email protected]>
Note: these changes don't make any difference on x86.
Replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when it is used as an hypercall argument.
---
ijc v2: - correct usage of guest handle paramters in tmem
- defer some changes to next patch to avoid temporarily breaking the build.
--- xen/arch/arm/domain.c | 2 +- xen/arch/arm/domctl.c | 2 +- xen/arch/arm/hvm.c | 2 +- xen/arch/arm/mm.c | 2 +- xen/arch/arm/physdev.c | 2 +- xen/arch/arm/sysctl.c | 2 +- xen/arch/x86/compat.c | 2 +- xen/arch/x86/cpu/mcheck/mce.c | 2 +- xen/arch/x86/domain.c | 2 +- xen/arch/x86/domctl.c | 2 +- xen/arch/x86/efi/runtime.c | 2 +- xen/arch/x86/hvm/hvm.c | 26 +++++++++--------- xen/arch/x86/microcode.c | 2 +- xen/arch/x86/mm.c | 14 +++++----- xen/arch/x86/mm/hap/hap.c | 2 +- xen/arch/x86/mm/mem_event.c | 2 +- xen/arch/x86/mm/paging.c | 2 +- xen/arch/x86/mm/shadow/common.c | 2 +- xen/arch/x86/oprofile/xenoprof.c | 6 ++-- xen/arch/x86/physdev.c | 2 +- xen/arch/x86/sysctl.c | 2 +- xen/arch/x86/traps.c | 2 +- xen/arch/x86/x86_64/compat/mm.c | 10 +++--- xen/arch/x86/x86_64/domain.c | 2 +- xen/arch/x86/x86_64/mm.c | 2 +- xen/arch/x86/x86_64/traps.c | 2 +- xen/common/compat/domain.c | 2 +- xen/common/compat/grant_table.c | 8 +++--- xen/common/compat/memory.c | 4 +- xen/common/domain.c | 2 +- xen/common/domctl.c | 2 +- xen/common/event_channel.c | 2 +- xen/common/grant_table.c | 36 +++++++++++++------------- xen/common/kernel.c | 4 +- xen/common/kexec.c | 17 ++++++------ xen/common/memory.c | 4 +- xen/common/schedule.c | 2 +- xen/common/sysctl.c | 2 +- xen/common/tmem.c | 45 ++++++++++++++++++-------------- xen/common/tmem_xen.c | 8 +++--- xen/common/xenoprof.c | 8 +++--- xen/drivers/acpi/pmstat.c | 2 +- xen/drivers/char/console.c | 6 ++-- xen/drivers/passthrough/iommu.c | 2 +- xen/include/asm-arm/hypercall.h | 2 +- xen/include/asm-arm/mm.h | 2 +- xen/include/asm-x86/hap.h | 2 +- xen/include/asm-x86/hypercall.h | 22 ++++++++-------- xen/include/asm-x86/mem_event.h | 2 +- xen/include/asm-x86/mm.h | 8 +++--- xen/include/asm-x86/paging.h | 2 +- xen/include/asm-x86/processor.h | 2 +- xen/include/asm-x86/shadow.h | 2 +- xen/include/asm-x86/xenoprof.h | 6 ++-- xen/include/xen/acpi.h | 4 +- xen/include/xen/compat.h | 3 ++ xen/include/xen/hypercall.h | 52 +++++++++++++++++++------------------- xen/include/xen/iommu.h | 2 +- xen/include/xen/tmem_xen.h | 18 ++++++++----- xen/include/xsm/xsm.h | 4 +- xen/xsm/dummy.c | 2 +- xen/xsm/flask/flask_op.c | 4 +- xen/xsm/flask/hooks.c | 2 +- xen/xsm/xsm_core.c | 2 +- 64 files changed, 206 insertions(+), 193 deletions(-)
xen/arch/arm/domain.c +1 -1
@@ -519,7 +519,7 @@ void arch_dump_domain_info(struct domain *d) { } -long arch_do_vcpu_op (int cmd,struct vcpu *v,XEN_GUEST_HANDLE (void ) arg) +long arch_do_vcpu_op (int cmd,struct vcpu *v,XEN_GUEST_HANDLE_PARAM (void ) arg) {return -ENOSYS ; }
xen/arch/arm/domctl.c +1 -1
@@ -11,7 +11,7 @@#include <public/domctl.h> long arch_do_domctl (struct xen_domctl *domctl, -XEN_GUEST_HANDLE (xen_domctl_t) u_domctl) +XEN_GUEST_HANDLE_PARAM (xen_domctl_t) u_domctl) {return -ENOSYS ; }
xen/arch/arm/hvm.c +1 -1
@@ -11,7 +11,7 @@#include <asm/hypercall.h> -long do_hvm_op (unsigned long op,XEN_GUEST_HANDLE (void ) arg) +long do_hvm_op (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) arg) {long rc =0 ;
xen/arch/arm/mm.c +1 -1
@@ -579,7 +579,7 @@ out: } -long arch_memory_op (int op,XEN_GUEST_HANDLE (void ) arg) +long arch_memory_op (int op,XEN_GUEST_HANDLE_PARAM (void ) arg) {int rc;
xen/arch/arm/physdev.c +1 -1
@@ -11,7 +11,7 @@#include <asm/hypercall.h> -int do_physdev_op (int cmd,XEN_GUEST_HANDLE (void ) arg) +int do_physdev_op (int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {printk ("%s %d cmd=%d: not implemented yet\n" , __func__, __LINE__, cmd);return -ENOSYS ;
xen/arch/arm/sysctl.c +1 -1
@@ -13,7 +13,7 @@#include <public/sysctl.h> long arch_do_sysctl (struct xen_sysctl *sysctl, -XEN_GUEST_HANDLE (xen_sysctl_t) u_sysctl) +XEN_GUEST_HANDLE_PARAM (xen_sysctl_t) u_sysctl) {return -ENOSYS ; }
xen/arch/x86/compat.c +1 -1
@@ -27,7 +27,7 @@ ret_t do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop)#ifndef COMPAT /* Legacy hypercall (as of 0x00030202). */ -long do_event_channel_op_compat (XEN_GUEST_HANDLE (evtchn_op_t) uop) +long do_event_channel_op_compat (XEN_GUEST_HANDLE_PARAM (evtchn_op_t) uop) {struct evtchn_op op;
xen/arch/x86/cpu/mcheck/mce.c +1 -1
@@ -1289,7 +1289,7 @@ CHECK_mcinfo_recovery;# undef xen_mcinfo_recovery/* Machine Check Architecture Hypercall */ -long do_mca (XEN_GUEST_HANDLE (xen_mc_t) u_xen_mc) +long do_mca (XEN_GUEST_HANDLE_PARAM (xen_mc_t) u_xen_mc) {long ret =0 ;struct xen_mc curop, *op = &curop;
xen/arch/x86/domain.c +1 -1
@@ -1077,7 +1077,7 @@ map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)long arch_do_vcpu_op ( -int cmd,struct vcpu *v,XEN_GUEST_HANDLE (void ) arg) +int cmd,struct vcpu *v,XEN_GUEST_HANDLE_PARAM (void ) arg) {long rc =0 ;
xen/arch/x86/domctl.c +1 -1
@@ -48,7 +48,7 @@ static int gdbsx_guest_mem_io(long arch_do_domctl (struct xen_domctl *domctl, -XEN_GUEST_HANDLE (xen_domctl_t) u_domctl) +XEN_GUEST_HANDLE_PARAM (xen_domctl_t) u_domctl) {long ret =0 ;
xen/arch/x86/efi/runtime.c +1 -1
@@ -184,7 +184,7 @@ int efi_get_info(uint32_t idx, union xenpf_efi_info *info)return 0 ; } -static long gwstrlen (XEN_GUEST_HANDLE (CHAR16) str) +static long gwstrlen (XEN_GUEST_HANDLE_PARAM (CHAR16) str) {unsigned long len;
xen/arch/x86/hvm/hvm.c +13 -13
@@ -3091,14 +3091,14 @@ static int grant_table_op_is_allowed(unsigned int cmd) }static long hvm_grant_table_op ( -unsigned int cmd,XEN_GUEST_HANDLE (void ) uop,unsigned int count) +unsigned int cmd,XEN_GUEST_HANDLE_PARAM (void ) uop,unsigned int count) {if ( !grant_table_op_is_allowed (cmd) )return -ENOSYS ;/* all other commands need auditing */ return do_grant_table_op (cmd, uop, count); } -static long hvm_memory_op (int cmd,XEN_GUEST_HANDLE (void ) arg) +static long hvm_memory_op (int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {long rc;
@@ -3116,7 +3116,7 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE(void) arg)return do_memory_op (cmd, arg); } -static long hvm_physdev_op (int cmd,XEN_GUEST_HANDLE (void ) arg) +static long hvm_physdev_op (int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {switch ( cmd ) {
@@ -3132,7 +3132,7 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg) }static long hvm_vcpu_op ( -int cmd,int vcpuid,XEN_GUEST_HANDLE (void ) arg) +int cmd,int vcpuid,XEN_GUEST_HANDLE_PARAM (void ) arg) {long rc;
@@ -3163,7 +3163,7 @@ typedef unsigned long hvm_hypercall_t( [ __HYPERVISOR_ ## x ] = (hvm_hypercall_t *) do_ ## xstatic long hvm_grant_table_op_compat32 (unsigned int cmd, -XEN_GUEST_HANDLE (void ) uop, +XEN_GUEST_HANDLE_PARAM (void ) uop,unsigned int count) {if ( !grant_table_op_is_allowed (cmd) )
@@ -3171,7 +3171,7 @@ static long hvm_grant_table_op_compat32(unsigned int cmd,return compat_grant_table_op (cmd, uop, count); } -static long hvm_memory_op_compat32 (int cmd,XEN_GUEST_HANDLE (void ) arg) +static long hvm_memory_op_compat32 (int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {int rc;
@@ -3190,7 +3190,7 @@ static long hvm_memory_op_compat32(int cmd, XEN_GUEST_HANDLE(void) arg) }static long hvm_vcpu_op_compat32 ( -int cmd,int vcpuid,XEN_GUEST_HANDLE (void ) arg) +int cmd,int vcpuid,XEN_GUEST_HANDLE_PARAM (void ) arg) {long rc;
@@ -3214,7 +3214,7 @@ static long hvm_vcpu_op_compat32( }static long hvm_physdev_op_compat32 ( -int cmd,XEN_GUEST_HANDLE (void ) arg) +int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {switch ( cmd ) {
@@ -3380,7 +3380,7 @@ void hvm_hypercall_page_initialise(struct domain *d, }static int hvmop_set_pci_intx_level ( -XEN_GUEST_HANDLE (xen_hvm_set_pci_intx_level_t) uop) +XEN_GUEST_HANDLE_PARAM (xen_hvm_set_pci_intx_level_t) uop) {struct xen_hvm_set_pci_intx_level op;struct domain *d;
@@ -3547,7 +3547,7 @@ static void hvm_s3_resume(struct domain *d) }static int hvmop_set_isa_irq_level ( -XEN_GUEST_HANDLE (xen_hvm_set_isa_irq_level_t) uop) +XEN_GUEST_HANDLE_PARAM (xen_hvm_set_isa_irq_level_t) uop) {struct xen_hvm_set_isa_irq_level op;struct domain *d;
@@ -3591,7 +3591,7 @@ static int hvmop_set_isa_irq_level( }static int hvmop_set_pci_link_route ( -XEN_GUEST_HANDLE (xen_hvm_set_pci_link_route_t) uop) +XEN_GUEST_HANDLE_PARAM (xen_hvm_set_pci_link_route_t) uop) {struct xen_hvm_set_pci_link_route op;struct domain *d;
@@ -3624,7 +3624,7 @@ static int hvmop_set_pci_link_route( }static int hvmop_inject_msi ( -XEN_GUEST_HANDLE (xen_hvm_inject_msi_t) uop) +XEN_GUEST_HANDLE_PARAM (xen_hvm_inject_msi_t) uop) {struct xen_hvm_inject_msi op;struct domain *d;
@@ -3708,7 +3708,7 @@ static int hvm_replace_event_channel(struct vcpu *v, domid_t remote_domid,return 0 ; } -long do_hvm_op (unsigned long op,XEN_GUEST_HANDLE (void ) arg) +long do_hvm_op (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) arg) {struct domain *curr_d = current->domain;
xen/arch/x86/microcode.c +1 -1
@@ -195,7 +195,7 @@ static long do_microcode_update(void *_info)return error; } -int microcode_update (XEN_GUEST_HANDLE (const_void) buf,unsigned long len) +int microcode_update (XEN_GUEST_HANDLE_PARAM (const_void) buf,unsigned long len) {int ret;struct microcode_info *info;
xen/arch/x86/mm.c +7 -7
@@ -2652,7 +2652,7 @@ static void put_pg_owner(struct domain *pg_owner) }static inline int vcpumask_to_pcpumask ( -struct domain *d,XEN_GUEST_HANDLE (const_void) bmap,cpumask_t *pmask) +struct domain *d,XEN_GUEST_HANDLE_PARAM (const_void) bmap,cpumask_t *pmask) {unsigned int vcpu_id, vcpu_bias, offs;unsigned long vmask;
@@ -2692,9 +2692,9 @@ static inline int vcpumask_to_pcpumask(#define fixunmap_domain_page (ptr) ((void)(ptr))long do_mmuext_op ( -XEN_GUEST_HANDLE (mmuext_op_t) uops, +XEN_GUEST_HANDLE_PARAM (mmuext_op_t) uops,unsigned int count, -XEN_GUEST_HANDLE (uint) pdone, +XEN_GUEST_HANDLE_PARAM (uint) pdone,unsigned int foreigndom) {struct mmuext_op op;
@@ -3151,9 +3151,9 @@ long do_mmuext_op( }long do_mmu_update ( -XEN_GUEST_HANDLE (mmu_update_t) ureqs, +XEN_GUEST_HANDLE_PARAM (mmu_update_t) ureqs,unsigned int count, -XEN_GUEST_HANDLE (uint) pdone, +XEN_GUEST_HANDLE_PARAM (uint) pdone,unsigned int foreigndom) {struct mmu_update req;
@@ -4098,7 +4098,7 @@ long set_gdt(struct vcpu *v, } -long do_set_gdt (XEN_GUEST_HANDLE (ulong) frame_list,unsigned int entries) +long do_set_gdt (XEN_GUEST_HANDLE_PARAM (ulong) frame_list,unsigned int entries) {int nr_pages = (entries +511 ) /512 ;unsigned long frames[16 ];
@@ -4370,7 +4370,7 @@ static int xenmem_add_to_physmap(struct domain *d,return xenmem_add_to_physmap_once (d, xatp); } -long arch_memory_op (int op,XEN_GUEST_HANDLE (void ) arg) +long arch_memory_op (int op,XEN_GUEST_HANDLE_PARAM (void ) arg) {int rc;
xen/arch/x86/mm/hap/hap.c +1 -1
@@ -571,7 +571,7 @@ void hap_teardown(struct domain *d) }int hap_domctl (struct domain *d,xen_domctl_shadow_op_t *sc, -XEN_GUEST_HANDLE (void ) u_domctl) +XEN_GUEST_HANDLE_PARAM (void ) u_domctl) {int rc, preempted =0 ;
xen/arch/x86/mm/mem_event.c +1 -1
@@ -512,7 +512,7 @@ void mem_event_cleanup(struct domain *d) }int mem_event_domctl (struct domain *d,xen_domctl_mem_event_op_t *mec, -XEN_GUEST_HANDLE (void ) u_domctl) +XEN_GUEST_HANDLE_PARAM (void ) u_domctl) {int rc;
xen/arch/x86/mm/paging.c +1 -1
@@ -654,7 +654,7 @@ void paging_vcpu_init(struct vcpu *v)int paging_domctl (struct domain *d,xen_domctl_shadow_op_t *sc, -XEN_GUEST_HANDLE (void ) u_domctl) +XEN_GUEST_HANDLE_PARAM (void ) u_domctl) {int rc;
xen/arch/x86/mm/shadow/common.c +1 -1
@@ -3641,7 +3641,7 @@ out:int shadow_domctl (struct domain *d,xen_domctl_shadow_op_t *sc, -XEN_GUEST_HANDLE (void ) u_domctl) +XEN_GUEST_HANDLE_PARAM (void ) u_domctl) {int rc, preempted =0 ;
xen/arch/x86/oprofile/xenoprof.c +3 -3
@@ -17,7 +17,7 @@#include "op_counter.h" -int xenoprof_arch_counter (XEN_GUEST_HANDLE (void ) arg) +int xenoprof_arch_counter (XEN_GUEST_HANDLE_PARAM (void ) arg) {struct xenoprof_counter counter;
@@ -37,7 +37,7 @@ int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg)return 0 ; } -int xenoprof_arch_ibs_counter (XEN_GUEST_HANDLE (void ) arg) +int xenoprof_arch_ibs_counter (XEN_GUEST_HANDLE_PARAM (void ) arg) {struct xenoprof_ibs_counter ibs_counter;
@@ -54,7 +54,7 @@ int xenoprof_arch_ibs_counter(XEN_GUEST_HANDLE(void) arg)return 0 ; } -int compat_oprof_arch_counter (XEN_GUEST_HANDLE (void ) arg) +int compat_oprof_arch_counter (XEN_GUEST_HANDLE_PARAM (void ) arg) {struct compat_oprof_counter counter;
xen/arch/x86/physdev.c +1 -1
@@ -258,7 +258,7 @@ int physdev_unmap_pirq(domid_t domid, int pirq) }#endif /* COMPAT */ -ret_t do_physdev_op (int cmd,XEN_GUEST_HANDLE (void ) arg) +ret_t do_physdev_op (int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {int irq;ret_t ret;
xen/arch/x86/sysctl.c +1 -1
@@ -58,7 +58,7 @@ long cpu_down_helper(void *data) }long arch_do_sysctl ( -struct xen_sysctl *sysctl,XEN_GUEST_HANDLE (xen_sysctl_t) u_sysctl) +struct xen_sysctl *sysctl,XEN_GUEST_HANDLE_PARAM (xen_sysctl_t) u_sysctl) {long ret =0 ;
xen/arch/x86/traps.c +1 -1
@@ -3536,7 +3536,7 @@ int send_guest_trap(struct domain *d, uint16_t vcpuid, unsigned int trap_nr) } -long do_set_trap_table (XEN_GUEST_HANDLE (const_trap_info_t) traps) +long do_set_trap_table (XEN_GUEST_HANDLE_PARAM (const_trap_info_t) traps) {struct trap_info cur;struct vcpu *curr = current;
xen/arch/x86/x86_64/compat/mm.c +5 -5
@@ -5,7 +5,7 @@#include <asm/mem_event.h> #include <asm/mem_sharing.h> -int compat_set_gdt (XEN_GUEST_HANDLE (uint) frame_list,unsigned int entries) +int compat_set_gdt (XEN_GUEST_HANDLE_PARAM (uint) frame_list,unsigned int entries) {unsigned int i, nr_pages = (entries +511 ) /512 ;unsigned long frames[16 ];
@@ -44,7 +44,7 @@ int compat_update_descriptor(u32 pa_lo, u32 pa_hi, u32 desc_lo, u32 desc_hi) desc_lo | ((u64)desc_hi << 32)); } -int compat_arch_memory_op (int op,XEN_GUEST_HANDLE (void ) arg) +int compat_arch_memory_op (int op,XEN_GUEST_HANDLE_PARAM (void ) arg) {struct compat_machphys_mfn_list xmml;l2_pgentry_t l2e;
@@ -260,14 +260,14 @@ int compat_update_va_mapping_otherdomain(unsigned long va, u32 lo, u32 hi,DEFINE_XEN_GUEST_HANDLE (mmuext_op_compat_t); -int compat_mmuext_op (XEN_GUEST_HANDLE (mmuext_op_compat_t) cmp_uops, +int compat_mmuext_op (XEN_GUEST_HANDLE_PARAM (mmuext_op_compat_t) cmp_uops,unsigned int count, -XEN_GUEST_HANDLE (uint) pdone, +XEN_GUEST_HANDLE_PARAM (uint) pdone,unsigned int foreigndom) {unsigned int i, preempt_mask;int rc =0 ; -XEN_GUEST_HANDLE (mmuext_op_t) nat_ops; +XEN_GUEST_HANDLE_PARAM (mmuext_op_t) nat_ops; preempt_mask = count &MMU_UPDATE_PREEMPTED ; count ^= preempt_mask;
xen/arch/x86/x86_64/domain.c +1 -1
@@ -23,7 +23,7 @@ CHECK_vcpu_get_physid;int arch_compat_vcpu_op ( -int cmd,struct vcpu *v,XEN_GUEST_HANDLE (void ) arg) +int cmd,struct vcpu *v,XEN_GUEST_HANDLE_PARAM (void ) arg) {int rc = -ENOSYS ;
xen/arch/x86/x86_64/mm.c +1 -1
@@ -1027,7 +1027,7 @@ void __init subarch_init_memory(void) } } -long subarch_memory_op (int op,XEN_GUEST_HANDLE (void ) arg) +long subarch_memory_op (int op,XEN_GUEST_HANDLE_PARAM (void ) arg) {struct xen_machphys_mfn_list xmml;l3_pgentry_t l3e;
xen/arch/x86/x86_64/traps.c +1 -1
@@ -519,7 +519,7 @@ static long unregister_guest_callback(struct callback_unregister *unreg) } -long do_callback_op (int cmd,XEN_GUEST_HANDLE (const_void) arg) +long do_callback_op (int cmd,XEN_GUEST_HANDLE_PARAM (const_void) arg) {long ret;
xen/common/compat/domain.c +1 -1
@@ -15,7 +15,7 @@ CHECK_vcpu_set_periodic_timer;#undef xen_vcpu_set_periodic_timer -int compat_vcpu_op (int cmd,int vcpuid,XEN_GUEST_HANDLE (void ) arg) +int compat_vcpu_op (int cmd,int vcpuid,XEN_GUEST_HANDLE_PARAM (void ) arg) {struct domain *d = current->domain;struct vcpu *v;
xen/common/compat/grant_table.c +4 -4
@@ -52,12 +52,12 @@ CHECK_gnttab_swap_grant_ref;#undef xen_gnttab_swap_grant_refint compat_grant_table_op (unsigned int cmd, -XEN_GUEST_HANDLE (void ) cmp_uop, +XEN_GUEST_HANDLE_PARAM (void ) cmp_uop,unsigned int count) {int rc =0 ;unsigned int i; -XEN_GUEST_HANDLE (void ) cnt_uop; +XEN_GUEST_HANDLE_PARAM (void ) cnt_uop;set_xen_guest_handle (cnt_uop,NULL ); switch ( cmd )
@@ -206,7 +206,7 @@ int compat_grant_table_op(unsigned int cmd, }if ( rc >=0 ) { -XEN_GUEST_HANDLE (gnttab_transfer_compat_t) xfer; +XEN_GUEST_HANDLE_PARAM (gnttab_transfer_compat_t) xfer; xfer =guest_handle_cast (cmp_uop, gnttab_transfer_compat_t);guest_handle_add_offset (xfer, i);
@@ -251,7 +251,7 @@ int compat_grant_table_op(unsigned int cmd, }if ( rc >=0 ) { -XEN_GUEST_HANDLE (gnttab_copy_compat_t) copy; +XEN_GUEST_HANDLE_PARAM (gnttab_copy_compat_t) copy; copy =guest_handle_cast (cmp_uop, gnttab_copy_compat_t);guest_handle_add_offset (copy, i);
xen/common/compat/memory.c +2 -2
@@ -13,7 +13,7 @@ CHECK_TYPE(domid);#undef compat_domid_t#undef xen_domid_t -int compat_memory_op (unsigned int cmd,XEN_GUEST_HANDLE (void ) compat) +int compat_memory_op (unsigned int cmd,XEN_GUEST_HANDLE_PARAM (void ) compat) {int rc, split, op = cmd &MEMOP_CMD_MASK ;unsigned int start_extent = cmd >>MEMOP_EXTENT_SHIFT ;
@@ -22,7 +22,7 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE(void) compat) {unsigned int i, end_extent =0 ;union { -XEN_GUEST_HANDLE (void ) hnd; +XEN_GUEST_HANDLE_PARAM (void ) hnd;struct xen_memory_reservation *rsrv;struct xen_memory_exchange *xchg;struct xen_remove_from_physmap *xrfp;
xen/common/domain.c +1 -1
@@ -806,7 +806,7 @@ void vcpu_reset(struct vcpu *v) } -long do_vcpu_op (int cmd,int vcpuid,XEN_GUEST_HANDLE (void ) arg) +long do_vcpu_op (int cmd,int vcpuid,XEN_GUEST_HANDLE_PARAM (void ) arg) {struct domain *d = current->domain;struct vcpu *v;
xen/common/domctl.c +1 -1
@@ -239,7 +239,7 @@ void domctl_lock_release(void)spin_unlock (¤t->domain->hypercall_deadlock_mutex); } -long do_domctl (XEN_GUEST_HANDLE (xen_domctl_t) u_domctl) +long do_domctl (XEN_GUEST_HANDLE_PARAM (xen_domctl_t) u_domctl) {long ret =0 ;struct xen_domctl curop, *op = &curop;
xen/common/event_channel.c +1 -1
@@ -970,7 +970,7 @@ out: } -long do_event_channel_op (int cmd,XEN_GUEST_HANDLE (void ) arg) +long do_event_channel_op (int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {long rc;
xen/common/grant_table.c +18 -18
@@ -833,7 +833,7 @@ __gnttab_map_grant_ref(static long gnttab_map_grant_ref ( -XEN_GUEST_HANDLE (gnttab_map_grant_ref_t) uop,unsigned int count) +XEN_GUEST_HANDLE_PARAM (gnttab_map_grant_ref_t) uop,unsigned int count) {int i;struct gnttab_map_grant_ref op;
@@ -1102,7 +1102,7 @@ __gnttab_unmap_grant_ref(static long gnttab_unmap_grant_ref ( -XEN_GUEST_HANDLE (gnttab_unmap_grant_ref_t) uop,unsigned int count) +XEN_GUEST_HANDLE_PARAM (gnttab_unmap_grant_ref_t) uop,unsigned int count) {int i, c, partial_done, done =0 ;struct gnttab_unmap_grant_ref op;
@@ -1164,7 +1164,7 @@ __gnttab_unmap_and_replace(static long gnttab_unmap_and_replace ( -XEN_GUEST_HANDLE (gnttab_unmap_and_replace_t) uop,unsigned int count) +XEN_GUEST_HANDLE_PARAM (gnttab_unmap_and_replace_t) uop,unsigned int count) {int i, c, partial_done, done =0 ;struct gnttab_unmap_and_replace op;
@@ -1316,7 +1316,7 @@ active_alloc_failed:static long gnttab_setup_table ( -XEN_GUEST_HANDLE (gnttab_setup_table_t) uop,unsigned int count) +XEN_GUEST_HANDLE_PARAM (gnttab_setup_table_t) uop,unsigned int count) {struct gnttab_setup_table op;struct domain *d;
@@ -1395,7 +1395,7 @@ gnttab_setup_table(static long gnttab_query_size ( -XEN_GUEST_HANDLE (gnttab_query_size_t) uop,unsigned int count) +XEN_GUEST_HANDLE_PARAM (gnttab_query_size_t) uop,unsigned int count) {struct gnttab_query_size op;struct domain *d;
@@ -1517,7 +1517,7 @@ gnttab_prepare_for_transfer(static long gnttab_transfer ( -XEN_GUEST_HANDLE (gnttab_transfer_t) uop,unsigned int count) +XEN_GUEST_HANDLE_PARAM (gnttab_transfer_t) uop,unsigned int count) {struct domain *d = current->domain;struct domain *e;
@@ -2125,7 +2125,7 @@ __gnttab_copy(static long gnttab_copy ( -XEN_GUEST_HANDLE (gnttab_copy_t) uop,unsigned int count) +XEN_GUEST_HANDLE_PARAM (gnttab_copy_t) uop,unsigned int count) {int i;struct gnttab_copy op;
@@ -2144,7 +2144,7 @@ gnttab_copy( }static long -gnttab_set_version (XEN_GUEST_HANDLE (gnttab_set_version_t uop)) +gnttab_set_version (XEN_GUEST_HANDLE_PARAM (gnttab_set_version_t uop)) {gnttab_set_version_t op;struct domain *d = current->domain;
@@ -2263,7 +2263,7 @@ out: }static long -gnttab_get_status_frames (XEN_GUEST_HANDLE (gnttab_get_status_frames_t) uop, +gnttab_get_status_frames (XEN_GUEST_HANDLE_PARAM (gnttab_get_status_frames_t) uop,int count) {gnttab_get_status_frames_t op;
@@ -2327,7 +2327,7 @@ out1: }static long -gnttab_get_version (XEN_GUEST_HANDLE (gnttab_get_version_t uop)) +gnttab_get_version (XEN_GUEST_HANDLE_PARAM (gnttab_get_version_t uop)) {gnttab_get_version_t op;struct domain *d;
@@ -2412,7 +2412,7 @@ out: }static long -gnttab_swap_grant_ref (XEN_GUEST_HANDLE (gnttab_swap_grant_ref_t uop), +gnttab_swap_grant_ref (XEN_GUEST_HANDLE_PARAM (gnttab_swap_grant_ref_t uop),unsigned int count) {int i;
@@ -2433,7 +2433,7 @@ gnttab_swap_grant_ref(XEN_GUEST_HANDLE(gnttab_swap_grant_ref_t uop),long do_grant_table_op ( -unsigned int cmd,XEN_GUEST_HANDLE (void ) uop,unsigned int count) +unsigned int cmd,XEN_GUEST_HANDLE_PARAM (void ) uop,unsigned int count) {long rc;
@@ -2445,7 +2445,7 @@ do_grant_table_op( {case GNTTABOP_map_grant_ref: { -XEN_GUEST_HANDLE (gnttab_map_grant_ref_t) map = +XEN_GUEST_HANDLE_PARAM (gnttab_map_grant_ref_t) map =guest_handle_cast (uop, gnttab_map_grant_ref_t);if (unlikely (!guest_handle_okay (map, count)) ) goto out;
@@ -2459,7 +2459,7 @@ do_grant_table_op( }case GNTTABOP_unmap_grant_ref: { -XEN_GUEST_HANDLE (gnttab_unmap_grant_ref_t) unmap = +XEN_GUEST_HANDLE_PARAM (gnttab_unmap_grant_ref_t) unmap =guest_handle_cast (uop, gnttab_unmap_grant_ref_t);if (unlikely (!guest_handle_okay (unmap, count)) ) goto out;
@@ -2473,7 +2473,7 @@ do_grant_table_op( }case GNTTABOP_unmap_and_replace: { -XEN_GUEST_HANDLE (gnttab_unmap_and_replace_t) unmap = +XEN_GUEST_HANDLE_PARAM (gnttab_unmap_and_replace_t) unmap =guest_handle_cast (uop, gnttab_unmap_and_replace_t);if (unlikely (!guest_handle_okay (unmap, count)) ) goto out;
@@ -2497,7 +2497,7 @@ do_grant_table_op( }case GNTTABOP_transfer: { -XEN_GUEST_HANDLE (gnttab_transfer_t) transfer = +XEN_GUEST_HANDLE_PARAM (gnttab_transfer_t) transfer =guest_handle_cast (uop, gnttab_transfer_t);if (unlikely (!guest_handle_okay (transfer, count)) ) goto out;
@@ -2511,7 +2511,7 @@ do_grant_table_op( }case GNTTABOP_copy: { -XEN_GUEST_HANDLE (gnttab_copy_t) copy = +XEN_GUEST_HANDLE_PARAM (gnttab_copy_t) copy =guest_handle_cast (uop, gnttab_copy_t);if (unlikely (!guest_handle_okay (copy, count)) ) goto out;
@@ -2548,7 +2548,7 @@ do_grant_table_op( }case GNTTABOP_swap_grant_ref: { -XEN_GUEST_HANDLE (gnttab_swap_grant_ref_t) swap = +XEN_GUEST_HANDLE_PARAM (gnttab_swap_grant_ref_t) swap =guest_handle_cast (uop, gnttab_swap_grant_ref_t);if (unlikely (!guest_handle_okay (swap, count)) ) goto out;
xen/common/kernel.c +2 -2
@@ -204,7 +204,7 @@ void __init do_initcalls(void)* Simple hypercalls. */ -DO (xen_version)(int cmd,XEN_GUEST_HANDLE (void ) arg) +DO (xen_version)(int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {switch ( cmd ) {
@@ -332,7 +332,7 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE(void) arg)return -ENOSYS ; } -DO (nmi_op)(unsigned int cmd,XEN_GUEST_HANDLE (void ) arg) +DO (nmi_op)(unsigned int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {struct xennmi_callback cb;long rc =0 ;
xen/common/kexec.c +9 -8
@@ -613,7 +613,7 @@ static int kexec_get_range_internal(xen_kexec_range_t *range)return ret; } -static int kexec_get_range (XEN_GUEST_HANDLE (void ) uarg) +static int kexec_get_range (XEN_GUEST_HANDLE_PARAM (void ) uarg) {xen_kexec_range_t range;int ret = -EINVAL ;
@@ -629,7 +629,7 @@ static int kexec_get_range(XEN_GUEST_HANDLE(void) uarg)return ret; } -static int kexec_get_range_compat (XEN_GUEST_HANDLE (void ) uarg) +static int kexec_get_range_compat (XEN_GUEST_HANDLE_PARAM (void ) uarg) {#ifdef CONFIG_COMPAT xen_kexec_range_t range;
@@ -777,7 +777,7 @@ static int kexec_load_unload_internal(unsigned long op, xen_kexec_load_t *load)return ret; } -static int kexec_load_unload (unsigned long op,XEN_GUEST_HANDLE (void ) uarg) +static int kexec_load_unload (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) uarg) {xen_kexec_load_t load;
@@ -788,7 +788,7 @@ static int kexec_load_unload(unsigned long op, XEN_GUEST_HANDLE(void) uarg) }static int kexec_load_unload_compat (unsigned long op, -XEN_GUEST_HANDLE (void ) uarg) +XEN_GUEST_HANDLE_PARAM (void ) uarg) {#ifdef CONFIG_COMPAT compat_kexec_load_t compat_load;
@@ -813,7 +813,7 @@ static int kexec_load_unload_compat(unsigned long op,#endif /* CONFIG_COMPAT */ } -static int kexec_exec (XEN_GUEST_HANDLE (void ) uarg) +static int kexec_exec (XEN_GUEST_HANDLE_PARAM (void ) uarg) {xen_kexec_exec_t exec;xen_kexec_image_t *image;
@@ -845,7 +845,8 @@ static int kexec_exec(XEN_GUEST_HANDLE(void) uarg)return -EINVAL ;/* never reached */ } -static int do_kexec_op_internal (unsigned long op,XEN_GUEST_HANDLE (void ) uarg, +static int do_kexec_op_internal (unsigned long op, +XEN_GUEST_HANDLE_PARAM (void ) uarg,bool_t compat) {unsigned long flags;
@@ -886,13 +887,13 @@ static int do_kexec_op_internal(unsigned long op, XEN_GUEST_HANDLE(void) uarg,return ret; } -long do_kexec_op (unsigned long op,XEN_GUEST_HANDLE (void ) uarg) +long do_kexec_op (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) uarg) {return do_kexec_op_internal (op, uarg,0 ); }#ifdef CONFIG_COMPAT -int compat_kexec_op (unsigned long op,XEN_GUEST_HANDLE (void ) uarg) +int compat_kexec_op (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) uarg) {return do_kexec_op_internal (op, uarg,1 ); }
xen/common/memory.c +2 -2
@@ -277,7 +277,7 @@ static void decrease_reservation(struct memop_args *a) a->nr_done = i; } -static long memory_exchange (XEN_GUEST_HANDLE (xen_memory_exchange_t) arg) +static long memory_exchange (XEN_GUEST_HANDLE_PARAM (xen_memory_exchange_t) arg) {struct xen_memory_exchange exch;PAGE_LIST_HEAD (in_chunk_list);
@@ -517,7 +517,7 @@ static long memory_exchange(XEN_GUEST_HANDLE(xen_memory_exchange_t) arg)return rc; } -long do_memory_op (unsigned long cmd,XEN_GUEST_HANDLE (void ) arg) +long do_memory_op (unsigned long cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {struct domain *d;int rc, op;
xen/common/schedule.c +1 -1
@@ -836,7 +836,7 @@ typedef long ret_t;#endif /* !COMPAT */ -ret_t do_sched_op (int cmd,XEN_GUEST_HANDLE (void ) arg) +ret_t do_sched_op (int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg) {ret_t ret =0 ;
xen/common/sysctl.c +1 -1
@@ -27,7 +27,7 @@#include <xsm/xsm.h> #include <xen/pmstat.h> -long do_sysctl (XEN_GUEST_HANDLE (xen_sysctl_t) u_sysctl) +long do_sysctl (XEN_GUEST_HANDLE_PARAM (xen_sysctl_t) u_sysctl) {long ret =0 ;struct xen_sysctl curop, *op = &curop;
xen/common/tmem.c +25 -20
145 lines not on this page · raw message
xen/common/tmem_xen.c +4 -4
@@ -146,7 +146,7 @@ static inline void cli_put_page(void *cli_va, pfp_t *cli_pfp, EXPORT int tmh_copy_from_client(pfp_t *pfp,tmem_cli_mfn_t cmfn,pagesize_t tmem_offset, -pagesize_t pfn_offset,pagesize_t len,tmem_cli_va_t clibuf) +pagesize_t pfn_offset,pagesize_t len,tmem_cli_va_param_t clibuf) {unsigned long tmem_mfn, cli_mfn =0 ;char *tmem_va, *cli_va =NULL ;
@@ -194,7 +194,7 @@ EXPORT int tmh_copy_from_client(pfp_t *pfp, } EXPORT int tmh_compress_from_client(tmem_cli_mfn_t cmfn, -void **out_va,size_t *out_len,tmem_cli_va_t clibuf) +void **out_va,size_t *out_len,tmem_cli_va_param_t clibuf) {int ret =0 ;unsigned char *dmem =this_cpu (dstmem);
@@ -227,7 +227,7 @@ EXPORT int tmh_compress_from_client(tmem_cli_mfn_t cmfn, EXPORT int tmh_copy_to_client(tmem_cli_mfn_t cmfn, pfp_t *pfp,pagesize_t tmem_offset,pagesize_t pfn_offset,pagesize_t len, -tmem_cli_va_t clibuf) +tmem_cli_va_param_t clibuf) {unsigned long tmem_mfn, cli_mfn =0 ;char *tmem_va, *cli_va =NULL ;
@@ -265,7 +265,7 @@ EXPORT int tmh_copy_to_client(tmem_cli_mfn_t cmfn, pfp_t *pfp, } EXPORT int tmh_decompress_to_client(tmem_cli_mfn_t cmfn, void *tmem_va, -size_t size,tmem_cli_va_t clibuf) +size_t size,tmem_cli_va_param_t clibuf) {unsigned long cli_mfn =0 ;pfp_t *cli_pfp =NULL ;
xen/common/xenoprof.c +4 -4
@@ -404,7 +404,7 @@ static int add_active_list(domid_t domid)return 0 ; } -static int add_passive_list (XEN_GUEST_HANDLE (void ) arg) +static int add_passive_list (XEN_GUEST_HANDLE_PARAM (void ) arg) {struct xenoprof_passive passive;struct domain *d;
@@ -585,7 +585,7 @@ void xenoprof_log_event(struct vcpu *vcpu, const struct cpu_user_regs *regs, -static int xenoprof_op_init (XEN_GUEST_HANDLE (void ) arg) +static int xenoprof_op_init (XEN_GUEST_HANDLE_PARAM (void ) arg) {struct domain *d = current->domain;struct xenoprof_init xenoprof_init;
@@ -611,7 +611,7 @@ static int xenoprof_op_init(XEN_GUEST_HANDLE(void) arg)#endif /* !COMPAT */ -static int xenoprof_op_get_buffer (XEN_GUEST_HANDLE (void ) arg) +static int xenoprof_op_get_buffer (XEN_GUEST_HANDLE_PARAM (void ) arg) {struct xenoprof_get_buffer xenoprof_get_buffer;struct domain *d = current->domain;
@@ -662,7 +662,7 @@ static int xenoprof_op_get_buffer(XEN_GUEST_HANDLE(void) arg) || (op == XENOPROF_disable_virq) \ || (op == XENOPROF_get_buffer)) -ret_t do_xenoprof_op (int op,XEN_GUEST_HANDLE (void ) arg) +ret_t do_xenoprof_op (int op,XEN_GUEST_HANDLE_PARAM (void ) arg) {int ret =0 ;
xen/drivers/acpi/pmstat.c +1 -1
@@ -496,7 +496,7 @@ int do_pm_op(struct xen_sysctl_pm_op *op)return ret; } -int acpi_set_pdc_bits (u32 acpi_id,XEN_GUEST_HANDLE (uint32) pdc) +int acpi_set_pdc_bits (u32 acpi_id,XEN_GUEST_HANDLE_PARAM (uint32) pdc) {u32 bits[3 ];int ret;
xen/drivers/char/console.c +3 -3
@@ -182,7 +182,7 @@ static void putchar_console_ring(int c)long read_console_ring (struct xen_sysctl_readconsole *op) { -XEN_GUEST_HANDLE (char ) str; +XEN_GUEST_HANDLE_PARAM (char ) str;uint32_t idx, len, max, sofar, c; str = guest_handle_cast(op->buffer, char),
@@ -363,7 +363,7 @@ static void notify_dom0_con_ring(unsigned long unused) static DECLARE_SOFTIRQ_TASKLET(notify_dom0_con_ring_tasklet, notify_dom0_con_ring, 0); -static long guest_console_write (XEN_GUEST_HANDLE (char ) buffer,int count) +static long guest_console_write (XEN_GUEST_HANDLE_PARAM (char ) buffer,int count) {char kbuf[128 ], *kptr;int kcount;
@@ -401,7 +401,7 @@ static long guest_console_write(XEN_GUEST_HANDLE(char) buffer, int count)return 0 ; } -long do_console_io (int cmd,int count,XEN_GUEST_HANDLE (char ) buffer) +long do_console_io (int cmd,int count,XEN_GUEST_HANDLE_PARAM (char ) buffer) {long rc;unsigned int idx, len;
xen/drivers/passthrough/iommu.c +1 -1
@@ -527,7 +527,7 @@ void iommu_crash_shutdown(void)int iommu_do_domctl (struct xen_domctl *domctl, -XEN_GUEST_HANDLE (xen_domctl_t) u_domctl) +XEN_GUEST_HANDLE_PARAM (xen_domctl_t) u_domctl) {struct domain *d;u16 seg;
xen/include/asm-arm/hypercall.h +1 -1
@@ -2,7 +2,7 @@#define __ASM_ARM_HYPERCALL_H__#include <public/domctl.h> /* for arch_do_domctl */ -int do_physdev_op (int cmd,XEN_GUEST_HANDLE (void ) arg); +int do_physdev_op (int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg);#endif /* __ASM_ARM_HYPERCALL_H__ */ /*
xen/include/asm-arm/mm.h +1 -1
@@ -267,7 +267,7 @@ static inline int relinquish_shared_pages(struct domain *d)/* Arch-specific portion of memory_op hypercall. */ -long arch_memory_op (int op,XEN_GUEST_HANDLE (void ) arg); +long arch_memory_op (int op,XEN_GUEST_HANDLE_PARAM (void ) arg);int steal_page (struct domain *d,struct page_info *page,unsigned int memflags);
xen/include/asm-x86/hap.h +1 -1
@@ -51,7 +51,7 @@ hap_unmap_domain_page(void *p)/************************************************/ void hap_domain_init (struct domain *d);int hap_domctl (struct domain *d,xen_domctl_shadow_op_t *sc, -XEN_GUEST_HANDLE (void ) u_domctl); +XEN_GUEST_HANDLE_PARAM (void ) u_domctl);int hap_enable (struct domain *d,u32 mode);void hap_final_teardown (struct domain *d);void hap_teardown (struct domain *d);
xen/include/asm-x86/hypercall.h +11 -11
@@ -18,22 +18,22 @@extern long do_event_channel_op_compat ( -XEN_GUEST_HANDLE (evtchn_op_t) uop); +XEN_GUEST_HANDLE_PARAM (evtchn_op_t) uop);extern long do_set_trap_table ( -XEN_GUEST_HANDLE (const_trap_info_t) traps); +XEN_GUEST_HANDLE_PARAM (const_trap_info_t) traps);extern long do_mmu_update ( -XEN_GUEST_HANDLE (mmu_update_t) ureqs, +XEN_GUEST_HANDLE_PARAM (mmu_update_t) ureqs,unsigned int count, -XEN_GUEST_HANDLE (uint) pdone, +XEN_GUEST_HANDLE_PARAM (uint) pdone,unsigned int foreigndom);extern long do_set_gdt ( -XEN_GUEST_HANDLE (ulong) frame_list, +XEN_GUEST_HANDLE_PARAM (ulong) frame_list,unsigned int entries); extern long
@@ -60,7 +60,7 @@ do_update_descriptor( u64 desc);extern long -do_mca (XEN_GUEST_HANDLE (xen_mc_t) u_xen_mc); +do_mca (XEN_GUEST_HANDLE_PARAM (xen_mc_t) u_xen_mc);extern long do_update_va_mapping(
@@ -70,7 +70,7 @@ do_update_va_mapping(extern long do_physdev_op ( -int cmd,XEN_GUEST_HANDLE (void ) arg); +int cmd,XEN_GUEST_HANDLE_PARAM (void ) arg);extern long do_update_va_mapping_otherdomain(
@@ -81,9 +81,9 @@ do_update_va_mapping_otherdomain(extern long do_mmuext_op ( -XEN_GUEST_HANDLE (mmuext_op_t) uops, +XEN_GUEST_HANDLE_PARAM (mmuext_op_t) uops,unsigned int count, -XEN_GUEST_HANDLE (uint) pdone, +XEN_GUEST_HANDLE_PARAM (uint) pdone,unsigned int foreigndom); extern unsigned long
@@ -104,10 +104,10 @@ do_set_segment_base(extern int compat_physdev_op (int cmd, -XEN_GUEST_HANDLE (void ) arg); +XEN_GUEST_HANDLE_PARAM (void ) arg);extern int arch_compat_vcpu_op ( -int cmd,struct vcpu *v,XEN_GUEST_HANDLE (void ) arg); +int cmd,struct vcpu *v,XEN_GUEST_HANDLE_PARAM (void ) arg);#endif /* __ASM_X86_HYPERCALL_H__ */
xen/include/asm-x86/mem_event.h +1 -1
@@ -65,7 +65,7 @@ int mem_event_get_response(struct domain *d, struct mem_event_domain *med,struct domain *get_mem_event_op_target (uint32_t domain,int *rc);int do_mem_event_op (int op,uint32_t domain,void *arg);int mem_event_domctl (struct domain *d,xen_domctl_mem_event_op_t *mec, -XEN_GUEST_HANDLE (void ) u_domctl); +XEN_GUEST_HANDLE_PARAM (void ) u_domctl);#endif /* __MEM_EVENT_H__ */
xen/include/asm-x86/mm.h +4 -4
@@ -555,10 +555,10 @@ void *do_page_walk(struct vcpu *v, unsigned long addr);int __sync_local_execstate (void );/* Arch-specific portion of memory_op hypercall. */ -long arch_memory_op (int op,XEN_GUEST_HANDLE (void ) arg); -long subarch_memory_op (int op,XEN_GUEST_HANDLE (void ) arg); -int compat_arch_memory_op (int op,XEN_GUEST_HANDLE (void )); -int compat_subarch_memory_op (int op,XEN_GUEST_HANDLE (void )); +long arch_memory_op (int op,XEN_GUEST_HANDLE_PARAM (void ) arg); +long subarch_memory_op (int op,XEN_GUEST_HANDLE_PARAM (void ) arg); +int compat_arch_memory_op (int op,XEN_GUEST_HANDLE_PARAM (void )); +int compat_subarch_memory_op (int op,XEN_GUEST_HANDLE_PARAM (void ));int steal_page (struct domain *d,struct page_info *page,unsigned int memflags);
xen/include/asm-x86/paging.h +1 -1
@@ -207,7 +207,7 @@ int paging_domain_init(struct domain *d, unsigned int domcr_flags);* and disable ephemeral shadow modes (test mode and log-dirty mode) and * manipulate the log-dirty bitmap. */ int paging_domctl (struct domain *d,xen_domctl_shadow_op_t *sc, -XEN_GUEST_HANDLE (void ) u_domctl); +XEN_GUEST_HANDLE_PARAM (void ) u_domctl);/* Call when destroying a domain */ void paging_teardown (struct domain *d);
xen/include/asm-x86/processor.h +1 -1
@@ -549,7 +549,7 @@ int rdmsr_hypervisor_regs(uint32_t idx, uint64_t *val);int wrmsr_hypervisor_regs (uint32_t idx,uint64_t val);void microcode_set_module (unsigned int ); -int microcode_update (XEN_GUEST_HANDLE (const_void ),unsigned long len); +int microcode_update (XEN_GUEST_HANDLE_PARAM (const_void ),unsigned long len);int microcode_resume_cpu (int cpu);#endif /* !__ASSEMBLY__ */
xen/include/asm-x86/shadow.h +1 -1
@@ -73,7 +73,7 @@ int shadow_track_dirty_vram(struct domain *d,* manipulate the log-dirty bitmap. */ int shadow_domctl (struct domain *d,xen_domctl_shadow_op_t *sc, -XEN_GUEST_HANDLE (void ) u_domctl); +XEN_GUEST_HANDLE_PARAM (void ) u_domctl);/* Call when destroying a domain */ void shadow_teardown (struct domain *d);
xen/include/asm-x86/xenoprof.h +3 -3
@@ -40,9 +40,9 @@ int xenoprof_arch_init(int *num_events, char *cpu_type);#define xenoprof_arch_disable_virq () nmi_disable_virq()#define xenoprof_arch_release_counters () nmi_release_counters() -int xenoprof_arch_counter (XEN_GUEST_HANDLE (void ) arg); -int compat_oprof_arch_counter (XEN_GUEST_HANDLE (void ) arg); -int xenoprof_arch_ibs_counter (XEN_GUEST_HANDLE (void ) arg); +int xenoprof_arch_counter (XEN_GUEST_HANDLE_PARAM (void ) arg); +int compat_oprof_arch_counter (XEN_GUEST_HANDLE_PARAM (void ) arg); +int xenoprof_arch_ibs_counter (XEN_GUEST_HANDLE_PARAM (void ) arg);struct vcpu ;struct cpu_user_regs ;
xen/include/xen/acpi.h +2 -2
@@ -145,8 +145,8 @@ static inline unsigned int acpi_get_cstate_limit(void) { return 0; }static inline void acpi_set_cstate_limit (unsigned int new_limit) {return ; }#endif -#ifdef XEN_GUEST_HANDLE -int acpi_set_pdc_bits (u32 acpi_id,XEN_GUEST_HANDLE (uint32 )); +#ifdef XEN_GUEST_HANDLE_PARAM +int acpi_set_pdc_bits (u32 acpi_id,XEN_GUEST_HANDLE_PARAM (uint32 ));#endif int arch_acpi_set_pdc_bits (u32 acpi_id,u32 *,u32 mask);
xen/include/xen/compat.h +3 -0
@@ -22,6 +22,9 @@ __DEFINE_COMPAT_HANDLE(const_ ## name, const name)#define COMPAT_HANDLE (name) __compat_handle_ ## name +/* NB: it is assumed that if an arch uses the compat layer it does not +* distinguish handles from parameter handles. */ +#define COMPAT_HANDLE_PARAM (name) __compat_handle_ ## name/* Is the compat handle a NULL reference? */ #define compat_handle_is_null (hnd) ((hnd).c == 0)
xen/include/xen/hypercall.h +26 -26
161 lines not on this page · raw message
xen/include/xen/iommu.h +1 -1
@@ -156,7 +156,7 @@ void iommu_crash_shutdown(void);void iommu_set_dom0_mapping (struct domain *d);void iommu_share_p2m_table (struct domain *d); -int iommu_do_domctl (struct xen_domctl *,XEN_GUEST_HANDLE (xen_domctl_t )); +int iommu_do_domctl (struct xen_domctl *,XEN_GUEST_HANDLE_PARAM (xen_domctl_t ));void iommu_iotlb_flush (struct domain *d,unsigned long gfn,unsigned int page_count);void iommu_iotlb_flush_all (struct domain *d);
xen/include/xen/tmem_xen.h +11 -7
@@ -430,7 +430,8 @@ static inline void tmh_tze_copy_from_pfp(void *tva, pfp_t *pfp, pagesize_t len)typedef XEN_GUEST_HANDLE(void) cli_mfn_t; typedef XEN_GUEST_HANDLE(char) cli_va_t; */ -typedef XEN_GUEST_HANDLE (tmem_op_t)tmem_cli_op_t ; +typedef XEN_GUEST_HANDLE_PARAM (tmem_op_t)tmem_cli_op_t ; +typedef XEN_GUEST_HANDLE_PARAM (char )tmem_cli_va_param_t ;static inline int tmh_get_tmemop_from_client (tmem_op_t *op,tmem_cli_op_t uops) {
@@ -466,8 +467,9 @@ static inline int tmh_get_tmemop_from_client(tmem_op_t *op, tmem_cli_op_t uops)#define tmh_cli_buf_null guest_handle_from_ptr(NULL, char) -static inline void tmh_copy_to_client_buf_offset (tmem_cli_va_t clibuf,int off, -char *tmembuf,int len) +static inline void tmh_copy_to_client_buf_offset (tmem_cli_va_param_t clibuf, +int off, +char *tmembuf,int len) {copy_to_guest_offset (clibuf,off,tmembuf,len); }
@@ -482,15 +484,17 @@ static inline void tmh_copy_to_client_buf_offset(tmem_cli_va_t clibuf, int off,#define tmh_cli_id_str "domid"#define tmh_client_str "domain" -int tmh_decompress_to_client (tmem_cli_mfn_t ,void *,size_t ,tmem_cli_va_t ); +int tmh_decompress_to_client (tmem_cli_mfn_t ,void *,size_t , +tmem_cli_va_param_t ); -int tmh_compress_from_client (tmem_cli_mfn_t ,void **,size_t *,tmem_cli_va_t ); +int tmh_compress_from_client (tmem_cli_mfn_t ,void **,size_t *, +tmem_cli_va_param_t );int tmh_copy_from_client (pfp_t *,tmem_cli_mfn_t ,pagesize_t tmem_offset, -pagesize_t pfn_offset,pagesize_t len,tmem_cli_va_t ); +pagesize_t pfn_offset,pagesize_t len,tmem_cli_va_param_t );int tmh_copy_to_client (tmem_cli_mfn_t ,pfp_t *,pagesize_t tmem_offset, -pagesize_t pfn_offset,pagesize_t len,tmem_cli_va_t ); +pagesize_t pfn_offset,pagesize_t len,tmem_cli_va_param_t );extern int tmh_copy_tze_to_client (tmem_cli_mfn_t cmfn,void *tmem_va,pagesize_t len);
xen/include/xsm/xsm.h +2 -2
@@ -139,7 +139,7 @@ struct xsm_operations {int (*cpupool_op)(void );int (*sched_op)(void ); -long (*__do_xsm_op) (XEN_GUEST_HANDLE (xsm_op_t) op); +long (*__do_xsm_op) (XEN_GUEST_HANDLE_PARAM (xsm_op_t) op);#ifdef CONFIG_X86 int (*shadow_control) (struct domain *d,uint32_t op);
@@ -585,7 +585,7 @@ static inline int xsm_sched_op(void)return xsm_call (sched_op ()); } -static inline long __do_xsm_op (XEN_GUEST_HANDLE (xsm_op_t) op) +static inline long __do_xsm_op (XEN_GUEST_HANDLE_PARAM (xsm_op_t) op) {#ifdef XSM_ENABLE return xsm_ops->__do_xsm_op (op);
xen/xsm/dummy.c +1 -1
@@ -380,7 +380,7 @@ static int dummy_sched_op (void)return 0 ; } -static long dummy___do_xsm_op (XEN_GUEST_HANDLE (xsm_op_t) op) +static long dummy___do_xsm_op (XEN_GUEST_HANDLE_PARAM (xsm_op_t) op) {return -ENOSYS ; }
xen/xsm/flask/flask_op.c +2 -2
@@ -71,7 +71,7 @@ static int domain_has_security(struct domain *d, u32 perms) perms, NULL); } -static int flask_copyin_string (XEN_GUEST_HANDLE (char ) u_buf,char **buf,uint32_t size) +static int flask_copyin_string (XEN_GUEST_HANDLE_PARAM (char ) u_buf,char **buf,uint32_t size) {char *tmp =xmalloc_bytes (size +1 );if ( !tmp )
@@ -618,7 +618,7 @@ static int flask_relabel_domain(struct xen_flask_relabel *arg)return rc; } -long do_flask_op (XEN_GUEST_HANDLE (xsm_op_t) u_flask_op) +long do_flask_op (XEN_GUEST_HANDLE_PARAM (xsm_op_t) u_flask_op) {xen_flask_op_t op;int rv;
xen/xsm/flask/hooks.c +1 -1
@@ -1462,7 +1462,7 @@ static int flask_vcpuextstate (struct domain *d, uint32_t cmd) }#endif -long do_flask_op (XEN_GUEST_HANDLE (xsm_op_t) u_flask_op); +long do_flask_op (XEN_GUEST_HANDLE_PARAM (xsm_op_t) u_flask_op);static struct xsm_operations flask_ops = { .security_domaininfo = flask_security_domaininfo,
xen/xsm/xsm_core.c +1 -1
@@ -111,7 +111,7 @@ int unregister_xsm(struct xsm_operations *ops)#endif -long do_xsm_op (XEN_GUEST_HANDLE (xsm_op_t) op) +long do_xsm_op (XEN_GUEST_HANDLE_PARAM (xsm_op_t) op) {return __do_xsm_op (op); }
Signature · 1 line
1.7.9.1
PATCH v2 8/10 xen: more XEN_GUEST_HANDLE_PARAM substitutions
In reply to Ian CampbellFrom: Stefano Stabellini <[email protected]>
More substitutions in this patch, not as obvious as the ones in the previous patch.
---
ijc v2:
- Avoid _t suffix on variable names, use _param instead.
--- xen/arch/x86/mm.c | 12 +++++++++--- xen/arch/x86/oprofile/backtrace.c | 5 ++++- xen/arch/x86/platform_hypercall.c | 10 +++++++--- xen/arch/x86/x86_64/cpu_idle.c | 4 +++- xen/arch/x86/x86_64/cpufreq.c | 4 +++- xen/arch/x86/x86_64/platform_hypercall.c | 1 + xen/common/compat/multicall.c | 1 + xen/common/multicall.c | 2 +- 8 files changed, 29 insertions(+), 10 deletions(-)
xen/arch/x86/mm.c +9 -3
@@ -2913,7 +2913,9 @@ long do_mmuext_op( {cpumask_t pmask; -if (unlikely (vcpumask_to_pcpumask (d, op.arg2.vcpumask, &pmask)) ) +if (unlikely (vcpumask_to_pcpumask (d, +guest_handle_to_param (op.arg2.vcpumask, const_void), + &pmask)) ) { okay =0 ;break ;
@@ -4195,6 +4197,7 @@ static int handle_iomem_range(unsigned long s, unsigned long e, void *p)if ( s > ctxt->s ) {e820entry_t ent; +XEN_GUEST_HANDLE_PARAM (e820entry_t) buffer_param;XEN_GUEST_HANDLE (e820entry_t) buffer;if ( ctxt->n +1 >= ctxt->map.nr_entries )
@@ -4202,7 +4205,8 @@ static int handle_iomem_range(unsigned long s, unsigned long e, void *p) ent.addr = (uint64_t )ctxt->s <<PAGE_SHIFT ; ent.size = (uint64_t )(s - ctxt->s) <<PAGE_SHIFT ; ent.type =E820_RESERVED ; - buffer =guest_handle_cast (ctxt->map.buffer, e820entry_t); + buffer_param =guest_handle_cast (ctxt->map.buffer, e820entry_t); + buffer =guest_handle_from_param (buffer_param, e820entry_t);if (__copy_to_guest_offset (buffer, ctxt->n, &ent,1 ) )return -EFAULT ; ctxt->n++;
@@ -4499,6 +4503,7 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg) {struct memory_map_context ctxt;XEN_GUEST_HANDLE (e820entry_t) buffer; +XEN_GUEST_HANDLE_PARAM (e820entry_t) buffer_param;unsigned int i;if ( !IS_PRIV (current->domain) )
@@ -4513,7 +4518,8 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg)if ( ctxt.map.nr_entries < e820.nr_map +1 )return -EINVAL ; - buffer =guest_handle_cast (ctxt.map.buffer, e820entry_t); + buffer_param =guest_handle_cast (ctxt.map.buffer, e820entry_t); + buffer =guest_handle_from_param (buffer_param, e820entry_t);if ( !guest_handle_okay (buffer, ctxt.map.nr_entries) )return -EFAULT ;
xen/arch/x86/oprofile/backtrace.c +4 -1
@@ -74,8 +74,11 @@ dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head, }else { -XEN_GUEST_HANDLE (const_frame_head_t) guest_head = +XEN_GUEST_HANDLE (const_frame_head_t) guest_head; +XEN_GUEST_HANDLE_PARAM (const_frame_head_t) guest_head_param =const_guest_handle_from_ptr (head, frame_head_t); + guest_head =guest_handle_from_param (guest_head_param, + const_frame_head_t);/* Also check accessibility of one struct frame_head beyond */ if (!guest_handle_okay (guest_head,2 ))
xen/arch/x86/platform_hypercall.c +7 -3
@@ -61,7 +61,7 @@ long cpu_down_helper(void *data);long core_parking_helper (void *data);uint32_t get_cur_idle_nums (void ); -ret_t do_platform_op (XEN_GUEST_HANDLE (xen_platform_op_t) u_xenpf_op) +ret_t do_platform_op (XEN_GUEST_HANDLE_PARAM (xen_platform_op_t) u_xenpf_op) {ret_t ret =0 ;struct xen_platform_op curop, *op = &curop;
@@ -186,7 +186,9 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op) } } - ret =microcode_update (data, op->u.microcode.length); + ret =microcode_update ( +guest_handle_to_param (data, const_void), + op->u.microcode.length);spin_unlock (&vcpu_alloc_lock); }break ;
@@ -454,7 +456,9 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)XEN_GUEST_HANDLE (uint32) pdc;guest_from_compat_handle (pdc, op->u.set_pminfo.u.pdc); - ret =acpi_set_pdc_bits (op->u.set_pminfo.id, pdc); + ret =acpi_set_pdc_bits ( + op->u.set_pminfo.id, +guest_handle_to_param (pdc, uint32)); }break ;
xen/arch/x86/x86_64/cpu_idle.c +3 -1
@@ -57,10 +57,12 @@ static int copy_from_compat_state(xen_processor_cx_t *xen_state, {#define XLAT_processor_cx_HNDL_dp (_d_, _s_) do { \ XEN_GUEST_HANDLE(compat_processor_csd_t) dps; \ + XEN_GUEST_HANDLE_PARAM(xen_processor_csd_t) dps_param; \ if ( unlikely(!compat_handle_okay((_s_)->dp, (_s_)->dpcnt)) ) \ return -EFAULT; \ guest_from_compat_handle(dps, (_s_)->dp); \ - (_d_)->dp = guest_handle_cast(dps, xen_processor_csd_t); \ + dps_param = guest_handle_cast(dps, xen_processor_csd_t); \ + (_d_)->dp = guest_handle_from_param(dps_param, xen_processor_csd_t); \ } while (0)XLAT_processor_cx (xen_state, state);#undef XLAT_processor_cx_HNDL_dp
xen/arch/x86/x86_64/cpufreq.c +3 -1
@@ -45,10 +45,12 @@ compat_set_px_pminfo(uint32_t cpu, struct compat_processor_performance *perf)#define XLAT_processor_performance_HNDL_states (_d_, _s_) do { \ XEN_GUEST_HANDLE(compat_processor_px_t) states; \ + XEN_GUEST_HANDLE_PARAM(xen_processor_px_t) states_t; \ if ( unlikely(!compat_handle_okay((_s_)->states, (_s_)->state_count)) ) \ return -EFAULT; \ guest_from_compat_handle(states, (_s_)->states); \ - (_d_)->states = guest_handle_cast(states, xen_processor_px_t); \ + states_t = guest_handle_cast(states, xen_processor_px_t); \ + (_d_)->states = guest_handle_from_param(states_t, xen_processor_px_t); \ } while (0)XLAT_processor_performance (xen_perf, perf);
xen/arch/x86/x86_64/platform_hypercall.c +1 -0
@@ -38,6 +38,7 @@ CHECK_pf_pcpu_version;#define COMPAT #define _XEN_GUEST_HANDLE (t) XEN_GUEST_HANDLE(t) +#define _XEN_GUEST_HANDLE_PARAM (t) XEN_GUEST_HANDLE_PARAM(t)typedef int ret_t ;#include "../platform_hypercall.c"
xen/common/compat/multicall.c +1 -0
@@ -25,6 +25,7 @@ DEFINE_XEN_GUEST_HANDLE(multicall_entry_compat_t);#define call compat_call#define do_multicall (l, n) compat_multicall(_##l, n)#define _XEN_GUEST_HANDLE (t) XEN_GUEST_HANDLE(t) +#define _XEN_GUEST_HANDLE_PARAM (t) XEN_GUEST_HANDLE(t)static void __trace_multicall_call (multicall_entry_t *call) {
xen/common/multicall.c +1 -1
@@ -35,7 +35,7 @@ static void trace_multicall_call(multicall_entry_t *call)ret_t do_multicall ( -XEN_GUEST_HANDLE (multicall_entry_t) call_list,unsigned int nr_calls) +XEN_GUEST_HANDLE_PARAM (multicall_entry_t) call_list,unsigned int nr_calls) {struct mc_state *mcs = ¤t->mc_state;unsigned int i;
Signature · 1 line
1.7.9.1
PATCH v2 9/10 xen: remove XEN_GUEST_HANDLE(ulong)
In reply to Ian CampbellHaving both this handle (always unsigned long) and XEN_GUEST_HANDLE(xen_ulong_t) (unsigned long on x86 and explicit size of ARM) is confusing and error prone.
Replace the two remaining uses of the ulong handle, in grant set and x86 set_gdt hypercalls, with xen_ulong_t.
This correctly sizes the grant frame entry as 64 bit on ARM but leaves it as unsigned long on x86 (therefore no intended change on x86). Likewise in set_gdt there is no actual change.
--- xen/arch/x86/mm.c | 3 ++- xen/common/grant_table.c | 2 +- xen/include/asm-x86/hypercall.h | 2 +- xen/include/public/grant_table.h | 2 +- xen/include/public/xen.h | 2 -- 5 files changed, 5 insertions(+), 6 deletions(-)
xen/arch/x86/mm.c +2 -1
@@ -4100,7 +4100,8 @@ long set_gdt(struct vcpu *v, } -long do_set_gdt (XEN_GUEST_HANDLE_PARAM (ulong) frame_list,unsigned int entries) +long do_set_gdt (XEN_GUEST_HANDLE_PARAM (xen_ulong_t) frame_list, +unsigned int entries) {int nr_pages = (entries +511 ) /512 ;unsigned long frames[16 ];
xen/common/grant_table.c +1 -1
@@ -1322,7 +1322,7 @@ gnttab_setup_table(struct domain *d;struct grant_table *gt;int i; -unsigned long gmfn; +xen_pfn_t gmfn;if ( count !=1 )return -EINVAL ;
xen/include/asm-x86/hypercall.h +1 -1
@@ -33,7 +33,7 @@ do_mmu_update(extern long do_set_gdt ( -XEN_GUEST_HANDLE_PARAM (ulong) frame_list, +XEN_GUEST_HANDLE_PARAM (xen_ulong_t) frame_list,unsigned int entries); extern long
xen/include/public/grant_table.h +1 -1
@@ -385,7 +385,7 @@ struct gnttab_setup_table {uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* => enum grant_status */ -XEN_GUEST_HANDLE (ulong) frame_list; +XEN_GUEST_HANDLE (xen_pfn_t) frame_list; };typedef struct gnttab_setup_table gnttab_setup_table_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_t);
xen/include/public/xen.h +0 -2
@@ -43,8 +43,6 @@ DEFINE_XEN_GUEST_HANDLE(char); __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);DEFINE_XEN_GUEST_HANDLE (int); __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); -DEFINE_XEN_GUEST_HANDLE (long); -__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);DEFINE_XEN_GUEST_HANDLE (void);DEFINE_XEN_GUEST_HANDLE (uint64_t);
Signature · 1 line
1.7.9.1
Re: [PATCH 09/10] xen: remove XEN_GUEST_HANDLE(ulong)
Quoted 7 lines · Ian Campbell
Having both this handle (always unsigned long) and
XEN_GUEST_HANDLE(xen_ulong_t)(unsigned long on x86 and explicit size of ARM) is confusing and error prone.Replace the two remaining uses of the ulong handle, in grant set and x86
set_gdthypercalls, withxen_ulong_t.
Quoted 7 lines
This correctly sizes the grant frame entry as 64 bit on ARM but leaves it as unsigned long on x86 (therefore no intended change on x86). Likewise in
set_gdtthere is no actual change.
Quoted 76 lines
xen/arch/x86/mm.c | 3 ++- xen/common/grant_table.c | 2 +- xen/include/asm-x86/hypercall.h | 2 +- xen/include/public/grant_table.h | 2 +- xen/include/public/xen.h | 2 -- 5 files changed, 5 insertions(+), 6 deletions(-)xen/arch/x86/mm.c +2
-1@@ -4100,7 +4100,8 @@ long set_gdt(struct vcpu *v, } -long do_set_gdt (XEN_GUEST_HANDLE_PARAM (ulong) frame_list,unsigned int entries) +long do_set_gdt (XEN_GUEST_HANDLE_PARAM (xen_ulong_t) frame_list, +unsigned int entries) {int nr_pages = (entries +511 ) /512 ;unsigned long frames[16 ];xen/common/grant_table.c +1
-1@@ -1322,7 +1322,7 @@ gnttab_setup_table(struct domain *d;struct grant_table *gt;int i; -unsigned long gmfn; +xen_pfn_t gmfn;if ( count !=1 )return -EINVAL ;xen/include/asm-x86/hypercall.h +1
-1@@ -33,7 +33,7 @@ do_mmu_update(extern long do_set_gdt ( -XEN_GUEST_HANDLE_PARAM (ulong) frame_list, +XEN_GUEST_HANDLE_PARAM (xen_ulong_t) frame_list,unsigned int entries); extern longxen/include/public/grant_table.h +1
-1@@ -385,7 +385,7 @@ struct gnttab_setup_table {uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* => enum grant_status */ -XEN_GUEST_HANDLE (ulong) frame_list; +XEN_GUEST_HANDLE (xen_pfn_t) frame_list; };typedef struct gnttab_setup_table gnttab_setup_table_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_t);xen/include/public/xen.h +0
-2@@ -43,8 +43,6 @@ DEFINE_XEN_GUEST_HANDLE(char); __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);DEFINE_XEN_GUEST_HANDLE (int); __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); -DEFINE_XEN_GUEST_HANDLE (long); -__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);DEFINE_XEN_GUEST_HANDLE (void);DEFINE_XEN_GUEST_HANDLE (uint64_t);Signature · 1 line
1.7.9.1
Re: [PATCH 09/10] xen: remove XEN_GUEST_HANDLE(ulong)
In reply to Ian CampbellQuoted 15 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
xen/include/public/grant_table.h +1
-1@@ -385,7 +385,7 @@ struct gnttab_setup_table {uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* => enum grant_status */ -XEN_GUEST_HANDLE (ulong) frame_list; +XEN_GUEST_HANDLE (xen_pfn_t) frame_list; };typedef struct gnttab_setup_table gnttab_setup_table_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_t);
xen/include/public/xen.h DEFINE_XEN_GUEST_HANDLE(char); · line 48
Quoted 8 lines
xen/include/public/xen.h +0
-2@@ -43,8 +43,6 @@ DEFINE_XEN_GUEST_HANDLE(char); __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);DEFINE_XEN_GUEST_HANDLE (int); __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); -DEFINE_XEN_GUEST_HANDLE (long); -__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);DEFINE_XEN_GUEST_HANDLE (void);DEFINE_XEN_GUEST_HANDLE (uint64_t);
These two must be wrapped in __XEN_INTERFACE_VERSION__ conditionals (and __XEN_LATEST_INTERFACE_VERSION__ needs to be bumped accordingly), since the various guest handles are distinct types (i.e. consumers will fail to build if not updated).
Jan
Re: [PATCH 09/10] xen: remove XEN_GUEST_HANDLE(ulong)
Quoted 22 lines · Jan Beulich
Quoted 22 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
xen/include/public/grant_table.h +1
-1@@ -385,7 +385,7 @@ struct gnttab_setup_table {uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* => enum grant_status */ -XEN_GUEST_HANDLE (ulong) frame_list; +XEN_GUEST_HANDLE (xen_pfn_t) frame_list; };typedef struct gnttab_setup_table gnttab_setup_table_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_t);xen/include/public/xen.h +0
-2@@ -43,8 +43,6 @@ DEFINE_XEN_GUEST_HANDLE(char); __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);DEFINE_XEN_GUEST_HANDLE (int); __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); -DEFINE_XEN_GUEST_HANDLE (long); -__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);DEFINE_XEN_GUEST_HANDLE (void);
Quoted 6 lines
xen/include/public/xen.h DEFINE_XEN_GUEST_HANDLE(char); · line 48
Quoted 1 line
xen/include/public/xen.h +0
-0DEFINE_XEN_GUEST_HANDLE (uint64_t);These two must be wrapped in
__XEN_INTERFACE_VERSION__conditionals (and__XEN_LATEST_INTERFACE_VERSION__needs to be bumped accordingly), since the various guest handles are distinct types (i.e. consumers will fail to build if not updated).
Are there external consumers of gnttab_setup_table?
Nevertheless, here is the fix.
8<-----------------------------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1350544609 -3600
# Node ID 68f0f7ed3e7b3b7b4b9dbc692a448421ebc31035 # Parent 5c402b905e00fb0871c3f439c8391dd3cfb3bc10
xen: retain ulong guest handle for older consumers.
26072:5529b91bd2e4 removed this but we need to keep it around for older consumers. Bump __XEN_LATEST_INTERFACE_VERSION__ accordingly.
xen/include/public/grant_table.h +4 -0
@@ -385,7 +385,11 @@ struct gnttab_setup_table {uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* => enum grant_status */ +#if __XEN_INTERFACE_VERSION__ <0x00040300 +XEN_GUEST_HANDLE (ulong) frame_list; +#else XEN_GUEST_HANDLE (xen_pfn_t) frame_list; +#endif };typedef struct gnttab_setup_table gnttab_setup_table_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_t);
xen/include/public/xen-compat.h +1 -1
@@ -27,7 +27,7 @@#ifndef __XEN_PUBLIC_XEN_COMPAT_H__#define __XEN_PUBLIC_XEN_COMPAT_H__ -#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200 +#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040300#if defined(__XEN__) || defined(__XEN_TOOLS__)/* Xen is built with matching headers and implements the latest interface. */
xen/include/public/xen.h +4 -0
@@ -43,6 +43,10 @@ DEFINE_XEN_GUEST_HANDLE(char); __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);DEFINE_XEN_GUEST_HANDLE (int); __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); +#if __XEN_INTERFACE_VERSION__ <0x00040300 +DEFINE_XEN_GUEST_HANDLE (long); +__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long); +#endif DEFINE_XEN_GUEST_HANDLE (void);DEFINE_XEN_GUEST_HANDLE (uint64_t);
Jan Beulich
Acked-byRe: [PATCH 09/10] xen: remove XEN_GUEST_HANDLE(ulong)
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 5 lines · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line · Ian Campbell
These two must be wrapped in
__XEN_INTERFACE_VERSION__conditionals (and__XEN_LATEST_INTERFACE_VERSION__needs to be bumped accordingly), since the various guest handles are distinct types (i.e. consumers will fail to build if not updated).Are there external consumers of
gnttab_setup_table?
We can't know - it's a public, not tools-only interface.
Quoted 11 lines
Nevertheless, here is the fix.
8<-----------------------------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1350544609 -3600
# Node ID68f0f7ed3e7b3b7b4b9dbc692a448421ebc31035# Parent5c402b905e00fb0871c3f439c8391dd3cfb3bc10
xen: retain ulong guest handle for older consumers.
Quoted 4 lines
26072:5529b91bd2e4 removed this but we need to keep it around for older consumers. Bump
__XEN_LATEST_INTERFACE_VERSION__accordingly.Signed-off-by Ian Campbell <[email protected]>
Quoted 42 lines
diff -r
5c402b905e00-r68f0f7ed3e7bxen/include/public/grant_table.hxen/include/public/grant_table.h +4
-0@@ -385,7 +385,11 @@ struct gnttab_setup_table {uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* => enum grant_status */ +#if __XEN_INTERFACE_VERSION__ <0x00040300 +XEN_GUEST_HANDLE (ulong) frame_list; +#else XEN_GUEST_HANDLE (xen_pfn_t) frame_list; +#endif };typedef struct gnttab_setup_table gnttab_setup_table_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_t);diff -r
5c402b905e00-r68f0f7ed3e7bxen/include/public/xen-compat.hxen/include/public/xen-compat.h +1
-1@@ -27,7 +27,7 @@#ifndef __XEN_PUBLIC_XEN_COMPAT_H__#define __XEN_PUBLIC_XEN_COMPAT_H__ -#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200 +#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040300#if defined(__XEN__) || defined(__XEN_TOOLS__)/* Xen is built with matching headers and implements the latest interface. */
diff -r5c402b905e00-r68f0f7ed3e7bxen/include/public/xen.hxen/include/public/xen.h +4
-0@@ -43,6 +43,10 @@ DEFINE_XEN_GUEST_HANDLE(char); __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);DEFINE_XEN_GUEST_HANDLE (int); __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); +#if __XEN_INTERFACE_VERSION__ <0x00040300 +DEFINE_XEN_GUEST_HANDLE (long); +__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long); +#endif DEFINE_XEN_GUEST_HANDLE (void);DEFINE_XEN_GUEST_HANDLE (uint64_t);
Ian Campbell
AppliedRe: [PATCH 09/10] xen: remove XEN_GUEST_HANDLE(ulong)
Quoted 11 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 5 lines · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line · Ian Campbell
These two must be wrapped in
__XEN_INTERFACE_VERSION__conditionals (and__XEN_LATEST_INTERFACE_VERSION__needs to be bumped accordingly), since the various guest handles are distinct types (i.e. consumers will fail to build if not updated).Are there external consumers of
gnttab_setup_table?We can't know - it's a public, not tools-only interface.
Right.
Quoted 11 lines
Quoted 11 lines
Nevertheless, here is the fix.
8<-----------------------------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1350544609 -3600
# Node ID68f0f7ed3e7b3b7b4b9dbc692a448421ebc31035# Parent5c402b905e00fb0871c3f439c8391dd3cfb3bc10
xen: retain ulong guest handle for older consumers.
Quoted 6 lines
Quoted 4 lines
26072:5529b91bd2e4 removed this but we need to keep it around for older consumers. Bump
__XEN_LATEST_INTERFACE_VERSION__accordingly.Signed-off-by Ian Campbell <[email protected]>Acked-by Jan Beulich <[email protected]>
Applied, thanks.
Quoted 46 lines
Quoted 43 lines
diff -r
5c402b905e00-r68f0f7ed3e7bxen/include/public/grant_table.hxen/include/public/grant_table.h +4
-0@@ -385,7 +385,11 @@ struct gnttab_setup_table {uint32_t nr_frames;/* OUT parameters. */ int16_t status;/* => enum grant_status */ +#if __XEN_INTERFACE_VERSION__ <0x00040300 +XEN_GUEST_HANDLE (ulong) frame_list; +#else XEN_GUEST_HANDLE (xen_pfn_t) frame_list; +#endif };typedef struct gnttab_setup_table gnttab_setup_table_t ;DEFINE_XEN_GUEST_HANDLE (gnttab_setup_table_t);diff -r
5c402b905e00-r68f0f7ed3e7bxen/include/public/xen-compat.hxen/include/public/xen-compat.h +1
-1@@ -27,7 +27,7 @@#ifndef __XEN_PUBLIC_XEN_COMPAT_H__#define __XEN_PUBLIC_XEN_COMPAT_H__ -#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040200 +#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040300#if defined(__XEN__) || defined(__XEN_TOOLS__)/* Xen is built with matching headers and implements the latest interface. */
diff -r5c402b905e00-r68f0f7ed3e7bxen/include/public/xen.hxen/include/public/xen.h +4
-0@@ -43,6 +43,10 @@ DEFINE_XEN_GUEST_HANDLE(char); __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);DEFINE_XEN_GUEST_HANDLE (int); __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int); +#if __XEN_INTERFACE_VERSION__ <0x00040300 +DEFINE_XEN_GUEST_HANDLE (long); +__DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long); +#endif DEFINE_XEN_GUEST_HANDLE (void);DEFINE_XEN_GUEST_HANDLE (uint64_t);
PATCH v2 10/10 arm: parameter guest handles are 32 bit on 32 bit hypervisor
In reply to Ian CampbellHandles within structs remain 64 bit such that they are consistently sized on both 32 and 64 bit.
--- xen/include/public/arch-arm.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
xen/include/public/arch-arm.h +1 -1
@@ -74,7 +74,7 @@#define __XEN_GUEST_HANDLE (name) __guest_handle_64_ ## name#define XEN_GUEST_HANDLE (name) __XEN_GUEST_HANDLE(name)/* this is going to be changed on 64 bit */ -#define XEN_GUEST_HANDLE_PARAM (name) XEN_GUEST_HANDLE(name) +#define XEN_GUEST_HANDLE_PARAM (name) __guest_handle_ ## name#define set_xen_guest_handle_raw (hnd, val) \ do { \ typeof(&(hnd)) _sxghr_tmp = &(hnd); \
Signature · 1 line
1.7.9.1
Re: [PATCH 10/10] arm: parameter guest handles are 32 bit on 32 bit hypervisor
Quoted 13 lines · Ian Campbell
Handles within structs remain 64 bit such that they are consistently sized on both 32 and 64 bit.
Signed-off-by Ian Campbell <[email protected]>--- xen/include/public/arch-arm.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)xen/include/public/arch-arm.h +0
-0
xen/include/public/arch-arm.h line 80
Quoted 8 lines
xen/include/public/arch-arm.h +1
-1@@ -74,7 +74,7 @@#define __XEN_GUEST_HANDLE (name) __guest_handle_64_ ## name#define XEN_GUEST_HANDLE (name) __XEN_GUEST_HANDLE(name)/* this is going to be changed on 64 bit */ -#define XEN_GUEST_HANDLE_PARAM (name) XEN_GUEST_HANDLE(name) +#define XEN_GUEST_HANDLE_PARAM (name) __guest_handle_ ## name#define set_xen_guest_handle_raw (hnd, val) \ do { \ typeof(&(hnd)) _sxghr_tmp = &(hnd); \
I am confused.
I am not sure what version of my patch "xen: introduce XEN_GUEST_HANDLE_PARAM" you have based this series upon, because the latest one I have sent, certainly contains this change:
xen/include/public/arch-arm.h +16 -4
@@ -51,18 +51,36 @@#define XEN_HYPERCALL_TAG 0XEA1 +#define uint64_aligned_t uint64_t __attribute__((aligned(8)))#ifndef __ASSEMBLY__ -#define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ - typedef struct { type *p; } __guest_handle_ ## name +#define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ + typedef union { type *p; unsigned long q; } \ + __guest_handle_ ## name; \ + typedef union { type *p; uint64_aligned_t q; } \ + __guest_handle_64_ ## name; +/* +* XEN_GUEST_HANDLE represents a guest pointer, when passed as a field +* in a struct in memory. On ARM is always 8 bytes sizes and 8 bytes +* aligned. +* XEN_GUEST_HANDLE_PARAM represent a guest pointer, when passed as an +* hypercall argument. It is 4 bytes on aarch and 8 bytes on aarch64. +*/ #define __DEFINE_XEN_GUEST_HANDLE (name, type) \ ___DEFINE_XEN_GUEST_HANDLE(name, type); \ ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)#define DEFINE_XEN_GUEST_HANDLE (name) __DEFINE_XEN_GUEST_HANDLE(name, name) -#define __XEN_GUEST_HANDLE (name) __guest_handle_ ## name +#define __XEN_GUEST_HANDLE (name) __guest_handle_64_ ## name#define XEN_GUEST_HANDLE (name) __XEN_GUEST_HANDLE(name) -#define set_xen_guest_handle_raw (hnd, val) do { (hnd).p = val; } while (0) +/* this is going to be changes on 64 bit */ +#define XEN_GUEST_HANDLE_PARAM (name) __guest_handle_ ## name
Re: [PATCH 10/10] arm: parameter guest handles are 32 bit on 32 bit hypervisor
Quoted 25 lines · Stefano Stabellini
Quoted 13 lines · Ian Campbell
Handles within structs remain 64 bit such that they are consistently sized on both 32 and 64 bit.
Signed-off-by Ian Campbell <[email protected]>--- xen/include/public/arch-arm.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)xen/include/public/arch-arm.h +0
-0xen/include/public/arch-arm.h line 80
Quoted 8 lines
xen/include/public/arch-arm.h +1
-1@@ -74,7 +74,7 @@#define __XEN_GUEST_HANDLE (name) __guest_handle_64_ ## name#define XEN_GUEST_HANDLE (name) __XEN_GUEST_HANDLE(name)/* this is going to be changed on 64 bit */ -#define XEN_GUEST_HANDLE_PARAM (name) XEN_GUEST_HANDLE(name) +#define XEN_GUEST_HANDLE_PARAM (name) __guest_handle_ ## name#define set_xen_guest_handle_raw (hnd, val) \ do { \ typeof(&(hnd)) _sxghr_tmp = &(hnd); \I am confused.
Quoted 3 lines
I am not sure what version of my patch "xen: introduce
XEN_GUEST_HANDLE_PARAM" you have based this series upon, because the latest one I have sent, certainly contains this change:
That stuff is in "xen: introduce XEN_GUEST_HANDLE_PARAM". I had to defer the final switch until after the transition to HANDLE_PARAM was complete in order to avoid breaking the build in the interim.
Quoted 39 lines
xen/include/public/arch-arm.h +16
-4@@ -51,18 +51,36 @@#define XEN_HYPERCALL_TAG 0XEA1 +#define uint64_aligned_t uint64_t __attribute__((aligned(8)))#ifndef __ASSEMBLY__ -#define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ - typedef struct { type *p; } __guest_handle_ ## name +#define ___DEFINE_XEN_GUEST_HANDLE (name, type) \ + typedef union { type *p; unsigned long q; } \ + __guest_handle_ ## name; \ + typedef union { type *p; uint64_aligned_t q; } \ + __guest_handle_64_ ## name; +/* +* XEN_GUEST_HANDLE represents a guest pointer, when passed as a field +* in a struct in memory. On ARM is always 8 bytes sizes and 8 bytes +* aligned. +* XEN_GUEST_HANDLE_PARAM represent a guest pointer, when passed as an +* hypercall argument. It is 4 bytes on aarch and 8 bytes on aarch64. +*/ #define __DEFINE_XEN_GUEST_HANDLE (name, type) \ ___DEFINE_XEN_GUEST_HANDLE(name, type); \ ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)#define DEFINE_XEN_GUEST_HANDLE (name) __DEFINE_XEN_GUEST_HANDLE(name, name) -#define __XEN_GUEST_HANDLE (name) __guest_handle_ ## name +#define __XEN_GUEST_HANDLE (name) __guest_handle_64_ ## name#define XEN_GUEST_HANDLE (name) __XEN_GUEST_HANDLE(name) -#define set_xen_guest_handle_raw (hnd, val) do { (hnd).p = val; } while (0) +/* this is going to be changes on 64 bit */ +#define XEN_GUEST_HANDLE_PARAM (name) __guest_handle_ ## name
Stefano Stabellini
Acked-byRe: [PATCH 10/10] arm: parameter guest handles are 32 bit on 32 bit hypervisor
Quoted 26 lines · Ian Campbell
Quoted 25 lines · Stefano Stabellini
Quoted 13 lines · Ian Campbell
Handles within structs remain 64 bit such that they are consistently sized on both 32 and 64 bit.
Signed-off-by Ian Campbell <[email protected]>--- xen/include/public/arch-arm.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)xen/include/public/arch-arm.h +0
-0xen/include/public/arch-arm.h line 80
Quoted 8 lines
xen/include/public/arch-arm.h +1
-1@@ -74,7 +74,7 @@#define __XEN_GUEST_HANDLE (name) __guest_handle_64_ ## name#define XEN_GUEST_HANDLE (name) __XEN_GUEST_HANDLE(name)/* this is going to be changed on 64 bit */ -#define XEN_GUEST_HANDLE_PARAM (name) XEN_GUEST_HANDLE(name) +#define XEN_GUEST_HANDLE_PARAM (name) __guest_handle_ ## name#define set_xen_guest_handle_raw (hnd, val) \ do { \ typeof(&(hnd)) _sxghr_tmp = &(hnd); \I am confused.
Quoted 7 lines
Quoted 3 lines
I am not sure what version of my patch "xen: introduce
XEN_GUEST_HANDLE_PARAM" you have based this series upon, because the latest one I have sent, certainly contains this change:That stuff is in "xen: introduce
XEN_GUEST_HANDLE_PARAM". I had to defer the final switch until after the transition toHANDLE_PARAMwas complete in order to avoid breaking the build in the interim.
I see.
Also I noticed that you wrote that in the commit message of "xen:
introduce XEN_GUEST_HANDLE_PARAM", so it is OK by me.
Quoted 6 lines · Ian Campbell
This is v2 of "Sweep through arm-for-4.3 branch + a bit extra" retitled since most of the sweep through stuff has been swept through already and just the bit extra remains.
I've addressed the review comments and fixed the bisection issue. A bunch of this stuff is cross arch and/or touches common code.
Those bits are fine by me, now.
Quoted 30 lines
The Linux side of the 64 bit ARM ABI changes are in mainline Linux already (just a few tweaks and cleanups remain).
xen: arm: implement
XENMEM_add_to_physmap_rangeNew hypercall intended for use by both ARM (Linux patches exist) and x86 PVH (TBD)
xen/arm: grant table
Simple wiring up job. Acked but depends on
XENMEM_add_to_physmap_range.arm: tools: add arm to foreign structs checking
Fixes native tools build on ARM
xen:
xen_ulong_tsubstitution
xen: change the limit ofnr_extentstoUINT_MAX>>MEMOP_EXTENT_SHIFT
xen: introduceXEN_GUEST_HANDLE_PARAM
xen: replaceXEN_GUEST_HANDLEwithXEN_GUEST_HANDLE_PARAMwhen appropriate
xen: moreXEN_GUEST_HANDLE_PARAMsubstitutions
xen: removeXEN_GUEST_HANDLE(ulong)
arm: parameter guest handles are 32 bit on 32 bit hypervisorThese are the ARM 64 bit API, mostly from Stefano and posted several times already.
Ian.
Quoted 6 lines · Keir Fraser
Quoted 4 lines · Ian Campbell
This is v2 of "Sweep through arm-for-4.3 branch + a bit extra" retitled since most of the sweep through stuff has been swept through already and just the bit extra remains.
Quoted 6 lines
Quoted 2 lines
I've addressed the review comments and fixed the bisection issue. A bunch of this stuff is cross arch and/or touches common code.
Those bits are fine by me, now.
Acked-by Keir Fraser <[email protected]>
Thanks, I'll give it a while for others to comment and plan to shovel it in tomorrow or Thursday unless there are objections.
Quoted 33 lines
Quoted 31 lines
The Linux side of the 64 bit ARM ABI changes are in mainline Linux already (just a few tweaks and cleanups remain).
xen: arm: implement
XENMEM_add_to_physmap_rangeNew hypercall intended for use by both ARM (Linux patches exist) and x86 PVH (TBD)
xen/arm: grant table
Simple wiring up job. Acked but depends on
XENMEM_add_to_physmap_range.arm: tools: add arm to foreign structs checking
Fixes native tools build on ARM
xen:
xen_ulong_tsubstitution
xen: change the limit ofnr_extentstoUINT_MAX>>MEMOP_EXTENT_SHIFT
xen: introduceXEN_GUEST_HANDLE_PARAM
xen: replaceXEN_GUEST_HANDLEwithXEN_GUEST_HANDLE_PARAMwhen appropriate
xen: moreXEN_GUEST_HANDLE_PARAMsubstitutions
xen: removeXEN_GUEST_HANDLE(ulong)
arm: parameter guest handles are 32 bit on 32 bit hypervisorThese are the ARM 64 bit API, mostly from Stefano and posted several times already.
Ian.
Quoted 10 lines · Ian Campbell
Quoted 9 lines · Keir Fraser
Quoted 6 lines · Ian Campbell
This is v2 of "Sweep through arm-for-4.3 branch + a bit extra" retitled since most of the sweep through stuff has been swept through already and just the bit extra remains.
I've addressed the review comments and fixed the bisection issue. A bunch of this stuff is cross arch and/or touches common code.
Quoted 6 lines
Quoted 3 lines
Those bits are fine by me, now.
Acked-by Keir Fraser <[email protected]>Thanks, I'll give it a while for others to comment and plan to shovel it in tomorrow or Thursday unless there are objections.
Added Stefano's + your acks and pushed, thanks
Ian.