From nobody Mon Feb 9 06:40:25 2026 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=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1613591889; cv=none; d=zohomail.com; s=zohoarc; b=Qd2kORRTUUAJoxyIO4ahF2NFc3ozRcu8humyVTYU5GXcxLZ09wgJWEnYDjCLRXy5auEt+UkMqn+Xk8K6lXl9X3l8GDT/fPSDYPYQ57QplrhOkhrMc4IKLgnYsECGQVS+HpRtIvSNQHrfKkWgE2Z2dwOEZ7CMeJrQCqkfLi5S04o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613591889; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=oovX60XoqhNHXvxv4yUIi6wVoW7U1wnfc24d+2aTxik=; b=I8BX+fTA9tCOCxZC36J8TrX1F4rM9Mqe9TxT04enV39jDZQYXrEGK1FW5vKwE92j1+f8TH+hBXGab0Q4BQmneTxKhKs7M1bJv8D4xiQuKqrk1glOdLlq39F3Pk8sTh8lYrCcxhqzu/kWrBt3dzx7S/sz4Ouz5siRQnxqP4ckxOY= 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 1613591888556810.0293872408798; Wed, 17 Feb 2021 11:58:08 -0800 (PST) Received: from localhost ([::1]:34524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCSxb-0005Ab-Cj for importer@patchew.org; Wed, 17 Feb 2021 14:58:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCSvt-0003Nj-Ki for qemu-devel@nongnu.org; Wed, 17 Feb 2021 14:56:21 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36168 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCSvr-0008Oo-7X for qemu-devel@nongnu.org; Wed, 17 Feb 2021 14:56:21 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 11HJfmHC163856 for ; Wed, 17 Feb 2021 14:56:17 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 36s9h7ratq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 17 Feb 2021 14:56:17 -0500 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 11HJjEv9180348 for ; Wed, 17 Feb 2021 14:56:17 -0500 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0b-001b2d01.pphosted.com with ESMTP id 36s9h7ratg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Feb 2021 14:56:17 -0500 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 11HJr44r000647; Wed, 17 Feb 2021 19:56:16 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma01dal.us.ibm.com with ESMTP id 36p6d9ruuk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Feb 2021 19:56:16 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 11HJuEnc45810102 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Feb 2021 19:56:14 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D5937805F; Wed, 17 Feb 2021 19:56:14 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B189B7805C; Wed, 17 Feb 2021 19:56:12 +0000 (GMT) Received: from lagarcia.br.ibm.com.com (unknown [9.85.146.90]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 17 Feb 2021 19:56:12 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=oovX60XoqhNHXvxv4yUIi6wVoW7U1wnfc24d+2aTxik=; b=dXQTZ6otonhwIAmUKP5Ol0UogQNg5PPrHHrmqfBeXPeKmlQyzOagt6zpFchx91sJteX/ H85AWwDuIXYdmhBMZQE+WEfykwtWmKHennNV6zaOzsF6Xqn8XeheWuTMYLLASbZUosHQ YQ1ulQUkkrxBZZB1o9b7xJnH5jU4lj3fycmEvHZoRMcpGPTwoPut2YoQ7auT8GdvZJRk eLpVf3rlgToXl65NyFUq/2zjAS9vxgoo2sWlDGaUAo36F0NK0VGfSJ9i4vmJXVZhDGcP FLLj4PG3Zh/VyZfZ59pM0P6ZnPG+d3zPR4pBHaUFUdNrNK0JcQs/YN6da9KqoZ/y+lF6 oQ== From: lagarcia@linux.ibm.com To: qemu-devel@nongnu.org Subject: [PATCH v2] IOMMU not supported by vhost-user. Date: Wed, 17 Feb 2021 16:55:12 -0300 Message-Id: X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-02-17_15:2021-02-16, 2021-02-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102170138 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=148.163.158.5; envelope-from=lagarcia@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: farosas@br.ibm.com, gkurz@redhat.com, Leonardo Garcia , dgilbert@redhat.com, stefanha@redhat.com 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" From: Leonardo Garcia Currently, as IOMMU is not supported, if a user mistakenly set it and tries to mount the vhost-user filesystem (or use any other vhost-user based device) inside the guest, whenever the user tries to access the device, the system will hang forever (because virtiofsd will not be running anymore). Signed-off-by: Leonardo Garcia --- hw/virtio/vhost-user-fs.c | 5 +++++ hw/virtio/vhost-user.c | 7 +++++++ hw/virtio/vhost.c | 1 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c index ac4fc34b36..059b0d2ef9 100644 --- a/hw/virtio/vhost-user-fs.c +++ b/hw/virtio/vhost-user-fs.c @@ -222,6 +222,11 @@ static void vuf_device_realize(DeviceState *dev, Error= **errp) /* 1 high prio queue, plus the number configured */ fs->vhost_dev.nvqs =3D 1 + fs->conf.num_request_queues; fs->vhost_dev.vqs =3D g_new0(struct vhost_virtqueue, fs->vhost_dev.nvq= s); + /* + * vhost_user_backend_init does additional checks if VirtIODevice is d= efined + * in vhost_dev + */ + fs->vhost_dev.vdev =3D vdev; ret =3D vhost_dev_init(&fs->vhost_dev, &fs->vhost_user, VHOST_BACKEND_TYPE_USER, 0); if (ret < 0) { diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 2fdd5daf74..6ab760364b 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1849,6 +1849,13 @@ static int vhost_user_backend_init(struct vhost_dev = *dev, void *opaque) } } =20 + if ((dev->vdev !=3D NULL) && + virtio_host_has_feature(dev->vdev, VIRTIO_F_IOMMU_PLATFORM) && + !(features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) { + error_report("IOMMU is currently not supported with vhost-user= "); + return -1; + } + if (virtio_has_feature(features, VIRTIO_F_IOMMU_PLATFORM) && !(virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_SLAVE_REQ) && diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 6e17d631f7..78e58d2148 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1293,7 +1293,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaq= ue, int i, r, n_initialized_vqs =3D 0; Error *local_err =3D NULL; =20 - hdev->vdev =3D NULL; hdev->migration_blocker =3D NULL; =20 r =3D vhost_set_backend_type(hdev, backend_type); --=20 2.29.2