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=-10.1 required=3.0 tests=BAYES_00,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=unavailable 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 CC367C433E1 for ; Wed, 15 Jul 2020 11:51:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A428B20658 for ; Wed, 15 Jul 2020 11:51:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ry0B7kwB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730489AbgGOLvj (ORCPT ); Wed, 15 Jul 2020 07:51:39 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:24933 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728766AbgGOLvj (ORCPT ); Wed, 15 Jul 2020 07:51:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594813897; 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=r3FX3UuRCTo9UAVThurv1D/BIiQ0N6rOrGTWl0O4StY=; b=Ry0B7kwBPvO8OEY3orXXuVTOZhRxZ13ApjRYCZkoujMjI7mp9lKT+2beW1fRzvG9XFSSXv TAV88+Xp65xoReQeRZFbZHY9Cc6dNjQsK+1aVdwqWxvKxBxPxN2au9U4nMXcSebkuf6LyH ms3iho9oIUOhVrnMWm6mf0me8l+i9kA= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-489-RbIuBzCWPIyGmZ1lRFm4GA-1; Wed, 15 Jul 2020 07:51:36 -0400 X-MC-Unique: RbIuBzCWPIyGmZ1lRFm4GA-1 Received: by mail-qk1-f198.google.com with SMTP id 204so1281781qki.20 for ; Wed, 15 Jul 2020 04:51:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=r3FX3UuRCTo9UAVThurv1D/BIiQ0N6rOrGTWl0O4StY=; b=PkQiBPr66tXS+1BLZwKAP1G16IC9eREKXOjIB/+mvu8sjwwaFlEO9mueZ8tX36t4mA PwXwLxOykvoP+mzQtAooQKaq/fYeJI1pEAMewDgnyN8hi8ReG7/wkCDFvPL56DHI6HnZ +w0W1+KwCDJ1giJ4W5R1gBkdyy8ZvK0oEgUcbBXy/CNGVqVkPrXYowSaYyoJIna4R5e0 hkqPhN4ZMrgOZNTjUHqNrRBJLTMM2sEVFl66LID1jC6gmjqh/swerCI52KLzpDCIwAVS vpv/7SsfVYRZkBItog2aYnLPzHL0i0SrUHUYn1PLlkgVqrGpshTZYpl+EdKae8zXC8fZ 98JQ== X-Gm-Message-State: AOAM532FgiDexosVDQ3A4AUTn1BpzWITYdb96xZF2GhJmg/gAwnzZZ6O bPVf16cdpQDeQZ128BNcz7AQcX7IVJknQs8RSEKZYSFAbG29n9TSQI1NILO+6FLfrCFdcvL20AJ Msl5QSnLen4jXF+j9x/qUHqyQ X-Received: by 2002:a37:4249:: with SMTP id p70mr8978824qka.496.1594813895585; Wed, 15 Jul 2020 04:51:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx1aUJiCqHYur0Jh6ZYxhkiq8X5xdMXXfCrNDK8eHV+0xFXx7Y6LeDlwk29NTSE0FYz2C5zw== X-Received: by 2002:a37:4249:: with SMTP id p70mr8978802qka.496.1594813895270; Wed, 15 Jul 2020 04:51:35 -0700 (PDT) Received: from redhat.com (bzq-79-180-10-140.red.bezeqint.net. [79.180.10.140]) by smtp.gmail.com with ESMTPSA id n64sm2006264qke.77.2020.07.15.04.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 04:51:34 -0700 (PDT) Date: Wed, 15 Jul 2020 07:51:28 -0400 From: "Michael S. Tsirkin" To: Jason Wang Cc: Pierre Morel , linux-kernel@vger.kernel.org, pasic@linux.ibm.com, borntraeger@de.ibm.com, frankja@linux.ibm.com, cohuck@redhat.com, kvm@vger.kernel.org, linux-s390@vger.kernel.org, virtualization@lists.linux-foundation.org, thomas.lendacky@amd.com, david@gibson.dropbear.id.au, linuxram@us.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com Subject: Re: [PATCH v7 2/2] s390: virtio: PV needs VIRTIO I/O device protection Message-ID: <20200715074917-mutt-send-email-mst@kernel.org> References: <1594801869-13365-1-git-send-email-pmorel@linux.ibm.com> <1594801869-13365-3-git-send-email-pmorel@linux.ibm.com> <20200715054807-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 15, 2020 at 06:16:59PM +0800, Jason Wang wrote: > > On 2020/7/15 下午5:50, Michael S. Tsirkin wrote: > > On Wed, Jul 15, 2020 at 10:31:09AM +0200, Pierre Morel wrote: > > > If protected virtualization is active on s390, the virtio queues are > > > not accessible to the host, unless VIRTIO_F_IOMMU_PLATFORM has been > > > negotiated. Use the new arch_validate_virtio_features() interface to > > > fail probe if that's not the case, preventing a host error on access > > > attempt. > > > > > > Signed-off-by: Pierre Morel > > > Reviewed-by: Cornelia Huck > > > Acked-by: Halil Pasic > > > Acked-by: Christian Borntraeger > > > --- > > > arch/s390/mm/init.c | 28 ++++++++++++++++++++++++++++ > > > 1 file changed, 28 insertions(+) > > > > > > diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c > > > index 6dc7c3b60ef6..d39af6554d4f 100644 > > > --- a/arch/s390/mm/init.c > > > +++ b/arch/s390/mm/init.c > > > @@ -45,6 +45,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(.bss..swapper_pg_dir); > > > @@ -161,6 +162,33 @@ bool force_dma_unencrypted(struct device *dev) > > > return is_prot_virt_guest(); > > > } > > > +/* > > > + * arch_validate_virtio_features > > > + * @dev: the VIRTIO device being added > > > + * > > > + * Return an error if required features are missing on a guest running > > > + * with protected virtualization. > > > + */ > > > +int arch_validate_virtio_features(struct virtio_device *dev) > > > +{ > > > + if (!is_prot_virt_guest()) > > > + return 0; > > > + > > > + if (!virtio_has_feature(dev, VIRTIO_F_VERSION_1)) { > > > + dev_warn(&dev->dev, > > > + "legacy virtio not supported with protected virtualization\n"); > > > + return -ENODEV; > > > + } > > > + > > > + if (!virtio_has_feature(dev, VIRTIO_F_IOMMU_PLATFORM)) { > > > + dev_warn(&dev->dev, > > > + "support for limited memory access required for protected virtualization\n"); > > > + return -ENODEV; > > > + } > > > + > > > + return 0; > > > +} > > > + > > > /* protected virtualization */ > > > static void pv_init(void) > > > { > > What bothers me here is that arch code depends on virtio now. > > It works even with a modular virtio when functions are inline, > > but it seems fragile: e.g. it breaks virtio as an out of tree module, > > since layout of struct virtio_device can change. > > > The code was only called from virtio.c so it should be fine. > > And my understanding is that we don't need to care about the kABI issue > during upstream development? > > Thanks No, but so far it has been convenient at least for me, for development, to just be able to unload all of virtio and load a different version. > > > > > I'm not sure what to do with this yet, will try to think about it > > over the weekend. Thanks! > > > > > > > -- > > > 2.25.1