Messages in this thread Patch in this message | | | Date | Wed, 18 Jan 2017 11:24:50 +0100 (CET) | From | Thomas Gleixner <> | Subject | Re: [PATCH v2 1/1] x86/rtc: Allocate interrupt for platform device |
| |
On Tue, 17 Jan 2017, Andy Shevchenko wrote:
> 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
Indeed. Did not think about that we need the irq subsystem up not only the primary IOAPIC init done.
Looking deeper it's actually simple. MID already overloads the timer_init() setup function. So we can just do it there.
Thanks,
tglx
--- a/arch/x86/platform/intel-mid/intel-mid.c +++ b/arch/x86/platform/intel-mid/intel-mid.c @@ -93,6 +93,17 @@ static void __init intel_mid_setup_bp_ti setup_boot_APIC_clock(); } +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) < 0) { + pr_info("Failed to allocate RTC interrupt. Disabling RTC\n"); + x86_platform.legacy.rtc = 0; + } +} + static void __init intel_mid_time_init(void) { sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr); @@ -115,6 +126,10 @@ static void __init intel_mid_time_init(v } x86_init.timers.setup_percpu_clockev = apbt_time_init; + + /* If the platform has an RTC make sure the APIC entry is allocated */ + if (x86_platform.legacy.rtc) + intel_mid_legacy_rtc_init(); } static void intel_mid_arch_setup(void) --- a/arch/x86/platform/intel-mid/sfi.c +++ b/arch/x86/platform/intel-mid/sfi.c @@ -540,21 +540,8 @@ static int __init sfi_parse_devs(struct return 0; } -static int __init intel_mid_legacy_rtc_init(void) -{ - struct irq_alloc_info info; - - if (!x86_platform.legacy.rtc) - return -ENODEV; - - ioapic_set_alloc_attr(&info, NUMA_NO_NODE, 1, 0); - return mp_map_gsi_to_irq(RTC_IRQ, IOAPIC_MAP_ALLOC, &info); -} - static int __init intel_mid_platform_init(void) { - intel_mid_legacy_rtc_init(); - sfi_table_parse(SFI_SIG_GPIO, NULL, NULL, sfi_parse_gpio); sfi_table_parse(SFI_SIG_DEVS, NULL, NULL, sfi_parse_devs); return 0;
| |