diff mbox series

[RFC,v2,14/22] i386/xen: implement HYPERVISOR_hvm_op

Message ID 20221209095612.689243-15-dwmw2@infradead.org
State New
Headers show
Series Xen HVM support under KVM | expand

Commit Message

David Woodhouse Dec. 9, 2022, 9:56 a.m. UTC
From: Joao Martins <joao.m.martins@oracle.com>

This is when guest queries for support for HVMOP_pagetable_dying.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 target/i386/xen.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Durrant, Paul Dec. 12, 2022, 2:41 p.m. UTC | #1
On 09/12/2022 09:56, David Woodhouse wrote:
> From: Joao Martins <joao.m.martins@oracle.com>
> 
> This is when guest queries for support for HVMOP_pagetable_dying.
> 
> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> ---
>   target/i386/xen.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/target/i386/xen.c b/target/i386/xen.c
> index ddd144039a..2847b4f864 100644
> --- a/target/i386/xen.c
> +++ b/target/i386/xen.c
> @@ -18,6 +18,7 @@
>   #include "hw/i386/kvm/xen_overlay.h"
>   #include "standard-headers/xen/version.h"
>   #include "standard-headers/xen/memory.h"
> +#include "standard-headers/xen/hvm/hvm_op.h"
>   
>   static int kvm_gva_rw(CPUState *cs, uint64_t gva, void *_buf, size_t sz,
>                         bool is_write)
> @@ -180,6 +181,19 @@ static bool kvm_xen_hcall_memory_op(struct kvm_xen_exit *exit,
>       return true;
>   }
>   
> +static bool kvm_xen_hcall_hvm_op(struct kvm_xen_exit *exit,
> +                                 int cmd, uint64_t arg)
> +{
> +    switch (cmd) {
> +    case HVMOP_pagetable_dying:
> +            exit->u.hcall.result = -ENOSYS;
> +            return true;
> +
> +    default:
> +            return false;
> +    }
> +}
> +
>   static bool __kvm_xen_handle_exit(X86CPU *cpu, struct kvm_xen_exit *exit)
>   {
>       uint16_t code = exit->u.hcall.input;
> @@ -190,6 +204,9 @@ static bool __kvm_xen_handle_exit(X86CPU *cpu, struct kvm_xen_exit *exit)
>       }
>   
>       switch (code) {
> +    case __HYPERVISOR_hvm_op:
> +        return kvm_xen_hcall_hvm_op(exit, exit->u.hcall.params[0],
> +                                    exit->u.hcall.params[1]);
>       case __HYPERVISOR_memory_op:
>           return kvm_xen_hcall_memory_op(exit, exit->u.hcall.params[0],
>                                          exit->u.hcall.params[1], cpu);

This all seems rather pointless since the only sub-op caught results in 
-ENOSYS. AFAICT the only real change to avoid the emission of a log 
message... which I suggested might become a trace anyway.

   Paul
diff mbox series

Patch

diff --git a/target/i386/xen.c b/target/i386/xen.c
index ddd144039a..2847b4f864 100644
--- a/target/i386/xen.c
+++ b/target/i386/xen.c
@@ -18,6 +18,7 @@ 
 #include "hw/i386/kvm/xen_overlay.h"
 #include "standard-headers/xen/version.h"
 #include "standard-headers/xen/memory.h"
+#include "standard-headers/xen/hvm/hvm_op.h"
 
 static int kvm_gva_rw(CPUState *cs, uint64_t gva, void *_buf, size_t sz,
                       bool is_write)
@@ -180,6 +181,19 @@  static bool kvm_xen_hcall_memory_op(struct kvm_xen_exit *exit,
     return true;
 }
 
+static bool kvm_xen_hcall_hvm_op(struct kvm_xen_exit *exit,
+                                 int cmd, uint64_t arg)
+{
+    switch (cmd) {
+    case HVMOP_pagetable_dying:
+            exit->u.hcall.result = -ENOSYS;
+            return true;
+
+    default:
+            return false;
+    }
+}
+
 static bool __kvm_xen_handle_exit(X86CPU *cpu, struct kvm_xen_exit *exit)
 {
     uint16_t code = exit->u.hcall.input;
@@ -190,6 +204,9 @@  static bool __kvm_xen_handle_exit(X86CPU *cpu, struct kvm_xen_exit *exit)
     }
 
     switch (code) {
+    case __HYPERVISOR_hvm_op:
+        return kvm_xen_hcall_hvm_op(exit, exit->u.hcall.params[0],
+                                    exit->u.hcall.params[1]);
     case __HYPERVISOR_memory_op:
         return kvm_xen_hcall_memory_op(exit, exit->u.hcall.params[0],
                                        exit->u.hcall.params[1], cpu);