From nobody Wed Nov 27 21:37:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153482164558994.22225595655993; Mon, 20 Aug 2018 20:20:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 75553307D845; Tue, 21 Aug 2018 03:20:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3CBA8308BDA2; Tue, 21 Aug 2018 03:20:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E6CF0181A12E; Tue, 21 Aug 2018 03:20:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7L3Kf6v004578 for ; Mon, 20 Aug 2018 23:20:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 60EEA10CD65A; Tue, 21 Aug 2018 03:20:41 +0000 (UTC) Received: from hansolo.nay.redhat.com (wlan-69-196.nay.redhat.com [10.66.69.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABC7210CD6B3; Tue, 21 Aug 2018 03:20:39 +0000 (UTC) From: Han Han To: libvir-list@redhat.com Date: Tue, 21 Aug 2018 11:20:27 +0800 Message-Id: <20180821032028.11682-2-hhan@redhat.com> In-Reply-To: <20180821032028.11682-1-hhan@redhat.com> References: <20180821032028.11682-1-hhan@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Han Han Subject: [libvirt] [PATCH 1/2] virsh: Implement virNodeGetSEVInfo in virsh X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 21 Aug 2018 03:20:44 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add sub-command nodesevinfo to get node infomation of AMD SEV feature. Signed-off-by: Han Han --- tools/virsh-host.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++ tools/virsh.pod | 5 ++++ 2 files changed, 71 insertions(+) diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 16f504bafe..0bcd71a2b8 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -952,6 +952,67 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd) return ret; } =20 +/* + * "nodesevinfo" command + */ +static const vshCmdInfo info_nodesevinfo[] =3D { + {.name =3D "help", + .data =3D N_("AMD SEV feature information.") + }, + {.name =3D "desc", + .data =3D N_("Returns information of SEV feature about the node.") + }, + {.name =3D NULL} +}; + +static bool +cmdNodesevinfo(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) +{ + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + unsigned int flags =3D 0; + bool ret =3D false; + size_t i; + virshControlPtr priv =3D ctl->privData; + + if (nparams =3D=3D 0) { + /* Get the number of SEV info parameters */ + if (virNodeGetSEVInfo(priv->conn, NULL, &nparams, flags) !=3D 0) { + vshError(ctl, "%s", + _("Unable to get number of SEV info parameters")); + goto cleanup; + } + } + + if (nparams =3D=3D 0) { + ret =3D true; + goto cleanup; + } + + /* Now get all the SEV info parameters */ + params =3D vshCalloc(ctl, nparams, sizeof(params)); + if (virNodeGetSEVInfo(priv->conn, ¶ms, &nparams, flags) !=3D 0) { + vshError(ctl, "%s", _("Unable to get SEV info parameters")); + goto cleanup; + } + + /* XXX: Need to sort the returned params once new parameter + * fields not of shared memory are added. + */ + vshPrint(ctl, _("SEV info:\n")); + for (i =3D 0; i < nparams; i++) { + char *str =3D vshGetTypedParamValue(ctl, ¶ms[i]); + vshPrint(ctl, "\t%-15s %s\n", params[i].field, str); + VIR_FREE(str); + } + + ret =3D true; + + cleanup: + virTypedParamsFree(params, nparams); + return ret; +} + /* * "nodesuspend" command */ @@ -1900,6 +1961,11 @@ const vshCmdDef hostAndHypervisorCmds[] =3D { .info =3D info_nodememstats, .flags =3D 0 }, + {.name =3D "nodesevinfo", + .handler =3D cmdNodesevinfo, + .info =3D info_nodesevinfo, + .flags =3D 0 + }, {.name =3D "nodesuspend", .handler =3D cmdNodeSuspend, .opts =3D opts_node_suspend, diff --git a/tools/virsh.pod b/tools/virsh.pod index 4e118851f8..ea513c0acc 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -317,6 +317,11 @@ of cpu statistics during 1 second. Returns memory stats of the node. If I is specified, this will print the specified cell statistics onl= y. =20 +=3Ditem B + +Display AMD's SEV feature of this host, including PDH, cert-chain, cbitpos +and reduced-phys-bits. + =3Ditem B [I] [I] =20 Puts the node (host machine) into a system-wide sleep state and schedule --=20 2.18.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Nov 27 21:37:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1534821653302958.2394327606477; Mon, 20 Aug 2018 20:20:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F4C54E90C; Tue, 21 Aug 2018 03:20:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D147B308BDA0; Tue, 21 Aug 2018 03:20:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 94A9C181A13A; Tue, 21 Aug 2018 03:20:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7L3Kis8004588 for ; Mon, 20 Aug 2018 23:20:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id DE22B10EE781; Tue, 21 Aug 2018 03:20:43 +0000 (UTC) Received: from hansolo.nay.redhat.com (wlan-69-196.nay.redhat.com [10.66.69.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36FC110CD658; Tue, 21 Aug 2018 03:20:41 +0000 (UTC) From: Han Han To: libvir-list@redhat.com Date: Tue, 21 Aug 2018 11:20:28 +0800 Message-Id: <20180821032028.11682-3-hhan@redhat.com> In-Reply-To: <20180821032028.11682-1-hhan@redhat.com> References: <20180821032028.11682-1-hhan@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Han Han Subject: [libvirt] [PATCH 2/2] news: Add nodesevinfo command in virsh X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 21 Aug 2018 03:20:51 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Han Han --- docs/news.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index c6d03f5556..fc9db92d05 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -63,6 +63,15 @@ Support the vhost-vsock-ccw device on S390. + + + virsh: Add subcommand nodesevinfo + + + Implement virNodeGetSEVInfo in virsh nodesevinfo to get AMD SEV + features of host. + +
--=20 2.18.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list