linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] arm:kvm correct prototype to make sparse happy
@ 2014-12-22 11:23 Peng Fan
  2014-12-22 11:23 ` [PATCH 2/2] arm:kvm remove len 8 for mmio read write buf Peng Fan
  0 siblings, 1 reply; 4+ messages in thread
From: Peng Fan @ 2014-12-22 11:23 UTC (permalink / raw)
  To: linux-arm-kernel

Warning message:
arch/arm/kvm/arm.c:85:17:
error: symbol 'kvm_get_running_vcpus' redeclared with different type
(originally declared at ./arch/arm/include/asm/kvm_host.h :190) -
different address spaces

Signed-off-by: Peng Fan <van.freenix@gmail.com>
CC: Gleb Natapov <gleb@kernel.org>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Christoffer Dall <christoffer.dall@linaro.org>
CC: Marc Zyngier <marc.zyngier@arm.com>
CC: Russell King <linux@arm.linux.org.uk>
---
 arch/arm/include/asm/kvm_host.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 53036e2..219d025 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -187,7 +187,7 @@ static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
 }
 
 struct kvm_vcpu *kvm_arm_get_running_vcpu(void);
-struct kvm_vcpu __percpu **kvm_get_running_vcpus(void);
+struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void);
 
 int kvm_arm_copy_coproc_indices(struct kvm_vcpu *vcpu, u64 __user *uindices);
 unsigned long kvm_arm_num_coproc_regs(struct kvm_vcpu *vcpu);
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] arm:kvm remove len 8 for mmio read write buf
  2014-12-22 11:23 [PATCH 1/2] arm:kvm correct prototype to make sparse happy Peng Fan
@ 2014-12-22 11:23 ` Peng Fan
  2014-12-22 11:51   ` Marc Zyngier
  0 siblings, 1 reply; 4+ messages in thread
From: Peng Fan @ 2014-12-22 11:23 UTC (permalink / raw)
  To: linux-arm-kernel

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@gmail.com>
CC: Gleb Natapov <gleb@kernel.org>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Christoffer Dall <christoffer.dall@linaro.org>
CC: Marc Zyngier <marc.zyngier@arm.com>
CC: Russell King <linux@arm.linux.org.uk>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] arm:kvm remove len 8 for mmio read write buf
  2014-12-22 11:23 ` [PATCH 2/2] arm:kvm remove len 8 for mmio read write buf Peng Fan
@ 2014-12-22 11:51   ` Marc Zyngier
  2014-12-22 14:20     ` Peng Fan
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Zyngier @ 2014-12-22 11:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 22/12/14 11:23, Peng Fan wrote:
> For arm 32 bit architecture, 8 bytes load/store operation in one instruction
> will not be generated by compiler.

Ever heard of lrdr/strd?

> 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.

NAK. This code is shared between arm and arm64. See commit f42798c.

	M.

> 
> Signed-off-by: Peng Fan <van.freenix@gmail.com>
> CC: Gleb Natapov <gleb@kernel.org>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: Christoffer Dall <christoffer.dall@linaro.org>
> CC: Marc Zyngier <marc.zyngier@arm.com>
> CC: Russell King <linux@arm.linux.org.uk>
> ---
>  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;
> 


-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] arm:kvm remove len 8 for mmio read write buf
  2014-12-22 11:51   ` Marc Zyngier
@ 2014-12-22 14:20     ` Peng Fan
  0 siblings, 0 replies; 4+ messages in thread
From: Peng Fan @ 2014-12-22 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

Just began learning this piece of code.
Thanks for correcting me. 

On 12/22/2014 07:51 PM, Marc Zyngier wrote:
> On 22/12/14 11:23, Peng Fan wrote:
>> For arm 32 bit architecture, 8 bytes load/store operation in one instruction
>> will not be generated by compiler.
> 
> Ever heard of lrdr/strd?
> 
>> 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.
> 
> NAK. This code is shared between arm and arm64. See commit f42798c.
> 
> 	M.
> 
>>
>> Signed-off-by: Peng Fan <van.freenix@gmail.com>
>> CC: Gleb Natapov <gleb@kernel.org>
>> CC: Paolo Bonzini <pbonzini@redhat.com>
>> CC: Christoffer Dall <christoffer.dall@linaro.org>
>> CC: Marc Zyngier <marc.zyngier@arm.com>
>> CC: Russell King <linux@arm.linux.org.uk>
>> ---
>>  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;
>>
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-22 14:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-22 11:23 [PATCH 1/2] arm:kvm correct prototype to make sparse happy Peng Fan
2014-12-22 11:23 ` [PATCH 2/2] arm:kvm remove len 8 for mmio read write buf Peng Fan
2014-12-22 11:51   ` Marc Zyngier
2014-12-22 14:20     ` Peng Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).