|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [for-4.7 1/2] xen: XENMEM_add_physmap_batch: Mark 'foreign_id' as reserved for dev_mmio
The field 'foreign_id' is not used when the space is dev_mmio. As the
space is not yet part of the stable ABI, the field is marked as reserved
for future use.
The value should always be 0, other values will return -ENOSYS.
Note that the code would need some rework (such as renaming the field
'foreign_id' to a generic name), however the release of Xen 4.7 is
really close. The rework will be done for the next release.
Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
---
xen/arch/arm/mm.c | 4 ++++
xen/common/memory.c | 6 ++++--
xen/include/public/memory.h | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index b46e23e..83edfa1 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1143,6 +1143,10 @@ int xenmem_add_to_physmap_one(
break;
}
case XENMAPSPACE_dev_mmio:
+ /* The field 'foreign_domid' is reserved for future use */
+ if ( foreign_domid )
+ return -ENOSYS;
+
rc = map_dev_mmio_region(d, gpfn, 1, idx);
return rc;
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 644f81a..6bc52ac 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -639,9 +639,11 @@ static int xenmem_add_to_physmap(struct domain *d,
{
unsigned int done = 0;
long rc = 0;
+ /* The field 'foreign_id' should be 0 when mapping MMIO. */
+ domid_t inv = (xatp->space != XENMAPSPACE_dev_mmio) ? DOMID_INVALID : 0;
if ( xatp->space != XENMAPSPACE_gmfn_range )
- return xenmem_add_to_physmap_one(d, xatp->space, DOMID_INVALID,
+ return xenmem_add_to_physmap_one(d, xatp->space, inv,
xatp->idx, xatp->gpfn);
if ( xatp->size < start )
@@ -658,7 +660,7 @@ static int xenmem_add_to_physmap(struct domain *d,
while ( xatp->size > done )
{
- rc = xenmem_add_to_physmap_one(d, xatp->space, DOMID_INVALID,
+ rc = xenmem_add_to_physmap_one(d, xatp->space, inv,
xatp->idx, xatp->gpfn);
if ( rc < 0 )
break;
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index fe52ee1..b023046 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -259,7 +259,7 @@ struct xen_add_to_physmap_batch {
/* Number of pages to go through */
uint16_t size;
- domid_t foreign_domid; /* IFF gmfn_foreign */
+ domid_t foreign_domid; /* IFF gmfn_foreign. Should be 0 for other spaces.
*/
/* Indexes into space being mapped. */
XEN_GUEST_HANDLE(xen_ulong_t) idxs;
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |