Message ID | CACRpkdZy7TnrmkWrRerjm6dZW9m65Dsc_kp8TPHzbhTxz5Hbrw@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hello Linus, On 01/12/15 11:09, Linus Walleij wrote: >> clocksource_mmio_init() explicitly checks for counter's width and refuses to >> > register anything with resolution higher than 32 bits. We need to use >> > clocksource_register_hz() directly to repair HIGH_RES_TIMERS. > Maybe tglx want to jump in on this. > > Isn't it better to fix clocksource_mmio_init() to accept > 32 bits? > > What is really prompting this in drivers/clocksource/mmio.c: > > if (bits > 32 || bits < 16) > return -EINVAL; probably lack of >32bit access functions in the driver. But I do not know the original intentions of the author. In any case, if we modify the check here, probably the access function for 64 bits should be moved to the mmio.c? Alex.
On Tue, Dec 1, 2015 at 11:14 AM, Alexander Sverdlin <alexander.sverdlin@gmail.com> wrote: > On 01/12/15 11:09, Linus Walleij wrote: >>> clocksource_mmio_init() explicitly checks for counter's width and refuses to >>> > register anything with resolution higher than 32 bits. We need to use >>> > clocksource_register_hz() directly to repair HIGH_RES_TIMERS. >> Maybe tglx want to jump in on this. >> >> Isn't it better to fix clocksource_mmio_init() to accept > 32 bits? >> >> What is really prompting this in drivers/clocksource/mmio.c: >> >> if (bits > 32 || bits < 16) >> return -EINVAL; > > probably lack of >32bit access functions in the driver. But I do not know > the original intentions of the author. In any case, if we modify the check here, > probably the access function for 64 bits should be moved to the mmio.c? The clocksource returns a cycle_t which is 64 bits. I have sent a proper patch to Daniel+tglx fixing it up. Yours, Linus Walleij
On Tue, Dec 01, 2015 at 11:14:02AM +0100, Alexander Sverdlin wrote: > Hello Linus, > > On 01/12/15 11:09, Linus Walleij wrote: > >> clocksource_mmio_init() explicitly checks for counter's width and refuses to > >> > register anything with resolution higher than 32 bits. We need to use > >> > clocksource_register_hz() directly to repair HIGH_RES_TIMERS. > > Maybe tglx want to jump in on this. > > > > Isn't it better to fix clocksource_mmio_init() to accept > 32 bits? > > > > What is really prompting this in drivers/clocksource/mmio.c: > > > > if (bits > 32 || bits < 16) > > return -EINVAL; > > probably lack of >32bit access functions in the driver. But I do not know > the original intentions of the author. In any case, if we modify the check here, > probably the access function for 64 bits should be moved to the mmio.c? If people want to use it with 64-bit accessors, then yes. So says the author of that file (me).
On Thu, Dec 10, 2015 at 6:32 PM, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote: > On Tue, Dec 01, 2015 at 11:14:02AM +0100, Alexander Sverdlin wrote: >> Hello Linus, >> >> On 01/12/15 11:09, Linus Walleij wrote: >> >> clocksource_mmio_init() explicitly checks for counter's width and refuses to >> >> > register anything with resolution higher than 32 bits. We need to use >> >> > clocksource_register_hz() directly to repair HIGH_RES_TIMERS. >> > Maybe tglx want to jump in on this. >> > >> > Isn't it better to fix clocksource_mmio_init() to accept > 32 bits? >> > >> > What is really prompting this in drivers/clocksource/mmio.c: >> > >> > if (bits > 32 || bits < 16) >> > return -EINVAL; >> >> probably lack of >32bit access functions in the driver. But I do not know >> the original intentions of the author. In any case, if we modify the check here, >> probably the access function for 64 bits should be moved to the mmio.c? > > If people want to use it with 64-bit accessors, then yes. So says > the author of that file (me). I've sent a patch to tglx / Daniel Lezcano that I think does the proper fix to the clksrc mmio core. Yours, Linus Walleij
diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c index 1593ade2a815..c4f7d7a9b689 100644 --- a/drivers/clocksource/mmio.c +++ b/drivers/clocksource/mmio.c @@ -55,7 +55,7 @@ int __init clocksource_mmio_init(void __iomem *base, const char *name, { struct clocksource_mmio *cs; - if (bits > 32 || bits < 16) + if (bits > 64 || bits < 16) return -EINVAL;