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

[Xen-changelog] [xen master] hvm: Clean up vlapic_reg_write() error propagation.



commit 5082cc19524b6687ef1bc0a717538d75aae7cd00
Author:     Keir Fraser <keir@xxxxxxx>
AuthorDate: Thu Mar 28 20:16:37 2013 +0000
Commit:     Keir Fraser <keir@xxxxxxx>
CommitDate: Thu Mar 28 20:16:37 2013 +0000

    hvm: Clean up vlapic_reg_write() error propagation.
    
    In particular, correctly propagate errors through vlapic_apicv_write()
    and hvm_x2apic_msr_write().
    
    Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/arch/x86/hvm/vlapic.c |   26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index d69e8af..4b25cc8 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -680,10 +680,9 @@ static int vlapic_reg_write(struct vcpu *v,
         break;
 
     case APIC_SELF_IPI:
-        if ( vlapic_x2apic_mode(vlapic) )
-            vlapic_reg_write(v, APIC_ICR, 0x40000 | (val & 0xff));
-        else
-            rc = X86EMUL_UNHANDLEABLE;
+        rc = vlapic_x2apic_mode(vlapic)
+            ? vlapic_reg_write(v, APIC_ICR, 0x40000 | (val & 0xff))
+            : X86EMUL_UNHANDLEABLE;
         break;
 
     case APIC_ICR:
@@ -836,28 +835,25 @@ static int vlapic_write(struct vcpu *v, unsigned long 
address,
 int vlapic_apicv_write(struct vcpu *v, unsigned int offset)
 {
     uint32_t val = vlapic_get_reg(vcpu_vlapic(v), offset);
-
-    vlapic_reg_write(v, offset, val);
-    return 0;
+    return vlapic_reg_write(v, offset, val);
 }
 
 int hvm_x2apic_msr_write(struct vcpu *v, unsigned int msr, uint64_t 
msr_content)
 {
     struct vlapic *vlapic = vcpu_vlapic(v);
     uint32_t offset = (msr - MSR_IA32_APICBASE_MSR) << 4;
-    int rc;
 
     if ( !vlapic_x2apic_mode(vlapic) )
-        return 1;
+        return X86EMUL_UNHANDLEABLE;
 
     if ( offset == APIC_ICR )
-        if ( vlapic_reg_write(v, APIC_ICR2 , (uint32_t)(msr_content >> 32)) )
-            return 1;
-
-    rc = vlapic_reg_write(v, offset, (uint32_t)msr_content);
+    {
+        int rc = vlapic_reg_write(v, APIC_ICR2, (uint32_t)(msr_content >> 32));
+        if ( rc )
+            return rc;
+    }
 
-    /* X86EMUL_RETRY for SIPI */
-    return ((rc != X86EMUL_OKAY) && (rc != X86EMUL_RETRY));
+    return vlapic_reg_write(v, offset, (uint32_t)msr_content);
 }
 
 static int vlapic_range(struct vcpu *v, unsigned long addr)
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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