|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] xen/riscv: simplify aplic_init_hw_interrupts()
On 12/2/26 11:20 AM, Baptiste Le Duc wrote: aplic_init_hw_interrupts() clears all enable bits via clrie[], then writes 0 to sourcecfg[i] and APLIC_DEFAULT_PRIORITY to target[i] for each source. However, writing 0 to sourcecfg[i] makes source i inactive (D = 0, SM = Inactive) and, per the AIA spec, the pending and enable bits and target[i] of an inactive source are read-only zero. Thus the clrie[] loop is redundant and the target[i] write is ignored. Moreover, domaincfg.DM is set right after, and in MSI delivery mode the low bits of target[i] are EIID rather than IPRIO, so a default priority isn't needed at all. Drop the clrie[] loop, the target[i] write and APLIC_DEFAULT_PRIORITY. To still prevent a source left active by firmware from raising an interrupt while the sources are being made inactive, clear domaincfg.IE first, keeping DM so as not to switch the delivery mode. Also, as domaincfg.DM is WARL and Xen supports only MSI delivery mode, check that DM reads back as 1 and panic otherwise, instead of relying on the ASSERT()s in the IRQ paths.Nit: don't we want to have a `Fix:` tag, it may be too much for this as it is not a bug, but at least I think we should reference the commit which introduced the write to target[i] no? I don't think a Fixes: tag is appropriate here: the patch doesn't fix any bug, it only drops code which has no effect.
Amends: 028e41d1f3e2 ("xen/riscv: aplic_init() implementation") would be
closer, but it doesn't really fit either, as nothing was missing from
that commit (except, arguably, the DM read-back check).
So I'd prefer not to add any tag. Reviewed-by: Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx> Thanks. ~ Oleksii
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |