From patchwork Mon Jul 31 17:50:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13335346 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 6CC31C04E69 for ; Mon, 31 Jul 2023 17:51:11 +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=UdfEVtwcMtIwzV Z24xVpG1h35TLf9mvInNyCtTAsipDQpx84S3IzSl7dS/IRt0Z9Q8mfTEeylXujyZrG9VMWcPtncgL jA1Wved6p0C9RXDROAjxBIH7WlDq1FxFCibW4gSxjhMmPbPDZ+FuPC/56SbwP2KBqXr13zCYMqbCa GkaxUVM7wy/eTAwHYyIJ907SeEpQq6m/PCQSw6Ljcfb+l+PjzjoCHEjLvM++X56G0x4PDgmjcLNHz 0DimKRdRnOBCDtOdGH+9VHJNhgoeVA+PhOvCVCYC0mNb66gYuYsCRyY+5fJV/hF8gPdBE0h5YCULN XPgK1q6OjQuIfdu+ilow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qQX2w-00Gtwq-0C; Mon, 31 Jul 2023 17:51:06 +0000 Received: from mail-bn8nam11on20600.outbound.protection.outlook.com ([2a01:111:f400:7eae::600] helo=NAM11-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qQX2h-00GtZZ-26; Mon, 31 Jul 2023 17:50:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FRwV+ux3ZTHWH4U8dJW+KLmNaNB0VjcVgDzXPkexPW7kyzg45498uCZgeMUgxINxp1B9TBAbAIAQvGfnybl1D22cRin8qfNM6lYBq4lrxb5ygFeX3+dlMGFodOuROAbBDYwBDMLRXP2WJZf6zq6Yz3Qm+UiIE0+Sf1zQyp5o0SXZ0lM1328NA3yGXJqotk7PnDpCDUdQCoxPIuT24iucyJWFWHptXlqP6EgkmG7SKpFnGh9XOqz2iaX0V1ZqV6rItDaJJffgXh5IpdfbtAB88LfDEZNoLQ3KaonO9SEl35+FJqCMI8oIVRDVPi8MjPlOCVGhmVwXf1eiDjajemYILg== 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=GA8E44QRGw4D1VgDRxNvrOKZKkkNYmiQ8iVze25Y9E16svTVn102L2WZWGYqTETg2iYTFBIWY+xIXBdUv5W43WI2cmg7XNQQr/cirXQAm3O8SWNyfB9dtIwXVYDgcNzrjdB7jC4vn3iAcY6z0cK+X/3LLFVCksy3WHQmFFHAj+0xZk6R4/kJqoImZY0tdHYX/Go8mnbw2tOErbP3FyB2t6DrtRCtC8ZrJs45WsQRr9DPDpri8Ypr8ScLdxIcmvC1Mdx4ermbd0V5anmIQW4YvnldqToUEKBtWmyfwTDqgcOdWCYSiaxdAUsoeCNC/z7kaxjsB2kMehxWsmwfnIDwgw== 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=JDMempPnYJc5LHO0+eCUSurKVuBRTTVc4+12fqoZXVKIOqqwrbVuuvsEcipjZQlk1H0Dofq7961I1MXaZL9PkOWr1XsShVZS9KoGgqxrsr9Xq37upx6ch+rf85aNbGwKekmIy8tOrYgSLcuAQl5Oi4sFwvGMtwfM3r+mLYtks57C+V5WF7/Kv93bnaFww0M4EUODH+MwfKYs69+JnXrkESmLSeAiECuczVuqAmJ3RryMbUENHYDolmXfIJ0SmzJmrkkWlarzQ41X2CriBDY2njDEOOKaKnI1qdcqY/s0nZu/zfD9pny9Q4cWn0wMRSdqYjnzYhQIxBDC8pQasPb8Nw== 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 MN0PR12MB6320.namprd12.prod.outlook.com (2603:10b6:208:3d3::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Mon, 31 Jul 2023 17:50:39 +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.6631.043; Mon, 31 Jul 2023 17:50:39 +0000 From: Jason Gunthorpe To: Baolin Wang , David Woodhouse , 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: Alex Williamson , Lu Baolu Subject: [PATCH v2 06/10] iommu/rockchip: Convert to generic_single_device_group() Date: Mon, 31 Jul 2023 14:50:29 -0300 Message-ID: <6-v2-b0417f84403e+11f-iommu_group_locking_jgg@nvidia.com> In-Reply-To: <0-v2-b0417f84403e+11f-iommu_group_locking_jgg@nvidia.com> References: X-ClientProxiedBy: YT1PR01CA0085.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2d::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_|MN0PR12MB6320:EE_ X-MS-Office365-Filtering-Correlation-Id: 745bcb3a-2833-43f1-86c3-08db91eea5d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SOZfZ11q/pG8HXVho72Co31TBrkL+9hq+CSR8jS0EY0w4pYG919iosIXQv6IoYMP3jnlDV06ejq4dR8xW+VI5tUYOeJZAVGNK5Fu51c4H3huvaOkb7mtHCO8M09M0lsfHM6pnxweya+ANNsU5GM/xCuT4wlAxDsQQy+nsdE1phAP99hRHIVZUVmLptYXT+sRAT8S25sqvyUJTOGj3oHjSAFEiTOGaH9jpnHgPu3Xy73++DNm0qnNcV1801O91CjOK2p1vktnE8jK/376a9y0r3436TpJMEQk0qKrryAhS1Nv4gkxsO+GEQJQlJCRPEoxmk084Lx4TvNWQ3rUxXOK90kQFbPef1AeUSNNXihejQU8uwXWZIN4YFw87j4t9SYv6sT9QQUJb28TtVL9C7tt/j5UdDuo8rs+IxOinV9sGGLV0UTTZHM/P9ocxWXCwDrWHkkf7f/WKR9HhOpSDiM+GZdtqd8M2E9p7VuEvTaMiUNgqwGynG5Go9FrPXeMp8uIfRIL+CgsiNu34cdKiU8EH0tCqqS4oRwii09D8U/ND+Bkt2qlk83luNBhpUZL9xTNEmPkLnS3hTcHHfH6/ECqOv1QO1AOvmMaC5aNlvAVZOhjDEQx8auMeY/7M0hAXtxn852MW5i+rTx7SgJG5Y9yuw== 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:(13230028)(4636009)(136003)(376002)(346002)(366004)(39860400002)(396003)(451199021)(478600001)(38100700002)(921005)(86362001)(6512007)(36756003)(6486002)(6666004)(2616005)(186003)(8676002)(26005)(8936002)(6506007)(5660300002)(4326008)(2906002)(66476007)(66946007)(66556008)(41300700001)(54906003)(110136005)(316002)(7416002)(83380400001)(4216001)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SlMRSOqnqQ1IO7YhYhw13Xg/dMhEjITfXrcrwChhGbYjK0ai+tioN7ASndMwdv2/MBErX4Xvi6xtemUxL+BLBUgtSDTujxcc9ia2Xa7XNFSJX78FBAaG/mFy7R+3bT0NzzmSYTM/LdSc6G9/qlMNGr9+JCiJxoV22RGaHFTLBdYH/h61tAiQ7pwwNAUX7xD/2NqQyvMjg/yF921uVtzHD2evUemogiH96EJmzKODYMsmNYKIHyzM5n9mzGuKqvtTHzlnPcbHMVbQSxIUB7lu3ZvuyqW+gk2CNwZls55Megr2+QwzNqTu8GgsqgmOkKylw0q3vm77vWVzQj0rzMC8eFM1tobE/CMVOMdbhSX4eUcbUh1tq2X60rPQ2eUDlJqsRHE/S9F4UfF1fwOBEPBto9sswPuI21DaFP2URChxW57d4H4hW1ieODG46SxYPmuYkCD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cjISPCpONNZXSqHLAF97FIHUdJpYxvCgv6GmX5lBoEMMCMiqeHuJoLe1qcTRCp0TbjH4wa9X6+JFt/dBgGUah X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 745bcb3a-2833-43f1-86c3-08db91eea5d8 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 17:50:37.5274 (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: pu7FQ1dVHes6exME9Tzmxj/GxPcZIKf1YL2w9eE2+HZe/bcxA16Iu0I4j0KNVgAd X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6320 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230731_105051_716536_0D737B0E X-CRM114-Status: GOOD ( 14.49 ) 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 Tested-by: Marek Szyprowski --- 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;