Re: [PATCH v2 1/1] x86/rtc: Allocate interrupt for platform device

From: Andy Shevchenko
Date: Tue Jan 17 2017 - 08:43:48 EST


On Mon, 2017-01-16 at 22:00 +0100, Thomas Gleixner wrote:

> The early callback does not work, but we have one which is invoked
> later
> on: x86_init.wallclock_init(). That's invoked after the (IO/APIC)
> setup has
> been completed. See patch below.

Unfortunately it is till too early. Looks like descriptors are not
available yet and we still can't get an allocation:

[ ÂÂÂ0.000000] intel_mid: Failed to allocate RTC interrupt. Disabling
RTC

...

[ ÂÂÂ0.000000] NR_IRQS:4352 nr_irqs:512 0

> +static void __init intel_mid_legacy_rtc_init(void)
> +{
> + struct irq_alloc_info info;
> +
> + ioapic_set_alloc_attr(&info, NUMA_NO_NODE, 1, 0);
> + if (mp_map_gsi_to_irq(RTC_IRQ, IOAPIC_MAP_ALLOC, &info)) {
> + pr_info("Failed to allocate RTC interrupt. Disabling
> RTC\n");
> + x86_platform.legacy.rtc = 0;
> + }
> +}
> +
> Âstatic void intel_mid_arch_setup(void)
> Â{
> Â if (boot_cpu_data.x86 != 6) {
> @@ -151,6 +162,10 @@ static void intel_mid_arch_setup(void)
> Â if (intel_mid_ops->arch_setup)
> Â intel_mid_ops->arch_setup();
> Â
> + /* If the platform has an RTC make sure the APIC entry is
> allocated */
> + if (x86_platform.legacy.rtc)
> + x86_init.timers.wallclock_init =
> intel_mid_legacy_rtc_init;

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy