On 20.02.2026 17:18, Oleksii Kurochko wrote:
> --- a/xen/arch/riscv/domain.c
> +++ b/xen/arch/riscv/domain.c
> @@ -2,9 +2,39 @@
>
> #include <xen/init.h>
> #include <xen/mm.h>
> +#include <xen/sections.h>
> #include <xen/sched.h>
> #include <xen/vmap.h>
>
> +#include <asm/cpufeature.h>
> +#include <asm/csr.h>
> +
> +struct csr_masks {
> + register_t hedeleg;
> + register_t henvcfg;
> + register_t hideleg;
> + register_t hstateen0;
> +};
> +
> +static struct csr_masks __ro_after_init csr_masks;
> +
> +void __init init_csr_masks(void)
> +{
> +#define INIT_CSR_MASK(csr, field) do { \
> + register_t old; \
> + old = csr_read(CSR_##csr); \
Can't this be the initializer of the variable? Can't ...
> + csr_set(CSR_##csr, ULONG_MAX); \
... csr_swap() be used here, too?
> + csr_masks.field = csr_swap(CSR_##csr, old); \
> +} while (0)
This whole macro body would also better be indented by one level, to not leave
in particular this closing brace as a misleading one.
Happy to make adjustments while committing, provided you agree. With the
adjustments (or clarification why any of them shouldn't be done):
Reviewed-by: Jan Beulich <[email protected]>
Jan