From patchwork Thu Jan 4 22:17:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Kuehling X-Patchwork-Id: 10145681 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 57D74605BD for ; Thu, 4 Jan 2018 22:18:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F80A2885F for ; Thu, 4 Jan 2018 22:18:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 940B92886F; Thu, 4 Jan 2018 22:18:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 204C22885F for ; Thu, 4 Jan 2018 22:18:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752552AbeADWR7 (ORCPT ); Thu, 4 Jan 2018 17:17:59 -0500 Received: from mail-by2nam03on0078.outbound.protection.outlook.com ([104.47.42.78]:32395 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753262AbeADWR6 (ORCPT ); Thu, 4 Jan 2018 17:17:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gb6xJj6RfommYsgxQNPRWldTW+YEJx0l7iQb+7a3Ivg=; b=5YSsW71CYmtTC+nScdfegAEm3jG98NuSXSM6oosynucDlF/am8Dfa7j7T9xI1madTETzZARNzy7JPWZ4cLHMbWWyES+ktowTh+EKD6c20h5j/0wGuTScTkOCNkCOeir085c5KzOvcPXJrfjVteOSK0KnGlv+eNNzUs/sYGjr1Kk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Felix.Kuehling@amd.com; Received: from Harpoon.amd.com (165.204.55.251) by CY4PR1201MB0230.namprd12.prod.outlook.com (10.172.79.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Thu, 4 Jan 2018 22:17:55 +0000 From: Felix Kuehling To: amd-gfx@lists.freedesktop.org, oded.gabbay@gmail.com Cc: Felix Kuehling , linux-pci@vger.kernel.org Subject: [PATCH 2/9] drm/amdkfd: Conditionally enable PCIe atomics Date: Thu, 4 Jan 2018 17:17:41 -0500 Message-Id: <1515104268-25087-3-git-send-email-Felix.Kuehling@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515104268-25087-1-git-send-email-Felix.Kuehling@amd.com> References: <1515104268-25087-1-git-send-email-Felix.Kuehling@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: DM5PR06CA0094.namprd06.prod.outlook.com (10.174.189.35) To CY4PR1201MB0230.namprd12.prod.outlook.com (10.172.79.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e1abc320-8f65-42cc-cb6e-08d553c1017b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:CY4PR1201MB0230; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0230; 3:MSPG9sBWrVNHuFfB/J+pE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FszOt/Jw1WEpWUZ0LLeU2dvOVW5xDraYSHKiEz9zlKYcKbl9xzRUsLyYAsjR2XTcENRA+2WO7GW6Z7UanfjzZG+jH9mk0xVQ7fmFvw6j/Jh0P7DdNMD2d9wPBcyNIn10jbGYb4ipLxHDUrlsOhcPQ4FnUIO6WX7VLZNwRNBTFw7svqo8CHeE44k/JPXicM/odn4j39wEH8vp4Sk4m2VLuswtlVPTgkOlSwcPPBQRHrTDxYNSmhLVmFKsPUgbzt6bjmUakTfdQkbykkgMPqhmXVXIXRWoSIIz2Sllo+ehO5e0zPxu+hk/wEEVSODlmusUfV; 4:iMhZGdqmAAkotdS0XLt4xY5R2C2tc8p7zcFoGnL2Rha0WdJZ9PWSqWBVQXFHjih3SrUPtQhZQ712WI939lacNe1xFkZIUmRM0QD1nrl3jA6ZVJPP+Oh2BUQThqhv3QklaHgAETihiykg+vrMAbTcWx6H+/6P3UPO4h3im1vFDD+x2oTZl2H/q2VP5laAtnOz85q20bnK5bSjI+d+B6qHnRxzKXZE7dv4F9qWuN4KgJIWo45pjqPn476OxkRSZ3E4idGro/YaCrkOysrgZhk9OQGiPqtRL0ksLznucRu/HwZBxNoBGXpsa3i39gla7wHKrThDVHFlNEjEoWEqeMz3Kw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231023)(944501075)(10201501046)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:CY4PR1201MB0230; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR1201MB0230; X-Forefront-PRVS: 054231DC40 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39860400002)(39380400002)(366004)(396003)(189003)(199004)(66066001)(36756003)(47776003)(68736007)(478600001)(6116002)(8936002)(3846002)(81166006)(4326008)(53416004)(50226002)(72206003)(39060400002)(25786009)(386003)(16526018)(5660300001)(316002)(8676002)(81156014)(305945005)(7736002)(7696005)(52116002)(6666003)(76176011)(51416003)(2906002)(97736004)(2950100002)(106356001)(105586002)(86362001)(16586007)(6486002)(48376002)(53936002)(50466002)(357404004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB0230; H:Harpoon.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:3; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR1201MB0230; 23:6a31J/gPWRhelFq3D97jJOUF7d/cNghc7xNR6DJ?= =?us-ascii?Q?3WoQjC2vUR8sntROM2UT1kQBXSfnyjQ79KjpuJlnBXHduRMefJ2hjbisp5B1?= =?us-ascii?Q?EuX5EojSDXU2aztAh+gNgAHw5AQES4fw5yJM8618DwQ+ZmF5jj9Yg63tMfI5?= =?us-ascii?Q?afWZlt1MufXojSjswaew3qOXx0BstTtgimqPUeCS+s7CrFMOBLTpJs1AY/pG?= =?us-ascii?Q?l1+plDSRLcK9BV60AlBZF5UUlaF/CxNtaGmU5GM/TkgAkdwcN5gFFPkmDa83?= =?us-ascii?Q?97Ef8mRTTsi8zXezZeUU9NoRehnutIHyQFLracMs6soaycEKC7bO7L5r1tg0?= =?us-ascii?Q?bPbPZiD/SZIBF70JBBOF3sfvzkabBrenN1B6dw6AFdzE7gghV5qGW2dEcGyb?= =?us-ascii?Q?LO57OymcesOB3hP/JpNPjw6ZnkZUPosLEMQrg3c0Osyf7LZY0YDItP0FSIqF?= =?us-ascii?Q?9E+VMScPXpa4SCSoDrfzmfWWdJxlyjNBW/nnmC1075Dej6DyOyQrkBfxzZ4D?= =?us-ascii?Q?xjc7GVxdDiebtFUe9QTO4AZgQ8FNuer1C9ikKuJEdHre70cK5p0a+oT7w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liJcjU9xkXMq/n6gOlT7hGodGp614=; 5:RMhMF9A37lp6LphyHMXnqxht/m4T0Ea6LuwDNJB+8VltFuAwLANYCYftAsa9nZU5mufPPQfBzAWNnGMVtesMemgzV5ohKHPvKJVoAjglvH9Czvr/ZijBV2x9h+9BmkvCR/Q+gz15LNAK5wWXNDwn1u/ag52wYWQvnZQDuf2AaDw=; 24:ml6n9QEvVWIXgtBDzpTKuTecBpMuXHjqoOBHwbaDpvmGn9NrFKN5nwXODXxMGs6ZfdBHbZnt65+H0cTfhv+6Fu8dvBKMc5yTOehfUmicFJU=; 7:e1aFLdvzbTT1+WBAodO07rRSltY7Jnlw0vBwSZu6VGIVeccD8LXhYYtnchoDzlaVmOYDf2tqz525HBcMdm66TOzVTkgf7VhtDx0BGwrnBFNz7QrbFVy3AGIqrx90wMXHpxoe2ppfRClfEVMajK+tc5senvc6us/7wiAAR8sLtwWzGQNyYBbN3GwwwDSdidVyUQCYnURQD6yYTtTLAmH5jWqRiebs4CHyzwfH3D8Q4F/V7fn+uC8J/QELJDrcFdIv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0230; 20:yPEvs68S/BLa5vwTCa6BS4s/9QJCiKBTV+s8Cqo9sexK769SXZ2MSdYYT/LKRw0GMhYNKpS8ppXTUHCsMUffuN5TOOKBDPFD01ciPRCBtCfE3a3RPVpxl9+/vvId1bXAils79fD36JPE5AFlVzFMlyWgSfF3qKWvOom+Mg9IoRHdUyvZtBPmktU5fZUprhojq2swj7BQc6vTJgo7z4eHHxSf2Lj+F3KNOQafv8Y6dnuWgnTWzI0S7Qx2Qxa4vUyA X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2018 22:17:55.5226 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1abc320-8f65-42cc-cb6e-08d553c1017b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0230 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This will be needed for most dGPUs. CC: linux-pci@vger.kernel.org Signed-off-by: Felix Kuehling Reviewed-by: Oded Gabbay --- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 17 +++++++++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c index a8fa33a..fafe971 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -41,6 +41,7 @@ static const struct kfd_device_info kaveri_device_info = { .num_of_watch_points = 4, .mqd_size_aligned = MQD_SIZE_ALIGNED, .supports_cwsr = false, + .needs_pci_atomics = false, }; static const struct kfd_device_info carrizo_device_info = { @@ -53,6 +54,7 @@ static const struct kfd_device_info carrizo_device_info = { .num_of_watch_points = 4, .mqd_size_aligned = MQD_SIZE_ALIGNED, .supports_cwsr = true, + .needs_pci_atomics = false, }; struct kfd_deviceid { @@ -127,6 +129,21 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, return NULL; } + if (device_info->needs_pci_atomics) { + /* Allow BIF to recode atomics to PCIe 3.0 + * AtomicOps. 32 and 64-bit requests are possible and + * must be supported. + */ + if (pci_enable_atomic_ops_to_root(pdev, + PCI_EXP_DEVCAP2_ATOMIC_COMP32 | + PCI_EXP_DEVCAP2_ATOMIC_COMP64) < 0) { + dev_info(kfd_device, + "skipped device %x:%x, PCI rejects atomics", + pdev->vendor, pdev->device); + return NULL; + } + } + kfd = kzalloc(sizeof(*kfd), GFP_KERNEL); if (!kfd) return NULL; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index 6a48d29..eebfb1e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h @@ -158,6 +158,7 @@ struct kfd_device_info { uint8_t num_of_watch_points; uint16_t mqd_size_aligned; bool supports_cwsr; + bool needs_pci_atomics; }; struct kfd_mem_obj {