From patchwork Tue Jun 22 16:23:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 12338009 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 6B232C2B9F4 for ; Tue, 22 Jun 2021 16:24:12 +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 3654C60238 for ; Tue, 22 Jun 2021 16:24:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3654C60238 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 A8FCA6E107; Tue, 22 Jun 2021 16:24:11 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2A7F6E107; Tue, 22 Jun 2021 16:24:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J4SaaVtXKYmmNVm6lFFfZQ1Pf0vT8dq1r9pBG6wgU4NnHIfJVqeIqDnTxxS3G37lLdnREgtRc7+5TiKUhjAx8yJwjGNWGfYFs+dqz9wHkhWVcXdl/wpxbIQWTUhqXWGDU4zKUlHdI4Ii5n/hlKu1j0jYFJn5T/5C6uozk59cKwfTqNVIWB/pSOwm9d7oMhAj8p1xVqpVk3+8mJVD0wKt/pJa0LiCWIn5koiipW9mGK33qEPfi1icHl6ZmDXCTiLC4G2ouX/2IVHZmqavKZh+FC4N89Y+W2nOe7OL5AowSjbsTZOsxVT8F9YOJiA8XYcC51t1XeaNxbRBbXZ8CcUM2w== 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=aeq3lPKpic4GpmDjUD2jzgFHSzvPxEwBEV1xsFKCcIY=; b=exy5ssp/0JWXqDeovR5ee6ceIBaAWf8fUNarcwF3JPDduDVcUaltCB6vhYphYHdibh7Xr55tcn/dgrQxN1lkZfwF5CR6qG9wKifuvd0Az/rcVjPrKbHHFOy8P6sX90yuftm0SMuaye5a+/4KXJQYWpnDk1OT1hw9+tPNePUhBSBDzAdncfPthX3ltNNfbRFo8Vuv+tfnBpLcWJ+o7Eq02EcR1Y2wjRNj9nn3cMxQZxnM3bVJW5EAJPnBOGGFPYmIXQ0VGt9jgGarnG2RFOBD8ZMepvWGclTmxWy+m3dWdODbJu4BjbeDsYlgJBHFq9St7HvgNJLBPxea5OarG5p+UA== 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=aeq3lPKpic4GpmDjUD2jzgFHSzvPxEwBEV1xsFKCcIY=; b=hFZrPbXhA8FTF54Y4kH+hke2q3pQEVcGwDDsCdqGwCvEvo1DLJX8yAHQmyWW8nCF810tsZB5+9UOBQ792SWkGYA1BYbdWp/6cGCPU/JcIedVUiw3AEN/XO5x2zJwlKoZRk+LYbfxMChaENAn0mtyny/K8Z1wWsasL5CZinJKWu8= 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:08 +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:08 +0000 From: Andrey Grodzovsky To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 1/6] drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3 Date: Tue, 22 Jun 2021 12:23:34 -0400 Message-Id: <20210622162339.761651-1-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.25.1 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:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a79ec498-aff4-41c3-d186-08d9359a2905 X-MS-TrafficTypeDiagnostic: SA0PR12MB4399: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:590; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g4X4yJkgkyBznOOHc3pW6fusIWob1tJuvP0Zsq0TTB9d97CAVTmDHMBGjxGRsiq+o5oOc4Cr2d2oO4ujHlPDc8tk4GDRIU36luZ1RAZBPVf1ii5lSc1sHQ2JidQ1NfdmRHBi8DmB4aCuL0rhthz4WK10m0ebum5jRjdJEW7zFkb/W8LH4MHI6c/mZLGAO4lsZ5HeIRoXd+MG0k21AGXscRSahxzh+ZEpnjkrUKUXDgvhwMv2dQAdc8Gb+DOGtg1O7qsFZGamwRY9WG1lUhMebnmvPIOWKWhDWs3hMiC9h6ZUtlxSXhrZ22d9OuEHF/NNr9ShTj3S6QLTVcSK0YKJZgahfqF3JyHhxeczngfuM1Mx5YevEzqSr5h/tjvicoZqlEncFnF1pTEBGAz2Kcy163hL2jOebsCRChcaLXAzp+4g0Lfm3eftERsaiI6XLUtwUmdWT67v2MUTfNUcOiZIHmn8aOsrnDNSYEkKqC0hpPNnN1a+7tdOhz4rmBpRnQ5h4m7NwV1fexZhHVAuIhHGWroQw6/UfiIu+4rUri9SZIuAX0vBQ4JKkYqqEr6Ezd0JnKJCXW9YoK3Su5AUq+RYFb6BBKHHnZtwhtcKRE9Dors= 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)(66574015)(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?Ff7tuhwuIJBThmtWATFw3FBKlAcC?= =?utf-8?q?FRW01AahpYLwqwYkg4q3lXSeyo4pOPiUsOSRxWt/yoQWqe6sp+Y1zrzhsy4NihW2Y?= =?utf-8?q?+r8UUj7yBJGgsXpwGMv1nxyTsKcOFS11FaV8/s1/h6XWGFTMphSvficwCZnPNMLod?= =?utf-8?q?3tKPHuVktFOh2P7c6R8cgeaft6H2V3LZYxI5Y2MC2wBDqlvKwWxFpryFjzQx9vwST?= =?utf-8?q?2hpBDNzUG7IiVqw/vvRkICi/bMiyORI1BdqrUc8FdCaLJzI6+h5ctqTo1jjddq30u?= =?utf-8?q?XhXPKlg2tZTCpOY6MXrn3vUEy3fVX+sNzbLSoj7zqX4pSFqQVDW2CmD76e6/N0TS5?= =?utf-8?q?OPAKI0uY1q4rdohWvxbt1p6R6A7X2fLSwtyUNWgPsbkV8T+H47w3BlNgFKd9xiF40?= =?utf-8?q?wG8Kj6+1UBq9F0RtdN8rJpnvAiciZfBkrsGvXUvBcqo4UdhIV9oF4Uaa8yiO3iPv1?= =?utf-8?q?MRSs79MO5jwJ1Jlogp5a3K9hTbPe+c2D2fmUXHAPvlZBffRXyW2COXI9piLIVX3DV?= =?utf-8?q?FKtG96lvJqHW2ktIuKMyNJhKIoU1D6DCzOanfE15PLiH18Tna2BcwduHbfoYFncX2?= =?utf-8?q?efmrPegdSlbm0pOrlOcISb1f5EEOXPsxfGsOmR4mgH+PR0dd6J7t/DErWWyOGEn+z?= =?utf-8?q?+oegktOzHpEGbObRQZuEa2yrwiCM9tCOtp1Byf1reUuBtBKxa8GE/r72Sw13MOcZA?= =?utf-8?q?pQJ0b6uU3StqSL7W6IaRnIU9C9TxfD/8ck79fBxgdvQ3Z9wjqymmcXoVRbCHP3bgH?= =?utf-8?q?+kkwBPp5883XG8nSUTHqsUMCjWH9l1qafGwUwkqrW5E8IY8XswZEmRuDHLODJ/2b8?= =?utf-8?q?nfuzPNuH7mtm8y+/oT11UafbCHIueN4NovblcrPLAUI1W9mpWLSMRVC+Ok+54SMBr?= =?utf-8?q?Bcr1iJmBHMWiLvCBsh6AdjeIZt3FqWb4d2571g7qUCc6ek8Y3npC117ajmYSJHxSE?= =?utf-8?q?OD1OAZ8zpdFo0xCXbvShtje2oCZ8rOcf2k8eaXkke5CsZUODk3uE+UgsJ3OmeG13i?= =?utf-8?q?K4ciAKZ0/PYfPhh7dmAdyd4XIwFRGRCio61eeHdkEhbksjCUEZL4K9VbOEpBNzxNK?= =?utf-8?q?I/oUUBc8vRsnhc85CbPn0r2EWVn0VkO0DIAhdcqhmfuqkgDkTQU7BZaiZC2hxGc1u?= =?utf-8?q?JzH83IeJdxnZBbEr21eWh7/xu4IEjQsJpWNEkyWRWakDFPwjJZuty3IGe+mgH40pu?= =?utf-8?q?2bPoZKX0sfVeB0FLt1j5CpuJQFqWTIPdngezsoM9/7WNcBXcU7H2J+w2qXhdNMZ/6?= =?utf-8?q?8HJuafXGu0mfxiAbPw6dY9J/IXrjmHE9Qmojq2Vt3mvZ9OvzMsNGVF7ZfVOtOx9XF?= =?utf-8?q?I68X9yzQErLdJfa?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a79ec498-aff4-41c3-d186-08d9359a2905 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:08.1597 (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: VJGLOcKiG2JIKgCNa6891UrNx0B20UPdlg7W7xPCtpX6vLO5Z+zD2ZyOjK2CdaqKQ0iBfYMKihAkJZS6YI6Wyw== 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: Lang Yu Sometimes drivers need to use bounce buffers to evict BOs. While those reside in some domain they are not necessarily suitable for CS. Add a flag so that drivers can note that a bounce buffers needs to be reallocated during validation. v2: add detailed comments v3 (chk): merge commits and rework commit message Suggested-by: Christian König Signed-off-by: Lang Yu Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo.c | 3 +++ include/drm/ttm/ttm_placement.h | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index db53fecca696..45145d02aed2 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -913,6 +913,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places, { unsigned i; + if (mem->placement & TTM_PL_FLAG_TEMPORARY) + return false; + for (i = 0; i < num_placement; i++) { const struct ttm_place *heap = &places[i]; diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h index aa6ba4d0cf78..8995c9e4ec1b 100644 --- a/include/drm/ttm/ttm_placement.h +++ b/include/drm/ttm/ttm_placement.h @@ -47,8 +47,11 @@ * top of the memory area, instead of the bottom. */ -#define TTM_PL_FLAG_CONTIGUOUS (1 << 19) -#define TTM_PL_FLAG_TOPDOWN (1 << 22) +#define TTM_PL_FLAG_CONTIGUOUS (1 << 0) +#define TTM_PL_FLAG_TOPDOWN (1 << 1) + +/* For multihop handling */ +#define TTM_PL_FLAG_TEMPORARY (1 << 2) /** * struct ttm_place