From patchwork Wed May 16 18:51:12 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: 10404683 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 0FE15601F7 for ; Wed, 16 May 2018 18:56:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F257F28649 for ; Wed, 16 May 2018 18:56:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E629528662; Wed, 16 May 2018 18:56:50 +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=-4.0 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 6B12F28649 for ; Wed, 16 May 2018 18:56:50 +0000 (UTC) Received: from localhost ([::1]:34164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1bV-00076I-LI for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 May 2018 14:56:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1Wn-0002tS-Hw for qemu-devel@nongnu.org; Wed, 16 May 2018 14:51:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ1Wm-0000h1-Fy for qemu-devel@nongnu.org; Wed, 16 May 2018 14:51:57 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:38488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ1Wm-0000gh-8v for qemu-devel@nongnu.org; Wed, 16 May 2018 14:51:56 -0400 Received: by mail-wm0-x241.google.com with SMTP id m129-v6so4229025wmb.3 for ; Wed, 16 May 2018 11:51:56 -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=qYAZaF+5C1T/BAubKp0rEdGatli7l5tJiNqFkqUH0e8=; b=ljLm/P3KXtuotVcxYZkIC8rBjSbjNpabxPrdP4U0L6qajlo0+J9bOdSoPwtA/n6WIH it+1ocSbh0yeQsvSlh3gkfVQUHHBCmGgjdH6wdJIVe03qCbbFTglpOBE+XNhrsmQPLSJ aOQCA2KOd0SrYOU1H4PVWcjIIQurYqtHNb1D5miXb0t8YQV8AvlCd1nYEgcBUihGE473 Cqn/ymVxTlbJU0XwkV1csqAMCkQ8gmdBMd1o7iCgpMaYO2bVEk4eGCIZ+X++VNm2AzJM pjlZfCFLSwKK3MDkJCNmfMDx6UzDu1vpK5LnlcpNswYIzhxMqxpqj6+UwyjbJqiFQJN2 Mi6w== 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=qYAZaF+5C1T/BAubKp0rEdGatli7l5tJiNqFkqUH0e8=; b=Z5rfTfwx37vlBokjbni+D+cLrgXf6zAeF37k2f6/IUVvKay9dw+d9rEo9zwAR6L0CT 5ZcRR18NMtQYUhxuoYsB63G5LuBM4k/nCOaH19487+LuRa6T5tzFXODpyiKSqG5V+ldx hhhgWKdX9+8kSl6wNCUZMadoHFEDEvafKPm+5WazioKzTJWlrBjBVJHpDoGoMoJtuSPG V+dP937KXj8n5qN5eSbIYYHjHssJ1LXIzz2Bt7swpnkPpNCBc/ufFNfV+aoY4FmjRtIU 8dlRDmwacMhCjb/RqRhkZHeLEolpXudaD4FPE/JY4gnf08S4YQ/emVfNA/BBKcLtjLJf Qmjg== X-Gm-Message-State: ALKqPwesQfujlPQyzDP265Knn3wwgtw7cYXA5myFfJ+8f0RgiestsTNK xyPDgk2rSg9kwZvxH1Pru3btfA== X-Google-Smtp-Source: AB8JxZq8RWbvnSbe6atzBxxvJWQKeGKimFrw48C9otxW+5GnT8eHeE95wpO/SZKPYuf8t/smERqdWg== X-Received: by 2002:a2e:9248:: with SMTP id v8-v6mr1273252ljg.133.1526496714789; Wed, 16 May 2018 11:51:54 -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 x3-v6sm771515lfd.78.2018.05.16.11.51.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 11:51:53 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 20:51:12 +0200 Message-Id: <20180516185146.30708-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180516185146.30708-1-edgar.iglesias@gmail.com> References: <20180516185146.30708-1-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PATCH v3 04/38] 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, sstabellini@kernel.org, sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com, alistair@alistair23.me, richard.henderson@linaro.org, frederic.konrad@adacore.com 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. Reviewed-by: Alistair Francis Signed-off-by: Edgar E. Iglesias --- 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; }