From nobody Tue May 7 20:56:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600415616; cv=none; d=zohomail.com; s=zohoarc; b=kd3at2g+IxxZ0DDdlQfqisqif2m5rmJMUQ1My8UacGINBwB6d6YXMMinRvdt+/+uZd8thre9apEJGOs6ozZXOGhVskB/3BYlsCwU7mUcphh+k5DKvNbQS+P3amMIc1paWyxFqoMkQ4iHUqM4GEPBZ/8RJZjRIkLTFXGTIUE2Paw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600415616; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bOtfch8ZhcX71UJzfmytbrAC4LhkTS8uzmlxgfFYy4s=; b=ljAYbRXSkWBJdeMX6TnEAE8v22pqEsnpmFINSumHNcAzwh79Wq6sBFYEFfEldO49ybzbWWkjyfJGXKpcjDYQWyZJCMdaVg0zzguxj6AlxksoOqrvJy8OYos5cAVHNNmZRxkjHmUpn6RAwQZQbdrIzI2JGYCkeJ2/C5yJEaJo2AM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16004156163761002.0862049843831; Fri, 18 Sep 2020 00:53:36 -0700 (PDT) Received: from localhost ([::1]:33034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJBD4-0005oc-Q1 for importer@patchew.org; Fri, 18 Sep 2020 03:53:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJB7I-0000JV-J8 for qemu-devel@nongnu.org; Fri, 18 Sep 2020 03:47:36 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33031 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJB7G-0008OS-MN for qemu-devel@nongnu.org; Fri, 18 Sep 2020 03:47:36 -0400 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-51-8iKMz4LsMMuxJyYdxlV2hg-1; Fri, 18 Sep 2020 03:47:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A03991084C95; Fri, 18 Sep 2020 07:47:30 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-92.ams2.redhat.com [10.36.113.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id E02D655773; Fri, 18 Sep 2020 07:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600415253; 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=bOtfch8ZhcX71UJzfmytbrAC4LhkTS8uzmlxgfFYy4s=; b=ePHbUX5G7A5ZYxiiR+FTGp3Qi9LjGzM8GNPkYFXoZzWKMhkqlPk97+Iis5GGTlPJSxsd6E xV8NkDMFfX9ZUCQHTStem6iuGm1yD0u0bx0p41edCm5rludjHhkdlcOsRRVGIv6ffvAuEp eMUpvfcTENPEwsUEf4eqxxh89iBiPpI= X-MC-Unique: 8iKMz4LsMMuxJyYdxlV2hg-1 From: Stefano Garzarella To: qemu-devel@nongnu.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Cornelia Huck Subject: [PATCH v3 1/4] virtio: skip legacy support check on machine types less than 5.1 Date: Fri, 18 Sep 2020 09:47:07 +0200 Message-Id: <20200918074710.27810-2-sgarzare@redhat.com> In-Reply-To: <20200918074710.27810-1-sgarzare@redhat.com> References: <20200918074710.27810-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=sgarzare@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=sgarzare@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 03:47:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.997, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Qinghua Cheng , Eduardo Habkost , David Hildenbrand , qemu-stable@nongnu.org, Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson , Qian Cai Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on") added a check that returns an error if legacy support is on, but the device is not legacy. Unfortunately some devices were wrongly declared legacy even if they were not (e.g vhost-vsock). To avoid migration issues, we add a virtio-device property (x-disable-legacy-check) to skip the legacy error, printing a warning instaed, for machine types < 5.1. Cc: qemu-stable@nongnu.org Fixes: 9b3a35ec82 ("virtio: verify that legacy support is not accidentally = on") Suggested-by: Dr. David Alan Gilbert Suggested-by: Cornelia Huck Signed-off-by: Stefano Garzarella Reviewed-by: Cornelia Huck --- v3: - added virtio_legacy_check_disabled() helper - moved warning where error was returned [Cornelia] v2: - fixed Cornelia's e-mail address --- include/hw/virtio/virtio.h | 2 ++ hw/core/machine.c | 1 + hw/s390x/virtio-ccw.c | 15 ++++++++++++--- hw/virtio/virtio-pci.c | 14 ++++++++++++-- hw/virtio/virtio.c | 7 +++++++ 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 807280451b..f90cfb03e3 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -103,6 +103,7 @@ struct VirtIODevice bool use_started; bool started; bool start_on_kick; /* when virtio 1.0 feature has not been negotiated= */ + bool disable_legacy_check; VMChangeStateEntry *vmstate; char *bus_name; uint8_t device_endian; @@ -396,5 +397,6 @@ static inline bool virtio_device_disabled(VirtIODevice = *vdev) } =20 bool virtio_legacy_allowed(VirtIODevice *vdev); +bool virtio_legacy_check_disabled(VirtIODevice *vdev); =20 #endif diff --git a/hw/core/machine.c b/hw/core/machine.c index ea26d61237..b686eab798 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -44,6 +44,7 @@ GlobalProperty hw_compat_5_0[] =3D { { "vmport", "x-signal-unsupported-cmd", "off" }, { "vmport", "x-report-vmx-type", "off" }, { "vmport", "x-cmds-v2", "off" }, + { "virtio-device", "x-disable-legacy-check", "true" }, }; const size_t hw_compat_5_0_len =3D G_N_ELEMENTS(hw_compat_5_0); =20 diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 8feb3451a0..97a01bc48a 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1122,9 +1122,18 @@ static void virtio_ccw_device_plugged(DeviceState *d= , Error **errp) } =20 if (!virtio_ccw_rev_max(dev) && !virtio_legacy_allowed(vdev)) { - error_setg(errp, "Invalid value of property max_rev " - "(is %d expected >=3D 1)", virtio_ccw_rev_max(dev)); - return; + /* + * To avoid migration issues, we allow legacy mode when legacy + * check is disabled in the old machine types (< 5.1). + */ + if (virtio_legacy_check_disabled(vdev)) { + warn_report("device is modern-only, but for backward " + "compatibility legacy is allowed"); + } else { + error_setg(errp, "Invalid value of property max_rev " + "(is %d expected >=3D 1)", virtio_ccw_rev_max(dev)); + return; + } } =20 if (virtio_get_num_queues(vdev) > VIRTIO_QUEUE_MAX) { diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 5bc769f685..bb91e34594 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1597,8 +1597,18 @@ static void virtio_pci_device_plugged(DeviceState *d= , Error **errp) =20 if (legacy) { if (!virtio_legacy_allowed(vdev)) { - error_setg(errp, "device is modern-only, use disable-legacy=3D= on"); - return; + /* + * To avoid migration issues, we allow legacy mode when legacy + * check is disabled in the old machine types (< 5.1). + */ + if (virtio_legacy_check_disabled(vdev)) { + warn_report("device is modern-only, but for backward " + "compatibility legacy is allowed"); + } else { + error_setg(errp, + "device is modern-only, use disable-legacy=3Don= "); + return; + } } if (virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM)) { error_setg(errp, "VIRTIO_F_IOMMU_PLATFORM was supported by" diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index e983025217..b85277da67 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3304,6 +3304,11 @@ bool virtio_legacy_allowed(VirtIODevice *vdev) } } =20 +bool virtio_legacy_check_disabled(VirtIODevice *vdev) +{ + return vdev->disable_legacy_check; +} + hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n) { return vdev->vq[n].vring.desc; @@ -3713,6 +3718,8 @@ static Property virtio_properties[] =3D { DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, host_features), DEFINE_PROP_BOOL("use-started", VirtIODevice, use_started, true), DEFINE_PROP_BOOL("use-disabled-flag", VirtIODevice, use_disabled_flag,= true), + DEFINE_PROP_BOOL("x-disable-legacy-check", VirtIODevice, + disable_legacy_check, false), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.26.2 From nobody Tue May 7 20:56:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600415759; cv=none; d=zohomail.com; s=zohoarc; b=RMcU7siNYP+GBrYrOIx72M4neEg+q9FR2oKdRxASy4OVjk3dN0MX1bMcdkSvZP+peO+smMxbgyuje52XvdkrsDnZ6nmOvcfY2EYf2qJzi7oYiYX7sG6D5SFav64WJPL5OHG1po3Zsp6whMvwxDbYwbYD4UFjVuo5zIhgqonH4rA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600415759; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=otkV9JMmoK5sSwVWVNAvedJTysACuBjOKRt5Slm4jUM=; b=SURjYCmWcP2wVEkjSqxEW7OLiM3lOC05egOZfDRyUhaNxKOjsDn4puBHW6KMI/KLUpUV0iyXayB9xnv39wzGwyfSbi/N0HlcPJpy1CREsQx61XF58G2d/2f+mHVJ4rGFnac1GzAyYP30UCIoO8pO6T87bsv2bkLLTdq5iIDciYM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160041575992923.05275833059943; Fri, 18 Sep 2020 00:55:59 -0700 (PDT) Received: from localhost ([::1]:38978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJBFO-0008I8-H2 for importer@patchew.org; Fri, 18 Sep 2020 03:55:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJB7S-0000VC-PE for qemu-devel@nongnu.org; Fri, 18 Sep 2020 03:47:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44347) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJB7Q-0008Q7-S1 for qemu-devel@nongnu.org; Fri, 18 Sep 2020 03:47:46 -0400 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-266-oZKewhyXMvid6LwO1ot_Zg-1; Fri, 18 Sep 2020 03:47:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2E5686408F; Fri, 18 Sep 2020 07:47:37 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-92.ams2.redhat.com [10.36.113.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0979355773; Fri, 18 Sep 2020 07:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600415262; 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=otkV9JMmoK5sSwVWVNAvedJTysACuBjOKRt5Slm4jUM=; b=ggJsPNk2HfuhLyMT47321XGYqlGo8JWtOnYvTF4GNOAPXyQ4aI3/HcgJQTIcAQNV7raCFg dbBAVmZOrp7h3z5f7swu81FwACGsc3q2kCnVzGLvNCVQFm9SBbBE1Fwm+193X5e1BIrIlZ k2RFRWQQjuJH5yU1tMEiEm1nT99fVF8= X-MC-Unique: oZKewhyXMvid6LwO1ot_Zg-1 From: Stefano Garzarella To: qemu-devel@nongnu.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Cornelia Huck Subject: [PATCH v3 2/4] vhost-vsock-pci: force virtio version 1 Date: Fri, 18 Sep 2020 09:47:08 +0200 Message-Id: <20200918074710.27810-3-sgarzare@redhat.com> In-Reply-To: <20200918074710.27810-1-sgarzare@redhat.com> References: <20200918074710.27810-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=sgarzare@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=sgarzare@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 00:20:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.997, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Qinghua Cheng , Eduardo Habkost , David Hildenbrand , qemu-stable@nongnu.org, Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson , Qian Cai Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on") added a safety check that requires to set 'disable-legacy=3Don' on vhost-vsock-pci device: $ ./qemu-system-x86_64 ... -device vhost-vsock-pci,guest-cid=3D5 qemu-system-x86_64: -device vhost-vsock-pci,guest-cid=3D5: device is modern-only, use disable-legacy=3Don virtio-vsock was introduced after the release of VIRTIO 1.0 specifications, so it should be 'modern-only'. In addition Cornelia verified that forcing a legacy mode on vhost-vsock-pci device using x86-64 host and s390x guest, so with different endianness, produces strange behaviours. This patch forces virtio version 1 and removes the 'transitional_name' property removing the need to specify 'disable-legacy=3Don' on vhost-vsock-pci device. To avoid migration issues, we force virtio version 1 only when legacy check is enabled in the new machine types (>=3D 5.1). Cc: qemu-stable@nongnu.org Reported-by: Qian Cai Reported-by: Qinghua Cheng Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1868449 Suggested-by: Cornelia Huck Signed-off-by: Stefano Garzarella --- v3: - forced virtio version 1 only with new machine types v2: - fixed commit message [Cornelia] --- hw/virtio/vhost-vsock-pci.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vsock-pci.c b/hw/virtio/vhost-vsock-pci.c index e56067b427..205da8d1f5 100644 --- a/hw/virtio/vhost-vsock-pci.c +++ b/hw/virtio/vhost-vsock-pci.c @@ -44,6 +44,15 @@ static void vhost_vsock_pci_realize(VirtIOPCIProxy *vpci= _dev, Error **errp) { VHostVSockPCI *dev =3D VHOST_VSOCK_PCI(vpci_dev); DeviceState *vdev =3D DEVICE(&dev->vdev); + VirtIODevice *virtio_dev =3D VIRTIO_DEVICE(vdev); + + /* + * To avoid migration issues, we force virtio version 1 only when + * legacy check is enabled in the new machine types (>=3D 5.1). + */ + if (!virtio_legacy_check_disabled(virtio_dev)) { + virtio_pci_force_virtio_1(vpci_dev); + } =20 qdev_realize(vdev, BUS(&vpci_dev->bus), errp); } @@ -73,7 +82,6 @@ static void vhost_vsock_pci_instance_init(Object *obj) static const VirtioPCIDeviceTypeInfo vhost_vsock_pci_info =3D { .base_name =3D TYPE_VHOST_VSOCK_PCI, .generic_name =3D "vhost-vsock-pci", - .transitional_name =3D "vhost-vsock-pci-transitional", .non_transitional_name =3D "vhost-vsock-pci-non-transitional", .instance_size =3D sizeof(VHostVSockPCI), .instance_init =3D vhost_vsock_pci_instance_init, --=20 2.26.2 From nobody Tue May 7 20:56:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600415361; cv=none; d=zohomail.com; s=zohoarc; b=Iq8cnLDvZVE4coeNayme8kDunvFfZo7x5/0tpVyT8qw4WaH4Oe4VY7uhp19YyvslsY3G9JUJ3UVUP4FAc/NIBZrbJBtwyk/T/5fPYKaEeaZieqheq/hM1Zew6+uw12Rmgpz9aDw928nl4YKUKzFhESA+OD1CIp+QS0mghscdE2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600415361; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zcswl9xJbFxQIciRzfMy6+B6mLyBS92ppBDS30waMgs=; b=jIO/r6Gsb6q5+aGaDQK/vSHlg88NlVpGg9/so48F3gBS4xRh2FIP/FJ5Dn9sH5ip6aDiarwTuofYA4VXb4IHR56aKgXznV4OkiUeUaqsT20DL6aczwENpvJWzNcznRyknbInKDHol9AuJPLRRRDAxo69VTHrh8sV5HhA6gf8+bQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600415361441966.2268354132578; Fri, 18 Sep 2020 00:49:21 -0700 (PDT) Received: from localhost ([::1]:51956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJB8x-0001oE-MS for importer@patchew.org; Fri, 18 Sep 2020 03:49:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJB7e-0000ZC-ER for qemu-devel@nongnu.org; Fri, 18 Sep 2020 03:48:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59865) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJB7Z-0008SE-HE for qemu-devel@nongnu.org; Fri, 18 Sep 2020 03:47:58 -0400 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-10-5awjm5dQMNy01eY1BCMbQw-1; Fri, 18 Sep 2020 03:47:50 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 060451084C92; Fri, 18 Sep 2020 07:47:49 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-92.ams2.redhat.com [10.36.113.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8990255772; Fri, 18 Sep 2020 07:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600415271; 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=zcswl9xJbFxQIciRzfMy6+B6mLyBS92ppBDS30waMgs=; b=HDpCUl/kNt2oC+564FcJnIWGdRGoej8zfbVNuhDBoabDWe9Vfdq0EOYe9Rk2++iFqNvLdy v1ab6nHq1u7wzLPOs2XgUjt1/AB+/XN5NW2pxBbjBDn1qqfdt+oWtxJSeNJ/aF7bRRYAfB ZM1WHRtJ1qtvx9fX5wj2WeVzWOsJDms= X-MC-Unique: 5awjm5dQMNy01eY1BCMbQw-1 From: Stefano Garzarella To: qemu-devel@nongnu.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Cornelia Huck Subject: [PATCH v3 3/4] vhost-user-vsock-pci: force virtio version 1 Date: Fri, 18 Sep 2020 09:47:09 +0200 Message-Id: <20200918074710.27810-4-sgarzare@redhat.com> In-Reply-To: <20200918074710.27810-1-sgarzare@redhat.com> References: <20200918074710.27810-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=sgarzare@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=sgarzare@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 00:20:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.997, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Qinghua Cheng , Eduardo Habkost , David Hildenbrand , qemu-stable@nongnu.org, Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson , Qian Cai Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on") added a safety check that requires to set 'disable-legacy=3Don' on vhost-user-vsock-pci device: $ ./qemu-system-x86_64 ... \ -chardev socket,id=3Dchar0,reconnect=3D0,path=3D/tmp/vhost4.socket \ -device vhost-user-vsock-pci,chardev=3Dchar0 qemu-system-x86_64: -device vhost-user-vsock-pci,chardev=3Dchar0: device is modern-only, use disable-legacy=3Don virtio-vsock was introduced after the release of VIRTIO 1.0 specifications, so it should be 'modern-only'. This patch forces virtio version 1 and removes the 'transitional_name' property, as done for vhost-vsock-pci, removing the need to specify 'disable-legacy=3Don' on vhost-user-vsock-pci device. Cc: qemu-stable@nongnu.org Suggested-by: Cornelia Huck Reviewed-by: Cornelia Huck Signed-off-by: Stefano Garzarella --- v2: - fixed commit message [Cornelia] --- hw/virtio/vhost-user-vsock-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost-user-vsock-pci.c b/hw/virtio/vhost-user-vsock-= pci.c index 763f89984e..14109121e2 100644 --- a/hw/virtio/vhost-user-vsock-pci.c +++ b/hw/virtio/vhost-user-vsock-pci.c @@ -41,6 +41,7 @@ static void vhost_user_vsock_pci_realize(VirtIOPCIProxy *= vpci_dev, Error **errp) VHostUserVSockPCI *dev =3D VHOST_USER_VSOCK_PCI(vpci_dev); DeviceState *vdev =3D DEVICE(&dev->vdev); =20 + virtio_pci_force_virtio_1(vpci_dev); qdev_realize(vdev, BUS(&vpci_dev->bus), errp); } =20 @@ -69,7 +70,6 @@ static void vhost_user_vsock_pci_instance_init(Object *ob= j) static const VirtioPCIDeviceTypeInfo vhost_user_vsock_pci_info =3D { .base_name =3D TYPE_VHOST_USER_VSOCK_PCI, .generic_name =3D "vhost-user-vsock-pci", - .transitional_name =3D "vhost-user-vsock-pci-transitional", .non_transitional_name =3D "vhost-user-vsock-pci-non-transitional", .instance_size =3D sizeof(VHostUserVSockPCI), .instance_init =3D vhost_user_vsock_pci_instance_init, --=20 2.26.2 From nobody Tue May 7 20:56:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600415870; cv=none; d=zohomail.com; s=zohoarc; b=X4gnO6WV4J/2jCaMUWsxYdnCFORQ+I2vnmTM6SR0QNPLmwKBs9viyaGQ+DS4+bc7cn5pEZQLzPLWCs5nfou/ox13gKdjr7znIoS9ng7ubB3Xkh6FbiLGXhshCp0mgXUqvVI+qcOFoSQoYIiI1hu66XLXh2ztK1oSNqJLJdgOCx0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600415870; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ur9qZSAsLSOK/VR3EirI9d3AW5Xs2qWrYAuAh+6fJ/E=; b=cZzTAWzC7BQGMfIHQ+qpKnyeGI1MAjS5GnkXXiUNgl2dWn/vDy/WPA1ETw5VpE5SyLLSyURnfhf0siUmrkC9puV1aY29BvVLzBf+eLyIMgCnuj0td6QkAVTfvpVi0mz9ov6qiUb4tInVVim7EVkEiPNgM0bo8lo8FpPWqM5aaw8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600415870788974.9520836688708; Fri, 18 Sep 2020 00:57:50 -0700 (PDT) Received: from localhost ([::1]:43838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJBHB-0001yl-Jf for importer@patchew.org; Fri, 18 Sep 2020 03:57:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJB8A-0001FE-7v for qemu-devel@nongnu.org; Fri, 18 Sep 2020 03:48:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43091) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJB88-00005g-Mf for qemu-devel@nongnu.org; Fri, 18 Sep 2020 03:48:29 -0400 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-205-YbwsRouvNVOUPrhERK0Bzg-1; Fri, 18 Sep 2020 03:48:24 -0400 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 0CF721084C93; Fri, 18 Sep 2020 07:48:23 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-92.ams2.redhat.com [10.36.113.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E58C60BEC; Fri, 18 Sep 2020 07:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600415308; 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=Ur9qZSAsLSOK/VR3EirI9d3AW5Xs2qWrYAuAh+6fJ/E=; b=jS4YMCEc+WGnxIjt4JH3/GptYhZqRKa0KOEVrng/ATAdkpfOByjJp5/ENg5IdvUVN9Nbbn YAUioFlFYntEx0jUN18wa0HWrbEgTNrGi0QPyWRJD+4Xfg1/ObGSt3RiGqt3p/4Uq/5nLt 9iy/rNe8T5IeF+sku9c46h9JeJk4PHc= X-MC-Unique: YbwsRouvNVOUPrhERK0Bzg-1 From: Stefano Garzarella To: qemu-devel@nongnu.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Cornelia Huck Subject: [PATCH v3 4/4] vhost-vsock-ccw: force virtio version 1 Date: Fri, 18 Sep 2020 09:47:10 +0200 Message-Id: <20200918074710.27810-5-sgarzare@redhat.com> In-Reply-To: <20200918074710.27810-1-sgarzare@redhat.com> References: <20200918074710.27810-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=sgarzare@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=sgarzare@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 01:32:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.997, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Qinghua Cheng , Eduardo Habkost , David Hildenbrand , qemu-stable@nongnu.org, Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson , Qian Cai Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" virtio-vsock was introduced after the release of VIRTIO 1.0 specifications, so it should be 'modern-only'. This patch forces virtio version 1 as done for vhost-vsock-pci. To avoid migration issues, we force virtio version 1 only when legacy check is enabled in the new machine types (>=3D 5.1). Cc: qemu-stable@nongnu.org Suggested-by: Cornelia Huck Signed-off-by: Stefano Garzarella Reviewed-by: Cornelia Huck --- v3: - forced virtio version 1 only with new machine types --- hw/s390x/vhost-vsock-ccw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/s390x/vhost-vsock-ccw.c b/hw/s390x/vhost-vsock-ccw.c index 0822ecca89..246416a8f9 100644 --- a/hw/s390x/vhost-vsock-ccw.c +++ b/hw/s390x/vhost-vsock-ccw.c @@ -40,9 +40,21 @@ static void vhost_vsock_ccw_class_init(ObjectClass *klas= s, void *data) static void vhost_vsock_ccw_instance_init(Object *obj) { VHostVSockCCWState *dev =3D VHOST_VSOCK_CCW(obj); + VirtioCcwDevice *ccw_dev =3D VIRTIO_CCW_DEVICE(obj); + VirtIODevice *virtio_dev; =20 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), TYPE_VHOST_VSOCK); + + virtio_dev =3D VIRTIO_DEVICE(&dev->vdev); + + /* + * To avoid migration issues, we force virtio version 1 only when + * legacy check is enabled in the new machine types (>=3D 5.1). + */ + if (!virtio_legacy_check_disabled(virtio_dev)) { + ccw_dev->force_revision_1 =3D true; + } } =20 static const TypeInfo vhost_vsock_ccw_info =3D { --=20 2.26.2