From patchwork Tue Feb 12 18:19:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 158177 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4150875jaa; Tue, 12 Feb 2019 10:19:20 -0800 (PST) X-Received: by 2002:a7b:c777:: with SMTP id x23mr122067wmk.71.1549995560334; Tue, 12 Feb 2019 10:19:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549995560; cv=none; d=google.com; s=arc-20160816; b=cTyayi8AbJi/QAf3O9aiMKNhcphpEf3eyoI1kmMrc9P2XWXOZTanUL/ejbIYtNp/Ln kpnZvN+MorGd5ure20xDvyHxaCKSik58LcE3Ywf2auVk6kvlbrnGVFG1KTop+irfMk/9 0jV0ov3Z4qahSqFwM3IrSwmdC6CxsHvxFHdRgX4n0kpGsm8aQ9BQzHXLZ037Mc2VHnXL XrLcyZUt2cwI7gW4f2St7P+HWZeYGklsKmo2LHjoJoKR9FzRoCLqxnvioG6ojg5v9UtC FbaRF8kZbJYpjuhU/9pwexkXWAApohKSlvqpKG/VWpoDPsDTQMltPL0YijrTq9H16ZPl 2V2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=TJJbCexAnaygb5NbSxOchbhUl0UTuJ20W+GAJCoo3jc=; b=p7VBXSC+9wNdH6klQK3fP4wQQkipCeXCWLLr+C66ZYqvzcfwloK6w+Ay4c8CukNEHA SZcPeQlYp2bdrWN9QFGExxhuHPJ/d17lPcRy4gGZCzztRr6joCdiZJBtvoUxBL/AbngC f/7YRorVZXqVbtpYFgg/lBRyzy55OvzjSgK/XXf21MHcOWG5YCSy0vXinjiAX0s+kQzy 6MVQSf+zqekuqzevJgB7L17R1SDQ7muV/Hce4RwZbvEVDcdJKTarrOQrpR9aW7IWlQGA ZWOvo1WvKv+qtK3U8kX+E3RrV7elStzNBmUhrhEUm2paEZgZuZuRIA5UxPsFd4pL4rgx +d5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EOn8V89V; spf=pass (google.com: domain of peter.maydell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=peter.maydell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id n24sor1603106wmh.2.2019.02.12.10.19.20 for (Google Transport Security); Tue, 12 Feb 2019 10:19:20 -0800 (PST) Received-SPF: pass (google.com: domain of peter.maydell@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EOn8V89V; spf=pass (google.com: domain of peter.maydell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=peter.maydell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TJJbCexAnaygb5NbSxOchbhUl0UTuJ20W+GAJCoo3jc=; b=EOn8V89VnvvT8EAq1/o8XzC+UFuzrR7Z5rB1wNSUbDsMw2hteOV1RmHpJp30s/zJEo mBocajNuUSoSrX1cmVUUGHs5k2B4HeWQYEz/B96lq4/h9DW79ZH7/ad2lmB6WUtpJrP7 s3GjZe5cmIRX1AmNjHnLFDjLiUnLs8lukCK+yKD/lVtYKkiztG+3PuJHpbiEqA9ln7Yr AXGhdtAjSNzeSvE6uC9bhTPLsq7c9htY22iTGQZ7tgiapV03pm2ajqndw43/7v+kactw 1XVC7/YOvy6CNmEXABM5y2VwPyUeY0DHRL7uDIGUg2OsQTry+dJBX54ULo2trzuFcZXW l9GA== 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=TJJbCexAnaygb5NbSxOchbhUl0UTuJ20W+GAJCoo3jc=; b=qVl5E4KHLAjQOdq4zmJzyjXDnqUW8KmuqZTXGwyK09JohZpwiZdTZtsXlk7kBxT0BR IVgwPrYp4U9OHIOnGuKZ7sR3QK5ehAnidkrj0IjjhSLHPho/PDJSh/F3+HJFNYTJbllj HBTq3vnh98bkJMtbyYOq4Mc654C58C4qcSoyKhuuQSiYqVA3lkZ5UuSTDHqqAGJTMn7o TI/RL2sRHuP5hUH2Xi8jp2B8p8rpBJu8dxpy0qEjRB6h2TQk5zCJv4hgPoD/xbLZFgy8 WZvuctP7tEdY2y71T3Opxp/olxHgyqO44ztNjdbPjE0BqCK89OJlUDfmHFk2r5dX70mV w2ZA== X-Gm-Message-State: AHQUAua2VAIhAINCtnh4CYTZjQEDgrSsyNl3AsO74BgvOol2kaKma/BO S0lOcqiZttPP21qdgoZPqIZdMM0GXX6GoxqQ X-Google-Smtp-Source: AHgI3IZcDMw/dUwVKPAFowNv0NljvB+26+h+gHpjhcCqxR823RIrCtyCDvJteyGFLQJMsSMvfndfZA== X-Received: by 2002:a1c:4301:: with SMTP id q1mr156670wma.44.1549995559920; Tue, 12 Feb 2019 10:19:19 -0800 (PST) Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id n6sm6212848wmk.9.2019.02.12.10.19.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 10:19:19 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: patches@linaro.org, Julia Suvorova Subject: [PATCH] hw/intc/armv7m_nvic: Allow byte accesses to SHPR1 Date: Tue, 12 Feb 2019 18:19:17 +0000 Message-Id: <20190212181917.8322-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 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 --- The Zephyr RTOS happens to access SHPR1 byte at a time, which is how I spotted this. --- hw/intc/armv7m_nvic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index 790a3d95849..2fd40f9dc4c 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -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; }