From nobody Thu May 16 08:12:55 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=1600691392; cv=none; d=zohomail.com; s=zohoarc; b=cMlx7r6p8XTwQWmYF+vZAXgX5xMOCRvv+YzYN1O6dO4KXKCAXQBOtOTbdYdlpNkLSQ53NVbpBElw71ZqFw82tFpP6FXFDx2gBAj3aaYOAcyIRg5NGtH0P+X1m4aBcErK6/0BGW95phNZIDi6NKi0i43K1AX5xdyXY3pMcsVyUPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600691392; 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=NGWZdn3eQc/ARcIvOarHziwGA3baOxJqJ3Y3jysN+yoOuNxhchXA42DBJ0m9v2higuSFM2xl04FlgrHPf11fKAKZNSmOXmhm6A7t8ybclXkxLsBYVBssUDt4qSANMq6JJen5ZEOKY7ijMnE3kznKDt89db7WOsMct1EvsxADVS4= 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 1600691392742196.0137626863625; Mon, 21 Sep 2020 05:29:52 -0700 (PDT) Received: from localhost ([::1]:45872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKKx5-0007oy-9H for importer@patchew.org; Mon, 21 Sep 2020 08:29:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKKsx-00049d-3W for qemu-devel@nongnu.org; Mon, 21 Sep 2020 08:25:36 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:25866 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 1kKKss-0008L7-Sf for qemu-devel@nongnu.org; Mon, 21 Sep 2020 08:25:33 -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-179-kQO_G-s3MvOKKpXX9Yy5OA-1; Mon, 21 Sep 2020 08:25:26 -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 51372EA323; Mon, 21 Sep 2020 12:25:25 +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 28B4368432; Mon, 21 Sep 2020 12:25:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600691128; 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=JFavyLMZ6tTX3uIfFZfi+MRfQ4vdxPFOMcx0hnrburlAhIjjDfy0F7I9i2T4oOdgdNTWtj OGSSmeENFg6hhZHR42Gxwo06an6J847qrcRWM2YigeXAzXNk3bcui7MM7fSvcyszUnNPDX KRFbjTCalgQ4uceZZ9ADPVttDW8xq88= X-MC-Unique: kQO_G-s3MvOKKpXX9Yy5OA-1 From: Stefano Garzarella To: "Dr. David Alan Gilbert" , Cornelia Huck , "Michael S. Tsirkin" , qemu-devel@nongnu.org Subject: [PATCH v5 1/4] virtio: skip legacy support check on machine types less than 5.1 Date: Mon, 21 Sep 2020 14:25:03 +0200 Message-Id: <20200921122506.82515-2-sgarzare@redhat.com> In-Reply-To: <20200921122506.82515-1-sgarzare@redhat.com> References: <20200921122506.82515-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=207.211.31.81; 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 03:43:14 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.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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 , Qian Cai , qemu-stable@nongnu.org, 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 08:12:55 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=1600691384; cv=none; d=zohomail.com; s=zohoarc; b=NQspIhQlteJLF5mNNyr9SxH9WGJ/blqeoEFaKFJDFzWme9O976VSye9UBmdfWG4tYaRAY92dqoEZN9iwCILHpk1zBUNGBJHrdnxnO60u9mRSb9ZGuQpMh55SeJxwnI17EHkeycF17+VLYtAQgvKE7SZjcXnu8AzwmBuzAFGPXSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600691384; 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=+sglpfqz+FSX2DyXDyQm7XCF3s5OmOX2rqNAym9G8uE=; b=Rno+zdE1q/mFVKwavdVlEJy3yQg+WDqhAjWL61Is1Q+CabsqPN43VL4XobdK0pzFFommj+5tnNPTXISmYSHcHqsVyUpYghMCQ8v3oPxMncys0nJ+f2rbm5C33zYwffWPjLaHTusYJ88IWvHnvvkDVRVGczAJ0WlN/n8RkjdnGjI= 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 1600691384664292.7363201106766; Mon, 21 Sep 2020 05:29:44 -0700 (PDT) Received: from localhost ([::1]:45384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKKwx-0007a7-BH for importer@patchew.org; Mon, 21 Sep 2020 08:29:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKKtK-0004RD-7s for qemu-devel@nongnu.org; Mon, 21 Sep 2020 08:25:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57513) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKKtH-00009M-9p for qemu-devel@nongnu.org; Mon, 21 Sep 2020 08:25:57 -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-221-9pLCtEY7PgCSFu2BYuvHEQ-1; Mon, 21 Sep 2020 08:25:50 -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 2ECFA807100; Mon, 21 Sep 2020 12:25:49 +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 A5F536CE4D; Mon, 21 Sep 2020 12:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600691154; 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=+sglpfqz+FSX2DyXDyQm7XCF3s5OmOX2rqNAym9G8uE=; b=SWNgPKfi0q0aX1iu/Hjbq/q+fj/jEKkN+4+wTASLWitz4l4a9baoZtcj/zJGLoy024e3Ch emmxVbRpvgGkX95LirHyM3tgdXQ6wT+Ryj9nuaUH+pbs0G7Sc6F5QnqXoBhvoZbaf853+6 wNDv71a0yj2LQ9AMzLwTtU14xv+nSfw= X-MC-Unique: 9pLCtEY7PgCSFu2BYuvHEQ-1 From: Stefano Garzarella To: "Dr. David Alan Gilbert" , Cornelia Huck , "Michael S. Tsirkin" , qemu-devel@nongnu.org Subject: [PATCH v5 2/4] vhost-vsock-pci: force virtio version 1 Date: Mon, 21 Sep 2020 14:25:04 +0200 Message-Id: <20200921122506.82515-3-sgarzare@redhat.com> In-Reply-To: <20200921122506.82515-1-sgarzare@redhat.com> References: <20200921122506.82515-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/21 01:43:11 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.455, 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 , Qian Cai , qemu-stable@nongnu.org, 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). As the transitional device name is not commonly used, we do not provide compatibility handling for it. 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 Reviewed-by: Cornelia Huck Signed-off-by: Stefano Garzarella --- v5: - added a phrase about transitional device in the commit message [Cornelia] 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 08:12:55 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=1600691601; cv=none; d=zohomail.com; s=zohoarc; b=NxTK644Z65TdO61+ArKLj41fWQdAl2DvLx2bIb5KYl0nbDsaPbU/C9aZAZZ475RZraHWGOcSUHP5MfJ5pyFssPru/OLQfVbGQvgVR6c+wHQRleNuPfequ8gXmu9+4CdvOS0mOws8bMJwb1x9cHqpoCuWuLBGiBMCJIi9fTlm4hk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600691601; 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=HnTqFMMhp7XP/UGUXFgVxBiSznXzt8iWFrdmcHKpDzblKcrT/KzsgMNAKak/oYIx+MfLTrDrG6iebmKfLtio4AvKMla7Vyb9GBaghf9FDMhA90pVSinB/tNy0h1Gbah0pOpryYEbbIrhgDGyB3ssmSKv0zoJTGyI7SvsmLS1ni8= 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 1600691601291444.2260422891079; Mon, 21 Sep 2020 05:33:21 -0700 (PDT) Received: from localhost ([::1]:53746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKL0R-0002nK-Tl for importer@patchew.org; Mon, 21 Sep 2020 08:33:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKKtR-0004VU-Mv for qemu-devel@nongnu.org; Mon, 21 Sep 2020 08:26:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kKKtQ-0000Bm-5j for qemu-devel@nongnu.org; Mon, 21 Sep 2020 08:26:05 -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-557-wHM_UKR0PhmWoh__8eonmg-1; Mon, 21 Sep 2020 08:26:00 -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 7F5A08064B4; Mon, 21 Sep 2020 12:25:57 +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 83D216E70B; Mon, 21 Sep 2020 12:25:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600691163; 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=NJrWgLSVzAvJiZ2Q3G4YBiT7pXi44C24PsA5v5TwJZb1vBmKuZqSwaFa8iopCB0KzliPIO gq68Q/fDkh9snb2EoW6jmhQRYjXUVVGCNPaboflVlqajm/EZMVbL7rUzjIjTYlTSyHOuUr 0KvE3SYR+MYP2SOXM5eQV586Pi9N4xs= X-MC-Unique: wHM_UKR0PhmWoh__8eonmg-1 From: Stefano Garzarella To: "Dr. David Alan Gilbert" , Cornelia Huck , "Michael S. Tsirkin" , qemu-devel@nongnu.org Subject: [PATCH v5 3/4] vhost-user-vsock-pci: force virtio version 1 Date: Mon, 21 Sep 2020 14:25:05 +0200 Message-Id: <20200921122506.82515-4-sgarzare@redhat.com> In-Reply-To: <20200921122506.82515-1-sgarzare@redhat.com> References: <20200921122506.82515-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/21 01:43:11 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.455, 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 , Qian Cai , qemu-stable@nongnu.org, 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 08:12:55 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=1600691591; cv=none; d=zohomail.com; s=zohoarc; b=YB4Ydz4fMvXSq0BUjXHYiL2ce+DxuYAXsPKur6cGTqE9p3Q5gt7xQPbALUF3hhjEap8XLsmYcFUHYaQPvwA87FyxrJPXmeF9ommJzMaXm9JS0haof1V2r0QSK0jHo1s4Ywfur2Nl/XgqhZa+MyYkjJS4hhQFFu3gj3l9EpMWOnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600691591; 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=OfijPIGJSitapDaLDVkdTs9q4MWiVlk4WGzcjjwcb+9Zo/BNxe7gk6xtzn1U8eZW6IPEi4BaFWaVaQjG5CDFDVhi1ayyUdQrTzvM25+F08SchmW+3m8fpC55XwFLC0IyGIj64PmysXkoYKi5qYCCU1ZVUig8fsR/ZI5vcro5YMI= 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 1600691591365799.5464778286591; Mon, 21 Sep 2020 05:33:11 -0700 (PDT) Received: from localhost ([::1]:52962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKL0H-0002U9-RX for importer@patchew.org; Mon, 21 Sep 2020 08:33:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKKtz-00054i-67 for qemu-devel@nongnu.org; Mon, 21 Sep 2020 08:26:39 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:25640 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 1kKKtv-0000Hs-CI for qemu-devel@nongnu.org; Mon, 21 Sep 2020 08:26:38 -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-159-8fjNlrujPEiegtdMYlvdUw-1; Mon, 21 Sep 2020 08:26:32 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 67F0110BBECA; Mon, 21 Sep 2020 12:26:31 +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 0495578825; Mon, 21 Sep 2020 12:26:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600691194; 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=hqYBfRbJobZ4AbaAiv1Uw5VNrkDQg2EXuh7fOoceflzftQRQiIgCtqxPOihetsK7khNS3P gwStBL/3t68aB/2+8Re6Ii0PqASzlzNkBONmJ2zqpbzsKx5G499M2IQmrpCrvNSmMCNIhM kh27ukNNsBZ0R/DhcOx5Yuiz9n4Ait8= X-MC-Unique: 8fjNlrujPEiegtdMYlvdUw-1 From: Stefano Garzarella To: "Dr. David Alan Gilbert" , Cornelia Huck , "Michael S. Tsirkin" , qemu-devel@nongnu.org Subject: [PATCH v5 4/4] vhost-vsock-ccw: force virtio version 1 Date: Mon, 21 Sep 2020 14:25:06 +0200 Message-Id: <20200921122506.82515-5-sgarzare@redhat.com> In-Reply-To: <20200921122506.82515-1-sgarzare@redhat.com> References: <20200921122506.82515-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.81; 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 03:43:14 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.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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 , Qian Cai , qemu-stable@nongnu.org, 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