From: Christoffer Dall <christoffer.dall@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v2 20/28] ARM: KVM: Change kvm_call_hyp return type to unsigned long
Date: Tue, 9 Feb 2016 19:28:28 +0100 [thread overview]
Message-ID: <20160209182828.GB5171@cbox> (raw)
In-Reply-To: <1454583645-10144-21-git-send-email-marc.zyngier@arm.com>
On Thu, Feb 04, 2016 at 11:00:37AM +0000, Marc Zyngier wrote:
> Having u64 as the kvm_call_hyp return type is problematic, as
> it forces all kind of tricks for the return values from HYP
> to be promoted to 64bit (LE has the LSB in r0, and BE has them
> in r1).
>
> Since the only user of the return value is perfectly happy with
> a 32bit value, let's make kvm_call_hyp return an unsigned long,
> which is 32bit on ARM.
I wonder why I ever did this as a u64...
should the arm64 counterpart be modified to an unsigned long as well?
>
> This solves yet another headache.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> arch/arm/include/asm/kvm_host.h | 2 +-
> arch/arm/kvm/interrupts.S | 10 ++--------
> 2 files changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
> index 02932ba..c62d717 100644
> --- a/arch/arm/include/asm/kvm_host.h
> +++ b/arch/arm/include/asm/kvm_host.h
> @@ -165,7 +165,7 @@ unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
> int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
> int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
> int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
> -u64 kvm_call_hyp(void *hypfn, ...);
> +unsigned long kvm_call_hyp(void *hypfn, ...);
> void force_vm_exit(const cpumask_t *mask);
>
> #define KVM_ARCH_WANT_MMU_NOTIFIER
> diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
> index 7bfb289..01eb169 100644
> --- a/arch/arm/kvm/interrupts.S
> +++ b/arch/arm/kvm/interrupts.S
> @@ -207,20 +207,14 @@ after_vfp_restore:
>
> restore_host_regs
> clrex @ Clear exclusive monitor
> -#ifndef CONFIG_CPU_ENDIAN_BE8
> mov r0, r1 @ Return the return code
> - mov r1, #0 @ Clear upper bits in return value
> -#else
> - @ r1 already has return code
> - mov r0, #0 @ Clear upper bits in return value
> -#endif /* CONFIG_CPU_ENDIAN_BE8 */
> bx lr @ return to IOCTL
>
> /********************************************************************
> * Call function in Hyp mode
> *
> *
> - * u64 kvm_call_hyp(void *hypfn, ...);
> + * unsigned long kvm_call_hyp(void *hypfn, ...);
> *
> * This is not really a variadic function in the classic C-way and care must
> * be taken when calling this to ensure parameters are passed in registers
> @@ -231,7 +225,7 @@ after_vfp_restore:
> * passed as r0, r1, and r2 (a maximum of 3 arguments in addition to the
> * function pointer can be passed). The function being called must be mapped
> * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are
> - * passed in r0 and r1.
> + * passed in r0 (strictly 32bit).
> *
> * A function pointer with a value of 0xffffffff has a special meaning,
> * and is used to implement __hyp_get_vectors in the same way as in
> --
> 2.1.4
>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
WARNING: multiple messages have this Message-ID (diff)
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 20/28] ARM: KVM: Change kvm_call_hyp return type to unsigned long
Date: Tue, 9 Feb 2016 19:28:28 +0100 [thread overview]
Message-ID: <20160209182828.GB5171@cbox> (raw)
In-Reply-To: <1454583645-10144-21-git-send-email-marc.zyngier@arm.com>
On Thu, Feb 04, 2016 at 11:00:37AM +0000, Marc Zyngier wrote:
> Having u64 as the kvm_call_hyp return type is problematic, as
> it forces all kind of tricks for the return values from HYP
> to be promoted to 64bit (LE has the LSB in r0, and BE has them
> in r1).
>
> Since the only user of the return value is perfectly happy with
> a 32bit value, let's make kvm_call_hyp return an unsigned long,
> which is 32bit on ARM.
I wonder why I ever did this as a u64...
should the arm64 counterpart be modified to an unsigned long as well?
>
> This solves yet another headache.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> arch/arm/include/asm/kvm_host.h | 2 +-
> arch/arm/kvm/interrupts.S | 10 ++--------
> 2 files changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
> index 02932ba..c62d717 100644
> --- a/arch/arm/include/asm/kvm_host.h
> +++ b/arch/arm/include/asm/kvm_host.h
> @@ -165,7 +165,7 @@ unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
> int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
> int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
> int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
> -u64 kvm_call_hyp(void *hypfn, ...);
> +unsigned long kvm_call_hyp(void *hypfn, ...);
> void force_vm_exit(const cpumask_t *mask);
>
> #define KVM_ARCH_WANT_MMU_NOTIFIER
> diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
> index 7bfb289..01eb169 100644
> --- a/arch/arm/kvm/interrupts.S
> +++ b/arch/arm/kvm/interrupts.S
> @@ -207,20 +207,14 @@ after_vfp_restore:
>
> restore_host_regs
> clrex @ Clear exclusive monitor
> -#ifndef CONFIG_CPU_ENDIAN_BE8
> mov r0, r1 @ Return the return code
> - mov r1, #0 @ Clear upper bits in return value
> -#else
> - @ r1 already has return code
> - mov r0, #0 @ Clear upper bits in return value
> -#endif /* CONFIG_CPU_ENDIAN_BE8 */
> bx lr @ return to IOCTL
>
> /********************************************************************
> * Call function in Hyp mode
> *
> *
> - * u64 kvm_call_hyp(void *hypfn, ...);
> + * unsigned long kvm_call_hyp(void *hypfn, ...);
> *
> * This is not really a variadic function in the classic C-way and care must
> * be taken when calling this to ensure parameters are passed in registers
> @@ -231,7 +225,7 @@ after_vfp_restore:
> * passed as r0, r1, and r2 (a maximum of 3 arguments in addition to the
> * function pointer can be passed). The function being called must be mapped
> * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are
> - * passed in r0 and r1.
> + * passed in r0 (strictly 32bit).
> *
> * A function pointer with a value of 0xffffffff has a special meaning,
> * and is used to implement __hyp_get_vectors in the same way as in
> --
> 2.1.4
>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
next prev parent reply other threads:[~2016-02-09 18:28 UTC|newest]
Thread overview: 138+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-04 11:00 [PATCH v2 00/28] ARM: KVM: Rewrite the world switch in C (mostly) Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-04 11:00 ` [PATCH v2 01/28] ARM: KVM: Move the HYP code to its own section Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:39 ` Christoffer Dall
2016-02-09 18:39 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 02/28] ARM: KVM: Remove __kvm_hyp_code_start/__kvm_hyp_code_end Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:39 ` Christoffer Dall
2016-02-09 18:39 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 03/28] ARM: KVM: Move VFP registers to a CPU context structure Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:42 ` Christoffer Dall
2016-02-09 18:42 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 04/28] ARM: KVM: Move CP15 array into the " Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:42 ` Christoffer Dall
2016-02-09 18:42 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 05/28] ARM: KVM: Move GP registers " Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:42 ` Christoffer Dall
2016-02-09 18:42 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 06/28] ARM: KVM: Add a HYP-specific header file Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:42 ` Christoffer Dall
2016-02-09 18:42 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 07/28] ARM: KVM: Add system register accessor macros Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-10 17:25 ` Christoffer Dall
2016-02-10 17:25 ` Christoffer Dall
2016-02-10 17:32 ` Marc Zyngier
2016-02-10 17:32 ` Marc Zyngier
2016-02-04 11:00 ` [PATCH v2 08/28] ARM: KVM: Add TLB invalidation code Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:42 ` Christoffer Dall
2016-02-09 18:42 ` Christoffer Dall
2016-02-10 15:32 ` Marc Zyngier
2016-02-10 15:32 ` Marc Zyngier
2016-02-04 11:00 ` [PATCH v2 09/28] ARM: KVM: Add CP15 save/restore code Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:42 ` Christoffer Dall
2016-02-09 18:42 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 10/28] ARM: KVM: Add timer save/restore Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:42 ` Christoffer Dall
2016-02-09 18:42 ` Christoffer Dall
2016-02-10 15:36 ` Marc Zyngier
2016-02-10 15:36 ` Marc Zyngier
2016-02-04 11:00 ` [PATCH v2 11/28] ARM: KVM: Add vgic v2 save/restore Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:42 ` Christoffer Dall
2016-02-09 18:42 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 12/28] ARM: KVM: Add VFP save/restore Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:42 ` Christoffer Dall
2016-02-09 18:42 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 13/28] ARM: KVM: Add banked registers save/restore Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:42 ` Christoffer Dall
2016-02-09 18:42 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 14/28] ARM: KVM: Add guest entry code Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:44 ` Christoffer Dall
2016-02-09 18:44 ` Christoffer Dall
2016-02-10 15:48 ` Marc Zyngier
2016-02-10 15:48 ` Marc Zyngier
2016-02-04 11:00 ` [PATCH v2 15/28] ARM: KVM: Add VFP lazy save/restore handler Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:44 ` Christoffer Dall
2016-02-09 18:44 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 16/28] ARM: KVM: Add the new world switch implementation Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:44 ` Christoffer Dall
2016-02-09 18:44 ` Christoffer Dall
2016-02-10 16:00 ` Marc Zyngier
2016-02-10 16:00 ` Marc Zyngier
2016-02-04 11:00 ` [PATCH v2 17/28] ARM: KVM: Add populating of fault data structure Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:44 ` Christoffer Dall
2016-02-09 18:44 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 18/28] ARM: KVM: Add HYP mode entry code Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 17:00 ` Christoffer Dall
2016-02-09 17:00 ` Christoffer Dall
2016-02-10 16:02 ` Marc Zyngier
2016-02-10 16:02 ` Marc Zyngier
2016-02-10 17:23 ` Christoffer Dall
2016-02-10 17:23 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 19/28] ARM: KVM: Add panic handling code Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:45 ` Christoffer Dall
2016-02-09 18:45 ` Christoffer Dall
2016-02-10 16:03 ` Marc Zyngier
2016-02-10 16:03 ` Marc Zyngier
2016-02-04 11:00 ` [PATCH v2 20/28] ARM: KVM: Change kvm_call_hyp return type to unsigned long Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:28 ` Christoffer Dall [this message]
2016-02-09 18:28 ` Christoffer Dall
2016-02-10 16:07 ` Marc Zyngier
2016-02-10 16:07 ` Marc Zyngier
2016-02-04 11:00 ` [PATCH v2 21/28] ARM: KVM: Remove the old world switch Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:45 ` Christoffer Dall
2016-02-09 18:45 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 22/28] ARM: KVM: Switch to C-based stage2 init Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:45 ` Christoffer Dall
2016-02-09 18:45 ` Christoffer Dall
2016-02-10 7:42 ` Marc Zyngier
2016-02-10 7:42 ` Marc Zyngier
2016-02-10 8:04 ` Christoffer Dall
2016-02-10 8:04 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 23/28] ARM: KVM: Remove __weak attributes Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:45 ` Christoffer Dall
2016-02-09 18:45 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 24/28] ARM: KVM: Turn CP15 defines to an enum Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:45 ` Christoffer Dall
2016-02-09 18:45 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 25/28] ARM: KVM: Cleanup asm-offsets.c Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:45 ` Christoffer Dall
2016-02-09 18:45 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 26/28] ARM: KVM: Remove unused hyp_pc field Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:39 ` Christoffer Dall
2016-02-09 18:39 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 27/28] ARM: KVM: Remove handling of ARM_EXCEPTION_DATA/PREF_ABORT Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:39 ` Christoffer Dall
2016-02-09 18:39 ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 28/28] ARM: KVM: Remove __kvm_hyp_exit/__kvm_hyp_exit_end Marc Zyngier
2016-02-04 11:00 ` Marc Zyngier
2016-02-09 18:39 ` Christoffer Dall
2016-02-09 18:39 ` Christoffer Dall
2016-02-09 18:49 ` [PATCH v2 00/28] ARM: KVM: Rewrite the world switch in C (mostly) Christoffer Dall
2016-02-09 18:49 ` Christoffer Dall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160209182828.GB5171@cbox \
--to=christoffer.dall@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.