[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH xenbus 6/7] Add a new helper function to make VCPUOP_register_vcpu_info hypercalls



From: Paul Durrant <pdurrant@xxxxxxxxxx>

Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
---
 include/xen.h  |  9 +++++++++
 src/xen/vcpu.c | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/include/xen.h b/include/xen.h
index 89f68867ad5f..8fb55c753c55 100644
--- a/include/xen.h
+++ b/include/xen.h
@@ -495,4 +495,13 @@ VcpuSetPeriodicTimer(
     IN  PLARGE_INTEGER  Period
     );
 
+__checkReturn
+XEN_API
+NTSTATUS
+VcpuRegisterVcpuInfo(
+    IN  unsigned int                vcpu_id,
+    IN  PFN_NUMBER                  Pfn,
+    IN  ULONG                       Offset
+    );
+
 #endif  // _XEN_H
diff --git a/src/xen/vcpu.c b/src/xen/vcpu.c
index a1881cf37b0c..552b3b330878 100644
--- a/src/xen/vcpu.c
+++ b/src/xen/vcpu.c
@@ -80,3 +80,41 @@ fail1:
 
     return status;
 }
+
+__checkReturn
+XEN_API
+NTSTATUS
+VcpuRegisterVcpuInfo(
+    IN  unsigned int                vcpu_id,
+    IN  PFN_NUMBER                  Pfn,
+    IN  ULONG                       Offset
+    )
+{
+    struct vcpu_register_vcpu_info  op;
+    LONG_PTR                        rc;
+    NTSTATUS                        status;
+
+    op.mfn = (xen_pfn_t)Pfn;
+    op.offset = Offset;
+    op.rsvd = 0;
+
+    //
+    // NOTE: This has to be called on the CPU with the matching vcpu_id
+    //       otherwise Xen will fail the hypercall with -EINVAL.
+    //
+
+    rc = VcpuOp(VCPUOP_register_vcpu_info, vcpu_id, &op);
+
+    if (rc < 0) {
+        ERRNO_TO_STATUS(-rc, status);
+        goto fail1;
+    }
+
+    return STATUS_SUCCESS;
+
+fail1:
+    Error("fail1 (%08x)\n", status);
+
+    return status;
+
+}
-- 
2.17.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.