From patchwork Tue Jun 22 16:23:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 12338015 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.7 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 31785C2B9F4 for ; Tue, 22 Jun 2021 16:24:27 +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 067EB60240 for ; Tue, 22 Jun 2021 16:24:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 067EB60240 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine 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 389BC6E5C1; Tue, 22 Jun 2021 16:24:17 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2084.outbound.protection.outlook.com [40.107.237.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9C636E5C0; Tue, 22 Jun 2021 16:24:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ft5rSvxSzlC+h15Ifk30bKhnmVANtaRDs7vvFshCHVzDkGlAKK1dfjWBjMlEUrNlwxHk/aMunZ9qV0eSjk2uzF/kL2zBIBEfI+xWKF5LlNsTJBl5ukxbJ5KFTIbH6HeUTEEP5/SVqYocGYhwq6/LnlaqPhtlBuQmkXsI+Vquiacd14OuLceH7kxtTibJrbThIDfCeca7+3vhLYF/cZMGdTSTEfvnlGz1dTK5PgpciKF5dtIKTYFt/qZDF4d8WresFVnuOpaewn7GYsoIxhr4F63Apb3i30y61F3SSMjg29QdUx07WLU7OtqEJ81ApkznpUJ7ihSMfdvtJ2iy5Kljeg== 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=hXsPlRN77QPW+FUwi5x4I+6OwsqiVa2abqH4ZYZ9ZrE=; b=ZyjG+gqEIQS3RssIfv+ezIq99V9hYG1+f2eRMMvEocB7K/6BbkvBnEsGDjNJu/KV6gLbEKi5CcX56mPSsY/joP7mIMeoctDTixAId1Z5imH6DWG1j2iDJj1gZ6UTulkuDu1O/ZI7WphNbYn9N/f8pOFY+hM8YpNEn+UK1EyHky7GTPzuEmzfIU+i0ISi5ynYMFQ5cQdaKw8S08Mpm2GvbZBsX4f1ChzzsGvId28lZHzf03mJpGoTuAnVjF83eiyD6SAqWJFGzHFpO2CFsNHERpnAcuCMpEOJ1PLu1Nu9kuLB8NR1aoACIL9MPvNVDJRb6veaPiyG1SoDP/mdLX9khw== 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=hXsPlRN77QPW+FUwi5x4I+6OwsqiVa2abqH4ZYZ9ZrE=; b=CboWOGyIuEBzd2OOC4C+ERFHkrHz94Mraw59XJyC6P49xMVnHc2i0FaZTy/+4kkwdMLWuvFRjEKRleDMbohVVLeypkmHYM/mOQVxewT9MVW8bTch84hdWHsEx3mqW1UCHC6gkHWAZwyr+Dz1s5VK8p6FH90TJIXotlyXqx6NI+A= 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 SA0PR12MB4399.namprd12.prod.outlook.com (2603:10b6:806:98::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Tue, 22 Jun 2021 16:24:11 +0000 Received: from SN6PR12MB4623.namprd12.prod.outlook.com ([fe80::9f8:ec71:6535:cd36]) by SN6PR12MB4623.namprd12.prod.outlook.com ([fe80::9f8:ec71:6535:cd36%5]) with mapi id 15.20.4242.023; Tue, 22 Jun 2021 16:24:11 +0000 From: Andrey Grodzovsky To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 3/6] drm/amdgpu: always allow evicting to SYSTEM domain Date: Tue, 22 Jun 2021 12:23:36 -0400 Message-Id: <20210622162339.761651-3-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622162339.761651-1-andrey.grodzovsky@amd.com> References: <20210622162339.761651-1-andrey.grodzovsky@amd.com> X-Originating-IP: [2607:fea8:3edf:49b0:5c6b:dde9:a4fe:685] X-ClientProxiedBy: YT1PR01CA0137.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2f::16) 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:5c6b:dde9:a4fe:685) by YT1PR01CA0137.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Tue, 22 Jun 2021 16:24:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cebc4f23-3372-4e6f-b6c5-08d9359a2b0b X-MS-TrafficTypeDiagnostic: SA0PR12MB4399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dfxIwalk5F5VMoSgKntOjohWwxE77GWyFrLK42kDxxYTEqhurzi0dxl+1HQIVCtOGsc0BZen14O5CUZJJjEMxqWMewYda566cxlcY1UPC3+2O1J2B9+zufD7mDUdVLDT5qNsULMDoilf/Z3RKeaI9vdmDpAiWD2fFR5ih+G72IOKqQTmxm+H4GvbTEUqxvcAKcBQQlbQmV3t0RyjpVg7s/7NhmynjhtglqOIfBahaewHkqNt/gv/xxzWIIbHUTMBIO9fr+kF5g1+x4GXQsrKitu2BK0zE1WKq9zKU6etn1xY0JyhhnchA3BMd+vRE4S64f3aXEC6XiYbPoEOnBwJn8kYJE+IyUpp8SMr7gj01IoYLFUuicQKmawOWoEDcmbpOcYAKvFu9XmOgeMejjw3vkAhxmJBsJTaPUXvzD7tULC/r5Wi0A+2RjmdVL0FnoeXNde8vnbNRCsiZIEuvPLBz+gGmf/EqrjQLpCXRH+APkMREwfNCdmw1Pfqgvfv1rI7ycf/Q/VytfwcMZzAjRhW8fIK3xFPNOOp87Q0m4Ya3CeACC4vk4rWYaqN1JXr4JoSBgXiLPjFJqhLsr9MhK3PJQ4JPMMGLIy5qnj7S52MZkI= 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)(36756003)(66476007)(66556008)(66946007)(2616005)(44832011)(2906002)(8936002)(8676002)(5660300002)(6666004)(86362001)(6486002)(16526019)(186003)(6512007)(6506007)(83380400001)(1076003)(52116002)(38100700002)(4326008)(498600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?K6SrEy3LqDSLRjBBYRZkA6em7qnP?= =?utf-8?q?OF4IZXs7i1SjGXwkobl1fc2JorzOEQlW1cu3BHNAbJD/TbOGZnNoTKrmjcGoI0cWm?= =?utf-8?q?WRLE+sajYf32VdrUF417LlPJtBUiJDOHSicKSEEB1ULuGxHwrwzXoo8YAeLs4dyBQ?= =?utf-8?q?G980Rmk/y+ZEq6UeuTeYbnJ07VD74RKpwt6FBCNvRkalGivZk2c5SdyYR0yrPQx/5?= =?utf-8?q?iwekK0fnhKOSTpEt7plaRZqcraQs0sfVqmWOezH++I+GNI8HhhJBdwBsgxU1anKz7?= =?utf-8?q?unogUPvdELP+rx/LNOIM2Otfn6cTO6K03eER2TIilqUdvqFZC9A8sSbkulELYQTCr?= =?utf-8?q?pCQ1t8YYNZuIiQ8cqDcNzQkfzFsBKsH64eoH9XunF8yUht1U5M93mPbWIwrEbCFoC?= =?utf-8?q?HYha+/dzl5Auu5zYNmBS4XkzisRisouGXJH94mFNtsgPYBXo0Rim2N4Qn7WD/1M00?= =?utf-8?q?tgf9uVLEXg+3XibAgeBMjcASJSDnxnmaeCMTHF5mXg6/ndFcB7Xm8kNmrrcHjaYKm?= =?utf-8?q?8OxJvEfTFOyPzXj05MTOBCD9LH1olnCwB2QHd9do9y3o/iXr3jyPcclprZPZoTl5N?= =?utf-8?q?GddmoFm/YGdxQ+2Q1U4ElN9N88OGmeWo0X6psirt8TaqMJA+xU14nq2ZhmMUd10yR?= =?utf-8?q?F7NO3eRZ/dKyiaL7GfiEP/xT6HpJ8O2ulkiyOoFTUyxzN3YjFBrJg88lb6i7lQmYS?= =?utf-8?q?UtpXSyrAWVWCdEVj6zd3D5gAv+D0a0diRp/J5KHtpv6Gw/37o0XeWBhBB2Qgn9RZU?= =?utf-8?q?HtTICsk0YA03shucqdXpimezozpzwsH+RUqiG91XLJL8wqPfANCr1Zio3tSkQLIF5?= =?utf-8?q?ALCAENnhKaLaxMUgJj/eknc+ykqwx00ogTlKIsk8B7yZ+PF5VW2cBCROqEccDLpkN?= =?utf-8?q?xzJswV0APv3icCVS9ESMlDS1Ef4voyh+/1x4zzDyMoqrWVu6nCQ3c9KE/4/D4iXRp?= =?utf-8?q?clBhfxhJLHIkzfpoP3eId2chd2+ULknw3uP6ASfSOOilc404kYBlU6aVdgJrma+Ry?= =?utf-8?q?IoGsp88dd8xoea3e/y/ugnQq6/f03vQ9W86tbGfnhGTo7vmKt/2CX2fU90MjDdKWQ?= =?utf-8?q?J4jFf4JuQGQoa1ldIWmwogN7iLhHDRx6lrvKp+XJvFPVvQZCunKpR7HLywbOg0GY1?= =?utf-8?q?bcufpaYzUnX2nEAXkdD23Qg0JZmOHs0w8wZXI4S61KCLd1ah4xF+qhOnvaivhs2xx?= =?utf-8?q?B6TBM8u3NM80BL2dTYUexwRWdaXG1o4trf64G1sDYNVQg4J+Y0wfAV53u8bgzjn+8?= =?utf-8?q?7NU24S2bJ2ktgUhUUPFBxabgR9Ogoayxro7/zx3LLyxcdTUFdnF8UvBFKtQ2EtUVm?= =?utf-8?q?9U5kIFfjZgcKxmt?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: cebc4f23-3372-4e6f-b6c5-08d9359a2b0b X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB4623.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2021 16:24:11.7067 (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: Axa7N/HDGFuKLBavKBBS1vfSSvlfAVWBVvAqUM9y/nisQlbdT++k2R5HcQXI1xwZUft09bVsH3J/pOTDpwiKYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4399 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: ckoenig.leichtzumerken@gmail.com, Lang.Yu@amd.com, =?utf-8?q?Christian_K?= =?utf-8?q?=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Christian König When we run out of GTT we should still be able to evict VRAM->SYSTEM with a bounce bufferdrm/amdgpu: always allow evicting to SYSTEM domain Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 79f875792b30..b46726e47bce 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -149,14 +149,16 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, * BOs to be evicted from VRAM */ amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM | - AMDGPU_GEM_DOMAIN_GTT); + AMDGPU_GEM_DOMAIN_GTT | + AMDGPU_GEM_DOMAIN_CPU); abo->placements[0].fpfn = adev->gmc.visible_vram_size >> PAGE_SHIFT; abo->placements[0].lpfn = 0; abo->placement.busy_placement = &abo->placements[1]; abo->placement.num_busy_placement = 1; } else { /* Move to GTT memory */ - amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_GTT); + amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_GTT | + AMDGPU_GEM_DOMAIN_CPU); } break; case TTM_PL_TT: