Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1225548

Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32

Path csiph.com!goblin3!goblin.stu.neva.ru!gandalf.srv.welterde.de!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Jens Wiklander <jens.wiklander@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32
Date Tue, 15 Sep 2015 23:10:01 +0200
Message-ID <q95Ed-vd-11@gated-at.bofh.it> (permalink)
References <pZ7eh-Nx-1@gated-at.bofh.it> <pZ7ei-Nx-21@gated-at.bofh.it> <pZeSt-3lt-1@gated-at.bofh.it> <pZwml-3AQ-5@gated-at.bofh.it> <pZQO9-7UZ-55@gated-at.bofh.it> <pZSZz-2x5-1@gated-at.bofh.it> <q8xsT-Tg-43@gated-at.bofh.it> <q939o-4nZ-9@gated-at.bofh.it>
X-Original-To Will Deacon <will.deacon@arm.com>
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=oIhPidXoxhrzLyXzzNom0ImxGaZmP8LHHMtgZ/WPfpI=; b=OlbNsDRusRTTn/hCxOqFAaWKGxPvnn8gplTLmxFymi9vEf54L2EJmSn9/T9qfs5QP0 DiiX79J7M8cNtmE+RG3vJG8T5CzdvwZWA9jzo1A3Awd7ekE+bX2JMUbZmkpe41Tk3ij+ NpGHvdwwaFJy8ZQenEco2+2Jwu30Lk0xq/EjC6kD7tGcYBMeTyDuuF047nVnKGCYYbXS PIyAAFBexEciem/J2Q0HF7v3It8wH8U0Bv3ERfRSJuGkQsSEw6Gv2u8DlEG1jrTthWYv WStyJlUKILE486GovFgO5Vg5/F2mg93eTs4FTSWzl1/AXutd2fskW6GsgoP05HUFYcqb 3irA==
X-Gm-Message-State ALoCoQk5kp3V9ijeoAjA7IyaJlNTKMns9O2MT2eFoj3rK44e+mJ+Bf5RqfvkNkseZ7LWkgEi+pnK
X-Received by 10.194.23.2 with SMTP id i2mr16758138wjf.106.1442351164967; Tue, 15 Sep 2015 14:06:04 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Disposition inline
User-Agent Mutt/1.5.21 (2010-09-15)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 57
Organization linux.* mail to news gateway
X-Original-Cc "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Kees Cook <keescook@chromium.org>, "valentin.manea@huawei.com" <valentin.manea@huawei.com>, Mark Rutland <Mark.Rutland@arm.com>, "javier@javigon.com" <javier@javigon.com>, "emmanuel.michel@st.com" <emmanuel.michel@st.com>, Michal Simek <michal.simek@xilinx.com>, "jean-michel.delorme@st.com" <jean-michel.delorme@st.com>, Jason Gunthorpe <jgunthorpe@obsidianresearch.com>, Rob Herring <robh+dt@kernel.org>
X-Original-Date Tue, 15 Sep 2015 23:05:59 +0200
X-Original-Message-ID <20150915210557.GA31578@ermac>
X-Original-References <1439973629-19505-1-git-send-email-jens.wiklander@linaro.org> <1439973629-19505-2-git-send-email-jens.wiklander@linaro.org> <20150819165009.GC10297@arm.com> <20150820113729.GA25962@ermac> <20150821092430.GC30930@arm.com> <20150821114331.GA11701@ermac> <20150914083029.GA13963@ermac> <20150915182645.GQ31157@arm.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1225548

Show key headers only | View raw


On Tue, Sep 15, 2015 at 07:26:45PM +0100, Will Deacon wrote:
> On Mon, Sep 14, 2015 at 09:30:30AM +0100, Jens Wiklander wrote:
> > On Fri, Aug 21, 2015 at 01:43:31PM +0200, Jens Wiklander wrote:
> > > On Fri, Aug 21, 2015 at 10:24:30AM +0100, Will Deacon wrote:
> > > > On Thu, Aug 20, 2015 at 12:37:29PM +0100, Jens Wiklander wrote:
> > > > > On Wed, Aug 19, 2015 at 05:50:09PM +0100, Will Deacon wrote:
> > > > > > On Wed, Aug 19, 2015 at 09:40:25AM +0100, Jens Wiklander wrote:
> > > > > > > +       mov     x28, x0
> > > > > > > +       ldp     w0, w1, [x28, #SMC_PARAM_W0_OFFS]
> > > > > > > +       ldp     w2, w3, [x28, #SMC_PARAM_W2_OFFS]
> > > > > > > +       ldp     w4, w5, [x28, #SMC_PARAM_W4_OFFS]
> > > > > > > +       ldp     w6, w7, [x28, #SMC_PARAM_W6_OFFS]
> > > > > > > +       smc     #0
> > > > > > > +       stp     w0, w1, [x28, #SMC_PARAM_W0_OFFS]
> > > > > > > +       stp     w2, w3, [x28, #SMC_PARAM_W2_OFFS]
> > > > > > > +       ldp     x28, x30, [sp], #16
> > > > > > > +       ret
> > > > > > > +ENDPROC(smccc_call32)
> > > > > > 
> > > > > > Could we deal with this like we do for PSCI instead? (see
> > > > > > __invoke_psci_fn_smc). We could also then rename psci-call.S to fw-call.S
> > > > > > and stick this in there too.
> > > > > 
> > > > > I assume you're referring to when to use "hvc" and "smc".
> > > > 
> > > > No, I mean use a C prototype to avoid marshalling the parameters in assembly
> > > > like this. As Rutland pointed out, the return value is a bit messy, but
> > > > the arguments align nicely with the PCS afaict.
> > > 
> > > If possible I'd like the function to have the same prototype for both
> > > arm and arm64. For arm it's not possible to supply more than 4
> > > parameters. To fully support SMC Calling Convention we need to be able
> > > to pass 8 parameters and have 4 return values. The OP-TEE driver in this
> > > patch set depends on this. I don't see how we can avoid the marshalling
> > > here.
> > > 
> > > We could have two versions of the SMCCC functions, one simplified which
> > > only uses registers and one complete like this one with marshalling.
> > 
> > Will, what do think about this?
> 
> I still think you should make use of a C prototype to avoid explicit
> parameter marshalling in assembly. If you want to maintain a compatible
> API between arm and arm64, then you can easily have an intermediate
> function in arm64 that sits between the API entry point and the assembly.

Yes, I see how that's convenient for passing argument values in
registers, but that doesn't help with storing the returned values in
x0..x3 into something accessible in C. Am I missing something?

Thanks,
Jens
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Jens Wiklander <jens.wiklander@linaro.org> - 2015-09-14 10:40 +0200
  Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Will Deacon <will.deacon@arm.com> - 2015-09-15 20:30 +0200
    Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Jens Wiklander <jens.wiklander@linaro.org> - 2015-09-15 23:10 +0200
      Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Will Deacon <will.deacon@arm.com> - 2015-09-16 19:20 +0200

csiph-web