Re: [PATCH RFC v2 2/3] ARM: KVM: mark the end of the HYP mode code with __kvm_hyp_code_end

2012-02-10 Thread Christoffer Dall
On Fri, Feb 10, 2012 at 2:22 PM, Marc Zyngier  wrote:
> Use __kvm_hyp_code_end to mark the end of the main HYP code instead of
> __kvm_vcpu_run_end. It's a bit cleaner as we're about to add more code
> to that section.

this is good, but should we not rename the beginning of the section as
well (something like __kvm_hyp_code_start)???

Then we can include your new snippet and also the
__kvm_flush_vm_context in that section and perform a single mapping in
the init code - much nicer.

>
> Signed-off-by: Marc Zyngier 
> ---
>  arch/arm/include/asm/kvm_asm.h |    3 ++-
>  arch/arm/kvm/arm.c             |    4 ++--
>  arch/arm/kvm/interrupts.S      |    8 +---
>  3 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h
> index 89c318ea..5ee7bd3 100644
> --- a/arch/arm/include/asm/kvm_asm.h
> +++ b/arch/arm/include/asm/kvm_asm.h
> @@ -45,7 +45,8 @@ extern char __kvm_hyp_vector[];
>  extern char __kvm_hyp_vector_end[];
>
>  extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
> -extern char __kvm_vcpu_run_end[];
> +
> +extern char __kvm_hyp_code_end[];
>  #endif
>
>  #endif /* __ARM_KVM_ASM_H__ */
> diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
> index 14ccc4d..602e087 100644
> --- a/arch/arm/kvm/arm.c
> +++ b/arch/arm/kvm/arm.c
> @@ -636,9 +636,9 @@ static int init_hyp_mode(void)
>         * Map the world-switch code
>         */
>        err = create_hyp_mappings(kvm_hyp_pgd,
> -                                 __kvm_vcpu_run, __kvm_vcpu_run_end);
> +                                 __kvm_vcpu_run, __kvm_hyp_code_end);
>        if (err) {
> -               kvm_err(err, "Cannot map world-switch code");
> +               kvm_err(err, "Cannot map hyp mode code");
>                goto out_free_mappings;
>        }
>
> diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
> index fbc26ca..8b7e5e9 100644
> --- a/arch/arm/kvm/interrupts.S
> +++ b/arch/arm/kvm/interrupts.S
> @@ -351,11 +351,13 @@ return_to_ioctl:
>  THUMB( orr     lr, lr, #1)
>        mov     pc, lr
>
> -       .ltorg
>
> -__kvm_vcpu_run_end:
> -       .globl __kvm_vcpu_run_end
> +
> +       .ltorg
>
> +__kvm_hyp_code_end:
> +       .globl  __kvm_hyp_code_end
> +
>
>  @
>  @  Hypervisor exception vector and handlers
> --
> 1.7.3.4
>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC v2 2/3] ARM: KVM: mark the end of the HYP mode code with __kvm_hyp_code_end

2012-02-10 Thread Marc Zyngier
Use __kvm_hyp_code_end to mark the end of the main HYP code instead of
__kvm_vcpu_run_end. It's a bit cleaner as we're about to add more code
to that section.

Signed-off-by: Marc Zyngier 
---
 arch/arm/include/asm/kvm_asm.h |3 ++-
 arch/arm/kvm/arm.c |4 ++--
 arch/arm/kvm/interrupts.S  |8 +---
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h
index 89c318ea..5ee7bd3 100644
--- a/arch/arm/include/asm/kvm_asm.h
+++ b/arch/arm/include/asm/kvm_asm.h
@@ -45,7 +45,8 @@ extern char __kvm_hyp_vector[];
 extern char __kvm_hyp_vector_end[];
 
 extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
-extern char __kvm_vcpu_run_end[];
+
+extern char __kvm_hyp_code_end[];
 #endif
 
 #endif /* __ARM_KVM_ASM_H__ */
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 14ccc4d..602e087 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -636,9 +636,9 @@ static int init_hyp_mode(void)
 * Map the world-switch code
 */
err = create_hyp_mappings(kvm_hyp_pgd,
- __kvm_vcpu_run, __kvm_vcpu_run_end);
+ __kvm_vcpu_run, __kvm_hyp_code_end);
if (err) {
-   kvm_err(err, "Cannot map world-switch code");
+   kvm_err(err, "Cannot map hyp mode code");
goto out_free_mappings;
}
 
diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
index fbc26ca..8b7e5e9 100644
--- a/arch/arm/kvm/interrupts.S
+++ b/arch/arm/kvm/interrupts.S
@@ -351,11 +351,13 @@ return_to_ioctl:
 THUMB( orr lr, lr, #1)
mov pc, lr
 
-   .ltorg
 
-__kvm_vcpu_run_end:
-   .globl __kvm_vcpu_run_end
+   
+   .ltorg
 
+__kvm_hyp_code_end:
+   .globl  __kvm_hyp_code_end
+   
 
 @
 @  Hypervisor exception vector and handlers
-- 
1.7.3.4

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