Alexandre Courbot
2014-Apr-23 06:11 UTC
[Nouveau] [PATCH v2 04/10] drm/nouveau/fb: add GK20A support
On Wed, Apr 23, 2014 at 11:07 AM, Alexandre Courbot <acourbot at nvidia.com> wrote:> On 04/22/2014 07:40 PM, Thierry Reding wrote: >> >> * PGP Signed by an unknown key >> >> >> On Mon, Apr 21, 2014 at 03:02:16PM +0900, Alexandre Courbot wrote: >> [...] >>> >>> diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c >>> b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c >> >> [...] >>> >>> + pages = dma_alloc_from_contiguous(dev, ncmin, order); >>> + if (!pages) { >>> + gk20a_ram_put(pfb, &mem); >>> + return -ENOMEM; >>> + } >>> + >>> + dma_addr = pfn_to_dma(nv_device_base(nv_device(pfb)), >>> + page_to_pfn(pages)); >> >> >> This breaks compilation on x86 because neither pfn_to_dma() nor >> dma_to_pfn() are available. Is there some other way this can be >> allocated so that these functions don't need to be called? > > > Mmm, this is bad. There is probably another more portable way to do this. > Let me look for it.page_to_phys()/phys_to_page() can be used by drivers and will work just fine here since the CPU and GPU use the same physical addresses to access memory. Thanks, Alex.
Thierry Reding
2014-Apr-28 11:44 UTC
[Nouveau] [PATCH v2 04/10] drm/nouveau/fb: add GK20A support
On Wed, Apr 23, 2014 at 03:11:01PM +0900, Alexandre Courbot wrote:> On Wed, Apr 23, 2014 at 11:07 AM, Alexandre Courbot <acourbot at nvidia.com> wrote: > > On 04/22/2014 07:40 PM, Thierry Reding wrote: > >> > >> * PGP Signed by an unknown key > >> > >> > >> On Mon, Apr 21, 2014 at 03:02:16PM +0900, Alexandre Courbot wrote: > >> [...] > >>> > >>> diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c > >>> b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c > >> > >> [...] > >>> > >>> + pages = dma_alloc_from_contiguous(dev, ncmin, order); > >>> + if (!pages) { > >>> + gk20a_ram_put(pfb, &mem); > >>> + return -ENOMEM; > >>> + } > >>> + > >>> + dma_addr = pfn_to_dma(nv_device_base(nv_device(pfb)), > >>> + page_to_pfn(pages)); > >> > >> > >> This breaks compilation on x86 because neither pfn_to_dma() nor > >> dma_to_pfn() are available. Is there some other way this can be > >> allocated so that these functions don't need to be called? > > > > > > Mmm, this is bad. There is probably another more portable way to do this. > > Let me look for it. > > page_to_phys()/phys_to_page() can be used by drivers and will work > just fine here since the CPU and GPU use the same physical addresses > to access memory.I'm wondering how this is going to pan out when we try adding IOMMU support. But I guess we can cross that bridge when we come to it. Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/nouveau/attachments/20140428/e952897e/attachment-0001.sig>
Alexandre Courbot
2014-May-01 04:49 UTC
[Nouveau] [PATCH v2 04/10] drm/nouveau/fb: add GK20A support
On Mon, Apr 28, 2014 at 8:44 PM, Thierry Reding <thierry.reding at gmail.com> wrote:> On Wed, Apr 23, 2014 at 03:11:01PM +0900, Alexandre Courbot wrote: >> On Wed, Apr 23, 2014 at 11:07 AM, Alexandre Courbot <acourbot at nvidia.com> wrote: >> > On 04/22/2014 07:40 PM, Thierry Reding wrote: >> >> >> >> * PGP Signed by an unknown key >> >> >> >> >> >> On Mon, Apr 21, 2014 at 03:02:16PM +0900, Alexandre Courbot wrote: >> >> [...] >> >>> >> >>> diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c >> >>> b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c >> >> >> >> [...] >> >>> >> >>> + pages = dma_alloc_from_contiguous(dev, ncmin, order); >> >>> + if (!pages) { >> >>> + gk20a_ram_put(pfb, &mem); >> >>> + return -ENOMEM; >> >>> + } >> >>> + >> >>> + dma_addr = pfn_to_dma(nv_device_base(nv_device(pfb)), >> >>> + page_to_pfn(pages)); >> >> >> >> >> >> This breaks compilation on x86 because neither pfn_to_dma() nor >> >> dma_to_pfn() are available. Is there some other way this can be >> >> allocated so that these functions don't need to be called? >> > >> > >> > Mmm, this is bad. There is probably another more portable way to do this. >> > Let me look for it. >> >> page_to_phys()/phys_to_page() can be used by drivers and will work >> just fine here since the CPU and GPU use the same physical addresses >> to access memory. > > I'm wondering how this is going to pan out when we try adding IOMMU > support. But I guess we can cross that bridge when we come to it.Agreed. Besides I hope the day won't come where we have to go through 2 layers of memory translation for the GPU...