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

[Xen-changelog] [xen master] x86/hvm: Drop more remains of the PVHv1 implementation



commit 5efaeaa8235d9f16fa2711efe22b8f2bd54a182b
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Jun 22 11:30:00 2017 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jul 19 15:25:09 2017 +0100

    x86/hvm: Drop more remains of the PVHv1 implementation
    
    These functions don't need is_hvm_{vcpu,domain}() predicates.
    
    hvmop_set_evtchn_upcall_vector() does need the predicate to prevent a PV
    caller accessing the hvm union, but swap the copy_from_guest() and
    is_hvm_domain() predicate to avoid reading the hypercall parameter if we not
    going to use it.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
    Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 8145385..0b1aba7 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -506,8 +506,7 @@ void hvm_do_resume(struct vcpu *v)
 {
     check_wakeup_from_wait();
 
-    if ( is_hvm_domain(v->domain) )
-        pt_restore_timer(v);
+    pt_restore_timer(v);
 
     if ( !handle_hvm_io_completion(v) )
         return;
@@ -1544,8 +1543,7 @@ void hvm_vcpu_destroy(struct vcpu *v)
     tasklet_kill(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
     hvm_funcs.vcpu_destroy(v);
 
-    if ( is_hvm_vcpu(v) )
-        vlapic_destroy(v);
+    vlapic_destroy(v);
 
     hvm_vcpu_cacheattr_destroy(v);
 }
@@ -1710,9 +1708,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long 
gla,
      * - 32-bit WinXP (& older Windows) on AMD CPUs for LAPIC accesses,
      * - newer Windows (like Server 2012) for HPET accesses.
      */
-    if ( !nestedhvm_vcpu_in_guestmode(curr)
-         && is_hvm_domain(currd)
-         && hvm_mmio_internal(gpa) )
+    if ( !nestedhvm_vcpu_in_guestmode(curr) && hvm_mmio_internal(gpa) )
     {
         if ( !handle_mmio_with_translation(gla, gpa >> PAGE_SHIFT, npfec) )
             hvm_inject_hw_exception(TRAP_gp_fault, 0);
@@ -3139,7 +3135,7 @@ static enum hvm_copy_result __hvm_copy(
          * - 32-bit WinXP (& older Windows) on AMD CPUs for LAPIC accesses,
          * - newer Windows (like Server 2012) for HPET accesses.
          */
-        if ( v == current && is_hvm_vcpu(v)
+        if ( v == current
              && !nestedhvm_vcpu_in_guestmode(v)
              && hvm_mmio_internal(gpa) )
             return HVMCOPY_bad_gfn_to_mfn;
@@ -3971,12 +3967,12 @@ static int hvmop_set_evtchn_upcall_vector(
     struct domain *d = current->domain;
     struct vcpu *v;
 
-    if ( copy_from_guest(&op, uop, 1) )
-        return -EFAULT;
-
     if ( !is_hvm_domain(d) )
         return -EINVAL;
 
+    if ( copy_from_guest(&op, uop, 1) )
+        return -EFAULT;
+
     if ( op.vector < 0x10 )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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