[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/riscv: simplify aplic_init_hw_interrupts()



> 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?

Reviewed-by: Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx>

-- 
Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx>



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.