From: Wei Huang <wei@redhat.com>
To: Andrew Jones <drjones@redhat.com>
Cc: cov@codeaurora.org, alindsay@codeaurora.org, kvm@vger.kernel.org,
andre.przywara@arm.com, croberts@codeaurora.org,
qemu-devel@nongnu.org, alistair.francis@xilinx.com,
shannon.zhao@linaro.org, kvmarm@lists.cs.columbia.edu
Subject: Re: [Qemu-devel] [kvm-unit-tests PATCH v13 1/4] arm: Define macros for accessing system registers
Date: Thu, 1 Dec 2016 09:27:59 -0600 [thread overview]
Message-ID: <f502c9c7-50dc-e62e-fbb8-7a8b82f466a0@redhat.com> (raw)
In-Reply-To: <20161201085903.gcc5g7x6ixxgxofl@kamzik.brq.redhat.com>
On 12/01/2016 02:59 AM, Andrew Jones wrote:
>
> Should this be From: Andre?
>
> On Wed, Nov 30, 2016 at 11:16:39PM -0600, Wei Huang wrote:
>> This patch defines four macros to assist creating system register
>> accessors under both ARMv7 and AArch64:
>> * DEFINE_GET_SYSREG32(name, ...)
>> * DEFINE_SET_SYSREG32(name, ...)
>> * DEFINE_GET_SYSREG64(name, ...)
>> * DEFINE_SET_SYSREG64(name, ...)
>> These macros are translated to inline functions with consistent naming,
>> get_##name() and set_##name(), which can be used by C code directly.
>>
>> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
>> Signed-off-by: Wei Huang <wei@redhat.com>
>> ---
>> lib/arm/asm/processor.h | 37 ++++++++++++++++++++++++++++++++-----
>> lib/arm64/asm/processor.h | 35 ++++++++++++++++++++++++++++-------
>> 2 files changed, 60 insertions(+), 12 deletions(-)
>>
>> diff --git a/lib/arm/asm/processor.h b/lib/arm/asm/processor.h
>> index f25e7ee..3ca6b42 100644
>> --- a/lib/arm/asm/processor.h
>> +++ b/lib/arm/asm/processor.h
>> @@ -33,13 +33,40 @@ static inline unsigned long current_cpsr(void)
>>
>> #define current_mode() (current_cpsr() & MODE_MASK)
>>
>> -static inline unsigned int get_mpidr(void)
>> -{
>> - unsigned int mpidr;
>> - asm volatile("mrc p15, 0, %0, c0, c0, 5" : "=r" (mpidr));
>> - return mpidr;
>> +#define DEFINE_GET_SYSREG32(name, opc1, crn, crm, opc2) \
>> +static inline uint32_t get_##name(void) \
>> +{ \
>> + uint32_t reg; \
>> + asm volatile("mrc p15, " #opc1 ", %0, " #crn ", " #crm ", " \
>> + #opc2 : "=r" (reg)); \
>> + return reg; \
>> +}
>> +
>> +#define DEFINE_SET_SYSREG32(name, opc1, crn, crm, opc2) \
>> +static inline void set_##name(uint32_t value) \
>> +{ \
>> + asm volatile("mcr p15, " #opc1 ", %0, " #crn ", " #crm ", " \
>> + #opc2 :: "r" (value)); \
> ^ nit: no space here, checkpatch would complain
Which checkpatch script you are using? I didn't find one in
kvm-unit-tests. I tried kernel's checkpatch script, but it didn't
complain anything against this patch.
>> +}
>> +
<snip>
next prev parent reply other threads:[~2016-12-01 15:28 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 5:16 [Qemu-devel] [kvm-unit-tests PATCH v13 0/4] ARM PMU tests Wei Huang
2016-12-01 5:16 ` [Qemu-devel] [kvm-unit-tests PATCH v13 1/4] arm: Define macros for accessing system registers Wei Huang
2016-12-01 8:59 ` Andrew Jones
2016-12-01 9:38 ` Andrew Jones
2016-12-01 11:11 ` Andre Przywara
2016-12-01 13:16 ` Andrew Jones
2016-12-01 15:27 ` Wei Huang [this message]
2016-12-01 15:50 ` Andrew Jones
2016-12-01 5:16 ` [Qemu-devel] [kvm-unit-tests PATCH v13 2/4] arm: Add PMU test Wei Huang
2016-12-01 9:03 ` Andrew Jones
2016-12-01 11:28 ` Andre Przywara
2016-12-01 12:02 ` Peter Maydell
2016-12-01 12:19 ` Andre Przywara
2016-12-01 12:36 ` Peter Maydell
2016-12-01 5:16 ` [Qemu-devel] [kvm-unit-tests PATCH v13 3/4] arm: pmu: Check cycle count increases Wei Huang
2016-12-01 9:18 ` Andrew Jones
2016-12-01 17:36 ` Wei Huang
2016-12-02 9:58 ` Andrew Jones
2016-12-01 11:27 ` Andre Przywara
2016-12-01 17:39 ` Wei Huang
2016-12-01 5:16 ` [Qemu-devel] [kvm-unit-tests PATCH v13 4/4] arm: pmu: Add CPI checking Wei Huang
2016-12-01 9:26 ` Andrew Jones
2016-12-01 10:19 ` Andre Przywara
2016-12-01 13:47 ` Andrew Jones
2016-12-01 20:27 ` Andre Przywara
2016-12-01 21:12 ` Wei Huang
2016-12-01 22:11 ` André Przywara
2016-12-01 21:18 ` Christopher Covington
2016-12-01 22:04 ` André Przywara
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=f502c9c7-50dc-e62e-fbb8-7a8b82f466a0@redhat.com \
--to=wei@redhat.com \
--cc=alindsay@codeaurora.org \
--cc=alistair.francis@xilinx.com \
--cc=andre.przywara@arm.com \
--cc=cov@codeaurora.org \
--cc=croberts@codeaurora.org \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhao@linaro.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).