Message ID | 20190708154730.16643-6-sudeep.holla@arm.com |
---|---|
State | New |
Headers | show |
Series | firmware: arm_scmi: Add support for Rx, async commands and delayed response | expand |
Hi Sudeep, Would it make sense to save commits that support notifications for when you actually support them (correct me if I wrong, but this commit-set does not implement notifications. Jim On Mon, Jul 8, 2019 at 11:47 AM Sudeep Holla <sudeep.holla@arm.com> wrote: > > With all the plumbing in place, let's just add the separate dedicated > receive buffers to handle notifications that can arrive asynchronously > from the platform firmware to OS. > > Also add check to see if the platform supports any receive channels > before allocating the receive buffers. > > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> > --- > drivers/firmware/arm_scmi/driver.c | 24 ++++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > index 1a7ffd3f8534..eb5a2f271806 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -112,6 +112,7 @@ struct scmi_chan_info { > * @version: SCMI revision information containing protocol version, > * implementation version and (sub-)vendor identification. > * @tx_minfo: Universal Transmit Message management info > + * @rx_minfo: Universal Receive Message management info > * @tx_idr: IDR object to map protocol id to Tx channel info pointer > * @rx_idr: IDR object to map protocol id to Rx channel info pointer > * @protocols_imp: List of protocols implemented, currently maximum of > @@ -125,6 +126,7 @@ struct scmi_info { > struct scmi_revision_info version; > struct scmi_handle handle; > struct scmi_xfers_info tx_minfo; > + struct scmi_xfers_info rx_minfo; > struct idr tx_idr; > struct idr rx_idr; > u8 *protocols_imp; > @@ -615,13 +617,13 @@ int scmi_handle_put(const struct scmi_handle *handle) > return 0; > } > > -static int scmi_xfer_info_init(struct scmi_info *sinfo) > +static int __scmi_xfer_info_init(struct scmi_info *sinfo, bool tx) > { > int i; > struct scmi_xfer *xfer; > struct device *dev = sinfo->dev; > const struct scmi_desc *desc = sinfo->desc; > - struct scmi_xfers_info *info = &sinfo->tx_minfo; > + struct scmi_xfers_info *info = tx ? &sinfo->tx_minfo : &sinfo->rx_minfo; > > /* Pre-allocated messages, no more than what hdr.seq can support */ > if (WARN_ON(desc->max_msg >= MSG_TOKEN_MAX)) { > @@ -656,6 +658,16 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo) > return 0; > } > > +static int scmi_xfer_info_init(struct scmi_info *sinfo) > +{ > + int ret = __scmi_xfer_info_init(sinfo, true); > + > + if (!ret && idr_find(&sinfo->rx_idr, SCMI_PROTOCOL_BASE)) > + ret = __scmi_xfer_info_init(sinfo, false); > + > + return ret; > +} > + > static int scmi_mailbox_check(struct device_node *np, int idx) > { > return of_parse_phandle_with_args(np, "mboxes", "#mbox-cells", > @@ -792,10 +804,6 @@ static int scmi_probe(struct platform_device *pdev) > info->desc = desc; > INIT_LIST_HEAD(&info->node); > > - ret = scmi_xfer_info_init(info); > - if (ret) > - return ret; > - > platform_set_drvdata(pdev, info); > idr_init(&info->tx_idr); > idr_init(&info->rx_idr); > @@ -808,6 +816,10 @@ static int scmi_probe(struct platform_device *pdev) > if (ret) > return ret; > > + ret = scmi_xfer_info_init(info); > + if (ret) > + return ret; > + > ret = scmi_base_protocol_init(handle); > if (ret) { > dev_err(dev, "unable to communicate with SCMI(%d)\n", ret); > -- > 2.17.1 >
On Thu, Jul 18, 2019 at 05:14:55PM -0400, Jim Quinlan wrote: > Hi Sudeep, > > I'm not sure why you are adding code for notifications when this commit-set > does not support notifications. Why not save this commit for when you add > notifications? > Right, I missed this patch and sent. Yes we just need Rx channels and not Rx buffers to implement asynchronous commands. I will drop it from this set. -- Regards, Sudeep
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 1a7ffd3f8534..eb5a2f271806 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -112,6 +112,7 @@ struct scmi_chan_info { * @version: SCMI revision information containing protocol version, * implementation version and (sub-)vendor identification. * @tx_minfo: Universal Transmit Message management info + * @rx_minfo: Universal Receive Message management info * @tx_idr: IDR object to map protocol id to Tx channel info pointer * @rx_idr: IDR object to map protocol id to Rx channel info pointer * @protocols_imp: List of protocols implemented, currently maximum of @@ -125,6 +126,7 @@ struct scmi_info { struct scmi_revision_info version; struct scmi_handle handle; struct scmi_xfers_info tx_minfo; + struct scmi_xfers_info rx_minfo; struct idr tx_idr; struct idr rx_idr; u8 *protocols_imp; @@ -615,13 +617,13 @@ int scmi_handle_put(const struct scmi_handle *handle) return 0; } -static int scmi_xfer_info_init(struct scmi_info *sinfo) +static int __scmi_xfer_info_init(struct scmi_info *sinfo, bool tx) { int i; struct scmi_xfer *xfer; struct device *dev = sinfo->dev; const struct scmi_desc *desc = sinfo->desc; - struct scmi_xfers_info *info = &sinfo->tx_minfo; + struct scmi_xfers_info *info = tx ? &sinfo->tx_minfo : &sinfo->rx_minfo; /* Pre-allocated messages, no more than what hdr.seq can support */ if (WARN_ON(desc->max_msg >= MSG_TOKEN_MAX)) { @@ -656,6 +658,16 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo) return 0; } +static int scmi_xfer_info_init(struct scmi_info *sinfo) +{ + int ret = __scmi_xfer_info_init(sinfo, true); + + if (!ret && idr_find(&sinfo->rx_idr, SCMI_PROTOCOL_BASE)) + ret = __scmi_xfer_info_init(sinfo, false); + + return ret; +} + static int scmi_mailbox_check(struct device_node *np, int idx) { return of_parse_phandle_with_args(np, "mboxes", "#mbox-cells", @@ -792,10 +804,6 @@ static int scmi_probe(struct platform_device *pdev) info->desc = desc; INIT_LIST_HEAD(&info->node); - ret = scmi_xfer_info_init(info); - if (ret) - return ret; - platform_set_drvdata(pdev, info); idr_init(&info->tx_idr); idr_init(&info->rx_idr); @@ -808,6 +816,10 @@ static int scmi_probe(struct platform_device *pdev) if (ret) return ret; + ret = scmi_xfer_info_init(info); + if (ret) + return ret; + ret = scmi_base_protocol_init(handle); if (ret) { dev_err(dev, "unable to communicate with SCMI(%d)\n", ret);
With all the plumbing in place, let's just add the separate dedicated receive buffers to handle notifications that can arrive asynchronously from the platform firmware to OS. Also add check to see if the platform supports any receive channels before allocating the receive buffers. Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> --- drivers/firmware/arm_scmi/driver.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) -- 2.17.1