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 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E16A6C35247 for ; Mon, 3 Feb 2020 17:12:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B29132080D for ; Mon, 3 Feb 2020 17:12:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aBWrfiX6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728421AbgBCRMw (ORCPT ); Mon, 3 Feb 2020 12:12:52 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:47930 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726287AbgBCRMw (ORCPT ); Mon, 3 Feb 2020 12:12:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580749970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jCimoT7vPuapUWMTalWFNqWDzb69UF8BoVS/mAn8gMw=; b=aBWrfiX6sIQyrT6v9F2eXhknFOS+vLYTEwcifZIh8yCN+NyyL0euf48oyyIBHw6KGWRyGb mAVIumEY+SC81zu2S8S1DlFT0x9kO/mhIpyjdBf/Xi980sOlm8mDM6ZlqxulJ/uXY5CvWi 8GaSLaRkYB3K4QVH/D1CFrpWm8EEQrg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-389-4cQJuupUPSe6mP1qzFCgMg-1; Mon, 03 Feb 2020 12:12:46 -0500 X-MC-Unique: 4cQJuupUPSe6mP1qzFCgMg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 606381800D41; Mon, 3 Feb 2020 17:12:45 +0000 (UTC) Received: from gondolin (ovpn-117-79.ams2.redhat.com [10.36.117.79]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FC6E60BE2; Mon, 3 Feb 2020 17:12:41 +0000 (UTC) Date: Mon, 3 Feb 2020 18:12:38 +0100 From: Cornelia Huck To: Christian Borntraeger Cc: Janosch Frank , KVM , David Hildenbrand , Thomas Huth , Ulrich Weigand , Claudio Imbrenda , Andrea Arcangeli Subject: Re: [RFCv2 02/37] s390/protvirt: introduce host side setup Message-ID: <20200203181238.7c7ea03b.cohuck@redhat.com> In-Reply-To: <20200203131957.383915-3-borntraeger@de.ibm.com> References: <20200203131957.383915-1-borntraeger@de.ibm.com> <20200203131957.383915-3-borntraeger@de.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, 3 Feb 2020 08:19:22 -0500 Christian Borntraeger wrote: > From: Vasily Gorbik > > Introduce KVM_S390_PROTECTED_VIRTUALIZATION_HOST kbuild option for > protected virtual machines hosting support code. Hm... I seem to remember that you wanted to drop this config option and always build the code, in order to reduce complexity. Have you reconsidered this? > > Add "prot_virt" command line option which controls if the kernel > protected VMs support is enabled at early boot time. This has to be > done early, because it needs large amounts of memory and will disable > some features like STP time sync for the lpar. > > Extend ultravisor info definitions and expose it via uv_info struct > filled in during startup. > > Signed-off-by: Vasily Gorbik > --- > .../admin-guide/kernel-parameters.txt | 5 ++ > arch/s390/boot/Makefile | 2 +- > arch/s390/boot/uv.c | 20 +++++++- > arch/s390/include/asm/uv.h | 46 ++++++++++++++++-- > arch/s390/kernel/Makefile | 1 + > arch/s390/kernel/setup.c | 4 -- > arch/s390/kernel/uv.c | 48 +++++++++++++++++++ > arch/s390/kvm/Kconfig | 19 ++++++++ > 8 files changed, 136 insertions(+), 9 deletions(-) > create mode 100644 arch/s390/kernel/uv.c (...) > diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c > new file mode 100644 > index 000000000000..35ce89695509 > --- /dev/null > +++ b/arch/s390/kernel/uv.c > @@ -0,0 +1,48 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Common Ultravisor functions and initialization > + * > + * Copyright IBM Corp. 2019 Happy new year? > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST > +int __bootdata_preserved(prot_virt_guest); Confused. You have this and uv_info below both in this file and in boot/uv.c. Is there some magic happening in __bootdata_preserved()? > +#endif > + > +#ifdef CONFIG_KVM_S390_PROTECTED_VIRTUALIZATION_HOST > +int prot_virt_host; > +EXPORT_SYMBOL(prot_virt_host); > +struct uv_info __bootdata_preserved(uv_info); > +EXPORT_SYMBOL(uv_info); > + > +static int __init prot_virt_setup(char *val) > +{ > + bool enabled; > + int rc; > + > + rc = kstrtobool(val, &enabled); > + if (!rc && enabled) > + prot_virt_host = 1; > + > + if (is_prot_virt_guest() && prot_virt_host) { > + prot_virt_host = 0; > + pr_info("Running as protected virtualization guest."); Trying to disentangle that a bit in my mind... If we don't have facility 158, is_prot_virt_guest() will return 0. If protected host support has been requested, we'll print a message below (and turn it off). If the hardware provides the facilities for running as a protected virt guest, we turn off protected virt host support if requested and print a messages that we're a guest. Two questions: - Can the hardware ever provide both host and guest interfaces at the same time? I guess not; maybe add a comment? - Do we also want to print a message that we're running as a guest if the user didn't enable host support? If not, maybe prefix the message with "Cannot enable support for protected virtualization host:" or so? (Maybe also a good idea for the message below.) > + } > + > + if (prot_virt_host && !test_facility(158)) { > + prot_virt_host = 0; > + pr_info("The ultravisor call facility is not available."); > + } > + > + return rc; > +} > +early_param("prot_virt", prot_virt_setup); > +#endif (...)