From: Jonathan Cameron <Jonathan.Cameron@Huawei.com> To: Sudeep Holla <sudeep.holla@arm.com> Cc: <linux-arm-kernel@lists.infradead.org>, <devicetree@vger.kernel.org>, Will Deacon <will@kernel.org>, <pratikp@quicinc.com>, <tsoni@quicinc.com>, <kernel-team@android.com> Subject: Re: [PATCH 9/9] firmware: arm_ffa: Setup in-kernel users of FFA partitions Date: Tue, 1 Sep 2020 17:38:02 +0100 [thread overview] Message-ID: <20200901173802.000048c6@Huawei.com> (raw) In-Reply-To: <20200829170923.29949-10-sudeep.holla@arm.com> On Sat, 29 Aug 2020 18:09:23 +0100 Sudeep Holla <sudeep.holla@arm.com> wrote: > In order to also enable in-kernel users of FFA interface along with > the access to user-space applications, let us add simple set of operations > for such devices. > > The in-kernel users are registered without the character device interface. > > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> > --- > drivers/firmware/arm_ffa/driver.c | 119 ++++++++++++++++++++++++++---- > include/linux/arm_ffa.h | 12 +++ > 2 files changed, 117 insertions(+), 14 deletions(-) > > diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c > index 96113e594db6..811558ef2a1d 100644 > --- a/drivers/firmware/arm_ffa/driver.c > +++ b/drivers/firmware/arm_ffa/driver.c > @@ -372,6 +372,97 @@ static void ffa_device_put(struct ffa_device *ffa_dev) > mutex_unlock(&ffa_dev->mutex); > } ... > + > +static long > +ffa_dev_ioctl(struct ffa_device *ffa_dev, unsigned int ioctl, void *arg) > +{ > + long r = -EINVAL; > + > + switch (ioctl) { > + case FFA_GET_API_VERSION: > + r = drv_info->version; Early returns would make this a tiny bit shorter and more readable. return drv_info->version; etc > + break; > + case FFA_GET_PARTITION_ID: > + r = ffa_dev->vm_id; > + break; > + case FFA_GET_PARTITION_INFO: { > + struct ffa_part_info *pinfo = arg; > + > + if (ffa_partition_probe(pinfo->uuid_str, &pinfo->info) != 1) > + r = -E2BIG; > + break; > + } > + case FFA_SEND_RECEIVE_SYNC: { > + struct ffa_send_recv_sync *kdata = arg; > + > + r = ffa_msg_send_direct_req(ffa_dev->vm_id, kdata->endpoint_id, > + &kdata->data); > + break; > + } > + case FFA_SEND_RECEIVE_ASYNC: { > + struct ffa_send_recv_async *kdata = arg; > + > + if (kdata->length < 0 || kdata->length > RXTX_BUFFER_SIZE) { > + r = -EINVAL; > + break; > + } > + > + r = ffa_msg_send(ffa_dev->vm_id, kdata->endpoint_id, > + kdata->buffer, kdata->length); > + break; > + } > + default: > + r = -EINVAL; > + } > + > + return r; > +} > + ... Thanks, Jonathan
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com> To: Sudeep Holla <sudeep.holla@arm.com> Cc: devicetree@vger.kernel.org, kernel-team@android.com, pratikp@quicinc.com, tsoni@quicinc.com, Will Deacon <will@kernel.org>, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 9/9] firmware: arm_ffa: Setup in-kernel users of FFA partitions Date: Tue, 1 Sep 2020 17:38:02 +0100 [thread overview] Message-ID: <20200901173802.000048c6@Huawei.com> (raw) In-Reply-To: <20200829170923.29949-10-sudeep.holla@arm.com> On Sat, 29 Aug 2020 18:09:23 +0100 Sudeep Holla <sudeep.holla@arm.com> wrote: > In order to also enable in-kernel users of FFA interface along with > the access to user-space applications, let us add simple set of operations > for such devices. > > The in-kernel users are registered without the character device interface. > > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> > --- > drivers/firmware/arm_ffa/driver.c | 119 ++++++++++++++++++++++++++---- > include/linux/arm_ffa.h | 12 +++ > 2 files changed, 117 insertions(+), 14 deletions(-) > > diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c > index 96113e594db6..811558ef2a1d 100644 > --- a/drivers/firmware/arm_ffa/driver.c > +++ b/drivers/firmware/arm_ffa/driver.c > @@ -372,6 +372,97 @@ static void ffa_device_put(struct ffa_device *ffa_dev) > mutex_unlock(&ffa_dev->mutex); > } ... > + > +static long > +ffa_dev_ioctl(struct ffa_device *ffa_dev, unsigned int ioctl, void *arg) > +{ > + long r = -EINVAL; > + > + switch (ioctl) { > + case FFA_GET_API_VERSION: > + r = drv_info->version; Early returns would make this a tiny bit shorter and more readable. return drv_info->version; etc > + break; > + case FFA_GET_PARTITION_ID: > + r = ffa_dev->vm_id; > + break; > + case FFA_GET_PARTITION_INFO: { > + struct ffa_part_info *pinfo = arg; > + > + if (ffa_partition_probe(pinfo->uuid_str, &pinfo->info) != 1) > + r = -E2BIG; > + break; > + } > + case FFA_SEND_RECEIVE_SYNC: { > + struct ffa_send_recv_sync *kdata = arg; > + > + r = ffa_msg_send_direct_req(ffa_dev->vm_id, kdata->endpoint_id, > + &kdata->data); > + break; > + } > + case FFA_SEND_RECEIVE_ASYNC: { > + struct ffa_send_recv_async *kdata = arg; > + > + if (kdata->length < 0 || kdata->length > RXTX_BUFFER_SIZE) { > + r = -EINVAL; > + break; > + } > + > + r = ffa_msg_send(ffa_dev->vm_id, kdata->endpoint_id, > + kdata->buffer, kdata->length); > + break; > + } > + default: > + r = -EINVAL; > + } > + > + return r; > +} > + ... Thanks, Jonathan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-09-01 16:39 UTC|newest] Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-29 17:09 [PATCH 0/9] firmware: Add initial support for Arm FF-A Sudeep Holla 2020-08-29 17:09 ` Sudeep Holla 2020-08-29 17:09 ` [PATCH 1/9] dt-bindings: Arm: Add Firmware Framework for Armv8-A (FF-A) binding Sudeep Holla 2020-08-29 17:09 ` Sudeep Holla 2020-09-01 16:03 ` Jonathan Cameron 2020-09-01 16:03 ` Jonathan Cameron 2020-09-07 11:40 ` Sudeep Holla 2020-09-07 11:40 ` Sudeep Holla 2020-09-02 22:14 ` Rob Herring 2020-09-02 22:14 ` Rob Herring 2020-11-03 15:59 ` Sudeep Holla 2020-11-03 15:59 ` Sudeep Holla 2020-08-29 17:09 ` [PATCH 2/9] dt-bindings: Arm: Extend FF-A binding to support in-kernel usage of partitions Sudeep Holla 2020-08-29 17:09 ` Sudeep Holla 2020-09-02 21:36 ` Rob Herring 2020-09-02 21:36 ` Rob Herring 2020-09-07 11:41 ` Sudeep Holla 2020-09-07 11:41 ` Sudeep Holla 2020-08-29 17:09 ` [PATCH 3/9] arm64: smccc: Add support for SMCCCv1.2 input/output registers Sudeep Holla 2020-08-29 17:09 ` Sudeep Holla 2020-08-29 17:09 ` [PATCH 4/9] firmware: smccc: export both smccc functions Sudeep Holla 2020-08-29 17:09 ` Sudeep Holla 2020-08-29 17:09 ` [PATCH 5/9] firmware: arm_ffa: Add initial FFA bus support for device enumeration Sudeep Holla 2020-08-29 17:09 ` Sudeep Holla 2020-08-29 17:09 ` [PATCH 6/9] firmware: arm_ffa: Add initial Arm FFA driver support Sudeep Holla 2020-08-29 17:09 ` Sudeep Holla 2020-09-07 7:55 ` Fuad Tabba 2020-09-07 7:55 ` Fuad Tabba 2020-09-07 9:29 ` Sudeep Holla 2020-09-07 9:29 ` Sudeep Holla 2020-08-29 17:09 ` [PATCH 7/9] firmware: arm_ffa: Add support for SMCCC as transport to FFA driver Sudeep Holla 2020-08-29 17:09 ` Sudeep Holla 2020-09-01 16:23 ` Jonathan Cameron 2020-09-01 16:23 ` Jonathan Cameron 2020-08-29 17:09 ` [PATCH 8/9] firmware: arm_ffa: Setup and register all the KVM managed partitions Sudeep Holla 2020-08-29 17:09 ` Sudeep Holla 2020-09-01 16:34 ` Jonathan Cameron 2020-09-01 16:34 ` Jonathan Cameron 2020-09-07 11:20 ` Achin Gupta 2020-09-07 11:20 ` Achin Gupta 2020-08-29 17:09 ` [PATCH 9/9] firmware: arm_ffa: Setup in-kernel users of FFA partitions Sudeep Holla 2020-08-29 17:09 ` Sudeep Holla 2020-09-01 16:38 ` Jonathan Cameron [this message] 2020-09-01 16:38 ` Jonathan Cameron 2020-09-07 11:32 ` Achin Gupta 2020-09-07 11:32 ` Achin Gupta 2020-09-07 12:04 ` Andrew Walbran 2020-09-07 12:04 ` Andrew Walbran
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=20200901173802.000048c6@Huawei.com \ --to=jonathan.cameron@huawei.com \ --cc=devicetree@vger.kernel.org \ --cc=kernel-team@android.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=pratikp@quicinc.com \ --cc=sudeep.holla@arm.com \ --cc=tsoni@quicinc.com \ --cc=will@kernel.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: linkBe 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.