From patchwork Tue Jun 29 07:36:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Das, Nirmoy" X-Patchwork-Id: 12349435 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=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 4E0AFC11F67 for ; Tue, 29 Jun 2021 07: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 1CA8561DBC for ; Tue, 29 Jun 2021 07:36:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CA8561DBC 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 5B4386E825; Tue, 29 Jun 2021 07:36:52 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2081.outbound.protection.outlook.com [40.107.220.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 88E726E821; Tue, 29 Jun 2021 07:36:50 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X2ZwhowxOuBVW/yRVjQ0EVOrsHvrYNUcPYUcyGt6XfiuGtJ4r4Q6/Hz0WlNsyqfnYdhOuqHFPACvrIKT1/bJzRKcIfZCfCDm3zQD99WFc/1ZZT0soV0e17Zt5Mq/6BWhUPJcBU39CsP0re1kajgmJlEK2vWhldYvc6ZKc8GB5pJ16ce5CA2D7DwvLsp6TVzCOzG/UoEoXxWbARDrZlOQVgYzUuez4d854B865Xqi8zQ15/pGt55tku378pm+ec5vibFne9CCaMrToSjdcjpfUmxxkmUZiEKEZaQO9FXb4mcE6YNr2s8NRDoU20rqxMm5FR0/yTHLoRhHKAv+j5npIw== 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=JFO2+pA68h6YQxh8eWjTLCU5H753JJKrjuFE0xrohog=; b=MXGe6jTTZuI/O2Dr8GoNScIF7fW/SdjTJysoKJNW8Tri/WGLOMjSQFDfkgLFN/RqXNFwH5nbcP8hX9GACPNQXzoD+ku5+xxRO0CSY5mBuQrqxB5FRQqWXM99yNbO/5i8FCnBEK+auSamZIzT0NkeWyFQavjTg1riYYqRkJs3TX1o5bCMiSngIi2SPpSsOSjaqN7OQ3rnUDZcoPWE5ni93IfEBEICOktlmhhUFZwnEHNBtF894tqYGHoIwHzBrA476mKxKdT1EgVF40LybEJ3HbwA6NqKl7U3Dj7wm1KpR1iRgaQL0uD4pW88VEn6dWg+GrccCZuMJdAfwVysJ3t+PQ== 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=JFO2+pA68h6YQxh8eWjTLCU5H753JJKrjuFE0xrohog=; b=q7oRjTCppsrDBRO1sjx4JJQ89DEisjDFkydogLo0BvnqAZ2dF9nth3abxSYGI7GrGMFj6EqwnKy/Vu+Wc0IMUsyMjHhWRiw4/Ye2CgNur+JIKi1DDQg1SEv+ICnTrUFoECStvpKdvd8W3UXY1GcV/jKC9/NV/cTkfARxX1jiU3o= 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 DM4PR12MB5136.namprd12.prod.outlook.com (2603:10b6:5:393::23) by DM4PR12MB5341.namprd12.prod.outlook.com (2603:10b6:5:39e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19; Tue, 29 Jun 2021 07:36:47 +0000 Received: from DM4PR12MB5136.namprd12.prod.outlook.com ([fe80::901b:72bb:a15:2a68]) by DM4PR12MB5136.namprd12.prod.outlook.com ([fe80::901b:72bb:a15:2a68%4]) with mapi id 15.20.4264.026; Tue, 29 Jun 2021 07:36:47 +0000 From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/2] drm/amdgpu: return early for non-TTM_PL_TT type BOs Date: Tue, 29 Jun 2021 09:36:28 +0200 Message-Id: <20210629073629.3069-1-nirmoy.das@amd.com> X-Mailer: git-send-email 2.32.0 X-Originating-IP: [217.86.118.245] X-ClientProxiedBy: PR3P189CA0009.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:52::14) To DM4PR12MB5136.namprd12.prod.outlook.com (2603:10b6:5:393::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from brihaspati.fritz.box (217.86.118.245) by PR3P189CA0009.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:52::14) 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, 29 Jun 2021 07:36:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53501ed9-ebd8-48d5-2011-08d93ad0a682 X-MS-TrafficTypeDiagnostic: DM4PR12MB5341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aMJ0OstsorthpqyU+kzGpYfgwK+YnnschC4U3T7p7zX+5gRCAynf/F1OJ88GCLEuy9Lt54iZDrIHD14RX7dkIjms4x1SJ3nLQBgklaoBmk9nkjRv5moiDVUom4RK/qCGT9Be5TaHTXeyUQF7075MsRtvb6X3elyuE8lDBOMjtL1bnI66sML7TaqNoXqI2rYyxR2vBkwux66q6Nc2chKJeNBZyJVyJ/Ne0gMgBu3xjp0xa+ZSRyPGHcBK7r3LVjve7cFiDGYZ5PWmhv2TFdowcent9XXAjji6sIMoXIy4KEosEEgxmkQzU0Q/hULqbqVdA3wYTTb7+8N4J/a8Zf3T0jsIpg0vfCrKtRh7ny+CUALie5YbCypeJuzGvQLIMW5dsFRsQzB0qwuNN7d2U0SjyEBNFzP423wpbSOpWW+Nrap0Ic+R3K1S3PxP3mW2v/btnZxk4Hg7+GoxC8auiK+BlNEJuMTt2C4UGfvWuyoyNsFER0Fy3VwUl3NA59v+QHRI2t2gpZ0dHwD8qlIvy2BL2qUz3ZVph17yPjSIifMNo6vqsMUxN2u6eQ+v2z2TnkK3oCF+3nlksRmF4croiWOMH5JMiAHVOJ+JHzV5m7xaHKEGNrfaD5iLeRe1LUljAfByLb2kXg+6iUB57/0DdVzhkER4NnpLUDUWqHDonG1YA1/YnJWjf8AO2355wxqMIDnSkje8nJR8FvAOd20ditEYiQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5136.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(136003)(396003)(346002)(366004)(4744005)(2906002)(83380400001)(1076003)(450100002)(4326008)(66556008)(8676002)(66476007)(8936002)(6666004)(66946007)(6916009)(44832011)(6486002)(5660300002)(86362001)(6512007)(186003)(16526019)(38100700002)(38350700002)(478600001)(26005)(36756003)(316002)(52116002)(6506007)(2616005)(956004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nE996EBS5Gd8mAt8/3wYm2WX0A71vazD1mkbnyxqvoOfBtl9G6dtWifCK3Wsx4IUwU3CaYnucMxnwovWy1gEEr2b0hdNsesO1+9mrt3qSHJ5yGWJ594SHBpWZoHtVDwYEXCjQvpBSgrAlxg96yDYBNG9MdnvAe4iUygSVj2wufLvtbHX3TKMCSU9d9ZLK9ked4+If95YeeYeX6vzz4aJD4mCPznl747ft0SZTNe+ttcBforGLASWviNn07Q33SBWPYypZasBRc0Cg9sXa1aQOFqAgzuXaQ+RBB8ucoR+g1NWfjYP6Gx513H5PuSCquPS00nAnEKSOvRf4dd4WpGegRsGtowYfDdGwIWviPIB2r0I/TafTuVV9Nn0RkvzOyg038qVWLlcxf0WfQQXXHPDJXg53VyGfal5EeIIY0uEyGaSc69FqSB7mpNPwfiHAjxwA6hC+6mMrPfsbAiFfblvXH+ORynj8VikqGro09vPVZw0nCjo6uOAbbUcG82j0D9PE8vqfOqLWfH0zDUzWFeOOgmT6bnEXUqWUlr5+qWRtrVmT/mBy3pFMhbteXEQ2fDj5PSzAYZvfF3YuykI1GJf8b33d1+y7X2WG9xQiJUndwAkdUdQjSYAbezrBe993+WE1DzNWaKz1xOf6oQArzw9S9JXnGe2dwbmfAcR759a5SRB5F5bP784iwA7BWhssCj2zoY5JGRq+QXTeLJwutSXFTIAI7PhAWP9LpPBZnBxkqHyFTJYycVCx09y4VVIrDqedGHGbpj4bmM78dyZvPde+ezOmdGscGP29jfVlVBvNBg+U0wk577BUzO338Bri7/XMBgmbZmDMn2TZ7HOOQ6SpYFmGcd0+4vDXte/BTG5nJRuRVc9KDgVUyB/Dl6Y+N2Hgq6SRRVgRQhsXUzVrKIw+t5L0KWhCOwgojBTuyeg/7UjD4hLxdSrnVArGuJk8aOoP+Zhm/pgSJZqzEY0sMPnZifB4ASqAPanegcGofIQBhH128OijEizKZAQtBVxh1x6u0K0PuzUMcAj5v2dcNJRy8B4k4ULPCbQrUNgHmIgxNFNXCtHI/QvoRGqtZkFY0CHobZ/4JBFhYL/S/guC2upgHq2ycTgD3oklqjw6484zu0T2jkt0G8q/2XRzOFODAcjiuvJcAns95/kXQiVzQGYsOHKo1Vy/fUoHYE8kVGEO1fbYEdNjNJBmdgwtPHh5/YR5WCoJMw4iEBDyEwp8igadXYCfS7LhEpLRqWF/UyITKPn5LsepLApQqnhptSSwI+KxjBJc1YrpAfKVhsNe8yDN338gSo0izYyyDIZfEscE3ck550PUOm12cuIAM2LYIJr X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53501ed9-ebd8-48d5-2011-08d93ad0a682 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5136.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2021 07:36:47.4055 (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: KEVIL4ky6iPQWvdRThpIS2AAr3BhFNq+vro6t7BvvWg+gJG5uZcLZo3ibRaONpgQQh4KDE7Gziy8YqrVGlN5Ng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5341 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: Felix.Kuehling@amd.com, Nirmoy Das , Christian.Koenig@amd.com, amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Return early for non-TTM_PL_TT BOs so that we don't pass wrong pointer to amdgpu_gtt_mgr_has_gart_addr() which assumes ttm_resource argument to be TTM_PL_TT type BO's. v2: merge if-conditions Signed-off-by: Nirmoy Das --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.32.0 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index b46726e47bce..208bc3ec1aff 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -926,7 +926,8 @@ static int amdgpu_ttm_backend_bind(struct ttm_device *bdev, bo_mem->mem_type == AMDGPU_PL_OA) return -EINVAL; - if (!amdgpu_gtt_mgr_has_gart_addr(bo_mem)) { + if ((bo_mem->mem_type != TTM_PL_TT) || + !amdgpu_gtt_mgr_has_gart_addr(bo_mem)) { gtt->offset = AMDGPU_BO_INVALID_OFFSET; return 0; } From patchwork Tue Jun 29 07:36:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Das, Nirmoy" X-Patchwork-Id: 12349433 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=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 1D55DC11F68 for ; Tue, 29 Jun 2021 07:36:53 +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 E419861DBC for ; Tue, 29 Jun 2021 07:36:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E419861DBC 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 056A76E821; Tue, 29 Jun 2021 07:36:52 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2081.outbound.protection.outlook.com [40.107.220.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id C00126E823; Tue, 29 Jun 2021 07:36:50 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ALc1JcusZklCA/FfukBVaMx8Gny7K2MJs9C+VH0zQPW4dyRLswZAdITDIs7cOtU6vmVS7bkNOELvt5ZOqfDszGNMnBGFg+MiRBWSHY+4XLK8Q2hm1XFfmpgnPhTGDPCmA1nSPUV6Gg2+HdoxMQIjW+Sto294XsFd8XlptuBLYa6MKRhENU6bLPryxST81iFsRxKYVKs1FMQ9sawcW/fw7p+mL34SPnNuu9yF1f7AE5isLGZ2gEJtgOhCBDK/oiq1vUGdP64Pfl3LWh1TEuOX9WWYVX3MC0ZRdpHIHEsZEqGwj3N0ZZz8ODl+B0UuwcqOK4hgT873thUgPu8vBNGBdA== 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=HnBiqDIGazLas9alx1hBxUyeyXlZxxobdElOUAsv5/o=; b=gsGMHsEdIqPUonfOqhC6dE9zBOkUuS66gznJSaeJQtwQelut1mmhTkhN2ygdzaww0JTZ+NE9HIS9MNhFc9Cv55tgbOgSb0SeWqEJikPK8WYwwwG0ARfYDPoVJvcWWw2+UGMmuob1Jx/dbcdg+2Yx9q+H/poFJcP/UsJVaenDaeZwDX1CAoj5tG4vPjvNUio+qiZmDGDVfvaA5BsF5N6iAq0eT3p0GKlppSnmAAa9fJ3RtI8Dl/OqyCUdTOylehwGoh6fgn88EaOBjpdCHJ18D7JnVxktSHu3Aqgz3X7EaZ07gmSgXvKLhfTmgybjXl66cGFScJlZTSoxObfGQWfViQ== 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=HnBiqDIGazLas9alx1hBxUyeyXlZxxobdElOUAsv5/o=; b=Jkm7WNYQxKNphGCiaQReiZphihI/Rzy1B8u3N23ILqWRLBGqBGYlSlOTx+US0ODt6GFNTEIBrZIuNhwqKrcJW6Smi3uHF55ZnQ5/Hm92tgyQZIsiHOGHB5tgUswMIK+xL25T148HynUyOrFyAWANh7wxRj2BMB5C2FjN9O6fKZc= 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 DM4PR12MB5136.namprd12.prod.outlook.com (2603:10b6:5:393::23) by DM4PR12MB5341.namprd12.prod.outlook.com (2603:10b6:5:39e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19; Tue, 29 Jun 2021 07:36:49 +0000 Received: from DM4PR12MB5136.namprd12.prod.outlook.com ([fe80::901b:72bb:a15:2a68]) by DM4PR12MB5136.namprd12.prod.outlook.com ([fe80::901b:72bb:a15:2a68%4]) with mapi id 15.20.4264.026; Tue, 29 Jun 2021 07:36:48 +0000 From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type Date: Tue, 29 Jun 2021 09:36:29 +0200 Message-Id: <20210629073629.3069-2-nirmoy.das@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210629073629.3069-1-nirmoy.das@amd.com> References: <20210629073629.3069-1-nirmoy.das@amd.com> X-Originating-IP: [217.86.118.245] X-ClientProxiedBy: PR3P189CA0009.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:52::14) To DM4PR12MB5136.namprd12.prod.outlook.com (2603:10b6:5:393::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from brihaspati.fritz.box (217.86.118.245) by PR3P189CA0009.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:52::14) 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, 29 Jun 2021 07:36:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bfca8f3d-7670-469d-193e-08d93ad0a765 X-MS-TrafficTypeDiagnostic: DM4PR12MB5341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MJ7R6X0vEJ1SZRQKVSoiAVUY98ln9vwt8kkwzJpSqSAQnJRkLVBJDHGtJUjLqtSgMtFUb6DwTOHCVuz3Vzj5XARaxvumr5ihG9kBTyd3M1WwwLYnSq7bvEBb0ULQcrxz14nxnRXJqBwkIdBmPEY1h5vWsL2qZzoEGDfLN0WhvpilAmgfYw6cgJWikEr6sdY9QG1//Mc7ByGrd0Xe7L4Lzh1y0rg7jUpK7U0AXtDgVS43PW302WbgLOHD5CWpN7DOY4sG68KAQSnSFEy/0NbqLPDHYYia4GcvbA7PPCigyEhAiWmbI8P9SzVQBDIPQPnucbYRv6cNRZDGWidOepowPJRdqPQcPjG4f0Tfyw2TA9/54mx5YIfSnLRYzNeMlhBMe+knA5lbJIW3x994ew5/UfcouZssYyE5ftLS9i2ZRy7iKi1OLAuqLHL/QkP2Nl7CCel168VtCBEpUW0bNOa047UkRY1sxMYJx6cyQUs29tlMkz7fbLxx9PMp7dXXoVyIWm/v1BlkF+qNwSZ/QcCWIraLTkmFGTr3dMmEvF1pNHIlloZhu4pE4IluC1uJqvG6OH5mNuiuzX6ykWPuRrfmp899Cc1nLYjybWIufOGon3owUhjOn6MvRm5D8N1AqbrMa5Ga3trM4L3L0AjO8taHVJLmJOSA4EsxrRIwPi+wu0V8buCSODMXqUCwKRjLikIvlX8b+UOWdaIqWJvSj59SOw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5136.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(136003)(396003)(346002)(366004)(4744005)(2906002)(83380400001)(1076003)(450100002)(4326008)(66556008)(8676002)(66476007)(8936002)(6666004)(66946007)(6916009)(44832011)(6486002)(5660300002)(86362001)(6512007)(186003)(16526019)(38100700002)(38350700002)(478600001)(26005)(36756003)(316002)(52116002)(6506007)(2616005)(956004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c4lobB9pV4l6PayJRV4gdGEwRdnDrS18FVcH+ukLcVfNDDxLn9T5is8Zge3Ck6fsEnWz7bTd7UQkZwmWRW2ep/KVejDtFYrjcI8Xb8t4jtKUvjlRM1XyhAQ+IUY803zHMmwjKvG4D3lLFjGsw5rHyVITbtUA/84O9hSlcyGtWlceT/INjo4ACh8QwREKZqARbdiCWyfv6HwHHg3o1SuMMolPLpTenKTFwJWOnVfQboSaqb3AYDweWuT4umJefK9AfPZiRPd+tc2iETiY+uerRi6gOZ0H3s8PsdJDS5wOXINpO6h5WiEVvf16NFn8YmNPNC7Sxn1L5Jbo/Pii/Gr3Gdmoda4mHpbbNdt1e7T9mntWa61Q6y6YbIQZ6iYogHqwnXkua8f6pxevL2iTUjGz0rEjUNtXvHzczUdIEEVHMRwpDtekJQEmsDzWTbNYA23BMK0LwLGDMbDOBMcxLftMaZXcT7ZRQsK5zkAqdTB4Wh0a+O194pdXKZ+2fukT6L3NmuLVd4yl37In3N8i1T+TlAMiRSMmKR4IYhuPGDNKiqm+SWmf1QD/alZxyGu/y8wQAcjnVRbU8hNN2IYhHurxMGuhFTFLmwuPUAXlvO+qTbKuDqxK2OpmIOjpTrh+ih0kcgdLQ49A7m+zTpn/qmS8kqK/8V5aNojPIl+Mmr69qMTWZTf1UZ5Gv3ZgccYwmr6OWecgxUlqKvoRGbtNjP2OUHVdu7a2nDUKtK26yU3JHJpipfABqK/fZnvb6rWVu3okWf8hvGljavzI/eBGGVeKairWLID/V7GikfTLAjShGHAaS8auuechJUWyiG/0zyyBZLMSNwzNrBL3EeVjFW56eihY5BF0LqeMwaQ7v0jpZM5WIBWDK0wo9y4vFvJJ9QprQ7+eP3LfmXeXINBBZw0vz2U3F1fZs//G/FxO+GwI4XCCHi0hf7bsZevVcV9jg3B6jEgAVcSE63+3f9xIiwsOHoGM4FW+GVyyjdEH/tsJe3sk8ySPf8dTPSmn/Nsgpyc41ujenz7MX7RPgNemrHFlBUgm/KDaB7SM1zgXPxe27vD4hfRlhtv+WIrGfO+nWXupFTY/crSnsktWIbd8cyxeRLhyXApvXjrxnmWWFbqmoL7XQhVJv1eR4jxWAli4IzUwb4SYmdhfeisKJ2jAZMkpyvxqJrowJwMJR7xT5lM5YNeNO/+4z7WH2QbiTbmn+WEDDNZ14BePiitp1hLpMlugdHFaH23hjqCwYfdUQzlpQ2oh6GFjAoy3pqtD6JBdGKRkIDoe3cvo3pLnITQQW5xqeFGAjJLi56Q4X6FDb2MS+u1GSPsfS0NolmAe7NKIb8Jg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: bfca8f3d-7670-469d-193e-08d93ad0a765 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5136.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2021 07:36:48.8602 (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: tM72+phMTxCLQLn6xQGtqyYj6+LNuGIzzmrQTKxTynCnJvZFHHYrf212ZWou5dACraylNLCMXgypStHRk13ZBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5341 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: Felix.Kuehling@amd.com, Nirmoy Das , Christian.Koenig@amd.com, amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Be more defensive and raise error on wrong mem_type argument in amdgpu_gtt_mgr_has_gart_addr(). Signed-off-by: Nirmoy Das --- drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c index 543000304a1c..0b0fa87b115c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c @@ -107,8 +107,12 @@ const struct attribute_group amdgpu_gtt_mgr_attr_group = { */ bool amdgpu_gtt_mgr_has_gart_addr(struct ttm_resource *res) { - struct amdgpu_gtt_node *node = to_amdgpu_gtt_node(res); + struct amdgpu_gtt_node *node; + + if (WARN_ON(res->mem_type != TTM_PL_TT)) + return false; + node = to_amdgpu_gtt_node(res); return drm_mm_node_allocated(&node->base.mm_nodes[0]); }