From patchwork Thu Apr 21 15:17:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 564371 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp557382map; Thu, 21 Apr 2022 08:51:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwibXoDXPpCOH44/KyAtqQiKokMELvgOK+5xheZ1/XxHAdFtqmCgOO3CdzQTFw0f1bRj0rd X-Received: by 2002:a05:6902:1007:b0:644:cbfd:40a6 with SMTP id w7-20020a056902100700b00644cbfd40a6mr294088ybt.355.1650556315491; Thu, 21 Apr 2022 08:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650556315; cv=none; d=google.com; s=arc-20160816; b=KHS+AdfV0nFaJi8ynnf8oOXwmXW3agqUuyVBcQW/sE4TNYWHF5dCdYgIfbe4n6v3hY ZULO1VnGgb91b27FuwQVFR4N0CMDkx//3SiHNdCpL5Z7P9bO2ZtW5LqbeECoB4cffq33 YNTHOY6lANcKTntZ438BZSdp9bkBJQ5n0S68cE4hImRs0RSPKqTsr44ghK/Vs8XMjIaY 7K9JweZ3AXmXyBdUYGgt1SnS9FuVKiVw2Mx+6M+SJjAtqwP3fDVmysLp1is/S8mfOJl3 EFHP9AtPKBisGljT2/ZlE57b1tXsGeyBVxfVwfe//Yw8S5Ms1WZRxfbNO+CVnLTfEXZd MM/A== 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=/itFkW+4Funmul04niTFa6ZdVhMkyVOGIfuc98g3ypk=; b=MVwZKioD5oxDkNRzHkIGSRUbETYBFNJlEfjA9repe284JWWYYPSOShdssxXcDFwrGo oXbW1ETnw13sSXE+zl9UE4iZNP7bwdPbfLwo2k2K659fNUXS29QFTQcmwIdQGmwtFXSL xeL7jQqMri1A1XZUkmdRB52euCxrpn58CqAObfB9OTYXru+sOa3sMpuf3pI3iDO57DbZ KHH6NVlwoUEMMAWV9TH1+pO1sL7sioYiZWx6qk72sNDcuikRkArVu+6mShzKQQv7E4AG XQzVZCNiD3ksjOH3PbRFf6O2enxVBbrln0hGbMot5SFh9Su8Ewon/H74odKvdAEajOzh wGFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G4ykTV+b; 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=pass (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 h132-20020a813a8a000000b002ec1ee80e72si2667782ywa.361.2022.04.21.08.51.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 08:51:55 -0700 (PDT) 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=pass header.i=@linaro.org header.s=google header.b=G4ykTV+b; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhZ63-00081P-08 for patch@linaro.org; Thu, 21 Apr 2022 11:51:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhYZr-00007a-O5 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 11:18:39 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:35526) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhYZq-0006OZ-5O for qemu-devel@nongnu.org; Thu, 21 Apr 2022 11:18:39 -0400 Received: by mail-pl1-x62f.google.com with SMTP id b7so5182750plh.2 for ; Thu, 21 Apr 2022 08:18:37 -0700 (PDT) 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=/itFkW+4Funmul04niTFa6ZdVhMkyVOGIfuc98g3ypk=; b=G4ykTV+bZjw7GOvdpWA/xB8N2oBMWCqpl6o/3J+AhxBwHv6EecL1OvTK4CJrcV4yDC 4lGBwIzrs6nJDVGy9NBTjG7wTqBBlP8qQzE8qk1P84YQJdgpl8F5IwdPbe4lyAzB1LuP cElI9x6y/yZ+lb33WwxHyJQT6KDEi1zS4xwCM0YyoV2DeroHjAP6squFaF6HTK0Ab+tt kUXxQxyGezQvwFSzjF07edvoEXMeo4DB7jhOWzHMIbLMBVPVefb4GGjXOcLbaWXpk4Xu dE8WBgzMj4NmNdEExoa4z7LC9nfdRECBOVyDBbVislA40dy6+xOlhwa5KqLp9y3fDdyo xJWg== 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=/itFkW+4Funmul04niTFa6ZdVhMkyVOGIfuc98g3ypk=; b=vptS5TIoxgBfrKuh3lm6deXxQQfL/EhUw0rpilACn0KYTn3qnQDAEU2JQMtqNp5g9F 8WjpdDlziQ+ObwwyD+BaxfR+bEeuYwOZNZNbgwSSo7WHGrsXlqgLStBhvi1umoacK656 rwYCQ2Cpj/NmiwGFvPVMpMqplR2aGZuCzAIF6umSnOEplKs2EmYaI6rCtgPs+bbCsm14 oc9YVDFZ2P91F5ehjEw+fVhWmxR4a8/bHQ3cmgM0rPWUHWqtBWRuWtSuEhPK3FCfa+zm e1T8fzVukUJ6Ka0dqWmSHdThtaT+j1TymiSKkNv3VLenkZrZRLtWCqouAKYeXGXjSMBs ToRA== X-Gm-Message-State: AOAM532qALiUjZO3riRghexZs6El8nitypcoRVdDFjzRT969FaJK+mYo AVXPttHieOgkoOLSkftV2pPQWAKeDTbBLQ== X-Received: by 2002:a17:90a:3ee4:b0:1cb:c1a6:e5c3 with SMTP id k91-20020a17090a3ee400b001cbc1a6e5c3mr122093pjc.215.1650554316871; Thu, 21 Apr 2022 08:18:36 -0700 (PDT) Received: from stoup.. ([2607:fb90:80c8:6cf3:a91a:4957:ba18:ac18]) by smtp.gmail.com with ESMTPSA id z16-20020a056a00241000b004f3a647ae89sm24616248pfh.174.2022.04.21.08.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 08:18:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 38/64] target/nios2: Implement cpuid Date: Thu, 21 Apr 2022 08:17:09 -0700 Message-Id: <20220421151735.31996-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220421151735.31996-1-richard.henderson@linaro.org> References: <20220421151735.31996-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: Peter Maydell 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index b3c5ae681c..a0c3e97d72 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -163,6 +163,7 @@ static void realize_cr_status(CPUState *cs) 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; @@ -176,6 +177,9 @@ static void nios2_cpu_realizefn(DeviceState *dev, Error **errp) qemu_init_vcpu(cs); cpu_reset(cs); + /* We have reserved storage for cpuid; might as well use it. */ + cpu->env.ctrl[CR_CPUID] = cs->cpu_index; + ncc->parent_realize(dev, errp); }