From patchwork Tue Mar 8 07:19:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 549248 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp2389002mag; Mon, 7 Mar 2022 23:33:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrQLMoobDTBC0LeKbw1fDUV/709FOKJgkNSxZXGwEb3+4TpGuShtptZqNNCEQUhs6qBWE2 X-Received: by 2002:a05:6214:23c8:b0:432:e64e:969a with SMTP id hr8-20020a05621423c800b00432e64e969amr11263839qvb.109.1646724805643; Mon, 07 Mar 2022 23:33:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646724805; cv=none; d=google.com; s=arc-20160816; b=Gg2wwskk1U6qFaI9DSyNmE/y5d37QiA6Uusr2ShLjU5bSFuPWp8V5thqXps1LLPIds p0u9CXfLk7pznTjW4cIy+9O8ikmAU+mhHARthgFmQtMotL7UtHA5V15v/uPRUshIlWNp gO5YOrslZP+w83+dVFKUNN9GFq6/i4HiaO0m/0LxxDbatU3gtUJYsgKaOnmJuLEEKyLC WpZbrq0PkzFz7aByRr9NsMUW8fomdpH4NFxCKAy5vejEGjvTfvwXW0TsWkKNzm+BWzpS RttVeHB09OPidOjDZAau60ISjMByICbuwXfxSZfwUu0lFazzRUk21RGiBhYQhCYEhqSR yfMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=j21dTyIj41G0K43gYWwqQRtlgt2XT5TcX5RNUrMtfBI=; b=leu7bt1WI4z1AtQO0Mu4FnwZI/8Pa3Lcg7RuXxj0/fK1fxUfP2tHLQ/my+wmw5CcSF qGiOGEOws4XVlxYOoSwJAjDIj3Dh9ljEO9ppOAdSS/lKe7ifTQ4N9GTzUGgg6jRYU1xP 14DoZTf86Tpm5h+uO36gFwYprpnA+goKiVSR8hXFDyXSnbC+/MIEuNsdtexHLspNU2DO C+8N1jMArEu/ozTEuQ1ZLETgNPaxhoewIjTxlWgNN5ifSM9XZdF88KDAJhUNegmDAQWt 2El6Lm/FKr/2i/ddIfiw0AQISb0yavpCTTcYdWV5rHjejYBHaIsqwI+rJlQ34E9AfypW xCkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zZGkqOim; 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 fq4-20020a056214258400b004353a0e50a9si7088774qvb.226.2022.03.07.23.33.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Mar 2022 23:33:25 -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=zZGkqOim; 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 ([::1]:49378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRULV-0005yI-7o for patch@linaro.org; Tue, 08 Mar 2022 02:33:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRU9G-0005GL-Q3 for qemu-devel@nongnu.org; Tue, 08 Mar 2022 02:20:52 -0500 Received: from [2607:f8b0:4864:20::42e] (port=46756 helo=mail-pf1-x42e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRU9A-0006OG-Q9 for qemu-devel@nongnu.org; Tue, 08 Mar 2022 02:20:44 -0500 Received: by mail-pf1-x42e.google.com with SMTP id s11so16555752pfu.13 for ; Mon, 07 Mar 2022 23:20:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j21dTyIj41G0K43gYWwqQRtlgt2XT5TcX5RNUrMtfBI=; b=zZGkqOimN6rEFEy6wYLBE4Cc8UfQSiZmClq3qNgXtZCRUnuwaT61b01I1bdYaz+Bbs H9G394kAcH4S5cLL4FojyF6PHr6E88pbCVIxB08tcLPVsixVL0K4MzK/UcXAuJiHpBus jmIVcDPM5qSpycCc/tQPsczzu2oLB34zy+IMJ5BFNz/52CKqovopQ+H+BJAZOD8f4Prs thH3WnTpXSsyTyvYu00sRHLd4BLAJZNg2rpUJMMVfOpWDpZIGjnieQDsITiwR2azRT8A NZZSii49sA7h1zsJAL9PxL5D7SPgtMRcz3Fllzm6a/3PU5Ob4IXr56zBCWjIuEiT0WGm Mcdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j21dTyIj41G0K43gYWwqQRtlgt2XT5TcX5RNUrMtfBI=; b=6Zx0SD8zygPXBnozOResDF7gkLuoh4F1GWAENlkKlrUv/SNb5eXmsRXaE0ZQIvYARb qtEQGrAbHl/XhHkqSE1/47SvJZSSMTm0yxGOygV6zBRqNbmKzuLNJLtIY+Mx2md7CJvc Y3SKcT6U3I8QXaHs/MuO+HWDL6YT3/5sXhU/3gT8unSMGl8OrIETzWs+QtJQlLYL6dq7 J1gnrXoeSUabQ41jLUBhNrUrskYU6sYOb1fJUqAIuvv1uD+Jkh7Y6XspRi/y7zgKbp1o vD7HrMj7sdGU4bA4LAmTTUnatLEcXTFXnejgiD+MbC6s41x5WtIgRuM4VMrfzK0gvqIq xzyA== X-Gm-Message-State: AOAM533dfHUZSu7zS0IWJTG3qoOlowEfv4ycGcx2VuYtBNs06/cowrJS v02bGVvpXRAm2GUKBWgpjhMC5uxOiQQ+0g== X-Received: by 2002:a63:513:0:b0:380:1180:9b48 with SMTP id 19-20020a630513000000b0038011809b48mr11112051pgf.623.1646724037772; Mon, 07 Mar 2022 23:20:37 -0800 (PST) Received: from localhost.localdomain (cpe-50-113-46-110.hawaii.res.rr.com. [50.113.46.110]) by smtp.gmail.com with ESMTPSA id p125-20020a622983000000b004f6c5d58225sm13790899pfp.90.2022.03.07.23.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 23:20:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 18/33] target/nios2: Implement cpuid Date: Mon, 7 Mar 2022 21:19:50 -1000 Message-Id: <20220308072005.307955-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308072005.307955-1-richard.henderson@linaro.org> References: <20220308072005.307955-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, peter.maydell@linaro.org, amir.gonnen@neuroblade.ai Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Copy the existing cpu_index into the space reserved for CR_CPUID. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/nios2/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index 189adf111c..fbcb4da737 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -159,6 +159,7 @@ static ObjectClass *nios2_cpu_class_by_name(const char *cpu_model) static void nios2_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); + Nios2CPU *cpu = NIOS2_CPU(cs); Nios2CPUClass *ncc = NIOS2_CPU_GET_CLASS(dev); Error *local_err = NULL; @@ -171,6 +172,9 @@ static void nios2_cpu_realizefn(DeviceState *dev, Error **errp) qemu_init_vcpu(cs); cpu_reset(cs); + /* We have reserved storage for ctrl[CR_CPUID]; might as well use it. */ + cpu->env.cpuid = cs->cpu_index; + ncc->parent_realize(dev, errp); }