From: Janosch Frank <frankja@linux.ibm.com>
To: "Cédric Le Goater" <clg@kaod.org>, qemu-s390x@nongnu.org
Cc: qemu-devel@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
"David Hildenbrand" <david@redhat.com>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Cédric Le Goater" <clg@redhat.com>
Subject: Re: [PATCH v2 2/4] s390x/pv: Check for support on the host
Date: Mon, 9 Jan 2023 09:45:18 +0100 [thread overview]
Message-ID: <2b69a682-692b-7151-caec-132182fa2e08@linux.ibm.com> (raw)
In-Reply-To: <20230106075330.3662549-3-clg@kaod.org>
On 1/6/23 08:53, Cédric Le Goater wrote:
> From: Cédric Le Goater <clg@redhat.com>
>
> Support for protected VMs should have been enabled on the host with
> the kernel parameter 'prot_virt=1'. If the hardware supports the
> feature, it is reflected under sysfs.
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
Any reason why you didn't use KVM_CAP_S390_PROTECTED?
The sysfs interface isn't meant to be parsed by programs, it's been
introduced for humans. Most of the interface's data has therefore been
made available via the UV info API.
> ---
> hw/s390x/pv.c | 23 ++++++++++++++++++++++-
> 1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
> index 8a1c71436b..d53ef8fd38 100644
> --- a/hw/s390x/pv.c
> +++ b/hw/s390x/pv.c
> @@ -14,6 +14,7 @@
> #include <linux/kvm.h>
>
> #include "qapi/error.h"
> +#include "qemu/cutils.h"
> #include "qemu/error-report.h"
> #include "sysemu/kvm.h"
> #include "qom/object_interfaces.h"
> @@ -280,9 +281,29 @@ static bool s390_pv_check_cpus(Error **errp)
> return true;
> }
>
> +#define S390_PV_HOST "/sys/firmware/uv/prot_virt_host"
> +
> +static bool s390_pv_check_host(Error **errp)
> +{
> + gchar *s = NULL;
> + uint64_t pv_host = 0;
> +
> + if (g_file_get_contents(S390_PV_HOST, &s, NULL, NULL)) {
> + pv_host = g_ascii_strtoull(s, NULL, 10);
> + }
> + g_free(s);
> +
> + if (pv_host != 1) {
> + error_setg(errp, "Host does not support protected VMs");
> + return false;
> + }
> +
> + return true;
> +}
> +
> static bool s390_pv_guest_check(ConfidentialGuestSupport *cgs, Error **errp)
> {
> - return s390_pv_check_cpus(errp);
> + return s390_pv_check_cpus(errp) && s390_pv_check_host(errp);
> }
>
> int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
next prev parent reply other threads:[~2023-01-09 8:56 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 7:53 [PATCH v2 0/4] s390x/pv: Improve protected VM support Cédric Le Goater
2023-01-06 7:53 ` [PATCH v2 1/4] s390x/pv: Implement a CGS check helper Cédric Le Goater
2023-01-09 13:34 ` Thomas Huth
2023-01-09 13:57 ` Cédric Le Goater
2023-01-09 14:12 ` Thomas Huth
2023-01-09 14:28 ` Cédric Le Goater
2023-01-06 7:53 ` [PATCH v2 2/4] s390x/pv: Check for support on the host Cédric Le Goater
2023-01-09 8:45 ` Janosch Frank [this message]
2023-01-09 9:44 ` Cédric Le Goater
2023-01-09 10:49 ` Janosch Frank
2023-01-06 7:53 ` [PATCH v2 3/4] s390x/pv: Introduce a s390_pv_check() helper for runtime Cédric Le Goater
2023-01-09 9:04 ` Janosch Frank
2023-01-09 9:27 ` Cédric Le Goater
2023-01-09 9:49 ` Janosch Frank
2023-01-09 13:30 ` Cédric Le Goater
2023-01-09 13:45 ` Janosch Frank
2023-01-09 13:53 ` Cédric Le Goater
2023-01-09 14:31 ` Janosch Frank
2023-01-09 14:52 ` Janosch Frank
2023-01-09 15:24 ` Cédric Le Goater
2023-01-06 7:53 ` [PATCH v2 4/4] s390x/pv: Move check on hugepage under s390_pv_guest_check() Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2b69a682-692b-7151-caec-132182fa2e08@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=clg@kaod.org \
--cc=clg@redhat.com \
--cc=david@redhat.com \
--cc=farman@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).