From patchwork Thu May 3 09:18:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 10377433 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4613060353 for ; Thu, 3 May 2018 09:26:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E22029070 for ; Thu, 3 May 2018 09:26:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32AC929081; Thu, 3 May 2018 09:26:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, FSL_HELO_FAKE, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B4EB629073 for ; Thu, 3 May 2018 09:26:37 +0000 (UTC) Received: from localhost ([::1]:54872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEAVY-0006rH-Us for patchwork-qemu-devel@patchwork.kernel.org; Thu, 03 May 2018 05:26:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEAOj-0000go-E3 for qemu-devel@nongnu.org; Thu, 03 May 2018 05:19:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEAOi-0004yl-Je for qemu-devel@nongnu.org; Thu, 03 May 2018 05:19:33 -0400 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:37520) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEAOi-0004y7-C3 for qemu-devel@nongnu.org; Thu, 03 May 2018 05:19:32 -0400 Received: by mail-lf0-x242.google.com with SMTP id b23-v6so24913545lfg.4 for ; Thu, 03 May 2018 02:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YqmGvWeLZEOM6pPeuy2/nDykRi0RApyRoJaClh+blzo=; b=A6YyOjLvXnqtanv6zSPsm3NNljwIAgemKfw8p17oqsgPHy3cT61uRqJam7h/8f4bcp QX8XTcBcKfH8C5cZUUGoFUCDUjkCq8yMbQ3whNYqDHkw3qcUy1BZDguT4FUnb1oMC9U1 OFjpOCoq9MDvnbcwGrs2NsXznIpgqtgE4GWDaLeCSrID4eP3w0m7Ni32e+KkS99LuXwN kGlinrD6/q/8oqgIfHphwdh3xJBcJItHX6KgF+q/7xLgzk/ztJJDBw5zW8NpWl9ue/jx ooEZz/MYstcvNbbcodUq3/MFkkqtO70kzjkIMPnrs6e4brVKshigpSkLqv4Fk0TVqLKg Gl0w== 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:in-reply-to :references; bh=YqmGvWeLZEOM6pPeuy2/nDykRi0RApyRoJaClh+blzo=; b=mN8ANDz/1jZrt8Ph2nAj5rWu+gtu02vYTtCoenxHEPH4Tui9lGwFJ53kGa1wWpMN/4 f5Jayi/8a5QksM8D6svnPVzC+iKPbxzYRv0fjvZ3u0x0URqzc+xpPE2KZxKWc56l9NPW IekF/bh0pPyEGV0TsAZFI90n5erwsTa+g9IODha//2q/zLcPsRvO3AI9zKfn+L5AxOuC VB0a4fOcBhD3aD1fFfCw4Cvz0l1Fmi9CRVVatRtRnlNaaHjj1ZPbP8a8crV9NKoNS+bo /A2xL+//qQhWF1GGiC9+At/nzN2ypA7MEuD0WuaRDr1Nfon4J3MFpih2U+TbCxz8rjEx SKtA== X-Gm-Message-State: ALQs6tDnzOIMi7SYeH+GYGHIEWu16CBNpLhltg9cTqdh7zyTGLv3wURZ MdDFFkA9yQJYYnCG6LHiL0FQOQ== X-Google-Smtp-Source: AB8JxZqqby+0zm8S0Umlbv/5eCaHaicum2+pAKMffhNbjw/uP3A/BOhREyAjtPxhTBN8QNrlW4i5bw== X-Received: by 2002:a19:b54a:: with SMTP id e71-v6mr13486515lff.94.1525339170832; Thu, 03 May 2018 02:19:30 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id h7-v6sm2716538lja.93.2018.05.03.02.19.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 02:19:29 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 11:18:57 +0200 Message-Id: <20180503091922.28733-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180503091922.28733-1-edgar.iglesias@gmail.com> References: <20180503091922.28733-1-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::242 Subject: [Qemu-devel] [PATCH v1 04/29] target-microblaze: Fallback to our latest CPU version 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: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com, alistair@alistair23.me, richard.henderson@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Today, when running QEMU in linux-user or with boards that don't select a specific CPU version, we treat it as an invalid version and log a message. Instead, if no specific version was selected, fallback to our latest CPU version. Signed-off-by: Edgar E. Iglesias Reviewed-by: Alistair Francis --- target/microblaze/cpu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 4dc1404800..06476f6efc 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -72,6 +72,9 @@ static const struct { {NULL, 0}, }; +/* If no specific version gets selected, default to the following. */ +#define DEFAULT_CPU_VERSION "10.0" + static void mb_cpu_set_pc(CPUState *cs, vaddr value) { MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); @@ -141,6 +144,7 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp) MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); CPUMBState *env = &cpu->env; uint8_t version_code = 0; + const char *version; int i = 0; Error *local_err = NULL; @@ -162,8 +166,9 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp) | PVR2_FPU_EXC_MASK \ | 0; - for (i = 0; mb_cpu_lookup[i].name && cpu->cfg.version; i++) { - if (strcmp(mb_cpu_lookup[i].name, cpu->cfg.version) == 0) { + version = cpu->cfg.version ? cpu->cfg.version : DEFAULT_CPU_VERSION; + for (i = 0; mb_cpu_lookup[i].name && version; i++) { + if (strcmp(mb_cpu_lookup[i].name, version) == 0) { version_code = mb_cpu_lookup[i].version_id; break; }