Message ID | 20210107175017.15893-4-nirmoy.das@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=OrwL=GK=lists.freedesktop.org=dri-devel-bounces@kernel.org> 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 3BCC8C433DB for <dri-devel@archiver.kernel.org>; Thu, 7 Jan 2021 17:50:58 +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 07210233FB for <dri-devel@archiver.kernel.org>; Thu, 7 Jan 2021 17:50:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07210233FB Authentication-Results: mail.kernel.org; dmarc=fail (p=none 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 EE6286E4BB; Thu, 7 Jan 2021 17:50:54 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2070.outbound.protection.outlook.com [40.107.93.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4BBC06E4C5 for <dri-devel@lists.freedesktop.org>; Thu, 7 Jan 2021 17:50:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I+YipzHL5ARfy68vGcgcId+cknt3XfwtLfY42afdqAfpla50tSW2UBZCXIwQmzd7BzpI0+xj82L68VaW8QsmrRWDpeIiOsMMgHFN3NLK3mnDd8efghgqEdJkFsxn70gll8EIek1OdbgXn/UyLoJQ50ROfTM05IRyGZUnzmFG/NLDEmp66MH1cliIPNPRxqCPSA5bzYpgK0rxhfXMT0N4uuKYVjJuutC7cIlmoGsoStAaroryb7z98ZV6X+tfOeLwntWo64YcrKHk33N03gi8n93befEdk5xAVGetEmrm6387qeFSQvqwIbpa5bqKF8Mj9WocEaBvrMylxI9xw6k7KA== 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=1f/85AnEGElOJ9U09MFwycRi+XzCeG5VJ58qVhGop10=; b=nP1EDWk8VjbE22TrsgCWaFwkPGWF1SG/TBiunTkyTZ2ndk9Pddj1zPdkFJQTNHxXoiA1U+WJiGrZuVrSFt140D0Mm3mi2PuLtE66o2+RbD5HtVJKod3QhwqbOXcwol+sdoHENO2EpxCvQ4un6TndA38/Hd6xysK9TEoTR1Snyvm7GxEoI/cX08Bq+RrQzivj5QmYPkxSRERwO6xptLYM7/hdSfMMTh7Nedc7VFe85Ju8f/+gXFWR6GHv9OJi628gH8hk3gCZzLFfiQqarAdpEl3/L+XtZHmBlvxPzRRPfc2Nr/vnXwg/zsz5gM6Qx0vKk/gYx8IuNI6cqFjezK1BUg== 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=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1f/85AnEGElOJ9U09MFwycRi+XzCeG5VJ58qVhGop10=; b=n9wczHft+d2Af7u3XJRrF7NHtzmPXZ9QqQD06BCGorOiKHUSPeVJA+ad7dHYvUOd8oOLrVz0Wvv6sTgY6dM8BEi2FDGa64mhMGj1E1/wc+9a8h+XQ2BS9x8S9hpwszXPqi3y5D60Hq8LGWE1nTc/hqsnSXG9SlktPAbHZuFults= Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB3916.namprd12.prod.outlook.com (2603:10b6:5:1ca::21) by DM6PR12MB3066.namprd12.prod.outlook.com (2603:10b6:5:11a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Thu, 7 Jan 2021 17:50:52 +0000 Received: from DM6PR12MB3916.namprd12.prod.outlook.com ([fe80::f872:3677:28c3:660b]) by DM6PR12MB3916.namprd12.prod.outlook.com ([fe80::f872:3677:28c3:660b%5]) with mapi id 15.20.3721.024; Thu, 7 Jan 2021 17:50:51 +0000 From: Nirmoy Das <nirmoy.das@amd.com> To: bhelgaas@google.com Subject: [PATCH 3/4] drm/amdgpu: Resize BAR0 to the maximum available size, even if it doesn't cover VRAM Date: Thu, 7 Jan 2021 18:50:16 +0100 Message-Id: <20210107175017.15893-4-nirmoy.das@amd.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107175017.15893-1-nirmoy.das@amd.com> References: <20210107175017.15893-1-nirmoy.das@amd.com> X-Originating-IP: [217.86.111.165] X-ClientProxiedBy: AM0PR03CA0093.eurprd03.prod.outlook.com (2603:10a6:208:69::34) To DM6PR12MB3916.namprd12.prod.outlook.com (2603:10b6:5:1ca::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from brihaspati.fritz.box (217.86.111.165) by AM0PR03CA0093.eurprd03.prod.outlook.com (2603:10a6:208:69::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 17:50:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: edd9db93-ea7f-48f5-006a-08d8b334c650 X-MS-TrafficTypeDiagnostic: DM6PR12MB3066: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <DM6PR12MB3066AA7DD69BEB69C642E18E8BAF0@DM6PR12MB3066.namprd12.prod.outlook.com> X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6qN7Tt43VL5Hu2uXoCtC1Pzb73+y4vOQgZSOExDawJ9fsEUsIcfFMpZsalHcqo5br5PFHOrAcpdGv5ZXQ2QuEBvpXNNIRGy+yvTiN9LtWkaTz/u7QHQRv7TFGRk5o5tIuiCgux8GXxR3nQrmUALhjs+g9aN1xucCMxsoFWNZu/BfsZz4nLCqjx2f0HIMkrHypB0DpRaDQ67zMnTRaF/Ofrf8eW1FUna/mtmS5YUoksAVVq0OSTyt3deRyZPP+B904ZUnbJv9tuhixptrwGN7SwLw45dmcEtyyPNXtULdiaIEvQE0ltQDe+F2wGHrfAD8rCyWuqpO56jhntm9DrI+sKJPf8yL21MFLUXCQVRhktvlgFZtEe/wojN2Ghxrkd2R8ilDECinvfL+Uos60OW7lA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3916.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(376002)(136003)(39860400002)(396003)(4326008)(6916009)(316002)(1076003)(66574015)(83380400001)(478600001)(6486002)(54906003)(36756003)(26005)(66476007)(66556008)(5660300002)(8936002)(66946007)(2616005)(16526019)(44832011)(2906002)(52116002)(6506007)(8676002)(86362001)(6666004)(956004)(6512007)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?hRZYttNSti+kpZ/gvORjjrR1OnfTqM?= =?utf-8?q?n4O8EJ3BNQwxp77D9LSUHT2R6s904e3Rj+Aj97FyJ/LBYXU3yJTeNkrT2j5RggZQF?= =?utf-8?q?qammWBo5fIzlgRC0oj0ANjeSXCiTqiI2ZjFbQptu63t8xK3/hXHMHByxJD7Be5ox/?= =?utf-8?q?VKOKKCm/WDGtzqWe0YbUDdGHnqtDNoJhMvydJg2cEvhC8rn5wD2GcY10gkIEn+cme?= =?utf-8?q?JJyVsE0cLKGR0ZsEPuG/Gz+cpddQUhlIhlxT/zAO0Z+BadsdZV86DZl63zFXUdDXT?= =?utf-8?q?xrJEYzc67Mnqs7J6T25nnHWaRD/ZjbdH4gcN8qhR5jbtzBBy+NQg4gop2LL4cGQav?= =?utf-8?q?wtKNpp9P0BeY6b6PUGoW3e7CxyxyacQHMewua7MNxmnbclnVFq2kfQUEns4Ts3pX8?= =?utf-8?q?g0KC+PIza5+RabbCLvgvSHRyPBD2snD525cpp0AZrI3h28Lz1nnmWrx8p8too4Gjy?= =?utf-8?q?QINoNT0eiiZ3cMxCPfBBYiEkQlwlXRvvqvucYRvmoc5TX5ZRoVD+uFz7jo/i9Cnp6?= =?utf-8?q?R6MYuzC4r+I2Al55AukFq6hM7z4LVRoyuCJOLWmgOYOLCqY3oUYjjkw+1n1HxplSC?= =?utf-8?q?0F160uadYkj+y1XyHV+P+Q4eobaAOrqx+BHOxngkZ+JRfIUuOBCzNlLu2KXirl+nC?= =?utf-8?q?RFydR6AZKEG6mCdDV3k6s6HxQRJ3UaQgvhkJT7qPDv/TB5cPPOHD+luLryZlKS52w?= =?utf-8?q?L1CK7lxQeubWip+MkSw2a/WiWwTg+1QbWZm8GwuN7ApK3AcN1v0m3hQHZ3fIIuIib?= =?utf-8?q?4R6942JUawkEhWenI4BG4yciaWaD2hg7aPjRhXjhWoCaJCEy4biDkwXime/FTi8+i?= =?utf-8?q?TDC7jZ8dalsectOxOyk5sJ8mZfj53O/Leh5FJOh+YeZ0Og0wiokCGHemhIZQIc0Wi?= =?utf-8?q?jA6xytK+At6nN7nSbsAC0aUE2xCSzRbEt2C5TbBcYN4cd2hTOvdXQzCxY2Ve6lV8j?= =?utf-8?q?vwapAZFhwLf3dtvBT2b?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3916.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2021 17:50:51.8968 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-Network-Message-Id: edd9db93-ea7f-48f5-006a-08d8b334c650 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bew4ubldRdVU+id4hHT2Au74SXWOgCtWFXOPm3SUVmGl6sMGIkmboWDIM43IWFqhFvm/yo210wQLUEkaS70c2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3066 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Cc: ckoenig.leichtzumerken@gmail.com, dri-devel@lists.freedesktop.org, Nirmoy Das <nirmoy.das@amd.com>, linux-pci@vger.kernel.org, devspam@moreofthesa.me.uk, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> |
Series |
A PCI quirk for resizable BAR 0 on Navi10
|
expand
|
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index dce0e66b2364..390f2cc13df7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1090,7 +1090,7 @@ void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb) int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev) { u64 space_needed = roundup_pow_of_two(adev->gmc.real_vram_size); - u32 rbar_size = order_base_2(((space_needed >> 20) | 1)) - 1; + int rbar_size = pci_rebar_bytes_to_size(adev->gmc.real_vram_size); struct pci_bus *root; struct resource *res; unsigned i; @@ -1121,6 +1121,10 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev) if (!res) return 0; + /* Limit the BAR size to what is available */ + rbar_size = min(fls(pci_rebar_get_possible_sizes(adev->pdev, 0)) - 1, + rbar_size); + /* Disable memory decoding while we change the BAR addresses and size */ pci_read_config_word(adev->pdev, PCI_COMMAND, &cmd); pci_write_config_word(adev->pdev, PCI_COMMAND,