From patchwork Sun Feb 13 08:52:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paneer Selvam, Arunpravin" X-Patchwork-Id: 12744541 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C7322C43217 for ; Sun, 13 Feb 2022 08:53:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D27E710F370; Sun, 13 Feb 2022 08:52:59 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2064.outbound.protection.outlook.com [40.107.220.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6233610F375; Sun, 13 Feb 2022 08:52:56 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fn1FbFoV6C9TwizfdHfjihTF3l1Dfv6M1A0voKWZ3G0FNblrR6/b7a3twO9DzGwDxB1pGD2Awcy+uCDWewqO7WN8IksoYekBKHkcDvMVkteb/6iSQaiepucn06StoruPfIz0laZuMdjJPUQHTX6CouBAjva+nRCEZQVwk5DgznRBXDrvBdOMfICXBvdkthgA6Cbx2W8SP6Lr8StO1Ybftsb6EvQE5cyV/q/13cdYj+A4iDSWetGCZUkYoaZEZhrYwhZ01BRzmCp7rzMCnUEASiYxvFLfK0l70CW2Va8ey4BmALL34eUxrO07VTs6pv/DpBX01tp3DY5gzM/wSc3DKA== 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=2kIgAxTsZOmMt/R5KguyZmOmobVdLpO5qp1KF1znmrk=; b=DCxTL/BR3KirzFGa3aNRrnxY2xkCExrV9dc8FHvTqAV02Wfk5fJmAcX4XTsjHPO9MH0/a4NBzaeQ2kzyUal61kB13D15RQp9jGZjwIlZ7FnHeKOOiCNEko9ZD+Jmcx2FexfIlMQjOBMBJExgIH5vkQoAj2C1HC3Ay7vviRa4e/ka9zfyR34W15IhqBc/erJcO5TcrnGylcf0o3nLNtdb79lXmdaQT0bHyAkrWgnb9uV3LuKvn8P3nWUhfYBpPEAOnkWBl/0hRyZY1OD9zLoAJIo93cYUU/cbrA1Pbf5QNRPrmvJico92wgHnwAsaGfkr6DnWfT63LkyRtEzOYRsVIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=2kIgAxTsZOmMt/R5KguyZmOmobVdLpO5qp1KF1znmrk=; b=h312PUdZjC+g/UEAqAOBN3boN91tjeHtQAHkRc/AOxI95VyApOvMMvT5dHKSRInIAoCjofBG1udZ6nFHe6js8Y0BnHXGNsFr+GUdnyBuLW5GOX+axkD1x+ArHlrz4yooYln/lNc7qK5wEW5hPbG5AJOVC3Q65QltotIzVXPMnIo= Received: from BN9PR03CA0396.namprd03.prod.outlook.com (2603:10b6:408:111::11) by MN2PR12MB3599.namprd12.prod.outlook.com (2603:10b6:208:d2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Sun, 13 Feb 2022 08:52:52 +0000 Received: from BN8NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::66) by BN9PR03CA0396.outlook.office365.com (2603:10b6:408:111::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15 via Frontend Transport; Sun, 13 Feb 2022 08:52:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT053.mail.protection.outlook.com (10.13.177.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Sun, 13 Feb 2022 08:52:50 +0000 Received: from rtg-amd.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Sun, 13 Feb 2022 02:52:46 -0600 From: Arunpravin To: , , Subject: [PATCH v12 4/5] drm/amdgpu: move vram inline functions into a header Date: Sun, 13 Feb 2022 14:22:16 +0530 Message-ID: <20220213085217.2705-4-Arunpravin.PaneerSelvam@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220213085217.2705-1-Arunpravin.PaneerSelvam@amd.com> References: <20220213085217.2705-1-Arunpravin.PaneerSelvam@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2f36bbec-7de1-4c5b-4019-08d9eece37fb X-MS-TrafficTypeDiagnostic: MN2PR12MB3599:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QKH2awpLHjW6CTnI8yGNLZvcpIFK0LNjWAvyL396yI9DC1/mq79bi5TnIA57Chh48ur+Wd1DOO0IG2nqejOb+Uek2ZlHc43egsXmSNcCeyoNY8vmYJI0D1cUu0eNubp9HXViSebgxH422R923apK56Fln0oSUSgi289nLHoeVStkt1F/lcx6ysUNFLYguSnZF2g+uY9ZmvvTn9kD7vZoIOIwZtr4516xB6TDAjNEYOhM6O/6ztVfX0j4fRc1v6U+BO8EBQdNTAoUzwXyfJ831mf1qifiYW7khy5cgyl2obmVbtcHmHUF1VUoCeVof6R+RPdNumZ7oUFMKFodvyK2vKzJq3Ief/rXT6qht0SSzHItKyN/8o3KeFbvutM92O8ZFdbqOwXwU7EPDxY24OkfH4gO3hmaCsRhS7D4R45t7Z97H/7EO85wvr4YyuBtBzrZPd20EJJH0xINXT4nx4S2gxWn3BcXaiIqjX4Dj800I6YQ0YUVGX5tcDjRbc0CBPxJj7Pr7PTU5lKM8DhPDvaMJaTTR6Y9nb0cuxItZvP5w8yqSBb5EbVHF5UpqpyzMtcb60HwqTKpG2Sy97lKZwTvjpQgujItG1JxUIeK7uit3FV78eIeOQdRqqfB104YsYioLzt6w2MXh2hevkFfBIZN8ETirroFT/YjaJ6vc4VRD+QTMGHQlFNsL2pq6G28GP5iioU8UcKcVUTgk7iR/z+1GA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(5660300002)(426003)(336012)(186003)(83380400001)(16526019)(86362001)(26005)(8936002)(82310400004)(508600001)(7696005)(6666004)(1076003)(316002)(70586007)(8676002)(4326008)(70206006)(356005)(2616005)(110136005)(81166007)(54906003)(36756003)(2906002)(36860700001)(47076005)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2022 08:52:50.5147 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f36bbec-7de1-4c5b-4019-08d9eece37fb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3599 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: Arunpravin , matthew.auld@intel.com, tzimmermann@suse.de, alexander.deucher@amd.com, christian.koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Move shared vram inline functions and structs into a header file Signed-off-by: Arunpravin --- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 51 ++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h new file mode 100644 index 000000000000..59983464cce5 --- /dev/null +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: MIT + * Copyright 2021 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef __AMDGPU_VRAM_MGR_H__ +#define __AMDGPU_VRAM_MGR_H__ + +#include + +struct amdgpu_vram_mgr_node { + struct ttm_resource base; + struct list_head blocks; + unsigned long flags; +}; + +static inline u64 amdgpu_node_start(struct drm_buddy_block *block) +{ + return drm_buddy_block_offset(block); +} + +static inline u64 amdgpu_node_size(struct drm_buddy_block *block) +{ + return PAGE_SIZE << drm_buddy_block_order(block); +} + +static inline struct amdgpu_vram_mgr_node * +to_amdgpu_vram_mgr_node(struct ttm_resource *res) +{ + return container_of(res, struct amdgpu_vram_mgr_node, base); +} + +#endif