* [PATCH] x86, ioapic: move acpi_get_override_irq to acpi.c [not found] <20110401075011.GD7594@elte.hu> @ 2011-04-01 15:44 ` Florian Mickler 2011-04-01 16:26 ` Florian Mickler 2011-04-12 7:39 ` Ingo Molnar 0 siblings, 2 replies; 6+ messages in thread From: Florian Mickler @ 2011-04-01 15:44 UTC (permalink / raw) To: mingo Cc: linux-kernel, linux-acpi, Florian Mickler, Len Brown, Eric W. Biederman, kurup_avinash, maciej.rutecki, rjw, sedat.dilek In order to get rid of the ugly CONFIG_ACPI ifdef, we move the function acpi_get_override_irq into acpi.c and add a new helper function ioapic_get_irq to io_apic.c. Signed-off-by: Florian Mickler <florian@mickler.org> Cc: Len Brown <lenb@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: kurup_avinash@yahoo.com Cc: maciej.rutecki@gmail.com Cc: rjw@sisk.pl Cc: sedat.dilek@gmail.com LKML-Reference: <1301558489-4198-1-git-send-email-florian@mickler.org> --- Hi Ingo, Instead of exporting find_irq_entry, irq_trigger and irq_polarity, I added a new helper function 'ioapic_get_irq(..)' and exported that. Also I did it as a seperate commit, since it is more of a cleanup and the other commit is already tested... hope this is ok. Regards, Flo arch/x86/include/asm/io_apic.h | 8 +++++++- arch/x86/kernel/apic/io_apic.c | 40 ++++++++++++---------------------------- arch/x86/pci/acpi.c | 24 ++++++++++++++++++++++++ include/linux/acpi.h | 6 ++++++ 4 files changed, 49 insertions(+), 29 deletions(-) diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index c4bd267..89d3fc6 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -177,6 +177,7 @@ extern void __init pre_init_apic_IRQ0(void); extern void mp_save_irq(struct mpc_intsrc *m); extern void disable_ioapic_support(void); +extern int ioapic_get_irq(int ioapic, int pin, int *trigger, int *polarity); #else /* !CONFIG_X86_IO_APIC */ @@ -209,8 +210,13 @@ static inline int restore_IO_APIC_setup(struct IO_APIC_route_entry **ent) return -ENOMEM; } -static inline void mp_save_irq(struct mpc_intsrc *m) { }; +static inline void mp_save_irq(struct mpc_intsrc *m) { } static inline void disable_ioapic_support(void) { } +static inline int ioapic_get_irq(int ioapic, int pin, int *trigger, + int *polarity) +{ + return -1; +} #endif #endif /* _ASM_X86_IO_APIC_H */ diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index edf86ca..35eb531 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -938,6 +938,18 @@ static int irq_trigger(int idx) return trigger; } +int ioapic_get_irq(int ioapic, int pin, int *trigger, int *polarity) +{ + int idx = find_irq_entry(ioapic, pin, mp_INT); + + if (idx >= 0) { + *trigger = irq_trigger(idx); + *polarity = irq_polarity(idx); + } + + return idx; +} + static int pin_2_irq(int idx, int apic, int pin) { int irq; @@ -3785,34 +3797,6 @@ static int __init io_apic_get_version(int ioapic) return reg_01.bits.version; } -int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity) -{ - int ioapic, pin, idx; - -#ifdef CONFIG_ACPI - if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) - return -1; -#endif - if (skip_ioapic_setup) - return -1; - - ioapic = mp_find_ioapic(gsi); - if (ioapic < 0) - return -1; - - pin = mp_find_ioapic_pin(ioapic, gsi); - if (pin < 0) - return -1; - - idx = find_irq_entry(ioapic, pin, mp_INT); - if (idx < 0) - return -1; - - *trigger = irq_trigger(idx); - *polarity = irq_polarity(idx); - return 0; -} - /* * This function currently is only a helper for the i386 smp boot process where * we need to reprogram the ioredtbls to cater for the cpus which have come online diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 0972315..941328d 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c @@ -70,6 +70,30 @@ void __init pci_acpi_crs_quirks(void) pci_use_crs ? "nocrs" : "use_crs"); } +int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity) +{ + int ioapic, pin; + + if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) + return -1; + + if (skip_ioapic_setup) + return -1; + + ioapic = mp_find_ioapic(gsi); + if (ioapic < 0) + return -1; + + pin = mp_find_ioapic_pin(ioapic, gsi); + if (pin < 0) + return -1; + + if (ioapic_get_irq(ioapic, pin, trigger, polarity) < 0) + return -1; + + return 0; +} + static acpi_status resource_to_addr(struct acpi_resource *resource, struct acpi_resource_address64 *addr) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index a2e910e..82c03db 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -348,6 +348,12 @@ static inline int acpi_table_parse(char *id, { return -1; } + +static inline int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity) +{ + return -1; +} + #endif /* !CONFIG_ACPI */ #ifdef CONFIG_ACPI_SLEEP -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] x86, ioapic: move acpi_get_override_irq to acpi.c 2011-04-01 15:44 ` [PATCH] x86, ioapic: move acpi_get_override_irq to acpi.c Florian Mickler @ 2011-04-01 16:26 ` Florian Mickler 2011-04-03 14:34 ` Florian Mickler 2011-04-12 7:39 ` Ingo Molnar 1 sibling, 1 reply; 6+ messages in thread From: Florian Mickler @ 2011-04-01 16:26 UTC (permalink / raw) To: mingo Cc: linux-kernel, linux-acpi, Len Brown, Eric W. Biederman, kurup_avinash, maciej.rutecki, rjw, sedat.dilek On Fri, 1 Apr 2011 17:44:46 +0200 Florian Mickler <florian@mickler.org> wrote: > > Hi Ingo, > > Instead of exporting find_irq_entry, irq_trigger and irq_polarity, I added a > new helper function 'ioapic_get_irq(..)' and exported that. > > Also I did it as a seperate commit, since it is more of a cleanup and the other > commit is already tested... hope this is ok. > > Regards, > Flo > btw, include/linux/acpi.h: 120 121 #ifdef CONFIG_X86_IO_APIC 122 extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); 123 #else 124 #define acpi_get_override_irq(gsi, trigger, polarity) (-1) 125 #endif this shouldn't be needed anymore, as acpi_get_override_irq is now independent of CONFIG_X86_IO_APIC (because of ioapic_get_irq having a placeholder in the !CONFIG_X86_IO_APIC case) But on the other hand, the code flow for the !CONFIG_X86_IO_APIC would be kind of silly... what's the rationale for mp_find_ioapic returning 0 in the !CONFIG_X86_IO_APIC case? And how do I check compilation of !CONFIG_X86_IO_APIC? It looks like it already has problems, as mp_find_ioapic_pin is not stubbed out, or am I overlooking something? Regards, Flo ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86, ioapic: move acpi_get_override_irq to acpi.c 2011-04-01 16:26 ` Florian Mickler @ 2011-04-03 14:34 ` Florian Mickler 2011-04-04 15:00 ` Ingo Molnar 0 siblings, 1 reply; 6+ messages in thread From: Florian Mickler @ 2011-04-03 14:34 UTC (permalink / raw) To: linux-kernel Cc: Florian Mickler, mingo, linux-acpi, Len Brown, Eric W. Biederman, kurup_avinash, maciej.rutecki, rjw, sedat.dilek On Fri, 1 Apr 2011 18:26:53 +0200 Florian Mickler <florian@mickler.org> wrote: > And how do I check compilation of !CONFIG_X86_IO_APIC? That was a real question, btw. Not just me mumbling around... make oldconfig always turns that symbol back on to =y ... and I couldn't find out why. > Regards, > Flo ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86, ioapic: move acpi_get_override_irq to acpi.c 2011-04-03 14:34 ` Florian Mickler @ 2011-04-04 15:00 ` Ingo Molnar 0 siblings, 0 replies; 6+ messages in thread From: Ingo Molnar @ 2011-04-04 15:00 UTC (permalink / raw) To: Florian Mickler Cc: linux-kernel, linux-acpi, Len Brown, Eric W. Biederman, kurup_avinash, maciej.rutecki, rjw, sedat.dilek * Florian Mickler <florian@mickler.org> wrote: > On Fri, 1 Apr 2011 18:26:53 +0200 > Florian Mickler <florian@mickler.org> wrote: > > > And how do I check compilation of !CONFIG_X86_IO_APIC? > > That was a real question, btw. Not just me mumbling around... make > oldconfig always turns that symbol back on to =y ... and I couldn't find > out why. 'make ARCH=i386 allnoconfig' for example. Thanks, Ingo ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86, ioapic: move acpi_get_override_irq to acpi.c 2011-04-01 15:44 ` [PATCH] x86, ioapic: move acpi_get_override_irq to acpi.c Florian Mickler 2011-04-01 16:26 ` Florian Mickler @ 2011-04-12 7:39 ` Ingo Molnar 2011-04-12 19:53 ` Florian Mickler 1 sibling, 1 reply; 6+ messages in thread From: Ingo Molnar @ 2011-04-12 7:39 UTC (permalink / raw) To: Florian Mickler Cc: linux-kernel, linux-acpi, Len Brown, Eric W. Biederman, kurup_avinash, maciej.rutecki, rjw, sedat.dilek * Florian Mickler <florian@mickler.org> wrote: > In order to get rid of the ugly CONFIG_ACPI ifdef, we move > the function acpi_get_override_irq into acpi.c and add a new > helper function ioapic_get_irq to io_apic.c. > > Signed-off-by: Florian Mickler <florian@mickler.org> > Cc: Len Brown <lenb@kernel.org> > Cc: "Eric W. Biederman" <ebiederm@xmission.com> > Cc: kurup_avinash@yahoo.com > Cc: maciej.rutecki@gmail.com > Cc: rjw@sisk.pl > Cc: sedat.dilek@gmail.com > LKML-Reference: <1301558489-4198-1-git-send-email-florian@mickler.org> > --- > > Hi Ingo, > > Instead of exporting find_irq_entry, irq_trigger and irq_polarity, I added a > new helper function 'ioapic_get_irq(..)' and exported that. > > Also I did it as a seperate commit, since it is more of a cleanup and the other > commit is already tested... hope this is ok. Yeah, looks good in principle. Mind porting to the latest x86 devel tree and resend the patch? I tried to apply your patch but there's a conflict. You can find the tree at: http://people.redhat.com/mingo/tip.git/README Thanks, Ingo ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86, ioapic: move acpi_get_override_irq to acpi.c 2011-04-12 7:39 ` Ingo Molnar @ 2011-04-12 19:53 ` Florian Mickler 0 siblings, 0 replies; 6+ messages in thread From: Florian Mickler @ 2011-04-12 19:53 UTC (permalink / raw) To: Ingo Molnar Cc: linux-kernel, linux-acpi, Len Brown, Eric W. Biederman, kurup_avinash, maciej.rutecki, rjw, sedat.dilek On Tue, 12 Apr 2011 09:39:29 +0200 Ingo Molnar <mingo@elte.hu> wrote: > > * Florian Mickler <florian@mickler.org> wrote: > > > In order to get rid of the ugly CONFIG_ACPI ifdef, we move > > the function acpi_get_override_irq into acpi.c and add a new > > helper function ioapic_get_irq to io_apic.c. > > > > Signed-off-by: Florian Mickler <florian@mickler.org> > > Cc: Len Brown <lenb@kernel.org> > > Cc: "Eric W. Biederman" <ebiederm@xmission.com> > > Cc: kurup_avinash@yahoo.com > > Cc: maciej.rutecki@gmail.com > > Cc: rjw@sisk.pl > > Cc: sedat.dilek@gmail.com > > LKML-Reference: <1301558489-4198-1-git-send-email-florian@mickler.org> > > --- > > > > Hi Ingo, > > > > Instead of exporting find_irq_entry, irq_trigger and irq_polarity, I added a > > new helper function 'ioapic_get_irq(..)' and exported that. > > > > Also I did it as a seperate commit, since it is more of a cleanup and the other > > commit is already tested... hope this is ok. > > Yeah, looks good in principle. > > Mind porting to the latest x86 devel tree and resend the patch? I tried to > apply your patch but there's a conflict. You can find the tree at: > > http://people.redhat.com/mingo/tip.git/README > > Thanks, > > Ingo It does still apply on top of [PATCH v2] x86, ioapic: Skip looking for ioapic overrides when ioapics are not present (<1301621025-3858-1-git-send-email-florian@mickler.org>) I'm going to send both patches as a reply to this message, since I have updated the $subject patch to also remove the #define acpi_get_override_irq in acpi.h .. Regards, Flo ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-04-12 19:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20110401075011.GD7594@elte.hu>
2011-04-01 15:44 ` [PATCH] x86, ioapic: move acpi_get_override_irq to acpi.c Florian Mickler
2011-04-01 16:26 ` Florian Mickler
2011-04-03 14:34 ` Florian Mickler
2011-04-04 15:00 ` Ingo Molnar
2011-04-12 7:39 ` Ingo Molnar
2011-04-12 19:53 ` Florian Mickler
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox