From patchwork Tue May 26 12:59:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1298002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49WYyQ146vz9sRW; Tue, 26 May 2020 23:02:06 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jdZDR-0004xO-6v; Tue, 26 May 2020 13:01:57 +0000 Received: from mail-pf1-f193.google.com ([209.85.210.193]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jdZD1-0004dk-IB for kernel-team@lists.ubuntu.com; Tue, 26 May 2020 13:01:31 +0000 Received: by mail-pf1-f193.google.com with SMTP id q8so10156176pfu.5 for ; Tue, 26 May 2020 06:01:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7moaUIokECCNocDPFMQ3TJEbUcaH1wtcLOfEZb+jRUI=; b=O14fA6UUt7ovkPlsOGnFpKubaN5wdOvZMtwCnYJayrSo1J3lLkHSgPoigAZE4Si5+I KSRZrOr/B5MMKmQDzUKsNJCWhM0PZxavs5TekBRCGv07lakJUF6Q9BXSVgaubtH1Fr2Z Auzl1yKQA3zkC0fsyMe9g/hZ2DVHc6VKmdzOQI16ecUHbN8y+XELyQd0irXU4rJTGDuw megCvrEgeA74y1Wkt3gqb1dpJBKxVUNxqQYyOK/SYqU8WOd2tq0osyg4XX1CL39HdIsy ec84ZYkmWNDHMac0IV3xCT1sLsqyzhuGWKScs+P1gEub34Uxj1nija7mkOhrEwmN2neO /IUA== X-Gm-Message-State: AOAM531RJYzePbAEzWDzhDykL8QyalWEmXXPxfOesGxdqZg5gnyzxwAV Vn6h2d+iForLLgG+G7HypR3ENszG9co= X-Google-Smtp-Source: ABdhPJyGGTKWoSWESidRd3SeBYUO8EbnIecbdB7JHL6Y0JZsbD8d+Zmx174g1zm3wfcxE+wf2A2g+w== X-Received: by 2002:a62:8648:: with SMTP id x69mr22139349pfd.278.1590498087448; Tue, 26 May 2020 06:01:27 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id x13sm14926775pfn.200.2020.05.26.06.01.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 06:01:26 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 31/42][SRU][U] UBUNTU: SAUCE: iommu/exynos: Convert to probe/release_device() call-backs Date: Tue, 26 May 2020 20:59:43 +0800 Message-Id: <20200526125954.237403-32-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200526125954.237403-1-vicamo.yang@canonical.com> References: <20200526125954.237403-1-vicamo.yang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Joerg Roedel BugLink: https://bugs.launchpad.net/bugs/1876707 Convert the Exynos 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 Tested-by: Marek Szyprowski Acked-by: Marek Szyprowski Link: https://lore.kernel.org/r/20200429133712.31431-32-joro@8bytes.org Signed-off-by: Joerg Roedel (cherry picked from commit 3c51c05479c577ea4235d46366d6181a2d6aff2d iommu/next) Signed-off-by: You-Sheng Yang --- drivers/iommu/exynos-iommu.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 09cdd163560a..60c8a56e4a3f 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1235,19 +1235,13 @@ static phys_addr_t exynos_iommu_iova_to_phys(struct iommu_domain *iommu_domain, return phys; } -static int exynos_iommu_add_device(struct device *dev) +static struct iommu_device *exynos_iommu_probe_device(struct device *dev) { struct exynos_iommu_owner *owner = dev->archdata.iommu; struct sysmmu_drvdata *data; - struct iommu_group *group; if (!has_sysmmu(dev)) - return -ENODEV; - - group = iommu_group_get_for_dev(dev); - - if (IS_ERR(group)) - return PTR_ERR(group); + return ERR_PTR(-ENODEV); list_for_each_entry(data, &owner->controllers, owner_node) { /* @@ -1259,17 +1253,15 @@ static int exynos_iommu_add_device(struct device *dev) DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME); } - iommu_group_put(group); /* There is always at least one entry, see exynos_iommu_of_xlate() */ data = list_first_entry(&owner->controllers, struct sysmmu_drvdata, owner_node); - iommu_device_link(&data->iommu, dev); - return 0; + return &data->iommu; } -static void exynos_iommu_remove_device(struct device *dev) +static void exynos_iommu_release_device(struct device *dev) { struct exynos_iommu_owner *owner = dev->archdata.iommu; struct sysmmu_drvdata *data; @@ -1287,15 +1279,9 @@ static void exynos_iommu_remove_device(struct device *dev) iommu_group_put(group); } } - iommu_group_remove_device(dev); list_for_each_entry(data, &owner->controllers, owner_node) device_link_del(data->link); - - /* There is always at least one entry, see exynos_iommu_of_xlate() */ - data = list_first_entry(&owner->controllers, - struct sysmmu_drvdata, owner_node); - iommu_device_unlink(&data->iommu, dev); } static int exynos_iommu_of_xlate(struct device *dev, @@ -1341,8 +1327,8 @@ static const struct iommu_ops exynos_iommu_ops = { .unmap = exynos_iommu_unmap, .iova_to_phys = exynos_iommu_iova_to_phys, .device_group = generic_device_group, - .add_device = exynos_iommu_add_device, - .remove_device = exynos_iommu_remove_device, + .probe_device = exynos_iommu_probe_device, + .release_device = exynos_iommu_release_device, .pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE, .of_xlate = exynos_iommu_of_xlate, };