回复: [PATCH] aplic: fix lock machanism in xmsiaddrcfg(h)
z_bajeer at yeah.net
z_bajeer at yeah.net
Tue Aug 5 23:15:59 PDT 2025
And there is no field L in smsiaddrcfgh. We should use the L field in mmsiaddrcfgh for all xmsiaddrcfg(h).
________________________________________
发件人: Yang Jialong <z_bajeer at yeah.net>
已发送: 2025 年 8 月 06 日 星期三 11:29
收件人: opensbi at lists.infradead.org <opensbi at lists.infradead.org>
抄送: yangjialong at rvcore.com <yangjialong at rvcore.com>; Yang Jialong <z_bajeer at yeah.net>
主题: [PATCH] aplic: fix lock machanism in xmsiaddrcfg(h)
4.5.4. Supervisor MSI address configuration (smsiaddrcfg and smsiaddrcfgh)
If register mmsiaddrcfgh of the domain has bit L set to one, then
smsiaddrcfg and smsiaddrcfgh are locked as read-only alongside
mmsiaddrcfg and mmsiaddrcfgh.
Signed-off-by: Yang Jialong <z_bajeer at yeah.net>
---
lib/utils/irqchip/aplic.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/lib/utils/irqchip/aplic.c b/lib/utils/irqchip/aplic.c
index 72906d5..e4a29ae 100644
--- a/lib/utils/irqchip/aplic.c
+++ b/lib/utils/irqchip/aplic.c
@@ -121,10 +121,6 @@ static void aplic_writel_msicfg(struct aplic_msicfg_data *msicfg,
u32 val;
unsigned long base_ppn;
- /* Check if MSI config is already locked */
- if (readl(msicfgaddrH) & APLIC_xMSICFGADDRH_L)
- return;
-
/* Compute the MSI base PPN */
base_ppn = msicfg->base_addr >> APLIC_xMSICFGADDR_PPN_SHIFT;
base_ppn &= ~APLIC_xMSICFGADDR_PPN_HART(msicfg->lhxs);
@@ -167,7 +163,7 @@ static int aplic_check_msicfg(struct aplic_msicfg_data *msicfg)
int aplic_cold_irqchip_init(struct aplic_data *aplic)
{
- int rc;
+ int rc, locked;
u32 i, j, tmp;
struct aplic_delegate_data *deleg;
u32 first_deleg_irq, last_deleg_irq;
@@ -247,12 +243,13 @@ int aplic_cold_irqchip_init(struct aplic_data *aplic)
}
/* MSI configuration */
- if (aplic->targets_mmode && aplic->has_msicfg_mmode) {
+ locked = readl((void *)(aplic->addr + APLIC_MMSICFGADDRH)) & APLIC_xMSICFGADDRH_L;
+ if (aplic->targets_mmode && aplic->has_msicfg_mmode && !locked) {
aplic_writel_msicfg(&aplic->msicfg_mmode,
(void *)(aplic->addr + APLIC_MMSICFGADDR),
(void *)(aplic->addr + APLIC_MMSICFGADDRH));
}
- if (aplic->targets_mmode && aplic->has_msicfg_smode) {
+ if (aplic->targets_mmode && aplic->has_msicfg_smode && !locked) {
aplic_writel_msicfg(&aplic->msicfg_smode,
(void *)(aplic->addr + APLIC_SMSICFGADDR),
(void *)(aplic->addr + APLIC_SMSICFGADDRH));
--
2.34.1
More information about the opensbi
mailing list