From nobody Sat Nov 15 01:01:17 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1592514472; cv=none; d=zohomail.com; s=zohoarc; b=diQq7XFS5oCAgT41tNnIFWzaA7YXQZbRAXmw0pdI2qYFxe02+y3Jk7qvxPjyxxye8Z3zi9M9pdxmkHE8yvNOUWzrhiSDjoU/gE9reyz0IFnl39mhzt5mqNmHvRcfHv8sEH8Xb0Qza3m6CjAnpDUxIYRErE2Rx7apcbShApgyTu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592514472; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=xmHWxebtPKupZcaNBdpPwXqTediISejz0zucPT84HsM=; b=Ylk7O0yKoMxVS/hKm1VwplnAaS9ljuWgD3GuZCdwJX8tAibRuq90h1vU2J+yzb0hzRhCJDawct/+IPTvjtf84lrCHQscFaR9avrwSjNwRiF4FePGNiHfa8XuHO1Sg536fF+8gMwUS2mByD6ysKd0wNqyR/8iZPSBqYP5F/RjaVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592514472284707.1548650803937; Thu, 18 Jun 2020 14:07:52 -0700 (PDT) Received: from localhost ([::1]:41092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jm1lE-00046M-BT for importer@patchew.org; Thu, 18 Jun 2020 17:07:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jm1kP-0003Jd-1b for qemu-devel@nongnu.org; Thu, 18 Jun 2020 17:06:57 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:44770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jm1kN-0002Mu-Ei for qemu-devel@nongnu.org; Thu, 18 Jun 2020 17:06:56 -0400 Received: by mail-wr1-x441.google.com with SMTP id b6so7557722wrs.11 for ; Thu, 18 Jun 2020 14:06:54 -0700 (PDT) Received: from Jessicas-MacBook.local (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id l8sm4725526wrq.15.2020.06.18.14.06.53 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jun 2020 14:06:53 -0700 (PDT) Received: by Jessicas-MacBook.local (Postfix, from userid 501) id B8907207587E59; Thu, 18 Jun 2020 22:06:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jrtc27.com; s=gmail.jrtc27.user; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xmHWxebtPKupZcaNBdpPwXqTediISejz0zucPT84HsM=; b=Preb8aGP3Y9TvJgXjcxe0QA7HId1Sufa1futOsZv4GJhWt8sFoeJdEkx9/5RV14TLS WV19KxDPS0NRxzgO70mf6wa+HnI2rvf4hKVMZrenVnztzgJkLZefgQo5XNQNSCyqQEfq 5+6RUi6HkzoEaCxgKC7ixFuioO09C768d+MwwuC8fDZmCQYTdptMK//DhcFfspiIxN0X UNleIpraOb8Lygh815qpp2cbiT1BViV4W1gLQD3d5QDeysdYITYnJmRzyWZfIKoYCm51 g2CJe+ldZgDileXBfQzZEkCra1+h3gWXVdvqJBvSxRCtO1tD74/9Q/lsEgH4epos2NCY /uPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xmHWxebtPKupZcaNBdpPwXqTediISejz0zucPT84HsM=; b=SYRWVNaSrneyzN7VMTwAc9hY3AovDSjXictGceI60um3wRVQH7MralEFcnqqnvyMEx Hlt0LcxXcYHcaOthUXVTgPUClJa6VT7YyvIMNqzsJ1LneoZbSXbW+sjt5GjE9g/b2E3V AWJyuKoC99ysStoDOPbhXZoFT2oK7v/T8exj37iNmEk8J3w0z1X5EjKF3tncUbwKIoMR SRkZJ/utDUk+XNMdJxYui+UElD9rkqMqWUyLM2GQcbTH5pNCp28uwkT3J8uMoTm7EARj WELhufGV4v9jxpecchPUzksHJLQhp8eXtVgcsntkoO0Ic9wEB1Y73v1P3nNjiJNSUhrX av/Q== X-Gm-Message-State: AOAM531+ZWXPdtX9DgBgkoghOnJJS3ncYY9z3Y71UPs16xJJPiw+Uy+w NEznbm1Dk/fSutnjqStLmfakoQ== X-Google-Smtp-Source: ABdhPJz6pq+khpYv/LmFnJkEwHYiTMq/pazc6YIYTSwJFj5lQY+P4nxiH3LXSX8v3ZOPyLUvcx7M2A== X-Received: by 2002:adf:9163:: with SMTP id j90mr385972wrj.65.1592514413895; Thu, 18 Jun 2020 14:06:53 -0700 (PDT) From: Jessica Clarke To: qemu-riscv@nongnu.org Subject: [PATCH] riscv: plic: Add a couple of mising sifive_plic_update calls Date: Thu, 18 Jun 2020 22:06:49 +0100 Message-Id: <20200618210649.22451-1-jrtc27@jrtc27.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::441; envelope-from=jrtc27@jrtc27.com; helo=mail-wr1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sagar Karandikar , Bastian Koppelmann , qemu-devel@nongnu.org, Palmer Dabbelt , Alistair Francis , Jessica Clarke Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Claiming an interrupt and changing the source priority both potentially affect whether an interrupt is pending, thus we must re-compute xEIP. Note that we don't put the sifive_plic_update inside sifive_plic_claim so that the logging of a claim (and the resulting IRQ) happens before the state update, making the causal effect clear, and that we drop the explicit call to sifive_plic_print_state when claiming since sifive_plic_update already does that automatically at the end for us. This can result in both spurious interrupt storms if you fail to complete an IRQ before enabling interrupts (and no other actions occur that result in a call to sifive_plic_update), but also more importantly lost interrupts if a disabled interrupt is pending and then becomes enabled. Signed-off-by: Jessica Clarke Reviewed-by: Alistair Francis --- hw/riscv/sifive_plic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/riscv/sifive_plic.c b/hw/riscv/sifive_plic.c index d91e82b8ab..c20c192034 100644 --- a/hw/riscv/sifive_plic.c +++ b/hw/riscv/sifive_plic.c @@ -255,8 +255,8 @@ static uint64_t sifive_plic_read(void *opaque, hwaddr a= ddr, unsigned size) plic->addr_config[addrid].hartid, mode_to_char(plic->addr_config[addrid].mode), value); - sifive_plic_print_state(plic); } + sifive_plic_update(plic); return value; } } @@ -287,6 +287,7 @@ static void sifive_plic_write(void *opaque, hwaddr addr= , uint64_t value, qemu_log("plic: write priority: irq=3D%d priority=3D%d\n", irq, plic->source_priority[irq]); } + sifive_plic_update(plic); return; } else if (addr >=3D plic->pending_base && /* 1 bit per source */ addr < plic->pending_base + (plic->num_sources >> 3)) --=20 2.20.1