From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24AC4C25B06 for ; Sun, 14 Aug 2022 19:57:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 50F048419C; Sun, 14 Aug 2022 21:57:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="gCq71alh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6B6DD845F2; Sun, 14 Aug 2022 21:57:30 +0200 (CEST) Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1EE1E83FCA for ; Sun, 14 Aug 2022 21:57:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from workstation5.fritz.box (ip-062-143-094-109.um16.pools.vodafone-ip.de [62.143.94.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 6BFB43F11D; Sun, 14 Aug 2022 19:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1660507047; bh=23LYQy2edFkIp+TRU9JThzH3s8e52FsFxY3SUYTwTj0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gCq71alhWWEb0EHycjGP56Yex3dB/Jed9vgxHjBRcF+7eHs7/UjGqo0VprJmILsII KwjriwvD2Pla3ORB1EQO0AdyuA/w7mzyV0kX/dAmWh0IE8mVNITh4WAW/Jb2O5yRKF RN3FQibmgVoK734WLndyW8Y/FXj0zToNkLETbYIFa9YZeumMlEr83RGJ92oJ+/5fPV 3AEdBaPXivqiu7wkbFTLT3BZcdZbFueCoPmCtWsqTdkpHeZvRfX8CX4RHdjAIlos7L ssYYYQX7tusTgq479yQ7EbBca+3U0ZncKAcGUCY1IChzAJfZK0YtsUH+NsBvblYgEP /3FtbPvE1XEgw== From: Heinrich Schuchardt To: Rick Chen , Leo Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 1/1] cmd/sbi: format KVM version Date: Sun, 14 Aug 2022 21:57:14 +0200 Message-Id: <20220814195714.2522078-1-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Format the KVM implementation number in a human readable form. With the patch output of the sbi command for Linux 5.19.1 looks like: => sbi SBI 0.3 KVM 5.19.1 Machine: Vendor ID 0 Architecture ID 7005c Implementation ID 7005c Extensions: SBI Base Functionality Timer Extension IPI Extension RFENCE Extension Hart State Management Extension System Reset Extension Signed-off-by: Heinrich Schuchardt --- cmd/riscv/sbi.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c index ee11e0f88e..522f502435 100644 --- a/cmd/riscv/sbi.c +++ b/cmd/riscv/sbi.c @@ -68,11 +68,21 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc, ret = sbi_get_impl_version(&vers); if (ret < 0) break; - if (impl_id == 1) + switch (impl_id) { + case 1: /* OpenSBI */ printf("%ld.%ld", vers >> 16, vers & 0xffff); - else + break; + case 3: /* KVM */ + printf("%ld.%ld.%ld", + vers >> 16, + (vers >> 8) & 0xff, + vers & 0xff); + break; + default: printf("0x%lx", vers); + break; + } break; } } -- 2.36.1