From nobody Sun Feb 8 19:33:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1565210202; cv=none; d=zoho.com; s=zohoarc; b=PN7Lcs+DQ7oONfs/bXdeCT9MWlEn+IFmmzO24ggGEq5CnI956CclOk5OwZ7L5Dm6+TiC8YiexCgPOTKEFfpFUr4GxvIUUPKSn/ZZuzxUD3dxPCBklAAESZbQNqKE4LMtau6TSlk1RETPDf22LvojV2KGDZoHsfbFatQiIzc/MwQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565210202; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=R8xWP9Mxshej5PA8tCd2n8Cul5yLRtIaS9eOBFzo/ZQ=; b=MEgae32qcPBQu6ap9a5zUW932U1t7okLqlyGyeojj02A/EnR7G4tlYil0174/I1RhQXDwbpDyL+TS/KR/sbejHZNHcBaB81CtqFKu+b+Eya+M0VkALYWpS+bJj6vrFk4FaA//zhgoOlfT+FlWXw3btMi1MjVNh+N1iHGtKDYrrc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565210202132888.7860185300822; Wed, 7 Aug 2019 13:36:42 -0700 (PDT) Received: from localhost ([::1]:45158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvSfg-0003Xs-Ht for importer@patchew.org; Wed, 07 Aug 2019 16:36:32 -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) 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) 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) 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 Content-Transfer-Encoding: quoted-printable 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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 =3D isa_str + snprintf(isa_str, maxlen, "rv%d", TARGET_LONG_BI= TS); for (i =3D 0; i < sizeof(riscv_exts); i++) { if (cpu->env.misa & RV(riscv_exts[i])) { - *p++ =3D qemu_tolower(riscv_exts[i]); + char lower =3D qemu_tolower(riscv_exts[i]); + switch (lower) { + case 's': + case 'u': + /* + * The 's' and 'u' extensions shouldn't be passed in the d= evice + * tree, but we still use them internally to track extensi= on + * sets. Here we just explicitly remove them when formatt= ing + * an ISA string. + */ + break; + + default: + *p++ =3D lower; + break; + } } } *p =3D '\0'; --=20 2.21.0