From patchwork Tue Aug 22 16:16:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13361128 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 12832EE4993 for ; Tue, 22 Aug 2023 16:16:36 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m6v7jeXu4SbMHzDvcwLrA/QU5hs7R9FkBNry/UE1SgQ=; b=4xii8HxqQaNovW 7Y1EZJHe4PSBocxcelSULEHQXUn6EjMr4h+6IwC+CVfLcAdpMl7s3wmkx7/6uEh3W7cDjGJ0OWj2B WqqbjdBGHfQApHrf6rYlavO41eNSvo54+b70cULGCjrbhq8cW9jbjsZ8siAcQIZ+xxsbR7Dc7uGTA jIVNh1zGL2Z0+rHD/ycoS4MEz3/p25xPD7lF+OO/e6vpHuEQ3dc6oPRAytyuDcNGTngA+8BfCSR+j QRH8c9BM0iszo7s3Rvnvkct4lnFtIkLM3EZike6qSS3K1KTcNGorD20B9zpEvkxvaBYXVAf2dW1r+ EvhoB1WG9owO5q4YQXEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYU3M-00GS7o-0s; Tue, 22 Aug 2023 16:16:24 +0000 Received: from mail-bn8nam12on2061b.outbound.protection.outlook.com ([2a01:111:f400:fe5b::61b] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYU3E-00GRyc-2B; Tue, 22 Aug 2023 16:16:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d9H1sNYcP/AKNhKXwQl+Z7u5oit8VPW42vCXWPnIZIu2c6wb6RFeJUww+LkpwXzjorAhr1qc8vpggkJOUftw2UOIZgkJLNL4ZlmcSr+MsW5Dmm+9eGmyGhufrAcwq+iXclHfMTBVBhVZvpWvuVM74/xDGX7k3MRNtxko8NZdlyUVBAYZBCGZiGSKmWA1MIFusEfs1NLvOpEPCRR8iaiv9N08HyZffDrRaJpUXp/wt8n1OAduZwAWgNKL/yeyvRBnWiWkbDfJAb9Mm7XDUDEUiHOjoTTbcorvWnBXhjYg8H5a/45FTWlqqGxzI49doudLBBD5U0/K+TeZKHsQbmZApQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lF20GgUKOoytttAX7Lh/dfU2iYeWLRAsCCkrvp7s/OM=; b=AiDIQYH6GI60yPzzPMn54mrp15O4GEb9EBoY7kp5V8EexlsceM8YRmZ1J3aNxHu0QceugkZcqry6BMvasXKZ9zD2HYM2qTFD8lm2HlFnBR65VYzsCRR6em2eSScaUmUyJnAfTORylq+alHlt/GJc3IVyOfLXe7BPt465Lk8oVOTkluapcg7U6R7OyT5F8X+xnEp3aWdj1+vbFJLTg6lIHKMMcqf8gHQKD/PPhG8UPml+heJoFYbCdl+8SiozOauEvLp061lFqsDxq95gHZGc4FrHP7yUdiCY2N4W/8Y3srzs2Xbz1UPOr7Ny3Rxo3mgdAibt/UgP0HUKN3oL7D0O7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lF20GgUKOoytttAX7Lh/dfU2iYeWLRAsCCkrvp7s/OM=; b=FBozIvRHPNSCk1f7+fpNYevrJJ/cwWeRjLAZ8Bvh3vM7COXDbDviZI53lyu+oNgDLwVMmP675tTXWVM1SIfpp2Yc/WJHGdvblrK7vKzSgjDPCTBT2W7yWCYNw5nhTxM07eoTscF0KE4d1SxAMXuQahcwFvWv+U15v+XQ0CGeuZoevN6AB6vQpZyVxgqMG0Kg49mzk0nrGan+8vPKiqHDyHXdVmRsiN67aXkMdeibEh+oov0oKIDFAGf5gZS0f5KI/Il7B7u32DffMI6HV+zJ1UjD8in+vTPXvhUUS9kM9zpvQ9ei9nz12oezrJ2sEXGiPbyEIy5FHwXhbs5HgWqj7A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by LV3PR12MB9329.namprd12.prod.outlook.com (2603:10b6:408:21c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.25; Tue, 22 Aug 2023 16:16:06 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::5111:16e8:5afe:1da1]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::5111:16e8:5afe:1da1%6]) with mapi id 15.20.6699.020; Tue, 22 Aug 2023 16:16:06 +0000 From: Jason Gunthorpe To: Baolin Wang , Heiko Stuebner , iommu@lists.linux.dev, Jernej Skrabec , Joerg Roedel , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Orson Zhai , Robin Murphy , Samuel Holland , Chen-Yu Tsai , Will Deacon , Chunyan Zhang Cc: Lu Baolu , Kevin Tian , Marek Szyprowski Subject: [PATCH 5/7] iommu/rockchip: Convert to generic_single_device_group() Date: Tue, 22 Aug 2023 13:16:00 -0300 Message-ID: <5-v1-c869a95191f2+5e8-iommu_single_grp_jgg@nvidia.com> In-Reply-To: <0-v1-c869a95191f2+5e8-iommu_single_grp_jgg@nvidia.com> References: X-ClientProxiedBy: CH2PR17CA0014.namprd17.prod.outlook.com (2603:10b6:610:53::24) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|LV3PR12MB9329:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b4a6b75-ace7-429f-cda7-08dba32b1670 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AJ1+CA/2tsmP4qEhyNXcopRkv51VwsQrejA7dmtTf5enhIfSv5x6to8NLb0uetJRYhM/mjhjaQrA0WSP5WZTE5jQh8Q+pRnEoNUhU/Gd3PkIoPZ3pB8TMVmwqX1gqJrmWjuj0ypA7Z0mnqprnM4ENRL5mG1E711mQtcFHzMBjnCJBqOqOD8zegTtN82+WP7oemc7amJDE+vmDbVhbDU4RisJpO3231AH3eLBbvdNit9eNAFQudCqDw0F16iEyclGCcAkV9UkYxAXTN6pPEYoIXELXTGlMzo7yrLx56c7h1Rkh0mqXByWz4nkp+lGBlVOErVRa9sqYl4Dl3G/44yFvVlkq/dKWsEIuEWZC86hBlUDVp+kT/4tIKF2d0xdj3ea9skUn2vI8LCODFQZNG42pJo4b7IrX9/SRR58/hO2oB4KP5a74gUWsa8NK8IS7MToxT85YytIYsEaN5c/M85yPm27O/brTdiQ2LLDROFQ3/Ofz9U9VhjFb2HAiQvZnAocqMIuPd74XLYrNroULAUhFcJKm9ql6/yLfJZoTJU564JBrztsdU9kJcCahPjxxPujwksRKxR6cmr7qhHsioCMaoOWzENVws6LdLNyhF/0Jpncv3JlxofRc9wvrMf4n/iioWoCUkNGsU75g+/JZI0V6g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(396003)(136003)(39860400002)(376002)(366004)(451199024)(1800799009)(186009)(83380400001)(478600001)(921005)(26005)(6506007)(6486002)(2616005)(6512007)(6666004)(86362001)(5660300002)(4326008)(2906002)(7416002)(66556008)(38100700002)(110136005)(316002)(54906003)(66476007)(41300700001)(8676002)(8936002)(36756003)(66946007)(4216001)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OSXUxCje1rDULGSL9SjICK7UPgfxBP8ULtlNggFlvW/jkv1gz4XrBepSA6sIm1aMLOHMA9pEnkqE2Hj7rMTCdhtRRr1iWsS3r9c30Bhw2JJFJirnk3YPJ8HID7pxSvPA9UEuhu3FTmK6BvfMyWylSw+XVw0uxxLoJRKvowK8ol1UTm7AqwXqy+wuQK/IMPRrKH9hAK+RIWjTkg1NJer/Mnx20HsVGbH9Y/FnCNv9W7A4iYE3dioroB84h1jqGbAWAXQuVAMJ6ZSIcd9wGkmXGkazC1hy6uUNxghIg+eISskLCfwAQrCW+eHzPmrVGL9u4CJokx8ynpe+8hYCwfY3QS41UJKVsn0AgHzzaGDw8T6nWsWjaXJUmfJM4nqMW2d15rL6TbDRNS88zKtUYy7P/XjnPRJxSEl7xlHsxh9PC/fp5ZDKIO3wV2dGz+J6rqbx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U/cad6nZcoXB2L8zmS5eOcJmVsgyrSRKHzTL4aN6g9HI2/mioz+aWc45BiA2GUz2lmdP X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b4a6b75-ace7-429f-cda7-08dba32b1670 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2023 16:16:05.9970 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /gXXYyWnwvXMR6SJ8giS3TK7QvpPaIL7gz00eNTL1tBGnGFXeYtsEcjx7v3njwNv X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9329 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230822_091616_770004_A26320D8 X-CRM114-Status: GOOD ( 13.38 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Use the new helper. Signed-off-by: Jason Gunthorpe --- drivers/iommu/rockchip-iommu.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 8ff69fbf9f65db..91f13cc9411548 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -113,7 +113,6 @@ struct rk_iommu { struct iommu_device iommu; struct list_head node; /* entry in rk_iommu_domain.iommus */ struct iommu_domain *domain; /* domain to which iommu is attached */ - struct iommu_group *group; }; struct rk_iommudata { @@ -1155,15 +1154,6 @@ static void rk_iommu_release_device(struct device *dev) device_link_del(data->link); } -static struct iommu_group *rk_iommu_device_group(struct device *dev) -{ - struct rk_iommu *iommu; - - iommu = rk_iommu_from_dev(dev); - - return iommu_group_ref_get(iommu->group); -} - static int rk_iommu_of_xlate(struct device *dev, struct of_phandle_args *args) { @@ -1189,7 +1179,7 @@ static const struct iommu_ops rk_iommu_ops = { .domain_alloc = rk_iommu_domain_alloc, .probe_device = rk_iommu_probe_device, .release_device = rk_iommu_release_device, - .device_group = rk_iommu_device_group, + .device_group = generic_single_device_group, #ifdef CONFIG_ARM .set_platform_dma_ops = rk_iommu_set_platform_dma, #endif @@ -1280,15 +1270,9 @@ static int rk_iommu_probe(struct platform_device *pdev) if (err) return err; - iommu->group = iommu_group_alloc(); - if (IS_ERR(iommu->group)) { - err = PTR_ERR(iommu->group); - goto err_unprepare_clocks; - } - err = iommu_device_sysfs_add(&iommu->iommu, dev, NULL, dev_name(dev)); if (err) - goto err_put_group; + goto err_unprepare_clocks; err = iommu_device_register(&iommu->iommu, &rk_iommu_ops, dev); if (err) @@ -1325,8 +1309,6 @@ static int rk_iommu_probe(struct platform_device *pdev) pm_runtime_disable(dev); err_remove_sysfs: iommu_device_sysfs_remove(&iommu->iommu); -err_put_group: - iommu_group_put(iommu->group); err_unprepare_clocks: clk_bulk_unprepare(iommu->num_clocks, iommu->clocks); return err;