From: Julien Grall <julien.grall@linaro.org>
To: Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: ARM, time: alternative of using udelay() before init time
Date: Fri, 17 Oct 2014 17:22:25 +0100 [thread overview]
Message-ID: <54414241.9050901@linaro.org> (raw)
In-Reply-To: <CAJEb2DHKZD0+wqA1coHygaCiMTY-WAv0Fe+ZnY5MLp+vdunyzQ@mail.gmail.com>
On 10/17/2014 05:12 PM, Oleksandr Tyshchenko wrote:
> On Fri, Oct 17, 2014 at 3:58 PM, Julien Grall <julien.grall@linaro.org
> <mailto:julien.grall@linaro.org>> wrote:
> On 10/16/2014 04:10 PM, Oleksandr Tyshchenko wrote:
> Hi Oleksandr,
>
> Hi Julien.
Hi Oleksandr,
>
>
> > I have a question about using udelay() (located in arch/arm/time.c) in XEN.
> > I have found out that I can't use this function before call
> > init_xen_time(). Otherwise udelay() hangs,
> > since get_s_time() returns wrong result.
> > Even if we come from U-Boot with ARCH timer enabled (which also not
> > always true) the global variable "cpu_khz" not initialized yet.
> >
> > For example, a some UART driver has init_preirq callback where we need
> > to call udelay(X) after changing baudrate before continuing init
> > sequence. But we can't, since the console_init_preirq() called a bit
> > early than init_xen_time().
> >
> > So, could you please explain me is there other method I can use before
> > init time subsystem.
> > Is the simple while loop the only way?
>
> I would move the initialization of the timer earlier.
>
> But not earlier
> than the creation of the internal device tree
> (dt_unflatten_host_device_tree()).
>
>
> IIRC there is no other dependency for this function. The only drawback
> is the log of the timer won't be appear if early printk is not enabled.
>
>
> Sounds good. I also thought about it.
> Unfortunately, there are other dependencies:
> init_xen_time() calls platform_init_time().
And platform_init_time() depends on platform_init.
> I see that many platform
> callbacks use dprintk to print error messages.
early printk has been hooked in the console driver (and therefore
dprintk) in Xen 4.5. So if early printk is enabled you would be able to
see the message.
> Also init_xen_time() checks cpu_has_gentimer feature, but global
> variable boot_cpu_data which contains this info initialized a bit later
> in processor_id().
IHMO, this check is not useful. We would have catch it via the device
tree because the timer wouldn't have been exposed. After the user is
using the wrong device tree then...
If we do want to keep this check, we could expand it and directly get
the information from the coprocessor rather than boot_cpu_data.
I'm wondering how Linux deal with the time when the timer is not
initialized?
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-10-17 16:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-16 15:10 ARM, time: alternative of using udelay() before init time Oleksandr Tyshchenko
2014-10-17 12:58 ` Julien Grall
2014-10-17 16:12 ` Oleksandr Tyshchenko
2014-10-17 16:22 ` Julien Grall [this message]
2014-10-20 10:12 ` Oleksandr Tyshchenko
2014-10-20 12:30 ` Julien Grall
2014-10-20 12:35 ` Oleksandr Tyshchenko
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=54414241.9050901@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=oleksandr.tyshchenko@globallogic.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.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.