From patchwork Wed Aug 7 17:49:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 11082725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B3CF13B1 for ; Wed, 7 Aug 2019 20:36:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E71302899B for ; Wed, 7 Aug 2019 20:36:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6220289BA; Wed, 7 Aug 2019 20:36:13 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7A7DD2899B for ; Wed, 7 Aug 2019 20:36:13 +0000 (UTC) Received: from localhost ([::1]:45158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvSfM-0003Xs-CV for patchwork-qemu-devel@patchwork.kernel.org; Wed, 07 Aug 2019 16:36:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34004) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvSf3-0002ls-7S for qemu-devel@nongnu.org; Wed, 07 Aug 2019 16:35:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hvSf2-00076N-9v for qemu-devel@nongnu.org; Wed, 07 Aug 2019 16:35:53 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45057) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hvSf2-00074q-4t for qemu-devel@nongnu.org; Wed, 07 Aug 2019 16:35:52 -0400 Received: by mail-pl1-f196.google.com with SMTP id y8so371397plr.12 for ; Wed, 07 Aug 2019 13:35:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:mime-version :content-transfer-encoding:cc:from:to; bh=R8xWP9Mxshej5PA8tCd2n8Cul5yLRtIaS9eOBFzo/ZQ=; b=KUyWjmUAbOC+J2jONqfzP2uIMNgkgs2g0HfmuWYJ/1M7rDGjKQsuoAovxiQhF+nNHv w6Lx1z/vHabGycNlkmKK8Pzr6+mNeynGToYOhWltSnoXIZ6UNgUtiTKH3SpMc6PmKysj U6l7ybPVw2ap6mEZBpKNjRIpZ3E3ZJmMWNGFcryomVeieoJXFfmLolp8GzcypsuYX1Oa h2LleLLrC0xvc48eFUH/SpZn3riX6rbXKIGA6SZ22GnlSlEJRRh//kZThvhP7Egt0Aj8 ptINeI1bIcwTkRF8MN0qDYgdtEZ0kATdA2pJHrfLNaNt5wEIKUWBKrQbn9ov/3c/clMi mQoQ== X-Gm-Message-State: APjAAAV1wAXRBohEFYufcXEVI9VBR/TdPY69shnBX/xsMM0zVUQvy/8B 7fW94Mh7znEjQp1ChETpWyrU8Q== X-Google-Smtp-Source: APXvYqxX5SLoJ8LCMG8hrdBU22+vVLN9GHqDo4HQr/WML2TFEw4hEbgiIF2ZxIqOC6C5Ikf2EfVGaQ== X-Received: by 2002:a17:902:82c4:: with SMTP id u4mr9960400plz.196.1565210150735; Wed, 07 Aug 2019 13:35:50 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id q22sm85567918pgh.49.2019.08.07.13.35.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 07 Aug 2019 13:35:50 -0700 (PDT) Date: Wed, 7 Aug 2019 10:49:44 -0700 Message-Id: <20190807174944.17944-1-palmer@sifive.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 From: Palmer Dabbelt To: qemu-riscv@nongnu.org, Alistair Francis X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.214.196 Subject: [Qemu-devel] [PATCH v2] RISC-V: Ignore the S and U extensions when formatting ISA strings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Atish Patra , Palmer Dabbelt , qemu-devel@nongnu.org, Paul Walmsley Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The ISA strings we're providing from QEMU aren't actually legal RISC-V ISA strings, as both the S and U extensions cannot exist as single-letter extensions and must instead be multi-letter strings. We're still using the ISA strings inside QEMU to track the availiable extensions, so this patch just strips out the S and U extensions when formatting ISA strings. This boots Linux on top of 4.1-rc3, which no longer has the U extension in /proc/cpuinfo. Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index f8d07bd20ad7..74f3449c4918 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -501,7 +501,22 @@ char *riscv_isa_string(RISCVCPU *cpu) char *p = isa_str + snprintf(isa_str, maxlen, "rv%d", TARGET_LONG_BITS); for (i = 0; i < sizeof(riscv_exts); i++) { if (cpu->env.misa & RV(riscv_exts[i])) { - *p++ = qemu_tolower(riscv_exts[i]); + char lower = qemu_tolower(riscv_exts[i]); + switch (lower) { + case 's': + case 'u': + /* + * The 's' and 'u' extensions shouldn't be passed in the device + * tree, but we still use them internally to track extension + * sets. Here we just explicitly remove them when formatting + * an ISA string. + */ + break; + + default: + *p++ = lower; + break; + } } } *p = '\0';