Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1491264 > unrolled thread
| Started by | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| First post | 2016-09-26 14:40 +0200 |
| Last post | 2016-10-06 15:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v4 1/3] drm/nouveau: set streaming DMA mask early Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-09-26 14:40 +0200
Re: [Nouveau] [PATCH v4 1/3] drm/nouveau: set streaming DMA mask early Alexandre Courbot <gnurou@gmail.com> - 2016-10-03 07:50 +0200
Re: [Nouveau] [PATCH v4 1/3] drm/nouveau: set streaming DMA mask early Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-10-06 15:00 +0200
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2016-09-26 14:40 +0200 |
| Subject | [PATCH v4 1/3] drm/nouveau: set streaming DMA mask early |
| Message-ID | <slDmp-3Pp-9@gated-at.bofh.it> |
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));
+
ret = drm_get_pci_dev(pdev, pent, &driver_pci);
if (ret) {
nvkm_device_del(&device);
--
2.7.4
[toc] | [next] | [standalone]
| From | Alexandre Courbot <gnurou@gmail.com> |
|---|---|
| Date | 2016-10-03 07:50 +0200 |
| Subject | Re: [Nouveau] [PATCH v4 1/3] drm/nouveau: set streaming DMA mask early |
| Message-ID | <so4it-8qM-3@gated-at.bofh.it> |
| In reply to | #1491264 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2016-10-06 15:00 +0200 |
| Subject | Re: [Nouveau] [PATCH v4 1/3] drm/nouveau: set streaming DMA mask early |
| Message-ID | <spgrf-dR-9@gated-at.bofh.it> |
| In reply to | #1494705 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web