[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 11/16] xen/arm: move vgic defines to vgic header file
From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> gic.h contains defines of vgic. Move these to vgic header file. Also move inline functions and defines in vgic.c to vgic.h Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> --- xen/arch/arm/irq.c | 1 + xen/arch/arm/time.c | 1 + xen/arch/arm/vgic.c | 41 -------------------------------------- xen/arch/arm/vpsci.c | 1 + xen/arch/arm/vtimer.c | 1 + xen/include/asm-arm/gic.h | 10 +--------- xen/include/asm-arm/vgic.h | 47 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 52 insertions(+), 50 deletions(-) diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index 5daa269..4686c85 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -26,6 +26,7 @@ #include <xen/sched.h> #include <asm/gic.h> +#include <asm/vgic.h> static void enable_none(struct irq_desc *irq) { } static unsigned int startup_none(struct irq_desc *irq) { return 0; } diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c index ae09c6b..953b0b0 100644 --- a/xen/arch/arm/time.c +++ b/xen/arch/arm/time.c @@ -32,6 +32,7 @@ #include <asm/system.h> #include <asm/time.h> #include <asm/gic.h> +#include <asm/vgic.h> #include <asm/cpufeature.h> #include <asm/platform.h> diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index f73247d..7e258ae 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -34,28 +34,9 @@ #define REG(n) (n/4) -/* Number of ranks of interrupt registers for a domain */ -#define DOMAIN_NR_RANKS(d) (((d)->arch.vgic.nr_lines+31)/32) - static struct mmio_handler vgic_distr_mmio_handler; /* - * Rank containing GICD_<FOO><n> for GICD_<FOO> with - * <b>-bits-per-interrupt - */ -static inline int REG_RANK_NR(int b, uint32_t n) -{ - switch ( b ) - { - case 8: return n >> 3; - case 4: return n >> 2; - case 2: return n >> 1; - case 1: return n; - default: BUG(); - } -} - -/* * Offset of GICD_<FOO><n> with its rank, for GICD_<FOO> with * <b>-bits-per-interrupt. */ @@ -154,12 +135,6 @@ int vcpu_vgic_free(struct vcpu *v) return 0; } -#define vgic_lock(v) spin_lock_irq(&(v)->domain->arch.vgic.lock) -#define vgic_unlock(v) spin_unlock_irq(&(v)->domain->arch.vgic.lock) - -#define vgic_lock_rank(v, r) spin_lock(&(r)->lock) -#define vgic_unlock_rank(v, r) spin_unlock(&(r)->lock) - static uint32_t byte_read(uint32_t val, int sign, int offset) { int byte = offset & 0x3; @@ -425,22 +400,6 @@ static void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n) } } -static inline int is_vcpu_running(struct domain *d, int vcpuid) -{ - struct vcpu *v; - - if ( vcpuid >= d->max_vcpus ) - return 0; - - v = d->vcpu[vcpuid]; - if ( v == NULL ) - return 0; - if (test_bit(_VPF_down, &v->pause_flags) ) - return 0; - - return 1; -} - static int vgic_to_sgi(struct vcpu *v, register_t sgir) { struct domain *d = v->domain; diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c index c82884f..37e6a55 100644 --- a/xen/arch/arm/vpsci.c +++ b/xen/arch/arm/vpsci.c @@ -16,6 +16,7 @@ #include <asm/current.h> #include <asm/gic.h> +#include <asm/vgic.h> #include <asm/psci.h> int do_psci_cpu_on(uint32_t vcpuid, register_t entry_point) diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c index 87be11e..4755e1a 100644 --- a/xen/arch/arm/vtimer.c +++ b/xen/arch/arm/vtimer.c @@ -24,6 +24,7 @@ #include <asm/irq.h> #include <asm/time.h> #include <asm/gic.h> +#include <asm/vgic.h> #include <asm/regs.h> extern s_time_t ticks_to_ns(uint64_t ticks); diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index 2209f14..7489684 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -85,16 +85,8 @@ struct gic_lr { uint8_t grp; }; -extern int gic_hw_version(void); - -extern int domain_vgic_init(struct domain *d); -extern void domain_vgic_free(struct domain *d); - -extern int vcpu_vgic_init(struct vcpu *v); - -extern void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq); -extern void vgic_clear_pending_irqs(struct vcpu *v); extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq); +extern int gic_hw_version(void); /* Program the GIC to route an interrupt with a dt_irq */ extern void gic_route_dt_irq(const struct dt_irq *irq, diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index 104a87d..f9d6549 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -17,6 +17,7 @@ #ifndef __ASM_ARM_VGIC_H__ #define __ASM_ARM_VGIC_H__ +#include <xen/bitops.h> /* Represents state corresponding to a block of 32 interrupts */ struct vgic_irq_rank { @@ -27,6 +28,52 @@ struct vgic_irq_rank { uint32_t itargets[8]; }; +/* Number of ranks of interrupt registers for a domain */ +#define DOMAIN_NR_RANKS(d) (((d)->arch.vgic.nr_lines+31)/32) + +#define vgic_lock(v) spin_lock_irq(&(v)->domain->arch.vgic.lock) +#define vgic_unlock(v) spin_unlock_irq(&(v)->domain->arch.vgic.lock) + +#define vgic_lock_rank(v, r) spin_lock(&(r)->lock) +#define vgic_unlock_rank(v, r) spin_unlock(&(r)->lock) + +/* + * Rank containing GICD_<FOO><n> for GICD_<FOO> with + * <b>-bits-per-interrupt + */ +static inline int REG_RANK_NR(int b, uint32_t n) +{ + switch ( b ) + { + case 8: return n >> 3; + case 4: return n >> 2; + case 2: return n >> 1; + case 1: return n; + default: BUG(); + } +} + +static inline int is_vcpu_running(struct domain *d, int vcpuid) +{ + struct vcpu *v; + + if ( vcpuid >= d->max_vcpus ) + return 0; + + v = d->vcpu[vcpuid]; + if ( v == NULL ) + return 0; + if (test_bit(_VPF_down, &v->pause_flags) ) + return 0; + + return 1; +} + +extern int domain_vgic_init(struct domain *d); +extern void domain_vgic_free(struct domain *d); +extern int vcpu_vgic_init(struct vcpu *v); +extern void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq); +extern void vgic_clear_pending_irqs(struct vcpu *v); extern int vcpu_vgic_free(struct vcpu *v); #endif -- 1.7.9.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |