From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C69FC433EF for ; Wed, 6 Jul 2022 17:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Qmx788V9s3niviWRl8vuq+bKrjUqmUshxsKhoOeLaB4=; b=pDD1KzXahHDGHM fdbHbu4Dui+vhaY/UvONCwbDXWThA4SK4Hw1dTDV2IzFpbaq2KsEYRLimxUP5svCg6yFIdqeX+Cp3 VPmlhrLd2a6Qfk0XTRhX1520RC55X9jy5CJOkx5CqcJL7K6s1bVbT209MgGZBnF8hAsXB05CvzlCd /zg/zJmVTuznq5SXWO7jRBb8DP4FbfudVXy+tYlEnNqdUku7fFznLgLoniqQf7aOCb8jgzYwFqMyF y7z1ptk90pO5y9Hn3sc2oU9UpWFVeMHwVLGOO6mstzWGQ6zurjvvNoxkKJRgRmpQdqDfYiBdYVBVd jke87mfa7gAjrK9zf9Kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o992m-00Blgy-4Z; Wed, 06 Jul 2022 17:42:32 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o992h-00BleS-Nd for linux-arm-kernel@lists.infradead.org; Wed, 06 Jul 2022 17:42:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657129343; 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=Bm6ni0e0Z3ZqDaHM6VmzfCaa2VxT43x1YW4zQJliK1o=; b=bRkNBhGdBd4GpOyFO/Su+lYkljtGNjfykD/xASJje7SZNJBA6RJte2DlkBfYHLx3RlnBN+ /HLbnsI9ryG3lE2z9mVCAXkoTojej1HGbsD6pT7A6/sjNFefiqyXy010/YX7ov4kAs1D20 QlS7Q8kevrTWlCWsdYPI4mpZdKuJIdY= Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-453-cWGMmLPvNBiELaKMcZ2bzg-1; Wed, 06 Jul 2022 13:42:20 -0400 X-MC-Unique: cWGMmLPvNBiELaKMcZ2bzg-1 Received: by mail-io1-f72.google.com with SMTP id h73-20020a6bb74c000000b0067275998ba8so8394472iof.2 for ; Wed, 06 Jul 2022 10:42:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=Bm6ni0e0Z3ZqDaHM6VmzfCaa2VxT43x1YW4zQJliK1o=; b=hDjOJz3pMHHRSCA6RfjytLj0OrBhthVT/SnrVTXzGnULCO+Nq5oixddfuPxr18lzXF VWDYOBI+/vb8dshYJ2mxibc0eJWP0ABNjqsQz3UtSCYiQdXO69AjMR+MXkQUxhfDI/Bj RcLaZCuJQ6zNSz0KXS2rBLQ4Q0gKLhJj/d3BEc3Pd4/8UFAPqip0IhSnTX75WoBmLUYd 6gx0O5ueRewkwDEz63UY9Btb3EXqercffDmbJFzr32qkyNAznYeIhM+DCZIxuKfUgmAF W8UU4jAo3szC9RUPdTLWr2LZlFiKuSUmkm/ORPfoAenkrnVH/z+z7TvZxvLZ/TgHUMAw 2QGA== X-Gm-Message-State: AJIora8HtnHX35cXpZ6Q3iYF/Fjfqs9ox1nTeZo5YvW+LopgrNhnvMsV zVmsTMamT+EVl5kIgB3KpFd9VQwhumajZPqlTmv9HdNZ/Y2PIhlH5heT976Rh/cPzJRQ85Wnttv syAGMO+UdgvJcRJO70zoY3SpzUgE3gn3GP78= X-Received: by 2002:a05:6e02:1be6:b0:2db:ea7f:10c4 with SMTP id y6-20020a056e021be600b002dbea7f10c4mr17220890ilv.248.1657129340258; Wed, 06 Jul 2022 10:42:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tKW5hHrIbN8D8MKAPlov0FsaTgJJCZrivyPi82ikNP5NQmibHb26OWtdHiMispm5nOi3tbJA== X-Received: by 2002:a05:6e02:1be6:b0:2db:ea7f:10c4 with SMTP id y6-20020a056e021be600b002dbea7f10c4mr17220872ilv.248.1657129339926; Wed, 06 Jul 2022 10:42:19 -0700 (PDT) Received: from redhat.com ([38.15.36.239]) by smtp.gmail.com with ESMTPSA id i83-20020a6bb856000000b0065a47e16f53sm17005663iof.37.2022.07.06.10.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 10:42:19 -0700 (PDT) Date: Wed, 6 Jul 2022 11:42:17 -0600 From: Alex Williamson To: Nicolin Chen Subject: Re: [PATCH v5 0/5] cover-letter: Simplify vfio_iommu_type1 attach/detach routine Message-ID: <20220706114217.105f4f61.alex.williamson@redhat.com> In-Reply-To: <20220701214455.14992-1-nicolinc@nvidia.com> References: <20220701214455.14992-1-nicolinc@nvidia.com> Organization: Red Hat MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=alex.williamson@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220706_104227_916088_86CB450E X-CRM114-Status: GOOD ( 25.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, marcan@marcan.st, mjrosato@linux.ibm.com, virtualization@lists.linux-foundation.org, thierry.reding@gmail.com, will@kernel.org, alyssa@rosenzweig.io, jean-philippe@linaro.org, kvm@vger.kernel.org, zhang.lyra@gmail.com, joro@8bytes.org, jonathanh@nvidia.com, iommu@lists.linux.dev, jgg@nvidia.com, yangyingliang@huawei.com, orsonzhai@gmail.com, gerald.schaefer@linux.ibm.com, kevin.tian@intel.com, sven@svenpeter.dev, linux-arm-msm@vger.kernel.org, john.garry@huawei.com, christophe.jaillet@wanadoo.fr, thunder.leizhen@huawei.com, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chenxiang66@hisilicon.com, dwmw2@infradead.org, cohuck@redhat.com, linux-kernel@vger.kernel.org, robdclark@gmail.com, suravee.suthikulpanit@amd.com, baolin.wang7@gmail.com, robin.murphy@arm.com, baolu.lu@linux.intel.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 1 Jul 2022 14:44:50 -0700 Nicolin Chen wrote: > This is a preparatory series for IOMMUFD v2 patches. It enforces error > code -EMEDIUMTYPE in iommu_attach_device() and iommu_attach_group() when > an IOMMU domain and a device/group are incompatible. It also drops the > useless domain->ops check since it won't fail in current environment. > > These allow VFIO iommu code to simplify its group attachment routine, by > avoiding the extra IOMMU domain allocations and attach/detach sequences > of the old code. > > Worths mentioning the exact match for enforce_cache_coherency is removed > with this series, since there's very less value in doing that as KVM will > not be able to take advantage of it -- this just wastes domain memory. > Instead, we rely on Intel IOMMU driver taking care of that internally. > > This is on github: > https://github.com/nicolinc/iommufd/commits/vfio_iommu_attach How do you foresee this going in, I'm imagining Joerg would merge the first patch via the IOMMU tree and provide a topic branch that I'd merge into the vfio tree along with the remaining patches. Sound right? Thanks, Alex > Changelog > v5: > * Rebased on top of Robin's "Simplify bus_type determination". > * Fixed a wrong change returning -EMEDIUMTYPE in arm-smmu driver. > * Added Baolu's "Reviewed-by". > v4: > * Dropped -EMEDIUMTYPE change in mtk_v1 driver per Robin's input > * Added Baolu's and Kevin's Reviewed-by lines > v3: https://lore.kernel.org/kvm/20220623200029.26007-1-nicolinc@nvidia.com/ > * Dropped all dev_err since -EMEDIUMTYPE clearly indicates what error. > * Updated commit message of enforce_cache_coherency removing patch. > * Updated commit message of domain->ops removing patch. > * Replaced "goto out_unlock" with simply mutex_unlock() and return. > * Added a line of comments for -EMEDIUMTYPE return check. > * Moved iommu_get_msi_cookie() into alloc_attach_domain() as a cookie > should be logically tied to the lifetime of a domain itself. > * Added Kevin's "Reviewed-by". > v2: https://lore.kernel.org/kvm/20220616000304.23890-1-nicolinc@nvidia.com/ > * Added -EMEDIUMTYPE to more IOMMU drivers that fit the category. > * Changed dev_err to dev_dbg for -EMEDIUMTYPE to avoid kernel log spam. > * Dropped iommu_ops patch, and removed domain->ops in VFIO directly, > since there's no mixed-driver use case that would fail the sanity. > * Updated commit log of the patch removing enforce_cache_coherency. > * Fixed a misplace of "num_non_pinned_groups--" in detach_group patch. > * Moved "num_non_pinned_groups++" in PATCH-5 to the common path between > domain-reusing and new-domain pathways, like the code previously did. > * Fixed a typo in EMEDIUMTYPE patch. > v1: https://lore.kernel.org/kvm/20220606061927.26049-1-nicolinc@nvidia.com/ > > Jason Gunthorpe (1): > vfio/iommu_type1: Prefer to reuse domains vs match enforced cache > coherency > > Nicolin Chen (4): > iommu: Return -EMEDIUMTYPE for incompatible domain and device/group > vfio/iommu_type1: Remove the domain->ops comparison > vfio/iommu_type1: Clean up update_dirty_scope in detach_group() > vfio/iommu_type1: Simplify group attachment > > drivers/iommu/amd/iommu.c | 2 +- > drivers/iommu/apple-dart.c | 4 +- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 15 +- > drivers/iommu/arm/arm-smmu/arm-smmu.c | 5 +- > drivers/iommu/arm/arm-smmu/qcom_iommu.c | 9 +- > drivers/iommu/intel/iommu.c | 10 +- > drivers/iommu/iommu.c | 28 ++ > drivers/iommu/ipmmu-vmsa.c | 4 +- > drivers/iommu/omap-iommu.c | 3 +- > drivers/iommu/s390-iommu.c | 2 +- > drivers/iommu/sprd-iommu.c | 6 +- > drivers/iommu/tegra-gart.c | 2 +- > drivers/iommu/virtio-iommu.c | 3 +- > drivers/vfio/vfio_iommu_type1.c | 352 ++++++++++---------- > 14 files changed, 229 insertions(+), 216 deletions(-) > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel