public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Chris Ball <chris@printf.net>,
	linux-mmc <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH V2] mmc: sdhci-acpi: Add 64-bit DMA support
Date: Wed, 29 Oct 2014 10:53:31 +0200	[thread overview]
Message-ID: <5450AB0B.90908@intel.com> (raw)
In-Reply-To: <5303217.pZOl7Wlk1k@wuerfel>

On 28/10/14 17:38, Arnd Bergmann wrote:
> On Tuesday 28 October 2014 17:14:25 Adrian Hunter wrote:
>> On 28/10/2014 5:08 p.m., Arnd Bergmann wrote:
>>> On Tuesday 28 October 2014 16:14:46 Adrian Hunter wrote:
>>>> On 28/10/2014 3:54 p.m., Arnd Bergmann wrote:
>>>>> On Tuesday 28 October 2014 13:41:30 Adrian Hunter wrote:
>>>>>> On 28/10/14 12:18, Arnd Bergmann wrote:
>>>>>>> On Tuesday 28 October 2014 12:05:30 Adrian Hunter wrote:
>>>>>>>> On 28/10/14 11:43, Arnd Bergmann wrote:
>>>>>>>>> On Tuesday 28 October 2014 10:37:20 Adrian Hunter wrote:
>>>>>>>>>>    static int sdhci_acpi_enable_dma(struct sdhci_host *host)
>>>>>>>>>>    {
>>>>>>>>>> -       return 0;
>>>>>>>>>> +       struct sdhci_acpi_host *c = sdhci_priv(host);
>>>>>>>>>> +       struct device *dev = &c->pdev->dev;
>>>>>>>>>> +       int err = -1;
>>>>>>>>>> +
>>>>>>>>>> +       if (c->dma_setup)
>>>>>>>>>> +               return 0;
>>>>>>>>>> +
>>>>>>>>>> +       if (host->flags & SDHCI_USE_64_BIT_DMA) {
>>>>>>>>>> +               if (host->quirks2 & SDHCI_QUIRK2_BROKEN_64_BIT_DMA) {
>>>>>>>>>> +                       host->flags &= ~SDHCI_USE_64_BIT_DMA;
>>>>>>>>>> +               } else {
>>>>>>>>>> +                       err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
>>>>>>>>>> +                       if (err)
>>>>>>>>>> +                               dev_warn(dev, "Failed to set 64-bit DMA mask\n");
>>>>>>>>>> +               }
>>>>>>>>>> +       }
>>>>>>>>>> +
>>>>>>>>>> +       if (err)
>>>>>>>>>> +               err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
>>>>>>>>>> +
>>>>>>>>>> +       c->dma_setup = !err;
>>>>>>>>>> +
>>>>>>>>>> +       return err;
>>>>>>>>>>    }
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I don't think it's worth a dev_warn() message (maybe dev_info), there is nothing
>>>>>>>>
>>>>>>>> It is worth a dev_warn because 32-bit DMA can allocate memory for bounce
>>>>>>>> buffers which jeopardizes memory reclaim.
>>>>>>>
>>>>>>> Then you should also warn if SDHCI_USE_64_BIT_DMA isn't or if
>>>>>>> SDHCI_QUIRK2_BROKEN_64_BIT_DMA is set I guess.
>>>>>>
>>>>>> The warning is for when the controller supports 64-bit, not when it doesn't.
>>>>>
>>>>> But why warn about a feature of the controller being present? You just
>>>>> said it's a problem for memory reclaim if 64-bit DMA is not supported.
>>>>
>>>> The warning is for when the controller supports 64-bit but it can't
>>>> get a 64-bit DMA mask, and might therefore need to bounce things.
>>>
>>> What does "can't get a 64-bit DMA mask" mean? This is just a different
>>> way to say it doesn't support 64-bit for some reason.
>>
>> The host controller advertises whether it is capable of 64-bit DMA.  If
>> it is 64-bit capable but the driver cannot get a 64-bit DMA mask it issues
>> a warning.
> 
> But the host controller doesn't know if it's 64-bit capable, nor should
> it know. All the host controller knows is that it has registers to perform
> 64-bit DMA, but the platform code (ACPI in your case) is the only thing that
> knows how many of those address lines are connected to an upstream bus.

No, the SDHCI spec. says:

	64-bit System Bus Support
	Setting 1 to this bit indicates that the Host Controller supports 64-bit
	address descriptor mode and is connected to 64-bit address system bus.

So the expectation is that it is on a 64-bit bus.  The warning is reasonable.


  reply	other threads:[~2014-10-29  8:55 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21  9:26 [PATCH 00/15] mmc: sdhci: Add 64-bit ADMA support Adrian Hunter
2014-10-21  9:26 ` [PATCH 01/15] mmc: sdhci: Fix incorrect ADMA2 descriptor table size Adrian Hunter
2014-10-21  9:26 ` [PATCH 02/15] mmc: sdhci: Fix ADMA page boundary warnings Adrian Hunter
2014-10-21  9:26 ` [PATCH 03/15] mmc: sdhci: Fix ADMA table size warning Adrian Hunter
2014-10-21  9:26 ` [PATCH 04/15] mmc: sdhci: Rename two ADMA-related functions for consistency Adrian Hunter
2014-10-21  9:26 ` [PATCH 05/15] mmc: sdhci: Rename adma_desc to adma_table Adrian Hunter
2014-10-21  9:26 ` [PATCH 06/15] mmc: sdhci: Add sdhci_adma_mark_end() Adrian Hunter
2014-10-21  9:26 ` [PATCH 07/15] mmc: sdhci: Use 'void *' for not 'u8 *' for ADMA data Adrian Hunter
2014-10-21  9:26 ` [PATCH 08/15] mmc: sdhci: Parameterize ADMA sizes and alignment Adrian Hunter
2014-10-21  9:26 ` [PATCH 09/15] mmc: sdhci: Define maximum segments Adrian Hunter
2014-10-21  9:26 ` [PATCH 10/15] mmc: sdhci: Define ADMA constants Adrian Hunter
2014-10-21  9:26 ` [PATCH 11/15] mmc: sdhci: Define ADMA descriptor structure Adrian Hunter
2014-10-21  9:26 ` [PATCH 12/15] mmc: sdhci: Add 64-bit ADMA support Adrian Hunter
2014-10-21  9:26 ` [PATCH 13/15] mmc: sdhci-acpi: Add 64-bit DMA support Adrian Hunter
2014-10-21  9:33   ` Arnd Bergmann
2014-10-21 10:45     ` Adrian Hunter
2014-10-21 11:05       ` Arnd Bergmann
2014-10-28  8:37         ` [PATCH V2] " Adrian Hunter
2014-10-28  9:43           ` Arnd Bergmann
2014-10-28 10:05             ` Adrian Hunter
2014-10-28 10:18               ` Arnd Bergmann
2014-10-28 11:41                 ` Adrian Hunter
2014-10-28 13:54                   ` Arnd Bergmann
2014-10-28 14:14                     ` Adrian Hunter
2014-10-28 15:08                       ` Arnd Bergmann
2014-10-28 15:14                         ` Adrian Hunter
2014-10-28 15:38                           ` Arnd Bergmann
2014-10-29  8:53                             ` Adrian Hunter [this message]
2014-10-21  9:26 ` [PATCH 14/15] mmc: sdhci-pci: " Adrian Hunter
2014-10-21  9:26 ` [PATCH 15/15] mmc: mmc_test: Extend "Badly aligned" tests for 8-byte alignment Adrian Hunter
2014-10-30  7:25 ` [PATCH 00/15] mmc: sdhci: Add 64-bit ADMA support Adrian Hunter
2014-10-30  8:05   ` Arnd Bergmann
2014-10-30  8:40     ` Adrian Hunter
2014-10-30 10:00       ` Arnd Bergmann
2014-10-30 10:50         ` Adrian Hunter
2014-10-30 12:15           ` Arnd Bergmann
2014-10-30 12:55             ` Adrian Hunter
2014-11-03  8:28   ` Adrian Hunter
2014-11-03 14:40     ` Ulf Hansson

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=5450AB0B.90908@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=arnd@arndb.de \
    --cc=chris@printf.net \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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