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

[Xen-changelog] [xen master] xen/arm: vgic: Correctly emulate write when byte is used



commit 3f214fea76acc6cbc1101fe1815cee795483a67d
Author:     Julien Grall <julien.grall@xxxxxxxxxx>
AuthorDate: Tue Sep 22 21:18:48 2015 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Sep 24 11:41:16 2015 +0100

    xen/arm: vgic: Correctly emulate write when byte is used
    
    When a guest is writing a byte, the value will be located in bits[7:0]
    of the register.
    
    Although the current implementation is expecting the byte at the Nth
    byte of the register where N = address & 4;
    
    When the address is not 4-byte aligned, the corresponding byte in the
    internal state will always be set to zero rather.
    
    Note that byte access are only used for GICD_IPRIORITYR and
    GICD_ITARGETSR. So the worst things that could happen is not setting the
    priority correctly and ignore the target vCPU written.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/include/asm-arm/vgic.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
index 41cadb1..96839f0 100644
--- a/xen/include/asm-arm/vgic.h
+++ b/xen/include/asm-arm/vgic.h
@@ -174,10 +174,10 @@ static inline void vgic_byte_write(uint32_t *reg, 
uint32_t var, int offset)
 {
     int byte = offset & 0x3;
 
-    var &= (0xff << (8*byte));
+    var &= 0xff;
 
     *reg &= ~(0xff << (8*byte));
-    *reg |= var;
+    *reg |= (var << (8*byte));
 }
 
 enum gic_sgi_mode;
--
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®.