linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Alexandre Courbot <gnurou@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ben Skeggs <bskeggs@redhat.com>, David Airlie <airlied@linux.ie>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>
Subject: Re: [Nouveau] [PATCH v4 1/3] drm/nouveau: set streaming DMA mask early
Date: Thu, 6 Oct 2016 13:57:10 +0100	[thread overview]
Message-ID: <CAKv+Gu8w+LN3j3JahvJBgFCTxOb3-HfzXJHigvjTLLUUpaxb+A@mail.gmail.com> (raw)
In-Reply-To: <CAAVeFuL8tsJX2iFMny2ZRmj+WU9rb9K0=rnkJpbMn_-b4Cnscw@mail.gmail.com>

On 3 October 2016 at 06:39, Alexandre Courbot <gnurou@gmail.com> wrote:
> On Mon, Sep 26, 2016 at 9:32 PM, Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
>> Some subdevices (i.e., fb/nv50.c and fb/gf100.c) map a scratch page using
>> dma_map_page() way before the TTM layer has had a chance to set the DMA
>> mask. This may prevent the driver from loading at all on platforms whose
>> system memory is not covered by the default DMA mask of 32-bit (i.e., when
>> all RAM is above 4 GB).
>>
>> So set a preliminary DMA mask right after constructing the PCI device, and
>> base it on the .dma_bits member of the MMU subdevice, which is what the TTM
>> layer will base the DMA mask on as well.
>>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>>  drivers/gpu/drm/nouveau/nouveau_drm.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
>> index 652ab111dd74..e61e9a0adb51 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
>> @@ -361,6 +361,17 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
>>
>>         pci_set_master(pdev);
>>
>> +       /*
>> +        * Set a preliminary DMA mask based on the .dma_bits member of the
>> +        * MMU subdevice. This allows other subdevices to create DMA mappings
>> +        * in their init() function, which are called before the TTM layer sets
>> +        * the DMA mask definitively.
>> +        * This is necessary for platforms where the default DMA mask of 32
>> +        * does not cover any system memory, i.e., when all RAM is > 4 GB.
>> +        */
>> +       dma_set_mask_and_coherent(device->dev,
>> +                                 DMA_BIT_MASK(device->mmu->dma_bits));
>
> I would just move this to nvkm_device_pci_new() so that it perfectly
> mirrors the same call done in nvkm_device_tegra_new(), which was done
> for the same purpose. Otherwise, looks good to me.

OK, will do that.

  reply	other threads:[~2016-10-06 12:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 12:32 [PATCH v4 0/3] drm/nouveau: set DMA mask before mapping scratch page Ard Biesheuvel
2016-09-26 12:32 ` [PATCH v4 1/3] drm/nouveau: set streaming DMA mask early Ard Biesheuvel
2016-10-03  5:39   ` [Nouveau] " Alexandre Courbot
2016-10-06 12:57     ` Ard Biesheuvel [this message]
2016-09-26 12:32 ` [PATCH v4 2/3] drm/nouveau/fb/gf100: defer DMA mapping of scratch page to init() hook Ard Biesheuvel
2016-10-03  5:44   ` [Nouveau] " Alexandre Courbot
2016-09-26 12:32 ` [PATCH v4 3/3] drm/nouveau/fb/nv50: " Ard Biesheuvel
2016-10-03  5:45   ` [Nouveau] " Alexandre Courbot

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=CAKv+Gu8w+LN3j3JahvJBgFCTxOb3-HfzXJHigvjTLLUUpaxb+A@mail.gmail.com \
    --to=ard.biesheuvel@linaro.org \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gnurou@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.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;
as well as URLs for NNTP newsgroup(s).