From patchwork Wed Dec 26 17:20:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 10743251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A3836C2 for ; Wed, 26 Dec 2018 17:29:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11BE2286C0 for ; Wed, 26 Dec 2018 17:29:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02559286A2; Wed, 26 Dec 2018 17:29:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 74E88286A2 for ; Wed, 26 Dec 2018 17:29:57 +0000 (UTC) Received: from localhost ([127.0.0.1]:47486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcD0G-0007sQ-CN for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Dec 2018 12:29:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcCrN-0004EG-Fj for qemu-devel@nongnu.org; Wed, 26 Dec 2018 12:20:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gcCrH-0007rw-M3 for qemu-devel@nongnu.org; Wed, 26 Dec 2018 12:20:41 -0500 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:36998) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gcCrD-0007mx-P4 for qemu-devel@nongnu.org; Wed, 26 Dec 2018 12:20:36 -0500 Received: by mail-qk1-x744.google.com with SMTP id g125so9624166qke.4 for ; Wed, 26 Dec 2018 09:20:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:cc:from:to; bh=IWfZjYzkdRCs/v8ZQPYnDvi7qMZxCS9XtrTCN8xP4I8=; b=B5phCFixoLrMAE/hU+kaLwffwj9Xg6SfTKyGMSusQGRtuAA/E+oQbe9dl5scIVL/YM irfiYD5bqdeTRsejer+vfexoIqjzIL2+aNfR0yHs0SKeujw0MV39i0IYZBS4MTW1Obin c3QSOittK8M+ImWYU5fcWSVnObaPOIOg/aW8kuuq43mELuVvabWFElaYl0V9Q174Boad c84fsEcF3NU0sI6Z9C/36n62VeKgO/ThpUQVYNNnFmJCbwX8VlAsXU26rHcw1C8oGc54 yV4o4lyd8cYQ3xnHhh2U3b9KZzcVTVMIP7OphkjNqmuLzAVEwO4s8rQndfKdKNj+/Pcc l97A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=IWfZjYzkdRCs/v8ZQPYnDvi7qMZxCS9XtrTCN8xP4I8=; b=BLXr4LO8rNj8l0FcYCm6ATgANUnGSTR4rhkCozjsSGX8UMiUz7rIdif4UUe4KO4GLQ +McUDqjFMe7xneeuVYOq1FtueBCo9gqFhgv+b7lkZv7hVVPkcPRdlYXfJqGAS5Nd2b/l Tdai2shH3iZ7udpaNGbfXfIb76w62HUTNjYZCu91s56fcHGGVafLqkOO0ZjeB0Mx+eDm TFZnefy4oZiInUYz4zTHQFyfu/7GjSLV3ceMN4tNFUtYNOFyYEz5nkVL0g11o0oWmHBS /MMSPqsalLZWlsq9i0CwpgAGSNEjyIVBAJN05D5A4IUtmD0Gov+IJXJiUwMs64fLNNFX K7YA== X-Gm-Message-State: AJcUukcuRBrFyoey55tgL5ho9ksmImSYlfxWzE7TDHpMpPX/q79waafy 4Q9q1uAiiYRfLDzzo/Y/Fpq87w== X-Google-Smtp-Source: ALg8bN5jm5L9xkOO41qzqSCZGqYPVX77m2uaxr/T6Lc7OLZMY3RM948q1q/+Tp7Isa+e3kPXsQIumw== X-Received: by 2002:a37:9c57:: with SMTP id f84mr18421497qke.176.1545844830067; Wed, 26 Dec 2018 09:20:30 -0800 (PST) Received: from localhost ([2601:182:c980:96c:8dd:4488:90b1:59d1]) by smtp.gmail.com with ESMTPSA id b17sm12614983qkj.69.2018.12.26.09.20.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Dec 2018 09:20:29 -0800 (PST) Date: Wed, 26 Dec 2018 09:20:00 -0800 Message-Id: <20181226172005.26990-10-palmer@sifive.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20181226172005.26990-1-palmer@sifive.com> References: <20181226172005.26990-1-palmer@sifive.com> From: Palmer Dabbelt To: Peter Maydell X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::744 Subject: [Qemu-devel] [PULL 09/14] RISC-V: Fix PLIC pending bitfield reads X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-riscv@nongnu.org, Sagar Karandikar , Bastian Koppelmann , Palmer Dabbelt , qemu-devel@nongnu.org, Michael Clark , Alistair Francis Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Michael Clark The address calculation for the pending bitfield had a copy paste bug. This bug went unnoticed because the Linux PLIC driver does not read the pending bitfield, rather it reads pending interrupt numbers from the claim register and writes acknowledgements back to the claim register. Cc: Palmer Dabbelt Cc: Sagar Karandikar Cc: Bastian Koppelmann Cc: Alistair Francis Reported-by: Vincent Siles Signed-off-by: Michael Clark Reviewed-by: Alistair Francis Signed-off-by: Alistair Francis Signed-off-by: Palmer Dabbelt --- hw/riscv/sifive_plic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/riscv/sifive_plic.c b/hw/riscv/sifive_plic.c index 9cf9a1f98644..d12ec3fc9a54 100644 --- a/hw/riscv/sifive_plic.c +++ b/hw/riscv/sifive_plic.c @@ -214,7 +214,7 @@ static uint64_t sifive_plic_read(void *opaque, hwaddr addr, unsigned size) } else if (addr >= plic->pending_base && /* 1 bit per source */ addr < plic->pending_base + (plic->num_sources >> 3)) { - uint32_t word = (addr - plic->priority_base) >> 2; + uint32_t word = (addr - plic->pending_base) >> 2; if (RISCV_DEBUG_PLIC) { qemu_log("plic: read pending: word=%d value=%d\n", word, plic->pending[word]);