From patchwork Fri Feb 1 16:06:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 157259 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp624816jaa; Fri, 1 Feb 2019 08:12:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IakUzPi+IwkkOIyoLISg7e4ScgV9IijNiFsN7KNDU84KSgvLbZPv5eUwp2oX/X3xeBoAz2P X-Received: by 2002:a25:287:: with SMTP id 129mr5298257ybc.324.1549037559628; Fri, 01 Feb 2019 08:12:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549037559; cv=none; d=google.com; s=arc-20160816; b=HXtYCCwRPTVGvd4ec4XabAuAREeSnQI63jDh1jRQt/zGmOhHb7VdoGiFIC8rpd+U9O CG+usTy6acsSKf0utQYnZixisJQ7yWRuyDhWzjsn9sUZXV/cb+CaJEMM/mUgSGrXhxRk ZuKzzw5kVID35dLr+iPpD23+v1rafLOeSVAIuragwPabP3Kf/4KT4tsbdnsvS4hmkUjF YBEe+i4yjnID+Ms4iOoo+8Ek3QWRbsW1hfLVIEQsUWU4L0Ws1lGb6spH2xJjXlBiml0T zjoZuH7Sb8L9+oKFOPG36lnzpiJ7YEQBExwx1NqwSYSGGyFBv2i3btbtyEMXgJ6m9Xm7 5WXA== 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=UuVW7tpTbDI/qssggkHCCe5zSzAPxwdivNU6kF+NI+c=; b=V8mwvVep/vnsUhoPF8SZhoSsLLemEsx2eFQMdoXygzdH8bAvHHy4vGauyB+lu8ZKD/ ct+ZvSb8ev6kpB3XZGMH+h7XXsiWXDYCTySj1YPBt8gaKrOo9y/Jr9VNSJVRyvlaqDmY NOyHxl05NawOuB0YxMkH+1mnNM5+CN5MlXPx3si3IRcpRQ3OUWqX9j+BYrmNPeW00Nx6 FfcOoXDKYflzURoDbryuXOijpicCLKl5KRa1T2HP41XOyAD/iGOHXc9yS0qaMBtdoEzm MQskp4xY1TmuhoxyFFS7yCTtjc0M8Tco8Jhu/061mhAY+7bsv2nn1oHXOCKqLS6ZoZu4 QvSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QVufptqc; 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 l127si4660299ywf.460.2019.02.01.08.12.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 01 Feb 2019 08:12:39 -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=QVufptqc; 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]:57304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpbQl-0002s0-2z for patch@linaro.org; Fri, 01 Feb 2019 11:12:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpbLJ-0007ZL-Ip for qemu-devel@nongnu.org; Fri, 01 Feb 2019 11:07:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gpbLI-0003G1-H8 for qemu-devel@nongnu.org; Fri, 01 Feb 2019 11:07:01 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:45066) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gpbLH-0003FY-T7 for qemu-devel@nongnu.org; Fri, 01 Feb 2019 11:07:00 -0500 Received: by mail-wr1-x430.google.com with SMTP id t6so7607607wrr.12 for ; Fri, 01 Feb 2019 08:06:59 -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=UuVW7tpTbDI/qssggkHCCe5zSzAPxwdivNU6kF+NI+c=; b=QVufptqcd/B7I7r+uUKaQKmAnO2k6f4sB1y6W/nIPlhuLogYfSRnJdIUbeFoL+2Q5x hOxiC0ZDuW8mC14qExJABgQLoBFo5erD5829GKzYZJNSU9tRsUDMUkFAUGE2MJ16siq/ HSEJDQNImAyxkfQ7tWJbwapssu/toq2RR/aR4= 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=UuVW7tpTbDI/qssggkHCCe5zSzAPxwdivNU6kF+NI+c=; b=WugdlYxmFe4KENbZVJ5b7TGMJXkjJXeVhvpx4SPJOgYT4wB28V9FziHe2UDTggRHvx 6pjc3ydWsKRd5AeRS/shYdIdg9BQFJLuE9B/r89Gg7NiJKpxP2D1CWmOjuzpmp4KLTUU Xeu4yCC5uAphcTL7Joh4jLM8bYrt7xt9omZR5g9qGg0e5x5vNQ109YepPo5JZMA1hqV0 WWHzzK4ddhG+BtdcJvMtvj+rWOpANiyeE7f304+4sd9/o7K/kAMibIznjpiIFa9DiM0M IGLYgbNmYN684h++fl/DgyIjryI2LCzd5gtfF9oHUOid6CQj6BqOdiro76jY5pj+P+tk Xs8Q== X-Gm-Message-State: AJcUukeoPJhmqlPNZ+E78o51lhtiXkanMdZ4s7Ffj29S77qMO1bL525F iFjpqmaoryrZ2wWpfjabtgLuQlE2f+bP9A== X-Received: by 2002:adf:9d85:: with SMTP id p5mr37610285wre.41.1549037218532; Fri, 01 Feb 2019 08:06:58 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id n6sm2847250wmk.9.2019.02.01.08.06.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Feb 2019 08:06:57 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 1 Feb 2019 16:06:08 +0000 Message-Id: <20190201160653.13829-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190201160653.13829-1-peter.maydell@linaro.org> References: <20190201160653.13829-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::430 Subject: [Qemu-devel] [PULL 02/47] armv7m: Don't assume the NVIC's CPU is CPU 0 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" Currently the ARMv7M NVIC object's realize method assumes that the CPU the NVIC is attached to is CPU 0, because it thinks there can only ever be one CPU in the system. To allow a dual-Cortex-M33 setup we need to remove this assumption; instead the armv7m wrapper object tells the NVIC its CPU, in the same way that it already tells the CPU what the NVIC is. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20190121185118.18550-2-peter.maydell@linaro.org --- hw/arm/armv7m.c | 6 ++++-- hw/intc/armv7m_nvic.c | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index f4446528307..f9aa83d20ef 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -178,10 +178,12 @@ static void armv7m_realize(DeviceState *dev, Error **errp) } } - /* Tell the CPU where the NVIC is; it will fail realize if it doesn't - * have one. + /* + * Tell the CPU where the NVIC is; it will fail realize if it doesn't + * have one. Similarly, tell the NVIC where its CPU is. */ s->cpu->env.nvic = &s->nvic; + s->nvic.cpu = s->cpu; object_property_set_bool(OBJECT(s->cpu), true, "realized", &err); if (err != NULL) { diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index 0beefb05d44..790a3d95849 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -2274,8 +2274,7 @@ static void armv7m_nvic_realize(DeviceState *dev, Error **errp) Error *err = NULL; int regionlen; - s->cpu = ARM_CPU(qemu_get_cpu(0)); - + /* The armv7m container object will have set our CPU pointer */ if (!s->cpu || !arm_feature(&s->cpu->env, ARM_FEATURE_M)) { error_setg(errp, "The NVIC can only be used with a Cortex-M CPU"); return;