All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Jens Wiklander <jens.wiklander@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	Trilok Soni <tsoni@codeaurora.org>,
	arve@android.com, Andrew Walbran <qwandor@google.com>,
	David Hartley <dhh@qti.qualcomm.com>,
	Achin Gupta <Achin.Gupta@arm.com>,
	Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>,
	Marc Bonnici <marc.bonnici@arm.com>
Subject: Re: [PATCH v4 2/7] arm64: smccc: Add support for SMCCCv1.2 input/output registers
Date: Tue, 23 Mar 2021 09:56:04 +0000	[thread overview]
Message-ID: <20210323095604.dcz3xr4sai6saol2@bogus> (raw)
In-Reply-To: <20210317071759.GA3005811@jade>

On Wed, Mar 17, 2021 at 08:17:59AM +0100, Jens Wiklander wrote:
> On Fri, Feb 12, 2021 at 03:46:09PM +0000, Sudeep Holla wrote:
> > SMCCC v1.2 allows x8-x17 to be used as parameter registers and x4—x17
> > to be used as result registers in SMC64/HVC64. Arm Firmware Framework
> > for Armv8-A specification makes use of x0-x7 as parameter and result
> > registers.
> > 
> > Current SMCCC interface in the kernel just use x0-x7 as parameter and
> > x0-x3 as result registers. Let us add new interface to support x0-x7
> > as parameter and result registers. This can be extended to include
> > x8-x17 when there are users for the same.
> > 
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> >  arch/arm64/kernel/asm-offsets.c |  4 +++
> >  arch/arm64/kernel/smccc-call.S  | 22 +++++++++++++++
> >  include/linux/arm-smccc.h       | 50 +++++++++++++++++++++++++++++++++
> >  3 files changed, 76 insertions(+)
> > 
> > diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
> > index 301784463587..89b444591575 100644
> > --- a/arch/arm64/kernel/asm-offsets.c
> > +++ b/arch/arm64/kernel/asm-offsets.c
> > @@ -129,6 +129,10 @@ int main(void)
> >    DEFINE(ARM_SMCCC_RES_X2_OFFS,		offsetof(struct arm_smccc_res, a2));
> >    DEFINE(ARM_SMCCC_QUIRK_ID_OFFS,	offsetof(struct arm_smccc_quirk, id));
> >    DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS,	offsetof(struct arm_smccc_quirk, state));
> > +  DEFINE(ARM_SMCCC_V1_2_RES_X0_OFFS,	offsetof(struct arm_smccc_v1_2_res, a0));
> > +  DEFINE(ARM_SMCCC_V1_2_RES_X2_OFFS,	offsetof(struct arm_smccc_v1_2_res, a2));
> > +  DEFINE(ARM_SMCCC_V1_2_RES_X4_OFFS,	offsetof(struct arm_smccc_v1_2_res, a4));
> > +  DEFINE(ARM_SMCCC_V1_2_RES_X6_OFFS,	offsetof(struct arm_smccc_v1_2_res, a6));
> >    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 d62447964ed9..0ea15c1742f3 100644
> > --- a/arch/arm64/kernel/smccc-call.S
> > +++ b/arch/arm64/kernel/smccc-call.S
> > @@ -43,3 +43,25 @@ SYM_FUNC_START(__arm_smccc_hvc)
> >  	SMCCC	hvc
> >  SYM_FUNC_END(__arm_smccc_hvc)
> >  EXPORT_SYMBOL(__arm_smccc_hvc)
> > +
> > +	.macro SMCCC_v1_2 instr
> > +	.cfi_startproc
> > +	\instr #0
> > +	ldr x8, [sp]
> > +	stp x0, x1, [x8, #ARM_SMCCC_V1_2_RES_X0_OFFS]
> > +	stp x2, x3, [x8, #ARM_SMCCC_V1_2_RES_X2_OFFS]
> > +	stp x4, x5, [x8, #ARM_SMCCC_V1_2_RES_X4_OFFS]
> > +	stp x6, x7, [x8, #ARM_SMCCC_V1_2_RES_X6_OFFS]
> > +	ret
> > +	.cfi_endproc
> > +.endm
> > +
> > +SYM_FUNC_START(arm_smccc_v1_2_hvc)
> > +	SMCCC_v1_2 hvc
> > +SYM_FUNC_END(arm_smccc_v1_2_hvc)
> > +EXPORT_SYMBOL(arm_smccc_v1_2_hvc)
> > +
> > +SYM_FUNC_START(arm_smccc_v1_2_smc)
> > +	SMCCC_v1_2 smc
> > +SYM_FUNC_END(arm_smccc_v1_2_smc)
> > +EXPORT_SYMBOL(arm_smccc_v1_2_smc)
> > diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
> > index f860645f6512..66fd3d582c7f 100644
> > --- a/include/linux/arm-smccc.h
> > +++ b/include/linux/arm-smccc.h
> > @@ -155,6 +155,56 @@ struct arm_smccc_res {
> >  	unsigned long a3;
> >  };
> >  
> > +#ifdef CONFIG_ARM64
> > +/* TODO Need to implement for ARM too */
> 
> It would be nice to have this TODO resolved.
> 

Agreed, but I don't have a complete stack to test this and bit nervous to push
untested code out or even merge it. We can push/get that merged when there
is need for it. It is definitely in my TODO list.

Thanks for all the review and testing. Sorry for the delay in response.
I was off until yesterday.

-- 
Regards,
Sudeep

WARNING: multiple messages have this Message-ID (diff)
From: Sudeep Holla <sudeep.holla@arm.com>
To: Jens Wiklander <jens.wiklander@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	Trilok Soni <tsoni@codeaurora.org>,
	arve@android.com, Andrew Walbran <qwandor@google.com>,
	David Hartley <dhh@qti.qualcomm.com>,
	Achin Gupta <Achin.Gupta@arm.com>,
	Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>,
	Marc Bonnici <marc.bonnici@arm.com>
Subject: Re: [PATCH v4 2/7] arm64: smccc: Add support for SMCCCv1.2 input/output registers
Date: Tue, 23 Mar 2021 09:56:04 +0000	[thread overview]
Message-ID: <20210323095604.dcz3xr4sai6saol2@bogus> (raw)
In-Reply-To: <20210317071759.GA3005811@jade>

On Wed, Mar 17, 2021 at 08:17:59AM +0100, Jens Wiklander wrote:
> On Fri, Feb 12, 2021 at 03:46:09PM +0000, Sudeep Holla wrote:
> > SMCCC v1.2 allows x8-x17 to be used as parameter registers and x4—x17
> > to be used as result registers in SMC64/HVC64. Arm Firmware Framework
> > for Armv8-A specification makes use of x0-x7 as parameter and result
> > registers.
> > 
> > Current SMCCC interface in the kernel just use x0-x7 as parameter and
> > x0-x3 as result registers. Let us add new interface to support x0-x7
> > as parameter and result registers. This can be extended to include
> > x8-x17 when there are users for the same.
> > 
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> >  arch/arm64/kernel/asm-offsets.c |  4 +++
> >  arch/arm64/kernel/smccc-call.S  | 22 +++++++++++++++
> >  include/linux/arm-smccc.h       | 50 +++++++++++++++++++++++++++++++++
> >  3 files changed, 76 insertions(+)
> > 
> > diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
> > index 301784463587..89b444591575 100644
> > --- a/arch/arm64/kernel/asm-offsets.c
> > +++ b/arch/arm64/kernel/asm-offsets.c
> > @@ -129,6 +129,10 @@ int main(void)
> >    DEFINE(ARM_SMCCC_RES_X2_OFFS,		offsetof(struct arm_smccc_res, a2));
> >    DEFINE(ARM_SMCCC_QUIRK_ID_OFFS,	offsetof(struct arm_smccc_quirk, id));
> >    DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS,	offsetof(struct arm_smccc_quirk, state));
> > +  DEFINE(ARM_SMCCC_V1_2_RES_X0_OFFS,	offsetof(struct arm_smccc_v1_2_res, a0));
> > +  DEFINE(ARM_SMCCC_V1_2_RES_X2_OFFS,	offsetof(struct arm_smccc_v1_2_res, a2));
> > +  DEFINE(ARM_SMCCC_V1_2_RES_X4_OFFS,	offsetof(struct arm_smccc_v1_2_res, a4));
> > +  DEFINE(ARM_SMCCC_V1_2_RES_X6_OFFS,	offsetof(struct arm_smccc_v1_2_res, a6));
> >    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 d62447964ed9..0ea15c1742f3 100644
> > --- a/arch/arm64/kernel/smccc-call.S
> > +++ b/arch/arm64/kernel/smccc-call.S
> > @@ -43,3 +43,25 @@ SYM_FUNC_START(__arm_smccc_hvc)
> >  	SMCCC	hvc
> >  SYM_FUNC_END(__arm_smccc_hvc)
> >  EXPORT_SYMBOL(__arm_smccc_hvc)
> > +
> > +	.macro SMCCC_v1_2 instr
> > +	.cfi_startproc
> > +	\instr #0
> > +	ldr x8, [sp]
> > +	stp x0, x1, [x8, #ARM_SMCCC_V1_2_RES_X0_OFFS]
> > +	stp x2, x3, [x8, #ARM_SMCCC_V1_2_RES_X2_OFFS]
> > +	stp x4, x5, [x8, #ARM_SMCCC_V1_2_RES_X4_OFFS]
> > +	stp x6, x7, [x8, #ARM_SMCCC_V1_2_RES_X6_OFFS]
> > +	ret
> > +	.cfi_endproc
> > +.endm
> > +
> > +SYM_FUNC_START(arm_smccc_v1_2_hvc)
> > +	SMCCC_v1_2 hvc
> > +SYM_FUNC_END(arm_smccc_v1_2_hvc)
> > +EXPORT_SYMBOL(arm_smccc_v1_2_hvc)
> > +
> > +SYM_FUNC_START(arm_smccc_v1_2_smc)
> > +	SMCCC_v1_2 smc
> > +SYM_FUNC_END(arm_smccc_v1_2_smc)
> > +EXPORT_SYMBOL(arm_smccc_v1_2_smc)
> > diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
> > index f860645f6512..66fd3d582c7f 100644
> > --- a/include/linux/arm-smccc.h
> > +++ b/include/linux/arm-smccc.h
> > @@ -155,6 +155,56 @@ struct arm_smccc_res {
> >  	unsigned long a3;
> >  };
> >  
> > +#ifdef CONFIG_ARM64
> > +/* TODO Need to implement for ARM too */
> 
> It would be nice to have this TODO resolved.
> 

Agreed, but I don't have a complete stack to test this and bit nervous to push
untested code out or even merge it. We can push/get that merged when there
is need for it. It is definitely in my TODO list.

Thanks for all the review and testing. Sorry for the delay in response.
I was off until yesterday.

-- 
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-03-23  9:57 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 15:46 [PATCH v4 0/7] firmware: Add initial support for Arm FF-A Sudeep Holla
2021-02-12 15:46 ` Sudeep Holla
2021-02-12 15:46 ` [PATCH v4 1/7] dt-bindings: Arm: Add Firmware Framework for Armv8-A (FF-A) binding Sudeep Holla
2021-02-12 15:46   ` Sudeep Holla
2021-03-05 20:38   ` Rob Herring
2021-03-05 20:38     ` Rob Herring
2021-02-12 15:46 ` [PATCH v4 2/7] arm64: smccc: Add support for SMCCCv1.2 input/output registers Sudeep Holla
2021-02-12 15:46   ` Sudeep Holla
2021-03-17  7:17   ` Jens Wiklander
2021-03-17  7:17     ` Jens Wiklander
2021-03-23  9:56     ` Sudeep Holla [this message]
2021-03-23  9:56       ` Sudeep Holla
2021-02-12 15:46 ` [PATCH v4 3/7] firmware: arm_ffa: Add initial FFA bus support for device enumeration Sudeep Holla
2021-02-12 15:46   ` Sudeep Holla
2021-02-12 15:46 ` [PATCH v4 4/7] firmware: arm_ffa: Add initial Arm FFA driver support Sudeep Holla
2021-02-12 15:46   ` Sudeep Holla
2021-03-19  7:25   ` Jens Wiklander
2021-03-19  7:25     ` Jens Wiklander
2021-03-23  9:53     ` Sudeep Holla
2021-03-23  9:53       ` Sudeep Holla
2021-02-12 15:46 ` [PATCH v4 5/7] firmware: arm_ffa: Add support for SMCCC as transport to FFA driver Sudeep Holla
2021-02-12 15:46   ` Sudeep Holla
2021-03-19  7:02   ` Jens Wiklander
2021-03-19  7:02     ` Jens Wiklander
2021-02-12 15:46 ` [PATCH v4 6/7] firmware: arm_ffa: Setup in-kernel users of FFA partitions Sudeep Holla
2021-02-12 15:46   ` Sudeep Holla
2021-03-18 13:08   ` Jens Wiklander
2021-03-18 13:08     ` Jens Wiklander
2021-02-12 15:46 ` [PATCH v4 7/7] firmware: arm_ffa: Add support for MEM_* interfaces Sudeep Holla
2021-02-12 15:46   ` Sudeep Holla
2021-03-18 14:02   ` Jens Wiklander
2021-03-18 14:02     ` Jens Wiklander
2021-03-16 14:34 ` [PATCH v4 0/7] firmware: Add initial support for Arm FF-A Sudeep Holla
2021-03-16 14:34   ` Sudeep Holla
2021-03-18 14:09   ` Jens Wiklander
2021-03-18 14:09     ` Jens Wiklander
2021-03-19  7:56     ` Jens Wiklander
2021-03-19  7:56       ` Jens Wiklander
2021-03-23  9:50       ` Sudeep Holla
2021-03-23  9:50         ` Sudeep Holla
2021-03-23  9:49     ` Sudeep Holla
2021-03-23  9:49       ` Sudeep Holla

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=20210323095604.dcz3xr4sai6saol2@bogus \
    --to=sudeep.holla@arm.com \
    --cc=Achin.Gupta@arm.com \
    --cc=arunachalam.ganapathy@arm.com \
    --cc=arve@android.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dhh@qti.qualcomm.com \
    --cc=jens.wiklander@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.bonnici@arm.com \
    --cc=qwandor@google.com \
    --cc=tsoni@codeaurora.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 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.