All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] ARM64: KVM: use lm_alias() for kvm_ksym_ref()
@ 2018-05-10 11:13 ` Mark Rutland
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Rutland @ 2018-05-10 11:13 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Mark Rutland, Marc Zyngier, Christoffer Dall, kvmarm

For historical reasons, we open-code lm_alias() in kvm_ksym_ref().

Let's use lm_alias() to avoid duplication and make things clearer.

As we have to pull this from <linux/mm.h> (which is not safe for
inclusion in assembly), we may as well move the kvm_ksym_ref()
definition into the existing !__ASSEMBLY__ block.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Christoffer Dall <christoffer.dall@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: kvmarm@lists.cs.columbia.edu
---
 arch/arm64/include/asm/kvm_asm.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Since v1 [1]:
* Rebase to v4.17-rc4
* Fix typo in commit message

Mark.

[1] https://lkml.kernel.org/r/20180406151909.57197-1-mark.rutland@arm.com

diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
index f6648a3e4152..a9ceeec5a76f 100644
--- a/arch/arm64/include/asm/kvm_asm.h
+++ b/arch/arm64/include/asm/kvm_asm.h
@@ -33,16 +33,19 @@
 #define KVM_ARM64_DEBUG_DIRTY_SHIFT	0
 #define KVM_ARM64_DEBUG_DIRTY		(1 << KVM_ARM64_DEBUG_DIRTY_SHIFT)
 
+#ifndef __ASSEMBLY__
+
+#include <linux/mm.h>
+
 /* Translate a kernel address of @sym into its equivalent linear mapping */
 #define kvm_ksym_ref(sym)						\
 	({								\
 		void *val = &sym;					\
 		if (!is_kernel_in_hyp_mode())				\
-			val = phys_to_virt((u64)&sym - kimage_voffset);	\
+			val = lm_alias(&sym);				\
 		val;							\
 	 })
 
-#ifndef __ASSEMBLY__
 struct kvm;
 struct kvm_vcpu;
 
-- 
2.11.0

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

* [PATCHv2] ARM64: KVM: use lm_alias() for kvm_ksym_ref()
@ 2018-05-10 11:13 ` Mark Rutland
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Rutland @ 2018-05-10 11:13 UTC (permalink / raw)
  To: linux-arm-kernel

For historical reasons, we open-code lm_alias() in kvm_ksym_ref().

Let's use lm_alias() to avoid duplication and make things clearer.

As we have to pull this from <linux/mm.h> (which is not safe for
inclusion in assembly), we may as well move the kvm_ksym_ref()
definition into the existing !__ASSEMBLY__ block.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Christoffer Dall <christoffer.dall@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: kvmarm at lists.cs.columbia.edu
---
 arch/arm64/include/asm/kvm_asm.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Since v1 [1]:
* Rebase to v4.17-rc4
* Fix typo in commit message

Mark.

[1] https://lkml.kernel.org/r/20180406151909.57197-1-mark.rutland at arm.com

diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
index f6648a3e4152..a9ceeec5a76f 100644
--- a/arch/arm64/include/asm/kvm_asm.h
+++ b/arch/arm64/include/asm/kvm_asm.h
@@ -33,16 +33,19 @@
 #define KVM_ARM64_DEBUG_DIRTY_SHIFT	0
 #define KVM_ARM64_DEBUG_DIRTY		(1 << KVM_ARM64_DEBUG_DIRTY_SHIFT)
 
+#ifndef __ASSEMBLY__
+
+#include <linux/mm.h>
+
 /* Translate a kernel address of @sym into its equivalent linear mapping */
 #define kvm_ksym_ref(sym)						\
 	({								\
 		void *val = &sym;					\
 		if (!is_kernel_in_hyp_mode())				\
-			val = phys_to_virt((u64)&sym - kimage_voffset);	\
+			val = lm_alias(&sym);				\
 		val;							\
 	 })
 
-#ifndef __ASSEMBLY__
 struct kvm;
 struct kvm_vcpu;
 
-- 
2.11.0

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

* Re: [PATCHv2] ARM64: KVM: use lm_alias() for kvm_ksym_ref()
  2018-05-10 11:13 ` Mark Rutland
@ 2018-05-25 10:50   ` Mark Rutland
  -1 siblings, 0 replies; 8+ messages in thread
From: Mark Rutland @ 2018-05-25 10:50 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Marc Zyngier, kvmarm

On Thu, May 10, 2018 at 12:13:47PM +0100, Mark Rutland wrote:
> For historical reasons, we open-code lm_alias() in kvm_ksym_ref().
> 
> Let's use lm_alias() to avoid duplication and make things clearer.
> 
> As we have to pull this from <linux/mm.h> (which is not safe for
> inclusion in assembly), we may as well move the kvm_ksym_ref()
> definition into the existing !__ASSEMBLY__ block.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Christoffer Dall <christoffer.dall@arm.com>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: kvmarm@lists.cs.columbia.edu
> ---
>  arch/arm64/include/asm/kvm_asm.h | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Marc, Christoffer, are you happy to pick this up?

Mark.

> Since v1 [1]:
> * Rebase to v4.17-rc4
> * Fix typo in commit message
> 
> Mark.
> 
> [1] https://lkml.kernel.org/r/20180406151909.57197-1-mark.rutland@arm.com
> 
> diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
> index f6648a3e4152..a9ceeec5a76f 100644
> --- a/arch/arm64/include/asm/kvm_asm.h
> +++ b/arch/arm64/include/asm/kvm_asm.h
> @@ -33,16 +33,19 @@
>  #define KVM_ARM64_DEBUG_DIRTY_SHIFT	0
>  #define KVM_ARM64_DEBUG_DIRTY		(1 << KVM_ARM64_DEBUG_DIRTY_SHIFT)
>  
> +#ifndef __ASSEMBLY__
> +
> +#include <linux/mm.h>
> +
>  /* Translate a kernel address of @sym into its equivalent linear mapping */
>  #define kvm_ksym_ref(sym)						\
>  	({								\
>  		void *val = &sym;					\
>  		if (!is_kernel_in_hyp_mode())				\
> -			val = phys_to_virt((u64)&sym - kimage_voffset);	\
> +			val = lm_alias(&sym);				\
>  		val;							\
>  	 })
>  
> -#ifndef __ASSEMBLY__
>  struct kvm;
>  struct kvm_vcpu;
>  
> -- 
> 2.11.0
> 

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

* [PATCHv2] ARM64: KVM: use lm_alias() for kvm_ksym_ref()
@ 2018-05-25 10:50   ` Mark Rutland
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Rutland @ 2018-05-25 10:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 10, 2018 at 12:13:47PM +0100, Mark Rutland wrote:
> For historical reasons, we open-code lm_alias() in kvm_ksym_ref().
> 
> Let's use lm_alias() to avoid duplication and make things clearer.
> 
> As we have to pull this from <linux/mm.h> (which is not safe for
> inclusion in assembly), we may as well move the kvm_ksym_ref()
> definition into the existing !__ASSEMBLY__ block.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Christoffer Dall <christoffer.dall@arm.com>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: kvmarm at lists.cs.columbia.edu
> ---
>  arch/arm64/include/asm/kvm_asm.h | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Marc, Christoffer, are you happy to pick this up?

Mark.

> Since v1 [1]:
> * Rebase to v4.17-rc4
> * Fix typo in commit message
> 
> Mark.
> 
> [1] https://lkml.kernel.org/r/20180406151909.57197-1-mark.rutland at arm.com
> 
> diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
> index f6648a3e4152..a9ceeec5a76f 100644
> --- a/arch/arm64/include/asm/kvm_asm.h
> +++ b/arch/arm64/include/asm/kvm_asm.h
> @@ -33,16 +33,19 @@
>  #define KVM_ARM64_DEBUG_DIRTY_SHIFT	0
>  #define KVM_ARM64_DEBUG_DIRTY		(1 << KVM_ARM64_DEBUG_DIRTY_SHIFT)
>  
> +#ifndef __ASSEMBLY__
> +
> +#include <linux/mm.h>
> +
>  /* Translate a kernel address of @sym into its equivalent linear mapping */
>  #define kvm_ksym_ref(sym)						\
>  	({								\
>  		void *val = &sym;					\
>  		if (!is_kernel_in_hyp_mode())				\
> -			val = phys_to_virt((u64)&sym - kimage_voffset);	\
> +			val = lm_alias(&sym);				\
>  		val;							\
>  	 })
>  
> -#ifndef __ASSEMBLY__
>  struct kvm;
>  struct kvm_vcpu;
>  
> -- 
> 2.11.0
> 

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

* Re: [PATCHv2] ARM64: KVM: use lm_alias() for kvm_ksym_ref()
  2018-05-25 10:50   ` Mark Rutland
@ 2018-05-25 11:08     ` Marc Zyngier
  -1 siblings, 0 replies; 8+ messages in thread
From: Marc Zyngier @ 2018-05-25 11:08 UTC (permalink / raw)
  To: Mark Rutland, linux-arm-kernel; +Cc: kvmarm

On 25/05/18 11:50, Mark Rutland wrote:
> On Thu, May 10, 2018 at 12:13:47PM +0100, Mark Rutland wrote:
>> For historical reasons, we open-code lm_alias() in kvm_ksym_ref().
>>
>> Let's use lm_alias() to avoid duplication and make things clearer.
>>
>> As we have to pull this from <linux/mm.h> (which is not safe for
>> inclusion in assembly), we may as well move the kvm_ksym_ref()
>> definition into the existing !__ASSEMBLY__ block.
>>
>> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
>> Cc: Christoffer Dall <christoffer.dall@arm.com>
>> Cc: Marc Zyngier <marc.zyngier@arm.com>
>> Cc: kvmarm@lists.cs.columbia.edu
>> ---
>>  arch/arm64/include/asm/kvm_asm.h | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> Marc, Christoffer, are you happy to pick this up?

I've queued it some time ago (see kvmarm/queue), but failed to mention
it on the list...

Thanks,

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

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

* [PATCHv2] ARM64: KVM: use lm_alias() for kvm_ksym_ref()
@ 2018-05-25 11:08     ` Marc Zyngier
  0 siblings, 0 replies; 8+ messages in thread
From: Marc Zyngier @ 2018-05-25 11:08 UTC (permalink / raw)
  To: linux-arm-kernel

On 25/05/18 11:50, Mark Rutland wrote:
> On Thu, May 10, 2018 at 12:13:47PM +0100, Mark Rutland wrote:
>> For historical reasons, we open-code lm_alias() in kvm_ksym_ref().
>>
>> Let's use lm_alias() to avoid duplication and make things clearer.
>>
>> As we have to pull this from <linux/mm.h> (which is not safe for
>> inclusion in assembly), we may as well move the kvm_ksym_ref()
>> definition into the existing !__ASSEMBLY__ block.
>>
>> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
>> Cc: Christoffer Dall <christoffer.dall@arm.com>
>> Cc: Marc Zyngier <marc.zyngier@arm.com>
>> Cc: kvmarm at lists.cs.columbia.edu
>> ---
>>  arch/arm64/include/asm/kvm_asm.h | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> Marc, Christoffer, are you happy to pick this up?

I've queued it some time ago (see kvmarm/queue), but failed to mention
it on the list...

Thanks,

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

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

* Re: [PATCHv2] ARM64: KVM: use lm_alias() for kvm_ksym_ref()
  2018-05-25 11:08     ` Marc Zyngier
@ 2018-05-25 11:28       ` Mark Rutland
  -1 siblings, 0 replies; 8+ messages in thread
From: Mark Rutland @ 2018-05-25 11:28 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: Christoffer Dall, linux-arm-kernel, kvmarm

On Fri, May 25, 2018 at 12:08:28PM +0100, Marc Zyngier wrote:
> On 25/05/18 11:50, Mark Rutland wrote:
> > On Thu, May 10, 2018 at 12:13:47PM +0100, Mark Rutland wrote:
> >> For historical reasons, we open-code lm_alias() in kvm_ksym_ref().
> >>
> >> Let's use lm_alias() to avoid duplication and make things clearer.
> >>
> >> As we have to pull this from <linux/mm.h> (which is not safe for
> >> inclusion in assembly), we may as well move the kvm_ksym_ref()
> >> definition into the existing !__ASSEMBLY__ block.
> >>
> >> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> >> Cc: Christoffer Dall <christoffer.dall@arm.com>
> >> Cc: Marc Zyngier <marc.zyngier@arm.com>
> >> Cc: kvmarm@lists.cs.columbia.edu
> >> ---
> >>  arch/arm64/include/asm/kvm_asm.h | 7 +++++--
> >>  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > Marc, Christoffer, are you happy to pick this up?
> 
> I've queued it some time ago (see kvmarm/queue), but failed to mention
> it on the list...

Ah, cheers!

I'll drop this from my list of things to poke. :)

Thanks,
Mark.

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

* [PATCHv2] ARM64: KVM: use lm_alias() for kvm_ksym_ref()
@ 2018-05-25 11:28       ` Mark Rutland
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Rutland @ 2018-05-25 11:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 25, 2018 at 12:08:28PM +0100, Marc Zyngier wrote:
> On 25/05/18 11:50, Mark Rutland wrote:
> > On Thu, May 10, 2018 at 12:13:47PM +0100, Mark Rutland wrote:
> >> For historical reasons, we open-code lm_alias() in kvm_ksym_ref().
> >>
> >> Let's use lm_alias() to avoid duplication and make things clearer.
> >>
> >> As we have to pull this from <linux/mm.h> (which is not safe for
> >> inclusion in assembly), we may as well move the kvm_ksym_ref()
> >> definition into the existing !__ASSEMBLY__ block.
> >>
> >> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> >> Cc: Christoffer Dall <christoffer.dall@arm.com>
> >> Cc: Marc Zyngier <marc.zyngier@arm.com>
> >> Cc: kvmarm at lists.cs.columbia.edu
> >> ---
> >>  arch/arm64/include/asm/kvm_asm.h | 7 +++++--
> >>  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > Marc, Christoffer, are you happy to pick this up?
> 
> I've queued it some time ago (see kvmarm/queue), but failed to mention
> it on the list...

Ah, cheers!

I'll drop this from my list of things to poke. :)

Thanks,
Mark.

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

end of thread, other threads:[~2018-05-25 11:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-10 11:13 [PATCHv2] ARM64: KVM: use lm_alias() for kvm_ksym_ref() Mark Rutland
2018-05-10 11:13 ` Mark Rutland
2018-05-25 10:50 ` Mark Rutland
2018-05-25 10:50   ` Mark Rutland
2018-05-25 11:08   ` Marc Zyngier
2018-05-25 11:08     ` Marc Zyngier
2018-05-25 11:28     ` Mark Rutland
2018-05-25 11:28       ` Mark Rutland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.