xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-4.14 v2] mm: fix public declaration of struct xen_mem_acquire_resource
@ 2020-06-25 14:16 Roger Pau Monne
  2020-06-25 14:27 ` Roger Pau Monné
  0 siblings, 1 reply; 2+ messages in thread
From: Roger Pau Monne @ 2020-06-25 14:16 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Julien Grall, Wei Liu, paul, Andrew Cooper,
	Ian Jackson, George Dunlap, Jan Beulich, Roger Pau Monne

XENMEM_acquire_resource and it's related structure is currently inside
a __XEN__ or __XEN_TOOLS__ guarded section to limit it's scope to the
hypervisor or the toolstack only. This is wrong as the hypercall is
already being used by the Linux kernel at least, and as such needs to
be public.

Also switch the usage of uint64_aligned_t to plain uint64_t, as
uint64_aligned_t is only to be used by the toolstack. Note that a
padding field is added on 32bit x86, so that the size of the structure
is the same.

No layout structure change. The structure doesn't need to be adjusted
on 32bit Arm, because guest handlers are already expanded to 64bits.

Fixes: 3f8f12281dd20 ('x86/mm: add HYPERVISOR_memory_op to acquire guest resources')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Should also be backported.
---
Changes since v1:
 - Add padding on 32bits so structure size matches between arches and
   the previous layout is kept.
---
 xen/include/public/memory.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index dbd35305df..b6d3587cfa 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -607,6 +607,8 @@ struct xen_reserved_device_memory_map {
 typedef struct xen_reserved_device_memory_map xen_reserved_device_memory_map_t;
 DEFINE_XEN_GUEST_HANDLE(xen_reserved_device_memory_map_t);
 
+#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
+
 /*
  * Get the pages for a particular guest resource, so that they can be
  * mapped directly by a tools domain.
@@ -645,7 +647,7 @@ struct xen_mem_acquire_resource {
      * IN - the index of the initial frame to be mapped. This parameter
      *      is ignored if nr_frames is 0.
      */
-    uint64_aligned_t frame;
+    uint64_t frame;
 
 #define XENMEM_resource_ioreq_server_frame_bufioreq 0
 #define XENMEM_resource_ioreq_server_frame_ioreq(n) (1 + (n))
@@ -662,12 +664,14 @@ struct xen_mem_acquire_resource {
      *          This parameter may be NULL if nr_frames is 0.
      */
     XEN_GUEST_HANDLE(xen_pfn_t) frame_list;
+
+#ifdef __i386__
+    uint32_t pad2;
+#endif
 };
 typedef struct xen_mem_acquire_resource xen_mem_acquire_resource_t;
 DEFINE_XEN_GUEST_HANDLE(xen_mem_acquire_resource_t);
 
-#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
-
 /*
  * XENMEM_get_vnumainfo used by guest to get
  * vNUMA topology from hypervisor.
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH for-4.14 v2] mm: fix public declaration of struct xen_mem_acquire_resource
  2020-06-25 14:16 [PATCH for-4.14 v2] mm: fix public declaration of struct xen_mem_acquire_resource Roger Pau Monne
@ 2020-06-25 14:27 ` Roger Pau Monné
  0 siblings, 0 replies; 2+ messages in thread
From: Roger Pau Monné @ 2020-06-25 14:27 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Julien Grall, Wei Liu, paul, Andrew Cooper,
	Ian Jackson, George Dunlap, Jan Beulich

On Thu, Jun 25, 2020 at 04:16:43PM +0200, Roger Pau Monne wrote:
> XENMEM_acquire_resource and it's related structure is currently inside
> a __XEN__ or __XEN_TOOLS__ guarded section to limit it's scope to the
> hypervisor or the toolstack only. This is wrong as the hypercall is
> already being used by the Linux kernel at least, and as such needs to
> be public.
> 
> Also switch the usage of uint64_aligned_t to plain uint64_t, as
> uint64_aligned_t is only to be used by the toolstack. Note that a
> padding field is added on 32bit x86, so that the size of the structure
> is the same.
> 
> No layout structure change. The structure doesn't need to be adjusted
> on 32bit Arm, because guest handlers are already expanded to 64bits.
> 
> Fixes: 3f8f12281dd20 ('x86/mm: add HYPERVISOR_memory_op to acquire guest resources')
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Should also be backported.
> ---
> Changes since v1:
>  - Add padding on 32bits so structure size matches between arches and
>    the previous layout is kept.

This is bogus, will send a proper version.

Sorry for the noise, Roger.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-25 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25 14:16 [PATCH for-4.14 v2] mm: fix public declaration of struct xen_mem_acquire_resource Roger Pau Monne
2020-06-25 14:27 ` Roger Pau Monné

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).