On 31.07.2025 17:58, Oleksii Kurochko wrote:
> --- a/xen/arch/riscv/include/asm/mm.h
> +++ b/xen/arch/riscv/include/asm/mm.h
> @@ -12,6 +12,7 @@
>  #include <xen/sections.h>
>  #include <xen/types.h>
>  
> +#include <asm/cmpxchg.h>
>  #include <asm/page.h>
>  #include <asm/page-bits.h>
>  
> @@ -247,9 +248,17 @@ static inline bool arch_mfns_in_directmap(unsigned long 
> mfn, unsigned long nr)
>  #define PGT_writable_page PG_mask(1, 1)  /* has writable mappings?         */
>  #define PGT_type_mask     PG_mask(1, 1)  /* Bits 31 or 63.                 */
>  
> -/* Count of uses of this frame as its current type. */
> -#define PGT_count_width   PG_shift(2)
> -#define PGT_count_mask    ((1UL << PGT_count_width) - 1)
> + /* 9-bit count of uses of this frame as its current type. */

Nit: Stray blank at start of line.

> +#define PGT_count_mask    PG_mask(0x3FF, 10)

A 9-bit count corresponds to a mask of 0x1ff, doesn't it? With 0x3ff the count
can spill over the type.

Jan

Reply via email to