]> xenbits.xensource.com Git - people/pauldu/xen.git/commitdiff
viridian: add init hooks
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 18 Dec 2018 15:52:57 +0000 (15:52 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Fri, 11 Jan 2019 10:21:58 +0000 (10:21 +0000)
This patch adds domain and vcpu init hooks for viridian features. The init
hooks do not yet do anything; the functionality will be added to by
subsequent patches.

NOTE: This patch also removes the call from the domain deinit function to
      the vcpu deinit function, as this is not necessary.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>
v3:
 - Re-instate call from domain deinit to vcpu deinit

v2:
 - Remove call from domain deinit to vcpu deinit

xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/viridian/viridian.c
xen/include/asm-x86/hvm/viridian.h

index 401c4a931216a2a92c72c38aafbbbd79a9c2d390..9967169af63ee83931fe19f953d9cf4833a43c28 100644 (file)
@@ -665,12 +665,18 @@ int hvm_domain_initialise(struct domain *d)
     if ( hvm_tsc_scaling_supported )
         d->arch.hvm.tsc_scaling_ratio = hvm_default_tsc_scaling_ratio;
 
+    rc = viridian_domain_init(d);
+    if ( rc )
+        goto fail2;
+
     rc = hvm_funcs.domain_initialise(d);
     if ( rc != 0 )
-        goto fail2;
+        goto fail3;
 
     return 0;
 
+ fail3:
+    viridian_domain_deinit(d);
  fail2:
     rtc_deinit(d);
     stdvga_deinit(d);
@@ -1539,6 +1545,10 @@ int hvm_vcpu_initialise(struct vcpu *v)
     if ( rc != 0 )
         goto fail6;
 
+    rc = viridian_vcpu_init(v);
+    if ( rc )
+        goto fail7;
+
     if ( v->vcpu_id == 0 )
     {
         /* NB. All these really belong in hvm_domain_initialise(). */
@@ -1551,6 +1561,8 @@ int hvm_vcpu_initialise(struct vcpu *v)
 
     return 0;
 
+ fail7:
+    hvm_all_ioreq_servers_remove_vcpu(d, v);
  fail6:
     nestedhvm_vcpu_destroy(v);
  fail5:
index c78b2918d92694c570fba2e55e6c2dbec999887a..ad110ee6f3c9f462d05fbfbcaca53479225b24a2 100644 (file)
@@ -417,6 +417,16 @@ int guest_rdmsr_viridian(const struct vcpu *v, uint32_t idx, uint64_t *val)
     return X86EMUL_OKAY;
 }
 
+int viridian_vcpu_init(struct vcpu *v)
+{
+    return 0;
+}
+
+int viridian_domain_init(struct domain *d)
+{
+    return 0;
+}
+
 void viridian_vcpu_deinit(struct vcpu *v)
 {
     viridian_synic_wrmsr(v, HV_X64_MSR_VP_ASSIST_PAGE, 0);
index ec5ef8d3f94c4542b55ef6399cb3eeb8786dfbfa..f072838955885072820b962e3b232a4b8ac131bd 100644 (file)
@@ -80,6 +80,9 @@ viridian_hypercall(struct cpu_user_regs *regs);
 void viridian_time_ref_count_freeze(struct domain *d);
 void viridian_time_ref_count_thaw(struct domain *d);
 
+int viridian_vcpu_init(struct vcpu *v);
+int viridian_domain_init(struct domain *d);
+
 void viridian_vcpu_deinit(struct vcpu *v);
 void viridian_domain_deinit(struct domain *d);