Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp629347ybz; Wed, 29 Apr 2020 06:40:16 -0700 (PDT) X-Google-Smtp-Source: APiQypJPb2cZTDCmKExcbk0d3Qypc1l8gxSy7ijOZHqcfjsga34TjLkmclT/ugB/BBX3ZyEiQ51c X-Received: by 2002:a17:906:130e:: with SMTP id w14mr2648110ejb.155.1588167616722; Wed, 29 Apr 2020 06:40:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588167616; cv=none; d=google.com; s=arc-20160816; b=UeFzaY+JxImKVm3S5av2FlLmpvdNm8Dh8lvzKsj4eiU8KdAq56pTDEblRSG6nFmkq6 v0dwCTM7KF1HCmKLGJzqdjV7FUfQqoaUh1M9i4/1b3+rx5gV1ulmCJ62zIwcGn8SANIo LGty0LVc74Ri8m083XgAYJSumq3qlD2j2oqQfx3sukTtM3RPAFuSDH+BU1FA5ND8Thmo rJKC7A70hQkamUEuTveHalHOkZu6kKl4qjMp8MHYoTD0y99cKvWJDaInb+UNxu02fMq1 c6FM7iex18du8k1tKOPH/e5LKJkddt1lj+3Uo4qckdtaclkAdE99dJVc1NZMxOhRzOF1 DWbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=G3ouBcVxGm0cXMOB5g0I5uMTw8BFLiPMZLpR/oT5y8s=; b=HgCM7t0aulXJd07+vlsqxwaMNfSV3rEw+qarAZEFCCzHwaXKCZ+AgG0C3B2FNE8iZC MYguR2ieiV3D26rs8hmCuNuVP/XvCthQlXdtjPFcJlPfv93eV+ILZee/58tF87hlgDwY LMAK1ooCwZUZzL2JIA5SncPS2Znyf4JVAYwxGgio11xd6K3MBvtFAqGriLlcCLujFXiK tkU0HqnNmHVDYHDOskVykjFOs/zdNJdtVfjZdsq8PvCpA1AMQ+TG9neHmkJoJuz//rlh g2szbwFY9pfyjoADi/c5yaEVLFN1LfP2p3KJmi5AeSwMr1x2gUmSqvqOcFfgN9/QWtWq mGuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 23si3741199ejn.282.2020.04.29.06.39.52; Wed, 29 Apr 2020 06:40:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728091AbgD2Nhz (ORCPT + 99 others); Wed, 29 Apr 2020 09:37:55 -0400 Received: from 8bytes.org ([81.169.241.247]:39788 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbgD2Nht (ORCPT ); Wed, 29 Apr 2020 09:37:49 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id DF0ACECD; Wed, 29 Apr 2020 15:37:38 +0200 (CEST) From: Joerg Roedel To: Joerg Roedel , Will Deacon , Robin Murphy , Marek Szyprowski , Kukjin Kim , Krzysztof Kozlowski , David Woodhouse , Lu Baolu , Andy Gross , Bjorn Andersson , Matthias Brugger , Rob Clark , Heiko Stuebner , Gerald Schaefer , Thierry Reding , Jonathan Hunter , Jean-Philippe Brucker Cc: Daniel Drake , jonathan.derrick@intel.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org, linux-tegra@vger.kernel.org, virtualization@lists.linux-foundation.org, Joerg Roedel Subject: [PATCH v3 19/34] iommu/s390: Convert to probe/release_device() call-backs Date: Wed, 29 Apr 2020 15:36:57 +0200 Message-Id: <20200429133712.31431-20-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200429133712.31431-1-joro@8bytes.org> References: <20200429133712.31431-1-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel Convert the S390 IOMMU driver to use the probe_device() and release_device() call-backs of iommu_ops, so that the iommu core code does the group and sysfs setup. Signed-off-by: Joerg Roedel --- drivers/iommu/s390-iommu.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c index 1137f3ddcb85..610f0828f22d 100644 --- a/drivers/iommu/s390-iommu.c +++ b/drivers/iommu/s390-iommu.c @@ -166,21 +166,14 @@ static void s390_iommu_detach_device(struct iommu_domain *domain, } } -static int s390_iommu_add_device(struct device *dev) +static struct iommu_device *s390_iommu_probe_device(struct device *dev) { - struct iommu_group *group = iommu_group_get_for_dev(dev); struct zpci_dev *zdev = to_pci_dev(dev)->sysdata; - if (IS_ERR(group)) - return PTR_ERR(group); - - iommu_group_put(group); - iommu_device_link(&zdev->iommu_dev, dev); - - return 0; + return &zdev->iommu_dev; } -static void s390_iommu_remove_device(struct device *dev) +static void s390_iommu_release_device(struct device *dev) { struct zpci_dev *zdev = to_pci_dev(dev)->sysdata; struct iommu_domain *domain; @@ -191,7 +184,7 @@ static void s390_iommu_remove_device(struct device *dev) * to vfio-pci and completing the VFIO_SET_IOMMU ioctl (which triggers * the attach_dev), removing the device via * "echo 1 > /sys/bus/pci/devices/.../remove" won't trigger detach_dev, - * only remove_device will be called via the BUS_NOTIFY_REMOVED_DEVICE + * only release_device will be called via the BUS_NOTIFY_REMOVED_DEVICE * notifier. * * So let's call detach_dev from here if it hasn't been called before. @@ -201,9 +194,6 @@ static void s390_iommu_remove_device(struct device *dev) if (domain) s390_iommu_detach_device(domain, dev); } - - iommu_device_unlink(&zdev->iommu_dev, dev); - iommu_group_remove_device(dev); } static int s390_iommu_update_trans(struct s390_domain *s390_domain, @@ -373,8 +363,8 @@ static const struct iommu_ops s390_iommu_ops = { .map = s390_iommu_map, .unmap = s390_iommu_unmap, .iova_to_phys = s390_iommu_iova_to_phys, - .add_device = s390_iommu_add_device, - .remove_device = s390_iommu_remove_device, + .probe_device = s390_iommu_probe_device, + .release_device = s390_iommu_release_device, .device_group = generic_device_group, .pgsize_bitmap = S390_IOMMU_PGSIZES, }; -- 2.17.1