From nobody Fri May 17 10:13:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612906500; cv=none; d=zohomail.com; s=zohoarc; b=EsWj0y6sJZV6pHXZdWcRRMaZtQKHj6kGlXpadC32R+dsEDbXsJcn67bnqVl08KMCeXk04uj0a6APmdfBKC0YQLltTEfd8/6sbZpaTjr178HPZlXQcuEhAbo5VIgt+2K9PcEgjCtREd92pDNoSK7XhSsTYM8af0HqMiHM34KE/Tw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612906500; 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=92NG+f3sSvz04Akz1ljC0pjPIcuzVJBz3zyXRsquL04=; b=I+dBKMbmDZu67Z9egmUonNn1kumMit+rJEU0dv0ZlF4/cceFDiuo+l6RyNUWb3ev226B8Qct7TE8Z8zaCXi0ngxh+a6uaVEUKlDL5IPwPBNRcXX3oyt2nY4NxHva4XhYNhFIlW4aHZUTi68UMp2YcpJRODI5WrdE7ahlTk9+c4A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1612906500213582.0714469860693; Tue, 9 Feb 2021 13:35:00 -0800 (PST) Received: from localhost ([::1]:53924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9aex-0000UY-7R for importer@patchew.org; Tue, 09 Feb 2021 16:34:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9adF-0007k4-WC for qemu-devel@nongnu.org; Tue, 09 Feb 2021 16:33:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28115) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l9adD-0003QV-Ue for qemu-devel@nongnu.org; Tue, 09 Feb 2021 16:33:13 -0500 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-201-QlqR1zwROpWbBxbJR1cUKA-1; Tue, 09 Feb 2021 16:33:09 -0500 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 05E9B107ACE3; Tue, 9 Feb 2021 21:33:08 +0000 (UTC) Received: from laptop.redhat.com (ovpn-112-10.ams2.redhat.com [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A6F95B694; Tue, 9 Feb 2021 21:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612906390; 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=92NG+f3sSvz04Akz1ljC0pjPIcuzVJBz3zyXRsquL04=; b=Acm0pclbYOtfh2vImznO4LrkihnfcyvJP8tSdnyzRdZF2jejrb6JpIVi8fWTSDOniu6uds ThbHP4VM6EWbLb5kqSNdm1Q2yuVylTJa932lgnmilKgbgDigIudqS8kpwMkNbgAR6T6LqR FkOTtrMCmyeLaUBLUhu9Uw3rMlFimnU= X-MC-Unique: QlqR1zwROpWbBxbJR1cUKA-1 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com, alex.williamson@redhat.com, jasowang@redhat.com, eperezma@redhat.com, jean-philippe@linaro.org, david@gibson.dropbear.id.au, groug@kaod.org Subject: [PATCH 1/2] vfio: Do not register any IOMMU_NOTIFIER_DEVIOTLB_UNMAP notifier Date: Tue, 9 Feb 2021 22:32:32 +0100 Message-Id: <20210209213233.40985-2-eric.auger@redhat.com> In-Reply-To: <20210209213233.40985-1-eric.auger@redhat.com> References: <20210209213233.40985-1-eric.auger@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=eric.auger@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=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.57, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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: peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In an attempt to fix smmu/virtio-iommu - vhost regression, commit 958ec334bca3 ("vhost: Unbreak SMMU and virtio-iommu on dev-iotlb support") broke virtio-iommu integration. This is due to the fact VFIO registers IOMMU_NOTIFIER_ALL notifiers, which includes IOMMU_NOTIFIER_DEVIOTLB_UNMAP and this latter now is rejected by the virtio-iommu. As a consequence, the registration fails. VHOST behaves like a device with an ATC cache. The VFIO device does not support this scheme yet. Let's register only legacy MAP and UNMAP notifiers. Fixes: 958ec334bca3 ("vhost: Unbreak SMMU and virtio-iommu on dev-iotlb sup= port") Signed-off-by: Eric Auger Acked-by: Alex Williamson Acked-by: Jason Wang Reviewed-by: Peter Xu --- hw/vfio/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 6ff1daa763..a50b10c801 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -787,7 +787,7 @@ static void vfio_listener_region_add(MemoryListener *li= stener, iommu_idx =3D memory_region_iommu_attrs_to_index(iommu_mr, MEMTXATTRS_UNSPECIF= IED); iommu_notifier_init(&giommu->n, vfio_iommu_map_notify, - IOMMU_NOTIFIER_ALL, + IOMMU_NOTIFIER_IOTLB_EVENTS, section->offset_within_region, int128_get64(llend), iommu_idx); --=20 2.26.2 From nobody Fri May 17 10:13:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612906771; cv=none; d=zohomail.com; s=zohoarc; b=MI7trK9vaK2asHdvaojQDEmFF/HT8n6uXnanY04Thim1HpcZlofFOuJL8YDqA7gOeJXJQblgYkCoHnovY6A1H43I+EM3m+v1o1MldUluuj8bgdVwFUiEgnHtMpQX87e+jWOkrvaJ0tAmevbhJT8jmEMLmd6R4S/dILI3tEatbvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612906771; 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=iZT9xJ1+fp0hP5g8lqCrvWBZJVludifeiDJJ/OAH16U=; b=jAEgRygkU1PvW2+R92kJkjJAe4FwmUeuH7NrhRaPTXncyRT/C/D8LPlJhMVZsYsihmDv15SQWl3hyXGl0Y2ZbCV9u7GmhlgXM6oJRsCpnnOXLI03v3ZnjIXDPyjAFKTxAAy9wqzSRKgmWK/G6xPFkgOecxsDH1EzR83nQ9IllxM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1612906771476481.6568406008986; Tue, 9 Feb 2021 13:39:31 -0800 (PST) Received: from localhost ([::1]:32818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9ajK-0003hY-AP for importer@patchew.org; Tue, 09 Feb 2021 16:39:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9adf-0007x4-Hc for qemu-devel@nongnu.org; Tue, 09 Feb 2021 16:33:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28543) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l9adY-0003Y3-Co for qemu-devel@nongnu.org; Tue, 09 Feb 2021 16:33:39 -0500 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-111-NC0IAKWvNTiwtD3Ccv6rmA-1; Tue, 09 Feb 2021 16:33:28 -0500 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 12E8D192D786; Tue, 9 Feb 2021 21:33:27 +0000 (UTC) Received: from laptop.redhat.com (ovpn-112-10.ams2.redhat.com [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C3BE5D745; Tue, 9 Feb 2021 21:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612906409; 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=iZT9xJ1+fp0hP5g8lqCrvWBZJVludifeiDJJ/OAH16U=; b=W5Cr7AxcTEiB+b5tT+QfR+Eo7JKIcaj0CfRKukP2KyX+Xu0iN56K8yRqdHSvQLZCTB1+P9 Twb7nl+QmiWSD2mc7YLC+WMcvEiywqJPHrWj9RuabuulE3K4eEoIhtu/ErxYrMmYp1Y32d okgv59cCWuC2vokgBHYMQaA7bGm8820= X-MC-Unique: NC0IAKWvNTiwtD3Ccv6rmA-1 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com, alex.williamson@redhat.com, jasowang@redhat.com, eperezma@redhat.com, jean-philippe@linaro.org, david@gibson.dropbear.id.au, groug@kaod.org Subject: [PATCH 2/2] spapr_iommu: Fix vhost integration regression Date: Tue, 9 Feb 2021 22:32:33 +0100 Message-Id: <20210209213233.40985-3-eric.auger@redhat.com> In-Reply-To: <20210209213233.40985-1-eric.auger@redhat.com> References: <20210209213233.40985-1-eric.auger@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=eric.auger@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=eric.auger@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.57, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=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: peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Previous work on dev-iotlb message broke spapr_iommu/vhost integration as it did for SMMU and virtio-iommu. The spapr_iommu currently only sends IOMMU_NOTIFIER_UNMAP notifications. Since commit 958ec334bca3 ("vhost: Unbreak SMMU and virtio-iommu on dev-iotlb support"), VHOST first tries to register IOMMU_NOTIFIER_DEVIOTLB_UNMAP notifier and if it fails, falls back to legacy IOMMU_NOTIFIER_UNMAP. So spapr_iommu must fail on the IOMMU_NOTIFIER_DEVIOTLB_UNMAP registration. Reported-by: Peter Xu Fixes: b68ba1ca57677acf870d5ab10579e6105c1f5338 Signed-off-by: Eric Auger Acked-by: David Gibson Acked-by: Jason Wang Reviewed-by: Greg Kurz Reviewed-by: Michael S. Tsirkin Reviewed-by: Peter Xu --- hw/ppc/spapr_iommu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index 30352df00e..24537ffcbd 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -212,6 +212,11 @@ static int spapr_tce_notify_flag_changed(IOMMUMemoryRe= gion *iommu, { struct SpaprTceTable *tbl =3D container_of(iommu, SpaprTceTable, iommu= ); =20 + if (new & IOMMU_NOTIFIER_DEVIOTLB_UNMAP) { + error_setg(errp, "spart_tce does not support dev-iotlb yet"); + return -EINVAL; + } + if (old =3D=3D IOMMU_NOTIFIER_NONE && new !=3D IOMMU_NOTIFIER_NONE) { spapr_tce_set_need_vfio(tbl, true); } else if (old !=3D IOMMU_NOTIFIER_NONE && new =3D=3D IOMMU_NOTIFIER_N= ONE) { --=20 2.26.2