Re: [PATCH v1 09/17] xen/riscv: add helper to check APLIC MSI mode
Baptiste Le Duc <[email protected]>
| Newsgroups | gmane.comp.emulators.xen.devel |
|---|---|
| Message-ID | <1786613682.8631fc262581453bbf619ec5b2062170.19ffa7951ae000c4f3@vates.tech> |
> 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. > > Signed-off-by: Oleksii Kurochko <[email protected]> > > diff --git a/xen/arch/riscv/aplic.c b/xen/arch/riscv/aplic.c > index 87f2134bc5..1ce844cd21 100644 > --- 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) It does a readl() of the physical APLIC on every call. Patch 11 puts it on the vCPU context switch path (vaplic_state_save/restore), so this becomes an uncached MMIO read per switch to read a value that aplic_init_hw_interrupts() sets once and nothing ever changes. Please cache it at init time. -- Baptiste Le Duc <[email protected]>