All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: Bjorn Andersson <andersson@kernel.org>
Cc: Bjorn Andersson <quic_bjorande@quicinc.com>,
	Andy Gross <agross@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] soc: qcom: rmtfs: Support discarding guard pages
Date: Fri, 22 Sep 2023 09:35:00 +0200	[thread overview]
Message-ID: <ZQ1DmSRIe56WQmnK@gerhold.net> (raw)
In-Reply-To: <j5ivvbjprgdcekujzjiobk7gpoaz3jxpnda5dsgoh6f4hsn5id@3ug5i74ubkqf>

eOn Thu, Sep 21, 2023 at 07:51:42PM -0700, Bjorn Andersson wrote:
> On Thu, Sep 21, 2023 at 08:04:06PM +0200, Stephan Gerhold wrote:
> > On Wed, Sep 20, 2023 at 07:37:31PM -0700, Bjorn Andersson wrote:
> > > In some configurations, the exact placement of the rmtfs shared memory
> > > region isn't so strict. The DeviceTree author can then choose to use the
> > > "size" property and rely on the OS for placement (in combination with
> > > "alloc-ranges", if desired).
> > > 
> > > But on some platforms the rmtfs memory region may not be allocated
> > > adjacent to regions allocated by other clients. Add support for
> > > discarding the first and last 4k block in the region, if
> > > qcom,use-guard-pages is specified in DeviceTree.
> > > 
> > > Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
> > > ---
> > >  drivers/soc/qcom/rmtfs_mem.c | 9 +++++++++
> > >  1 file changed, 9 insertions(+)
> > > 
> > > diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c
> > > index f83811f51175..83bba9321e72 100644
> > > --- a/drivers/soc/qcom/rmtfs_mem.c
> > > +++ b/drivers/soc/qcom/rmtfs_mem.c
> > > @@ -200,6 +200,15 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
> > >  	rmtfs_mem->client_id = client_id;
> > >  	rmtfs_mem->size = rmem->size;
> > >  
> > > +	/*
> > > +	 * If requested, discard the first and last 4k block in order to ensure
> > > +	 * that the rmtfs region isn't adjacent to other protected regions.
> > > +	 */
> > > +	if (of_property_present(node, "qcom,use-guard-pages")) {
> > 
> > I think of_property_read_bool() would be more fitting here. Right now
> > of_property_present() is just a wrapper around of_property_read_bool().
> > Semantically reading a bool fits better here though. :-)
> > 
> 
> Are you saying that you would prefer this to be a bool, so hat you can
> give it a "false" value? Or you are simply saying "it walks like a
> boolean, quacks like a boolean, let's use the boolean accessor"?
> 

The latter. I would expect that of_property_present() is used for
properties which usually have a value, while of_property_read_bool()
is used for pure bool values which can be present or not but must not
have a value. I think a "bool" in terms of DT is simply a present or
not-present property without any value?

For example consider

  regulator-min-microvolts = <4200000000>;
  regulator-always-on;

Then I would expect

  - of_property_present(..., "regulator-min-microvolts"), but
  - of_property_read_bool(..., "regulator-always-on")

Does that make sense? :D

> > Feel free to fix that up while applying.
> > 
> > FWIW I don't really have an opinion if "qcom,use-guard-pages" is a good
> > way to describe this in the DT. For the implementation side feel free to
> > add my
> > 
> 
> Right, I don't think I commented on your suggestion to make the size of
> the guard page configurable. I am not aware of any current or upcoming
> reasons for adding such complexity, so I'd simply prefer to stick with a
> boolean. Should that need arise, I think this model would allow
> extension to express that.
> 

I must admit I forgot that I suggested this until now. :')
I don't see a use case for a different "guard size" either so I think
it's fine to have it as a bool.

Thanks,
Stephan

  reply	other threads:[~2023-09-22  7:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21  2:37 [PATCH v3 0/3] soc: qcom: rmtfs: Support dynamic allocation Bjorn Andersson
2023-09-21  2:37 ` [PATCH v3 1/3] dt-bindings: reserved-memory: rmtfs: Allow guard pages Bjorn Andersson
2023-09-21  7:06   ` Konrad Dybcio
2023-09-23 17:46   ` Krzysztof Kozlowski
2023-09-21  2:37 ` [PATCH v3 2/3] soc: qcom: rmtfs: Support discarding " Bjorn Andersson
2023-09-21  7:28   ` Konrad Dybcio
2023-09-21 18:04   ` Stephan Gerhold
2023-09-22  2:51     ` Bjorn Andersson
2023-09-22  7:35       ` Stephan Gerhold [this message]
2023-09-22 13:50         ` Bjorn Andersson
2023-09-21  2:37 ` [PATCH v3 3/3] soc: qcom: rtmfs: Handle reserved-memory allocation issues Bjorn Andersson
2023-09-21  7:09   ` Konrad Dybcio
2023-09-21 18:11   ` Stephan Gerhold
2023-09-22  2:44     ` Bjorn Andersson
2023-09-28  0:34 ` (subset) [PATCH v3 0/3] soc: qcom: rmtfs: Support dynamic allocation Bjorn Andersson

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=ZQ1DmSRIe56WQmnK@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_bjorande@quicinc.com \
    --cc=robh+dt@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: 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.