U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: neil.armstrong@linaro.org, Tom Rini <trini@konsulko.com>,
	Lukasz Majewski <lukma@denx.de>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Bin Meng <bmeng.cn@gmail.com>
Cc: Caleb Connolly <caleb.connolly@linaro.org>,
	u-boot-qcom@groups.io, u-boot@lists.denx.de
Subject: Re: [PATCH v3 2/3] usb: dwc3: fix dcache flush range calculation
Date: Fri, 4 Oct 2024 13:19:18 +0200	[thread overview]
Message-ID: <45b93c6f-f16d-4db8-b4e1-e4e2f3803e68@denx.de> (raw)
In-Reply-To: <38d30bce-269c-4caf-b198-e0d72ec58930@linaro.org>

On 10/4/24 9:16 AM, neil.armstrong@linaro.org wrote:
> On 03/10/2024 15:19, Marek Vasut wrote:
>> On 10/3/24 2:49 PM, Neil Armstrong wrote:
>>> On 02/10/2024 16:55, Marek Vasut wrote:
>>>> On 10/2/24 4:39 PM, Neil Armstrong wrote:
>>>>> The current flush operation will omit doing a flush/invalidate on
>>>>> the first and last bytes if the base address and size are not aligned
>>>>> with DMA_MINALIGN.
>>>>>
>>>>> This causes operation failures Qualcomm platforms.
>>>>>
>>>>> Take in account the alignment and size of the buffer and also
>>>>> flush the previous and last cacheline.
>>>>>
>>>>> Remove CACHELINE_SIZE which was the same as DMA_MINALIGN.
>>>>
>>>> It isn't the same, CACHELINE_SIZE was set to 
>>>> CONFIG_SYS_CACHELINE_SIZE (CPU L1 cache cacheline length) while 
>>>> ARCH_DMA_MINALIGN is DMA engine alignment requirement (from times 
>>>> where there used to be one DMA engine on most devices). You likely 
>>>> want a max(CONFIG_SYS_CACHELINE_SIZE, dwc3-buffer-alignment- 
>>>> requirement) to really correctly align the buffer.
>>>
>>> It is definitely true for platforms declaring dma_alloc_coherent() 
>>> (arm, riscv, x86)
>>> except nios2 but there's 0 chance dwc3 appears on a nios2 platform.
>> There is real chance of that, because on modern SoCFPGA platforms 
>> (Agilex) you can have the FPGA content access the SoC peripherals, and 
>> one of the SoC peripherals is DWC3 controller. If anyone would 
>> actually synthesize it is another question ... but it is an FPGA, so 
>> that option exists.
> 
> Guess I'll switch to CACHELINE_SIZE instead of DMA_MINALIGN for nios2.
I think max(CONFIG_SYS_CACHELINE_SIZE, ARCH_DMA_MINALIGN) should cover 
all the cases ?

  reply	other threads:[~2024-10-04 11:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 14:39 [PATCH v3 0/3] dwc3: gadget: properly fix cache operations Neil Armstrong
2024-10-02 14:39 ` [PATCH v3 1/3] usb: dwc3: allocate setup_buf with dma_alloc_coherent() Neil Armstrong
2024-10-02 14:51   ` Marek Vasut
2024-10-02 14:39 ` [PATCH v3 2/3] usb: dwc3: fix dcache flush range calculation Neil Armstrong
2024-10-02 14:55   ` Marek Vasut
2024-10-03 12:49     ` Neil Armstrong
2024-10-03 13:19       ` Marek Vasut
2024-10-04  7:16         ` neil.armstrong
2024-10-04 11:19           ` Marek Vasut [this message]
2024-10-02 14:39 ` [PATCH v3 3/3] usb: dwc3: invalidate dcache on buffer used in interrupt handling Neil Armstrong

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=45b93c6f-f16d-4db8-b4e1-e4e2f3803e68@denx.de \
    --to=marex@denx.de \
    --cc=bmeng.cn@gmail.com \
    --cc=caleb.connolly@linaro.org \
    --cc=lukma@denx.de \
    --cc=mkorpershoek@baylibre.com \
    --cc=neil.armstrong@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot-qcom@groups.io \
    --cc=u-boot@lists.denx.de \
    /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