On 09/12/2022 09:56, David Woodhouse wrote:
From: Joao Martins <joao.m.mart...@oracle.com>

Specifically XENMEM_add_to_physmap with space XENMAPSPACE_shared_info to
allow the guest to set its shared_info page.

Signed-off-by: Joao Martins <joao.m.mart...@oracle.com>
[dwmw2: Use the xen_overlay device]
Signed-off-by: David Woodhouse <d...@amazon.co.uk>
---
  target/i386/trace-events |  1 +
  target/i386/xen.c        | 59 +++++++++++++++++++++++++++++++++++++++-
  2 files changed, 59 insertions(+), 1 deletion(-)

[snip]
+static bool kvm_xen_hcall_memory_op(struct kvm_xen_exit *exit,
+                                   int cmd, uint64_t arg, X86CPU *cpu)
+{
+    CPUState *cs = CPU(cpu);
+    int err = 0;
+
+    switch (cmd) {
+    case XENMEM_add_to_physmap: {
+            struct xen_add_to_physmap xatp;
+
+            err = kvm_copy_from_gva(cs, arg, &xatp, sizeof(xatp));
+            if (err) {
+                break;
+            }
+
+            switch (xatp.space) {
+            case XENMAPSPACE_shared_info:
+                break;
+            default:
+                err = -ENOSYS;
+                break;

Don't you want to return false here?

  Paul

+            }
+
+            err = xen_set_shared_info(cs, xatp.gpfn);
+            break;
+         }
+
+    default:
+            return false;
+    }
+
+    exit->u.hcall.result = err;
+    return true;
+}
+


Reply via email to