[tip:x86/apic] x86, ACPI, irq: Enhance error handling in function acpi_register_gsi()
Commit-ID: 2c0a6894df19515baf9d2bf0076a2b57c8b51efb Gitweb: http://git.kernel.org/tip/2c0a6894df19515baf9d2bf0076a2b57c8b51efb Author: Jiang Liu jiang@linux.intel.com AuthorDate: Tue, 10 Jun 2014 14:11:23 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:40 +0200 x86, ACPI, irq: Enhance error handling in function acpi_register_gsi() Function mp_register_gsi() may return error code when failed to look up or program corresponding IOAPIC pin for GSI, so enhance acpi_register_gsi() to handle possible error cases. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Link: http://lkml.kernel.org/r/1402380683-32345-1-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/acpi/boot.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 392360c..298f796 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -97,6 +97,8 @@ static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; +#defineACPI_INVALID_GSIINT_MIN + static unsigned int gsi_to_irq(unsigned int gsi) { unsigned int irq = gsi + NR_IRQS_LEGACY; @@ -441,7 +443,7 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, polarity == ACPI_ACTIVE_HIGH ? 0 : 1); ret = io_apic_set_pci_routing(dev, gsi_to_irq(gsi), irq_attr); if (ret 0) - gsi = INT_MIN; + gsi = ACPI_INVALID_GSI; return gsi; } @@ -666,13 +668,13 @@ int (*acpi_suspend_lowlevel)(void); */ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) { - unsigned int irq; - unsigned int plat_gsi = gsi; + unsigned int plat_gsi; - plat_gsi = (*__acpi_register_gsi)(dev, gsi, trigger, polarity); - irq = gsi_to_irq(plat_gsi); + plat_gsi = __acpi_register_gsi(dev, gsi, trigger, polarity); + if (plat_gsi != ACPI_INVALID_GSI) + return gsi_to_irq(plat_gsi); - return irq; + return -1; } EXPORT_SYMBOL_GPL(acpi_register_gsi); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, mpparse: Simplify arch/x86/include/asm/ mpspec.h
Commit-ID: a491cc902ca495365e9cd45154b60d8c702d86da Gitweb: http://git.kernel.org/tip/a491cc902ca495365e9cd45154b60d8c702d86da Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:32 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:40 +0200 x86, mpparse: Simplify arch/x86/include/asm/mpspec.h Simplify arch/x86/include/asm/mpspec.h by 1) Change max_physical_apicid to static as it's only used in apic.c. 2) Kill declaration of mpc_default_type, it's never defined. 3) Delete default_acpi_madt_oem_check(), it has already been declared in apic.h. 4) Make default_acpi_madt_oem_check() depends on CONFIG_X86_LOCAL_APIC instead of CONFIG_X86_64 to support i386. 5) Change mp_override_legacy_irq(), mp_config_acpi_legacy_irqs() and mp_register_gsi() as static because they are only used in acpi/boot.c. Signed-off-by: Jiang Liu jiang@linux.intel.com Acked-by: David Rientjes rient...@google.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: H. Peter Anvin h...@linux.intel.com Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Cc: Seiji Aguchi seiji.agu...@hds.com Cc: HATAYAMA Daisuke d.hatay...@jp.fujitsu.com Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Richard Weinberger rich...@nod.at Cc: Andi Kleen a...@linux.intel.com Link: http://lkml.kernel.org/r/1402302011-23642-4-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/include/asm/apic.h| 4 ++-- arch/x86/include/asm/io_apic.h | 3 --- arch/x86/include/asm/mpspec.h | 13 - arch/x86/kernel/acpi/boot.c| 12 +--- arch/x86/kernel/apic/apic.c| 2 +- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 19b0eba..69ed79a 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -502,8 +502,6 @@ static inline unsigned default_get_apic_id(unsigned long x) #define DEFAULT_TRAMPOLINE_PHYS_HIGH 0x469 #ifdef CONFIG_X86_64 -extern int default_acpi_madt_oem_check(char *, char *); - extern void apic_send_IPI_self(int vector); DECLARE_PER_CPU(int, x2apic_extra_bits); @@ -552,6 +550,8 @@ static inline int default_apic_id_valid(int apicid) return (apicid 255); } +extern int default_acpi_madt_oem_check(char *, char *); + extern void default_setup_apic_routing(void); extern struct apic apic_noop; diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 90f97b4..9121abb 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -118,9 +118,6 @@ extern int mp_irq_entries; /* MP IRQ source entries */ extern struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES]; -/* non-0 if default (table-less) MP configuration */ -extern int mpc_default_type; - /* Older SiS APIC requires we rewrite the index register */ extern int sis_apic_bug; diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h index f5a6179..7bef40a 100644 --- a/arch/x86/include/asm/mpspec.h +++ b/arch/x86/include/asm/mpspec.h @@ -40,8 +40,6 @@ extern int mp_bus_id_to_type[MAX_MP_BUSSES]; extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); extern unsigned int boot_cpu_physical_apicid; -extern unsigned int max_physical_apicid; -extern int mpc_default_type; extern unsigned long mp_lapic_addr; #ifdef CONFIG_X86_LOCAL_APIC @@ -88,15 +86,6 @@ static inline void early_reserve_e820_mpc_new(void) { } #endif int generic_processor_info(int apicid, int version); -#ifdef CONFIG_ACPI -extern void mp_register_ioapic(int id, u32 address, u32 gsi_base); -extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, - u32 gsi); -extern void mp_config_acpi_legacy_irqs(void); -struct device; -extern int mp_register_gsi(struct device *dev, u32 gsi, int edge_level, -int active_high_low); -#endif /* CONFIG_ACPI */ #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_LOCAL_APIC) @@ -163,6 +152,4 @@ extern physid_mask_t phys_cpu_present_map; extern int generic_mps_oem_check(struct mpc_table *, char *, char *); -extern int default_acpi_madt_oem_check(char *, char *); - #endif /* _ASM_X86_MPSPEC_H */ diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 86281ff..b41b470 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -345,6 +345,10 @@ acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long e #endif
[tip:x86/apic] x86, ACPI, irq: Fix possible eror in GSI to IRQ mapping for legacy IRQ
Commit-ID: 2e0ad0e2c13534f1a0e7f63661e666c281e09b66 Gitweb: http://git.kernel.org/tip/2e0ad0e2c13534f1a0e7f63661e666c281e09b66 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:38 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:41 +0200 x86, ACPI, irq: Fix possible eror in GSI to IRQ mapping for legacy IRQ A default identity mapping between GSI and IRQ is built for legacy IRQs. So when overriding the default identity mapping for legacy IRQs, we should also invalidate isa_irq_to_gsi[gsi] when setting isa_irq_to_gsi[irq] = gsi. Otherwise there may be two entries with the same GSI in the isa_irq_to_gsi array, and acpi_isa_irq_to_gsi() may give wrong result. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Link: http://lkml.kernel.org/r/1402302011-23642-10-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/acpi/boot.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 298f796..f3bafcd 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -366,6 +366,13 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, mp_save_irq(mp_irq); + /* +* Reset default identity mapping if gsi is also an legacy IRQ, +* otherwise there will be more than one entry with the same GSI +* and acpi_isa_irq_to_gsi() may give wrong result. +*/ + if (gsi NR_IRQS_LEGACY isa_irq_to_gsi[gsi] == gsi) + isa_irq_to_gsi[gsi] = ACPI_INVALID_GSI; isa_irq_to_gsi[bus_irq] = gsi; } @@ -621,7 +628,8 @@ EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi) { - if (isa_irq NR_IRQS_LEGACY) { + if (isa_irq NR_IRQS_LEGACY + isa_irq_to_gsi[isa_irq] != ACPI_INVALID_GSI) { *gsi = isa_irq_to_gsi[isa_irq]; return 0; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, ioapic: Kill unused global variable timer_through_8259
Commit-ID: 4035ed0134b2dc545a0b22e3c052f684786649d4 Gitweb: http://git.kernel.org/tip/4035ed0134b2dc545a0b22e3c052f684786649d4 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:40 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:41 +0200 x86, ioapic: Kill unused global variable timer_through_8259 Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-12-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/include/asm/io_apic.h | 4 arch/x86/kernel/apic/io_apic.c | 3 --- 2 files changed, 7 deletions(-) diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 8dd1e13..de3d8b0 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -130,9 +130,6 @@ extern int noioapicquirk; /* -1 if noapic boot option passed */ extern int noioapicreroute; -/* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */ -extern int timer_through_8259; - /* * If we use the IO-APIC for IRQ routing, disable automatic * assignment of PCI IRQ's. @@ -212,7 +209,6 @@ extern void io_apic_eoi(unsigned int apic, unsigned int vector); #define io_apic_assign_pci_irqs 0 #define setup_ioapic_ids_from_mpc x86_init_noop -static const int timer_through_8259 = 0; static inline void ioapic_insert_resources(void) { } #define gsi_top (NR_IRQS_LEGACY) static inline int mp_find_ioapic(u32 gsi) { return 0; } diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index f339042..18ab95b 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -2638,8 +2638,6 @@ static int __init disable_timer_pin_setup(char *arg) } early_param(disable_timer_pin_1, disable_timer_pin_setup); -int timer_through_8259 __initdata; - /* * This code may look a bit paranoid, but it's supposed to cooperate with * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ @@ -2744,7 +2742,6 @@ static inline void __init check_timer(void) legacy_pic-unmask(0); if (timer_irq_works()) { apic_printk(APIC_QUIET, KERN_INFO ... works.\n); - timer_through_8259 = 1; goto out; } /* -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, ioapic: Introduce helper utilities to walk ioapics and pins
Commit-ID: f44d16929638a6dc34bdd51e7422e7e3c1d0b904 Gitweb: http://git.kernel.org/tip/f44d16929638a6dc34bdd51e7422e7e3c1d0b904 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:42 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:41 +0200 x86, ioapic: Introduce helper utilities to walk ioapics and pins Introduce helper utilities for_each_ioapic(), for_each_ioapic_reverse(), for_each_pin() and for_each_ioapic_pin() to walk ioapics and pins. They will be rewritten e will rewrite later to support IOAPIC hotplug. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-14-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/apic/io_apic.c | 120 + 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 46d09ea..16b0247 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -62,6 +62,16 @@ #define __apicdebuginit(type) static type __init +#definefor_each_ioapic(idx)\ + for ((idx) = 0; (idx) nr_ioapics; (idx)++) +#definefor_each_ioapic_reverse(idx)\ + for ((idx) = nr_ioapics - 1; (idx) = 0; (idx)--) +#definefor_each_pin(idx, pin) \ + for ((pin) = 0; (pin) ioapics[(idx)].nr_registers; (pin)++) +#definefor_each_ioapic_pin(idx, pin) \ + for_each_ioapic((idx)) \ + for_each_pin((idx), (pin)) + #define for_each_irq_pin(entry, head) \ for (entry = head; entry; entry = entry-next) @@ -191,7 +201,7 @@ int __init arch_early_irq_init(void) if (!legacy_pic-nr_legacy_irqs) io_apic_irqs = ~0UL; - for (i = 0; i nr_ioapics; i++) { + for_each_ioapic(i) { ioapics[i].saved_registers = kzalloc(sizeof(struct IO_APIC_route_entry) * ioapics[i].nr_registers, GFP_KERNEL); @@ -624,9 +634,8 @@ static void clear_IO_APIC (void) { int apic, pin; - for (apic = 0; apic nr_ioapics; apic++) - for (pin = 0; pin ioapics[apic].nr_registers; pin++) - clear_IO_APIC_pin(apic, pin); + for_each_ioapic_pin(apic, pin) + clear_IO_APIC_pin(apic, pin); } #ifdef CONFIG_X86_32 @@ -675,13 +684,13 @@ int save_ioapic_entries(void) int apic, pin; int err = 0; - for (apic = 0; apic nr_ioapics; apic++) { + for_each_ioapic(apic) { if (!ioapics[apic].saved_registers) { err = -ENOMEM; continue; } - for (pin = 0; pin ioapics[apic].nr_registers; pin++) + for_each_pin(apic, pin) ioapics[apic].saved_registers[pin] = ioapic_read_entry(apic, pin); } @@ -696,11 +705,11 @@ void mask_ioapic_entries(void) { int apic, pin; - for (apic = 0; apic nr_ioapics; apic++) { + for_each_ioapic(apic) { if (!ioapics[apic].saved_registers) continue; - for (pin = 0; pin ioapics[apic].nr_registers; pin++) { + for_each_pin(apic, pin) { struct IO_APIC_route_entry entry; entry = ioapics[apic].saved_registers[pin]; @@ -719,11 +728,11 @@ int restore_ioapic_entries(void) { int apic, pin; - for (apic = 0; apic nr_ioapics; apic++) { + for_each_ioapic(apic) { if (!ioapics[apic].saved_registers) continue; - for (pin = 0; pin ioapics[apic].nr_registers; pin++) + for_each_pin(apic, pin) ioapic_write_entry(apic, pin, ioapics[apic].saved_registers[pin]); } @@ -782,7 +791,7 @@ static int __init find_isa_irq_apic(int irq, int type) if (i mp_irq_entries) { int ioapic_idx; - for (ioapic_idx = 0; ioapic_idx nr_ioapics; ioapic_idx++) + for_each_ioapic(ioapic_idx) if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic) return ioapic_idx; } @@ -1001,7 +1010,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot,
[tip:x86/apic] x86, ioapic: Kill static variable nr_irqs_gsi
Commit-ID: 518b2c63fcdde0723d2719bbe5b14086bdc8ec80 Gitweb: http://git.kernel.org/tip/518b2c63fcdde0723d2719bbe5b14086bdc8ec80 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:41 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:41 +0200 x86, ioapic: Kill static variable nr_irqs_gsi Static variable nr_irqs_gsi is used to maintain the lowest dynamic allocatable IRQ number. It may cause trouble when enabling dynamic IRQ allocation for IOAPIC, so use arch_dynirq_lower_bound() to avoid directly accessing nr_irqs_gsi and kill nr_irqs_gsi. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-13-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/apic/io_apic.c | 24 +--- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 18ab95b..46d09ea 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -118,9 +118,6 @@ struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES]; /* # of MP IRQ source entries */ int mp_irq_entries; -/* GSI interrupts */ -static int nr_irqs_gsi = NR_IRQS_LEGACY; - #ifdef CONFIG_EISA int mp_bus_id_to_type[MAX_MP_BUSSES]; #endif @@ -3326,20 +3323,11 @@ static int __init io_apic_get_redir_entries(int ioapic) return reg_01.bits.entries + 1; } -static void __init probe_nr_irqs_gsi(void) -{ - int nr; - - nr = gsi_top + NR_IRQS_LEGACY; - if (nr nr_irqs_gsi) - nr_irqs_gsi = nr; - - printk(KERN_DEBUG nr_irqs_gsi: %d\n, nr_irqs_gsi); -} - unsigned int arch_dynirq_lower_bound(unsigned int from) { - return from nr_irqs_gsi ? nr_irqs_gsi : from; + unsigned int min = gsi_top + NR_IRQS_LEGACY; + + return from min ? min : from; } int __init arch_probe_nr_irqs(void) @@ -3349,12 +3337,12 @@ int __init arch_probe_nr_irqs(void) if (nr_irqs (NR_VECTORS * nr_cpu_ids)) nr_irqs = NR_VECTORS * nr_cpu_ids; - nr = nr_irqs_gsi + 8 * nr_cpu_ids; + nr = (gsi_top + NR_IRQS_LEGACY) + 8 * nr_cpu_ids; #if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ) /* * for MSI and HT dyn irq */ - nr += nr_irqs_gsi * 16; + nr += (gsi_top + NR_IRQS_LEGACY) * 16; #endif if (nr nr_irqs) nr_irqs = nr; @@ -3627,8 +3615,6 @@ fake_ioapic_page: ioapic_res-end = ioapic_phys + IO_APIC_SLOT_SIZE - 1; ioapic_res++; } - - probe_nr_irqs_gsi(); } void __init ioapic_insert_resources(void) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, ioapic: Use irq_cfg() instead of irq_get_chip_data() for better readability
Commit-ID: 32f5ef5d8dd5ac3cc7ac12cdaf33023e2fbd33c1 Gitweb: http://git.kernel.org/tip/32f5ef5d8dd5ac3cc7ac12cdaf33023e2fbd33c1 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:43 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:41 +0200 x86, ioapic: Use irq_cfg() instead of irq_get_chip_data() for better readability Use defined helper function irq_cfg() instead of irq_get_chip_data() for better readability. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-15-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/apic/io_apic.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 16b0247..446a931 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -230,7 +230,7 @@ int __init arch_early_irq_init(void) return 0; } -static struct irq_cfg *irq_cfg(unsigned int irq) +static inline struct irq_cfg *irq_cfg(unsigned int irq) { return irq_get_chip_data(irq); } @@ -272,7 +272,7 @@ static struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node) if (res 0) { if (res != -EEXIST) return NULL; - cfg = irq_get_chip_data(at); + cfg = irq_cfg(at); if (cfg) return cfg; } @@ -1204,7 +1204,7 @@ void __setup_vector_irq(int cpu) raw_spin_lock(vector_lock); /* Mark the inuse vectors */ for_each_active_irq(irq) { - cfg = irq_get_chip_data(irq); + cfg = irq_cfg(irq); if (!cfg) continue; @@ -1612,7 +1612,7 @@ __apicdebuginit(void) print_IO_APICs(void) if (chip != ioapic_chip) continue; - cfg = irq_get_chip_data(irq); + cfg = irq_cfg(irq); if (!cfg) continue; entry = cfg-irq_2_pin; @@ -2253,7 +2253,7 @@ static void irq_complete_move(struct irq_cfg *cfg) void irq_force_complete_move(int irq) { - struct irq_cfg *cfg = irq_get_chip_data(irq); + struct irq_cfg *cfg = irq_cfg(irq); if (!cfg) return; @@ -2515,7 +2515,7 @@ static inline void init_IO_APIC_traps(void) unsigned int irq; for_each_active_irq(irq) { - cfg = irq_get_chip_data(irq); + cfg = irq_cfg(irq); if (IO_APIC_IRQ(irq) cfg !cfg-vector) { /* * Hmm.. We don't have an entry for this, @@ -2648,7 +2648,7 @@ early_param(disable_timer_pin_1, disable_timer_pin_setup); */ static inline void __init check_timer(void) { - struct irq_cfg *cfg = irq_get_chip_data(0); + struct irq_cfg *cfg = irq_cfg(0); int node = cpu_to_node(0); int apic1, pin1, apic2, pin2; unsigned long flags; @@ -2912,7 +2912,7 @@ int arch_setup_hwirq(unsigned int irq, int node) void arch_teardown_hwirq(unsigned int irq) { - struct irq_cfg *cfg = irq_get_chip_data(irq); + struct irq_cfg *cfg = irq_cfg(irq); unsigned long flags; free_remapped_irq(irq); @@ -3039,7 +3039,7 @@ int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, if (!irq_offset) write_msi_msg(irq, msg); - setup_remapped_irq(irq, irq_get_chip_data(irq), chip); + setup_remapped_irq(irq, irq_cfg(irq), chip); irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, edge); @@ -3178,7 +3178,7 @@ int default_setup_hpet_msi(unsigned int irq, unsigned int id) hpet_msi_write(irq_get_handler_data(irq), msg); irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); - setup_remapped_irq(irq, irq_get_chip_data(irq), chip); + setup_remapped_irq(irq, irq_cfg(irq), chip); irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, edge); return 0; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86: ce4100, irq: Do not set legacy_pic to null_legacy_pic
Commit-ID: 6532ce994c304835f3bfc8479acce9d102cd8b5b Gitweb: http://git.kernel.org/tip/6532ce994c304835f3bfc8479acce9d102cd8b5b Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:47 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:42 +0200 x86: ce4100, irq: Do not set legacy_pic to null_legacy_pic Intel CE4100 platforms has i8259 legacy interrupt controllers, so don't set legacy_pic to null_legacy_pic in late booting stage because we need legacy_pic to mask i8259 pins when enabling IOAPIC pins for safety. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-19-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/platform/ce4100/ce4100.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c index 0a54a58..701fd58 100644 --- a/arch/x86/platform/ce4100/ce4100.c +++ b/arch/x86/platform/ce4100/ce4100.c @@ -138,8 +138,6 @@ static void __init sdv_arch_setup(void) static void sdv_pci_init(void) { x86_of_pci_init(); - /* We can't set this earlier, because we need to calibrate the timer */ - legacy_pic = null_legacy_pic; } /* -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq: Simplify arch_early_irq_init()
Commit-ID: 4b92b4f754939e4ac6bb53355abbe48a5054b573 Gitweb: http://git.kernel.org/tip/4b92b4f754939e4ac6bb53355abbe48a5054b573 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:49 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:42 +0200 x86, irq: Simplify arch_early_irq_init() Simplify function arch_early_irq_init() and kill static array irq_cfgx[]. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-21-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/apic/io_apic.c | 33 +++-- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 4208ea9..e25e7e3 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -183,6 +183,7 @@ early_param(noapic, parse_noapic); static int io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr); +static struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node); /* Will be called in mpparse/acpi/sfi codes for saving IRQ info */ void mp_save_irq(struct mpc_intsrc *m) @@ -214,14 +215,10 @@ static struct irq_pin_list *alloc_irq_pin_list(int node) return kzalloc_node(sizeof(struct irq_pin_list), GFP_KERNEL, node); } - -/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */ -static struct irq_cfg irq_cfgx[NR_IRQS_LEGACY]; - int __init arch_early_irq_init(void) { struct irq_cfg *cfg; - int count, node, i; + int i, node = cpu_to_node(0); if (!nr_legacy_irqs()) io_apic_irqs = ~0UL; @@ -234,22 +231,14 @@ int __init arch_early_irq_init(void) pr_err(IOAPIC %d: suspend/resume impossible!\n, i); } - cfg = irq_cfgx; - count = ARRAY_SIZE(irq_cfgx); - node = cpu_to_node(0); - - for (i = 0; i count; i++) { - irq_set_chip_data(i, cfg[i]); - zalloc_cpumask_var_node(cfg[i].domain, GFP_KERNEL, node); - zalloc_cpumask_var_node(cfg[i].old_domain, GFP_KERNEL, node); - /* -* For legacy IRQ's, start with assigning irq0 to irq15 to -* IRQ0_VECTOR to IRQ15_VECTOR for all cpu's. -*/ - if (i nr_legacy_irqs()) { - cfg[i].vector = IRQ0_VECTOR + i; - cpumask_setall(cfg[i].domain); - } + /* +* For legacy IRQ's, start with assigning irq0 to irq15 to +* IRQ0_VECTOR to IRQ15_VECTOR for all cpu's. +*/ + for (i = 0; i nr_legacy_irqs(); i++) { + cfg = alloc_irq_and_cfg_at(i, node); + cfg-vector = IRQ0_VECTOR + i; + cpumask_setall(cfg-domain); } return 0; @@ -3377,7 +3366,7 @@ int __init arch_probe_nr_irqs(void) if (nr nr_irqs) nr_irqs = nr; - return nr_legacy_irqs(); + return 0; } int io_apic_set_pci_routing(struct device *dev, int irq, -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq: Introduce mechanisms to support dynamically allocate IRQ for IOAPIC
Commit-ID: d7f3d4781852f5160b939f526afbc21a813a0206 Gitweb: http://git.kernel.org/tip/d7f3d4781852f5160b939f526afbc21a813a0206 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:52 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:42 +0200 x86, irq: Introduce mechanisms to support dynamically allocate IRQ for IOAPIC Currently x86 support identity mapping between GSI(IOAPIC pin) and IRQ number, so continous IRQs at low end are statically allocated to IOAPICs at boot time. This design causes trouble to support IOAPIC hotplug. This patch implements basic mechanism to dynamically allocate IRQ on demand for IOAPIC pins by using irqdomain framework. It first adds several fields into struct ioapic to support irqdomain. Then it implements an algorithm to dynamically allocate IRQ number for IOAPIC pins on demand. Currently it supports three types of irqdomain: 1) LEGACY: used to support IOAPIC hosting legacy IRQs and building identity mapping for legacy IRQs. A speical case, we dynamically allocate IRQ number for IOAPIC pin which has GSI number below nr_legacy_irqs() but isn't legacy IRQ. This is for backward compatibility and avoid regression. 2) STRICT: build identity mapping between GSI and IRQ nubmer. 3) DYNAMIC: dynamically allocate IRQ number for IOAPIC pin on demand. Legacy(ISA) IRQs is not managed by irqdomain because there may be multiple pins sharing the same IRQ number and current irqdomain only supports 1:1 mapping between pins and IRQ. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Link: http://lkml.kernel.org/r/1402302011-23642-24-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/Kconfig | 1 + arch/x86/include/asm/io_apic.h | 21 +- arch/x86/kernel/acpi/boot.c| 8 +-- arch/x86/kernel/apic/io_apic.c | 158 - 4 files changed, 147 insertions(+), 41 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 9df5c45..147a7b7 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -836,6 +836,7 @@ config X86_IO_APIC def_bool y depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC || PCI_MSI select GENERIC_IRQ_LEGACY_ALLOC_HWIRQ + select IRQ_DOMAIN config X86_REROUTE_FOR_BROKEN_BOOT_IRQS bool Reroute for broken boot IRQs diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 978e51f..64c6e34 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -98,6 +98,8 @@ struct IR_IO_APIC_route_entry { #define IOAPIC_AUTO -1 #define IOAPIC_EDGE 0 #define IOAPIC_LEVEL1 +#defineIOAPIC_MAP_ALLOC0x1 +#defineIOAPIC_MAP_CHECK0x2 #ifdef CONFIG_X86_IO_APIC @@ -163,6 +165,21 @@ extern int restore_ioapic_entries(void); extern void setup_ioapic_ids_from_mpc(void); extern void setup_ioapic_ids_from_mpc_nocheck(void); +enum ioapic_domain_type { + IOAPIC_DOMAIN_INVALID, + IOAPIC_DOMAIN_LEGACY, + IOAPIC_DOMAIN_STRICT, + IOAPIC_DOMAIN_DYNAMIC, +}; + +struct device_node; +struct irq_domain_ops; +struct ioapic_domain_cfg { + enum ioapic_domain_type type; + const struct irq_domain_ops *ops; + struct device_node *dev; +}; + struct mp_ioapic_gsi{ u32 gsi_base; u32 gsi_end; @@ -172,7 +189,7 @@ extern u32 gsi_top; extern int mp_find_ioapic(u32 gsi); extern int mp_find_ioapic_pin(int ioapic, u32 gsi); extern u32 mp_pin_to_gsi(int ioapic, int pin); -extern int mp_map_gsi_to_irq(u32 gsi); +extern int mp_map_gsi_to_irq(u32 gsi, unsigned int flags); extern void __init mp_register_ioapic(int id, u32 address, u32 gsi_base); extern void __init pre_init_apic_IRQ0(void); @@ -215,7 +232,7 @@ static inline void ioapic_insert_resources(void) { } #define gsi_top (NR_IRQS_LEGACY) static inline int mp_find_ioapic(u32 gsi) { return 0; } static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } -static inline int mp_map_gsi_to_irq(u32 gsi) { return gsi; } +static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; } struct io_apic_irq_attr; static inline int io_apic_set_pci_routing(struct device *dev, int irq, diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 0cf311c..d6635ba
[tip:x86/apic] x86, irq, ACPI: Change __acpi_register_gsi to return IRQ number instead of GSI
Commit-ID: 84245af7297ced9e8fe837dc0fc4782438771bd2 Gitweb: http://git.kernel.org/tip/84245af7297ced9e8fe837dc0fc4782438771bd2 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Tue, 10 Jun 2014 14:14:47 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:42 +0200 x86, irq, ACPI: Change __acpi_register_gsi to return IRQ number instead of GSI Currently __acpi_register_gsi is defined to return GSI number and may be set to acpi_register_gsi_pic(), acpi_register_gsi_ioapic(), acpi_register_gsi_xen_hvm() and acpi_register_gsi_xen(). Among which, acpi_register_gsi_ioapic() returns GSI number, but acpi_register_gsi_xen_hvm() and acpi_register_gsi_xen() actually returns IRQ number instead of GSI. And for acpi_register_gsi_pic(), GSI number equals to IRQ number. So change acpi_register_gsi_ioapic() to return IRQ number, it also simplifies the code. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Link: http://lkml.kernel.org/r/1402380887-32512-1-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/acpi/boot.c | 21 - 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 9965afb..0cf311c 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -419,7 +419,7 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, irq = map_gsi_to_irq(gsi); if (irq 0) - return ACPI_INVALID_GSI; + return irq; ioapic = mp_find_ioapic(gsi); if (ioapic 0) { @@ -444,12 +444,11 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, polarity == ACPI_ACTIVE_HIGH ? 0 : 1); ret = io_apic_set_pci_routing(dev, irq, irq_attr); if (ret 0) - gsi = ACPI_INVALID_GSI; + irq = -1; - return gsi; + return irq; } - static int __init acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) { @@ -652,11 +651,13 @@ static int acpi_register_gsi_pic(struct device *dev, u32 gsi, static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi, int trigger, int polarity) { + int irq = gsi; + #ifdef CONFIG_X86_IO_APIC - gsi = mp_register_gsi(dev, gsi, trigger, polarity); + irq = mp_register_gsi(dev, gsi, trigger, polarity); #endif - return gsi; + return irq; } int (*__acpi_register_gsi)(struct device *dev, u32 gsi, @@ -674,13 +675,7 @@ int (*acpi_suspend_lowlevel)(void); */ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) { - unsigned int plat_gsi; - - plat_gsi = __acpi_register_gsi(dev, gsi, trigger, polarity); - if (plat_gsi != ACPI_INVALID_GSI) - return map_gsi_to_irq(plat_gsi); - - return -1; + return __acpi_register_gsi(dev, gsi, trigger, polarity); } EXPORT_SYMBOL_GPL(acpi_register_gsi); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, ACPI, irq: Consolidate algorithm of mapping ( ioapic, pin) to IRQ number
Commit-ID: 6b9fb7082409cd4a2c7caf43e3c023ad82dad0d4 Gitweb: http://git.kernel.org/tip/6b9fb7082409cd4a2c7caf43e3c023ad82dad0d4 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Tue, 10 Jun 2014 14:13:25 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:42 +0200 x86, ACPI, irq: Consolidate algorithm of mapping (ioapic, pin) to IRQ number Currently ACPI and ioapic both implement algorithms to map (ioapic, pin) to IRQ number. So consolidate the common part into one place, which is also preparing for irqdomain support. It introduces mp_map_gsi_to_irq(), which will be used to allocate IRQ number IOAPIC pins when irqdomain is enabled. Also rename gsi_to_irq() to map_gsi_to_irq(), later we will introduce unmap_gsi_to_irq() when enabling IOAPIC hotplug. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Link: http://lkml.kernel.org/r/1402380812-32446-1-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/include/asm/io_apic.h | 2 ++ arch/x86/kernel/acpi/boot.c| 45 -- arch/x86/kernel/apic/io_apic.c | 27 ++--- 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index b775cf3..978e51f 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -172,6 +172,7 @@ extern u32 gsi_top; extern int mp_find_ioapic(u32 gsi); extern int mp_find_ioapic_pin(int ioapic, u32 gsi); extern u32 mp_pin_to_gsi(int ioapic, int pin); +extern int mp_map_gsi_to_irq(u32 gsi); extern void __init mp_register_ioapic(int id, u32 address, u32 gsi_base); extern void __init pre_init_apic_IRQ0(void); @@ -214,6 +215,7 @@ static inline void ioapic_insert_resources(void) { } #define gsi_top (NR_IRQS_LEGACY) static inline int mp_find_ioapic(u32 gsi) { return 0; } static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } +static inline int mp_map_gsi_to_irq(u32 gsi) { return gsi; } struct io_apic_irq_attr; static inline int io_apic_set_pci_routing(struct device *dev, int irq, diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index b129765..9965afb 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -100,27 +100,15 @@ static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = { #defineACPI_INVALID_GSIINT_MIN -static unsigned int gsi_to_irq(unsigned int gsi) +static int map_gsi_to_irq(unsigned int gsi) { - unsigned int irq = gsi + nr_legacy_irqs(); - unsigned int i; + int i; - for (i = 0; i nr_legacy_irqs(); i++) { - if (isa_irq_to_gsi[i] == gsi) { + for (i = 0; i nr_legacy_irqs(); i++) + if (isa_irq_to_gsi[i] == gsi) return i; - } - } - - /* Provide an identity mapping of gsi == irq -* except on truly weird platforms that have -* non isa irqs in the first 16 gsis. -*/ - if (gsi = nr_legacy_irqs()) - irq = gsi; - else - irq = gsi_top + gsi; - return irq; + return mp_map_gsi_to_irq(gsi); } /* @@ -416,6 +404,7 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger, static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) { + int irq; int ioapic; int ioapic_pin; struct io_apic_irq_attr irq_attr; @@ -428,6 +417,10 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, if (acpi_gbl_FADT.sci_interrupt == gsi) return gsi; + irq = map_gsi_to_irq(gsi); + if (irq 0) + return ACPI_INVALID_GSI; + ioapic = mp_find_ioapic(gsi); if (ioapic 0) { printk(KERN_WARNING No IOAPIC for GSI %u\n, gsi); @@ -449,7 +442,7 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, set_io_apic_irq_attr(irq_attr, ioapic, ioapic_pin, trigger == ACPI_EDGE_SENSITIVE ? 0 : 1, polarity == ACPI_ACTIVE_HIGH ? 0 : 1); - ret = io_apic_set_pci_routing(dev, gsi_to_irq(gsi), irq_attr); + ret = io_apic_set_pci_routing(dev, irq, irq_attr); if (ret 0) gsi = ACPI_INVALID_GSI; @@ -614,16 +607,20
[tip:x86/apic] x86, SFI, irq: Provide basic irqdomain support
Commit-ID: 1b5d3e00d45e093fa0551c588034c3355b362f66 Gitweb: http://git.kernel.org/tip/1b5d3e00d45e093fa0551c588034c3355b362f66 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:56 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:43 +0200 x86, SFI, irq: Provide basic irqdomain support Enhance SFI to provide basic support of irqdomain with identity mapping between GSIs and IRQs. Some Intel MID platforms assumes identity mapping between GSI and IRQ, so we can't dynamically allocate IRQ number on demand. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: H. Peter Anvin h...@linux.intel.com Cc: sfi-de...@simplefirmware.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown l...@kernel.org Cc: David Cohen david.a.co...@linux.intel.com Cc: Kuppuswamy Sathyanarayanan sathyanarayanan.kuppusw...@linux.intel.com Link: http://lkml.kernel.org/r/1402302011-23642-28-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/pci/intel_mid_pci.c | 3 +++ arch/x86/platform/intel-mid/sfi.c | 2 ++ arch/x86/platform/sfi/sfi.c | 8 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/pci/intel_mid_pci.c b/arch/x86/pci/intel_mid_pci.c index 84b9d67..fcbdc5fa 100644 --- a/arch/x86/pci/intel_mid_pci.c +++ b/arch/x86/pci/intel_mid_pci.c @@ -217,6 +217,9 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev) * MRST only have IOAPIC, the PCI irq lines are 1:1 mapped to * IOAPIC RTE entries, so we just enable RTE for the device. */ + if (mp_map_gsi_to_irq(dev-irq, IOAPIC_MAP_ALLOC) 0) + return -EBUSY; + irq_attr.ioapic = mp_find_ioapic(dev-irq); irq_attr.ioapic_pin = dev-irq; irq_attr.trigger = 1; /* level */ diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c index 994c40b..7161395 100644 --- a/arch/x86/platform/intel-mid/sfi.c +++ b/arch/x86/platform/intel-mid/sfi.c @@ -473,6 +473,8 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) /* PNW and CLV go with active low */ irq_attr.polarity = 1; } + WARN_ON(mp_map_gsi_to_irq(irq, + IOAPIC_MAP_ALLOC) 0); io_apic_set_pci_routing(NULL, irq, irq_attr); } } else { diff --git a/arch/x86/platform/sfi/sfi.c b/arch/x86/platform/sfi/sfi.c index 8f2f789..1fdaa57 100644 --- a/arch/x86/platform/sfi/sfi.c +++ b/arch/x86/platform/sfi/sfi.c @@ -25,6 +25,7 @@ #include linux/init.h #include linux/sfi.h #include linux/io.h +#include linux/irqdomain.h #include asm/io_apic.h #include asm/mpspec.h @@ -70,19 +71,24 @@ static int __init sfi_parse_cpus(struct sfi_table_header *table) #endif /* CONFIG_X86_LOCAL_APIC */ #ifdef CONFIG_X86_IO_APIC +static struct irq_domain_ops sfi_ioapic_irqdomain_ops; static int __init sfi_parse_ioapic(struct sfi_table_header *table) { struct sfi_table_simple *sb; struct sfi_apic_table_entry *pentry; int i, num; + struct ioapic_domain_cfg cfg = { + .type = IOAPIC_DOMAIN_STRICT, + .ops = sfi_ioapic_irqdomain_ops, + }; sb = (struct sfi_table_simple *)table; num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry); pentry = (struct sfi_apic_table_entry *)sb-pentry; for (i = 0; i num; i++) { - mp_register_ioapic(i, pentry-phys_addr, gsi_top, NULL); + mp_register_ioapic(i, pentry-phys_addr, gsi_top, cfg); pentry++; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, mpparse, irq: Provide basic irqdomain support
Commit-ID: 74501edcd846830bec86bfa06c47c25083e70ffc Gitweb: http://git.kernel.org/tip/74501edcd846830bec86bfa06c47c25083e70ffc Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:55 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:43 +0200 x86, mpparse, irq: Provide basic irqdomain support Enhance mpparse to provide basic support of irqdomain. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-27-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/mpparse.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index ea8595e..13c8e1f 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c @@ -19,6 +19,7 @@ #include linux/module.h #include linux/smp.h #include linux/pci.h +#include linux/irqdomain.h #include asm/mtrr.h #include asm/mpspec.h @@ -112,10 +113,17 @@ static void __init MP_bus_info(struct mpc_bus *m) pr_warn(Unknown bustype %s - ignoring\n, str); } +static struct irq_domain_ops mp_ioapic_irqdomain_ops; + static void __init MP_ioapic_info(struct mpc_ioapic *m) { + struct ioapic_domain_cfg cfg = { + .type = IOAPIC_DOMAIN_LEGACY, + .ops = mp_ioapic_irqdomain_ops, + }; + if (m-flags MPC_APIC_USABLE) - mp_register_ioapic(m-apicid, m-apicaddr, gsi_top, NULL); + mp_register_ioapic(m-apicid, m-apicaddr, gsi_top, cfg); } static void __init print_mp_irq_info(struct mpc_intsrc *mp_irq) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 3.16, i915: less colors in X?
Am Samstag, 21. Juni 2014, 22:29:01 schrieb Pavel Machek: Hi! I just test-booted 3.16-rc1, and background in X looked just wrong -- very noticeable bands on the background gradient. I thought that maybe it is just my eyes, but I went back to older kernel, and background is ok now. I'm trying to figure out how to ask X what color depth it is using...? I think: martin@merkaba:~ xdpyinfo | grep -i depth of root depth of root window:24 planes but am not completely sure. This is thinkpad x60 with Debian 6.0.9. Ciao, -- Martin 'Helios' Steigerwald - http://www.Lichtvoll.de GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, devicetree, irq: Use common mechanism to support irqdomain
Commit-ID: facd8fdb25fc4d041a283446cfb040cbfe2c3723 Gitweb: http://git.kernel.org/tip/facd8fdb25fc4d041a283446cfb040cbfe2c3723 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:57 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:43 +0200 x86, devicetree, irq: Use common mechanism to support irqdomain Now the ioapic driver provides a common interface to create irqdomain, so replace the private implementation. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Rob Herring rob.herr...@calxeda.com Cc: Michal Simek mon...@monstr.eu Cc: Tony Lindgren t...@atomide.com Link: http://lkml.kernel.org/r/1402302011-23642-29-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/include/asm/prom.h | 2 - arch/x86/kernel/devicetree.c | 191 +-- arch/x86/kernel/irqinit.c| 6 -- 3 files changed, 59 insertions(+), 140 deletions(-) diff --git a/arch/x86/include/asm/prom.h b/arch/x86/include/asm/prom.h index fbeb06e..1d081ac 100644 --- a/arch/x86/include/asm/prom.h +++ b/arch/x86/include/asm/prom.h @@ -26,12 +26,10 @@ extern int of_ioapic; extern u64 initial_dtb; extern void add_dtb(u64 data); -extern void x86_add_irq_domains(void); void x86_of_pci_init(void); void x86_dtb_init(void); #else static inline void add_dtb(u64 data) { } -static inline void x86_add_irq_domains(void) { } static inline void x86_of_pci_init(void) { } static inline void x86_dtb_init(void) { } #define of_ioapic 0 diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index d2c53fe..ee26fec 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -166,82 +166,6 @@ static void __init dtb_lapic_setup(void) #ifdef CONFIG_X86_IO_APIC static unsigned int ioapic_id; -static void __init dtb_add_ioapic(struct device_node *dn) -{ - struct resource r; - int ret; - - ret = of_address_to_resource(dn, 0, r); - if (ret) { - printk(KERN_ERR Can't obtain address from node %s.\n, - dn-full_name); - return; - } - mp_register_ioapic(++ioapic_id, r.start, gsi_top, NULL); -} - -static void __init dtb_ioapic_setup(void) -{ - struct device_node *dn; - - for_each_compatible_node(dn, NULL, intel,ce4100-ioapic) - dtb_add_ioapic(dn); - - if (nr_ioapics) { - of_ioapic = 1; - return; - } - printk(KERN_ERR Error: No information about IO-APIC in OF.\n); -} -#else -static void __init dtb_ioapic_setup(void) {} -#endif - -static void __init dtb_apic_setup(void) -{ - dtb_lapic_setup(); - dtb_ioapic_setup(); -} - -#ifdef CONFIG_OF_FLATTREE -static void __init x86_flattree_get_config(void) -{ - u32 size, map_len; - void *dt; - - if (!initial_dtb) - return; - - map_len = max(PAGE_SIZE - (initial_dtb ~PAGE_MASK), (u64)128); - - initial_boot_params = dt = early_memremap(initial_dtb, map_len); - size = of_get_flat_dt_size(); - if (map_len size) { - early_iounmap(dt, map_len); - initial_boot_params = dt = early_memremap(initial_dtb, size); - map_len = size; - } - - unflatten_and_copy_device_tree(); - early_iounmap(dt, map_len); -} -#else -static inline void x86_flattree_get_config(void) { } -#endif - -void __init x86_dtb_init(void) -{ - x86_flattree_get_config(); - - if (!of_have_populated_dt()) - return; - - dtb_setup_hpet(); - dtb_apic_setup(); -} - -#ifdef CONFIG_X86_IO_APIC - struct of_ioapic_type { u32 out_type; u32 trigger; @@ -292,7 +216,7 @@ static int ioapic_xlate(struct irq_domain *domain, it = of_ioapic_type[intspec[1]]; - idx = (u32) domain-host_data; + idx = (u32)(long)domain-host_data; set_io_apic_irq_attr(attr, idx, line, it-trigger, it-polarity); rc = io_apic_setup_irq_pin_once(irq_find_mapping(domain, line), @@ -309,78 +233,81 @@ const struct irq_domain_ops ioapic_irq_domain_ops = { .xlate = ioapic_xlate, }; -static void dt_add_ioapic_domain(unsigned int ioapic_num, - struct device_node *np) +static void __init dtb_add_ioapic(struct device_node *dn) { - struct irq_domain *id; - struct mp_ioapic_gsi *gsi_cfg; + struct resource r; int ret; - int num,
[tip:x86/apic] x86: ce4100, irq: Make CE4100 depend on CONFIG_X86_IO_APIC
Commit-ID: 6084a6e23c971ef703229ee1aec68d01688578d6 Gitweb: http://git.kernel.org/tip/6084a6e23c971ef703229ee1aec68d01688578d6 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:46 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:42 +0200 x86: ce4100, irq: Make CE4100 depend on CONFIG_X86_IO_APIC Intel CE4100 platforms need IOAPIC support becasue some devices are always connected to the second IOAPIC, so make CONFIG_CE depends on CONFIG_X86_IO_APIC. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-18-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/Kconfig | 1 + arch/x86/platform/ce4100/ce4100.c | 9 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index a8f749e..9df5c45 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -429,6 +429,7 @@ config X86_INTEL_CE bool CE4100 TV platform depends on PCI depends on PCI_GODIRECT + depends on X86_IO_APIC depends on X86_32 depends on X86_EXTENDED_PLATFORM select X86_REBOOTFIXUPS diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c index 8244f5e..0a54a58 100644 --- a/arch/x86/platform/ce4100/ce4100.c +++ b/arch/x86/platform/ce4100/ce4100.c @@ -135,14 +135,12 @@ static void __init sdv_arch_setup(void) sdv_serial_fixup(); } -#ifdef CONFIG_X86_IO_APIC static void sdv_pci_init(void) { x86_of_pci_init(); /* We can't set this earlier, because we need to calibrate the timer */ legacy_pic = null_legacy_pic; } -#endif /* * CE4100 specific x86_init function overrides and early setup @@ -155,7 +153,9 @@ void __init x86_ce4100_early_setup(void) x86_init.resources.probe_roms = x86_init_noop; x86_init.mpparse.get_smp_config = x86_init_uint_noop; x86_init.mpparse.find_smp_config = x86_init_noop; + x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc_nocheck; x86_init.pci.init = ce4100_pci_init; + x86_init.pci.init_irq = sdv_pci_init; /* * By default, the reboot method is ACPI which is supported by the @@ -166,10 +166,5 @@ void __init x86_ce4100_early_setup(void) */ reboot_type = BOOT_KBD; -#ifdef CONFIG_X86_IO_APIC - x86_init.pci.init_irq = sdv_pci_init; - x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc_nocheck; -#endif - pm_power_off = ce4100_power_off; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq, mpparse: Use common irqdomain map interface to program IOAPIC pins
Commit-ID: 9506063992cc0785246fd314a4a40b6314685aa8 Gitweb: http://git.kernel.org/tip/9506063992cc0785246fd314a4a40b6314685aa8 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:20:00 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:43 +0200 x86, irq, mpparse: Use common irqdomain map interface to program IOAPIC pins Refine mpparse to use common irqdomain map interface to program IOAPIC pins, so we can unify the callsite to progam IOAPIC pins. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-32-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/mpparse.c | 4 +++- arch/x86/pci/irq.c| 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 13c8e1f..faf503a 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c @@ -113,7 +113,9 @@ static void __init MP_bus_info(struct mpc_bus *m) pr_warn(Unknown bustype %s - ignoring\n, str); } -static struct irq_domain_ops mp_ioapic_irqdomain_ops; +static struct irq_domain_ops mp_ioapic_irqdomain_ops = { + .map = mp_irqdomain_map, +}; static void __init MP_ioapic_info(struct mpc_ioapic *m) { diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index 84112f5..e4200e5 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c @@ -1227,8 +1227,6 @@ static int pirq_enable_irq(struct pci_dev *dev) } dev = temp_dev; if (irq = 0) { - io_apic_set_pci_routing(dev-dev, irq, -irq_attr); dev-irq = irq; dev_info(dev-dev, PCI-APIC IRQ transform: INT %c - IRQ %d\n, 'A' + pin - 1, irq); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq, SFI: Use common irqdomain map interface to program IOAPIC pins
Commit-ID: ecc527d560cd87c74cc0bc7aff36eb72f7e18615 Gitweb: http://git.kernel.org/tip/ecc527d560cd87c74cc0bc7aff36eb72f7e18615 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:20:01 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:43 +0200 x86, irq, SFI: Use common irqdomain map interface to program IOAPIC pins Refine SFI to use common irqdomain map interface to program IOAPIC pins, so we can unify the callsite to progam IOAPIC pins. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: H. Peter Anvin h...@linux.intel.com Cc: sfi-de...@simplefirmware.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown l...@kernel.org Cc: David Cohen david.a.co...@linux.intel.com Cc: Kuppuswamy Sathyanarayanan sathyanarayanan.kuppusw...@linux.intel.com Link: http://lkml.kernel.org/r/1402302011-23642-33-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/pci/intel_mid_pci.c | 19 + arch/x86/platform/intel-mid/sfi.c | 58 +-- arch/x86/platform/sfi/sfi.c | 4 ++- 3 files changed, 35 insertions(+), 46 deletions(-) diff --git a/arch/x86/pci/intel_mid_pci.c b/arch/x86/pci/intel_mid_pci.c index fcbdc5fa..337d165 100644 --- a/arch/x86/pci/intel_mid_pci.c +++ b/arch/x86/pci/intel_mid_pci.c @@ -208,27 +208,22 @@ static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, static int intel_mid_pci_irq_enable(struct pci_dev *dev) { - u8 pin; - struct io_apic_irq_attr irq_attr; + int polarity; - pci_read_config_byte(dev, PCI_INTERRUPT_PIN, pin); + if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) + polarity = 0; /* active high */ + else + polarity = 1; /* active low */ /* * MRST only have IOAPIC, the PCI irq lines are 1:1 mapped to * IOAPIC RTE entries, so we just enable RTE for the device. */ + if (mp_set_gsi_attr(dev-irq, 1, polarity, dev_to_node(dev-dev))) + return -EBUSY; if (mp_map_gsi_to_irq(dev-irq, IOAPIC_MAP_ALLOC) 0) return -EBUSY; - irq_attr.ioapic = mp_find_ioapic(dev-irq); - irq_attr.ioapic_pin = dev-irq; - irq_attr.trigger = 1; /* level */ - if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) - irq_attr.polarity = 0; /* active high */ - else - irq_attr.polarity = 1; /* active low */ - io_apic_set_pci_routing(dev-dev, dev-irq, irq_attr); - return 0; } diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c index 7161395..3c53a90 100644 --- a/arch/x86/platform/intel-mid/sfi.c +++ b/arch/x86/platform/intel-mid/sfi.c @@ -432,9 +432,8 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) struct sfi_table_simple *sb; struct sfi_device_table_entry *pentry; struct devs_id *dev = NULL; - int num, i; - int ioapic; - struct io_apic_irq_attr irq_attr; + int num, i, ret; + int polarity; sb = (struct sfi_table_simple *)table; num = SFI_GET_NUM_ENTRIES(sb, struct sfi_device_table_entry); @@ -448,37 +447,30 @@ static int __init sfi_parse_devs(struct sfi_table_header *table) * devices, but they have separate RTE entry in IOAPIC * so we have to enable them one by one here */ - ioapic = mp_find_ioapic(irq); - if (ioapic = 0) { - irq_attr.ioapic = ioapic; - irq_attr.ioapic_pin = irq; - irq_attr.trigger = 1; - if (intel_mid_identify_cpu() == - INTEL_MID_CPU_CHIP_TANGIER) { - if (!strncmp(pentry-name, - r69001-ts-i2c, 13)) - /* active low */ - irq_attr.polarity = 1; - else if (!strncmp(pentry-name, - synaptics_3202, 14)) - /* active low */ - irq_attr.polarity = 1; - else if (irq == 41) -
[tip:x86/apic] x86, irq, devicetree: Use common irqdomain map interface to program IOAPIC pins
Commit-ID: 795aacf63fee1bfe8b68fd5db4882576c5c0c570 Gitweb: http://git.kernel.org/tip/795aacf63fee1bfe8b68fd5db4882576c5c0c570 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:20:02 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:43 +0200 x86, irq, devicetree: Use common irqdomain map interface to program IOAPIC pins Refine devicetree to use common irqdomain map interface to program IOAPIC pins, so we can unify the callsite to progam IOAPIC pins. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Rob Herring rob.herr...@calxeda.com Cc: Michal Simek mon...@monstr.eu Cc: Tony Lindgren t...@atomide.com Link: http://lkml.kernel.org/r/1402302011-23642-34-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/devicetree.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index ee26fec..f33bb43 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -201,10 +201,8 @@ static int ioapic_xlate(struct irq_domain *domain, const u32 *intspec, u32 intsize, irq_hw_number_t *out_hwirq, u32 *out_type) { - struct io_apic_irq_attr attr; struct of_ioapic_type *it; - u32 line, idx; - int rc; + u32 line, idx, gsi; if (WARN_ON(intsize 2)) return -EINVAL; @@ -217,12 +215,9 @@ static int ioapic_xlate(struct irq_domain *domain, it = of_ioapic_type[intspec[1]]; idx = (u32)(long)domain-host_data; - set_io_apic_irq_attr(attr, idx, line, it-trigger, it-polarity); - - rc = io_apic_setup_irq_pin_once(irq_find_mapping(domain, line), - cpu_to_node(0), attr); - if (rc) - return rc; + gsi = mp_pin_to_gsi(idx, line); + if (mp_set_gsi_attr(gsi, it-trigger, it-polarity, cpu_to_node(0))) + return -EBUSY; *out_hwirq = line; *out_type = it-out_type; @@ -230,6 +225,7 @@ static int ioapic_xlate(struct irq_domain *domain, } const struct irq_domain_ops ioapic_irq_domain_ops = { + .map = mp_irqdomain_map, .xlate = ioapic_xlate, }; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq: Clean up unused IOAPIC interface
Commit-ID: 9f354b0252b81c870ac7534d71906280cb573f86 Gitweb: http://git.kernel.org/tip/9f354b0252b81c870ac7534d71906280cb573f86 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:20:03 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:44 +0200 x86, irq: Clean up unused IOAPIC interface Now we have converted all x86 platforms to use the common irqdomain map interface. There's no caller of io_apic_set_pci_routing(), setup_IO_APIC_irq_extra() and io_apic_setup_irq_pin_once() any more, so kill them. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-35-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/include/asm/io_apic.h | 9 -- arch/x86/kernel/apic/io_apic.c | 70 -- 2 files changed, 79 deletions(-) diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index c535878..af6f9d4 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -141,9 +141,6 @@ extern int noioapicreroute; struct io_apic_irq_attr; struct irq_cfg; -extern int io_apic_set_pci_routing(struct device *dev, int irq, -struct io_apic_irq_attr *irq_attr); -extern void setup_IO_APIC_irq_extra(u32 gsi); extern void ioapic_insert_resources(void); extern int native_setup_ioapic_entry(int, struct IO_APIC_route_entry *, @@ -155,8 +152,6 @@ extern void native_compose_msi_msg(struct pci_dev *pdev, unsigned int irq, unsigned int dest, struct msi_msg *msg, u8 hpet_id); extern void native_eoi_ioapic_pin(int apic, int pin, int vector); -extern int io_apic_setup_irq_pin_once(unsigned int irq, int node, - struct io_apic_irq_attr *attr); extern int save_ioapic_entries(void); extern void mask_ioapic_entries(void); @@ -240,10 +235,6 @@ static inline int mp_find_ioapic(u32 gsi) { return 0; } static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; } -struct io_apic_irq_attr; -static inline int io_apic_set_pci_routing(struct device *dev, int irq, -struct io_apic_irq_attr *irq_attr) { return 0; } - static inline int save_ioapic_entries(void) { return -ENOMEM; diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index a602b35..6e3d4c7 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -111,7 +111,6 @@ static struct ioapic { struct ioapic_domain_cfg irqdomain_cfg; struct irq_domain *irqdomain; struct mp_pin_info *pin_info; - DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); } ioapics[MAX_IO_APICS]; #define mpc_ioapic_ver(ioapic_idx) ioapics[ioapic_idx].mp_config.apicver @@ -1524,38 +1523,6 @@ static void __init setup_IO_APIC_irqs(void) } /* - * for the gsi that is not in first ioapic - * but could not use acpi_register_gsi() - * like some special sci in IBM x3330 - */ -void setup_IO_APIC_irq_extra(u32 gsi) -{ - int ioapic_idx = 0, pin, idx, irq, node = cpu_to_node(0); - struct io_apic_irq_attr attr; - - /* -* Convert 'gsi' to 'ioapic.pin'. -*/ - ioapic_idx = mp_find_ioapic(gsi); - if (ioapic_idx 0) - return; - - pin = mp_find_ioapic_pin(ioapic_idx, gsi); - idx = find_irq_entry(ioapic_idx, pin, mp_INT); - if (idx == -1) - return; - - irq = pin_2_irq(idx, ioapic_idx, pin, IOAPIC_MAP_ALLOC); - if (irq 0 || mp_init_irq_at_boot(ioapic_idx, irq)) - return; - - set_io_apic_irq_attr(attr, ioapic_idx, pin, irq_trigger(idx), -irq_polarity(idx)); - - io_apic_setup_irq_pin_once(irq, node, attr); -} - -/* * Set up the timer pin, possibly with the 8259A-master behind. */ static void __init setup_timer_IRQ0_pin(unsigned int ioapic_idx, @@ -3458,27 +3425,6 @@ io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr) return ret; } -int io_apic_setup_irq_pin_once(unsigned int irq, int node, - struct io_apic_irq_attr *attr) -{ - unsigned int ioapic_idx = attr-ioapic, pin = attr-ioapic_pin; - int ret; - struct IO_APIC_route_entry orig_entry; - - /* Avoid
[tip:x86/apic] x86, irq, mpparse: Release IOAPIC pin when PCI device is disabled
Commit-ID: c03b3b0738a56cf283b0d05256988d5e3c8bd719 Gitweb: http://git.kernel.org/tip/c03b3b0738a56cf283b0d05256988d5e3c8bd719 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:20:08 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:44 +0200 x86, irq, mpparse: Release IOAPIC pin when PCI device is disabled Release IOAPIC pin associated with PCI device when the PCI device is disabled. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-40-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/mpparse.c | 1 + arch/x86/pci/irq.c| 13 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index faf503a..fde86d2 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c @@ -115,6 +115,7 @@ static void __init MP_bus_info(struct mpc_bus *m) static struct irq_domain_ops mp_ioapic_irqdomain_ops = { .map = mp_irqdomain_map, + .unmap = mp_irqdomain_unmap, }; static void __init MP_ioapic_info(struct mpc_ioapic *m) diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index e4200e5..748cfe8 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c @@ -26,6 +26,7 @@ static int acer_tm360_irqrouting; static struct irq_routing_table *pirq_table; static int pirq_enable_irq(struct pci_dev *dev); +static void pirq_disable_irq(struct pci_dev *dev); /* * Never use: 0, 1, 2 (timer, keyboard, and cascade) @@ -53,7 +54,7 @@ struct irq_router_handler { }; int (*pcibios_enable_irq)(struct pci_dev *dev) = pirq_enable_irq; -void (*pcibios_disable_irq)(struct pci_dev *dev) = NULL; +void (*pcibios_disable_irq)(struct pci_dev *dev) = pirq_disable_irq; /* * Check passed address for the PCI IRQ Routing Table signature @@ -1186,7 +1187,7 @@ void pcibios_penalize_isa_irq(int irq, int active) static int pirq_enable_irq(struct pci_dev *dev) { - u8 pin; + u8 pin = 0; pci_read_config_byte(dev, PCI_INTERRUPT_PIN, pin); if (pin !pcibios_lookup_irq(dev, 1)) { @@ -1252,3 +1253,11 @@ static int pirq_enable_irq(struct pci_dev *dev) } return 0; } + +static void pirq_disable_irq(struct pci_dev *dev) +{ + if (io_apic_assign_pci_irqs dev-irq) { + mp_unmap_irq(dev-irq); + dev-irq = 0; + } +} -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq: Introduce some helper utilities to improve readability
Commit-ID: 18e485518656205bbffce5e01f07830a6c3f557d Gitweb: http://git.kernel.org/tip/18e485518656205bbffce5e01f07830a6c3f557d Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:45 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:41 +0200 x86, irq: Introduce some helper utilities to improve readability It also fixes an off by one bug in if ((ioapic_idx 0) (irq NR_IRQS_LEGACY)) It should be if ((ioapic_idx 0) (irq = NR_IRQS_LEGACY)) Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-17-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/include/asm/io_apic.h | 2 ++ arch/x86/kernel/apic/io_apic.c | 29 ++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index de3d8b0..b775cf3 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -171,6 +171,7 @@ extern u32 gsi_top; extern int mp_find_ioapic(u32 gsi); extern int mp_find_ioapic_pin(int ioapic, u32 gsi); +extern u32 mp_pin_to_gsi(int ioapic, int pin); extern void __init mp_register_ioapic(int id, u32 address, u32 gsi_base); extern void __init pre_init_apic_IRQ0(void); @@ -212,6 +213,7 @@ extern void io_apic_eoi(unsigned int apic, unsigned int vector); static inline void ioapic_insert_resources(void) { } #define gsi_top (NR_IRQS_LEGACY) static inline int mp_find_ioapic(u32 gsi) { return 0; } +static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } struct io_apic_irq_attr; static inline int io_apic_set_pci_routing(struct device *dev, int irq, diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 09e5c7b..424f795 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -117,6 +117,24 @@ struct mp_ioapic_gsi *mp_ioapic_gsi_routing(int ioapic_idx) return ioapics[ioapic_idx].gsi_config; } +static inline int mp_ioapic_pin_count(int ioapic) +{ + struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic); + + return gsi_cfg-gsi_end - gsi_cfg-gsi_base + 1; +} + +u32 mp_pin_to_gsi(int ioapic, int pin) +{ + return mp_ioapic_gsi_routing(ioapic)-gsi_base + pin; +} + +/* Initialize all legacy IRQs and all pins on the first IOAPIC at boot */ +static inline int mp_init_irq_at_boot(int ioapic, int irq) +{ + return ioapic == 0 || (irq = 0 irq NR_IRQS_LEGACY); +} + int nr_ioapics; /* The one past the highest gsi number used */ @@ -1367,8 +1385,7 @@ static void __init __io_apic_setup_irqs(unsigned int ioapic_idx) continue; irq = pin_2_irq(idx, ioapic_idx, pin); - - if ((ioapic_idx 0) (irq NR_IRQS_LEGACY)) + if (!mp_init_irq_at_boot(ioapic_idx, irq)) continue; /* @@ -1419,9 +1436,7 @@ void setup_IO_APIC_irq_extra(u32 gsi) return; irq = pin_2_irq(idx, ioapic_idx, pin); - - /* Only handle the non legacy irqs on secondary ioapics */ - if (ioapic_idx == 0 || irq NR_IRQS_LEGACY) + if (mp_init_irq_at_boot(ioapic_idx, irq)) return; set_io_apic_irq_attr(attr, ioapic_idx, pin, irq_trigger(idx), @@ -3528,9 +3543,9 @@ void __init setup_ioapic_dest(void) irq_entry = find_irq_entry(ioapic, pin, mp_INT); if (irq_entry == -1) continue; - irq = pin_2_irq(irq_entry, ioapic, pin); - if ((ioapic 0) (irq NR_IRQS_LEGACY)) + irq = pin_2_irq(irq_entry, ioapic, pin); + if (!mp_init_irq_at_boot(ioapic, irq)) continue; idata = irq_get_irq_data(irq); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq: Reorganize IO_APIC_get_PCI_irq_vector() to prepare for irqdomain
Commit-ID: 79598505aee61bc943955de3653be054c2f7393f Gitweb: http://git.kernel.org/tip/79598505aee61bc943955de3653be054c2f7393f Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:44 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:41 +0200 x86, irq: Reorganize IO_APIC_get_PCI_irq_vector() to prepare for irqdomain Reorganize function IO_APIC_get_PCI_irq_vector() a bit to better support coming irqdomain. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-16-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/apic/io_apic.c | 61 +++--- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 446a931..09e5c7b 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -997,7 +997,7 @@ static int pin_2_irq(int idx, int apic, int pin) int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, struct io_apic_irq_attr *irq_attr) { - int ioapic_idx, i, best_guess = -1; + int irq, i, best_guess = -1; apic_printk(APIC_DEBUG, querying PCI - IRQ mapping bus:%d, slot:%d, pin:%d.\n, @@ -1007,41 +1007,46 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, PCI BIOS passed nonexistent PCI bus %d!\n, bus); return -1; } + for (i = 0; i mp_irq_entries; i++) { int lbus = mp_irqs[i].srcbus; + int ioapic_idx, found = 0; + + if (bus != lbus || mp_irqs[i].irqtype != mp_INT || + slot != ((mp_irqs[i].srcbusirq 2) 0x1f)) + continue; for_each_ioapic(ioapic_idx) if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic || - mp_irqs[i].dstapic == MP_APIC_ALL) + mp_irqs[i].dstapic == MP_APIC_ALL) { + found = 1; break; + } + if (!found) + continue; - if (!test_bit(lbus, mp_bus_not_pci) - mp_irqs[i].irqtype == mp_INT - (bus == lbus) - (slot == ((mp_irqs[i].srcbusirq 2) 0x1f))) { - int irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq); - - if (!(ioapic_idx || IO_APIC_IRQ(irq))) - continue; + /* Skip ISA IRQs */ + irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq); + if (ioapic_idx == 0 !IO_APIC_IRQ(irq)) + continue; - if (pin == (mp_irqs[i].srcbusirq 3)) { - set_io_apic_irq_attr(irq_attr, ioapic_idx, -mp_irqs[i].dstirq, -irq_trigger(i), -irq_polarity(i)); - return irq; - } - /* -* Use the first all-but-pin matching entry as a -* best-guess fuzzy result for broken mptables. -*/ - if (best_guess 0) { - set_io_apic_irq_attr(irq_attr, ioapic_idx, -mp_irqs[i].dstirq, -irq_trigger(i), -irq_polarity(i)); - best_guess = irq; - } + if (pin == (mp_irqs[i].srcbusirq 3)) { + set_io_apic_irq_attr(irq_attr, ioapic_idx, +mp_irqs[i].dstirq, +irq_trigger(i), +irq_polarity(i)); + return irq; + } + /* +* Use the first all-but-pin matching entry as a +* best-guess fuzzy result for broken mptables. +*/ + if (best_guess 0) { +
[tip:x86/apic] x86, irq, ACPI: Use common irqdomain map interface to program IOAPIC pins
Commit-ID: d7b830013f59cf586c1cec3caa1ce7156da59a13 Gitweb: http://git.kernel.org/tip/d7b830013f59cf586c1cec3caa1ce7156da59a13 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:59 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:43 +0200 x86, irq, ACPI: Use common irqdomain map interface to program IOAPIC pins Refine ACPI to use common irqdomain map interface to program IOAPIC pins, so we can unify the callsite to progam IOAPIC pins. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Link: http://lkml.kernel.org/r/1402302011-23642-31-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/acpi/boot.c | 44 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 8d9aee1..9add76f 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -405,11 +405,7 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger, static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) { - int irq; - int ioapic; - int ioapic_pin; - struct io_apic_irq_attr irq_attr; - int ret; + int irq, node; if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) return gsi; @@ -418,39 +414,27 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, if (acpi_gbl_FADT.sci_interrupt == gsi) return gsi; + trigger = trigger == ACPI_EDGE_SENSITIVE ? 0 : 1; + polarity = polarity == ACPI_ACTIVE_HIGH ? 0 : 1; + node = dev ? dev_to_node(dev) : NUMA_NO_NODE; + if (mp_set_gsi_attr(gsi, trigger, polarity, node)) { + pr_warn(Failed to set pin attr for GSI%d\n, gsi); + return -1; + } + irq = map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC); if (irq 0) return irq; - ioapic = mp_find_ioapic(gsi); - if (ioapic 0) { - printk(KERN_WARNING No IOAPIC for GSI %u\n, gsi); - return gsi; - } - - ioapic_pin = mp_find_ioapic_pin(ioapic, gsi); - - if (ioapic_pin MP_MAX_IOAPIC_PIN) { - printk(KERN_ERR Invalid reference to IOAPIC pin - %d-%d\n, mpc_ioapic_id(ioapic), - ioapic_pin); - return gsi; - } - if (enable_update_mptable) mp_config_acpi_gsi(dev, gsi, trigger, polarity); - set_io_apic_irq_attr(irq_attr, ioapic, ioapic_pin, -trigger == ACPI_EDGE_SENSITIVE ? 0 : 1, -polarity == ACPI_ACTIVE_HIGH ? 0 : 1); - ret = io_apic_set_pci_routing(dev, irq, irq_attr); - if (ret 0) - irq = -1; - return irq; } -static struct irq_domain_ops acpi_irqdomain_ops; +static struct irq_domain_ops acpi_irqdomain_ops = { + .map = mp_irqdomain_map, +}; static int __init acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) @@ -622,10 +606,6 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) int irq = map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); if (irq = 0) { -#ifdef CONFIG_X86_IO_APIC - if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) - setup_IO_APIC_irq_extra(gsi); -#endif *irqp = irq; return 0; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq: Simplify the way to handle ISA IRQ
Commit-ID: 16ee7b3dcc56be14b9a813612cff2cc2339cdced Gitweb: http://git.kernel.org/tip/16ee7b3dcc56be14b9a813612cff2cc2339cdced Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:20:04 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:44 +0200 x86, irq: Simplify the way to handle ISA IRQ On startup, setup_IO_APIC_irqs() will program all IOAPIC pins for ISA IRQs. Later when mp_map_pin_to_irq() is called, it just returns ISA IRQ number without programming corresponding IOAPIC pin. This patch consolidates the way to program IOAPIC pins for both ISA and non-ISA IRQs into mp_map_pin_to_irq() as below: 1) For ISA IRQs, mp_irqs array is used to map IOAPIC pin to IRQ and mp_irqdomain_map() is used to actually program the pin. 2) For non-ISA IRQs, irqdomain is used to map IOAPIC pin to IRQ, and mp_irqdomain_map() is also used to actually program the pin. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Link: http://lkml.kernel.org/r/1402302011-23642-36-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/acpi/boot.c| 15 +-- arch/x86/kernel/apic/io_apic.c | 98 -- 2 files changed, 40 insertions(+), 73 deletions(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 9add76f..fd4b6d2 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -101,17 +101,6 @@ static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = { #defineACPI_INVALID_GSIINT_MIN -static int map_gsi_to_irq(unsigned int gsi, unsigned int flags) -{ - int i; - - for (i = 0; i nr_legacy_irqs(); i++) - if (isa_irq_to_gsi[i] == gsi) - return i; - - return mp_map_gsi_to_irq(gsi, flags); -} - /* * This is just a simple wrapper around early_ioremap(), * with sanity checks for phys == 0 and size == 0. @@ -422,7 +411,7 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, return -1; } - irq = map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC); + irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC); if (irq 0) return irq; @@ -603,7 +592,7 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) { - int irq = map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); + int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); if (irq = 0) { *irqp = irq; diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 6e3d4c7..8485d90 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -204,8 +204,6 @@ static int __init parse_noapic(char *str) } early_param(noapic, parse_noapic); -static int io_apic_setup_irq_pin(unsigned int irq, int node, -struct io_apic_irq_attr *attr); static struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node); /* Will be called in mpparse/acpi/sfi codes for saving IRQ info */ @@ -1021,6 +1019,16 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, struct irq_domain *domain = mp_ioapic_irqdomain(ioapic); struct mp_pin_info *info = mp_pin_info(ioapic, pin); + if (!domain) { + /* +* Provide an identity mapping of gsi == irq except on truly +* weird platforms that have non isa irqs in the first 16 gsis. +*/ + return gsi = nr_legacy_irqs() ? gsi : gsi_top + gsi; + } + + mutex_lock(ioapic_mutex); + /* * Don't use irqdomain to manage ISA IRQs because there may be * multiple IOAPIC pins sharing the same ISA IRQ number and @@ -1033,28 +1041,30 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, * the interrupt routing logic. Thus there may be multiple pins * sharing the same legacy IRQ number when ACPI is disabled. */ - if (idx = 0 test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) - return mp_irqs[idx].srcbusirq; - - if (!domain) { - /* -* Provide an identity mapping of gsi == irq except on truly -* weird platforms that have non isa irqs in the first 16 gsis. -
[tip:x86/apic] x86, irq, devicetree: Release IOAPIC pin when PCI device is disabled
Commit-ID: 00f49c29b3298806c74589a4ed016a2afb359e98 Gitweb: http://git.kernel.org/tip/00f49c29b3298806c74589a4ed016a2afb359e98 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:20:10 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:44 +0200 x86, irq, devicetree: Release IOAPIC pin when PCI device is disabled Release IOAPIC pin associated with PCI device when the PCI device is disabled. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Rob Herring rob.herr...@calxeda.com Cc: Michal Simek mon...@monstr.eu Cc: Tony Lindgren t...@atomide.com Link: http://lkml.kernel.org/r/1402302011-23642-42-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/devicetree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index f33bb43..3d35033 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -226,6 +226,7 @@ static int ioapic_xlate(struct irq_domain *domain, const struct irq_domain_ops ioapic_irq_domain_ops = { .map = mp_irqdomain_map, + .unmap = mp_irqdomain_unmap, .xlate = ioapic_xlate, }; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq: Clean up irqdomain transition code
Commit-ID: b81975eade8c6495f3c4d6746d22bdc95f61 Gitweb: http://git.kernel.org/tip/b81975eade8c6495f3c4d6746d22bdc95f61 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:20:11 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:44 +0200 x86, irq: Clean up irqdomain transition code Now we have completely switched to irqdomain, so clean up transition code in IOAPIC drivers. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-43-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/apic/io_apic.c | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 8d80a8f..a44dce8 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -86,6 +86,7 @@ static DEFINE_RAW_SPINLOCK(ioapic_lock); static DEFINE_RAW_SPINLOCK(vector_lock); static DEFINE_MUTEX(ioapic_mutex); static unsigned int ioapic_dynirq_base; +static int ioapic_initialized; struct mp_pin_info { int trigger; @@ -1034,13 +1035,8 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, struct irq_domain *domain = mp_ioapic_irqdomain(ioapic); struct mp_pin_info *info = mp_pin_info(ioapic, pin); - if (!domain) { - /* -* Provide an identity mapping of gsi == irq except on truly -* weird platforms that have non isa irqs in the first 16 gsis. -*/ - return gsi = nr_legacy_irqs() ? gsi : gsi_top + gsi; - } + if (!domain) + return -1; mutex_lock(ioapic_mutex); @@ -2986,6 +2982,8 @@ void __init setup_IO_APIC(void) init_IO_APIC_traps(); if (nr_legacy_irqs()) check_timer(); + + ioapic_initialized = 1; } /* @@ -3461,12 +3459,11 @@ static int __init io_apic_get_redir_entries(int ioapic) unsigned int arch_dynirq_lower_bound(unsigned int from) { - unsigned int min = gsi_top + nr_legacy_irqs(); - - if (ioapic_dynirq_base) - return ioapic_dynirq_base; - - return from min ? min : from; + /* +* dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use +* gsi_top if ioapic_dynirq_base hasn't been initialized yet. +*/ + return ioapic_initialized ? ioapic_dynirq_base : gsi_top; } int __init arch_probe_nr_irqs(void) @@ -3841,10 +3838,7 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base, ioapics[idx].mp_config.flags = MPC_APIC_USABLE; ioapics[idx].mp_config.apicaddr = address; ioapics[idx].irqdomain = NULL; - if (cfg) - ioapics[idx].irqdomain_cfg = *cfg; - else - ioapics[idx].irqdomain_cfg.type = IOAPIC_DOMAIN_INVALID; + ioapics[idx].irqdomain_cfg = *cfg; set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq: Count legacy IRQs by legacy_pic- nr_legacy_irqs instead of NR_IRQS_LEGACY
Commit-ID: 95d76acc7518d566df18d67c1343bb375b78d1f3 Gitweb: http://git.kernel.org/tip/95d76acc7518d566df18d67c1343bb375b78d1f3 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:48 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:42 +0200 x86, irq: Count legacy IRQs by legacy_pic-nr_legacy_irqs instead of NR_IRQS_LEGACY Some platforms, such as Intel MID and mshypv, do not support legacy interrupt controllers. So count legacy IRQs by legacy_pic-nr_legacy_irqs instead of hard-coded NR_IRQS_LEGACY. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: xen-de...@lists.xenproject.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Rob Herring rob.herr...@calxeda.com Cc: Michal Simek mon...@monstr.eu Cc: Tony Lindgren t...@atomide.com Acked-by: David Vrabel david.vra...@citrix.com Link: http://lkml.kernel.org/r/1402302011-23642-20-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/include/asm/i8259.h | 5 + arch/x86/kernel/acpi/boot.c| 13 +++-- arch/x86/kernel/apic/io_apic.c | 43 -- arch/x86/kernel/devicetree.c | 13 +++-- arch/x86/kernel/irqinit.c | 6 +++--- arch/x86/pci/xen.c | 7 --- 6 files changed, 51 insertions(+), 36 deletions(-) diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h index a203659..ccffa53 100644 --- a/arch/x86/include/asm/i8259.h +++ b/arch/x86/include/asm/i8259.h @@ -67,4 +67,9 @@ struct legacy_pic { extern struct legacy_pic *legacy_pic; extern struct legacy_pic null_legacy_pic; +static inline int nr_legacy_irqs(void) +{ + return legacy_pic-nr_legacy_irqs; +} + #endif /* _ASM_X86_I8259_H */ diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index f3bafcd..b129765 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -43,6 +43,7 @@ #include asm/io.h #include asm/mpspec.h #include asm/smp.h +#include asm/i8259.h #include sleep.h /* To include x86_acpi_suspend_lowlevel */ static int __initdata acpi_force = 0; @@ -101,10 +102,10 @@ static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = { static unsigned int gsi_to_irq(unsigned int gsi) { - unsigned int irq = gsi + NR_IRQS_LEGACY; + unsigned int irq = gsi + nr_legacy_irqs(); unsigned int i; - for (i = 0; i NR_IRQS_LEGACY; i++) { + for (i = 0; i nr_legacy_irqs(); i++) { if (isa_irq_to_gsi[i] == gsi) { return i; } @@ -114,7 +115,7 @@ static unsigned int gsi_to_irq(unsigned int gsi) * except on truly weird platforms that have * non isa irqs in the first 16 gsis. */ - if (gsi = NR_IRQS_LEGACY) + if (gsi = nr_legacy_irqs()) irq = gsi; else irq = gsi_top + gsi; @@ -371,7 +372,7 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, * otherwise there will be more than one entry with the same GSI * and acpi_isa_irq_to_gsi() may give wrong result. */ - if (gsi NR_IRQS_LEGACY isa_irq_to_gsi[gsi] == gsi) + if (gsi nr_legacy_irqs() isa_irq_to_gsi[gsi] == gsi) isa_irq_to_gsi[gsi] = ACPI_INVALID_GSI; isa_irq_to_gsi[bus_irq] = gsi; } @@ -628,7 +629,7 @@ EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi) { - if (isa_irq NR_IRQS_LEGACY + if (isa_irq nr_legacy_irqs() isa_irq_to_gsi[isa_irq] != ACPI_INVALID_GSI) { *gsi = isa_irq_to_gsi[isa_irq]; return 0; @@ -1017,7 +1018,7 @@ static void __init mp_config_acpi_legacy_irqs(void) * Use the default configuration for the IRQs 0-15. Unless * overridden by (MADT) interrupt source override entries. */ - for (i = 0; i NR_IRQS_LEGACY; i++) { + for (i = 0; i nr_legacy_irqs(); i++) { int ioapic, pin; unsigned int dstapic; int idx; diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 424f795..4208ea9 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -129,10 +129,17 @@ u32 mp_pin_to_gsi(int ioapic, int pin) return mp_ioapic_gsi_routing(ioapic)-gsi_base + pin; } -/* Initialize all legacy IRQs and all pins on the first
[tip:x86/apic] x86, irq, ACPI: Release IOAPIC pin when PCI device is disabled
Commit-ID: 6a38fa0e3c94dfd1394a71a2d47c9c4d47367374 Gitweb: http://git.kernel.org/tip/6a38fa0e3c94dfd1394a71a2d47c9c4d47367374 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Tue, 10 Jun 2014 14:16:27 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:44 +0200 x86, irq, ACPI: Release IOAPIC pin when PCI device is disabled Release IOAPIC pin associated with PCI device when the PCI device is disabled. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Link: http://lkml.kernel.org/r/1402380987-32577-1-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/acpi/boot.c | 27 +++ drivers/acpi/pci_irq.c | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index fd4b6d2..8c28023 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -421,8 +421,24 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, return irq; } +static void mp_unregister_gsi(u32 gsi) +{ + int irq; + + if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) + return; + + if (acpi_gbl_FADT.sci_interrupt == gsi) + return; + + irq = mp_map_gsi_to_irq(gsi, 0); + if (irq 0) + mp_unmap_irq(irq); +} + static struct irq_domain_ops acpi_irqdomain_ops = { .map = mp_irqdomain_map, + .unmap = mp_irqdomain_unmap, }; static int __init @@ -640,8 +656,16 @@ static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi, return irq; } +static void acpi_unregister_gsi_ioapic(u32 gsi) +{ +#ifdef CONFIG_X86_IO_APIC + mp_unregister_gsi(gsi); +#endif +} + int (*__acpi_register_gsi)(struct device *dev, u32 gsi, int trigger, int polarity) = acpi_register_gsi_pic; +void (*__acpi_unregister_gsi)(u32 gsi) = NULL; #ifdef CONFIG_ACPI_SLEEP int (*acpi_suspend_lowlevel)(void) = x86_acpi_suspend_lowlevel; @@ -661,6 +685,8 @@ EXPORT_SYMBOL_GPL(acpi_register_gsi); void acpi_unregister_gsi(u32 gsi) { + if (__acpi_unregister_gsi) + __acpi_unregister_gsi(gsi); } EXPORT_SYMBOL_GPL(acpi_unregister_gsi); @@ -668,6 +694,7 @@ static void __init acpi_set_irq_model_ioapic(void) { acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC; __acpi_register_gsi = acpi_register_gsi_ioapic; + __acpi_unregister_gsi = acpi_unregister_gsi_ioapic; acpi_ioapic = 1; } diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 9c62340..6ba463c 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -498,5 +498,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev) */ dev_dbg(dev-dev, PCI INT %c disabled\n, pin_name(pin)); - acpi_unregister_gsi(gsi); + if (gsi = 0 dev-irq 0) + acpi_unregister_gsi(gsi); } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq: Introduce two helper functions to support irqdomain map operation
Commit-ID: 15a3c7cc9154321fc3ed1f7738bb7bbe690af91d Gitweb: http://git.kernel.org/tip/15a3c7cc9154321fc3ed1f7738bb7bbe690af91d Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:58 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:43 +0200 x86, irq: Introduce two helper functions to support irqdomain map operation Currently there are multiple entries to program IOAPIC pins, such as io_apic_setup_irq_pin_once(), io_apic_set_pci_routing() and setup_IO_APIC_irq_extra() etc. This patch introduces two functions to help consolidate the code to program IOAPIC pins. Function mp_set_pin_attr() is used to optionally set trigger, polarity and NUMA node property for an IOAPIC pin. If mp_set_pin_attr() is not invoked for a pin, the default configuration from BIOS will be used. Function mp_irqdomain_map() is an common implementation of irqdomain map() operation. It figures out attribures for pin and then actually programs the IOAPIC pin. We hope this will be the only entrance for programming IOAPIC pin. And the flow will: 1) caller such as xxx_pci_irq_enable figures out pin attributes. 2) Invoke mp_set_pin_attr() to set attributes for a pin. If the pin has already bin programmed, mp_set_pin_attr() will aslo detects attribute confictions. 3) Invoke mp_map_pin_to_irq() 3.1) If IRQ has already been assigned, return irq_find_mapping() 3.2) Else irq_create_mapping() -irq_domain_associate() -mp_irqdomain_map() -io_apic_setup_irq_pin() So every pin will only programmed once by mp_irqdomain_map(), so we could kill io_apic_setup_irq_pin_once(), io_apic_set_pci_routing() and setup_IO_APIC_irq_extra() etc. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-30-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/include/asm/io_apic.h | 5 +++ arch/x86/kernel/apic/io_apic.c | 99 +- 2 files changed, 103 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 3e4bea3..c535878 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -173,7 +173,9 @@ enum ioapic_domain_type { }; struct device_node; +struct irq_domain; struct irq_domain_ops; + struct ioapic_domain_cfg { enum ioapic_domain_type type; const struct irq_domain_ops *ops; @@ -192,6 +194,9 @@ extern u32 mp_pin_to_gsi(int ioapic, int pin); extern int mp_map_gsi_to_irq(u32 gsi, unsigned int flags); extern void __init mp_register_ioapic(int id, u32 address, u32 gsi_base, struct ioapic_domain_cfg *cfg); +extern int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq, + irq_hw_number_t hwirq); +extern int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, int node); extern void __init pre_init_apic_IRQ0(void); extern void mp_save_irq(struct mpc_intsrc *m); diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 563f450..a602b35 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -87,6 +87,14 @@ static DEFINE_RAW_SPINLOCK(vector_lock); static DEFINE_MUTEX(ioapic_mutex); static unsigned int ioapic_dynirq_base; +struct mp_pin_info { + int trigger; + int polarity; + int node; + int set; + u32 count; +}; + static struct ioapic { /* * # of IRQ routing registers @@ -102,6 +110,7 @@ static struct ioapic { struct mp_ioapic_gsi gsi_config; struct ioapic_domain_cfg irqdomain_cfg; struct irq_domain *irqdomain; + struct mp_pin_info *pin_info; DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); } ioapics[MAX_IO_APICS]; @@ -147,6 +156,11 @@ static inline int mp_init_irq_at_boot(int ioapic, int irq) return ioapic == 0 || (irq = 0 irq nr_legacy_irqs()); } +static inline struct mp_pin_info *mp_pin_info(int ioapic_idx, int pin) +{ + return ioapics[ioapic_idx].pin_info + pin; +} + static inline struct irq_domain *mp_ioapic_irqdomain(int ioapic) { return ioapics[ioapic].irqdomain; @@ -1006,6 +1020,7 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, { int irq; struct irq_domain *domain = mp_ioapic_irqdomain(ioapic); + struct
[tip:x86/apic] x86, ACPI, irq: Provide basic irqdomain support
Commit-ID: ca7e28aa4ff34fdd6622d915682b2765453c5ddd Gitweb: http://git.kernel.org/tip/ca7e28aa4ff34fdd6622d915682b2765453c5ddd Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:54 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:42 +0200 x86, ACPI, irq: Provide basic irqdomain support Enhance ACPI driver to provide basic irqdomain support for IOAPIC. We will build identity mapping for IOAPICs hosting legacy IRQs, otherwise dynamically allocate IRQ numbers for IOAPIC pins on demand. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Link: http://lkml.kernel.org/r/1402302011-23642-26-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/kernel/acpi/boot.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index f86b4ba..8d9aee1 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -31,6 +31,7 @@ #include linux/module.h #include linux/dmi.h #include linux/irq.h +#include linux/irqdomain.h #include linux/slab.h #include linux/bootmem.h #include linux/ioport.h @@ -449,10 +450,16 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, return irq; } +static struct irq_domain_ops acpi_irqdomain_ops; + static int __init acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) { struct acpi_madt_io_apic *ioapic = NULL; + struct ioapic_domain_cfg cfg = { + .type = IOAPIC_DOMAIN_DYNAMIC, + .ops = acpi_irqdomain_ops, + }; ioapic = (struct acpi_madt_io_apic *)header; @@ -461,8 +468,12 @@ acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) acpi_table_print_madt_entry(header); - mp_register_ioapic(ioapic-id, - ioapic-address, ioapic-global_irq_base, NULL); + /* Statically assign IRQ numbers for IOAPICs hosting legacy IRQs */ + if (ioapic-global_irq_base nr_legacy_irqs()) + cfg.type = IOAPIC_DOMAIN_LEGACY; + + mp_register_ioapic(ioapic-id, ioapic-address, ioapic-global_irq_base, + cfg); return 0; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:x86/apic] x86, irq: Enhance mp_register_ioapic() to support irqdomain
Commit-ID: 44767bfaaed782d6d635ecbb13f3980041e6f33e Gitweb: http://git.kernel.org/tip/44767bfaaed782d6d635ecbb13f3980041e6f33e Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:19:53 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:42 +0200 x86, irq: Enhance mp_register_ioapic() to support irqdomain Enhance function mp_register_ioapic() to support irqdomain. When registering IOAPIC, caller may provide callbacks and parameters for creating irqdomain. The IOAPIC core will create irqdomain later if caller has passed in corresponding parameters. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: sfi-de...@simplefirmware.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Cc: Len Brown len.br...@intel.com Cc: Pavel Machek pa...@ucw.cz Cc: Rob Herring rob.herr...@calxeda.com Cc: Michal Simek mon...@monstr.eu Cc: Tony Lindgren t...@atomide.com Link: http://lkml.kernel.org/r/1402302011-23642-25-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/include/asm/io_apic.h | 3 ++- arch/x86/kernel/acpi/boot.c| 2 +- arch/x86/kernel/apic/io_apic.c | 42 +- arch/x86/kernel/devicetree.c | 2 +- arch/x86/kernel/mpparse.c | 2 +- arch/x86/platform/sfi/sfi.c| 2 +- 6 files changed, 47 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 64c6e34..3e4bea3 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -190,7 +190,8 @@ extern int mp_find_ioapic(u32 gsi); extern int mp_find_ioapic_pin(int ioapic, u32 gsi); extern u32 mp_pin_to_gsi(int ioapic, int pin); extern int mp_map_gsi_to_irq(u32 gsi, unsigned int flags); -extern void __init mp_register_ioapic(int id, u32 address, u32 gsi_base); +extern void __init mp_register_ioapic(int id, u32 address, u32 gsi_base, + struct ioapic_domain_cfg *cfg); extern void __init pre_init_apic_IRQ0(void); extern void mp_save_irq(struct mpc_intsrc *m); diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index d6635ba..f86b4ba 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -462,7 +462,7 @@ acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) acpi_table_print_madt_entry(header); mp_register_ioapic(ioapic-id, - ioapic-address, ioapic-global_irq_base); + ioapic-address, ioapic-global_irq_base, NULL); return 0; } diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 51ce80004..563f450 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -85,6 +85,7 @@ int sis_apic_bug = -1; static DEFINE_RAW_SPINLOCK(ioapic_lock); static DEFINE_RAW_SPINLOCK(vector_lock); static DEFINE_MUTEX(ioapic_mutex); +static unsigned int ioapic_dynirq_base; static struct ioapic { /* @@ -2920,8 +2921,35 @@ out: */ #define PIC_IRQS (1UL PIC_CASCADE_IR) +static int mp_irqdomain_create(int ioapic) +{ + int hwirqs = mp_ioapic_pin_count(ioapic); + struct ioapic *ip = ioapics[ioapic]; + struct ioapic_domain_cfg *cfg = ip-irqdomain_cfg; + struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic); + + if (cfg-type == IOAPIC_DOMAIN_INVALID) + return 0; + + ip-irqdomain = irq_domain_add_linear(cfg-dev, hwirqs, cfg-ops, + (void *)(long)ioapic); + if(!ip-irqdomain) + return -ENOMEM; + + if (cfg-type == IOAPIC_DOMAIN_LEGACY || + cfg-type == IOAPIC_DOMAIN_STRICT) + ioapic_dynirq_base = max(ioapic_dynirq_base, +gsi_cfg-gsi_end + 1); + + if (gsi_cfg-gsi_base == 0) + irq_set_default_host(ip-irqdomain); + + return 0; +} + void __init setup_IO_APIC(void) { + int ioapic; /* * calling enable_IO_APIC() is moved to setup_local_APIC for BP @@ -2929,6 +2957,9 @@ void __init setup_IO_APIC(void) io_apic_irqs = nr_legacy_irqs() ? ~PIC_IRQS : ~0UL; apic_printk(APIC_VERBOSE, ENABLING IO-APIC IRQs\n); + for_each_ioapic(ioapic) + BUG_ON(mp_irqdomain_create(ioapic)); + /* * Set up IO-APIC IRQ routing. */ @@ -3437,6 +3468,9 @@ unsigned int arch_dynirq_lower_bound(unsigned int from) {
[tip:x86/apic] x86, irq: Introduce helper functions to release IOAPIC pin
Commit-ID: df334bead7e94772c41745af9f329383067d44ae Gitweb: http://git.kernel.org/tip/df334bead7e94772c41745af9f329383067d44ae Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:20:06 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:44 +0200 x86, irq: Introduce helper functions to release IOAPIC pin Introduce function mp_unmap_irq() to release IOAPIC IRQ when IRQ is not used any more, which will typically called by pcibios_disabled_irq. And function mp_irqdomain_unmap() is a common implementation of irq_domain_ops.unmap for IOAPIC. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-38-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/include/asm/io_apic.h | 3 +++ arch/x86/kernel/apic/io_apic.c | 61 ++ 2 files changed, 64 insertions(+) diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index af6f9d4..0aeed5c 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -187,10 +187,12 @@ extern int mp_find_ioapic(u32 gsi); extern int mp_find_ioapic_pin(int ioapic, u32 gsi); extern u32 mp_pin_to_gsi(int ioapic, int pin); extern int mp_map_gsi_to_irq(u32 gsi, unsigned int flags); +extern void mp_unmap_irq(int irq); extern void __init mp_register_ioapic(int id, u32 address, u32 gsi_base, struct ioapic_domain_cfg *cfg); extern int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq, irq_hw_number_t hwirq); +extern void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq); extern int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, int node); extern void __init pre_init_apic_IRQ0(void); @@ -234,6 +236,7 @@ static inline void ioapic_insert_resources(void) { } static inline int mp_find_ioapic(u32 gsi) { return 0; } static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; } +static inline void mp_unmap_irq(int irq) { } static inline int save_ioapic_entries(void) { diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 8485d90..8d80a8f 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -467,6 +467,21 @@ static int __add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pi return 0; } +static void __remove_pin_from_irq(struct irq_cfg *cfg, int apic, int pin) +{ + struct irq_pin_list **last, *entry; + + last = cfg-irq_2_pin; + for_each_irq_pin(entry, cfg-irq_2_pin) + if (entry-apic == apic entry-pin == pin) { + *last = entry-next; + kfree(entry); + return; + } else { + last = entry-next; + } +} + static void add_pin_to_irq_node(struct irq_cfg *cfg, int node, int apic, int pin) { if (__add_pin_to_irq_node(cfg, node, apic, pin)) @@ -1119,6 +1134,31 @@ int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags); } +void mp_unmap_irq(int irq) +{ + struct irq_data *data = irq_get_irq_data(irq); + struct mp_pin_info *info; + int ioapic, pin; + + if (!data || !data-domain) + return; + + ioapic = (int)(long)data-domain-host_data; + pin = (int)data-hwirq; + info = mp_pin_info(ioapic, pin); + + mutex_lock(ioapic_mutex); + if (--info-count == 0) { + info-set = 0; + if (irq nr_legacy_irqs() + ioapics[ioapic].irqdomain_cfg.type == IOAPIC_DOMAIN_LEGACY) + mp_irqdomain_unmap(data-domain, irq); + else + irq_dispose_mapping(irq); + } + mutex_unlock(ioapic_mutex); +} + /* * Find a specific PCI IRQ entry. * Not an __init, possibly needed by modules @@ -3878,6 +3918,27 @@ int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq, return io_apic_setup_irq_pin(virq, info-node, attr); } +void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq) +{ + struct irq_data *data = irq_get_irq_data(virq); + struct irq_cfg *cfg = irq_cfg(virq); + int ioapic = (int)(long)domain-host_data; + int
[tip:x86/apic] x86, irq, SFI: Release IOAPIC pin when PCI device is disabled
Commit-ID: 8a3e533df17f821a4d25dd2969d2f90d7c168b46 Gitweb: http://git.kernel.org/tip/8a3e533df17f821a4d25dd2969d2f90d7c168b46 Author: Jiang Liu jiang@linux.intel.com AuthorDate: Mon, 9 Jun 2014 16:20:09 +0800 Committer: Thomas Gleixner t...@linutronix.de CommitDate: Sat, 21 Jun 2014 23:05:44 +0200 x86, irq, SFI: Release IOAPIC pin when PCI device is disabled Release IOAPIC pin associated with PCI device when the PCI device is disabled. Signed-off-by: Jiang Liu jiang@linux.intel.com Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Tony Luck tony.l...@intel.com Cc: Joerg Roedel j...@8bytes.org Cc: Paul Gortmaker paul.gortma...@windriver.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Grant Likely grant.lik...@linaro.org Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Bjorn Helgaas bhelg...@google.com Cc: Randy Dunlap rdun...@infradead.org Cc: Yinghai Lu ying...@kernel.org Link: http://lkml.kernel.org/r/1402302011-23642-41-git-send-email-jiang@linux.intel.com Signed-off-by: Thomas Gleixner t...@linutronix.de --- arch/x86/pci/intel_mid_pci.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/pci/intel_mid_pci.c b/arch/x86/pci/intel_mid_pci.c index 337d165..09fece3 100644 --- a/arch/x86/pci/intel_mid_pci.c +++ b/arch/x86/pci/intel_mid_pci.c @@ -227,6 +227,12 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev) return 0; } +static void intel_mid_pci_irq_disable(struct pci_dev *dev) +{ + if (dev-irq 0) + mp_unmap_irq(dev-irq); +} + struct pci_ops intel_mid_pci_ops = { .read = pci_read, .write = pci_write, @@ -243,6 +249,7 @@ int __init intel_mid_pci_init(void) pr_info(Intel MID platform detected, using MID PCI ops\n); pci_mmcfg_late_init(); pcibios_enable_irq = intel_mid_pci_irq_enable; + pcibios_disable_irq = intel_mid_pci_irq_disable; pci_root_ops = intel_mid_pci_ops; pci_soc_mode = 1; /* Continue with standard init */ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [arch/mips] rb532: replace mac_addr parsing
Replace parse_mac_addr with sscanf. Signed-off-by: Daniel Walter dwal...@google.com --- Patch applies against current linux-tree --- arch/mips/rb532/devices.c | 30 +++--- 1 file changed, 7 insertions(+), 23 deletions(-) --- diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c index 3af00b2..6e32819b 100644 --- a/arch/mips/rb532/devices.c +++ b/arch/mips/rb532/devices.c @@ -250,28 +250,6 @@ static struct platform_device *rb532_devs[] = { rb532_wdt }; -static void __init parse_mac_addr(char *macstr) -{ - int i, h, l; - - for (i = 0; i 6; i++) { - if (i != 5 *(macstr + 2) != ':') - return; - - h = hex_to_bin(*macstr++); - if (h == -1) - return; - - l = hex_to_bin(*macstr++); - if (l == -1) - return; - - macstr++; - korina_dev0_data.mac[i] = (h 4) + l; - } -} - - /* NAND definitions */ #define NAND_CHIP_DELAY 25 @@ -333,7 +311,13 @@ static int __init plat_setup_devices(void) static int __init setup_kmac(char *s) { printk(KERN_INFO korina mac = %s\n, s); - parse_mac_addr(s); + sscanf(macstr, %hhx:%hhx:%hhx:%hhx:%hhx:%hhx, + korina_dev0_data.mac[0], + korina_dev0_data.mac[1], + korina_dev0_data.mac[2], + korina_dev0_data.mac[3], + korina_dev0_data.mac[4], + korina_dev0_data.mac[5]); return 0; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] video: fbdev: skeletonfb.c: Adding code to managing allocation error
Hi Sounds like a good idea to have better error handling although it is an example, even more important there. At the first return nothing has been allocated, so it's ok I guess. At the second I reflect about adding some deallocation, there are comments on some form of goto error part which would appropriately handle a deallocation. But all the other places in the code is just do a return, that was why I chose to do it at the second return to. Kind regards Rickard Strandqvist 2014-06-21 22:48 GMT+02:00 Geert Uytterhoeven ge...@linux-m68k.org: On Sat, Jun 21, 2014 at 3:58 PM, Joe Perches j...@perches.com wrote: (Adding Geert, who probably wrote most of this and likely might have forgotten all of it) On Sat, 2014-06-21 at 15:17 +0200, Rickard Strandqvist wrote: Adding missing code for managing a memory allocation error that may occur. This was partly found using a static code analysis program called cppcheck. skeletonfb.c is not meant to be compiled. It's a sample driver template. Yep. Those /* goto error path */ lines are for driver writers that use this to figure out what to do. Still, it's nice if a sample driver has correct error handling. Just comments are not good enough as guidance for some people ;-) The second return is not correct as it would not free the first alloc'd block. Indeed. Better do it right. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] net: wireless: rtlwifi: rtl8192cu: hw.c: Cleaning up if statement that always evaluates to false
On Saturday 21 June 2014 23:00:37 Rickard Strandqvist wrote: I found a logical error in an if statement that always evaluates to false. This has after same discussion resulted in that we add a macro to handle this. The subject is still wrong (it is not a cleanup, but a fix) and the commit message could also be improved (no need to mention the discussion, just say why it was necessary and what you did to fix it). Suggested text: rtlwifi/rtl8192c[eu]: fix media status register mask bt_msr 0xfc will never match 0x3. Fix this by using a mask that actually matches the available types. With that, you can add my Reviewed-by: Peter Wu pe...@lekensteyn.nl (oh, and please mail me at @lekensteyn.nl for patches) Also, when using a cover letter, you are supposed to group your changes. Not add a single commit to each cover letter. If you made three sequential changes for example, then you can generate your patches with: mkdir /tmp/patches git format-patch --cover-letter -o /tmp/patches/ HEAD~3 Then review the files in /tmp/patches/ and if you are satisfied: git send-email --to linux-wireless@... --cc ... /tmp/patches/* Kind regards, Peter Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/wireless/rtlwifi/rtl8192ce/hw.c |2 +- drivers/net/wireless/rtlwifi/rtl8192ce/reg.h |1 + drivers/net/wireless/rtlwifi/rtl8192cu/hw.c |2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c index 55adf04..5050938 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c @@ -1206,7 +1206,7 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw, rtl_write_byte(rtlpriv, (MSR), bt_msr); rtlpriv-cfg-ops-led_control(hw, ledaction); - if ((bt_msr 0xfc) == MSR_AP) + if ((bt_msr MSR_MASK) == MSR_AP) rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); else rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h index ed703a1..dc8460c 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h @@ -375,6 +375,7 @@ #define MSR_ADHOC 0x01 #define MSR_INFRA 0x02 #define MSR_AP 0x03 +#define MSR_MASK0x03 #define RRSR_RSC_OFFSET 21 #define RRSR_SHORT_OFFSET 23 diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index 07cb06d..87c0a27 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c @@ -1360,7 +1360,7 @@ static int _rtl92cu_set_media_status(struct ieee80211_hw *hw, } rtl_write_byte(rtlpriv, (MSR), bt_msr); rtlpriv-cfg-ops-led_control(hw, ledaction); - if ((bt_msr 0xfc) == MSR_AP) + if ((bt_msr MSR_MASK) == MSR_AP) rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); else rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] net: wireless: rtlwifi: rtl8192de: hw.c: Cleaning up if statement that always evaluates to false
On Saturday 21 June 2014 23:03:42 Rickard Strandqvist wrote: I found a logical error in an if statement that always evaluates to false. This has after same discussion resulted in that we add a macro to handle this. See other mail, this subject and commit message still suck. The change itself is fine. Don't forget those other drivers. You are aware that the *e drivers are for PCI(e) devices, and *u for USB right? Kind regards, Peter Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/net/wireless/rtlwifi/rtl8192de/hw.c |2 +- drivers/net/wireless/rtlwifi/rtl8192de/reg.h |1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c index 2b08671..280c3da 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c @@ -1128,7 +1128,7 @@ static int _rtl92de_set_media_status(struct ieee80211_hw *hw, } rtl_write_byte(rtlpriv, REG_CR + 2, bt_msr); rtlpriv-cfg-ops-led_control(hw, ledaction); - if ((bt_msr 0xfc) == MSR_AP) + if ((bt_msr MSR_MASK) == MSR_AP) rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); else rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/reg.h b/drivers/net/wireless/rtlwifi/rtl8192de/reg.h index 7f29b8d..315a298 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/reg.h +++ b/drivers/net/wireless/rtlwifi/rtl8192de/reg.h @@ -369,6 +369,7 @@ #define MSR_ADHOC 0x01 #define MSR_INFRA 0x02 #define MSR_AP 0x03 +#define MSR_MASK0x03 /* 6. Adaptive Control Registers (Offset: 0x0160 - 0x01CF) */ /* - */ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] ARM: add CLKSRC_OF dependency for PXA
Select CLKSRC_OF for PXA architectures, as the clocksource driver can be also initialized from device-tree. Signed-off-by: Robert Jarzmik robert.jarz...@free.fr Cc: Russell King li...@arm.linux.org.uk --- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index db3c541..c300b68 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -646,6 +646,7 @@ config ARCH_PXA select AUTO_ZRELADDR select CLKDEV_LOOKUP select CLKSRC_MMIO + select CLKSRC_OF if OF select GENERIC_CLOCKEVENTS select GPIO_PXA select HAVE_IDE -- 2.0.0.rc2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] clocksource: move PXA timer to clocksource framework
Move time.c from arch/arm/mach-pxa/time.c to drivers/clocksource/pxa_timer.c. Signed-off-by: Robert Jarzmik robert.jarz...@free.fr --- arch/arm/mach-pxa/Makefile | 2 +- drivers/clocksource/Makefile| 1 + arch/arm/mach-pxa/time.c = drivers/clocksource/pxa_timer.c | 0 3 files changed, 2 insertions(+), 1 deletion(-) rename arch/arm/mach-pxa/time.c = drivers/clocksource/pxa_timer.c (100%) diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 648867a..2fe1824 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile @@ -4,7 +4,7 @@ # Common support (must be linked before board specific support) obj-y += clock.o devices.o generic.o irq.o \ - time.o reset.o + reset.o obj-$(CONFIG_PM) += pm.o sleep.o standby.o # Generic drivers that other drivers may depend upon diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index 98cb6c5..e224125 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_ARCH_BCM2835)+= bcm2835_timer.o obj-$(CONFIG_ARCH_MARCO) += timer-marco.o obj-$(CONFIG_ARCH_MOXART) += moxart_timer.o obj-$(CONFIG_ARCH_MXS) += mxs_timer.o +obj-$(CONFIG_ARCH_PXA) += pxa_timer.o obj-$(CONFIG_ARCH_PRIMA2) += timer-prima2.o obj-$(CONFIG_ARCH_U300)+= timer-u300.o obj-$(CONFIG_SUN4I_TIMER) += sun4i_timer.o diff --git a/arch/arm/mach-pxa/time.c b/drivers/clocksource/pxa_timer.c similarity index 100% rename from arch/arm/mach-pxa/time.c rename to drivers/clocksource/pxa_timer.c -- 2.0.0.rc2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] clocksource: add device-tree support for PXA timer
Add device-tree support to PXA platforms. Signed-off-by: Robert Jarzmik robert.jarz...@free.fr --- drivers/clocksource/pxa_timer.c | 131 ++-- 1 file changed, 98 insertions(+), 33 deletions(-) diff --git a/drivers/clocksource/pxa_timer.c b/drivers/clocksource/pxa_timer.c index fca174e..67da3f5 100644 --- a/drivers/clocksource/pxa_timer.c +++ b/drivers/clocksource/pxa_timer.c @@ -15,14 +15,41 @@ #include linux/kernel.h #include linux/init.h #include linux/interrupt.h +#include linux/clk.h #include linux/clockchips.h +#include linux/of_address.h +#include linux/of_irq.h #include linux/sched_clock.h #include asm/div64.h #include asm/mach/irq.h #include asm/mach/time.h -#include mach/regs-ost.h #include mach/irqs.h +#include mach/hardware.h + +#define OSMR0 0x00/* */ +#define OSMR1 0x04/* */ +#define OSMR2 0x08/* */ +#define OSMR3 0x0C/* */ +#define OSMR4 0x80/* */ +#define OSCR 0x10/* OS Timer Counter Register */ +#define OSCR4 0x40/* OS Timer Counter Register */ +#define OMCR4 0xC0/* */ +#define OSSR 0x14/* OS Timer Status Register */ +#define OWER 0x18/* OS Timer Watchdog Enable Register */ +#define OIER 0x1C/* OS Timer Interrupt Enable Register */ + +#define OSSR_M3(1 3)/* Match status channel 3 */ +#define OSSR_M2(1 2)/* Match status channel 2 */ +#define OSSR_M1(1 1)/* Match status channel 1 */ +#define OSSR_M0(1 0)/* Match status channel 0 */ + +#define OWER_WME (1 0)/* Watchdog Match Enable */ + +#define OIER_E3(1 3)/* Interrupt enable channel 3 */ +#define OIER_E2(1 2)/* Interrupt enable channel 2 */ +#define OIER_E1(1 1)/* Interrupt enable channel 1 */ +#define OIER_E0(1 0)/* Interrupt enable channel 0 */ /* * This is PXA's sched_clock implementation. This has a resolution @@ -33,9 +60,14 @@ * calls to sched_clock() which should always be the case in practice. */ +#define timer_readl(reg) readl_relaxed(timer_base + (reg)) +#define timer_writel(val, reg) writel_relaxed((val), timer_base + (reg)) + +static void __iomem *timer_base; + static u64 notrace pxa_read_sched_clock(void) { - return readl_relaxed(OSCR); + return timer_readl(OSCR); } @@ -47,8 +79,8 @@ pxa_ost0_interrupt(int irq, void *dev_id) struct clock_event_device *c = dev_id; /* Disarm the compare/match, signal the event. */ - writel_relaxed(readl_relaxed(OIER) ~OIER_E0, OIER); - writel_relaxed(OSSR_M0, OSSR); + timer_writel(timer_readl(OIER) ~OIER_E0, OIER); + timer_writel(OSSR_M0, OSSR); c-event_handler(c); return IRQ_HANDLED; @@ -59,10 +91,10 @@ pxa_osmr0_set_next_event(unsigned long delta, struct clock_event_device *dev) { unsigned long next, oscr; - writel_relaxed(readl_relaxed(OIER) | OIER_E0, OIER); - next = readl_relaxed(OSCR) + delta; - writel_relaxed(next, OSMR0); - oscr = readl_relaxed(OSCR); + timer_writel(timer_readl(OIER) | OIER_E0, OIER); + next = timer_readl(OSCR) + delta; + timer_writel(next, OSMR0); + oscr = timer_readl(OSCR); return (signed)(next - oscr) = MIN_OSCR_DELTA ? -ETIME : 0; } @@ -72,15 +104,15 @@ pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev) { switch (mode) { case CLOCK_EVT_MODE_ONESHOT: - writel_relaxed(readl_relaxed(OIER) ~OIER_E0, OIER); - writel_relaxed(OSSR_M0, OSSR); + timer_writel(timer_readl(OIER) ~OIER_E0, OIER); + timer_writel(OSSR_M0, OSSR); break; case CLOCK_EVT_MODE_UNUSED: case CLOCK_EVT_MODE_SHUTDOWN: /* initializing, released, or preparing for suspend */ - writel_relaxed(readl_relaxed(OIER) ~OIER_E0, OIER); - writel_relaxed(OSSR_M0, OSSR); + timer_writel(timer_readl(OIER) ~OIER_E0, OIER); + timer_writel(OSSR_M0, OSSR); break; case CLOCK_EVT_MODE_RESUME: @@ -94,12 +126,12 @@ static unsigned long osmr[4], oier, oscr; static void pxa_timer_suspend(struct clock_event_device *cedev) { - osmr[0] = readl_relaxed(OSMR0); - osmr[1] = readl_relaxed(OSMR1); - osmr[2] = readl_relaxed(OSMR2); - osmr[3] = readl_relaxed(OSMR3); - oier = readl_relaxed(OIER); - oscr = readl_relaxed(OSCR); + osmr[0] = timer_readl(OSMR0); + osmr[1] = timer_readl(OSMR1); + osmr[2] = timer_readl(OSMR2); + osmr[3] = timer_readl(OSMR3); + oier = timer_readl(OIER); + oscr = timer_readl(OSCR); } static void pxa_timer_resume(struct clock_event_device
RE: [PATCH 10/14] scsi: only maintain target_blocked if the driver has a target queue limit
-Original Message- From: Christoph Hellwig [mailto:h...@lst.de] Sent: Thursday, 12 June, 2014 8:49 AM To: James Bottomley Cc: Jens Axboe; Bart Van Assche; Elliott, Robert (Server Storage); linux- s...@vger.kernel.org; linux-kernel@vger.kernel.org Subject: [PATCH 10/14] scsi: only maintain target_blocked if the driver has a target queue limit This saves us an atomic operation for each I/O submission and completion for the usual case where the driver doesn't set a per-target can_queue value. Only a few iscsi hardware offload drivers set the per-target can_queue value at the moment. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_lib.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 0e33dee..763b3c9 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c ... @@ -1642,7 +1648,8 @@ static void scsi_request_fn(struct request_queue *q) return; host_not_ready: - atomic_dec(scsi_target(sdev)-target_busy); + if (scsi_target(sdev)-can_queue 0) + atomic_dec(scsi_target(sdev)-target_busy); not_ready: /* * lock q, handle tag, requeue req, and decrement device_busy. We There's an extra in that if statement. --- Rob ElliottHP Server Storage -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 0/5] staging: comedi: addi_apci_1564: fix Change-of-State interrupt functionality
This patchset introduces a new private data struct for this driver, adds all of the code required to support Change-of-State interrupts for the digital input subdevice, and finally fixes apci1564_interrupt() to service this type of interrupt correctly. CHANGES FROM v1: *leave the send_sig() calls in for now, until the proper replacement can be implemented. *removed unused static globals, removed the remaining one into the private data struct. *private data struct moved into addi_apci_1564.c. *patches 4/6 and 5/6 from v1 have been merged into patch 4/5 here. *(*cancel) for the interrupt subdevice has been reduced to just disable DI interrupts rather than using the board's reset function. *support for all interrupts issued by the board has been kept in apci1564_interrupt(), rather than stripping everything out except for DI interrupt support. However, DI interrupt support has still been fixed. CHANGES FROM v2: *Just refreshed set against staging-next. Otherwise everything is exactly the same, and should apply now. Chase Southwood (5): staging: comedi: addi_apci_1564: remove use of devpriv-b_OutputMemoryStatus staging: comedi: addi_apci_1564: remove unused static variables staging: comedi: addi_apci_1564: introduce apci1564_private struct staging: comedi: addi_apci_1564: add Change-of-State interrupt subdevice and required functions staging: comedi: addi_apci_1564: move apci1564_interrupt() into addi_apci_1564.c .../comedi/drivers/addi-data/hwdrv_apci1564.c | 304 +++ drivers/staging/comedi/drivers/addi_apci_1564.c| 433 +++-- 2 files changed, 454 insertions(+), 283 deletions(-) -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 1/5] staging: comedi: addi_apci_1564: remove use of devpriv-b_OutputMemoryStatus
This member of the private data struct is only set at one location in the entire driver, and then never even used for anything. Let's just remove its use. Signed-off-by: Chase Southwood chase.southw...@gmail.com Cc: Ian Abbott abbo...@mev.co.uk Cc: H Hartley Sweeeten hswee...@visionengravers.com --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 0ba5385..19de400 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -149,11 +149,6 @@ static int apci1564_do_config(struct comedi_device *dev, return -EINVAL; } - if (data[0]) - devpriv-b_OutputMemoryStatus = 1; - else - devpriv-b_OutputMemoryStatus = 0; - if (data[1] == 1) ul_Command = ul_Command | 0x1; else -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 2/5] staging: comedi: addi_apci_1564: remove unused static variables
The global variables ui_InterruptStatus_1564 and ui_InterruptData are both set but never used. Just remove them from the driver. Signed-off-by: Chase Southwood chase.southw...@gmail.com Cc: Ian Abbott abbo...@mev.co.uk Cc: H Hartley Sweeten hswee...@visionengravers.com --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 19de400..95038f2 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -90,8 +90,7 @@ #define APCI1564_TCW_WARN_TIMEBASE_REG(x) (0x1c + ((x) * 0x20)) /* Global variables */ -static unsigned int ui_InterruptStatus_1564; -static unsigned int ui_InterruptData, ui_Type; +static unsigned int ui_Type; /* * Configures the digital input Subdevice @@ -160,7 +159,6 @@ static int apci1564_do_config(struct comedi_device *dev, ul_Command = ul_Command 0xFFFD; outl(ul_Command, devpriv-i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG); - ui_InterruptData = inl(devpriv-i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG); devpriv-tsk_Current = current; return insn-n; } @@ -428,9 +426,6 @@ static void apci1564_interrupt(int irq, void *d) if (ui_DI == 1) { ui_DI = inl(devpriv-i_IobaseAmcc + APCI1564_DI_IRQ_REG); outl(0x0, devpriv-i_IobaseAmcc + APCI1564_DI_IRQ_REG); - ui_InterruptStatus_1564 = - inl(devpriv-i_IobaseAmcc + APCI1564_DI_INT_STATUS_REG); - ui_InterruptStatus_1564 = ui_InterruptStatus_1564 0X0000; /* send signal to the sample */ send_sig(SIGIO, devpriv-tsk_Current, 0); /* enable the interrupt */ -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 3/5] staging: comedi: addi_apci_1564: introduce apci1564_private struct
The addi_private struct defined in addi-data/addi_common.h is very bloated and contains many fields which addi_apci_1564 does not require. In the interest of eventually removing this driver's dependency on addi_common.h, we can create a private data struct specifically for addi_apci_1564 containing only the fields it will actually use. Signed-off-by: Chase Southwood chase.southw...@gmail.com Cc: Ian Abbott abbo...@mev.co.uk Cc: H Hartley Sweeten hswee...@visionengravers.com --- .../comedi/drivers/addi-data/hwdrv_apci1564.c | 182 ++--- drivers/staging/comedi/drivers/addi_apci_1564.c| 46 +++--- 2 files changed, 118 insertions(+), 110 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 95038f2..732f43c 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -49,7 +49,7 @@ #define APCI1564_COUNTER4 3 /* - * devpriv-i_IobaseAmcc Register Map + * devpriv-amcc_iobase Register Map */ #define APCI1564_DI_REG0x04 #define APCI1564_DI_INT_MODE1_REG 0x08 @@ -89,9 +89,6 @@ #define APCI1564_TCW_WARN_TIMEVAL_REG(x) (0x18 + ((x) * 0x20)) #define APCI1564_TCW_WARN_TIMEBASE_REG(x) (0x1c + ((x) * 0x20)) -/* Global variables */ -static unsigned int ui_Type; - /* * Configures the digital input Subdevice * @@ -105,24 +102,24 @@ static int apci1564_di_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev-private; + struct apci1564_private *devpriv = dev-private; - devpriv-tsk_Current = current; + devpriv-tsk_current = current; /* Set the digital input logic */ if (data[0] == 1) { data[2] = data[2] 4; data[3] = data[3] 4; - outl(data[2], devpriv-i_IobaseAmcc + APCI1564_DI_INT_MODE1_REG); - outl(data[3], devpriv-i_IobaseAmcc + APCI1564_DI_INT_MODE2_REG); + outl(data[2], devpriv-amcc_iobase + APCI1564_DI_INT_MODE1_REG); + outl(data[3], devpriv-amcc_iobase + APCI1564_DI_INT_MODE2_REG); if (data[1] == ADDIDATA_OR) - outl(0x4, devpriv-i_IobaseAmcc + APCI1564_DI_IRQ_REG); + outl(0x4, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG); else - outl(0x6, devpriv-i_IobaseAmcc + APCI1564_DI_IRQ_REG); + outl(0x6, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG); } else { - outl(0x0, devpriv-i_IobaseAmcc + APCI1564_DI_INT_MODE1_REG); - outl(0x0, devpriv-i_IobaseAmcc + APCI1564_DI_INT_MODE2_REG); - outl(0x0, devpriv-i_IobaseAmcc + APCI1564_DI_IRQ_REG); + outl(0x0, devpriv-amcc_iobase + APCI1564_DI_INT_MODE1_REG); + outl(0x0, devpriv-amcc_iobase + APCI1564_DI_INT_MODE2_REG); + outl(0x0, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG); } return insn-n; @@ -139,7 +136,7 @@ static int apci1564_do_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev-private; + struct apci1564_private *devpriv = dev-private; unsigned int ul_Command = 0; if ((data[0] != 0) (data[0] != 1)) { @@ -158,8 +155,8 @@ static int apci1564_do_config(struct comedi_device *dev, else ul_Command = ul_Command 0xFFFD; - outl(ul_Command, devpriv-i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG); - devpriv-tsk_Current = current; + outl(ul_Command, devpriv-amcc_iobase + APCI1564_DO_INT_CTRL_REG); + devpriv-tsk_current = current; return insn-n; } @@ -179,31 +176,31 @@ static int apci1564_timer_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev-private; + struct apci1564_private *devpriv = dev-private; unsigned int ul_Command1 = 0; - devpriv-tsk_Current = current; + devpriv-tsk_current = current; if (data[0] == ADDIDATA_WATCHDOG) { - devpriv-b_TimerSelectMode = ADDIDATA_WATCHDOG; + devpriv-timer_select_mode = ADDIDATA_WATCHDOG; /* Disable the watchdog */ - outl(0x0, devpriv-i_IobaseAmcc + APCI1564_WDOG_CTRL_REG); + outl(0x0, devpriv-amcc_iobase + APCI1564_WDOG_CTRL_REG); /* Loading the Reload value */ - outl(data[3], devpriv-i_IobaseAmcc + APCI1564_WDOG_RELOAD_REG); + outl(data[3],
[PATCH v3 4/5] staging: comedi: addi_apci_1564: add Change-of-State interrupt subdevice and required functions
This board supports an interrupt that can be generated by an AND/OR combination of 16 of the input channels. Create a separate subdevice to handle this interrupt. The apci1564_di_config() function is used to configure which inputs are used to generate the interrupt. Currently this function is broken since it does not follow the comedi API for insn_config functions. Fix this function by implementing the config instruction INSN_CONFIG_DIGITAL_TRIG. Add the remaining subdevice operations necessary for the interrupt subdevice to support async commands. Signed-off-by: Chase Southwood chase.southw...@gmail.com Cc: Ian Abbott abbo...@mev.co.uk Cc: H Hartley Sweeten hswee...@visionengravers.com --- .../comedi/drivers/addi-data/hwdrv_apci1564.c | 44 +--- drivers/staging/comedi/drivers/addi_apci_1564.c| 250 +++-- 2 files changed, 232 insertions(+), 62 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 732f43c..697ee76 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -26,12 +26,12 @@ #define APCI1564_ADDRESS_RANGE 128 /* Digital Input IRQ Function Selection */ -#define ADDIDATA_OR0 -#define ADDIDATA_AND 1 +#define APCI1564_DI_INT_OR (0 1) +#define APCI1564_DI_INT_AND(1 1) /* Digital Input Interrupt Enable Disable. */ -#define APCI1564_DIGITAL_IP_INTERRUPT_ENABLE 0x4 -#define APCI1564_DIGITAL_IP_INTERRUPT_DISABLE 0xfffb +#define APCI1564_DI_INT_ENABLE 0x4 +#define APCI1564_DI_INT_DISABLE0xfffb /* Digital Output Interrupt Enable Disable. */ #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_ENABLE 0x1 @@ -90,42 +90,6 @@ #define APCI1564_TCW_WARN_TIMEBASE_REG(x) (0x1c + ((x) * 0x20)) /* - * Configures the digital input Subdevice - * - * data[0] 1 = Enable interrupt, 0 = Disable interrupt - * data[1] 0 = ADDIDATA Interrupt OR LOGIC, 1 = ADDIDATA Interrupt AND LOGIC - * data[2] Interrupt mask for the mode 1 - * data[3] Interrupt mask for the mode 2 - */ -static int apci1564_di_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - struct apci1564_private *devpriv = dev-private; - - devpriv-tsk_current = current; - - /* Set the digital input logic */ - if (data[0] == 1) { - data[2] = data[2] 4; - data[3] = data[3] 4; - outl(data[2], devpriv-amcc_iobase + APCI1564_DI_INT_MODE1_REG); - outl(data[3], devpriv-amcc_iobase + APCI1564_DI_INT_MODE2_REG); - if (data[1] == ADDIDATA_OR) - outl(0x4, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG); - else - outl(0x6, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG); - } else { - outl(0x0, devpriv-amcc_iobase + APCI1564_DI_INT_MODE1_REG); - outl(0x0, devpriv-amcc_iobase + APCI1564_DI_INT_MODE2_REG); - outl(0x0, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG); - } - - return insn-n; -} - -/* * Configures The Digital Output Subdevice. * * data[1] 0 = Disable VCC Interrupt, 1 = Enable VCC Interrupt diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index 1971da3..fec478c 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -8,6 +8,9 @@ struct apci1564_private { unsigned int amcc_iobase; /* base of AMCC I/O registers */ + unsigned int mode1; /* riding-edge/high level channels */ + unsigned int mode2; /* falling-edge/low level channels */ + unsigned int ctrl; /* interrupt mode OR (edge) . AND (level) */ unsigned int do_int_type; unsigned char timer_select_mode; unsigned char mode_select_register; @@ -16,6 +19,38 @@ struct apci1564_private { #include addi-data/hwdrv_apci1564.c +static int apci1564_reset(struct comedi_device *dev) +{ + struct apci1564_private *devpriv = dev-private; + + devpriv-do_int_type = 0; + + /* Disable the input interrupts and reset status register */ + outl(0x0, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG); + inl(devpriv-amcc_iobase + APCI1564_DI_INT_STATUS_REG); + outl(0x0, devpriv-amcc_iobase + APCI1564_DI_INT_MODE1_REG); + outl(0x0, devpriv-amcc_iobase + APCI1564_DI_INT_MODE2_REG); + + /* Reset the output channels and disable interrupts */ + outl(0x0, devpriv-amcc_iobase
[PATCH v3 5/5] staging: comedi: addi_apci_1564: move apci1564_interrupt() into addi_apci_1564.c
On moving the function into the driver proper, also check the device is asserting the shared interrupt line. This patch also fixes the interrupt handling for the digital input change-of-state interrupts. Signed-off-by: Chase Southwood chase.southw...@gmail.com Cc: Ian Abbott abbo...@mev.co.uk Cc: H Hartley Sweeten hswee...@visionengravers.com --- .../comedi/drivers/addi-data/hwdrv_apci1564.c | 146 --- drivers/staging/comedi/drivers/addi_apci_1564.c| 157 - 2 files changed, 153 insertions(+), 150 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 697ee76..ef419b4 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -357,149 +357,3 @@ static int apci1564_do_read(struct comedi_device *dev, *data = devpriv-do_int_type; return insn-n; } - -/* - * Interrupt handler for the interruptible digital inputs - */ -static void apci1564_interrupt(int irq, void *d) -{ - struct comedi_device *dev = d; - struct apci1564_private *devpriv = dev-private; - unsigned int ui_DO, ui_DI; - unsigned int ui_Timer; - unsigned int ui_C1, ui_C2, ui_C3, ui_C4; - unsigned int ul_Command2 = 0; - - ui_DI = inl(devpriv-amcc_iobase + APCI1564_DI_IRQ_REG) 0x01; - ui_DO = inl(devpriv-amcc_iobase + APCI1564_DO_IRQ_REG) 0x01; - ui_Timer = inl(devpriv-amcc_iobase + APCI1564_TIMER_IRQ_REG) 0x01; - ui_C1 = - inl(dev-iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER1)) 0x1; - ui_C2 = - inl(dev-iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER2)) 0x1; - ui_C3 = - inl(dev-iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER3)) 0x1; - ui_C4 = - inl(dev-iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER4)) 0x1; - if (ui_DI == 0 ui_DO == 0 ui_Timer == 0 ui_C1 == 0 -ui_C2 == 0 ui_C3 == 0 ui_C4 == 0) { - dev_err(dev-class_dev, Interrupt from unknown source.\n); - } - - if (ui_DI == 1) { - ui_DI = inl(devpriv-amcc_iobase + APCI1564_DI_IRQ_REG); - outl(0x0, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG); - /* send signal to the sample */ - send_sig(SIGIO, devpriv-tsk_current, 0); - /* enable the interrupt */ - outl(ui_DI, devpriv-amcc_iobase + APCI1564_DI_IRQ_REG); - return; - } - - if (ui_DO == 1) { - /* Check for Digital Output interrupt Type */ - /* 1: VCC interrupt*/ - /* 2: CC interrupt */ - devpriv-do_int_type = inl(devpriv-amcc_iobase + - APCI1564_DO_INT_STATUS_REG) 0x3; - /* Disable the Interrupt */ - outl(0x0, devpriv-amcc_iobase + APCI1564_DO_INT_CTRL_REG); - - /* Sends signal to user space */ - send_sig(SIGIO, devpriv-tsk_current, 0); - } - - if (ui_Timer == 1) { - devpriv-timer_select_mode = ADDIDATA_TIMER; - if (devpriv-timer_select_mode) { - - /* Disable Timer Interrupt */ - ul_Command2 = inl(devpriv-amcc_iobase + APCI1564_TIMER_CTRL_REG); - outl(0x0, devpriv-amcc_iobase + APCI1564_TIMER_CTRL_REG); - - /* Send a signal to from kernel to user space */ - send_sig(SIGIO, devpriv-tsk_current, 0); - - /* Enable Timer Interrupt */ - - outl(ul_Command2, devpriv-amcc_iobase + APCI1564_TIMER_CTRL_REG); - } - } - - if (ui_C1 == 1) { - devpriv-timer_select_mode = ADDIDATA_COUNTER; - if (devpriv-timer_select_mode) { - - /* Disable Counter Interrupt */ - ul_Command2 = - inl(dev-iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER1)); - outl(0x0, -dev-iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER1)); - - /* Send a signal to from kernel to user space */ - send_sig(SIGIO, devpriv-tsk_current, 0); - - /* Enable Counter Interrupt */ - outl(ul_Command2, -dev-iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER1)); - } - } - - if (ui_C2 == 1) { - devpriv-timer_select_mode = ADDIDATA_COUNTER; - if (devpriv-timer_select_mode) { - - /* Disable Counter Interrupt */ - ul_Command2 = - inl(dev-iobase +
[PATCH v2] net/wireless/brcm80211/brcmfmac: Make return type and name reflect actual semantics
Applying ++ to a bool is equivalent to setting it true, regardless of its initial value (bools are not uint1_t). Hence the function wl_get_vif_state_all can only ever return true/false. The only in-tree caller uses its return value as a boolean. So update its return type, and since the list traversal and bit testing have no side effects, just return true immediately. Its return value tells if any vif is up, so also rename it to brcmf_get_vif_state_any. Reviewed-by: Arend van Spriel ar...@broadcom.com Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- Notes: v2: Rename wl_get_vif_state_all = brcmf_get_vif_state_any as requested by Arend. drivers/net/wireless/brcm80211/brcmfmac/p2p.c | 2 +- drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 7 +++ drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c index f3445ac..588fdbd 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c @@ -708,7 +708,7 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans, active = P2PAPI_SCAN_SOCIAL_DWELL_TIME_MS; else if (num_chans == AF_PEER_SEARCH_CNT) active = P2PAPI_SCAN_AF_SEARCH_DWELL_TIME_MS; - else if (wl_get_vif_state_all(p2p-cfg, BRCMF_VIF_STATUS_CONNECTED)) + else if (brcmf_get_vif_state_any(p2p-cfg, BRCMF_VIF_STATUS_CONNECTED)) active = -1; else active = P2PAPI_SCAN_DWELL_TIME_MS; diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index d8fa276..93b1809 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c @@ -5625,16 +5625,15 @@ enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp) return wdev-iftype; } -u32 wl_get_vif_state_all(struct brcmf_cfg80211_info *cfg, unsigned long state) +bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg, unsigned long state) { struct brcmf_cfg80211_vif *vif; - bool result = 0; list_for_each_entry(vif, cfg-vif_list, list) { if (test_bit(state, vif-sme_state)) - result++; + return true; } - return result; + return false; } static inline bool vif_event_equals(struct brcmf_cfg80211_vif_event *event, diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h index 283c525..f9fb109 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h @@ -477,7 +477,7 @@ const struct brcmf_tlv * brcmf_parse_tlvs(const void *buf, int buflen, uint key); u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, struct ieee80211_channel *ch); -u32 wl_get_vif_state_all(struct brcmf_cfg80211_info *cfg, unsigned long state); +bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg, unsigned long state); void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg, struct brcmf_cfg80211_vif *vif); bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg); -- 1.9.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] tulip: Poll link status more frequently for Comet chips
Hi Ondrej, On Sat, Jun 21, 2014 at 1:29 PM, Ondrej Zary li...@rainbow-software.org wrote: Poll link status every 2 seconds instead of 60 for ADMtek Comet chips. Why use 2 seconds for the polling interval? I'm sure you have a good reason for this and it should be in the commit message or as a comment in the code. I otherwise have no objection to this change. thanks, grant Tested with AN983B. Signed-off-by: Ondrej Zary li...@rainbow-software.org --- drivers/net/ethernet/dec/tulip/timer.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/dec/tulip/timer.c b/drivers/net/ethernet/dec/tulip/timer.c index 768379b..523d9dd 100644 --- a/drivers/net/ethernet/dec/tulip/timer.c +++ b/drivers/net/ethernet/dec/tulip/timer.c @@ -158,7 +158,7 @@ void comet_timer(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct tulip_private *tp = netdev_priv(dev); - int next_tick = 60*HZ; + int next_tick = 2*HZ; if (tulip_debug 1) netdev_dbg(dev, Comet link status %04x partner capability %04x\n, -- Ondrej Zary -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 32-bit bug in iovec iterator changes
On Sat, Jun 21, 2014 at 06:53:07AM +0100, Al Viro wrote: ed include/linux/uio.h EOF /iov_iter_truncate/s/size_t/u64/ w q EOF Could you check if that fixes the sucker? The following patch (attached at the end) appears to fix the problem, but looking at uio.h, I'm completely confused about *why* it fixes the problem. In particular, iov_iter_iovec() makes no sense to me at all, and I don't understand how the calculation of iov_len makes any sense: .iov_len = min(iter-count, iter-iov-iov_len - iter-iov_offset), It also looks like uio.h is mostly about offsets to memory pointers, and so why this would make a difference when the issue is the block device offset goes above 2**30? There must be deep magic going on here, and so I don't know if your s/size_t/u64/g substitation also extends to the various functions that have size_t in them: unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); size_t iov_iter_copy_from_user_atomic(struct page *page, struct iov_iter *i, unsigned long offset, size_t bytes); void iov_iter_advance(struct iov_iter *i, size_t bytes); int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); size_t iov_iter_single_seg_count(const struct iov_iter *i); size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, struct iov_iter *i); size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, struct iov_iter *i); unsigned long iov_iter_alignment(const struct iov_iter *i); void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, unsigned long nr_segs, size_t count); ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, size_t maxsize, size_t *start); ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, size_t maxsize, size_t *start); Anyway, this patch does appear to make the problem go away, but given that I don't understand what is going on here, please take it with a huge grain of salt. And might I suggest some comments to perhaps give some context to someone who is trying to understand include/linux/uio.h? Thanks!! - Ted diff --git a/include/linux/uio.h b/include/linux/uio.h index e2231e4..bea7b7d 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -16,7 +16,7 @@ struct page; struct kvec { void *iov_base; /* and that should *never* hold a userland pointer */ - size_t iov_len; + u64 iov_len; }; enum { @@ -27,8 +27,8 @@ enum { struct iov_iter { int type; - size_t iov_offset; - size_t count; + u64 iov_offset; + u64 count; union { const struct iovec *iov; const struct bio_vec *bvec; @@ -41,12 +41,12 @@ struct iov_iter { * * NOTE that it is not safe to use this function until all the iovec's * segment lengths have been validated. Because the individual lengths can - * overflow a size_t when added together. + * overflow a u64 when added together. */ -static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs) +static inline u64 iov_length(const struct iovec *iov, unsigned long nr_segs) { unsigned long seg; - size_t ret = 0; + u64 ret = 0; for (seg = 0; seg nr_segs; seg++) ret += iov[seg].iov_len; @@ -89,12 +89,12 @@ ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, size_t maxsize, size_t *start); int iov_iter_npages(const struct iov_iter *i, int maxpages); -static inline size_t iov_iter_count(struct iov_iter *i) +static inline u64 iov_iter_count(struct iov_iter *i) { return i-count; } -static inline void iov_iter_truncate(struct iov_iter *i, size_t count) +static inline void iov_iter_truncate(struct iov_iter *i, u64 count) { if (i-count count) i-count = count; @@ -104,7 +104,7 @@ static inline void iov_iter_truncate(struct iov_iter *i, size_t count) * reexpand a previously truncated iterator; count must be no more than how much * we had shrunk it. */ -static inline void iov_iter_reexpand(struct iov_iter *i, size_t count) +static inline void iov_iter_reexpand(struct iov_iter *i, u64 count) { i-count = count; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/5] timer: Fix missing dynticks kick v2
Hi, It's a 2nd set that fixes some missing dyntick kicks in the timer's code. This new version also handles missing kicks in the hrtimers subsystem. The patches are also available at: git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git timers/missing-kick-v2 Thanks, Frederic --- Viresh Kumar (5): timer: Store cpu-number in 'struct tvec_base' timer: Kick dynticks targets on mod_timer*() calls hrtimer: Store cpu-number in 'struct hrtimer_cpu_base' hrtimer: Kick lowres dynticks targets on timer enqueue hrtimer: Remove hrtimer_enqueue_reprogram() include/linux/hrtimer.h | 2 ++ kernel/hrtimer.c| 49 +++-- kernel/timer.c | 34 ++ 3 files changed, 47 insertions(+), 38 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/5] hrtimer: Store cpu-number in 'struct hrtimer_cpu_base'
From: Viresh Kumar viresh.ku...@linaro.org In lowres mode, hrtimers are serviced by the tick instead of a clock event. Now it works well as long as the tick stays periodic but we must also make sure that the hrtimers are serviced in dynticks mode. Part of that job consist in kicking a dynticks hrtimer target in order to make it reconsider the next tick to schedule to correctly handle the hrtimer's expiring time. And that part isn't handled by the hrtimers subsystem. To prepare for fixing this, we need __hrtimer_start_range_ns() to be able to resolve the CPU target associated to a hrtimer's object 'cpu_base' so that the kick can be centralized there. So lets store it in the 'struct hrtimer_cpu_base' to resolve the CPU without overhead. It is set once at CPU's online notification. Signed-off-by: Viresh Kumar viresh.ku...@linaro.org Signed-off-by: Frederic Weisbecker fweis...@gmail.com --- include/linux/hrtimer.h | 2 ++ kernel/hrtimer.c| 1 + 2 files changed, 3 insertions(+) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index e7a8d3f..bb4 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -165,6 +165,7 @@ enum hrtimer_base_type { * struct hrtimer_cpu_base - the per cpu clock bases * @lock: lock protecting the base and associated clock bases * and timers + * @cpu: cpu number * @active_bases: Bitfield to mark bases with active timers * @clock_was_set: Indicates that clock was set from irq context. * @expires_next: absolute time of the next event which was scheduled @@ -179,6 +180,7 @@ enum hrtimer_base_type { */ struct hrtimer_cpu_base { raw_spinlock_t lock; + unsigned intcpu; unsigned intactive_bases; unsigned intclock_was_set; #ifdef CONFIG_HIGH_RES_TIMERS diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 3ab2899..0e32d4e 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1680,6 +1680,7 @@ static void init_hrtimers_cpu(int cpu) timerqueue_init_head(cpu_base-clock_base[i].active); } + cpu_base-cpu = cpu; hrtimer_init_hres(cpu_base); } -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/5] hrtimer: Remove hrtimer_enqueue_reprogram()
From: Viresh Kumar viresh.ku...@linaro.org We call hrtimer_enqueue_reprogram() only when we are in high resolution mode now so we don't need to check that again in hrtimer_enqueue_reprogram(). Once the check is removed, hrtimer_enqueue_reprogram() turns to be an useless wrapper over hrtimer_reprogram() and can be dropped. Signed-off-by: Viresh Kumar viresh.ku...@linaro.org Signed-off-by: Frederic Weisbecker fweis...@gmail.com --- kernel/hrtimer.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 5f30917..8b3ea17 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -602,6 +602,11 @@ hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, int skip_equal) * timers, we have to check, whether it expires earlier than the timer for * which the clock event device was armed. * + * Note, that in case the state has HRTIMER_STATE_CALLBACK set, no reprogramming + * and no expiry check happens. The timer gets enqueued into the rbtree. The + * reprogramming and expiry check is done in the hrtimer_interrupt or in the + * softirq. + * * Called with interrupts disabled and base-cpu_base.lock held */ static int hrtimer_reprogram(struct hrtimer *timer, @@ -662,18 +667,6 @@ static inline void hrtimer_init_hres(struct hrtimer_cpu_base *base) base-hres_active = 0; } -/* - * When High resolution timers are active, try to reprogram. Note, that in case - * the state has HRTIMER_STATE_CALLBACK set, no reprogramming and no expiry - * check happens. The timer gets enqueued into the rbtree. The reprogramming - * and expiry check is done in the hrtimer_interrupt or in the softirq. - */ -static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer, - struct hrtimer_clock_base *base) -{ - return base-cpu_base-hres_active hrtimer_reprogram(timer, base); -} - static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base) { ktime_t *offs_real = base-clock_base[HRTIMER_BASE_REALTIME].offset; @@ -755,8 +748,8 @@ static inline int hrtimer_is_hres_enabled(void) { return 0; } static inline int hrtimer_switch_to_hres(void) { return 0; } static inline void hrtimer_force_reprogram(struct hrtimer_cpu_base *base, int skip_equal) { } -static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer, - struct hrtimer_clock_base *base) +static inline int hrtimer_reprogram(struct hrtimer *timer, + struct hrtimer_clock_base *base) { return 0; } @@ -1025,7 +1018,7 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, */ wake_up_nohz_cpu(base-cpu_base-cpu); } else if (new_base-cpu_base == __get_cpu_var(hrtimer_bases) - hrtimer_enqueue_reprogram(timer, new_base)) { + hrtimer_reprogram(timer, new_base)) { /* * Only allow reprogramming if the new base is on this CPU. * (it might still be on another CPU if the timer was pending) -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/5] hrtimer: Kick lowres dynticks targets on timer enqueue
From: Viresh Kumar viresh.ku...@linaro.org In lowres mode, hrtimers are serviced by the tick instead of a clock event. It works well as long as the tick stays periodic but we must also make sure that the hrtimers are serviced in dynticks mode targets, pretty much like timer list timers do. Note that all dynticks modes are concerned: get_nohz_timer_target() tries not to return remote idle CPUs but there is nothing to prevent the elected target from entering dynticks idle mode until we lock its base. It's also prefectly legal to enqueue hrtimers on full dynticks CPU. So there are two requirements to correctly handle dynticks: 1) On target's tick stop time, we must not delay the next tick further the next hrtimer. 2) On hrtimer queue time. If the tick of the target is stopped, we must wake up that CPU such that it sees the new hrtimer and recalculate the next tick accordingly. The point 1 is well handled currently through get_nohz_timer_interrupt() and cmp_next_hrtimer_event(). But the point 2 isn't handled at all. Fixing this is easy though as we have the necessary API ready for that. All we need is to call wake_up_nohz_cpu() on a target when a newly enqueued hrtimer requires tick rescheduling, like timer list timer do. Signed-off-by: Viresh Kumar viresh.ku...@linaro.org Signed-off-by: Frederic Weisbecker fweis...@gmail.com --- kernel/hrtimer.c | 27 +++ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 0e32d4e..5f30917 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1013,14 +1013,25 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, leftmost = enqueue_hrtimer(timer, new_base); - /* -* Only allow reprogramming if the new base is on this CPU. -* (it might still be on another CPU if the timer was pending) -* -* XXX send_remote_softirq() ? -*/ - if (leftmost new_base-cpu_base == __get_cpu_var(hrtimer_bases) -hrtimer_enqueue_reprogram(timer, new_base)) { + if (!leftmost) { + unlock_hrtimer_base(timer, flags); + return ret; + } + + if (!hrtimer_is_hres_active(timer)) { + /* +* Kick to reschedule the next tick to handle the new timer +* on dynticks target. +*/ + wake_up_nohz_cpu(base-cpu_base-cpu); + } else if (new_base-cpu_base == __get_cpu_var(hrtimer_bases) + hrtimer_enqueue_reprogram(timer, new_base)) { + /* +* Only allow reprogramming if the new base is on this CPU. +* (it might still be on another CPU if the timer was pending) +* +* XXX send_remote_softirq() ? +*/ if (wakeup) { /* * We need to drop cpu_base-lock to avoid a -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/5] timer: Kick dynticks targets on mod_timer*() calls
From: Viresh Kumar viresh.ku...@linaro.org When a timer is enqueued or modified on a dynticks target, that CPU must re-evaluate the next tick to service that timer. The tick re-evaluation is performed by an IPI kick on the target. Now while we correctly call wake_up_nohz_cpu() from add_timer_on(), the mod_timer*() API family doesn't support so well dynticks targets. The reason for this is likely that __mod_timer() isn't supposed to select an idle target for a timer, unless that target is the current CPU, in which case a dynticks idle kick isn't actually needed. But there is a small race window lurking behind that assumption: the elected target has all the time to turn dynticks idle between the call to get_nohz_timer_target() and the locking of its base. Hence a risk that we enqueue a timer on a dynticks idle destination without kicking it. As a result, the timer might be serviced too late in the future. Also a target elected by __mod_timer() can be in full dynticks mode and thus require to be kicked as well. And unlike idle dynticks, this concern both local and remote targets. To fix this whole issue, lets centralize the dynticks kick to internal_add_timer() so that it is well handled for all sort of timer enqueue. Even timer migration is concerned so that a full dynticks target is correctly kicked as needed when timers are migrating to it. Signed-off-by: Viresh Kumar viresh.ku...@linaro.org Signed-off-by: Frederic Weisbecker fweis...@gmail.com --- kernel/timer.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/kernel/timer.c b/kernel/timer.c index 9e5f4f2..aca5dfe 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -410,6 +410,22 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer) base-next_timer = timer-expires; } base-all_timers++; + + /* +* Check whether the other CPU is in dynticks mode and needs +* to be triggered to reevaluate the timer wheel. +* We are protected against the other CPU fiddling +* with the timer by holding the timer base lock. This also +* makes sure that a CPU on the way to stop its tick can not +* evaluate the timer wheel. +* +* Spare the IPI for deferrable timers on idle targets though. +* The next busy ticks will take care of it. Except full dynticks +* require special care against races with idle_cpu(), lets deal +* with that later. +*/ + if (!tbase_get_deferrable(base) || tick_nohz_full_cpu(base-cpu)) + wake_up_nohz_cpu(base-cpu); } #ifdef CONFIG_TIMER_STATS @@ -949,22 +965,6 @@ void add_timer_on(struct timer_list *timer, int cpu) timer_set_base(timer, base); debug_activate(timer, timer-expires); internal_add_timer(base, timer); - /* -* Check whether the other CPU is in dynticks mode and needs -* to be triggered to reevaluate the timer wheel. -* We are protected against the other CPU fiddling -* with the timer by holding the timer base lock. This also -* makes sure that a CPU on the way to stop its tick can not -* evaluate the timer wheel. -* -* Spare the IPI for deferrable timers on idle targets though. -* The next busy ticks will take care of it. Except full dynticks -* require special care against races with idle_cpu(), lets deal -* with that later. -*/ - if (!tbase_get_deferrable(timer-base) || tick_nohz_full_cpu(cpu)) - wake_up_nohz_cpu(cpu); - spin_unlock_irqrestore(base-lock, flags); } EXPORT_SYMBOL_GPL(add_timer_on); -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 01/13] irqchip: spear_shirq: Fix interrupt offset
On Thu, Jun 19, 2014 at 09:34:37PM -, Thomas Gleixner wrote: The ras3 block on spear320 claims to have 3 interrupts. In fact it has one and 6 reserved interrupts. Account the 6 reserved to this block so it has 7 interrupts total. That matches the datasheet and the device tree entries. Broken since commit 80515a5a(ARM: SPEAr3xx: shirq: simplify and move the shared irq multiplexor to DT). Testing is overrated Signed-off-by: Thomas Gleixner t...@linutronix.de Cc: sta...@vger.kernel.org --- drivers/irqchip/spear-shirq.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Applied to irqchip/urgent noting that it's for stable v3.8+ with Viresh's Ack. thx, Jason. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/5] timer: Store cpu-number in 'struct tvec_base'
From: Viresh Kumar viresh.ku...@linaro.org Timers are serviced by the tick. But when a timer is enqueued on a dynticks target, we need to kick it in order to make it reconsider the next tick to schedule to correctly handle the timer's expiring time. Now while this kick is correctly performed for add_timer_on(), the mod_timer*() family has been a bit neglected. To prepare for fixing this, we need internal_add_timer() to be able to resolve the CPU target associated to a timer's object 'base' so that the kick can be centralized there. This can't be passed as an argument as not all the callers know the CPU number of a timer's base. So lets store it in the struct tvec_base to resolve the CPU without much overhead. It is set once for good at every CPU's first boot. Signed-off-by: Viresh Kumar viresh.ku...@linaro.org Signed-off-by: Frederic Weisbecker fweis...@gmail.com --- kernel/timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/timer.c b/kernel/timer.c index 3bb01a3..9e5f4f2 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -82,6 +82,7 @@ struct tvec_base { unsigned long next_timer; unsigned long active_timers; unsigned long all_timers; + int cpu; struct tvec_root tv1; struct tvec tv2; struct tvec tv3; @@ -1568,6 +1569,7 @@ static int init_timers_cpu(int cpu) } spin_lock_init(base-lock); tvec_base_done[cpu] = 1; + base-cpu = cpu; } else { base = per_cpu(tvec_bases, cpu); } -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 32-bit bug in iovec iterator changes
On Sat, Jun 21, 2014 at 07:09:22PM -0400, Theodore Ts'o wrote: On Sat, Jun 21, 2014 at 06:53:07AM +0100, Al Viro wrote: ed include/linux/uio.h EOF /iov_iter_truncate/s/size_t/u64/ w q EOF Could you check if that fixes the sucker? The following patch (attached at the end) appears to fix the problem, but looking at uio.h, I'm completely confused about *why* it fixes the problem. In particular, iov_iter_iovec() makes no sense to me at all, and I don't understand how the calculation of iov_len makes any sense: .iov_len = min(iter-count, iter-iov-iov_len - iter-iov_offset), Eh? We have iov[0].iov_base..iov[0].iov_base+iov[0].iov_len - 1 for area covered by the first iovec. First iov_offset bytes have already been consumed. And at most count bytes matter. So yes, this iov_len will give you equivalent first iovec. Said that, iov_iter_iovec() will die shortly - it's a rudiment of older code, with almost no users left. But yes, it is correct. It also looks like uio.h is mostly about offsets to memory pointers, and so why this would make a difference when the issue is the block device offset goes above 2**30? It is, and your patch is a huge overkill. There must be deep magic going on here, and so I don't know if your s/size_t/u64/g substitation also extends to the various functions that have size_t in them: No, it does not. It's specifically about iov_iter_truncate(); moreover, it matters to only one caller of that sucker. Namely, static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct file *file = iocb-ki_filp; struct inode *bd_inode = file-f_mapping-host; loff_t size = i_size_read(bd_inode); loff_t pos = iocb-ki_pos; if (pos = size) return 0; size -= pos; iov_iter_truncate(to, size); return generic_file_read_iter(iocb, to); } What happens here is capping to-count, to guarantee that we won't even look at anything past the end of block device. Alternative fix would be to have if (pos = size) return 0; if (to-size + pos size) { /* note that size - pos fits into size_t in this case, * so it's OK to pass it to iov_iter_truncate(). */ iov_iter_truncate(to, size - pos); } return generic_file_read_iter(iocb, to); in there. Other callers are passing it size_t values already, so we don't need similar checks there. Or we can make iov_iter_truncate() take an arbitrary u64 argument, seeing that it's inlined anyway. IMO it's more robust that way... Anyway, does the following alone fix the problem you are seeing? diff --git a/include/linux/uio.h b/include/linux/uio.h index ddfdb53..dbb02d4 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -94,7 +94,7 @@ static inline size_t iov_iter_count(struct iov_iter *i) return i-count; } -static inline void iov_iter_truncate(struct iov_iter *i, size_t count) +static inline void iov_iter_truncate(struct iov_iter *i, u64 count) { if (i-count count) i-count = count; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 32-bit bug in iovec iterator changes
On Sun, 2014-06-22 at 00:49 +0100, Al Viro wrote: On Sat, Jun 21, 2014 at 07:09:22PM -0400, Theodore Ts'o wrote: On Sat, Jun 21, 2014 at 06:53:07AM +0100, Al Viro wrote: ed include/linux/uio.h EOF /iov_iter_truncate/s/size_t/u64/ w q EOF Could you check if that fixes the sucker? The following patch (attached at the end) appears to fix the problem, but looking at uio.h, I'm completely confused about *why* it fixes the problem. In particular, iov_iter_iovec() makes no sense to me at all, and I don't understand how the calculation of iov_len makes any sense: .iov_len = min(iter-count, iter-iov-iov_len - iter-iov_offset), Eh? We have iov[0].iov_base..iov[0].iov_base+iov[0].iov_len - 1 for area covered by the first iovec. First iov_offset bytes have already been consumed. And at most count bytes matter. So yes, this iov_len will give you equivalent first iovec. Said that, iov_iter_iovec() will die shortly - it's a rudiment of older code, with almost no users left. But yes, it is correct. It also looks like uio.h is mostly about offsets to memory pointers, and so why this would make a difference when the issue is the block device offset goes above 2**30? It is, and your patch is a huge overkill. There must be deep magic going on here, and so I don't know if your s/size_t/u64/g substitation also extends to the various functions that have size_t in them: No, it does not. It's specifically about iov_iter_truncate(); moreover, it matters to only one caller of that sucker. Namely, static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct file *file = iocb-ki_filp; struct inode *bd_inode = file-f_mapping-host; loff_t size = i_size_read(bd_inode); loff_t pos = iocb-ki_pos; if (pos = size) return 0; size -= pos; iov_iter_truncate(to, size); return generic_file_read_iter(iocb, to); } What happens here is capping to-count, to guarantee that we won't even look at anything past the end of block device. Alternative fix would be to have if (pos = size) return 0; if (to-size + pos size) { /* note that size - pos fits into size_t in this case, * so it's OK to pass it to iov_iter_truncate(). */ iov_iter_truncate(to, size - pos); } return generic_file_read_iter(iocb, to); in there. Other callers are passing it size_t values already, so we don't need similar checks there. Or we can make iov_iter_truncate() take an arbitrary u64 argument, seeing that it's inlined anyway. IMO it's more robust that way... Anyway, does the following alone fix the problem you are seeing? diff --git a/include/linux/uio.h b/include/linux/uio.h index ddfdb53..dbb02d4 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -94,7 +94,7 @@ static inline size_t iov_iter_count(struct iov_iter *i) return i-count; } -static inline void iov_iter_truncate(struct iov_iter *i, size_t count) +static inline void iov_iter_truncate(struct iov_iter *i, u64 count) { if (i-count count) i-count = count; Al, how can that work? i-count is size_t, which is 32 bit, so we're going to get truncation errors. I could see this possibly working if count in struct iov_iter becomes u64 (which is going to have a lot of knock on consequences, but it seems to me that at least kvec.iov_len and iov_iter.iov_offset have to become u64 as well. James -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 32-bit bug in iovec iterator changes
On Sat, Jun 21, 2014 at 05:03:20PM -0700, James Bottomley wrote: Anyway, does the following alone fix the problem you are seeing? diff --git a/include/linux/uio.h b/include/linux/uio.h index ddfdb53..dbb02d4 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -94,7 +94,7 @@ static inline size_t iov_iter_count(struct iov_iter *i) return i-count; } -static inline void iov_iter_truncate(struct iov_iter *i, size_t count) +static inline void iov_iter_truncate(struct iov_iter *i, u64 count) { if (i-count count) i-count = count; Al, how can that work? i-count is size_t, which is 32 bit, so we're going to get truncation errors. No, we are not. Look: * comparison promotes both operands to u64 here, so its result is accurate, no matter how large count is. They are compared as natural numbers. * assignment converts count to size_t, which *would* truncate for values that are greater than the maximal value representable by size_t. But in that case it's by definition greater than i-count, so we do not reach that assignment at all. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 32-bit bug in iovec iterator changes
On Sun, 2014-06-22 at 01:26 +0100, Al Viro wrote: On Sat, Jun 21, 2014 at 05:03:20PM -0700, James Bottomley wrote: Anyway, does the following alone fix the problem you are seeing? diff --git a/include/linux/uio.h b/include/linux/uio.h index ddfdb53..dbb02d4 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -94,7 +94,7 @@ static inline size_t iov_iter_count(struct iov_iter *i) return i-count; } -static inline void iov_iter_truncate(struct iov_iter *i, size_t count) +static inline void iov_iter_truncate(struct iov_iter *i, u64 count) { if (i-count count) i-count = count; Al, how can that work? i-count is size_t, which is 32 bit, so we're going to get truncation errors. No, we are not. Look: * comparison promotes both operands to u64 here, so its result is accurate, no matter how large count is. They are compared as natural numbers. True ... figured this out 10 seconds after sending the email. * assignment converts count to size_t, which *would* truncate for values that are greater than the maximal value representable by size_t. But in that case it's by definition greater than i-count, so we do not reach that assignment at all. OK, so what I still don't get is why isn't the compiler warning when we truncate a u64 to a u32? We should get that warning in your new code, and we should have got that warning in fs/block_dev.c where it would have pinpointed the actual problem. James -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 32-bit bug in iovec iterator changes
On Sat, Jun 21, 2014 at 05:32:44PM -0700, James Bottomley wrote: No, we are not. Look: * comparison promotes both operands to u64 here, so its result is accurate, no matter how large count is. They are compared as natural numbers. True ... figured this out 10 seconds after sending the email. * assignment converts count to size_t, which *would* truncate for values that are greater than the maximal value representable by size_t. But in that case it's by definition greater than i-count, so we do not reach that assignment at all. OK, so what I still don't get is why isn't the compiler warning when we truncate a u64 to a u32? We should get that warning in your new code, and we should have got that warning in fs/block_dev.c where it would have pinpointed the actual problem. In which universe? extern void f(unsigned int); void g(unsigned long x) { f(x); } is perfectly valid C, with no warnings in sight. f(1UL 32) might give one, but not this... -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 32-bit bug in iovec iterator changes
On Sun, 2014-06-22 at 01:53 +0100, Al Viro wrote: On Sat, Jun 21, 2014 at 05:32:44PM -0700, James Bottomley wrote: No, we are not. Look: * comparison promotes both operands to u64 here, so its result is accurate, no matter how large count is. They are compared as natural numbers. True ... figured this out 10 seconds after sending the email. * assignment converts count to size_t, which *would* truncate for values that are greater than the maximal value representable by size_t. But in that case it's by definition greater than i-count, so we do not reach that assignment at all. OK, so what I still don't get is why isn't the compiler warning when we truncate a u64 to a u32? We should get that warning in your new code, and we should have got that warning in fs/block_dev.c where it would have pinpointed the actual problem. In which universe? extern void f(unsigned int); void g(unsigned long x) { f(x); } In the one where the code is compiled with -Wconversion ... I'm just surprised, I thought we had this enabled. James -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 32-bit bug in iovec iterator changes
On Sun, Jun 22, 2014 at 01:53:52AM +0100, Al Viro wrote: On Sat, Jun 21, 2014 at 05:32:44PM -0700, James Bottomley wrote: No, we are not. Look: * comparison promotes both operands to u64 here, so its result is accurate, no matter how large count is. They are compared as natural numbers. True ... figured this out 10 seconds after sending the email. * assignment converts count to size_t, which *would* truncate for values that are greater than the maximal value representable by size_t. But in that case it's by definition greater than i-count, so we do not reach that assignment at all. OK, so what I still don't get is why isn't the compiler warning when we truncate a u64 to a u32? We should get that warning in your new code, and we should have got that warning in fs/block_dev.c where it would have pinpointed the actual problem. In which universe? extern void f(unsigned int); void g(unsigned long x) { f(x); } is perfectly valid C, with no warnings in sight. f(1UL 32) might give one, but not this... PS: I agree that it's worth careful commenting, obviously, but before sending it to Linus (*with* comments) I want to get a confirmation that this one-liner actually fixes what Ted is seeing. I have reproduced it here, and that change makes the breakage go away in my testing, but I'd like to make sure that we are seeing the same thing. Ted? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Latency histogram broken after hrtimer: Set expiry time before switch_hrtimer_base()
In an rt-kernel with CONFIG_MISSED_TIMER_OFFSETS_HIST enabled, __hrtimer_start_range_ns() now crashes, as new_base is not assigned before it is used. I'm not sure how this should be fixed; is it: --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1108,7 +1108,7 @@ int __hrtimer_start_range_ns(struct hrti #ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { - ktime_t now = new_base-get_time(); + ktime_t now = base-get_time(); if (ktime_to_ns(tim) ktime_to_ns(now)) timer-praecox = now; --- END --- or: --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1106,6 +1106,11 @@ int __hrtimer_start_range_ns(struct hrti #endif } + hrtimer_set_expires_range_ns(timer, tim, delta_ns); + + /* Switch the timer base, if necessary: */ + new_base = switch_hrtimer_base(timer, base, mode HRTIMER_MODE_PINNED); + #ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { ktime_t now = new_base-get_time(); @@ -1117,11 +1122,6 @@ int __hrtimer_start_range_ns(struct hrti } #endif - hrtimer_set_expires_range_ns(timer, tim, delta_ns); - - /* Switch the timer base, if necessary: */ - new_base = switch_hrtimer_base(timer, base, mode HRTIMER_MODE_PINNED); - timer_stats_hrtimer_set_start_info(timer); leftmost = enqueue_hrtimer(timer, new_base); --- END --- or something else? Ben. -- Ben Hutchings 73.46% of all statistics are made up. signature.asc Description: This is a digitally signed message part
Re: [RFC] Tux3 for review
On Sat, Jun 21, 2014 at 12:29:01PM -0700, James Bottomley wrote: On Thu, 2014-06-19 at 14:58 -0700, Daniel Phillips wrote: On Thursday, June 19, 2014 2:26:48 AM PDT, Lukáš Czerner wrote: Let me remind you some more important problems Dave brought up, including page forking: The hacks around VFS and MM functionality need to have demonstrated methods for being removed. We already removed 450 lines of core kernel workarounds from Tux3 with an approach that was literally cut and pasted from one of Dave's emails. Then Dave changed his mind. Now the Tux3 team has been assigned a research project to improve core kernel writeback instead of simply adapting the approach that is already proven to work well enough. That is a rather blatant example of perfect is the enemy of good enough. Please read the thread. That's a bit disingenuous: the concern has always been how page forking interacted with writeback. It's not new, it was one of the major things brought up at LSF 14 months ago, so you weren't just assigned this. BTW, it's worth noting that reviewers are *allowed* to change their mind at any time during a discussion or during review cycles. Indeed, this occurs quite commonly. It's no different to multiple reviewers disagreeing on what the best way to make the improvement is - sometimes it takes an implementation to solidify opinion on the best approach to solving a problem. i.e. it took an implementation of the writeback hook tailored specifically to tux3's requirements to understand the best way to solve the infrastructure problem for *everyone*. This is how review is supposed to work - take an idea, and refine it into something better that works for everyone. We'd have been stuck way up the creek without a paddle a long time ago if reviewers weren't allowed to change their minds Cheers, Dave. -- Dave Chinner da...@fromorbit.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] please pull file locking bugfixes for v3.16 (pile #2)
The following changes since commit 64b2d1fbbfda07765dae3f601862796a61b2c451: Merge tag 'for-f2fs-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs (2014-06-09 19:11:44 -0700) are available in the git repository at: git://git.samba.org/jlayton/linux.git tags/locks-v3.16-2 for you to fetch changes up to 0c27362998a8357f199501aa401e99c51c2eb46e: locks: set fl_owner for leases back to current-files (2014-06-10 12:29:05 -0400) (from the branch description for locks-3.16 local branch) File locking related bugfixes for v3.16 (pile #2) Nothing too earth-shattering here. A fix for a potential regression due to a patch in pile #1, and the addition of a memory barrier to prevent a race condition between break_deleg and generic_add_lease. Jeff Layton (2): locks: add missing memory barrier in break_deleg locks: set fl_owner for leases back to current-files fs/locks.c | 2 +- include/linux/fs.h | 6 ++ 2 files changed, 7 insertions(+), 1 deletion(-) -- Jeff Layton jlay...@poochiereds.net signature.asc Description: PGP signature
Re: [PATCH 1/1] net/dsa/dsa.c: remove null test before kfree
From: Joe Perches j...@perches.com Date: Sat, 21 Jun 2014 07:10:06 -0700 In this case, it seems the simple substitution of unnecessary null to the subject would have been enough validation. Agreed. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] tulip: Poll link status more frequently for Comet chips
From: Grant Grundler grantgrund...@gmail.com Date: Sat, 21 Jun 2014 15:59:30 -0700 Hi Ondrej, On Sat, Jun 21, 2014 at 1:29 PM, Ondrej Zary li...@rainbow-software.org wrote: Poll link status every 2 seconds instead of 60 for ADMtek Comet chips. Why use 2 seconds for the polling interval? I'm sure you have a good reason for this and it should be in the commit message or as a comment in the code. I otherwise have no objection to this change. Agreed, please post this with a better commit message, specifically make sure you explain why the interval is being changed and why 2*HZ is specifically being choosen. Thanks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs/ntfs: Use '%lx' instead of '%zx'
For subtraction between 2 pointers, the result's type is 'long', so need use '%lx' instead of '%zx'. The related warning (allmodconfig under unicore32): CC [M] fs/ntfs/compress.o fs/ntfs/compress.c: In function 'ntfs_decompress': fs/ntfs/compress.c:207:2: warning: format '%zx' expects argument of type 'size_t', but argument 5 has type 'long int' [-Wformat=] ntfs_debug(Beginning sub-block at offset = 0x%zx in the cb., ^ CC [M] fs/ntfs/dir.o fs/ntfs/dir.c: In function 'ntfs_readdir': fs/ntfs/dir.c:1197:3: warning: format '%zx' expects argument of type 'size_t', but argument 5 has type 'long int' [-Wformat=] ntfs_debug(In index root, offset 0x%zx., (u8*)ie - (u8*)ir); ^ Also let the related code match linux kernel styles which is found by 'scripts/checkpatch.pl'. Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- fs/ntfs/compress.c | 2 +- fs/ntfs/dir.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ntfs/compress.c b/fs/ntfs/compress.c index f82498c..51abeb3 100644 --- a/fs/ntfs/compress.c +++ b/fs/ntfs/compress.c @@ -204,7 +204,7 @@ static int ntfs_decompress(struct page *dest_pages[], int *dest_index, ntfs_debug(Entering, cb_size = 0x%x., cb_size); do_next_sb: - ntfs_debug(Beginning sub-block at offset = 0x%zx in the cb., + ntfs_debug(Beginning sub-block at offset = 0x%lx in the cb., cb - cb_start); /* * Have we reached the end of the compression block or the end of the diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index 9e38daf..cf85530 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c @@ -1194,7 +1194,7 @@ static int ntfs_readdir(struct file *file, struct dir_context *actor) * or signals an error (both covered by the rc test). */ for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie-length))) { - ntfs_debug(In index root, offset 0x%zx., (u8*)ie - (u8*)ir); + ntfs_debug(In index root, offset 0x%lx., (u8 *)ie - (u8 *)ir); /* Bounds checks. */ if (unlikely((u8*)ie (u8*)ir || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) index_end || -- 1.9.2.459.g68773ac -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] Tux3 for review
On Saturday, June 21, 2014 12:29:01 PM PDT, James Bottomley wrote: On Thu, 2014-06-19 at 14:58 -0700, Daniel Phillips wrote: We already removed 450 lines of core kernel workarounds from Tux3 with an approach that was literally cut and pasted from one of Dave's emails. Then Dave changed his mind. Now the Tux3 team has been assigned a research project to improve core kernel writeback instead of simply adapting the approach that is already proven to work well enough. That is a rather blatant example of perfect is the enemy of good enough. Please read the thread. That's a bit disingenuous: the concern has always been how page forking interacted with writeback. It's not new, it was one of the major things brought up at LSF 14 months ago, so you weren't just assigned this. [citation needed] Regards, Daniel -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Latency histogram broken after hrtimer: Set expiry time before switch_hrtimer_base()
On Sun, 2014-06-22 at 02:04 +0100, Ben Hutchings wrote: In an rt-kernel with CONFIG_MISSED_TIMER_OFFSETS_HIST enabled, __hrtimer_start_range_ns() now crashes, as new_base is not assigned before it is used. Oh yeah, forgot about this. I'm not sure how this should be fixed; is it: My (3.12-ish tree) merge resolution was the later, but it shouldn't matter which you choose, what's stored where is unchanged pre/post. --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1108,7 +1108,7 @@ int __hrtimer_start_range_ns(struct hrti #ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { - ktime_t now = new_base-get_time(); + ktime_t now = base-get_time(); if (ktime_to_ns(tim) ktime_to_ns(now)) timer-praecox = now; --- END --- or: --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1106,6 +1106,11 @@ int __hrtimer_start_range_ns(struct hrti #endif } + hrtimer_set_expires_range_ns(timer, tim, delta_ns); + + /* Switch the timer base, if necessary: */ + new_base = switch_hrtimer_base(timer, base, mode HRTIMER_MODE_PINNED); + #ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { ktime_t now = new_base-get_time(); @@ -1117,11 +1122,6 @@ int __hrtimer_start_range_ns(struct hrti } #endif - hrtimer_set_expires_range_ns(timer, tim, delta_ns); - - /* Switch the timer base, if necessary: */ - new_base = switch_hrtimer_base(timer, base, mode HRTIMER_MODE_PINNED); - timer_stats_hrtimer_set_start_info(timer); leftmost = enqueue_hrtimer(timer, new_base); --- END --- or something else? Ben. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Latency histogram broken after hrtimer: Set expiry time before switch_hrtimer_base()
(CCs stable -rt maintainer) On Sun, 2014-06-22 at 06:10 +0200, Mike Galbraith wrote: On Sun, 2014-06-22 at 02:04 +0100, Ben Hutchings wrote: In an rt-kernel with CONFIG_MISSED_TIMER_OFFSETS_HIST enabled, __hrtimer_start_range_ns() now crashes, as new_base is not assigned before it is used. Oh yeah, forgot about this. I'm not sure how this should be fixed; is it: My (3.12-ish tree) merge resolution was the later, but it shouldn't matter which you choose, what's stored where is unchanged pre/post. --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1108,7 +1108,7 @@ int __hrtimer_start_range_ns(struct hrti #ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { - ktime_t now = new_base-get_time(); + ktime_t now = base-get_time(); if (ktime_to_ns(tim) ktime_to_ns(now)) timer-praecox = now; --- END --- or: --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1106,6 +1106,11 @@ int __hrtimer_start_range_ns(struct hrti #endif } + hrtimer_set_expires_range_ns(timer, tim, delta_ns); + + /* Switch the timer base, if necessary: */ + new_base = switch_hrtimer_base(timer, base, mode HRTIMER_MODE_PINNED); + #ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST { ktime_t now = new_base-get_time(); @@ -1117,11 +1122,6 @@ int __hrtimer_start_range_ns(struct hrti } #endif - hrtimer_set_expires_range_ns(timer, tim, delta_ns); - - /* Switch the timer base, if necessary: */ - new_base = switch_hrtimer_base(timer, base, mode HRTIMER_MODE_PINNED); - timer_stats_hrtimer_set_start_info(timer); leftmost = enqueue_hrtimer(timer, new_base); --- END --- or something else? Ben. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch/score/include/uapi/asm/ptrace.h: Add prefix 'SCORE_' for related macros
'COUNTER' and other same kind macros are too common to use, and easy to get conflict with other modules. So add prefix for them. The related warning (allmodconfig with score): CC [M] drivers/md/raid1.o In file included from drivers/md/raid1.c:42:0: drivers/md/bitmap.h:93:0: warning: COUNTER redefined #define COUNTER(x) (((bitmap_counter_t) x) COUNTER_MAX) ^ In file included from ./arch/score/include/asm/ptrace.h:4:0, from include/linux/sched.h:31, from include/linux/blkdev.h:4, from drivers/md/raid1.c:36: ./arch/score/include/uapi/asm/ptrace.h:13:0: note: this is the location of the previous definition #define COUNTER 38 Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- arch/score/include/uapi/asm/ptrace.h | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/score/include/uapi/asm/ptrace.h b/arch/score/include/uapi/asm/ptrace.h index f59771a..7a0ead9 100644 --- a/arch/score/include/uapi/asm/ptrace.h +++ b/arch/score/include/uapi/asm/ptrace.h @@ -4,16 +4,16 @@ #define PTRACE_GETREGS 12 #define PTRACE_SETREGS 13 -#define PC 32 -#define CONDITION 33 -#define ECR34 -#define EMA35 -#define CEH36 -#define CEL37 -#define COUNTER38 -#define LDCR 39 -#define STCR 40 -#define PSR41 +#define SCORE_PC 32 +#define SCORE_CONDITION33 +#define SCORE_ECR 34 +#define SCORE_EMA 35 +#define SCORE_CEH 36 +#define SOCRE_CEL 37 +#define SCORE_COUNTER 38 +#define SCORE_LDCR 39 +#define SCORE_STCR 40 +#define SCORE_PSR 41 #define SINGLESTEP16_INSN 0x7006 #define SINGLESTEP32_INSN 0x840C8000 -- 1.9.2.459.g68773ac -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] arch/score/include/uapi/asm/ptrace.h: Add prefix 'SCORE_' for related macros
On 06/21/2014 09:48 PM, Chen Gang wrote: 'COUNTER' and other same kind macros are too common to use, and easy to get conflict with other modules. So add prefix for them. The related warning (allmodconfig with score): CC [M] drivers/md/raid1.o In file included from drivers/md/raid1.c:42:0: drivers/md/bitmap.h:93:0: warning: COUNTER redefined #define COUNTER(x) (((bitmap_counter_t) x) COUNTER_MAX) ^ In file included from ./arch/score/include/asm/ptrace.h:4:0, from include/linux/sched.h:31, from include/linux/blkdev.h:4, from drivers/md/raid1.c:36: ./arch/score/include/uapi/asm/ptrace.h:13:0: note: this is the location of the previous definition #define COUNTER 38 Signed-off-by: Chen Gang gang.chen.5...@gmail.com Any idea where to find a cross-compile toolchain for this architecture ? Thanks, Guenter -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Linux 3.16-rc2
It's a day early, but tomorrow ends up being inconvenient for me due to being on the road most of the day, so here you are. These days most people send me their pull requests and patches during the week, so it's not like I expect that a Sunday release would have made much of a difference. And it's also not like I didn't have enough changes for making a rc2 release. Anyway, enough excuses. 3.16-rc2 is out, and contains the usual assortment of fixes all over the map. The most unusual part at this point is how the sparc changes stand out (at almost 40% of the patch by bulk), but they are basically all just sparse warning cleanups. Similarly, some Nouveau drm changes standing out size-wise, but again those are largely due to small firmware fixes resulting in big generated changes. The actual real changes are fairly small. Ignoring those two unusually large changes (in lines), everything else looks fairly normal. There are driver changes, some tooling updates (particularly perf), and various other arch updates (arm, s390, unicore32, x86..). And just misc random stuff all over the place - rtmutex, btrfs, yadda yadda. The shortlog is not tiny, but small enough to include here, so you can see the details there if you care. Please do go test it out, Linus --- Aaron Plattner (1): cpufreq: unlock when failing cpufreq_update_policy() Alan Stern (2): USB: EHCI: avoid BIOS handover on the HASEE E200 USB: usbtest: add a timeout for scatter-gather tests Alex Deucher (2): drm/radeon: update mode_valid testing for DP drm/radeon: improve dvi_mode_valid Alexander Gordeev (3): blk-mq: bitmap tag: fix races on shared ::wake_index fields blk-mq: bitmap tag: fix race on blk_mq_bitmap_tags::wake_cnt blk-mq: bitmap tag: fix races in bt_get() function Alexander Mezin (2): ACPI / battery: use callback for setting up quirks ACPI / battery: add quirk for Acer Aspire V5-573G Alexander Shiyan (1): w1: mxc_w1: Fix incorrect presence status Anssi Hannula (1): ASoC: fsl_spdif: Fix integer overflow when calculating divisors Archana Patni (1): iio: hid-sensors: Get feature report from sensor hub after changing power state Ard Biesheuvel (2): arm64/crypto: fix data corruption bug in GHASH algorithm arm64/crypto: improve performance of GHASH algorithm Arnaldo Carvalho de Melo (2): perf tools: Emit more precise message for missing glibc static library perf tests: Show the inner make output when an error happens Arnd Bergmann (11): ASoC: pxa: add I2C dependencies as needed regulator: add regulator_can_change_voltage stub ASoC: MMP audio needs sram support staging/iio: IIO_SIMPLE_DUMMY_BUFFER neds IIO_BUFFER cpufreq: cpufreq-cpu0: fix CPU_THERMAL dependency ARM: omap2: fix am43xx dependency on l2x0 cache ARM: keystone requires ARM_PATCH_PHYS_VIRT bus/arm-cci: add dependency on OF CPU_V7 remoteproc: da8xx: don't select CMA on no-MMU ARM: samsung: make SAMSUNG_DMADEV optional staging: comedi: addi_apci_1564: add addi_watchdog dependency Axel Lin (1): regulator: ltc3589: Use of_get_child_by_name Ben Skeggs (8): drm/gk104/clk: only touch divider for mode we'll be using drm/gk104/ibus: increase various random timeouts drm/gf100-/gr: report class data to host on fwmthd failure drm/gk104/fb/ram: fixups from an earlier search+replace drm/nouveau/disp/dp: don't touch link config after success drm/nv50/disp: fix a potential oops in supervisor handling drm/nouveau/pwr: fix typo in fifo wrap handling drm/gf117/i2c: no aux channels on this chipset Benjamin Herrenschmidt (1): Revert offb: Add palette hack for little endian Boris BREZILLON (3): i2c: sunxi: add P2WI DT bindings documentation i2c: sunxi: add P2WI (Push/Pull 2 Wire Interface) controller support i2c: sun6-p2wi: fix call to snprintf Catalin Marinas (2): arm64: defconfig update for LTP arm64: Limit the CMA buffer to 32-bit if ZONE_DMA Chen Gang (17): arch/unicore32/kernel/ksyms.c: remove several undefined exported symbols arch/unicore32/kernel/module.c: use __vmalloc_node_range() instead of __vmalloc_area() arch/unicore32/kernel/clock.c: add readl() and writel() for 'PM_' macros arch/unicore32/mm/alignment.c: include asm/pgtable.h to avoid compiling error arch/unicore32/include/asm/ptrace.h: add generic definition for profile_pc() arch/unicore32/include/asm/io.h: add readl_relaxed() generic definition drivers/rtc/rtc-puv3.c: use dev_dbg() instead of dev_debug() for typo issue drivers/rtc/rtc-puv3.c: remove dev- for typo issue MIME-Version: 1.0 arch/unicore32/kernel/ksyms.c: remove 2 export symbols to avoid compiling failure arch: unicore32: kernel: ksyms: remove 'bswapsi2' and 'muldi3' to avoid compiling failure drivers: scsi: mvsas: fix compiling
Re: [PATCH] arch/score/include/uapi/asm/ptrace.h: Add prefix 'SCORE_' for related macros
On 06/22/2014 01:16 PM, Guenter Roeck wrote: On 06/21/2014 09:48 PM, Chen Gang wrote: 'COUNTER' and other same kind macros are too common to use, and easy to get conflict with other modules. So add prefix for them. The related warning (allmodconfig with score): CC [M] drivers/md/raid1.o In file included from drivers/md/raid1.c:42:0: drivers/md/bitmap.h:93:0: warning: COUNTER redefined #define COUNTER(x) (((bitmap_counter_t) x) COUNTER_MAX) ^ In file included from ./arch/score/include/asm/ptrace.h:4:0, from include/linux/sched.h:31, from include/linux/blkdev.h:4, from drivers/md/raid1.c:36: ./arch/score/include/uapi/asm/ptrace.h:13:0: note: this is the location of the previous definition #define COUNTER 38 Signed-off-by: Chen Gang gang.chen.5...@gmail.com Any idea where to find a cross-compile toolchain for this architecture ? I use latest source code of gcc and binutils with git. related source code: git://sourceware.org/git/binutils-gdb.git git://gcc.gnu.org/git/gcc.git Issues: For binutils, have to use the latest one (I have fixed one segment fault issue of gas for score, and integrated into gas main line by maintainer in Jun 13, 2014). For gcc (after binutils has installed), when building glibc, may need modify the absolute path for score-elf-gas, score-elf-ld ... in related auto-generated file. Under ubuntu (but under fedora, it is OK), may need export LD_LIBRARY_PATH=/usr/local/lib for searching libmpfr.so. My current binary informations: root@gchen:/upstream/toolchain/binutils-gdb# /usr/local/bin/score-elf-ld -v GNU ld (GNU Binutils) 2.24.51.20140609 root@gchen:/upstream/toolchain/binutils-gdb# /usr/local/bin/score-elf-as -v GNU assembler version 2.24.51 (score-elf) using BFD version (GNU Binutils) 2.24.51.20140609 root@gchen:/upstream/toolchain/binutils-gdb# /usr/local/bin/score-elf-gcc -v Using built-in specs. COLLECT_GCC=/usr/local/bin/score-elf-gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/score-elf/4.10.0/lto-wrapper Target: score-elf Configured with: ../gcc/configure --without-header --disable-nls --enable-language=c --disable-threads --disable-shared --enable-werror=no target_configargs=enable_vtable_verify=yes --target=score-elf --enable-obsolete Thread model: single gcc version 4.10.0 20140530 (experimental) (GCC) Thanks. -- Chen Gang Open, share, and attitude like air, water, and life which God blessed -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] init: Introduce 'noinitramfs' kernel parameter
Currently, we have no kernel paramater to avoid loading a configured initial RAM filesystem. Therefore, if a kernel is built with an appended initramfs, there's no way to avoid unpacking and mounting it as the rootfs. This commit adds a new kernel parameter to provide such option, following the naming of the current 'initrd' which serves a similar purpose, for an initial RAM disk. This commit changes the build so noinitramfs.c is unconditionally included. If the new 'noinitramfs' option is passed in the command line, the kernel avoids unpacking an initramfs and calls default_rootfs(). Signed-off-by: Ezequiel Garcia ezequ...@vanguardiasur.com.ar --- Documentation/kernel-parameters.txt | 4 include/linux/initrd.h | 2 ++ init/Makefile | 3 --- init/initramfs.c| 14 +- init/noinitramfs.c | 4 +++- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 8849049..a8cb75e 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -102,6 +102,7 @@ parameter is applicable: PPT Parallel port support is enabled. PS2 Appropriate PS/2 support is enabled. RAM RAM disk support is enabled. + RAMFS Initial RAM filesystem support is enabled. S390S390 architecture is enabled. SCSIAppropriate SCSI support is enabled. A lot of drivers have their options described inside @@ -2211,6 +2212,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted. noisapnp[ISAPNP] Disables ISA PnP code. + noinitramfs [RAMFS] Tells the kernel not to load any configured + initial RAM filesystem. + noinitrd[RAM] Tells the kernel not to load any configured initial RAM disk. diff --git a/include/linux/initrd.h b/include/linux/initrd.h index 55289d2..f627ce6 100644 --- a/include/linux/initrd.h +++ b/include/linux/initrd.h @@ -17,4 +17,6 @@ extern int initrd_below_start_ok; extern unsigned long initrd_start, initrd_end; extern void free_initrd_mem(unsigned long, unsigned long); +extern int default_rootfs(void); + extern unsigned int real_root_dev; diff --git a/init/Makefile b/init/Makefile index 7bc47ee..692b91f 100644 --- a/init/Makefile +++ b/init/Makefile @@ -3,11 +3,8 @@ # obj-y := main.o version.o mounts.o -ifneq ($(CONFIG_BLK_DEV_INITRD),y) obj-y += noinitramfs.o -else obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o -endif obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o ifneq ($(CONFIG_ARCH_INIT_TASK),y) diff --git a/init/initramfs.c b/init/initramfs.c index a8497fa..cae8cee 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -580,9 +580,21 @@ static void __init clean_rootfs(void) } #endif +static int __initdata skip_initramfs; +static int __init noinitramfs_param(char *str) +{ + skip_initramfs = 1; + return 1; +} +__setup(noinitramfs, noinitramfs_param); + static int __init populate_rootfs(void) { - char *err = unpack_to_rootfs(__initramfs_start, __initramfs_size); + char *err; + + if (skip_initramfs) + return default_rootfs(); + err = unpack_to_rootfs(__initramfs_start, __initramfs_size); if (err) panic(%s, err); /* Failed to decompress INTERNAL initramfs */ if (initrd_start) { diff --git a/init/noinitramfs.c b/init/noinitramfs.c index 267739d..e7e828a 100644 --- a/init/noinitramfs.c +++ b/init/noinitramfs.c @@ -25,7 +25,7 @@ /* * Create a simple rootfs that is similar to the default initramfs */ -static int __init default_rootfs(void) +int __init default_rootfs(void) { int err; @@ -49,4 +49,6 @@ out: printk(KERN_WARNING Failed to create a rootfs\n); return err; } +#ifndef CONFIG_BLK_DEV_INITRD rootfs_initcall(default_rootfs); +#endif -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/