From patchwork Mon May 10 16:36:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 12248665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2565AC433ED for ; Mon, 10 May 2021 16:36:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C9F576115C for ; Mon, 10 May 2021 16:36:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C9F576115C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CEDD66E89C; Mon, 10 May 2021 16:36:47 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2078.outbound.protection.outlook.com [40.107.94.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id E0D806E8AC; Mon, 10 May 2021 16:36:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MQV9iUMCxqOKhtAsOR+uaTWWPmechG103HPlWN9QNdroRoQ5NjLkbm/RzgibckDN9RlAAA3U9ZtlcZRxrtwvLhE0sjwfX+B3KFTrWXlsJXPy0GO2TGJHUuUWLBzlyM8IQ2q+tFBfpFPxvY2DjeKEtCX0bQ6E+uglWKXL0CpTef4V9NWziy955XT0fIKSMmreRKaUQ8nzl63F2NCIpXQ9ih1Ni/6tTu9ZSLbKChQvVxUQ9rvS0afqC+BGz7k0Iyf4lYm1U83l9w+8N6HH3DeEFJ9okbqjVWwMkt+0Cl5qDWYKVoalfojVkhux8TpPlGrBtllkreIV0Rap1PiM5Wtmnw== 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-SenderADCheck; bh=BPUKus8UfUiKGKixY69zLZagZ3iEboaQcf3OLBd+5uo=; b=U+KUouJruF6iv4GXsBgcSUzYhmHCKUfL5NGJNLkbPUHRnpqk9TWXXqdQyeSVUAWgffboB0dJHftcw7qiGzCyxEZsOPsNVa/gduNoRmcUJJ1qSvxGpvHXaMLUMfKrVH2MW3zotyrLJofeMyhiEo5khsP4qR7tv16Ad7g061ZSbQ+LVQvXDLE8w0Ja6BY1IWx+6h3l05yurYDU4IOH8+SRynwHqcRKVt4+ls53CCew/ZsMkprsTCdIGldfZLOMpJr1u3FruMxvfasmk6auDPyb2R23ZT2/H+s8zdu92+9vMVJ9KKhYO5AAb+9+yijsggDRgj78l7Cg/Wfyt+8Q3p8UBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BPUKus8UfUiKGKixY69zLZagZ3iEboaQcf3OLBd+5uo=; b=KOkWf5CKi2GRJR3PYi1xU0pwRDn4wRMY4wu2c31vxdXTMxozhZspBPGCBPj/X4qhCRLVPCPcntUk+9IDqMQS654Nr+umR1v6ZWfUiALKe1cJ7dlLcmIreRTj4toDHMFb1AM0ArZ3B/bCYvC7xtbF36MvWia/yQcwzwLmKE3ElTg= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB4623.namprd12.prod.outlook.com (2603:10b6:805:e9::17) by SA0PR12MB4462.namprd12.prod.outlook.com (2603:10b6:806:95::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Mon, 10 May 2021 16:36:45 +0000 Received: from SN6PR12MB4623.namprd12.prod.outlook.com ([fe80::ad51:8c49:b171:856c]) by SN6PR12MB4623.namprd12.prod.outlook.com ([fe80::ad51:8c49:b171:856c%7]) with mapi id 15.20.4108.031; Mon, 10 May 2021 16:36:45 +0000 From: Andrey Grodzovsky To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-pci@vger.kernel.org, ckoenig.leichtzumerken@gmail.com, daniel.vetter@ffwll.ch, Harry.Wentland@amd.com Subject: [PATCH v6 02/16] drm/ttm: Expose ttm_tt_unpopulate for driver use Date: Mon, 10 May 2021 12:36:11 -0400 Message-Id: <20210510163625.407105-3-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510163625.407105-1-andrey.grodzovsky@amd.com> References: <20210510163625.407105-1-andrey.grodzovsky@amd.com> X-Originating-IP: [2607:fea8:3edf:49b0:6a5:47b8:e610:f6a3] X-ClientProxiedBy: YT2PR01CA0020.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:38::25) To SN6PR12MB4623.namprd12.prod.outlook.com (2603:10b6:805:e9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from agrodzovsky-All-Series.hitronhub.home (2607:fea8:3edf:49b0:6a5:47b8:e610:f6a3) by YT2PR01CA0020.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:38::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.31 via Frontend Transport; Mon, 10 May 2021 16:36:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 015c91f1-5c66-42bd-7447-08d913d1cccf X-MS-TrafficTypeDiagnostic: SA0PR12MB4462: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:489; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q1Z800tohbKW7zvn4Bbh1XA7Fftu3U5Amrz9uyWw7SKDQ7lfKhrCA4dDddHSUHbRnyCxc/piArC0L3liubpcRgdni9YaC1FRa7tNusmMlRhhHXynnK0PDtH+2XmLbKeR3NA/ZmURLptvDo17HMaqFv3vfRv4lDJ4kD3vlIx44qdWQVx14EqWvnbta6g8HDVhEkCml3BiXdQ4LKpzTk17afRJsvueaCXpbIkUlBorML4sGZ7QpyE+FEGOo7Fvo20E/IhBjck5M5vh1iQle03TbwKlsQ92m4364cgXHTSLaLvxp018kOmkO6Rln2zSA/9u6XwAmjN+F1gPo9ZrvYXQSDFyfv7WbJgdb0gMD6nzSrJZeiMPojBqlyA9W6s81lcE1pK471u8MGxs9ONYZD5+I569nhllqRC1YZH+MtMR57Ni+BRdO2qrs0mAFsO0OaFSFVN1ocmAG/Ne32Vhfuux/AHqbnnz2rSQYHq9j2KLABLliCfkZ6UYZ0kjONNxUMiOYQBUnOpKIASzs+dchSWQ35Yxg6CNNP0DGgoDjHkP25JOSYwoMfIiE+S6MsDY2MMFVmSsJ23AkI0o1QPzLVyqnVDwxj1RKfWy8R2KvrqGGGg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR12MB4623.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(136003)(39860400002)(396003)(376002)(346002)(86362001)(6506007)(38100700002)(52116002)(6666004)(44832011)(8676002)(36756003)(5660300002)(478600001)(8936002)(2906002)(6486002)(66946007)(4744005)(2616005)(66476007)(66556008)(1076003)(316002)(6636002)(6512007)(16526019)(186003)(83380400001)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: HmudEYT8XJ81BJAeUtRMYGEf+SXkrhMkGC7sxN+XsekuG+Q1GmdYFDrMB7YMnmABSdVyLAi4gPpZE32g/rzxX8J2cDEYPlazN8mUL7+o6rKDXbCABzLKZ6s4eiVrUxWlwT2W3y3LSqalKY91/SZGbjM/UnIm9/r/QwP2RaP6zQX4p349eBVE1MYNfHxNlxZq2abSY9U9Mnz+fLUYYarSCMvr7KLxajDueG3Ve3NpO/M66HVax6stCfREVtRMn8fCQs3GgoTRt9fyQY2rqOHVRyg8qa50Z2+XsKVcbfPYjayz6jJU+ugOz98YkAdklB4dibDF5zbPpA1cleHtdkKpodk1vNrmKkLICpbwjncY3Y5vfFGUk+wl+XaNwCgEy/C42ydflMnUxZWzzIhYIUHfzW5i5GjQG4QivRuaJOizZvnmcBMX4gdrxjq1C9BpnpCbkU+fHyWEJGr7Q0f0P5R2FCrk87xyN2BeiZgBv6PPMiSCaShRtw/f3OY5mG2BgSS/CMzRMMXfo9OP3BeYdfqxwnrkXlG4QVwonYjS4/wt7mXzn4R2uKSZlaFBB3q+DQJwdqXkbEDWXtliBEn906aN2EmMVnWmImjvn+rTSogN20FUVfMqtyvbgzlOYuZMZflMTEmYkx1dB7C+UcK/hiVcy0gHw77BMu/9NxwYZ24K5Ev/GYaMC5YH34IiJfiiAr4cxG35jxm0mKh35I3J5kfrtfreGxt/cMooYNW3XDPZKe7wOtHwj2tHbQ55ZkxPZUxHVXYNlQu6V9hqpsr/J9vkSj+eWbgXpgW2Ni1Sn2e1OQyXQCr9o2EE6UKr2BZF49vNCDSCNnOqnU6P/QhrVR1RLPG6O+OHHjIZoQl6FZ5VBcAnpFywFtOldIa4oZc17Izk3ChsMxdlggdyZdyCIS0ET3FKqKty5Nu4q0czEIC9StbONDbZcTfCOq0CGTKhds7PuSlSQnZgjCePKwqyilSN2wHXjzFwGyH5HPMtxZk58tl2j18yZIPOJ5ppx+7NlfuL1qTNEUEPd3erIo5YnevdKoOLGJkHLQYS8c+89cbh4WVYXc+souVxwG5pmM0ZK70q1OUdsvRfQ1ZAO1M3LUJd9dEBbVSsyVoyVN0vOCX1H5RiquCYSaPNwMmuGhkETEXylk99HI4k0iYLVG2JenUgcM8qFkxJYto2zjDTDkzV3oM38t1Yl612Qj5VroUcrMMmqt4SgnxpuMrNkAji/K5Z+zuGiYW1DRQskx+WSjNt2VwHlJlLc/PEKJ7SYt6ATWuDAoKaxurIGK3dRjWJzEzfrjh2GU3iD8VVs59NV2J4HezCaNwCNV9IkYgFUe2OWMNXirlLCTYEGIZ5WwRwaIzbwHoEbRqYFU0TvU1IJvY/dkCdmrXCPTb8fspDeE5IhQ28 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 015c91f1-5c66-42bd-7447-08d913d1cccf X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB4623.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:36:45.6965 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZBWfBQ3Q3dFKR0PaerZXYIbOO8wRaOI2BvOadpf/U8rLOQnCHVHUidcP4+C5cvGXAaH3cSX5ixtMt04uERtJqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4462 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gregkh@linuxfoundation.org, Felix.Kuehling@amd.com, helgaas@kernel.org, Alexander.Deucher@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's needed to drop iommu backed pages on device unplug before device's IOMMU group is released. Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/ttm/ttm_tt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 539e0232cb3b..dfbe1ea8763f 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -433,3 +433,4 @@ void ttm_tt_mgr_init(unsigned long num_pages, unsigned long num_dma32_pages) if (!ttm_dma32_pages_limit) ttm_dma32_pages_limit = num_dma32_pages; } +EXPORT_SYMBOL(ttm_tt_unpopulate);