From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Francisco Iglesias <frasse.iglesias@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
qemu-stable@nongnu.org, Alistair Francis <alistair@alistair23.me>,
qemu-devel@nongnu.org, Prasad J Pandit <ppandit@redhat.com>,
Lei Sun <slei.casper@gmail.com>,
qemu-arm@nongnu.org,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: Re: [Qemu-devel] [PATCH-for-4.1 v5 3/3] hw/ssi/xilinx_spips: Avoid out-of-bound access to lqspi_buf[]
Date: Mon, 8 Jul 2019 16:58:29 +0200 [thread overview]
Message-ID: <41f075ef-9b80-cb66-0fb1-d03079cd93a4@redhat.com> (raw)
In-Reply-To: <20190708142622.k4s5oknmzzj4brxd@fralle-msi>
Hi Francisco,
On 7/8/19 4:26 PM, Francisco Iglesias wrote:
> Hi Philippe,
>
> On [2019 Jul 08] Mon 12:47:50, Philippe Mathieu-Daudé wrote:
>> Both lqspi_read() and lqspi_load_cache() expect a 32-bit
>> aligned address.
>>
>> From UG1085 datasheet [*] Chapter 22: Quad-SPI Controller:
>
> s/22/24/
I'm confuse, Chapter 24 is "SD/SDIO Controller", so it seems this Xilinx
datasheet is not stable to refer to. Maybe I should simply use:
From UG1085 datasheet [*] Chapter on 'Quad-SPI Controller':
>
> After above change:
>
> Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
> Tested-by: Francisco Iglesias <frasse.iglesias@gmail.com>
>
> (I tested all three patches so the Tested-by tag can also be appended on the
> other two)
Thanks!
>
> Best regards,
> Francisco Iglesias
>
>>
>> Transfer Size Limitations
>>
>> Because of the 32-bit wide TX, RX, and generic FIFO, all
>> APB/AXI transfers must be an integer multiple of 4-bytes.
>> Shorter transfers are not possible.
>>
>> Set MemoryRegionOps.impl values to force 32-bit accesses,
>> this way we are sure we do not access the lqspi_buf[] array
>> out of bound.
>>
>> [*] https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> v5: add datasheet reference, drop RFC prefix, fix build (Francisco)
>> ---
>> hw/ssi/xilinx_spips.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c
>> index 3c4e8365ee..b29e0a4a89 100644
>> --- a/hw/ssi/xilinx_spips.c
>> +++ b/hw/ssi/xilinx_spips.c
>> @@ -1239,6 +1239,10 @@ static const MemoryRegionOps lqspi_ops = {
>> .read_with_attrs = lqspi_read,
>> .write_with_attrs = lqspi_write,
>> .endianness = DEVICE_NATIVE_ENDIAN,
>> + .impl = {
>> + .min_access_size = 4,
>> + .max_access_size = 4,
>> + },
>> .valid = {
>> .min_access_size = 1,
>> .max_access_size = 4
>> --
>> 2.20.1
>>
next prev parent reply other threads:[~2019-07-08 15:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-08 10:47 [Qemu-devel] [PATCH-for-4.1 v5 0/3] hw/ssi/xilinx_spips: Avoid NULL dereference and out-of-bound access Philippe Mathieu-Daudé
2019-07-08 10:47 ` [Qemu-devel] [PATCH-for-4.1 v5 1/3] hw/ssi/xilinx_spips: Convert lqspi_read() to read_with_attrs Philippe Mathieu-Daudé
2019-07-09 11:11 ` Peter Maydell
2019-07-09 12:10 ` Philippe Mathieu-Daudé
2019-07-08 10:47 ` [Qemu-devel] [PATCH-for-4.1 v5 2/3] hw/ssi/xilinx_spips: Avoid AXI writes to the LQSPI linear memory Philippe Mathieu-Daudé
2019-07-08 10:47 ` [Qemu-devel] [PATCH-for-4.1 v5 3/3] hw/ssi/xilinx_spips: Avoid out-of-bound access to lqspi_buf[] Philippe Mathieu-Daudé
2019-07-08 14:26 ` Francisco Iglesias
2019-07-08 14:58 ` Philippe Mathieu-Daudé [this message]
2019-07-08 16:03 ` Francisco Iglesias
2019-07-09 10:58 ` Philippe Mathieu-Daudé
2019-07-09 11:15 ` Peter Maydell
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=41f075ef-9b80-cb66-0fb1-d03079cd93a4@redhat.com \
--to=philmd@redhat.com \
--cc=alistair@alistair23.me \
--cc=edgar.iglesias@gmail.com \
--cc=frasse.iglesias@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=ppandit@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=slei.casper@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).