linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Terje Bergström" <tbergstrom@nvidia.com>
To: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Arto Merilainen <amerilainen@nvidia.com>,
	"airlied@linux.ie" <airlied@linux.ie>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCHv5,RESEND 1/8] gpu: host1x: Add host1x driver
Date: Wed, 6 Feb 2013 12:13:40 -0800	[thread overview]
Message-ID: <5112B974.10301@nvidia.com> (raw)
In-Reply-To: <20130205074301.GA20437@avionic-0098.mockup.avionic-design.de>

On 04.02.2013 23:43, Thierry Reding wrote:
> My point was that you could include the call to host1x_syncpt_reset()
> within host1x_syncpt_init(). That will keep unneeded code out of the
> host1x_probe() function. Also you don't want to use the syncpoints
> uninitialized, right?

Of course, sorry, I misunderstood. That makes a lot of sense.

>>>> + */
>>>> +static u32 syncpt_load_min(struct host1x_syncpt *sp)
>>>> +{
>>>> +     struct host1x *dev = sp->dev;
>>>> +     u32 old, live;
>>>> +
>>>> +     do {
>>>> +             old = host1x_syncpt_read_min(sp);
>>>> +             live = host1x_sync_readl(dev,
>>>> +                             HOST1X_SYNC_SYNCPT_0 + sp->id * 4);
>>>> +     } while ((u32)atomic_cmpxchg(&sp->min_val, old, live) != old);
>>>
>>> I think this warrants a comment.
>>
>> Sure. It just loops in case there's a race writing to min_val.
> 
> Oh, I see. That'd make a good comment. Is the cast to (u32) really
> necessary?

I'll add a comment. atomic_cmpxchg returns a signed value, so I think
the cast is needed.

> Save/restore has the disadvantage of the direction not being implicit.
> Save could mean save to hardware or save to software. The same is true
> for restore. However if the direction is clearly defined, save and
> restore work for me.
> 
> Maybe the comment could be changed to be more explicit. Something like:
> 
> 	/*
> 	 * Write cached syncpoint and waitbase values to hardware.
> 	 */
> 
> And for host1x_syncpt_save():
> 
> 	/*
> 	 * For client-managed registers, update the cached syncpoint and
> 	 * waitbase values by reading from the registers.
> 	 */

I was using save in the same way as f.ex. i915 (i915_suspend.c): save
state of hardware to RAM, restore state from RAM. I'll add proper
comments, but save and restore are for all syncpts, not only client managed.

> 
>>>> +/*
>>>> + * Updates the last value read from hardware.
>>>> + */
>>>> +u32 host1x_syncpt_load_min(struct host1x_syncpt *sp)
>>>> +{
>>>> +     u32 val;
>>>> +     val = sp->dev->syncpt_op.load_min(sp);
>>>> +     trace_host1x_syncpt_load_min(sp->id, val);
>>>> +
>>>> +     return val;
>>>> +}
> Maybe the function should be called host1x_syncpt_load() if there is no
> equivalent way to load the maximum value (since there is no register to
> read from).

Sounds good. Maximum is just a software concept.

> That's certainly true for interrupts. However, if you look at the DMA
> subsystem for example, you can also request an unnamed resource.
> 
> The difference is sufficiently subtle that host1x_syncpt_allocate()
> would work for me too, though. I just have a slight preference for
> host1x_syncpt_request().

I don't really have a strong preference, so I'll follow your suggestion.

Terje

  reply	other threads:[~2013-02-06 20:13 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 11:43 [PATCHv5,RESEND 0/8] Support for Tegra 2D hardware Terje Bergstrom
2013-01-15 11:43 ` [PATCHv5,RESEND 1/8] gpu: host1x: Add host1x driver Terje Bergstrom
2013-02-04  9:09   ` Thierry Reding
     [not found]     ` <20130204090941.GA27443-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-05  3:30       ` Terje Bergström
     [not found]         ` <51107CC0.9060900-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-05  7:43           ` Thierry Reding
2013-02-06 20:13             ` Terje Bergström [this message]
2013-01-15 11:43 ` [PATCHv5,RESEND 2/8] gpu: host1x: Add syncpoint wait and interrupts Terje Bergstrom
     [not found]   ` <1358250244-9678-3-git-send-email-tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-04 10:30     ` Thierry Reding
     [not found]       ` <20130204103032.GB27443-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-05  4:29         ` Terje Bergström
     [not found]           ` <51108A94.3060501-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-05  8:42             ` Thierry Reding
     [not found]               ` <20130205084255.GB20437-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-06 20:29                 ` Terje Bergström
     [not found]                   ` <5112BD26.5060800-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-06 20:38                     ` Thierry Reding
     [not found]                       ` <20130206203854.GA1012-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-06 20:41                         ` Terje Bergström
2013-01-15 11:43 ` [PATCHv5,RESEND 3/8] gpu: host1x: Add channel support Terje Bergstrom
     [not found]   ` <1358250244-9678-4-git-send-email-tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-25 15:24     ` Thierry Reding
2013-02-26  9:48       ` Terje Bergström
     [not found]         ` <512C84E2.5090201-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-27  8:56           ` Thierry Reding
2013-03-08 16:16           ` Terje Bergström
     [not found]             ` <513A0ED0.4070701-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-03-08 20:43               ` Thierry Reding
     [not found]                 ` <20130308204301.GA30742-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-03-11  6:29                   ` Terje Bergström
     [not found]                     ` <513D79E7.5000801-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-03-11  7:18                       ` Thierry Reding
     [not found]                         ` <20130311071851.GA6033-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-03-11  9:21                           ` Terje Bergström
     [not found]                             ` <513DA201.9010707-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-03-11  9:41                               ` Thierry Reding
2013-01-15 11:44 ` [PATCHv5,RESEND 4/8] gpu: host1x: Add debug support Terje Bergstrom
2013-02-04 11:03   ` Thierry Reding
     [not found]     ` <20130204110339.GA28134-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-05  4:41       ` Terje Bergström
2013-02-05  9:15         ` Thierry Reding
     [not found]           ` <20130205091555.GC20437-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-06 20:58             ` Terje Bergström
     [not found]               ` <5112C3EB.7020205-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-08  6:54                 ` Thierry Reding
2013-01-15 11:44 ` [PATCHv5,RESEND 5/8] drm: tegra: Move drm to live under host1x Terje Bergstrom
     [not found]   ` <1358250244-9678-6-git-send-email-tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-04 11:08     ` Thierry Reding
     [not found]       ` <20130204110804.GA595-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-05  4:45         ` Terje Bergström
     [not found]           ` <51108E70.5000602-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-05  9:26             ` Thierry Reding
2013-01-15 11:44 ` [PATCHv5,RESEND 6/8] gpu: host1x: Remove second host1x driver Terje Bergstrom
     [not found]   ` <1358250244-9678-7-git-send-email-tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-04 11:23     ` Thierry Reding
2013-01-15 11:44 ` [PATCHv5,RESEND 7/8] ARM: tegra: Add board data and 2D clocks Terje Bergstrom
     [not found]   ` <1358250244-9678-8-git-send-email-tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-04 11:26     ` Thierry Reding
     [not found]       ` <20130204112622.GC595-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-04 17:06         ` Stephen Warren
2013-02-05  4:47         ` Terje Bergström
     [not found] ` <1358250244-9678-1-git-send-email-tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-15 11:44   ` [PATCHv5,RESEND 8/8] drm: tegra: Add gr2d device Terje Bergstrom
     [not found]     ` <1358250244-9678-9-git-send-email-tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-04 12:56       ` Thierry Reding
2013-02-05  5:17         ` Terje Bergström
     [not found]           ` <511095F9.6040607-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-05  9:54             ` Thierry Reding
     [not found]               ` <20130205095403.GF20437-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-06 21:23                 ` Terje Bergström
     [not found]                   ` <5112C9C5.8080205-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-08  7:07                     ` Thierry Reding
     [not found]                       ` <20130208070734.GB15429-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-11  0:42                         ` Terje Bergström
     [not found]                           ` <51183E8D.1090607-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-11  6:44                             ` Thierry Reding
     [not found]                               ` <20130211064452.GA16676-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2013-02-11 15:40                                 ` Terje Bergström
2013-01-22  9:03   ` [PATCHv5,RESEND 0/8] Support for Tegra 2D hardware Terje Bergström
2013-02-01 11:29   ` Terje Bergström

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=5112B974.10301@nvidia.com \
    --to=tbergstrom@nvidia.com \
    --cc=airlied@linux.ie \
    --cc=amerilainen@nvidia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@avionic-design.de \
    /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).