From patchwork Tue Jun 29 11:44:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Das, Nirmoy" X-Patchwork-Id: 12349733 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 1768CC11F66 for ; Tue, 29 Jun 2021 11:44:36 +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 CF41561CED for ; Tue, 29 Jun 2021 11:44:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF41561CED 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 5F89C6E875; Tue, 29 Jun 2021 11:44:35 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2087.outbound.protection.outlook.com [40.107.92.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id D1A106E875; Tue, 29 Jun 2021 11:44:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fqgGSxGhrIijat1460dh8KAUtPDn/uSf4O/syIP1jQF7iZingjkBjyVuIzfvAJQPU48kG90OJYprL2Ona1/nKEu7IH9WDweV3y9GR1wNDiF69y1fT5jX5qLmdr2SAhTjD0E4wOnFZGkn8KFw36fodaYz9CS4B1bQx0y6PwkO33nG/B0X3y4w9eedB6idov+nIT5Qrw9UnmmYfiKZAvx8VAx07WEP+lrPmfP81OBKhjX8vzN7cEIv8SgD86IE+M79nCH+YklUGeztkoFCArPEaqPrWsPyJHjzNJEs8GJQdz4Lgvsk5joFN2+AL/X/O/eTtHv5UFyOGdZjCk2qDAu3Dw== 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=MxeB7yNopjKbuUaO/NOfqBYFLLOOZyWt3Yj0YZOR/iw=; b=aTaIwFYf1IlU4/Nr3kbfDJlfabjzeZbcMwVxyiEn5QMBI8ppTlSVIYmG/68LUJNYtlbZpeaM6jvc+FjGgVTJXJB1NPXzN5D9f89IR3srsfYFJr4YFgaiA0tndVyKrWFbLUZYf3O/Mw4vdTiWYes71l9QB8+V0cowRP+BTkhBwuJAYYnsR8jSGHAaPjtfixLh7h8WfQFF++mFs0KX0ok7rQDTx9EJznGf0Wvg1Bxi0T/b3iZs3ytSqhcavEE08CQ8wG3fzR/+WqSxLijYd+0n38tG7uNT1LjanaRn6RgY+ug9p1afSfkf73hI+eSKyjw3lM1EwLgaWgfjAtkn9ugLOQ== 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=MxeB7yNopjKbuUaO/NOfqBYFLLOOZyWt3Yj0YZOR/iw=; b=mKN+lRbmxdU6DiwhAdHAPw+vO1ydExi5aghqAbYP7NMsobVsgVSjd4rnKNOvHqQb5BBgO8L3dp2h/7YQnNFi4iXy70VfBud9rZUwAPto2jQ+T4g/GrPCjQeUjz5F2IbpuYgpZg+YjCs73xVsOUKPU6jiUOF7egXXNw6Ng8gNCW0= 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 DM4PR12MB5072.namprd12.prod.outlook.com (2603:10b6:5:38b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22; Tue, 29 Jun 2021 11:44:32 +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 11:44:32 +0000 From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 1/1] drm/amdgpu: return early for non-TTM_PL_TT type BOs Date: Tue, 29 Jun 2021 13:44:13 +0200 Message-Id: <20210629114413.3371-1-nirmoy.das@amd.com> X-Mailer: git-send-email 2.32.0 X-Originating-IP: [217.86.118.245] X-ClientProxiedBy: PR2PR09CA0012.eurprd09.prod.outlook.com (2603:10a6:101:16::24) 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 PR2PR09CA0012.eurprd09.prod.outlook.com (2603:10a6:101:16::24) 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 11:44:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 039dc96f-fa2a-4828-74c5-08d93af34284 X-MS-TrafficTypeDiagnostic: DM4PR12MB5072: 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: XAeNp9JLtoOHDHjfEtrm02WC/bJS/1ukfyBHuMj7FN54yFTo1BGSBx0AgZ1BdGVsmo70HgSkpLfw/OMA458a+etmORIhGbzEG1I+0N1pF97neFB7/lNkEXjpe3OCzD1lPJ8gAoHC7usdg8oKfcBwwKMHKUVUHKuz7vT7q8Htjht9XO+Gp9WpmTKJzzCP69gG3VtE1EFCqcaUkcWrgBBzG/Oixoa9OVACFKfnnw8eDpR5zFnHuIAp0r/jwvHBFdzHto82YRWhmxWyfv3iaV1l0akp5bmieDYeLSpLfHDyltst2SctVPfbY64Ukajw7UHMpeP4AbsuobK4531k7m914dBfhDPyRw/yKZb82iw6jnK4FldJn+4EAZr7XSWlz7QNyz16CxeXke85KoZEIjPFxqRU/J37KD37yCAX1ATHVDd7eUita7FFmmnlMv9WarNfty6GdPoNwxO/djWXUhUGHg6fHvQTHkyVK9IfhhtV0dXK/UrqKgk50/rXgXChym6wp+vW1MtGmqbFlJboXBNTPtmo9hAT2v2cxemzdQf1OnEjoWmxxMga1VvlOwGJIPcJhiuWLJZBkN5zXffa+W+7HmG+qe+c+Rv/EM9OKSBGEc7uG641tqBzB3KGVW1KW22WYLE/0oFAZJOL0WYEM4xRBRYNgWldb5y665YeVryJCdGA3EhydkOSruzCkkyW3YrBb+UVkCUUtx6/V58vceaP2w== 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)(136003)(366004)(396003)(376002)(346002)(39860400002)(6916009)(186003)(38350700002)(38100700002)(1076003)(16526019)(2616005)(86362001)(6666004)(478600001)(26005)(6512007)(5660300002)(956004)(6486002)(6506007)(4326008)(8676002)(316002)(2906002)(4744005)(44832011)(66574015)(450100002)(66476007)(66946007)(36756003)(52116002)(83380400001)(66556008)(54906003)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?6eyvFd2q/1TIpL2Eu9K091k25aiS?= =?utf-8?q?DT3MbY1xOQTOtj8zpeHRVNsjqIiPC9GTajm/HADcEW1QaAvyE74t/8yZNwGaiz7TP?= =?utf-8?q?tb8Mg/RNFGqNXMdCqOTy8G2wIEIZu5SekgUWlZfPuIvy0oiHQkuvXddielcPgeJId?= =?utf-8?q?7Cfl5Aiet5sRtKbcLkj2z+8mM35A769Y0FPpSPpvvlZZaw5UWMp6HlvBMjInkjAU8?= =?utf-8?q?5rQgCPQEMEZE2f+4F+s4/TbroaEXO6aZzmWkMkNT1gV7b2GJiA0y2+pp+mJ+BZkRC?= =?utf-8?q?aWAxYO+URRw3jXghCft03dYGIkn2Mtkk7tPu5wFb5CQIsuYYF7xe9R1dUgSHdnP/K?= =?utf-8?q?E4Glx2ktm+NdVd6MWyCmkGg1raGeHsrG0mALRAwD9OEvgpHNa9QNeDsH3jR9TaEB2?= =?utf-8?q?ENcEKeTyYSzUnk1A2OSWIpO2AkHqxASOZbq/2jtulfINIVDtQ5GKCTkO42g4SCjWm?= =?utf-8?q?tLiLmNVJ1ylG94Z+zJWjuWkUs0pN6euIHY76fKO9/tHFpqLOBnFH06ogTY3B1HpDF?= =?utf-8?q?UqxEUnnaWlJF/n6q2qq/nzy5UbEOEtG3PZakzqWTzwXRwU9+S9NtSSxzuy/hdN+uc?= =?utf-8?q?TV7kGhxmNqsdEiKSpqEYnXEUGGTy5liC3abOEtTrFMefH20/3kUZ6qE/KC09JMmNQ?= =?utf-8?q?bw9Xm3e9NXsNp7QpygEQ+kPm04WjctHwCNMFu8aJ0d6iX21Ei+ZJNoaD3esJfKEvi?= =?utf-8?q?b6SkR4fRp3BWPIDkbZoq/gaAonPP1K+6E+V2TMBMvxAXeYt/jXXXl2tadWuylt6vc?= =?utf-8?q?tMKQbWx/YTkB6sqE2drEdkF5aS2pWrsCdQHWCPdkm+2bitxYPij9ek/PqTa0im0bm?= =?utf-8?q?9uixbJkLf/AAFNIrlLyi4RC5+msv2K5n5n7ufZ6MfT2j18pykMTgRbmgS/DWu21Ml?= =?utf-8?q?fBPEj+06ZQgCG0amojZLmuNXYaMr2XhoHqcLzJIDzTx2F2nGuGkQyywWcYQVJoES+?= =?utf-8?q?CNq7HrLWlaVIi1VxF5kbB2CT9ssyQoW6cY+KF8mXUp8RBytTmXxMiVhBscgnl53T1?= =?utf-8?q?1NeTUK7yZcM4q0C93/jgs8b6BJ5X2Q3bKfqbHCpOnmj3XoHlcz5Jum09DH2FTsjLh?= =?utf-8?q?oY8uR14LukX0Ur2oct9smL35pgoDyzFLjxuxqSk0TMpbvayxo9+p2eIYBrjtwbwO6?= =?utf-8?q?IAq8wchOUdsJ3X3Xg9jFUrqZpep1SQ9MwF4QkFahJTvVlajEMJbNDmbwf0svSJzIM?= =?utf-8?q?GhyDalstub0Szoas61jic51Eni+VULjhGc6TLwZC5h5TSP0h/ID7SZobYTQ2fpFBf?= =?utf-8?q?7ub7hEMak7+KYYB6?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 039dc96f-fa2a-4828-74c5-08d93af34284 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5136.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2021 11:44:31.9018 (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: 8Kzc7TyIX0zWKSzG1bVNSoA3X7kPJSTkU1QPeAATIk1XghkxvDibpYhGv80ts6OwAogiOAyDm+yQ/CV5HqyZ1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5072 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 , =?utf-8?q?Chris?= =?utf-8?q?tian_K=C3=B6nig?= , 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. v3: remove extra braces. v2: merge if-conditions. Signed-off-by: Nirmoy Das Reviewed-by: Christian König --- 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..7a82e7b9e18e 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; }