linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 07/28] ARM: KVM: Add system register accessor macros
Date: Wed, 10 Feb 2016 18:25:39 +0100	[thread overview]
Message-ID: <20160210172539.GQ5171@cbox> (raw)
In-Reply-To: <1454583645-10144-8-git-send-email-marc.zyngier@arm.com>

On Thu, Feb 04, 2016 at 11:00:24AM +0000, Marc Zyngier wrote:
> In order to move system register (CP15, mostly) access to C code,
> add a few macros to facilitate this, and minimize the difference
> between 32 and 64bit CP15 registers.
> 
> This will get heavily used in the following patches.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  arch/arm/kvm/hyp/hyp.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/arm/kvm/hyp/hyp.h b/arch/arm/kvm/hyp/hyp.h
> index c723870..727089f 100644
> --- a/arch/arm/kvm/hyp/hyp.h
> +++ b/arch/arm/kvm/hyp/hyp.h
> @@ -27,4 +27,19 @@
>  #define kern_hyp_va(v) (v)
>  #define hyp_kern_va(v) (v)
>  
> +#define __ACCESS_CP15(CRn, Op1, CRm, Op2)	\
> +	"mrc", "mcr", __stringify(p15, Op1, %0, CRn, CRm, Op2), u32
> +#define __ACCESS_CP15_64(Op1, CRm)		\
> +	"mrrc", "mcrr", __stringify(p15, Op1, %Q0, %R0, CRm), u64
> +
> +#define __write_sysreg(v, r, w, c, t)	asm volatile(w " " c : : "r" ((t)(v)))
> +#define write_sysreg(v, ...)		__write_sysreg(v, __VA_ARGS__)
> +
> +#define __read_sysreg(r, w, c, t) ({				\
> +	t __val;						\
> +	asm volatile(r " " c : "=r" (__val));			\
> +	__val;							\
> +})
> +#define read_sysreg(...)		__read_sysreg(__VA_ARGS__)
> +
>  #endif /* __ARM_KVM_HYP_H__ */
> -- 
> 2.1.4
> 

I sort of figured that a reviewed-by tag on patches that actually use
these macros would be an implicit review of this code.

not feeling comfortable enough that I read this jibberish perfectly in
isolation, but given that the stuff compiles and works, I'll just ack
it:

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>

  reply	other threads:[~2016-02-10 17:25 UTC|newest]

Thread overview: 69+ 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 ` [PATCH v2 01/28] ARM: KVM: Move the HYP code to its own section Marc Zyngier
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-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-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-09 18:42   ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 05/28] ARM: KVM: Move GP registers " Marc Zyngier
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-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-10 17:25   ` Christoffer Dall [this message]
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-09 18:42   ` Christoffer Dall
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-09 18:42   ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 10/28] ARM: KVM: Add timer save/restore Marc Zyngier
2016-02-09 18:42   ` Christoffer Dall
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-09 18:42   ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 12/28] ARM: KVM: Add VFP save/restore Marc Zyngier
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-09 18:42   ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 14/28] ARM: KVM: Add guest entry code Marc Zyngier
2016-02-09 18:44   ` Christoffer Dall
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-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-09 18:44   ` Christoffer Dall
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-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-09 17:00   ` Christoffer Dall
2016-02-10 16:02     ` Marc Zyngier
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-09 18:45   ` Christoffer Dall
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-09 18:28   ` Christoffer Dall
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-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-09 18:45   ` Christoffer Dall
2016-02-10  7:42     ` Marc Zyngier
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-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-09 18:45   ` Christoffer Dall
2016-02-04 11:00 ` [PATCH v2 25/28] ARM: KVM: Cleanup asm-offsets.c Marc Zyngier
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-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-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-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

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=20160210172539.GQ5171@cbox \
    --to=christoffer.dall@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 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).