[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] irq cleanup
Make IRQ related data const or __read_mostly where possible/reasonable, use platform_legacy_irq() where feasible, and remove the now unused definition of vector_to_irq(). Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx> --- 2009-10-27.orig/xen/arch/ia64/linux-xen/iosapic.c 2009-06-05 11:59:48.000000000 +0200 +++ 2009-10-27/xen/arch/ia64/linux-xen/iosapic.c 2009-10-27 12:04:10.000000000 +0100 @@ -430,7 +430,7 @@ iosapic_end_level_irq (unsigned int irq) #define iosapic_disable_level_irq mask_irq #define iosapic_ack_level_irq nop -struct hw_interrupt_type irq_type_iosapic_level = { +static hw_irq_controller irq_type_iosapic_level = { .typename = "IO-SAPIC-level", .startup = iosapic_startup_level_irq, .shutdown = iosapic_shutdown_level_irq, @@ -476,7 +476,7 @@ iosapic_ack_edge_irq (unsigned int irq) #define iosapic_disable_edge_irq nop #define iosapic_end_edge_irq nop -struct hw_interrupt_type irq_type_iosapic_edge = { +static hw_irq_controller irq_type_iosapic_edge = { .typename = "IO-SAPIC-edge", .startup = iosapic_startup_edge_irq, .shutdown = iosapic_disable_edge_irq, @@ -605,7 +605,7 @@ register_intr (unsigned int gsi, int vec unsigned long polarity, unsigned long trigger) { irq_desc_t *idesc; - struct hw_interrupt_type *irq_type; + hw_irq_controller *irq_type; int rte_index; int index; unsigned long gsi_base; --- 2009-10-27.orig/xen/arch/ia64/linux-xen/irq_ia64.c 2009-03-31 17:55:50.000000000 +0200 +++ 2009-10-27/xen/arch/ia64/linux-xen/irq_ia64.c 2009-10-27 12:04:10.000000000 +0100 @@ -233,7 +233,7 @@ void ia64_process_pending_intr(void) #ifdef CONFIG_SMP extern irqreturn_t handle_IPI (int irq, void *dev_id, struct pt_regs *regs); -static struct irqaction ipi_irqaction = { +static struct irqaction __read_mostly ipi_irqaction = { .handler = handle_IPI, #ifndef XEN .flags = SA_INTERRUPT, --- 2009-10-27.orig/xen/arch/ia64/linux-xen/mca.c 2009-05-27 13:54:05.000000000 +0200 +++ 2009-10-27/xen/arch/ia64/linux-xen/mca.c 2009-10-27 12:04:10.000000000 +0100 @@ -1563,7 +1563,7 @@ ia64_mca_disable_cpe_polling(char *str) __setup("disable_cpe_poll", ia64_mca_disable_cpe_polling); -static struct irqaction cmci_irqaction = { +static struct irqaction __read_mostly cmci_irqaction = { .handler = ia64_mca_cmc_int_handler, #ifndef XEN .flags = SA_INTERRUPT, @@ -1571,7 +1571,7 @@ static struct irqaction cmci_irqaction = .name = "cmc_hndlr" }; -static struct irqaction cmcp_irqaction = { +static struct irqaction __read_mostly cmcp_irqaction = { .handler = ia64_mca_cmc_int_caller, #ifndef XEN .flags = SA_INTERRUPT, @@ -1579,7 +1579,7 @@ static struct irqaction cmcp_irqaction = .name = "cmc_poll" }; -static struct irqaction mca_rdzv_irqaction = { +static struct irqaction __read_mostly mca_rdzv_irqaction = { .handler = ia64_mca_rendez_int_handler, #ifndef XEN .flags = SA_INTERRUPT, @@ -1587,7 +1587,7 @@ static struct irqaction mca_rdzv_irqacti .name = "mca_rdzv" }; -static struct irqaction mca_wkup_irqaction = { +static struct irqaction __read_mostly mca_wkup_irqaction = { .handler = ia64_mca_wakeup_int_handler, #ifndef XEN .flags = SA_INTERRUPT, @@ -1596,7 +1596,7 @@ static struct irqaction mca_wkup_irqacti }; #ifdef CONFIG_ACPI -static struct irqaction mca_cpe_irqaction = { +static struct irqaction __read_mostly mca_cpe_irqaction = { .handler = ia64_mca_cpe_int_handler, #ifndef XEN .flags = SA_INTERRUPT, @@ -1604,7 +1604,7 @@ static struct irqaction mca_cpe_irqactio .name = "cpe_hndlr" }; -static struct irqaction mca_cpep_irqaction = { +static struct irqaction __read_mostly mca_cpep_irqaction = { .handler = ia64_mca_cpe_int_caller, #ifndef XEN .flags = SA_INTERRUPT, --- 2009-10-27.orig/xen/arch/ia64/linux-xen/perfmon.c 2009-07-15 16:34:16.000000000 +0200 +++ 2009-10-27/xen/arch/ia64/linux-xen/perfmon.c 2009-10-27 12:04:10.000000000 +0100 @@ -6811,7 +6811,7 @@ pfm_flush_pmds(struct task_struct *task, #endif } -static struct irqaction perfmon_irqaction = { +static struct irqaction __read_mostly perfmon_irqaction = { .handler = pfm_interrupt_handler, #ifndef XEN .flags = SA_INTERRUPT, --- 2009-10-27.orig/xen/arch/ia64/linux-xen/sn/kernel/irq.c 2008-10-24 11:21:38.000000000 +0200 +++ 2009-10-27/xen/arch/ia64/linux-xen/sn/kernel/irq.c 2009-10-27 12:04:10.000000000 +0100 @@ -221,7 +221,7 @@ static void sn_set_affinity_irq(unsigned } #endif -struct hw_interrupt_type irq_type_sn = { +static hw_irq_controller irq_type_sn = { #ifndef XEN .name = "SN hub", #else --- 2009-10-27.orig/xen/arch/ia64/linux/irq_lsapic.c 2005-11-17 15:51:03.000000000 +0100 +++ 2009-10-27/xen/arch/ia64/linux/irq_lsapic.c 2009-10-27 12:04:10.000000000 +0100 @@ -26,7 +26,7 @@ lsapic_noop (unsigned int irq) /* nuthing to do... */ } -struct hw_interrupt_type irq_type_ia64_lsapic = { +hw_irq_controller irq_type_ia64_lsapic = { .typename = "LSAPIC", .startup = lsapic_noop_startup, .shutdown = lsapic_noop, --- 2009-10-27.orig/xen/arch/ia64/xen/irq.c 2009-08-24 08:41:26.000000000 +0200 +++ 2009-10-27/xen/arch/ia64/xen/irq.c 2009-10-27 12:04:10.000000000 +0100 @@ -118,7 +118,7 @@ static void ack_none(unsigned int irq) #define shutdown_none disable_none #define end_none enable_none -struct hw_interrupt_type no_irq_type = { +hw_irq_controller no_irq_type = { "none", startup_none, shutdown_none, --- 2009-10-27.orig/xen/arch/ia64/xen/xentime.c 2008-04-08 12:12:42.000000000 +0200 +++ 2009-10-27/xen/arch/ia64/xen/xentime.c 2009-10-27 12:04:10.000000000 +0100 @@ -154,7 +154,7 @@ xen_timer_interrupt (int irq, void *dev_ raise_softirq(TIMER_SOFTIRQ); } -static struct irqaction xen_timer_irqaction = { +static struct irqaction __read_mostly xen_timer_irqaction = { .handler = (void *) xen_timer_interrupt, .name = "timer" }; --- 2009-10-27.orig/xen/arch/x86/hpet.c 2009-10-26 14:42:47.000000000 +0100 +++ 2009-10-27/xen/arch/x86/hpet.c 2009-10-27 12:04:10.000000000 +0100 @@ -319,7 +319,7 @@ static void hpet_msi_set_affinity(unsign /* * IRQ Chip for MSI HPET Devices, */ -static struct hw_interrupt_type hpet_msi_type = { +static hw_irq_controller hpet_msi_type = { .typename = "HPET-MSI", .startup = hpet_msi_startup, .shutdown = hpet_msi_shutdown, --- 2009-10-27.orig/xen/arch/x86/hvm/irq.c 2009-07-03 10:20:57.000000000 +0200 +++ 2009-10-27/xen/arch/x86/hvm/irq.c 2009-10-27 12:04:10.000000000 +0100 @@ -507,7 +507,7 @@ static int irq_load_isa(struct domain *d /* Adjust the GSI assert counts for the ISA IRQ line state. * This relies on the PCI IRQ state being loaded first. */ - for ( irq = 0; irq < 16; irq++ ) + for ( irq = 0; platform_legacy_irq(irq); irq++ ) if ( test_bit(irq, &hvm_irq->isa_irq.i) ) hvm_irq->gsi_assert_count[hvm_isa_irq_to_gsi(irq)]++; --- 2009-10-27.orig/xen/arch/x86/i8259.c 2009-10-07 13:31:36.000000000 +0200 +++ 2009-10-27/xen/arch/x86/i8259.c 2009-10-27 12:04:10.000000000 +0100 @@ -97,7 +97,7 @@ static void end_8259A_irq(unsigned int i enable_8259A_irq(irq); } -static struct hw_interrupt_type i8259A_irq_type = { +static struct hw_interrupt_type __read_mostly i8259A_irq_type = { .typename = "XT-PIC", .startup = startup_8259A_irq, .shutdown = disable_8259A_irq, @@ -347,7 +347,7 @@ void __devinit init_8259A(int auto_eoi) spin_unlock_irqrestore(&i8259A_lock, flags); } -static struct irqaction cascade = { no_action, "cascade", NULL}; +static struct irqaction __read_mostly cascade = { no_action, "cascade", NULL}; void __init init_IRQ(void) { @@ -366,7 +366,7 @@ void __init init_IRQ(void) set_intr_gate(vector, interrupt[vector]); } - for (irq = 0; irq < 16; irq++) { + for (irq = 0; platform_legacy_irq(irq); irq++) { struct irq_desc *desc = irq_to_desc(irq); struct irq_cfg *cfg = desc->chip_data; --- 2009-10-27.orig/xen/arch/x86/io_apic.c 2009-10-26 14:42:47.000000000 +0100 +++ 2009-10-27/xen/arch/x86/io_apic.c 2009-10-27 12:05:25.000000000 +0100 @@ -62,7 +62,8 @@ int sis_apic_bug = -1; /* * # of IRQ routing registers */ -int nr_ioapic_registers[MAX_IO_APICS]; +int __read_mostly nr_ioapic_registers[MAX_IO_APICS]; +int __read_mostly nr_ioapics; int disable_timer_pin_1 __initdata; @@ -497,7 +498,7 @@ void /*__init*/ setup_ioapic_dest(void) */ static int EISA_ELCR(unsigned int irq) { - if (irq < 16) { + if (platform_legacy_irq(irq)) { unsigned int port = 0x4d0 + (irq >> 3); return (inb(port) >> (irq & 7)) & 1; } @@ -763,8 +764,8 @@ static inline int IO_APIC_irq_trigger(in return 0; } -static struct hw_interrupt_type ioapic_level_type; -static struct hw_interrupt_type ioapic_edge_type; +static hw_irq_controller ioapic_level_type; +static hw_irq_controller ioapic_edge_type; #define IOAPIC_AUTO -1 #define IOAPIC_EDGE 0 @@ -844,7 +845,7 @@ static void __init setup_IO_APIC_irqs(vo entry.vector = vector; ioapic_register_intr(irq, IOAPIC_AUTO); - if (!apic && (irq < 16)) + if (!apic && platform_legacy_irq(irq)) disable_8259A_irq(irq); } cfg = irq_cfg(irq); @@ -1358,7 +1359,7 @@ static unsigned int startup_edge_ioapic_ unsigned long flags; spin_lock_irqsave(&ioapic_lock, flags); - if (irq < 16) { + if (platform_legacy_irq(irq)) { disable_8259A_irq(irq); if (i8259A_irq_pending(irq)) was_pending = 1; @@ -1408,7 +1409,7 @@ static unsigned int startup_level_ioapic return 0; /* don't check for pending */ } -int ioapic_ack_new = 1; +int __read_mostly ioapic_ack_new = 1; static void setup_ioapic_ack(char *s) { if ( !strcmp(s, "old") ) @@ -1572,7 +1573,7 @@ static void end_edge_ioapic_irq(unsigned * edge-triggered handler, without risking IRQ storms and other ugly * races. */ -static struct hw_interrupt_type ioapic_edge_type = { +static hw_irq_controller ioapic_edge_type = { .typename = "IO-APIC-edge", .startup = startup_edge_ioapic_irq, .shutdown = disable_edge_ioapic_irq, @@ -1583,7 +1584,7 @@ static struct hw_interrupt_type ioapic_e .set_affinity = set_ioapic_affinity_irq, }; -static struct hw_interrupt_type ioapic_level_type = { +static hw_irq_controller ioapic_level_type = { .typename = "IO-APIC-level", .startup = startup_level_ioapic_irq, .shutdown = mask_IO_APIC_irq, @@ -1631,7 +1632,7 @@ static void set_msi_affinity_irq(unsigne * IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices, * which implement the MSI or MSI-X Capability Structure. */ -struct hw_interrupt_type pci_msi_type = { +hw_irq_controller pci_msi_type = { .typename = "PCI-MSI", .startup = startup_msi_irq, .shutdown = shutdown_msi_irq, @@ -1646,7 +1647,7 @@ static inline void init_IO_APIC_traps(vo { int irq; /* Xen: This is way simpler than the Linux implementation. */ - for (irq = 0; irq < 16 ; irq++) + for (irq = 0; platform_legacy_irq(irq); irq++) if (IO_APIC_IRQ(irq) && !IO_APIC_VECTOR(irq)) make_8259A_irq(irq); } @@ -1674,7 +1675,7 @@ static void ack_lapic_irq(unsigned int i static void end_lapic_irq(unsigned int irq) { /* nothing */ } -static struct hw_interrupt_type lapic_irq_type = { +static hw_irq_controller lapic_irq_type = { .typename = "local-APIC-edge", .startup = NULL, /* startup_irq() not used for IRQ0 */ .shutdown = NULL, /* shutdown_irq() not used for IRQ0 */ @@ -2107,7 +2108,7 @@ int io_apic_set_pci_routing (int ioapic, /* * IRQs < 16 are already in the irq_2_pin[] map */ - if (irq >= 16) + if (!platform_legacy_irq(irq)) add_pin_to_irq(irq, ioapic, pin); vector = assign_irq_vector(irq); @@ -2122,7 +2123,7 @@ int io_apic_set_pci_routing (int ioapic, ioapic_register_intr(irq, edge_level); - if (!ioapic && (irq < 16)) + if (!ioapic && platform_legacy_irq(irq)) disable_8259A_irq(irq); spin_lock_irqsave(&ioapic_lock, flags); --- 2009-10-27.orig/xen/arch/x86/irq.c 2009-10-26 14:42:47.000000000 +0100 +++ 2009-10-27/xen/arch/x86/irq.c 2009-10-27 12:04:10.000000000 +0100 @@ -24,7 +24,7 @@ #include <public/physdev.h> /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */ -int opt_noirqbalance = 0; +int __read_mostly opt_noirqbalance = 0; boolean_param("noirqbalance", opt_noirqbalance); unsigned int __read_mostly nr_irqs_gsi = 16; @@ -45,7 +45,7 @@ DECLARE_BITMAP(used_vectors, NR_VECTORS) struct irq_cfg __read_mostly *irq_cfg = NULL; -static struct timer *irq_guest_eoi_timer; +static struct timer *__read_mostly irq_guest_eoi_timer; static DEFINE_SPINLOCK(vector_lock); @@ -60,7 +60,7 @@ static DEFINE_SPINLOCK(irq_ratelimit_loc static struct timer irq_ratelimit_timer; /* irq_ratelimit: the max irq rate allowed in every 10ms, set 0 to disable */ -unsigned int __read_mostly irq_ratelimit_threshold = 10000; +static unsigned int __read_mostly irq_ratelimit_threshold = 10000; integer_param("irq_ratelimit", irq_ratelimit_threshold); /* Must be called when irq disabled */ @@ -321,7 +321,7 @@ static void ack_none(unsigned int irq) #define shutdown_none disable_none #define end_none enable_none -struct hw_interrupt_type no_irq_type = { +hw_irq_controller no_irq_type = { "none", startup_none, shutdown_none, --- 2009-10-27.orig/xen/arch/x86/mpparse.c 2009-09-03 08:55:14.000000000 +0200 +++ 2009-10-27/xen/arch/x86/mpparse.c 2009-10-27 12:04:10.000000000 +0100 @@ -58,8 +58,6 @@ struct mpc_config_intsrc mp_irqs[MAX_IRQ /* MP IRQ source entries */ int mp_irq_entries; -int nr_ioapics; - int pic_mode; unsigned long mp_lapic_addr; @@ -525,7 +523,7 @@ static void __init construct_default_ioi } } - for (i = 0; i < 16; i++) { + for (i = 0; platform_legacy_irq(i); i++) { switch (mpc_default_type) { case 2: if (i == 0 || i == 13) @@ -1037,7 +1035,7 @@ void __init mp_config_acpi_legacy_irqs ( * Use the default configuration for the IRQs 0-15. Unless * overriden by (MADT) interrupt source override entries. */ - for (i = 0; i < 16; i++) { + for (i = 0; platform_legacy_irq(i); i++) { int idx; for (idx = 0; idx < mp_irq_entries; idx++) { --- 2009-10-27.orig/xen/arch/x86/time.c 2009-10-22 08:18:54.000000000 +0200 +++ 2009-10-27/xen/arch/x86/time.c 2009-10-27 12:04:10.000000000 +0100 @@ -232,7 +232,7 @@ static void timer_interrupt(int irq, voi } } -static struct irqaction irq0 = { timer_interrupt, "timer", NULL }; +static struct irqaction __read_mostly irq0 = { timer_interrupt, "timer", NULL }; /* ------ Calibrate the TSC ------- * Return processor ticks per second / CALIBRATE_FRAC. --- 2009-10-27.orig/xen/common/domain.c 2009-10-22 08:18:54.000000000 +0200 +++ 2009-10-27/xen/common/domain.c 2009-10-27 12:04:10.000000000 +0100 @@ -198,7 +198,8 @@ struct vcpu *alloc_idle_vcpu(unsigned in return alloc_vcpu(d, vcpu_id, cpu_id); } -static unsigned int extra_dom0_irqs = 256, extra_domU_irqs = 32; +static unsigned int __read_mostly extra_dom0_irqs = 256; +static unsigned int __read_mostly extra_domU_irqs = 32; static void __init parse_extra_guest_irqs(const char *s) { if ( isdigit(*s) ) --- 2009-10-27.orig/xen/drivers/passthrough/amd/iommu_init.c 2009-10-01 10:53:02.000000000 +0200 +++ 2009-10-27/xen/drivers/passthrough/amd/iommu_init.c 2009-10-27 12:04:10.000000000 +0100 @@ -406,7 +406,7 @@ static void iommu_msi_end(unsigned int i } -static struct hw_interrupt_type iommu_msi_type = { +static hw_irq_controller iommu_msi_type = { .typename = "AMD_IOV_MSI", .startup = iommu_msi_startup, .shutdown = iommu_msi_mask, --- 2009-10-27.orig/xen/drivers/passthrough/vtd/iommu.c 2009-10-22 08:18:54.000000000 +0200 +++ 2009-10-27/xen/drivers/passthrough/vtd/iommu.c 2009-10-27 12:04:10.000000000 +0100 @@ -871,7 +871,7 @@ static void dma_msi_set_affinity(unsigne spin_unlock_irqrestore(&iommu->register_lock, flags); } -static struct hw_interrupt_type dma_msi_type = { +static hw_irq_controller dma_msi_type = { .typename = "DMA_MSI", .startup = dma_msi_startup, .shutdown = dma_msi_mask, --- 2009-10-27.orig/xen/include/asm-ia64/linux-xen/asm/hw_irq.h 2009-03-31 17:55:50.000000000 +0200 +++ 2009-10-27/xen/include/asm-ia64/linux-xen/asm/hw_irq.h 2009-10-27 12:04:10.000000000 +0100 @@ -79,7 +79,7 @@ enum { extern __u8 isa_irq_to_vector_map[16]; #define isa_irq_to_vector(x) isa_irq_to_vector_map[(x)] -extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */ +extern hw_irq_controller irq_type_ia64_lsapic; /* CPU-internal interrupt controller */ extern int assign_irq_vector (int irq); /* allocate a free vector */ extern void free_irq_vector (int vector); @@ -91,7 +91,7 @@ extern int setup_vector(unsigned int vec #endif static inline void -hw_resend_irq (struct hw_interrupt_type *h, unsigned int vector) +hw_resend_irq (hw_irq_controller *h, unsigned int vector) { platform_send_ipi(smp_processor_id(), vector, IA64_IPI_DM_INT, 0); } --- 2009-10-27.orig/xen/include/asm-x86/irq.h 2009-10-26 14:42:47.000000000 +0100 +++ 2009-10-27/xen/include/asm-x86/irq.h 2009-10-27 12:04:10.000000000 +0100 @@ -10,8 +10,9 @@ #include <irq_vectors.h> #include <asm/percpu.h> -#define IO_APIC_IRQ(irq) (((irq) >= 16 && (irq) < nr_irqs_gsi) \ - || (((irq) < 16) && (1<<(irq)) & io_apic_irqs)) +#define IO_APIC_IRQ(irq) (platform_legacy_irq(irq) ? \ + (1 << (irq)) & io_apic_irqs : \ + (irq) < nr_irqs_gsi) #define IO_APIC_VECTOR(irq) (irq_vector[irq]) #define MSI_IRQ(irq) ((irq) >= nr_irqs_gsi && (irq) < nr_irqs) @@ -19,14 +20,12 @@ #define LEGACY_VECTOR(irq) ((irq) + FIRST_LEGACY_VECTOR) #define LEGACY_IRQ_FROM_VECTOR(vec) ((vec) - FIRST_LEGACY_VECTOR) -#define vector_to_irq(vec) (vector_irq[vec]) -#define irq_to_desc(irq) &irq_desc[(irq)] +#define irq_to_desc(irq) (&irq_desc[irq]) +#define irq_cfg(irq) (&irq_cfg[irq]) #define MAX_GSI_IRQS PAGE_SIZE * 8 #define MAX_NR_IRQS (2 * MAX_GSI_IRQS) -#define irq_cfg(irq) &irq_cfg[(irq)] - struct irq_cfg { int vector; cpumask_t domain; --- 2009-10-27.orig/xen/include/asm-x86/msi.h 2009-10-01 10:53:02.000000000 +0200 +++ 2009-10-27/xen/include/asm-x86/msi.h 2009-10-27 12:04:10.000000000 +0100 @@ -117,7 +117,7 @@ int msi_free_irq(struct msi_desc *entry) */ #define NR_HP_RESERVED_VECTORS 20 -extern struct hw_interrupt_type pci_msi_type; +extern const struct hw_interrupt_type pci_msi_type; /* * MSI-X Address Register --- 2009-10-27.orig/xen/include/xen/irq.h 2009-10-26 14:42:47.000000000 +0100 +++ 2009-10-27/xen/include/xen/irq.h 2009-10-27 12:04:10.000000000 +0100 @@ -47,7 +47,7 @@ struct hw_interrupt_type { void (*set_affinity)(unsigned int irq, cpumask_t mask); }; -typedef struct hw_interrupt_type hw_irq_controller; +typedef const struct hw_interrupt_type hw_irq_controller; #include <asm/irq.h> _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |