Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: marek.vasut@gmail.com (Marek Vasut)
Subject: [PATCH 1/2] [RFC] ata: ahci: Respect bus DMA constraints
Date: Thu, 7 Mar 2019 12:14:06 +0100	[thread overview]
Message-ID: <a8b5b75f-2660-e216-033a-77808e2afb76@gmail.com> (raw)
In-Reply-To: <79e44e90-b16a-5315-e02f-101a2ebbb6a0@arm.com>

On 3/7/19 10:48 AM, Robin Murphy wrote:
> On 2019-03-07 9:37 am, Marek Vasut wrote:
>> On 3/7/19 10:32 AM, Robin Murphy wrote:
>>> On 2019-03-07 12:04 am, marek.vasut@gmail.com wrote:
>>>> From: Marek Vasut <marek.vasut+renesas at gmail.com>
>>>>
>>>> Since commit 6c2fb2ea7636 ("of/device: Set bus DMA mask as
>>>> appropriate"),
>>>> the upstream bus can constraint device DMA range. Respect that
>>>> constraint
>>>> and do not change the device DMA masks if they were already set.
>>>>
>>>> This is applicable e.g. on systems where the PCIe controller cannot
>>>> expose
>>>> the full address space range. Such a system may have a 64bit CPU with
>>>> DRAM
>>>> mapped both below and above the 32bit address space, yet the PCIe
>>>> devices
>>>> can not perform DMA directly to/from the DRAM range above the 32bit
>>>> limit.
>>>> Hence, for such setup to work, all the buffers must exist below the
>>>> 32bit
>>>> limit.
>>>>
>>>> Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
>>>> Cc: Christoph Hellwig <hch at lst.de>
>>>> Cc: Geert Uytterhoeven <geert+renesas at glider.be>
>>>> Cc: Jens Axboe <axboe at fb.com>
>>>> Cc: Jens Axboe <axboe at kernel.dk>
>>>> Cc: Keith Busch <keith.busch at intel.com>
>>>> Cc: Robin Murphy <robin.murphy at arm.com>
>>>> Cc: Sagi Grimberg <sagi at grimberg.me>
>>>> Cc: Wolfram Sang <wsa+renesas at sang-engineering.com>
>>>> Cc: linux-renesas-soc at vger.kernel.org
>>>> To: linux-ide at vger.kernel.org
>>>> To: linux-nvme at lists.infradead.org
>>>> ---
>>>> ?? drivers/ata/ahci.c | 7 +++++++
>>>> ?? 1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
>>>> index 021ce46e2e57..2acce056dd8c 100644
>>>> --- a/drivers/ata/ahci.c
>>>> +++ b/drivers/ata/ahci.c
>>>> @@ -926,6 +926,13 @@ static int ahci_configure_dma_masks(struct
>>>> pci_dev *pdev, int using_dac)
>>>> ?????? if (pdev->dma_mask && pdev->dma_mask < DMA_BIT_MASK(32))
>>>> ?????????? return 0;
>>>> ?? +??? /*
>>>> +???? * The upstream device could have applied DMA constraints already,
>>>> +???? * respect those and do not change the DMA masks.
>>>> +???? */
>>>> +??? if (pdev->dev.dma_mask && pdev->dev.coherent_dma_mask)
>>>> +??????? return 0;
>>>
>>> At least for DT platforms, the device masks are always going to be set
>>> to some initial value, which will most commonly just be the 32-bit
>>> default - that should not prevent the driver from setting wider masks if
>>> that's what the device really supports (in fact there are some patches
>>> queued in which we're now starting to formalise that properly).
>>>
>>> Are you seeing a problem with a DMA API backend failing to respect
>>> bus_dma_mask?
>>
>> Yes, the DMA mask gets overridden here to 64bit one, which on the R-Car
>> Gen3 with PCI with 32bit addressing limitation makes the AHCI driver
>> fail (and NVMe driver, and xHCI PCI etc). All those PCI devices fail the
>> same way because they override the DMA mask.
> 
> Right, but whoever *interprets* the device masks after the driver has
> overridden them should be taking the (smaller) bus mask into account as
> well, so the question is where is *that* not being done correctly?

Do you have a hint where I should look for that ?

-- 
Best regards,
Marek Vasut

  reply	other threads:[~2019-03-07 11:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07  0:04 [PATCH 1/2] [RFC] ata: ahci: Respect bus DMA constraints marek.vasut
2019-03-07  0:04 ` [PATCH 2/2] [RFC] nvme-pci: " marek.vasut
2019-03-07  9:32 ` [PATCH 1/2] [RFC] ata: ahci: " Robin Murphy
2019-03-07  9:37   ` Marek Vasut
2019-03-07  9:48     ` Robin Murphy
2019-03-07 11:14       ` Marek Vasut [this message]
2019-03-08  7:18         ` Christoph Hellwig
2019-03-08 23:23           ` Marek Vasut
2019-03-13 18:30             ` Christoph Hellwig
2019-03-16 21:25               ` Marek Vasut
2019-03-16 23:04                 ` Marek Vasut
2019-03-17 10:29                   ` Geert Uytterhoeven
2019-03-17 23:36                     ` Marek Vasut
2019-03-18 13:14                       ` Robin Murphy
2019-03-18 23:25                         ` Marek Vasut
2019-03-28  3:25                           ` Marek Vasut
2019-04-09 12:16                             ` Marek Vasut
2019-03-17 10:24                 ` Geert Uytterhoeven

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=a8b5b75f-2660-e216-033a-77808e2afb76@gmail.com \
    --to=marek.vasut@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