From nobody Thu May 16 05:41:40 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=1600677765; cv=none; d=zohomail.com; s=zohoarc; b=NTl6lPJ/VkBBxC0ELpLAdD2L3mSnFb0Gel9/dD9uIH3z581f+HPXn/jBQ6ZSdsvLvMB/0/3QEShEePrW32xsh2/jFWkmThwrXJO1f89pgYaufQjGzr0ToZaeYIKaTEJaLGJo+djWv3Xe9GqXeXvvHMvwFMpjxJKLuun/uRDKFz4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600677765; 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=0p5jI72BV9q9kGL4Bgyc+PLA0efN3Fk3NOXsGKztPwo=; b=ELcRWCL362SDK56w2/1UYGxSN79s37xMarmh10vyG45n1KODWqlBuxf29LOB2XNZZ4LFKTlFoqtGLA25lA1bLNArRlmYPtG956JTb4BXY0C1+eeXe3yYXfoXWPRL/QWfQSxhQ4M9U+/BP99Tdjz702QpgwW2fOC+PFkHILa4m3Y= 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 1600677765579540.7539785074857; Mon, 21 Sep 2020 01:42:45 -0700 (PDT) Received: from localhost ([::1]:41088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKHPI-00057V-Ay for importer@patchew.org; Mon, 21 Sep 2020 04:42:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKHLH-0000Yw-KU for qemu-devel@nongnu.org; Mon, 21 Sep 2020 04:38:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:53524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKHLE-0003Pv-Db for qemu-devel@nongnu.org; Mon, 21 Sep 2020 04:38:35 -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-122-NzI5DkWwPtKVJlchqTGdUQ-1; Mon, 21 Sep 2020 04:38:29 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 586FE801AAD; Mon, 21 Sep 2020 08:38:28 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-150.ams2.redhat.com [10.36.113.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24A896886A; Mon, 21 Sep 2020 08:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600677511; 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=0p5jI72BV9q9kGL4Bgyc+PLA0efN3Fk3NOXsGKztPwo=; b=Z3Aae/KMINy9borTKX/Vm1ZqupmpG/fX8wZmJEZaRSH0xA9b932jmZxQVSdkpArXe3vw0/ ynP75P2XpwgOOJG1PJxTvO/yGvE2pgfKPua/W27cwgAshIRcPnmU0p6DEigrAsH/d2N0tQ l12Ci8bkjTC+a4peMijZkaQULTlBwvQ= X-MC-Unique: NzI5DkWwPtKVJlchqTGdUQ-1 From: Stefano Garzarella To: "Dr. David Alan Gilbert" , qemu-devel@nongnu.org, Cornelia Huck , "Michael S. Tsirkin" Subject: [PATCH v4 1/4] virtio: skip legacy support check on machine types less than 5.1 Date: Mon, 21 Sep 2020 10:38:04 +0200 Message-Id: <20200921083807.48380-2-sgarzare@redhat.com> In-Reply-To: <20200921083807.48380-1-sgarzare@redhat.com> References: <20200921083807.48380-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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/21 01:44:53 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -45 X-Spam_score: -4.6 X-Spam_bar: ---- X-Spam_report: (-4.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.501, 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=-1, RCVD_IN_MSPIKE_WL=-0.01, 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 , Qian Cai , David Hildenbrand , qemu-stable@nongnu.org, Eduardo Habkost , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson 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 does not support legacy. Unfortunately some devices were wrongly declared legacy capable 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 instead, 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 Reviewed-by: Cornelia Huck Signed-off-by: Stefano Garzarella --- v4: - fixed commit message and warning message [Cornelia] 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..c534cdf2e5 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 requires revision >=3D 1, but for backward= " + "compatibility max_revision=3D0 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 Thu May 16 05:41:40 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=1600677638; cv=none; d=zohomail.com; s=zohoarc; b=RyGgUdar1sR18/EXWHXZfikrNRcf0tNGOX0XrAol2hW9SIiCRoShNS0/D0lSViIeZuL4zFd75uWIPR3vODGomAZfqvCXxR0QMs46EbULe+J3oj7hR8ZgTVJNskVnymrpJt5YHFlgU55/WiaSKeEhdrtIUC/gksdn3qXoXNopwfA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600677638; 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=O6LWXsQ3/ZGxXhA8cvlrIb9GDVFAm/BlGmKIS69RgI3Lyxg1G/l59VZaJUBzca/YfzX7Iebtd4H0AFR23KzHj367xhn/Qv5L8BEwZyA5iTABDsECER2AgZsB0sR36R8PwJvIVvlg/ENCC3BeBmBToWq4/x+LeBap241I+rXB5+Q= 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 160067763856714.819401178907924; Mon, 21 Sep 2020 01:40:38 -0700 (PDT) Received: from localhost ([::1]:34170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKHNF-0002GR-3o for importer@patchew.org; Mon, 21 Sep 2020 04:40:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKHLX-0000xj-Ts for qemu-devel@nongnu.org; Mon, 21 Sep 2020 04:38:51 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:23533 helo=us-smtp-delivery-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 1kKHLW-0003S0-AF for qemu-devel@nongnu.org; Mon, 21 Sep 2020 04:38:51 -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-324-4KE10pSqNgy83-JOc6osQw-1; Mon, 21 Sep 2020 04:38:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6495A1091086; Mon, 21 Sep 2020 08:38:43 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-150.ams2.redhat.com [10.36.113.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7010C68D5F; Mon, 21 Sep 2020 08:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600677529; 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=MFhbRuFExA2xiqGVizeykOx8LRAkjWqozMrwqQLHKiPbScsfqquECDCde7yeBDaS2Cv5xz 10ySE9bTMbgQi9Sb84470W6WKAspwR/PXJ3NOpIfK7X/SVIZ0da8ne1qt25VCdbgv7bOI0 wBwx7qHqmYN6Y6WCieSenXlkhcAtx7A= X-MC-Unique: 4KE10pSqNgy83-JOc6osQw-1 From: Stefano Garzarella To: "Dr. David Alan Gilbert" , qemu-devel@nongnu.org, Cornelia Huck , "Michael S. Tsirkin" Subject: [PATCH v4 2/4] vhost-vsock-pci: force virtio version 1 Date: Mon, 21 Sep 2020 10:38:05 +0200 Message-Id: <20200921083807.48380-3-sgarzare@redhat.com> In-Reply-To: <20200921083807.48380-1-sgarzare@redhat.com> References: <20200921083807.48380-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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=205.139.110.61; envelope-from=sgarzare@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/21 04:38:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.501, 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=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 , Qian Cai , David Hildenbrand , qemu-stable@nongnu.org, Eduardo Habkost , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson 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 Reviewed-by: Cornelia Huck --- 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 Thu May 16 05:41:40 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=1600677664; cv=none; d=zohomail.com; s=zohoarc; b=cm076Cqt3MVsW70CgJ6zAhTQfXjFpoEDzsIoRw49uDesi01pXEUEwr2fkAVtoL+EW+r+Wx/IK6AFT3rgfxe4CRwSlvkz2RrqvSTSied31y+poQH2q9txWLDU/P5EpJGm8+wArC7YgR9eu78VHfLyyEfdNZY7rGYFUCG+rgKANVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600677664; 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=pFAhFyha1dr/ayw6Q6yCDQIHRvmzlKL9CI6hQL7NrCk=; b=QrKXd3qi+d/LLWD6IZiULQLFSp+EoRIuKaWp45HMarVaxTSYg6S+Jr9c49mVV75DxTwqKuPvRmTB4xwgTaM5gJ2S31u6YLAAudaMMeJrAX6NOSd3mpghb3HSw8UCIJBrSOqULsX5QoRdbVU2gIGH6U2Yya0GYrSZ/v7m/wFikSI= 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 1600677664481365.31891317976067; Mon, 21 Sep 2020 01:41:04 -0700 (PDT) Received: from localhost ([::1]:34880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKHNf-0002XY-75 for importer@patchew.org; Mon, 21 Sep 2020 04:41:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKHLZ-0000zb-6m for qemu-devel@nongnu.org; Mon, 21 Sep 2020 04:38:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:21597) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKHLW-0003SI-Vt for qemu-devel@nongnu.org; Mon, 21 Sep 2020 04:38:52 -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-240-32zC750cMwm3bGk98LE93A-1; Mon, 21 Sep 2020 04:38:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB97F9CC07; Mon, 21 Sep 2020 08:38:46 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-150.ams2.redhat.com [10.36.113.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id B92C868D64; Mon, 21 Sep 2020 08:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600677530; 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=pFAhFyha1dr/ayw6Q6yCDQIHRvmzlKL9CI6hQL7NrCk=; b=iEJ1FCi7Fv6fxiaXJ3S70zZv7BRYIeO62U8K2Wvjjmitr2+6vY9NkOybYyy+4pzcrub2S7 Wg4mdC8Qja9Zoo8qwj+OQpXmu0S074xorfajXdAEuZg5Jk/cOhD60XOXiPUbyLkHsHmB5I gbrVFv8go3eviIo0UfMx0wJT2UyMqOg= X-MC-Unique: 32zC750cMwm3bGk98LE93A-1 From: Stefano Garzarella To: "Dr. David Alan Gilbert" , qemu-devel@nongnu.org, Cornelia Huck , "Michael S. Tsirkin" Subject: [PATCH v4 3/4] vhost-user-vsock-pci: force virtio version 1 Date: Mon, 21 Sep 2020 10:38:06 +0200 Message-Id: <20200921083807.48380-4-sgarzare@redhat.com> In-Reply-To: <20200921083807.48380-1-sgarzare@redhat.com> References: <20200921083807.48380-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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/21 01:44:53 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -45 X-Spam_score: -4.6 X-Spam_bar: ---- X-Spam_report: (-4.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.501, 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=-1, RCVD_IN_MSPIKE_WL=-0.01, 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 , Qian Cai , David Hildenbrand , qemu-stable@nongnu.org, Eduardo Habkost , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson 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 --- v4: - added comment in the code [Cornelia] v2: - fixed commit message [Cornelia] --- hw/virtio/vhost-user-vsock-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-user-vsock-pci.c b/hw/virtio/vhost-user-vsock-= pci.c index 763f89984e..72a96199cd 100644 --- a/hw/virtio/vhost-user-vsock-pci.c +++ b/hw/virtio/vhost-user-vsock-pci.c @@ -41,6 +41,9 @@ 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 + /* unlike vhost-vsock, we do not need to care about pre-5.1 compat */ + virtio_pci_force_virtio_1(vpci_dev); + qdev_realize(vdev, BUS(&vpci_dev->bus), errp); } =20 @@ -69,7 +72,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 Thu May 16 05:41:40 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=1600677798; cv=none; d=zohomail.com; s=zohoarc; b=Cnz0y2qfJMQyGHmAqMTd50DgIXKwmrkCjhkf5LOb7QGWWKVgOa2yuq2L4/vbIcS7XKRqjF1/Fxr/zdk0Pl6h98ik2yxxDLWv2R7DZvzkzVMDonC2MHM4Y29X5triiORRt20MRdKTJ9Aezfr3vjBSmzHb+IyUCFKRmv+KeocnhMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600677798; 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=Fp4Dqk5F09EHvZ8x/DZST0uz2UViw+AHL0qVru9TkZY=; b=Ly/bmrbqAdx+kl2/nlCEy+9gb/+G8ddNp0hDcxQ3CMUzh3UIcqh6L0GdxiIOd+6jKhLp5Ny4/tdPl2kOAPiEulLl40K64aH32meNWNxdq3/rHzKUO0RNLv9ouCi62lAtlrYeub0P4oMdM/brCxa2/+R0eTj4lpKQQ5cpcDWZsOI= 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 1600677798918943.9691935112523; Mon, 21 Sep 2020 01:43:18 -0700 (PDT) Received: from localhost ([::1]:43186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKHPp-0005y4-Fh for importer@patchew.org; Mon, 21 Sep 2020 04:43:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKHM8-0001fT-9N for qemu-devel@nongnu.org; Mon, 21 Sep 2020 04:39:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKHM5-0003Vy-HN for qemu-devel@nongnu.org; Mon, 21 Sep 2020 04:39:27 -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-251-MwNzPMbQP_2er6VGwI24Ug-1; Mon, 21 Sep 2020 04:39:23 -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 B48D08015AA; Mon, 21 Sep 2020 08:39:21 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-150.ams2.redhat.com [10.36.113.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E29E55768; Mon, 21 Sep 2020 08:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600677564; 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=Fp4Dqk5F09EHvZ8x/DZST0uz2UViw+AHL0qVru9TkZY=; b=CGnOh8nscwc0AO2mF6H39srwoHVka8yUbVQgQ7RzTiXdp0W5RpPFV6eJY/EORNjesfX2Fm /rnSgwXx4YMfT1rUf8a5depyCpODvS0ZmTku6cfbuzHuYup2uK2Iu0rqVTYmNrDTXZhCuQ TGvexa183q88ZX9mhS40wAkGCHpJYrk= X-MC-Unique: MwNzPMbQP_2er6VGwI24Ug-1 From: Stefano Garzarella To: "Dr. David Alan Gilbert" , qemu-devel@nongnu.org, Cornelia Huck , "Michael S. Tsirkin" Subject: [PATCH v4 4/4] vhost-vsock-ccw: force virtio version 1 Date: Mon, 21 Sep 2020 10:38:07 +0200 Message-Id: <20200921083807.48380-5-sgarzare@redhat.com> In-Reply-To: <20200921083807.48380-1-sgarzare@redhat.com> References: <20200921083807.48380-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=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/21 01:43:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -45 X-Spam_score: -4.6 X-Spam_bar: ---- X-Spam_report: (-4.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.501, 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=-1, RCVD_IN_MSPIKE_WL=-0.01, 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 , Qian Cai , David Hildenbrand , qemu-stable@nongnu.org, Eduardo Habkost , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson 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 Reviewed-by: Cornelia Huck Signed-off-by: Stefano Garzarella --- 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