[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210308133410.GD5457@thinkpad>
Date: Mon, 8 Mar 2021 19:04:10 +0530
From: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To: Boris Brezillon <boris.brezillon@...labora.com>
Cc: miquel.raynal@...tlin.com, richard@....at, vigneshr@...com,
robh+dt@...nel.org, linux-arm-msm@...r.kernel.org,
devicetree@...r.kernel.org, linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org, Daniele.Palmas@...it.com,
bjorn.andersson@...aro.org
Subject: Re: [PATCH v4 3/3] mtd: rawnand: qcom: Add support for secure
regions in NAND memory
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@...aro.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
accordingly.
Thanks,
Mani
Powered by blists - more mailing lists