|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [RFC PATCH v1 02/12] Arm: GICv3: Move the macros to compute the affnity level to arm64/arm32
On 10/24/22 16:01, Ayan Kumar Halder wrote: On 24/10/2022 12:35, Xenia Ragiadakou wrote:Hi Ayan,Hi Xenia,On 10/24/22 14:00, Ayan Kumar Halder wrote:On 21/10/2022 22:18, Xenia Ragiadakou wrote:On 10/21/22 18:31, Ayan Kumar Halder wrote: Hi AyanHi Xenia,Refer https://elixir.bootlin.com/linux/v6.1-rc1/source/arch/arm64/ \ include/asm/cputype.h#L14 , these macros are specific for arm64. When one computes MPIDR_LEVEL_SHIFT(3), it crosses the width of a 32 bit register.Refer https://elixir.bootlin.com/linux/v6.1-rc1/source/arch/arm/include/ \asm/cputype.h#L54 , these macros are specific for arm32. Signed-off-by: Ayan Kumar Halder <ayankuma@xxxxxxx> --- xen/arch/arm/include/asm/arm32/processor.h | 10 ++++++++++ xen/arch/arm/include/asm/arm64/processor.h | 13 +++++++++++++ xen/arch/arm/include/asm/processor.h | 14 -------------- 3 files changed, 23 insertions(+), 14 deletions(-)diff --git a/xen/arch/arm/include/asm/arm32/processor.h b/xen/arch/arm/include/asm/arm32/processor.hindex 4e679f3273..3e03ce78dc 100644 --- a/xen/arch/arm/include/asm/arm32/processor.h +++ b/xen/arch/arm/include/asm/arm32/processor.h @@ -56,6 +56,16 @@ struct cpu_user_regs uint32_t pad1; /* Doubleword-align the user half of the frame */ }; +/* + * Macros to extract affinity level. Picked from kernel + */ + +#define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1) +#define MPIDR_LEVEL_SHIFT(level) (MPIDR_LEVEL_BITS * level) + +#define MPIDR_AFFINITY_LEVEL(mpidr, level) \ + ((mpidr >> (MPIDR_LEVEL_BITS * level)) & MPIDR_LEVEL_MASK) +Above, since #define MPIDR_LEVEL_SHIFT(level) (MPIDR_LEVEL_BITS * level)you can replace (MPIDR_LEVEL_BITS * level) with MPIDR_LEVEL_SHIFT(level) in the definition of MPIDR_AFFINITY_LEVEL.You will see that it is identical to the arm64 definition #define MPIDR_AFFINITY_LEVEL(mpidr, level) \ ((mpidr >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK)Currently, MPIDR_AFFINITY_LEVEL(mpidr, 3) differs between arm32 and arm64:- In arm32 :- (mpidr >> 24) & 0xff In arm64 :- (mpidr >> 32) & 0xff Correct. This is the case because the MPIDR_LEVEL_SHIFT(level) differs between arm32 and arm64.
The definition of MPIDR_AFFINITY_LEVEL is common in both.
More specifically, for level 3,
#define MPIDR_LEVEL_SHIFT(level) \
((level) << MPIDR_LEVEL_BITS_SHIFT)
#define MPIDR_AFFINITY_LEVEL(mpidr, level) \
(((mpidr) >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK)
gives (mpidr >> 24) & 0xff
While
#define MPIDR_LEVEL_SHIFT(level) \
(((1 << (level)) >> 1) << MPIDR_LEVEL_BITS_SHIFT)
#define MPIDR_AFFINITY_LEVEL(mpidr, level) \
(((mpidr) >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK)
gives (mpidr >> 32) & 0xff
-- Xenia
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |