Mailing List Archive

[xen staging] tools/libxc: change xc_memshr_fork_reset API to match hypervisor
commit b7d885695f91d4aa6fc498d27cfa1fefef53b2f2
Author: Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Tue Apr 26 14:25:54 2022 -0400
Commit: Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed May 18 18:31:11 2022 +0100

tools/libxc: change xc_memshr_fork_reset API to match hypervisor

Need to separately specify if the reset is for the memory or for the VM state,
or both.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
tools/include/xenctrl.h | 3 ++-
tools/libs/ctrl/xc_memshr.c | 7 ++++++-
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 95bd5eca67..1b089a2c02 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2290,7 +2290,8 @@ int xc_memshr_fork(xc_interface *xch,
*
* With VMs that have a lot of memory this call may block for a long time.
*/
-int xc_memshr_fork_reset(xc_interface *xch, uint32_t forked_domain);
+int xc_memshr_fork_reset(xc_interface *xch, uint32_t forked_domain,
+ bool reset_state, bool reset_memory);

/* Debug calls: return the number of pages referencing the shared frame backing
* the input argument. Should be one or greater.
diff --git a/tools/libs/ctrl/xc_memshr.c b/tools/libs/ctrl/xc_memshr.c
index a6cfd7dccf..a0d0b894e2 100644
--- a/tools/libs/ctrl/xc_memshr.c
+++ b/tools/libs/ctrl/xc_memshr.c
@@ -257,12 +257,17 @@ int xc_memshr_fork(xc_interface *xch, uint32_t pdomid, uint32_t domid,
return xc_memshr_memop(xch, domid, &mso);
}

-int xc_memshr_fork_reset(xc_interface *xch, uint32_t domid)
+int xc_memshr_fork_reset(xc_interface *xch, uint32_t domid, bool reset_state,
+ bool reset_memory)
{
xen_mem_sharing_op_t mso;

memset(&mso, 0, sizeof(mso));
mso.op = XENMEM_sharing_op_fork_reset;
+ if ( reset_state )
+ mso.u.fork.flags |= XENMEM_FORK_RESET_STATE;
+ if ( reset_memory )
+ mso.u.fork.flags |= XENMEM_FORK_RESET_MEMORY;

return xc_memshr_memop(xch, domid, &mso);
}
--
generated by git-patchbot for /home/xen/git/xen.git#staging