[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V2 23/33] xen/arm: Allow Xen to run on multiple platform without recompilation



On Wed, 2013-05-08 at 03:33 +0100, Julien Grall wrote:
> diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
> index bfc41c2..1114fe7 100644
> --- a/xen/arch/arm/time.c
> +++ b/xen/arch/arm/time.c
> @@ -33,6 +33,7 @@
>  #include <asm/time.h>
>  #include <asm/gic.h>
>  #include <asm/cpufeature.h>
> +#include <asm/platform.h>
>  
>  /*
>   * Unfortunately the hypervisor timer interrupt appears to be buggy in
> @@ -130,6 +131,11 @@ int __init init_xen_time(void)
>          panic("CPU does not support the Generic Timer v1 interface.\n");
>  
>      cpu_khz = READ_SYSREG32(CNTFRQ_EL0) / 1000;

Might be better to read this after platform_init_time, in case p_i_t
does something "magic" on this platform?

> +/* Helper to read/write a register */
> +static inline uint32_t platform_read_register(uint32_t addr)
> +{
> +    volatile const uint32_t *reg;
> +    uint32_t value;
> +
> +    set_fixmap(FIXMAP_MISC, addr >> PAGE_SHIFT, DEV_SHARED);
> +    reg = (uint32_t *)(FIXMAP_ADDR(FIXMAP_MISC) + (addr & ~PAGE_MASK));
> +    value = *reg;
> +    dsb(); isb();
> +    clear_fixmap(FIXMAP_MISC);

I don't think the fixmap is per-PCPU so you probably want some locking
here.

FIXMAP_MISC is a bit of an awful thing, but this isn't especially new,
so OK.

> +
> +    return value;
> +}
> +
> +static inline void platform_write_register(uint32_t addr, uint32_t value)
> +{
> +    volatile uint32_t *reg;
> +
> +    set_fixmap(FIXMAP_MISC, addr >> PAGE_SHIFT, DEV_SHARED);
> +    reg = (uint32_t *)(FIXMAP_ADDR(FIXMAP_MISC) + (addr & ~PAGE_MASK));
> +    *reg = value;
> +    clear_fixmap(FIXMAP_MISC);
> +}
> +

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.