Re: [PATCH v1 09/17] xen/riscv: add helper to check APLIC MSI mode

Jan Beulich <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On 20.07.2026 18:02, Oleksii Kurochko wrote:
> This helper can be used outside aplic.c to determine whether MSI mode
> is enabled. A follow-up patch uses it to decide whether the guest
> IMSIC state should be saved/restored.

How would this work, when ...

> --- a/xen/arch/riscv/aplic.c
> +++ b/xen/arch/riscv/aplic.c
> @@ -93,6 +93,11 @@ void aplic_hw_write_reg(unsigned int offset, uint32_t value)
>      spin_unlock_irqrestore(&aplic.lock, flags);
>  }
>  
> +bool has_msi_support(void)
> +{
> +    return readl(&aplic.regs->domaincfg) & APLIC_DOMAINCFG_DM;

... you read a global here? To know what state a guest's vAPLIC is in, you'd
need to read its (virtual) register, wouldn't you?

> +}

I think the name is overly ambiguous, the more that there's also no parameter
the type of which would help disambiguation. Judging from title and description,
maybe aplic_msi_mode_enabled() or simpler aplic_msi_mode() could be more to the
point. (Note that neither "has" nor "available" would really express things
correctly, as the DM field can [aiui] in principle be changed.)

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.