|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 08/22] xen/arm: p2m: Simplify p2m type check by using bitmask
On Wed, 20 Jul 2016, Julien Grall wrote:
> The resulting assembly code for the macros is much simpler and will
> never contain more than one instruction branch.
>
> The idea is taken from x86 (see include/asm-x86/p2m.h). Also move the
> two helpers earlier to keep all the p2m type definitions together.
>
> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> xen/include/asm-arm/p2m.h | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
> index dbbcefe..3091c04 100644
> --- a/xen/include/asm-arm/p2m.h
> +++ b/xen/include/asm-arm/p2m.h
> @@ -97,6 +97,17 @@ typedef enum {
> p2m_max_real_type, /* Types after this won't be store in the p2m */
> } p2m_type_t;
>
> +/* We use bitmaps and mask to handle groups of types */
> +#define p2m_to_mask(_t) (1UL << (_t))
> +
> +/* RAM types, which map to real machine frames */
> +#define P2M_RAM_TYPES (p2m_to_mask(p2m_ram_rw) | \
> + p2m_to_mask(p2m_ram_ro))
> +
> +/* Useful predicates */
> +#define p2m_is_ram(_t) (p2m_to_mask(_t) & P2M_RAM_TYPES)
> +#define p2m_is_foreign(_t) (p2m_to_mask(_t) & p2m_to_mask(p2m_map_foreign))
> +
> static inline
> void p2m_mem_access_emulate_check(struct vcpu *v,
> const vm_event_response_t *rsp)
> @@ -110,9 +121,6 @@ void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
> /* Not supported on ARM. */
> }
>
> -#define p2m_is_foreign(_t) ((_t) == p2m_map_foreign)
> -#define p2m_is_ram(_t) ((_t) == p2m_ram_rw || (_t) == p2m_ram_ro)
> -
> /* Initialise vmid allocator */
> void p2m_vmid_allocator_init(void);
>
> --
> 1.9.1
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |