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 2/8] gpu: host1x: Add syncpoint wait and interrupts
Date: Wed, 6 Feb 2013 12:29:26 -0800 [thread overview]
Message-ID: <5112BD26.5060800@nvidia.com> (raw)
In-Reply-To: <20130205084255.GB20437@avionic-0098.mockup.avionic-design.de>
On 05.02.2013 00:42, Thierry Reding wrote:
> On Mon, Feb 04, 2013 at 08:29:08PM -0800, Terje Bergström wrote:
>> host1x_get_host() actually needs that, so this #include should've also
>> been in previous patch.
>
> No need to if you pass struct device * instead. You might need
> linux/device.h instead, though.
Can do.
> Another variant would be host1x_syncpt_irq() for the top-level handler
> and something host1x_handle_syncpt() to handle individual syncpoints. I
> like this one best, but this is pure bike-shedding and there's nothing
> technically wrong with the names you chose, so I can't really object if
> you want to stick to them.
I could use these names. They sound logical to me,too.
>
>>>> + queue_work(intr->wq, &sp->work);
>>>
>>> Should the call to queue_work() perhaps be moved into
>>> host1x_intr_syncpt_thresh_isr().
>>
>> I'm not sure, either way would be ok to me. The current structure allows
>> host1x_intr_syncpt_thresh_isr() to only take one parameter
>> (host1x_intr_syncpt). If we move queue_work, we'd also need to pass
>> host1x_intr.
>
> I think I'd still prefer to have all the code in one function because it
> make subsequent modification easier and less error-prone.
Ok, I'll do that change.
> Yeah, in that case I think we should bail out. It's not like we're
> expecting any failures. If the interrupt cannot be requested, something
> must seriously be wrong and we should tell users about it so that it can
> be fixed. Trying to continue on a best effort basis isn't useful here, I
> think.
Yep, I agree.
>> In patch 3, at submit time we first allocate waiter, then take
>> submit_lock, write submit to channel, and add the waiter while having
>> the lock. I did this so that I host1x_intr_add_action() can always
>> succeed. Otherwise I'd need to write another code path to handle the
>> case where we wrote a job to channel, but we're not able to add a
>> submit_complete action to it.
>
> Okay. In that case why not allocate it on the stack in the first place
> so you don't have to bother with allocations (and potential failure) at
> all? The variable doesn't leave the function scope, so there shouldn't
> be any issues, right?
The submit code in patch 3 allocates a waiter, and the waiter outlives
the function scope. That waiter will clean up job queue once a job is
complete.
> Or if that doesn't work it would still be preferable to allocate memory
> in host1x_syncpt_wait() directly instead of going through the wrapper.
This was done purely, because I'm hiding the struct size from the
caller. If the caller needs to allocate, I need to expose the struct in
a header, not just a forward declaration.
>>>> +int host1x_intr_init(struct host1x_intr *intr, u32 irq_sync)
>>>
>>> Maybe you should keep the type of the irq_sync here so that it properly
>>> propagates to the call to devm_request_irq().
>>
>> I'm not sure what you mean. Do you mean that I should use unsigned int,
>> as that's the type used in devm_request_irq()?
>
> Yes.
Ok, will do.
>>>> +void host1x_intr_stop(struct host1x_intr *intr)
>>>> +{
>>>> + unsigned int id;
>>>> + struct host1x *host1x = intr_to_host1x(intr);
>>>> + struct host1x_intr_syncpt *syncpt;
>>>> + u32 nb_pts = host1x_syncpt_nb_pts(intr_to_host1x(intr));
>>>> +
>>>> + mutex_lock(&intr->mutex);
>>>> +
>>>> + host1x->intr_op.disable_all_syncpt_intrs(intr);
>>>
>>> I haven't commented on this everywhere, but I think this could benefit
>>> from a wrapper that forwards this to the intr_op. The same goes for the
>>> sync_op.
>>
>> You mean something like "host1x_disable_all_syncpt_intrs"?
>
> Yes. I think that'd be useful for each of the op functions. Perhaps you
> could even pass in a struct host1x * to make calls more uniform.
Ok, I'll add the wrapper, and I'll check if passing struct host1x *
would make sense. In effect that'd render struct host1x_intr mostly
unused, so how about if we just merge the contents of host1x_intr to host1x?
Terje
next prev parent reply other threads:[~2013-02-06 20:29 UTC|newest]
Thread overview: 49+ 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
2013-02-05 3:30 ` Terje Bergström
2013-02-05 7:43 ` Thierry Reding
2013-02-06 20:13 ` Terje Bergström
2013-01-15 11:43 ` [PATCHv5,RESEND 2/8] gpu: host1x: Add syncpoint wait and interrupts Terje Bergstrom
2013-02-04 10:30 ` Thierry Reding
2013-02-05 4:29 ` Terje Bergström
2013-02-05 8:42 ` Thierry Reding
2013-02-06 20:29 ` Terje Bergström [this message]
2013-02-06 20:38 ` Thierry Reding
2013-02-06 20:41 ` Terje Bergström
2013-01-15 11:43 ` [PATCHv5,RESEND 3/8] gpu: host1x: Add channel support Terje Bergstrom
2013-02-25 15:24 ` Thierry Reding
2013-02-26 9:48 ` Terje Bergström
2013-02-27 8:56 ` Thierry Reding
2013-03-08 16:16 ` Terje Bergström
2013-03-08 20:43 ` Thierry Reding
2013-03-11 6:29 ` Terje Bergström
2013-03-11 7:18 ` Thierry Reding
2013-03-11 9:21 ` Terje Bergström
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
2013-02-05 4:41 ` Terje Bergström
2013-02-05 9:15 ` Thierry Reding
2013-02-06 20:58 ` Terje Bergström
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
2013-02-04 11:08 ` Thierry Reding
2013-02-05 4:45 ` Terje Bergström
2013-02-05 9:26 ` Thierry Reding
2013-01-15 11:44 ` [PATCHv5,RESEND 6/8] gpu: host1x: Remove second host1x driver Terje Bergstrom
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
2013-02-04 11:26 ` Thierry Reding
2013-02-04 17:06 ` Stephen Warren
2013-02-05 4:47 ` Terje Bergström
2013-01-15 11:44 ` [PATCHv5,RESEND 8/8] drm: tegra: Add gr2d device Terje Bergstrom
2013-02-04 12:56 ` Thierry Reding
2013-02-05 5:17 ` Terje Bergström
2013-02-05 9:54 ` Thierry Reding
2013-02-06 21:23 ` Terje Bergström
2013-02-08 7:07 ` Thierry Reding
2013-02-11 0:42 ` Terje Bergström
2013-02-11 6:44 ` Thierry Reding
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
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=5112BD26.5060800@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