From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Pekka Paalanen <pq@iki.fi>
Cc: thellstrom@vmware.com, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, bskeggs@redhat.com,
j.glisse@redhat.com, thomas@shipmail.org, airlied@redhat.com,
airlied@linux.ie, alexdeucher@gmail.com
Subject: Re: [PATCH 1/7] ttm/radeon/nouveau: Check the DMA address from TTM against known value.
Date: Wed, 31 Aug 2011 08:02:09 -0400 [thread overview]
Message-ID: <20110831120209.GB4297@dumpdata.com> (raw)
In-Reply-To: <20110831093329.1d948a92@farn.lan>
On Wed, Aug 31, 2011 at 09:33:29AM +0300, Pekka Paalanen wrote:
> On Tue, 30 Aug 2011 22:41:46 -0400
> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
>
> > . instead of checking against the DMA_ERROR_CODE value which is
> > per-platform specific. The zero value is a known invalid value
> > that the TTM layer sets on the dma_address array if it is not
> > used (ttm_tt_alloc_page_directory calls drm_calloc_large which
> > creates a page with GFP_ZERO).
> >
> > We can't use pci_dma_mapping_error as that is IOMMU
> > specific (some check for a specific physical address, some
> > for ranges, some just do a check against zero).
> >
> > Also update the comments in the header about the true state
> > of that parameter.
> >
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > ---
> > drivers/gpu/drm/nouveau/nouveau_sgdma.c | 3 +--
> > drivers/gpu/drm/radeon/radeon_gart.c | 4 +---
> > include/drm/ttm/ttm_page_alloc.h | 4 ++--
> > 3 files changed, 4 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> > b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index 82fad91..624e2db
> > 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> > @@ -42,8 +42,7 @@ nouveau_sgdma_populate(struct ttm_backend *be,
> > unsigned long num_pages,
> > nvbe->nr_pages = 0;
> > while (num_pages--) {
> > - /* this code path isn't called and is incorrect
> > anyways */
> > - if (0) { /*dma_addrs[nvbe->nr_pages] !=
> > DMA_ERROR_CODE)*/
> > + if (dev->pdev, dma_addrs[nvbe->nr_pages] != 0) {
>
> This is weird, do you mean && instead of a comma, or what?
> Or am I completely missing the comma operator semantics?
Earlier implementation had this:
if (!pci_dma_mapping_error(rdev->pdev, dma_addr[i])) {
And then I changed it to check just the dma_addrs[x] (as the
different IOMMUs would provide irregular values), but
this ',' is really weird - no idea how it actually even compiles.
It should have just been:
if (dma_addrs[nvbe->nr_pages] != 0) {
>
> > nvbe->pages[nvbe->nr_pages] =
> > dma_addrs[nvbe->nr_pages];
> > nvbe->ttm_alloced[nvbe->nr_pages] =
> > true; diff --git a/drivers/gpu/drm/radeon/radeon_gart.c
> > b/drivers/gpu/drm/radeon/radeon_gart.c index a533f52..41f7e51
> > 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c
> > +++ b/drivers/gpu/drm/radeon/radeon_gart.c
> > @@ -181,9 +181,7 @@ int radeon_gart_bind(struct radeon_device
> > *rdev, unsigned offset, p = t / (PAGE_SIZE /
> > RADEON_GPU_PAGE_SIZE);
> > for (i = 0; i < pages; i++, p++) {
> > - /* we reverted the patch using dma_addr in TTM
> > for now but this
> > - * code stops building on alpha so just comment
> > it out for now */
> > - if (0) { /*dma_addr[i] != DMA_ERROR_CODE) */
> > + if (rdev->pdev, dma_addr[i] != 0) {
>
> The same question for this condition.
The same here. Reading
http://stackoverflow.com/questions/2087026/effect-of-using-a-comma-instead-of-a-semi-colon-in-c-and-c
says that it actually did the right thing (evaluated the last
thing) - but I am going to remove the pdev part.
Thanks for spotting this!
>
> --
> Pekka Paalanen
> http://www.iki.fi/pq/
WARNING: multiple messages have this Message-ID (diff)
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Pekka Paalanen <pq@iki.fi>
Cc: thellstrom@vmware.com, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, j.glisse@redhat.com,
airlied@redhat.com, bskeggs@redhat.com
Subject: Re: [PATCH 1/7] ttm/radeon/nouveau: Check the DMA address from TTM against known value.
Date: Wed, 31 Aug 2011 08:02:09 -0400 [thread overview]
Message-ID: <20110831120209.GB4297@dumpdata.com> (raw)
In-Reply-To: <20110831093329.1d948a92@farn.lan>
On Wed, Aug 31, 2011 at 09:33:29AM +0300, Pekka Paalanen wrote:
> On Tue, 30 Aug 2011 22:41:46 -0400
> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
>
> > . instead of checking against the DMA_ERROR_CODE value which is
> > per-platform specific. The zero value is a known invalid value
> > that the TTM layer sets on the dma_address array if it is not
> > used (ttm_tt_alloc_page_directory calls drm_calloc_large which
> > creates a page with GFP_ZERO).
> >
> > We can't use pci_dma_mapping_error as that is IOMMU
> > specific (some check for a specific physical address, some
> > for ranges, some just do a check against zero).
> >
> > Also update the comments in the header about the true state
> > of that parameter.
> >
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > ---
> > drivers/gpu/drm/nouveau/nouveau_sgdma.c | 3 +--
> > drivers/gpu/drm/radeon/radeon_gart.c | 4 +---
> > include/drm/ttm/ttm_page_alloc.h | 4 ++--
> > 3 files changed, 4 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> > b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index 82fad91..624e2db
> > 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
> > @@ -42,8 +42,7 @@ nouveau_sgdma_populate(struct ttm_backend *be,
> > unsigned long num_pages,
> > nvbe->nr_pages = 0;
> > while (num_pages--) {
> > - /* this code path isn't called and is incorrect
> > anyways */
> > - if (0) { /*dma_addrs[nvbe->nr_pages] !=
> > DMA_ERROR_CODE)*/
> > + if (dev->pdev, dma_addrs[nvbe->nr_pages] != 0) {
>
> This is weird, do you mean && instead of a comma, or what?
> Or am I completely missing the comma operator semantics?
Earlier implementation had this:
if (!pci_dma_mapping_error(rdev->pdev, dma_addr[i])) {
And then I changed it to check just the dma_addrs[x] (as the
different IOMMUs would provide irregular values), but
this ',' is really weird - no idea how it actually even compiles.
It should have just been:
if (dma_addrs[nvbe->nr_pages] != 0) {
>
> > nvbe->pages[nvbe->nr_pages] =
> > dma_addrs[nvbe->nr_pages];
> > nvbe->ttm_alloced[nvbe->nr_pages] =
> > true; diff --git a/drivers/gpu/drm/radeon/radeon_gart.c
> > b/drivers/gpu/drm/radeon/radeon_gart.c index a533f52..41f7e51
> > 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c
> > +++ b/drivers/gpu/drm/radeon/radeon_gart.c
> > @@ -181,9 +181,7 @@ int radeon_gart_bind(struct radeon_device
> > *rdev, unsigned offset, p = t / (PAGE_SIZE /
> > RADEON_GPU_PAGE_SIZE);
> > for (i = 0; i < pages; i++, p++) {
> > - /* we reverted the patch using dma_addr in TTM
> > for now but this
> > - * code stops building on alpha so just comment
> > it out for now */
> > - if (0) { /*dma_addr[i] != DMA_ERROR_CODE) */
> > + if (rdev->pdev, dma_addr[i] != 0) {
>
> The same question for this condition.
The same here. Reading
http://stackoverflow.com/questions/2087026/effect-of-using-a-comma-instead-of-a-semi-colon-in-c-and-c
says that it actually did the right thing (evaluated the last
thing) - but I am going to remove the pdev part.
Thanks for spotting this!
>
> --
> Pekka Paalanen
> http://www.iki.fi/pq/
next prev parent reply other threads:[~2011-08-31 12:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 2:41 [PATCH] TTM DMA pool v1.7 Konrad Rzeszutek Wilk
2011-08-31 2:41 ` Konrad Rzeszutek Wilk
2011-08-31 2:41 ` [PATCH 1/7] ttm/radeon/nouveau: Check the DMA address from TTM against known value Konrad Rzeszutek Wilk
2011-08-31 2:41 ` Konrad Rzeszutek Wilk
2011-08-31 6:33 ` Pekka Paalanen
2011-08-31 12:02 ` Konrad Rzeszutek Wilk [this message]
2011-08-31 12:02 ` Konrad Rzeszutek Wilk
2011-08-31 2:41 ` [PATCH 2/7] ttm: Introduce ttm_page_alloc_func structure Konrad Rzeszutek Wilk
2011-08-31 2:41 ` Konrad Rzeszutek Wilk
2011-08-31 2:41 ` [PATCH 3/7] ttm: Pass in 'struct device' to TTM so it can do DMA API on behalf of device Konrad Rzeszutek Wilk
2011-08-31 2:41 ` Konrad Rzeszutek Wilk
2011-08-31 2:41 ` [PATCH 4/7] swiotlb: Expose swiotlb_nr_tlb function to modules as swiotlb_enabled Konrad Rzeszutek Wilk
2011-08-31 2:41 ` Konrad Rzeszutek Wilk
2011-08-31 2:41 ` [PATCH 5/7] ttm: Provide a DMA aware TTM page pool code Konrad Rzeszutek Wilk
2011-08-31 2:41 ` Konrad Rzeszutek Wilk
2011-08-31 2:41 ` [PATCH 6/7] ttm: Add 'no_dma' parameter to turn the TTM DMA pool off during runtime Konrad Rzeszutek Wilk
2011-08-31 2:41 ` Konrad Rzeszutek Wilk
2011-08-31 2:41 ` [PATCH 7/7] nouveau/radeon: Set coherent DMA mask Konrad Rzeszutek Wilk
2011-08-31 2:41 ` Konrad Rzeszutek Wilk
-- strict thread matches above, loose matches on Subject: below --
2011-09-13 14:12 [PATCH] TTM DMA v1.8 Konrad Rzeszutek Wilk
2011-09-13 14:12 ` [PATCH 1/7] ttm/radeon/nouveau: Check the DMA address from TTM against known value Konrad Rzeszutek Wilk
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=20110831120209.GB4297@dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=airlied@linux.ie \
--cc=airlied@redhat.com \
--cc=alexdeucher@gmail.com \
--cc=bskeggs@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=j.glisse@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pq@iki.fi \
--cc=thellstrom@vmware.com \
--cc=thomas@shipmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.