From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
robh+dt@kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, Daniele.Palmas@telit.com,
bjorn.andersson@linaro.org
Subject: Re: [PATCH v4 3/3] mtd: rawnand: qcom: Add support for secure regions in NAND memory
Date: Mon, 8 Mar 2021 19:04:52 +0530 [thread overview]
Message-ID: <20210308133452.GE5457@thinkpad> (raw)
In-Reply-To: <20210308133410.GD5457@thinkpad>
On Mon, Mar 08, 2021 at 07:04:17PM +0530, Manivannan Sadhasivam wrote:
> On Mon, Mar 08, 2021 at 10:02:47AM +0100, Boris Brezillon wrote:
> > On Mon, 8 Mar 2021 11:14:47 +0530
> > Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> wrote:
> >
>
> [...]
>
> > > /* helper to configure address register values */
> > > -static void set_address(struct qcom_nand_host *host, u16 column, int page)
> > > +static int set_address(struct qcom_nand_host *host, u16 column, int page)
> > > {
> > > struct nand_chip *chip = &host->chip;
> > > struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
> > > + u32 offs = page << chip->page_shift;
> > > + int i, j;
> > > +
> > > + /* Skip touching the secure regions if present */
> > > + for (i = 0, j = 0; i < host->nr_sec_regions; i++, j += 2) {
> > > + if (offs >= host->sec_regions[j] &&
> > > + (offs <= host->sec_regions[j] + host->sec_regions[j + 1]))
> > > + return -EIO;
> > > + }
> >
> > Hm, not sure that's a good idea to make this check part of
> > set_address(). Looks like set_address() can be used for ONFI page
> > access too, and you definitely don't want to block those
> > requests. I'd recommend having a separate helper that you can call from
> > qcom_nandc_{read,write}_{oob,page,page_raw}().
> >
>
> Right but I went for the code simplicity :/ Anyway, since you're favoring
> towards moving this check into code, I'll incorporate your suggestion
s/code/core
> accordingly.
>
> Thanks,
> Mani
WARNING: multiple messages have this Message-ID (diff)
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
robh+dt@kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, Daniele.Palmas@telit.com,
bjorn.andersson@linaro.org
Subject: Re: [PATCH v4 3/3] mtd: rawnand: qcom: Add support for secure regions in NAND memory
Date: Mon, 8 Mar 2021 19:04:52 +0530 [thread overview]
Message-ID: <20210308133452.GE5457@thinkpad> (raw)
In-Reply-To: <20210308133410.GD5457@thinkpad>
On Mon, Mar 08, 2021 at 07:04:17PM +0530, Manivannan Sadhasivam wrote:
> On Mon, Mar 08, 2021 at 10:02:47AM +0100, Boris Brezillon wrote:
> > On Mon, 8 Mar 2021 11:14:47 +0530
> > Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> wrote:
> >
>
> [...]
>
> > > /* helper to configure address register values */
> > > -static void set_address(struct qcom_nand_host *host, u16 column, int page)
> > > +static int set_address(struct qcom_nand_host *host, u16 column, int page)
> > > {
> > > struct nand_chip *chip = &host->chip;
> > > struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
> > > + u32 offs = page << chip->page_shift;
> > > + int i, j;
> > > +
> > > + /* Skip touching the secure regions if present */
> > > + for (i = 0, j = 0; i < host->nr_sec_regions; i++, j += 2) {
> > > + if (offs >= host->sec_regions[j] &&
> > > + (offs <= host->sec_regions[j] + host->sec_regions[j + 1]))
> > > + return -EIO;
> > > + }
> >
> > Hm, not sure that's a good idea to make this check part of
> > set_address(). Looks like set_address() can be used for ONFI page
> > access too, and you definitely don't want to block those
> > requests. I'd recommend having a separate helper that you can call from
> > qcom_nandc_{read,write}_{oob,page,page_raw}().
> >
>
> Right but I went for the code simplicity :/ Anyway, since you're favoring
> towards moving this check into code, I'll incorporate your suggestion
s/code/core
> accordingly.
>
> Thanks,
> Mani
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2021-03-08 13:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 5:44 [PATCH v4 0/3] Add support for secure regions in Qcom NANDc driver Manivannan Sadhasivam
2021-03-08 5:44 ` Manivannan Sadhasivam
2021-03-08 5:44 ` [PATCH v4 1/3] dt-bindings: mtd: Convert Qcom NANDc binding to YAML Manivannan Sadhasivam
2021-03-08 5:44 ` Manivannan Sadhasivam
2021-03-08 5:44 ` [PATCH v4 2/3] dt-bindings: mtd: Add a property to declare secure regions in NAND chips Manivannan Sadhasivam
2021-03-08 5:44 ` Manivannan Sadhasivam
2021-03-08 9:10 ` Boris Brezillon
2021-03-08 9:10 ` Boris Brezillon
2021-03-08 13:31 ` Manivannan Sadhasivam
2021-03-08 13:31 ` Manivannan Sadhasivam
2021-03-09 7:57 ` Boris Brezillon
2021-03-09 7:57 ` Boris Brezillon
2021-03-08 5:44 ` [PATCH v4 3/3] mtd: rawnand: qcom: Add support for secure regions in NAND memory Manivannan Sadhasivam
2021-03-08 5:44 ` Manivannan Sadhasivam
2021-03-08 9:02 ` Boris Brezillon
2021-03-08 9:02 ` Boris Brezillon
2021-03-08 13:34 ` Manivannan Sadhasivam
2021-03-08 13:34 ` Manivannan Sadhasivam
2021-03-08 13:34 ` Manivannan Sadhasivam [this message]
2021-03-08 13:34 ` Manivannan Sadhasivam
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=20210308133452.GE5457@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=Daniele.Palmas@telit.com \
--cc=bjorn.andersson@linaro.org \
--cc=boris.brezillon@collabora.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=robh+dt@kernel.org \
--cc=vigneshr@ti.com \
/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.