All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vince Hsu <vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	Terje Bergstrom
	<tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 1/6] platform: specify the IOMMU physical translation bit
Date: Fri, 17 Apr 2015 15:07:01 +0800	[thread overview]
Message-ID: <5530B115.60305@nvidia.com> (raw)
In-Reply-To: <CAAVeFuL10UidtE4_Y2mYEYpWjDqXn-FQF3zJQv2eQDqg_QTJ1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>



On 04/17/2015 02:26 PM, Alexandre Courbot wrote:
> On Thu, Apr 16, 2015 at 8:06 PM, Vince Hsu <vinceh@nvidia.com> wrote:
>> The IOMMU physical translation bit might vary with different SoCs. So add
>> a variable to specify this bit for GK20A.
>>
>> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
>> ---
>>   drm/nouveau/nouveau_platform.c | 19 +++++++++++++++++++
>>   drm/nouveau/nouveau_platform.h |  1 +
>>   2 files changed, 20 insertions(+)
>>
>> diff --git a/drm/nouveau/nouveau_platform.c b/drm/nouveau/nouveau_platform.c
>> index 775277f1edb0..0d002f73e356 100644
>> --- a/drm/nouveau/nouveau_platform.c
>> +++ b/drm/nouveau/nouveau_platform.c
>> @@ -25,6 +25,7 @@
>>   #include <linux/module.h>
>>   #include <linux/platform_device.h>
>>   #include <linux/of.h>
>> +#include <linux/of_device.h>
>>   #include <linux/reset.h>
>>   #include <linux/regulator/consumer.h>
>>   #include <linux/iommu.h>
>> @@ -92,6 +93,22 @@ static int nouveau_platform_power_down(struct nouveau_platform_gpu *gpu)
>>          return 0;
>>   }
>>
>> +static unsigned long nouveau_platform_get_iommu_bit(struct device *dev)
>> +{
>> +       const struct of_device_id *match;
>> +
>> +       match = of_match_device(dev->driver->of_match_table, dev);
>> +       if (!match) {
>> +               dev_warn(dev, "cannot find OF match for device\n");
>> +               return 0;
>> +       }
>> +
>> +       if (!strcmp(match->compatible, "nvidia,gk20a"))
>> +               return 34;
>> +       else
>> +               return 0;
>> +}
> Instead of this function, you should probably use the data field of
> struct of_device_id. Define a local struct called, say,
> nouveau_platform_params containing (for now) a single iommu_addr_bit
> field and instanciate one for each entry of nouveau_platform_match.
> Then you can cast match->data and retrieve the field directly instead
> of using strcmp.
Actually I did that way when I was based on your tree since you already 
defined the probe data. I admit I jerry-built this patch while I rebased 
to Ben's tree. Will fix in the next version.

>
> I'd say this is then simple enough to do directly in
> nouveau_platform_probe_iommu() instead of having a function dedicated
> to it. It is also safer because when we add a new chip, we have to
> update nouveau_platform_match but might very well forget about your
> function, and will end up with bit 0 being set on all our GPU
> addresses and endless hours of fun figuring out how this happened. :)
>
> While I am at it: how about defining this as a u64 mask to set/unset
> on GPU addresses instead of just a bit? This is more flexible and
> again safer in case someone "omits" to specify the correct bit for a
> chip.
>


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2015-04-17  7:07 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 11:06 [PATCH 0/6] map big page by platform IOMMU Vince Hsu
     [not found] ` <1429182379-31964-1-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-16 11:06   ` [PATCH 1/6] platform: specify the IOMMU physical translation bit Vince Hsu
     [not found]     ` <1429182379-31964-2-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-16 20:41       ` Terje Bergstrom
     [not found]         ` <55301E65.5000705-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-17  2:22           ` Vince Hsu
2015-04-17  6:26       ` Alexandre Courbot
     [not found]         ` <CAAVeFuL10UidtE4_Y2mYEYpWjDqXn-FQF3zJQv2eQDqg_QTJ1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-17  7:07           ` Vince Hsu [this message]
2015-04-17 15:10           ` Terje Bergstrom
     [not found]             ` <55312257.8000606-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-20  7:37               ` Alexandre Courbot
     [not found]                 ` <CAAVeFuKSY9AvtmjkVY7CApMex3Gq5L5cQ=suaERY5-gtAYai6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-20 16:35                   ` Terje Bergstrom
2015-04-16 11:06   ` [PATCH 2/6] instmem/gk20a: refer to " Vince Hsu
     [not found]     ` <1429182379-31964-3-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-17  6:26       ` Alexandre Courbot
     [not found]         ` <CAAVeFuJqWuQeH1tbAdkVpocBAjq52GPv_O_yxd0X+7gSHjCoJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-17  7:19           ` Vince Hsu
     [not found]             ` <5530B3F7.3000000-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-17  7:40               ` Alexandre Courbot
2015-04-17 15:14           ` Terje Bergstrom
     [not found]             ` <5531234C.8020806-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-20  7:38               ` Alexandre Courbot
     [not found]                 ` <CAAVeFu+p=FFqMNTYNVo1DKnFWZ88_5osiTbiHQR=wQ6tJhHzBA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-20 16:37                   ` Terje Bergstrom
2015-04-16 11:06   ` [PATCH 3/6] mmu: map small pages into big pages(s) by IOMMU if possible Vince Hsu
     [not found]     ` <1429182379-31964-4-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-17  9:11       ` Alexandre Courbot
     [not found]         ` <CAAVeFuLSYGV8ghOQ26ubA9kvWHCPD2y+y_bJMLHv1V1Ab8NOYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-17 15:37           ` Terje Bergstrom
     [not found]             ` <553128CA.40304-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-20  7:49               ` Alexandre Courbot
     [not found]                 ` <CAAVeFuKc1szojynHrGM9TJrJsTK0RjRiO7i7uwxoVPAW=tZJrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-20 11:51                   ` Vince Hsu
     [not found]                     ` <5534E83D.80304-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-20 11:55                       ` Vince Hsu
2015-04-20 16:47                   ` Terje Bergstrom
2015-04-16 11:06   ` [PATCH 4/6] drm: enable big page mapping for small pages when IOMMU is available Vince Hsu
     [not found]     ` <1429182379-31964-5-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-17  6:26       ` Alexandre Courbot
     [not found]         ` <CAAVeFu+_zJ4DUwebhzpfA9uJroFEVrOBRqiXUuS9Gk04hVA88A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-17  7:28           ` Vince Hsu
     [not found]             ` <5530B603.9010703-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-17  7:33               ` Alexandre Courbot
2015-04-17 15:24               ` Terje Bergstrom
2015-04-16 11:06   ` [PATCH 5/6] mmu: gf100: share most of functions with GK20A Vince Hsu
     [not found]     ` <1429182379-31964-6-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-17  6:27       ` Alexandre Courbot
     [not found]         ` <CAAVeFuJay4TNdOwEorver+-WiYCLJ21BXcRgCBv1aush_i1wbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-17  7:30           ` Vince Hsu
2015-04-16 11:06   ` [PATCH 6/6] mmu: gk20a: implement IOMMU mapping for big pages Vince Hsu
     [not found]     ` <1429182379-31964-7-git-send-email-vinceh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-16 19:31       ` Ilia Mirkin
     [not found]         ` <CAKb7UvhEuNSYshiP+kt66zHfsmB=Edy+t7HLs2j_+-hvzzkdMQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-16 19:55           ` Terje Bergstrom
     [not found]             ` <553013A4.1020700-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-16 20:01               ` Ilia Mirkin
2015-04-17  6:25   ` [PATCH 0/6] map big page by platform IOMMU Alexandre Courbot
     [not found]     ` <CAAVeFuJLRo1XYum3FZBhO5=5u63KLUY_tr0wk=TPxWutvCdL8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-17  7:35       ` Vince Hsu
     [not found]         ` <5530B7D3.60700-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-04-17  7:37           ` Alexandre Courbot
     [not found]             ` <CAAVeFuLdr7h29G6_1XGV8kTag=m4Spe_R9Aog38eRs9gAbgdVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-17  7:42               ` Vince Hsu

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=5530B115.60305@nvidia.com \
    --to=vinceh-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.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.