[PATCH 2/2] arm:kvm remove len 8 for mmio read write buf

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

 



For arm 32 bit architecture, 8 bytes load/store operation in one instruction
will not be generated by compiler.

And before invoke mmio_read_buf, there is a piece of code:
"
                 len = run->mmio.len;
                 if (len > sizeof(unsigned long))
                         return -EINVAL;

		data = mmio_read_buf(run->mmio.data, len);
"

This piece code also tells that len variable does not exceeds 4 bytes.
So, remove 8 bytes assign in mmio_read_buf and mmio_write_buf.

Signed-off-by: Peng Fan <van.freenix@xxxxxxxxx>
CC: Gleb Natapov <gleb@xxxxxxxxxx>
CC: Paolo Bonzini <pbonzini@xxxxxxxxxx>
CC: Christoffer Dall <christoffer.dall@xxxxxxxxxx>
CC: Marc Zyngier <marc.zyngier@xxxxxxx>
CC: Russell King <linux@xxxxxxxxxxxxxxxx>
---
 arch/arm/kvm/mmio.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
index 4cb5a93..953a819 100644
--- a/arch/arm/kvm/mmio.c
+++ b/arch/arm/kvm/mmio.c
@@ -30,7 +30,6 @@ static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
 		u8	byte;
 		u16	hword;
 		u32	word;
-		u64	dword;
 	} tmp;
 
 	switch (len) {
@@ -46,10 +45,6 @@ static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
 		tmp.word	= data;
 		datap		= &tmp.word;
 		break;
-	case 8:
-		tmp.dword	= data;
-		datap		= &tmp.dword;
-		break;
 	}
 
 	memcpy(buf, datap, len);
@@ -61,7 +56,6 @@ static unsigned long mmio_read_buf(char *buf, unsigned int len)
 	union {
 		u16	hword;
 		u32	word;
-		u64	dword;
 	} tmp;
 
 	switch (len) {
@@ -76,10 +70,6 @@ static unsigned long mmio_read_buf(char *buf, unsigned int len)
 		memcpy(&tmp.word, buf, len);
 		data = tmp.word;
 		break;
-	case 8:
-		memcpy(&tmp.dword, buf, len);
-		data = tmp.dword;
-		break;
 	}
 
 	return data;
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux