From: Andy Gross <andy.gross@linaro.org>
To: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org,
Catalin Marinas <catalin.marinas@arm.com>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Stephen Boyd <sboyd@codeaurora.org>,
stanimir.varbanov@linaro.org, linux-kernel@vger.kernel.org,
patches@linaro.org, Bjorn Andersson <bjorn.andersson@linaro.org>,
lorenzo.pieralisi@arm.com, sudeep.holla@arm.com
Subject: Re: [PATCH 1/2] arm64: kernel: Add SMC Session ID to results
Date: Tue, 23 Aug 2016 07:39:20 -0500 [thread overview]
Message-ID: <20160823123920.GE30923@hector.attlocal.net> (raw)
In-Reply-To: <20160822151640.GC30923@hector.attlocal.net>
On Mon, Aug 22, 2016 at 10:16:40AM -0500, Andy Gross wrote:
> On Mon, Aug 22, 2016 at 03:53:26PM +0100, Will Deacon wrote:
> > On Mon, Aug 22, 2016 at 09:02:46AM -0500, Andy Gross wrote:
> > > On Mon, Aug 22, 2016 at 02:43:14PM +0100, Will Deacon wrote:
> > > > On Sat, Aug 20, 2016 at 12:51:13AM -0500, Andy Gross wrote:
<snip>
> > >
> > > In the case of Qualcomm's implementation, they return a value in register 6 that
> > > may or may not be used in subsequent calls. If I want to leverage the arm_smccc
> > > functions, then I need to extend them to include the optional return value. The
> > > downside to this is that everyone who uses this is exposed to it.
> >
> > Yes, I'm not keen on forcing this behaviour for everybody, as you never
> > know what other firmware might do with unexpected a6 values. Could we
> > perhaps quirk it, along the lines of the completely untested patch below?
>
> A quirk would work fine. I'll try this out and get back to you.
Update: Aside from a minor change with either the id type or using w9 register
for the id load, this works just fine.
> > --->8
> >
> > diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
> > index 05070b72fc28..1895e87d0240 100644
> > --- a/arch/arm64/kernel/asm-offsets.c
> > +++ b/arch/arm64/kernel/asm-offsets.c
> > @@ -141,6 +141,8 @@ int main(void)
> > #endif
> > DEFINE(ARM_SMCCC_RES_X0_OFFS, offsetof(struct arm_smccc_res, a0));
> > DEFINE(ARM_SMCCC_RES_X2_OFFS, offsetof(struct arm_smccc_res, a2));
> > + DEFINE(ARM_SMCCC_RES_QUIRK_ID_OFFS, offsetof(struct arm_smccc_res, quirk.id));
> > + DEFINE(ARM_SMCCC_RES_QUIRK_STATE_OFFS, offsetof(struct arm_smccc_res, quirk.state));
> > BLANK();
> > DEFINE(HIBERN_PBE_ORIG, offsetof(struct pbe, orig_address));
> > DEFINE(HIBERN_PBE_ADDR, offsetof(struct pbe, address));
> > diff --git a/arch/arm64/kernel/smccc-call.S b/arch/arm64/kernel/smccc-call.S
> > index ae0496fa4235..3c6c976eaf5c 100644
> > --- a/arch/arm64/kernel/smccc-call.S
> > +++ b/arch/arm64/kernel/smccc-call.S
> > @@ -12,6 +12,7 @@
> > *
> > */
> > #include <linux/linkage.h>
> > +#include <linux/arm-smccc.h>
> > #include <asm/asm-offsets.h>
> >
> > .macro SMCCC instr
> > @@ -20,7 +21,12 @@
> > ldr x4, [sp]
> > stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS]
> > stp x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS]
> > - ret
> > + ldr x9, [x4, #ARM_SMCCC_RES_QUIRK_ID_OFFS]
> > + cbz x9, 1f /* ARM_SMCCC_QUIRK_NONE */
> > + cmp x9, #ARM_SMCCC_QUIRK_QCOM_A6
> > + b.ne 1f
> > + str x6, [x4, ARM_SMCCC_RES_QUIRK_STATE_OFFS]
> > +1: ret
> > .cfi_endproc
> > .endm
> >
> > diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
> > index b5abfda80465..a3a6e291feb6 100644
> > --- a/include/linux/arm-smccc.h
> > +++ b/include/linux/arm-smccc.h
> > @@ -14,9 +14,6 @@
> > #ifndef __LINUX_ARM_SMCCC_H
> > #define __LINUX_ARM_SMCCC_H
> >
> > -#include <linux/linkage.h>
> > -#include <linux/types.h>
> > -
> > /*
> > * This file provides common defines for ARM SMC Calling Convention as
> > * specified in
> > @@ -60,6 +57,21 @@
> > #define ARM_SMCCC_OWNER_TRUSTED_OS 50
> > #define ARM_SMCCC_OWNER_TRUSTED_OS_END 63
> >
> > +#define ARM_SMCCC_QUIRK_NONE 0
> > +#define ARM_SMCCC_QUIRK_QCOM_A6 1 /* Save/restore register a6 */
> > +
> > +#ifndef __ASSEMBLY__
> > +
> > +#include <linux/linkage.h>
> > +#include <linux/types.h>
> > +
> > +struct arm_smccc_quirk {
> > + int id;
> > + union {
> > + unsigned long a6;
> > + } state;
> > +};
> > +
> > /**
> > * struct arm_smccc_res - Result from SMC/HVC call
> > * @a0-a3 result values from registers 0 to 3
> > @@ -69,6 +81,7 @@ struct arm_smccc_res {
> > unsigned long a1;
> > unsigned long a2;
> > unsigned long a3;
> > + struct arm_smccc_quirk quirk;
> > };
> >
> > /**
> > @@ -101,4 +114,5 @@ asmlinkage void arm_smccc_hvc(unsigned long a0, unsigned long a1,
> > unsigned long a5, unsigned long a6, unsigned long a7,
> > struct arm_smccc_res *res);
> >
> > +#endif /* !__ASSEMBLY__ */
> > #endif /*__LINUX_ARM_SMCCC_H*/
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-08-23 12:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-20 5:51 [PATCH 0/2] Qualcomm SMCCC Session ID Support Andy Gross
2016-08-20 5:51 ` [PATCH 1/2] arm64: kernel: Add SMC Session ID to results Andy Gross
2016-08-22 13:43 ` Will Deacon
2016-08-22 14:02 ` Andy Gross
2016-08-22 14:53 ` Will Deacon
2016-08-22 15:16 ` Andy Gross
2016-08-23 12:39 ` Andy Gross [this message]
2016-08-23 0:38 ` Stephen Boyd
2016-08-23 9:07 ` Lorenzo Pieralisi
2016-08-23 10:38 ` Lorenzo Pieralisi
2016-08-23 12:36 ` Andy Gross
2016-08-30 20:16 ` Andy Gross
2016-08-31 14:36 ` Will Deacon
2016-08-24 18:24 ` Bjorn Andersson
2016-08-20 5:51 ` [PATCH 2/2] firmware: qcom: scm: Fix interrupted SCM calls Andy Gross
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=20160823123920.GE30923@hector.attlocal.net \
--to=andy.gross@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=patches@linaro.org \
--cc=sboyd@codeaurora.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=stanimir.varbanov@linaro.org \
--cc=sudeep.holla@arm.com \
--cc=will.deacon@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 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).