[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XenPPC] [pushed][ppc] include the x86 versions of files instead of copying the, this makes it far easier to track
changeset: 9452:217c877d726c user: jimix@xxxxxxxxxxxxxxxxxxxxx date: Thu Mar 23 16:13:30 2006 -0500 summary: [ppc] include the x86 versions of files instead of copying the, this makes it far easier to track diff -r f2036b955ff4 -r 217c877d726c xen/arch/ppc/Makefile --- a/xen/arch/ppc/Makefile Thu Mar 23 16:07:21 2006 -0500 +++ b/xen/arch/ppc/Makefile Thu Mar 23 16:13:30 2006 -0500 @@ -6,6 +6,13 @@ OBJS += $(patsubst %.c,%.o,$(wildcard mt OBJS += $(patsubst %.c,%.o,$(wildcard mtrr/*.c)) OBJS += ofh.o OBJS += papr.o + + +# +# Majik for included C files +# +C_INCLUDE= irq.c physdev.c +$(INCLUDE_C): %.c : ../x86/%.c OBJS := $(subst $(TARGET_SUBARCH)/asm-offsets.o,,$(OBJS)) diff -r f2036b955ff4 -r 217c877d726c xen/arch/ppc/Rules.mk --- a/xen/arch/ppc/Rules.mk Thu Mar 23 16:07:21 2006 -0500 +++ b/xen/arch/ppc/Rules.mk Thu Mar 23 16:13:30 2006 -0500 @@ -3,7 +3,10 @@ LD := $(CROSS_COMPILE)ld CFLAGS := -ffreestanding -fno-builtin -fno-common -fno-strict-aliasing CFLAGS += -iwithprefix include -Wall -Werror -pipe # -Wpadded -CFLAGS += -I$(BASEDIR)/include -Wpointer-arith -Wredundant-decls +CFLAGS += -I$(BASEDIR)/include +CFLAGS += -I$(BASEDIR)/include/asm-ppc/mach-generic +CFLAGS += -I$(BASEDIR)/include/asm-ppc/mach-default +CFLAGS += -Wpointer-arith -Wredundant-decls CFLAGS += -msoft-float ifeq ($(optimize),y) diff -r f2036b955ff4 -r 217c877d726c xen/arch/ppc/irq.c --- a/xen/arch/ppc/irq.c Thu Mar 23 16:07:21 2006 -0500 +++ b/xen/arch/ppc/irq.c Thu Mar 23 16:13:30 2006 -0500 @@ -1,374 +1,1 @@ -/****************************************************************************** - * arch-ppc/irq.c - * - * Portions of this file are: - * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar - */ - -#include <xen/config.h> -#include <xen/errno.h> -#include <xen/event.h> -#include <xen/irq.h> -#include <xen/perfc.h> -#include <xen/sched.h> -#include <asm/smp.h> - -irq_desc_t irq_desc[NR_IRQS]; - -static void __do_IRQ_guest(int irq); - -void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs) { } - -static void enable_none(unsigned int irq) { } -static unsigned int startup_none(unsigned int irq) { return 0; } -static void disable_none(unsigned int irq) { } -static void ack_none(unsigned int irq) -{ - printk("Unexpected IRQ trap at vector %02x.\n", irq); -#ifdef JX - ack_APIC_irq(); -#endif -} - -#define shutdown_none disable_none -#define end_none enable_none - -struct hw_interrupt_type no_irq_type = { - .typename = "none", - .startup = startup_none, - .shutdown = shutdown_none, - .enable = enable_none, - .disable = disable_none, - .ack = ack_none, - .end = end_none -}; - -atomic_t irq_err_count; -atomic_t irq_mis_count; - -inline void disable_irq_nosync(unsigned int irq) -{ - irq_desc_t *desc = &irq_desc[irq]; - unsigned long flags; - - spin_lock_irqsave(&desc->lock, flags); - - if ( desc->depth++ == 0 ) - { - desc->status |= IRQ_DISABLED; - desc->handler->disable(irq); - } - - spin_unlock_irqrestore(&desc->lock, flags); -} - -void disable_irq(unsigned int irq) -{ - disable_irq_nosync(irq); - do { smp_mb(); } while ( irq_desc[irq].status & IRQ_INPROGRESS ); -} - -void enable_irq(unsigned int irq) -{ - irq_desc_t *desc = &irq_desc[irq]; - unsigned long flags; - - spin_lock_irqsave(&desc->lock, flags); - - if ( --desc->depth == 0 ) - { - desc->status &= ~IRQ_DISABLED; - if ( (desc->status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING ) - { - desc->status |= IRQ_REPLAY; - hw_resend_irq(desc->handler,irq); - } - desc->handler->enable(irq); - } - - spin_unlock_irqrestore(&desc->lock, flags); -} - -asmlinkage void do_IRQ(unsigned int irq, struct cpu_user_regs *regs) -{ - irq_desc_t *desc = &irq_desc[irq]; - struct irqaction *action; - - perfc_incrc(irqs); - - spin_lock(&desc->lock); - desc->handler->ack(irq); - - if ( likely(desc->status & IRQ_GUEST) ) - { - __do_IRQ_guest(irq); - spin_unlock(&desc->lock); - return; - } - - desc->status &= ~IRQ_REPLAY; - desc->status |= IRQ_PENDING; - - /* - * Since we set PENDING, if another processor is handling a different - * instance of this same irq, the other processor will take care of it. - */ - if ( desc->status & (IRQ_DISABLED | IRQ_INPROGRESS) ) - goto out; - - desc->status |= IRQ_INPROGRESS; - - action = desc->action; - while ( desc->status & IRQ_PENDING ) - { - desc->status &= ~IRQ_PENDING; - irq_enter(smp_processor_id(), irq); - spin_unlock_irq(&desc->lock); - action->handler(irq, action->dev_id, regs); - spin_lock_irq(&desc->lock); - irq_exit(smp_processor_id(), irq); - } - - desc->status &= ~IRQ_INPROGRESS; - - out: - desc->handler->end(irq); - spin_unlock(&desc->lock); -} - -void free_irq(unsigned int irq) -{ - irq_desc_t *desc = &irq_desc[irq]; - unsigned long flags; - - spin_lock_irqsave(&desc->lock,flags); - desc->action = NULL; - desc->depth = 1; - desc->status |= IRQ_DISABLED; - desc->handler->shutdown(irq); - spin_unlock_irqrestore(&desc->lock,flags); - - /* Wait to make sure it's not being used on another CPU */ - do { smp_mb(); } while ( irq_desc[irq].status & IRQ_INPROGRESS ); -} - -int setup_irq(unsigned int irq, struct irqaction *new) -{ - irq_desc_t *desc = &irq_desc[irq]; - unsigned long flags; - - spin_lock_irqsave(&desc->lock,flags); - - if ( desc->action != NULL ) - { - spin_unlock_irqrestore(&desc->lock,flags); - return -EBUSY; - } - - desc->action = new; - desc->depth = 0; - desc->status &= ~IRQ_DISABLED; - desc->handler->startup(irq); - - spin_unlock_irqrestore(&desc->lock,flags); - - return 0; -} - - -/* - * HANDLING OF GUEST-BOUND PHYSICAL IRQS - */ - -#define IRQ_MAX_GUESTS 7 -typedef struct { - u8 nr_guests; - u8 in_flight; - u8 shareable; - struct domain *guest[IRQ_MAX_GUESTS]; -} irq_guest_action_t; - -static void __do_IRQ_guest(int irq) -{ - irq_desc_t *desc = &irq_desc[irq]; - irq_guest_action_t *action = (irq_guest_action_t *)desc->action; - struct domain *d; - int i; - - for ( i = 0; i < action->nr_guests; i++ ) - { - d = action->guest[i]; - if ( !test_and_set_bit(irq, &d->pirq_mask) ) - action->in_flight++; - send_guest_pirq(d, irq); - } -} - -int pirq_guest_unmask(struct domain *d) -{ - irq_desc_t *desc; - unsigned int i, j, pirq; - u32 m; - shared_info_t *s = d->shared_info; - - for ( i = 0; i < ARRAY_SIZE(d->pirq_mask); i++ ) - { - m = d->pirq_mask[i]; - while ( m != 0 ) - { - j = find_first_set_bit(m); - m &= ~(1 << j); - pirq = (i << 5) + j; - desc = &irq_desc[pirq]; - spin_lock_irq(&desc->lock); - if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) && - test_and_clear_bit(pirq, &d->pirq_mask) && - (--((irq_guest_action_t *)desc->action)->in_flight == 0) ) - desc->handler->end(pirq); - spin_unlock_irq(&desc->lock); - } - } - - return 0; -} - -int pirq_guest_bind(struct vcpu *v, int irq, int will_share) -{ - irq_desc_t *desc; - irq_guest_action_t *action; - unsigned long flags; - int rc = 0; - cpumask_t cpumask = CPU_MASK_NONE; - - if ( (irq < 0) || (irq >= NR_IRQS) ) - return -EINVAL; - - desc = &irq_desc[irq]; - - spin_lock_irqsave(&desc->lock, flags); - - action = (irq_guest_action_t *)desc->action; - - if ( !(desc->status & IRQ_GUEST) ) - { - if ( desc->action != NULL ) - { - DPRINTK("Cannot bind IRQ %d to guest. In use by '%s'.\n", - irq, desc->action->name); - rc = -EBUSY; - goto out; - } - - action = xmalloc(irq_guest_action_t); - if ( (desc->action = (struct irqaction *)action) == NULL ) - { - DPRINTK("Cannot bind IRQ %d to guest. Out of memory.\n", irq); - rc = -ENOMEM; - goto out; - } - - action->nr_guests = 0; - action->in_flight = 0; - action->shareable = will_share; - - desc->depth = 0; - desc->status |= IRQ_GUEST; - desc->status &= ~IRQ_DISABLED; - desc->handler->startup(irq); - - /* Attempt to bind the interrupt target to the correct CPU. */ - cpu_set(v->processor, cpumask); - if ( desc->handler->set_affinity != NULL ) - desc->handler->set_affinity(irq, cpumask); - } - else if ( !will_share || !action->shareable ) - { - DPRINTK("Cannot bind IRQ %d to guest. Will not share with others.\n", - irq); - rc = -EBUSY; - goto out; - } - - if ( action->nr_guests == IRQ_MAX_GUESTS ) - { - DPRINTK("Cannot bind IRQ %d to guest. Already at max share.\n", irq); - rc = -EBUSY; - goto out; - } - - action->guest[action->nr_guests++] = v->domain; - - out: - spin_unlock_irqrestore(&desc->lock, flags); - return rc; -} - -int pirq_guest_unbind(struct domain *d, int irq) -{ - irq_desc_t *desc = &irq_desc[irq]; - irq_guest_action_t *action; - unsigned long flags; - int i; - - spin_lock_irqsave(&desc->lock, flags); - - action = (irq_guest_action_t *)desc->action; - - if ( test_and_clear_bit(irq, &d->pirq_mask) && - (--action->in_flight == 0) ) - desc->handler->end(irq); - - if ( action->nr_guests == 1 ) - { - desc->action = NULL; - xfree(action); - desc->depth = 1; - desc->status |= IRQ_DISABLED; - desc->status &= ~IRQ_GUEST; - desc->handler->shutdown(irq); - } - else - { - i = 0; - while ( action->guest[i] && action->guest[i] != d ) - i++; - memmove(&action->guest[i], &action->guest[i+1], IRQ_MAX_GUESTS-i-1); - action->nr_guests--; - } - - spin_unlock_irqrestore(&desc->lock, flags); - return 0; -} - -int pirq_guest_bindable(int irq, int will_share) -{ - irq_desc_t *desc = &irq_desc[irq]; - irq_guest_action_t *action; - unsigned long flags; - int okay; - - spin_lock_irqsave(&desc->lock, flags); - - action = (irq_guest_action_t *)desc->action; - - /* - * To be bindable the IRQ must either be not currently bound (1), or - * it must be shareable (2) and not at its share limit (3). - */ - okay = ((!(desc->status & IRQ_GUEST) && (action == NULL)) || /* 1 */ - (action->shareable && will_share && /* 2 */ - (action->nr_guests != IRQ_MAX_GUESTS))); /* 3 */ - - spin_unlock_irqrestore(&desc->lock, flags); - return okay; -} - -void init_IRQ(void) -{ - int i; - - /* temporary hack */ - for (i = 0; i < NR_IRQS; i++) { - irq_desc[i].handler = &no_irq_type; - } -} +#include "../x86/irq.c" diff -r f2036b955ff4 -r 217c877d726c xen/arch/x86/irq.c --- a/xen/arch/x86/irq.c Thu Mar 23 16:07:21 2006 -0500 +++ b/xen/arch/x86/irq.c Thu Mar 23 16:13:30 2006 -0500 @@ -162,7 +162,7 @@ static void __do_IRQ_guest(int vector) for ( i = 0; i < action->nr_guests; i++ ) { d = action->guest[i]; - if ( !test_and_set_bit(irq, &d->pirq_mask) ) + if ( !test_and_set_bit(irq, &d->pirq_mask[0]) ) action->in_flight++; send_guest_pirq(d, irq); } @@ -182,11 +182,11 @@ int pirq_guest_unmask(struct domain *d) { j = find_first_set_bit(m); m &= ~(1 << j); - pirq = (i << 5) + j; + pirq = (i * (sizeof(d->pirq_mask[0]) * 8)) + j; desc = &irq_desc[irq_to_vector(pirq)]; spin_lock_irq(&desc->lock); if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) && - test_and_clear_bit(pirq, &d->pirq_mask) && + test_and_clear_bit(pirq, &d->pirq_mask[0]) && (--((irq_guest_action_t *)desc->action)->in_flight == 0) ) desc->handler->end(irq_to_vector(pirq)); spin_unlock_irq(&desc->lock); @@ -286,7 +286,7 @@ int pirq_guest_unbind(struct domain *d, action = (irq_guest_action_t *)desc->action; - if ( test_and_clear_bit(irq, &d->pirq_mask) && + if ( test_and_clear_bit(irq, &d->pirq_mask[0]) && (--action->in_flight == 0) ) desc->handler->end(vector); @@ -358,7 +358,7 @@ static void dump_irqs(unsigned char key) (test_bit(d->pirq_to_evtchn[irq], &d->shared_info->evtchn_mask[0]) ? 'M' : '-'), - (test_bit(irq, &d->pirq_mask) ? + (test_bit(irq, &d->pirq_mask[0]) ? 'M' : '-')); if ( i != action->nr_guests ) printk(","); diff -r f2036b955ff4 -r 217c877d726c xen/include/asm-ppc/hardirq.h --- a/xen/include/asm-ppc/hardirq.h Thu Mar 23 16:07:21 2006 -0500 +++ b/xen/include/asm-ppc/hardirq.h Thu Mar 23 16:13:30 2006 -0500 @@ -1,41 +1,1 @@ -/* - * Copyright (C) 2005 Hollis Blanchard <hollisb@xxxxxxxxxx>, IBM Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef _ASM_HARDIRQ_H_ -#define _ASM_HARDIRQ_H_ - -#include <xen/cache.h> - -typedef struct { - unsigned long __softirq_pending; - unsigned int __local_irq_count; -} __cacheline_aligned irq_cpustat_t; - -#include <xen/irq_cpustat.h> - -#define in_irq() (local_irq_count(smp_processor_id()) != 0) - -#define irq_enter(cpu, irq) (local_irq_count(cpu)++) -#define irq_exit(cpu, irq) (local_irq_count(cpu)--) - -extern void do_external(struct cpu_user_regs *regs); -extern int external_get_irq(ulong *irqp, ulong *maskp, uint64_t *selp, int irqs); -extern void external_init(ulong base, int little_endian); - -#endif +#include "../asm-x86/hardirq.h" diff -r f2036b955ff4 -r 217c877d726c xen/include/asm-ppc/irq.h --- a/xen/include/asm-ppc/irq.h Thu Mar 23 16:07:21 2006 -0500 +++ b/xen/include/asm-ppc/irq.h Thu Mar 23 16:13:30 2006 -0500 @@ -1,32 +1,11 @@ -/* - * Copyright (C) 2005 Hollis Blanchard <hollisb@xxxxxxxxxx>, IBM Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ +#ifndef _ASM_PPC_HW_IRQ_H +#define _ASM_PPC_HW_IRQ_H +#include "../asm-x86/irq.h" -#ifndef _ASM_IRQ_H_ -#define _ASM_IRQ_H_ +#undef vector_to_irq +#define vector_to_irq(vec) (vec) +#undef irq_to_vector +#define irq_to_vector(irq) (irq) -extern void disable_irq(unsigned int); -extern void disable_irq_nosync(unsigned int); -extern void enable_irq(unsigned int); - -struct hw_interrupt_type; -static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) -{ - return; -} +extern int assign_irq_vector (int irq); #endif diff -r f2036b955ff4 -r 217c877d726c xen/include/asm-x86/hardirq.h --- a/xen/include/asm-x86/hardirq.h Thu Mar 23 16:07:21 2006 -0500 +++ b/xen/include/asm-x86/hardirq.h Thu Mar 23 16:13:30 2006 -0500 @@ -5,7 +5,7 @@ #include <xen/cache.h> typedef struct { - unsigned int __softirq_pending; + unsigned long __softirq_pending; unsigned int __local_irq_count; unsigned int __nmi_count; unsigned long idle_timestamp; diff -r f2036b955ff4 -r 217c877d726c xen/arch/ppc/physdev.c --- /dev/null Thu Jan 1 00:00:00 1970 +0000 +++ b/xen/arch/ppc/physdev.c Thu Mar 23 16:13:30 2006 -0500 @@ -0,0 +1,1 @@ +#include "../x86/physdev.c" diff -r f2036b955ff4 -r 217c877d726c xen/include/asm-ppc/asm_defns.h --- /dev/null Thu Jan 1 00:00:00 1970 +0000 +++ b/xen/include/asm-ppc/asm_defns.h Thu Mar 23 16:13:30 2006 -0500 @@ -0,0 +1,8 @@ +#ifndef __PPC_ASM_DEFNS_H__ +#define __PPC_ASM_DEFNS_H__ + +/* NB. Auto-generated from arch/.../asm-offsets.c */ +#include <asm/asm-offsets.h> +#include <asm/processor.h> + +#endif /* __PPC_ASM_DEFNS_H__ */ diff -r f2036b955ff4 -r 217c877d726c xen/include/asm-ppc/mach-default/irq_vectors.h --- /dev/null Thu Jan 1 00:00:00 1970 +0000 +++ b/xen/include/asm-ppc/mach-default/irq_vectors.h Thu Mar 23 16:13:30 2006 -0500 @@ -0,0 +1,103 @@ +/* + * This file should contain #defines for all of the interrupt vector + * numbers used by this architecture. + * + * In addition, there are some standard defines: + * + * FIRST_EXTERNAL_VECTOR: + * The first free place for external interrupts + * + * SYSCALL_VECTOR: + * The IRQ vector a syscall makes the user to kernel transition + * under. + * + * TIMER_IRQ: + * The IRQ number the timer interrupt comes in at. + * + * NR_IRQS: + * The total number of interrupt vectors (including all the + * architecture specific interrupts) needed. + * + */ +#ifndef _ASM_IRQ_VECTORS_H +#define _ASM_IRQ_VECTORS_H + +/* + * IDT vectors usable for external interrupt sources start + * at 0x0: + */ +#define FIRST_EXTERNAL_VECTOR 0x0 +#define FIRST_DEVICE_VECTOR 0 +#define NR_IRQS 256 +#define NR_VECTORS NR_IRQS +#define NR_IRQ_VECTORS NR_IRQS +#define HYPERCALL_VECTOR -1 +#define FAST_TRAP -1 /* 0x80 */ +#define FIRST_SYSTEM_VECTOR -1 + +#if 0 + +/* + * Vectors 0-16 in some cases are used for ISA interrupts. + */ + +/* + * Special IRQ vectors used by the SMP architecture, 0xf0-0xff + * + * some of the following vectors are 'rare', they are merged + * into a single vector (CALL_FUNCTION_VECTOR) to save vector space. + * TLB, reschedule and local APIC vectors are performance-critical. + * + * Vectors 0xf0-0xfa are free (reserved for future Linux use). + */ +#define SPURIOUS_APIC_VECTOR 0xff +#define ERROR_APIC_VECTOR 0xfe +#define INVALIDATE_TLB_VECTOR 0xfd +#define EVENT_CHECK_VECTOR 0xfc +#define CALL_FUNCTION_VECTOR 0xfb + +#define THERMAL_APIC_VECTOR 0xf0 +/* + * Local APIC timer IRQ vector is on a different priority level, + * to work around the 'lost local interrupt if more than 2 IRQ + * sources per level' errata. + */ +#define LOCAL_TIMER_VECTOR 0xef + +/* + * First APIC vector available to drivers: (vectors 0x30-0xee) + * we start at 0x31 to spread out vectors evenly between priority + * levels. (0x80 is the syscall vector) + */ +#define FIRST_DEVICE_VECTOR 0x31 +#define FIRST_SYSTEM_VECTOR 0xef + +#define TIMER_IRQ 0 + +/* + * 16 8259A IRQ's, 208 potential APIC interrupt sources. + * Right now the APIC is mostly only used for SMP. + * 256 vectors is an architectural limit. (we can have + * more than 256 devices theoretically, but they will + * have to use shared interrupts) + * Since vectors 0x00-0x1f are used/reserved for the CPU, + * the usable vector space is 0x20-0xff (224 vectors) + */ + +/* + * The maximum number of vectors supported by i386 processors + * is limited to 256. For processors other than i386, NR_VECTORS + * should be changed accordingly. + */ +#define NR_VECTORS 256 + +#include "irq_vectors_limits.h" + +#define FPU_IRQ 13 + +#define FIRST_VM86_IRQ 3 +#define LAST_VM86_IRQ 15 +#define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15) + +#endif // 0 +#endif /* _ASM_IRQ_VECTORS_H */ diff -r f2036b955ff4 -r 217c877d726c xen/include/asm-ppc/smpboot.h --- /dev/null Thu Jan 1 00:00:00 1970 +0000 +++ b/xen/include/asm-ppc/smpboot.h Thu Mar 23 16:13:30 2006 -0500 @@ -0,0 +1,1 @@ +#include "../asm-x86/smpboot.h" _______________________________________________ Xen-ppc-devel mailing list Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-ppc-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |