From nobody Thu Dec 18 22:18:16 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550172303972603.370992165909; Thu, 14 Feb 2019 11:25:03 -0800 (PST) Received: from localhost ([127.0.0.1]:53758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guMd1-0005Dr-Sb for importer@patchew.org; Thu, 14 Feb 2019 14:24:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guMLJ-00082q-US for qemu-devel@nongnu.org; Thu, 14 Feb 2019 14:06:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guMLH-0004so-Ua for qemu-devel@nongnu.org; Thu, 14 Feb 2019 14:06:41 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:54358) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1guMLH-0004kk-Et for qemu-devel@nongnu.org; Thu, 14 Feb 2019 14:06:39 -0500 Received: by mail-wm1-x329.google.com with SMTP id a62so7506563wmh.4 for ; Thu, 14 Feb 2019 11:06:22 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id n184sm7798471wmf.5.2019.02.14.11.06.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:06:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZgvlXUrla4aqO6Uil7LenvUSTmqMUy+IYTYM123dAPA=; b=mbJEHfM2PAqyJv7zEumStloDGOy4NCn3JDHGPOk/EceiV+s+xxO+WmXdCu5imk2K2i dBvkMqErC2DKtPsuDp+Lkow3rJD5Mp7sGKZ6NsXrXRP4pDIPsgKIyqbc2Znjuh5aDrS+ p1XYY2jPLwtnB1nln3NyGtF4RSnu6f3i19Rf3XrSgjQlJg+aeuJIoKsgXpG8PkSePWsD +Tx679xz5YDZR85fMD/w1R4A37WsHT53nHDqxj6QuQOmgb9jYkpooLNDuwjQuBTGYURd +Vqtn4uwk9CPRB1YqQKUy1+h6Rl9yN5DEEtuLUhklTTXVSehQCEBy0qa6BjPHvaqbLGr 4aLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZgvlXUrla4aqO6Uil7LenvUSTmqMUy+IYTYM123dAPA=; b=PGaoeBSJ3SYDjabWvCmkpvfL2n6fVPfzsvsX0+ghAuZ8Sx5RGaTijBKv3oOPMv5cKL SyCttHpJ2un2aAWtsaQmiw6a1Z/X2hNkvbB27N7868jB23OGoWXGpigVOdKTgJ3FWUqr jJ5OjvzDB42maHAciuYicSZq8QgtqwPXONxWHNlTQflTZxuNYrQQtabjbax+xcEZUiUZ MrsRl4MPF81CVBuKW8uapi3906I7rrlfH7T0Fhf87iQwwZ/Rg5zlSIUl4lmarmlFAwoS K+CECahu6Wmk46sNLXFn98ArUjNGo6xlB+hx8jJaElFAX7NrI2jlbl7HwueqHS6T+D6n jBIw== X-Gm-Message-State: AHQUAubumWw9epRTkcfQzd+NsGL4WH25ti71NR0yTVzDUS+aA5k06uPK n/SNQXqWBc0FgJggXyxtAPRG2uZXePKbBg== X-Google-Smtp-Source: AHgI3IajMw54XACF1ieP7ELwyLSoC6qen4uCWEeAwqHGB3ngw+oxoN9DH3rsp4xliDsS9VYJcgP2wg== X-Received: by 2002:a1c:2457:: with SMTP id k84mr3756550wmk.139.1550171181217; Thu, 14 Feb 2019 11:06:21 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 14 Feb 2019 19:05:49 +0000 Message-Id: <20190214190603.25030-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190214190603.25030-1-peter.maydell@linaro.org> References: <20190214190603.25030-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 13/27] hw/intc/armv7m_nvic: Allow byte accesses to SHPR1 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The code for handling the NVIC SHPR1 register intends to permit byte and halfword accesses (as the architecture requires). However the 'case' line for it only lists the base address of the register, so attempts to access bytes other than the first one end up in the "bad write" default logic. This bug was added accidentally when we split out the SHPR1 logic from SHPR2 and SHPR3 to support v6M. Fixes: 7c9140afd594 ("nvic: Handle ARMv6-M SCS reserved registers") Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- The Zephyr RTOS happens to access SHPR1 byte at a time, which is how I spotted this. --- hw/intc/armv7m_nvic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index 790a3d95849..ab822f42514 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -1841,7 +1841,7 @@ static MemTxResult nvic_sysreg_read(void *opaque, hwa= ddr addr, } } break; - case 0xd18: /* System Handler Priority (SHPR1) */ + case 0xd18 ... 0xd1b: /* System Handler Priority (SHPR1) */ if (!arm_feature(&s->cpu->env, ARM_FEATURE_M_MAIN)) { val =3D 0; break; @@ -1956,7 +1956,7 @@ static MemTxResult nvic_sysreg_write(void *opaque, hw= addr addr, } nvic_irq_update(s); return MEMTX_OK; - case 0xd18: /* System Handler Priority (SHPR1) */ + case 0xd18 ... 0xd1b: /* System Handler Priority (SHPR1) */ if (!arm_feature(&s->cpu->env, ARM_FEATURE_M_MAIN)) { return MEMTX_OK; } --=20 2.20.1