From patchwork Thu Feb 14 19:05:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 158442 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1764701jaa; Thu, 14 Feb 2019 11:25:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IYHjz0sbEMWU277XjSIZ3bBRymy2haIB4MnHwtkaGvdqGIyZx5G813NLV4FuVdo+QWIS7bX X-Received: by 2002:a25:b21b:: with SMTP id i27mr4883387ybj.108.1550172340051; Thu, 14 Feb 2019 11:25:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550172340; cv=none; d=google.com; s=arc-20160816; b=V31dN+YTlbpNuE7fFTOO2l1zpjtYzOtJ09EMPqmoN3MvejiJ4fBuOQe8huEb4bdWcU hYz95/lHkx64vuW/b9yUeyU5VZvROHw273kxF6lNJHg7IyP4rbLe1OX9SsDmZtYqyBMU qT0njshzXox/W6/n+Oae1tlpHkDUa5OW/a6S4qR8btl9S3mLyA2HLksLCB3pgZoxe2Cs AeOKrb6/cW0eaAwPyB2zbe4ZP0isSGF1J0E3nY5en4qdrXJjIrW377qs+QbfMKZZWxF+ ELEO7RQik4FaLx8wz+Rn9fftGSEIIbmR8Bjrmff79rDVCK3wm0awPo2F1TgMwOjcH56G WuGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ZgvlXUrla4aqO6Uil7LenvUSTmqMUy+IYTYM123dAPA=; b=GRotuKr6zxdwTB2Vvi5gB1TfiVQEuAb9Sjx9wXtw8GH4Zl9FF2ZzmTqvnBCmkaBlEZ U6Yk2KjB+nh4I/UxxM7huKADsBYTU8xo6Owc4nPA5Xtrb0cKixaZAs3d7uLZYkbS99oe 5sQDVwqv94LznITloLpRkOam0+XV2kuuwENQQJPJ1YmEJfPXuFEEIcfCeoS9fbUrAU62 4QRft3Bd2qeMyw8WgMxL4Pchb2TfYcnr+ppERk5PlINTo1UsL2ixOHD4gcQoz+RFIPAT lU3nLUl13MLP74APecHNogDfdeSI7G8v3dAqqhQnzLvPsAa4oCgFMOeRidZUhZ6wqUIN aQpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mbJEHfM2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v63si1948159ybc.190.2019.02.14.11.25.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 14 Feb 2019 11:25:40 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=mbJEHfM2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:53758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guMdf-0005Dr-2B for patch@linaro.org; Thu, 14 Feb 2019 14:25:39 -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) 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-Received: by 2002:a1c:2457:: with SMTP id k84mr3756550wmk.139.1550171181217; Thu, 14 Feb 2019 11:06:21 -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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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é --- 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(-) -- 2.20.1 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, hwaddr 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 = 0; break; @@ -1956,7 +1956,7 @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr 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; }