From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: "Sverdlin, Alexander (Nokia - DE/Ulm)" <alexander.sverdlin@nokia.com>
Cc: Bin Meng <bmeng.cn@gmail.com>,
"Porte,
Romain \(Nokia - FR/Paris-Saclay\)" <romain.porte@nokia.com>,
Boris Brezillon <bbrezillon@kernel.org>,
Richard Weinberger <richard@nod.at>,
Tudor Ambarus <tudor.ambarus@microchip.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
Marek Vasut <marek.vasut@gmail.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"Fabreges,
Pascal \(Nokia - FR/Paris-Saclay\)" <pascal.fabreges@nokia.com>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH v2] spi-nor: intel-spi: Avoid crossing 4K address boundary on read/write
Date: Wed, 27 Feb 2019 12:27:32 +0200 [thread overview]
Message-ID: <20190227102732.GU2696@lahna.fi.intel.com> (raw)
In-Reply-To: <20190227095617.20968-1-alexander.sverdlin@nokia.com>
On Wed, Feb 27, 2019 at 09:57:15AM +0000, Sverdlin, Alexander (Nokia - DE/Ulm) wrote:
> It was observed that reads crossing 4K address boundary are failing.
>
> This limitation is mentioned in Intel documents:
>
> Intel(R) 9 Series Chipset Family Platform Controller Hub (PCH) Datasheet:
>
> "5.26.3 Flash Access
> Program Register Access:
> * Program Register Accesses are not allowed to cross a 4 KB boundary..."
>
> Enhanced Serial Peripheral Interface (eSPI)
> Interface Base Specification (for Client and Server Platforms):
>
> "5.1.4 Address
> For other memory transactions, the address may start or end at any byte
> boundary. However, the address and payload length combination must not
> cross the naturally aligned address boundary of the corresponding Maximum
> Payload Size. It must not cross a 4 KB address boundary."
>
> Avoid this by splitting an operation crossing the boundary into two
> operations.
>
> Cc: stable@vger.kernel.org
> Reported-by: Romain Porte <romain.porte@nokia.com>
> Tested-by: Pascal Fabreges <pascal.fabreges@nokia.com>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> ---
> Changelog:
> v2: More macros! As Mika suggested.
>
> drivers/mtd/spi-nor/intel-spi.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/intel-spi.c b/drivers/mtd/spi-nor/intel-spi.c
> index af0a220..8c279c4 100644
> --- a/drivers/mtd/spi-nor/intel-spi.c
> +++ b/drivers/mtd/spi-nor/intel-spi.c
> @@ -632,6 +632,10 @@ static ssize_t intel_spi_read(struct spi_nor *nor, loff_t from, size_t len,
> while (len > 0) {
> block_size = min_t(size_t, len, INTEL_SPI_FIFO_SZ);
>
> + /* Read cannot cross 4K boundary */
> + blocksize = min(from + block_size, round_up(from + 1, SZ_4K)) -
> + from;
Nit:
It looks better if you put it into one line like:
blocksize = min(from + block_size, round_up(from + 1, SZ_4K)) - from;
Regardless of that,
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: "Sverdlin, Alexander (Nokia - DE/Ulm)" <alexander.sverdlin@nokia.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
Marek Vasut <marek.vasut@gmail.com>,
Tudor Ambarus <tudor.ambarus@microchip.com>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Boris Brezillon <bbrezillon@kernel.org>,
Richard Weinberger <richard@nod.at>,
Bin Meng <bmeng.cn@gmail.com>,
"Porte,
Romain (Nokia - FR/Paris-Saclay)" <romain.porte@nokia.com>,
"Fabreges,
Pascal (Nokia - FR/Paris-Saclay)" <pascal.fabreges@nokia.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v2] spi-nor: intel-spi: Avoid crossing 4K address boundary on read/write
Date: Wed, 27 Feb 2019 12:27:32 +0200 [thread overview]
Message-ID: <20190227102732.GU2696@lahna.fi.intel.com> (raw)
In-Reply-To: <20190227095617.20968-1-alexander.sverdlin@nokia.com>
On Wed, Feb 27, 2019 at 09:57:15AM +0000, Sverdlin, Alexander (Nokia - DE/Ulm) wrote:
> It was observed that reads crossing 4K address boundary are failing.
>
> This limitation is mentioned in Intel documents:
>
> Intel(R) 9 Series Chipset Family Platform Controller Hub (PCH) Datasheet:
>
> "5.26.3 Flash Access
> Program Register Access:
> * Program Register Accesses are not allowed to cross a 4 KB boundary..."
>
> Enhanced Serial Peripheral Interface (eSPI)
> Interface Base Specification (for Client and Server Platforms):
>
> "5.1.4 Address
> For other memory transactions, the address may start or end at any byte
> boundary. However, the address and payload length combination must not
> cross the naturally aligned address boundary of the corresponding Maximum
> Payload Size. It must not cross a 4 KB address boundary."
>
> Avoid this by splitting an operation crossing the boundary into two
> operations.
>
> Cc: stable@vger.kernel.org
> Reported-by: Romain Porte <romain.porte@nokia.com>
> Tested-by: Pascal Fabreges <pascal.fabreges@nokia.com>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> ---
> Changelog:
> v2: More macros! As Mika suggested.
>
> drivers/mtd/spi-nor/intel-spi.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/intel-spi.c b/drivers/mtd/spi-nor/intel-spi.c
> index af0a220..8c279c4 100644
> --- a/drivers/mtd/spi-nor/intel-spi.c
> +++ b/drivers/mtd/spi-nor/intel-spi.c
> @@ -632,6 +632,10 @@ static ssize_t intel_spi_read(struct spi_nor *nor, loff_t from, size_t len,
> while (len > 0) {
> block_size = min_t(size_t, len, INTEL_SPI_FIFO_SZ);
>
> + /* Read cannot cross 4K boundary */
> + blocksize = min(from + block_size, round_up(from + 1, SZ_4K)) -
> + from;
Nit:
It looks better if you put it into one line like:
blocksize = min(from + block_size, round_up(from + 1, SZ_4K)) - from;
Regardless of that,
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
next prev parent reply other threads:[~2019-02-27 10:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-26 11:23 [PATCH] spi-nor: intel-spi: Avoid crossing 4K address boundary on read/write Sverdlin, Alexander (Nokia - DE/Ulm)
2019-02-26 11:23 ` Sverdlin, Alexander (Nokia - DE/Ulm)
2019-02-26 11:31 ` Mika Westerberg
2019-02-26 11:31 ` Mika Westerberg
2019-02-27 9:57 ` [PATCH v2] " Sverdlin, Alexander (Nokia - DE/Ulm)
2019-02-27 9:57 ` Sverdlin, Alexander (Nokia - DE/Ulm)
2019-02-27 10:27 ` Mika Westerberg [this message]
2019-02-27 10:27 ` Mika Westerberg
2019-02-27 13:29 ` Sverdlin, Alexander (Nokia - DE/Ulm)
2019-02-27 13:29 ` Sverdlin, Alexander (Nokia - DE/Ulm)
2019-03-01 21:22 ` Sasha Levin
2019-02-27 13:23 ` [PATCH] " Sasha Levin
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=20190227102732.GU2696@lahna.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=alexander.sverdlin@nokia.com \
--cc=bbrezillon@kernel.org \
--cc=bmeng.cn@gmail.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=pascal.fabreges@nokia.com \
--cc=richard@nod.at \
--cc=romain.porte@nokia.com \
--cc=stable@vger.kernel.org \
--cc=tudor.ambarus@microchip.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.