From patchwork Wed Aug 14 21:31:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Herbst X-Patchwork-Id: 11094623 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D870C13AC for ; Wed, 14 Aug 2019 21:31:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6BA9209CD for ; Wed, 14 Aug 2019 21:31:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA93C2880C; Wed, 14 Aug 2019 21:31:28 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 4B196209CD for ; Wed, 14 Aug 2019 21:31:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729807AbfHNVb0 (ORCPT ); Wed, 14 Aug 2019 17:31:26 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44517 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728817AbfHNVbZ (ORCPT ); Wed, 14 Aug 2019 17:31:25 -0400 Received: by mail-wr1-f66.google.com with SMTP id p17so426596wrf.11 for ; Wed, 14 Aug 2019 14:31:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OnqmTFBl6UH0AjitgL4NS1jwiF8ciOoeoor1qBPQFQM=; b=OywmjUTnsw7hWj+6SoTwe9tfZ6WWSCopQegEfgC0zB64hkzrWIUQVAcpE46LHol5Kv 5I1wc+XyfgMYTqvagARPtSYGS8lxDdIcQ63fKo0WsVufPeiFiZGAl1G6duBOyx9h5MS9 7zxWAHEh/wpV+ntz5bjgn+g3nwh4mIRA/926RxXQF6mRjDotBPv4kYdPOl/3wp3X40en ytrV4Ev1fJA6vnX8hoXwRQAI2TaWbGFnefzzSgCJuiDE5RjKnQEMWSZP9hc9cibjwcH1 t/Vngobutn/1A+W4zc3qHaJ3ydENtLGVn9TxXL02hlxmZWKTuTyVUK+r5pFv47HAEgQN wksQ== X-Gm-Message-State: APjAAAXF7mAwcYtdL08SU8TB4ZYMEpqYjnBhxRFE7y95wss8Y/i9hjQp 1eWqbYVvyJbCtAw7OalkPX2QtQ== X-Google-Smtp-Source: APXvYqzSVT+o3wy2DXl2BjBaEcVKdDbY4rCB1w2Yu2iz4eCbRD6vvvxvJe0FB/RLEmTeX7aqPb9o/w== X-Received: by 2002:adf:ce05:: with SMTP id p5mr1630518wrn.197.1565818283445; Wed, 14 Aug 2019 14:31:23 -0700 (PDT) Received: from kherbst.pingu.com ([2a02:8108:453f:d1a0:28d1:9d88:57f6:f95b]) by smtp.gmail.com with ESMTPSA id r17sm2095134wrg.93.2019.08.14.14.31.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 14:31:22 -0700 (PDT) From: Karol Herbst To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Cc: Karol Herbst , Alex Hung , "Rafael J . Wysocki" , Dave Airlie , Lyude Paul , Ben Skeggs Subject: [PATCH 1/7] Revert "ACPI / OSI: Add OEM _OSI string to enable dGPU direct output" Date: Wed, 14 Aug 2019 23:31:12 +0200 Message-Id: <20190814213118.28473-2-kherbst@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190814213118.28473-1-kherbst@redhat.com> References: <20190814213118.28473-1-kherbst@redhat.com> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 28586a51eea666d5531bcaef2f68e4abbd87242c. The original commit message didn't even make sense. AMD _does_ support it and it works with Nouveau as well. Also what was the issue being solved here? No references to any bugs and not even explaining any issue at all isn't the way we do things. And even if it means a muxed design, then the fix is to make it work inside the driver, not adding some hacky workaround through ACPI tricks. And what out of tree drivers do or do not support we don't care one bit anyway. Signed-off-by: Karol Herbst CC: Alex Hung CC: Rafael J. Wysocki CC: Dave Airlie CC: Lyude Paul CC: Ben Skeggs Acked-by: Dave Airlie Acked-by: Daniel Vetter Acked-by: Alex Hung --- drivers/acpi/osi.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c index bec0bebc7f52..9b20ac4d79a0 100644 --- a/drivers/acpi/osi.c +++ b/drivers/acpi/osi.c @@ -61,13 +61,6 @@ osi_setup_entries[OSI_STRING_ENTRIES_MAX] __initdata = { * a BIOS workaround. */ {"Linux-Lenovo-NV-HDMI-Audio", true}, - /* - * Linux-HPI-Hybrid-Graphics is used by BIOS to enable dGPU to - * output video directly to external monitors on HP Inc. mobile - * workstations as Nvidia and AMD VGA drivers provide limited - * hybrid graphics supports. - */ - {"Linux-HPI-Hybrid-Graphics", true}, }; static u32 acpi_osi_handler(acpi_string interface, u32 supported) From patchwork Wed Aug 14 21:31:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Herbst X-Patchwork-Id: 11094629 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7B1E313B1 for ; Wed, 14 Aug 2019 21:31:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69369209CD for ; Wed, 14 Aug 2019 21:31:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CCA12880C; Wed, 14 Aug 2019 21:31:33 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 07836209CD for ; Wed, 14 Aug 2019 21:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729051AbfHNVbb (ORCPT ); Wed, 14 Aug 2019 17:31:31 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34493 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728777AbfHNVb0 (ORCPT ); Wed, 14 Aug 2019 17:31:26 -0400 Received: by mail-wm1-f66.google.com with SMTP id e8so4172976wme.1 for ; Wed, 14 Aug 2019 14:31:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XYZjU1RTDpOkzFDReluCSDSSmZ91Zx0fRKtSGoSAbAQ=; b=cbQ6g/9ZLwrDNZsGWKvfNerYet7jr4NK078CmCj5ueKY0CHnEecKBJDiD1uedIbfRW j3eiLN7CZfXm0ikoD+laGx9j8urls1zbzqs0ojCW7FJxtyI0yhULzrHdqSAag83rJDPV /sm/WUlb/vpqPaIyj23A+lO/UlX+AGpE71ndy8c6I65A8UdiuN3yyPh+ATkoVaCji//u XzTi0X5XYsjCVNFw7h8qzbKsOKoOxb9VDyOfcWmFbzMiAZETSaMKuBCneTZvLsX7NLc/ T2hDEoIOs9+zEvWZu3XNEY+OUvs9bjEsc6pEKvxM/exXFCmc6PeXLDqhRdKrc4qYPDGL B3OA== X-Gm-Message-State: APjAAAWzzVx10TMUP+yzMWmKvXorwEDp6I3VVL8+hSog0lNo8LU3qRXV WmLzGrzgv0V3gFOV/uP+ohwihQ== X-Google-Smtp-Source: APXvYqzNvd+OhowbMV5UPI7p1DFhfCV5EFIScUQVzbZ3KQZm996fQEnm0XDNrUvLBitBCCdEL8ugqA== X-Received: by 2002:a7b:c954:: with SMTP id i20mr884035wml.169.1565818284752; Wed, 14 Aug 2019 14:31:24 -0700 (PDT) Received: from kherbst.pingu.com ([2a02:8108:453f:d1a0:28d1:9d88:57f6:f95b]) by smtp.gmail.com with ESMTPSA id r17sm2095134wrg.93.2019.08.14.14.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 14:31:24 -0700 (PDT) From: Karol Herbst To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Cc: Karol Herbst , Alex Hung , "Rafael J . Wysocki" , Dave Airlie , Lyude Paul , Ben Skeggs Subject: [PATCH 2/7] Revert "ACPI / OSI: Add OEM _OSI string to enable NVidia HDMI audio" Date: Wed, 14 Aug 2019 23:31:13 +0200 Message-Id: <20190814213118.28473-3-kherbst@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190814213118.28473-1-kherbst@redhat.com> References: <20190814213118.28473-1-kherbst@redhat.com> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 887532ca7ca59fcf0547a79211756791128030a3. We have a better solution for this: b516ea586d717 And same as with the last commit: "NVidia Linux driver" that's Nouveau, any out of tree driver does _not_ matter. And with Nouveau all of this works even though it required a proper fix first, but we have that now. Signed-off-by: Karol Herbst CC: Alex Hung CC: Rafael J. Wysocki CC: Dave Airlie CC: Lyude Paul CC: Ben Skeggs --- drivers/acpi/osi.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c index 9b20ac4d79a0..56cc95b6b724 100644 --- a/drivers/acpi/osi.c +++ b/drivers/acpi/osi.c @@ -53,14 +53,6 @@ osi_setup_entries[OSI_STRING_ENTRIES_MAX] __initdata = { * be removed if both new and old graphics cards are supported. */ {"Linux-Dell-Video", true}, - /* - * Linux-Lenovo-NV-HDMI-Audio is used by BIOS to power on NVidia's HDMI - * audio device which is turned off for power-saving in Windows OS. - * This power management feature observed on some Lenovo Thinkpad - * systems which will not be able to output audio via HDMI without - * a BIOS workaround. - */ - {"Linux-Lenovo-NV-HDMI-Audio", true}, }; static u32 acpi_osi_handler(acpi_string interface, u32 supported) From patchwork Wed Aug 14 21:31:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Herbst X-Patchwork-Id: 11094627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1956A1823 for ; Wed, 14 Aug 2019 21:31:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 062BE209CD for ; Wed, 14 Aug 2019 21:31:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE5D62880C; Wed, 14 Aug 2019 21:31:31 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 93396209CD for ; Wed, 14 Aug 2019 21:31:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729865AbfHNVb2 (ORCPT ); Wed, 14 Aug 2019 17:31:28 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38435 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729832AbfHNVb1 (ORCPT ); Wed, 14 Aug 2019 17:31:27 -0400 Received: by mail-wr1-f65.google.com with SMTP id g17so454639wrr.5 for ; Wed, 14 Aug 2019 14:31:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xhvDIcAWfosZBJhY+0+tJdL27Lzyx+m3Z571YGmGrMU=; b=P9mqUsnBnbQwi4T9s0RL5vDiXusfblLzswuOmsZJD7dHxhFtmVet84/fHJaOEbdMhp bXQDRQlgM8Gzz6N/K+9WAT9sAB40UECRxpa7l9ZJaK0/S2wFN4cNR0+Ja1FPezIgBjQX dPLkZAsZKmmJYktNQJRwe3B6nDeiqL5dS4yw2nQIA4qrvYkuZ13Bo07dJrNDTAklmi96 4yKZPsuohG+2Nljj+2PJamUYQDE+oBiC3C0OW+j+TFk3ocDYqyQWnq1hE45/64vsvs5z cA1PVY6HJ8c2r1e+4CZnxTQOXMGI5xpSRu6k5MhCo11SOU4fTsbLcrI4tnWCkcS9vjyZ w5FQ== X-Gm-Message-State: APjAAAW++RdD1Ygdepu9VwYYtPCJZbI+eX+/GRzUSjHIEnOquOZtFKN0 hpsXTHmXXu8DBtKLWby54k/qYQ== X-Google-Smtp-Source: APXvYqzpILgvWyO/axbBU+RuIXy2MhZX3baBIQN5meB2TU+nSw73f26dSGUM9WN8J6xOSH+pbpo82A== X-Received: by 2002:a5d:4a4e:: with SMTP id v14mr1601044wrs.200.1565818285969; Wed, 14 Aug 2019 14:31:25 -0700 (PDT) Received: from kherbst.pingu.com ([2a02:8108:453f:d1a0:28d1:9d88:57f6:f95b]) by smtp.gmail.com with ESMTPSA id r17sm2095134wrg.93.2019.08.14.14.31.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 14:31:25 -0700 (PDT) From: Karol Herbst To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Cc: Karol Herbst , Alex Hung , "Rafael J . Wysocki" , Dave Airlie , Lyude Paul , Ben Skeggs Subject: [PATCH 3/7] Revert "ACPI / OSI: Add OEM _OSI strings to disable NVidia RTD3" Date: Wed, 14 Aug 2019 23:31:14 +0200 Message-Id: <20190814213118.28473-4-kherbst@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190814213118.28473-1-kherbst@redhat.com> References: <20190814213118.28473-1-kherbst@redhat.com> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 9251a71db62ca9cc7e7cf364218610b0f018c291. This was never discussed with anybody Nouveau related and we would have NACKed this change immediately. We have a better workaround, which makes it actually work with Nouveau. No idea why the comment mentions the Nvidia driver and assumes it gives any weight to the reasoning.... we don't care about out of tree drivers. Nouveau does support RTD3, but we had some issues with that. And we even have a better fix for this issue. Also, can we _please_ do it in a way worthy of an upstream community the next time? If some distribution feels like they have to please companies not wanting to be part of the linux community, please do so downstream and don't try to push something like this upstream. Signed-off-by: Karol Herbst CC: Alex Hung CC: Rafael J. Wysocki CC: Dave Airlie CC: Lyude Paul CC: Ben Skeggs --- drivers/acpi/osi.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c index 56cc95b6b724..f5d559a2ff14 100644 --- a/drivers/acpi/osi.c +++ b/drivers/acpi/osi.c @@ -44,15 +44,6 @@ osi_setup_entries[OSI_STRING_ENTRIES_MAX] __initdata = { {"Processor Device", true}, {"3.0 _SCP Extensions", true}, {"Processor Aggregator Device", true}, - /* - * Linux-Dell-Video is used by BIOS to disable RTD3 for NVidia graphics - * cards as RTD3 is not supported by drivers now. Systems with NVidia - * cards will hang without RTD3 disabled. - * - * Once NVidia drivers officially support RTD3, this _OSI strings can - * be removed if both new and old graphics cards are supported. - */ - {"Linux-Dell-Video", true}, }; static u32 acpi_osi_handler(acpi_string interface, u32 supported) From patchwork Wed Aug 14 21:31:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Herbst X-Patchwork-Id: 11094649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D39113B1 for ; Wed, 14 Aug 2019 21:32:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BA77209CD for ; Wed, 14 Aug 2019 21:32:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FC532880C; Wed, 14 Aug 2019 21:32:01 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 A0F8C209CD for ; Wed, 14 Aug 2019 21:32:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730031AbfHNVbi (ORCPT ); Wed, 14 Aug 2019 17:31:38 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39222 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729980AbfHNVbi (ORCPT ); Wed, 14 Aug 2019 17:31:38 -0400 Received: by mail-wr1-f67.google.com with SMTP id t16so452426wra.6 for ; Wed, 14 Aug 2019 14:31:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0TzjYpMy9+0zUnyIhGVp0XLreAg3cbu7k5uuH85z42Y=; b=lqJcwGi/iKX6Lah1UkksoLcsXgLD/uhUBwIw8Uss8JrvxiFWoYJPAkZb1fobTj9XYb y+vU89DnGMwXNo++hidRXgwU0K1hqwUku4HLYBeF4mCjzw2JjU41fR/uAvlOHAW2BtdI 4GcqlRnwQlQtCLMfEAKjMFECsFOOK3um0ePjeVp83fpYsJZ8KyCns/iNYxb+XsNwuxAp JxxEpCqvNdYXAgMPE9hNQbYDMMvfNB18uyKmmMf5eIyVtbbF24veKGbOYVmDKR/y3hld QoaQjizehq5V4UwC751G5DTq2engF2RFFSZns2nT0/dssaSEjviVPJgqASDVf2R5i1jC BA2w== X-Gm-Message-State: APjAAAW5IXN1bp1W1PhUJxd0jX3TqGwc+HWjBnkZDnC7MU6L1Q34nfyT fVGznSZZ5615k4fvCkoi7VvwWkRcV4s= X-Google-Smtp-Source: APXvYqzZayfXMMmK+XvZtOaSr4FuQVJXXrQ0d8j9SpvLi3XGme93Isve666keCnmVjrWEvMt/EDx6g== X-Received: by 2002:a5d:4284:: with SMTP id k4mr1733516wrq.6.1565818296138; Wed, 14 Aug 2019 14:31:36 -0700 (PDT) Received: from kherbst.pingu.com ([2a02:8108:453f:d1a0:28d1:9d88:57f6:f95b]) by smtp.gmail.com with ESMTPSA id r17sm2095134wrg.93.2019.08.14.14.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 14:31:26 -0700 (PDT) From: Karol Herbst To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Cc: Karol Herbst , Lyude Paul , Alex Hung , "Rafael J . Wysocki" , Dave Airlie , Ben Skeggs Subject: [PATCH 4/7] drm/nouveau/pci: enable pcie link changes for pascal Date: Wed, 14 Aug 2019 23:31:15 +0200 Message-Id: <20190814213118.28473-5-kherbst@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190814213118.28473-1-kherbst@redhat.com> References: <20190814213118.28473-1-kherbst@redhat.com> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Karol Herbst Reviewed-by: Lyude Paul CC: Alex Hung CC: Rafael J. Wysocki CC: Dave Airlie CC: Lyude Paul CC: Ben Skeggs --- drivers/gpu/drm/nouveau/nvkm/subdev/pci/gk104.c | 8 ++++---- drivers/gpu/drm/nouveau/nvkm/subdev/pci/gp100.c | 10 ++++++++++ drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h | 5 +++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/gk104.c index e68030507d88..664890185e15 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/gk104.c @@ -23,7 +23,7 @@ */ #include "priv.h" -static int +int gk104_pcie_version_supported(struct nvkm_pci *pci) { return (nvkm_rd32(pci->subdev.device, 0x8c1c0) & 0x4) == 0x4 ? 2 : 1; @@ -108,7 +108,7 @@ gk104_pcie_lnkctl_speed(struct nvkm_pci *pci) return -1; } -static enum nvkm_pcie_speed +enum nvkm_pcie_speed gk104_pcie_max_speed(struct nvkm_pci *pci) { u32 max_speed = nvkm_rd32(pci->subdev.device, 0x8c1c0) & 0x300000; @@ -146,7 +146,7 @@ gk104_pcie_set_link_speed(struct nvkm_pci *pci, enum nvkm_pcie_speed speed) nvkm_mask(device, 0x8c040, 0x1, 0x1); } -static int +int gk104_pcie_init(struct nvkm_pci * pci) { enum nvkm_pcie_speed lnkctl_speed, max_speed, cap_speed; @@ -178,7 +178,7 @@ gk104_pcie_init(struct nvkm_pci * pci) return 0; } -static int +int gk104_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width) { struct nvkm_subdev *subdev = &pci->subdev; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/gp100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/gp100.c index 82c5234a06ff..eb19c7a44561 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/gp100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/gp100.c @@ -35,6 +35,16 @@ gp100_pci_func = { .wr08 = nv40_pci_wr08, .wr32 = nv40_pci_wr32, .msi_rearm = gp100_pci_msi_rearm, + + .pcie.init = gk104_pcie_init, + .pcie.set_link = gk104_pcie_set_link, + + .pcie.max_speed = gk104_pcie_max_speed, + .pcie.cur_speed = g84_pcie_cur_speed, + + .pcie.set_version = gf100_pcie_set_version, + .pcie.version = gf100_pcie_version, + .pcie.version_supported = gk104_pcie_version_supported, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h index 7009aad86b6e..162ed5dc6fc3 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h @@ -54,6 +54,11 @@ int gf100_pcie_cap_speed(struct nvkm_pci *); int gf100_pcie_init(struct nvkm_pci *); int gf100_pcie_set_link(struct nvkm_pci *, enum nvkm_pcie_speed, u8); +int gk104_pcie_init(struct nvkm_pci *); +int gk104_pcie_set_link(struct nvkm_pci *, enum nvkm_pcie_speed, u8 width); +enum nvkm_pcie_speed gk104_pcie_max_speed(struct nvkm_pci *); +int gk104_pcie_version_supported(struct nvkm_pci *); + int nvkm_pcie_oneinit(struct nvkm_pci *); int nvkm_pcie_init(struct nvkm_pci *); #endif From patchwork Wed Aug 14 21:31:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Herbst X-Patchwork-Id: 11094645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 557F8112C for ; Wed, 14 Aug 2019 21:31:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43DCC2859E for ; Wed, 14 Aug 2019 21:31:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 378222880C; Wed, 14 Aug 2019 21:31:59 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 B9B112859E for ; Wed, 14 Aug 2019 21:31:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730076AbfHNVbm (ORCPT ); Wed, 14 Aug 2019 17:31:42 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46103 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730016AbfHNVbj (ORCPT ); Wed, 14 Aug 2019 17:31:39 -0400 Received: by mail-wr1-f68.google.com with SMTP id z1so414850wru.13 for ; Wed, 14 Aug 2019 14:31:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+R7LV1MxNrT9xguc00MGuS05JmkrEhR9rX0ez6LOs84=; b=s+Q1aHTGyVoXpo2BUkU1XhTeCnQsEnQ29TCGsfgWRHJ28L22zxYhXu4g5EzirUZvp3 6a8ZFw07Eo6zP4wYjMK1e0T3SpiUFekFfRilPbMPYS3FzKgDESPJOCMrn/IJ4+GHkg5B N90za4tpfDetL4krqA2kHr98O7LCVtFrKW3pWx3sVfYfYb87qn2xxUkr0g2eF+KR5P5V pAc19dBG7x5NH5VGPqR4vkV6RczPDWsz5EG2z0777J+lepx7bKBkqMUMYEByB8dsBnc+ CNy9Dco1wYpATKLnkU3KAevGjnTBlKcipy4pZ7Bws+Ls57AnitfEqrDj8FjIRTAdjZuR NoQA== X-Gm-Message-State: APjAAAVNwBW9062qhD3Ud+qZvgeNdSSOcAhX1MyPHf/SBmPrYthtZgXm Me7lZ3dIXIbOR4VTIWbojyTPtQ== X-Google-Smtp-Source: APXvYqy6Bct927d1tcxDlG3Bau1plPbpmZhGaupy99LmABC4eq6mo/7HS+c9vx5OHhIXxUPcYDgtMQ== X-Received: by 2002:adf:ed85:: with SMTP id c5mr1624418wro.268.1565818297742; Wed, 14 Aug 2019 14:31:37 -0700 (PDT) Received: from kherbst.pingu.com ([2a02:8108:453f:d1a0:28d1:9d88:57f6:f95b]) by smtp.gmail.com with ESMTPSA id r17sm2095134wrg.93.2019.08.14.14.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 14:31:37 -0700 (PDT) From: Karol Herbst To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Cc: Karol Herbst , Lyude Paul , Alex Hung , "Rafael J . Wysocki" , Dave Airlie , Ben Skeggs Subject: [PATCH 5/7] drm/nouveau/pci: add nvkm_pcie_get_speed Date: Wed, 14 Aug 2019 23:31:16 +0200 Message-Id: <20190814213118.28473-6-kherbst@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190814213118.28473-1-kherbst@redhat.com> References: <20190814213118.28473-1-kherbst@redhat.com> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP v2: fixed compilation error Signed-off-by: Karol Herbst Reviewed-by: Lyude Paul CC: Alex Hung CC: Rafael J. Wysocki CC: Dave Airlie CC: Lyude Paul CC: Ben Skeggs --- drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h index 4803a4fad4a2..b29101e485f9 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h @@ -53,4 +53,5 @@ int gp100_pci_new(struct nvkm_device *, int, struct nvkm_pci **); /* pcie functions */ int nvkm_pcie_set_link(struct nvkm_pci *, enum nvkm_pcie_speed, u8 width); +enum nvkm_pcie_speed nvkm_pcie_get_speed(struct nvkm_pci *); #endif diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c index d71e5db5028a..03be24930c0e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c @@ -163,3 +163,11 @@ nvkm_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width) return ret; } + +enum nvkm_pcie_speed +nvkm_pcie_get_speed(struct nvkm_pci *pci) +{ + if (!pci || !pci_is_pcie(pci->pdev) || !pci->func->pcie.cur_speed) + return -ENODEV; + return pci->func->pcie.cur_speed(pci); +} From patchwork Wed Aug 14 21:31:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Herbst X-Patchwork-Id: 11094647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13437112C for ; Wed, 14 Aug 2019 21:32:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00DD9209CD for ; Wed, 14 Aug 2019 21:32:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8FE92880C; Wed, 14 Aug 2019 21:31:59 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 40C2F209CD for ; Wed, 14 Aug 2019 21:31:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730064AbfHNVb6 (ORCPT ); Wed, 14 Aug 2019 17:31:58 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39227 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730058AbfHNVbl (ORCPT ); Wed, 14 Aug 2019 17:31:41 -0400 Received: by mail-wr1-f68.google.com with SMTP id t16so452537wra.6 for ; Wed, 14 Aug 2019 14:31:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M4cBPfAkm3JGwK6tgjgZG/bf6hqDAaKM4pHE2P3hoSk=; b=IzB0n5cxejX7FsmAgsYL/PI3Ag86wOlNembVe5Oz+REyMC+yL8ILlHxRxsyOIGPqaZ bB5kuA9siSa7VxMnUM8Z6oSQObFxQr+es5v/rKo6PuHY1zoeiEomnUtqS6XU4NYnF5vw AWwNpxMbimtq2ZDFEaiNmBAawIDazEt0/FcJw2hik4GrSinotuwaI5AakPHTWODgW/En uWIA0hs+lQNj1fUPJgkmhTEHYsEmQTILAAxcflz2avsWSITh8M3EoPW21lCl9LknQH9x g+crMzLk3gsFoUXKqQYagfPEz/W6gTUpUdQJuhWnc7fuxXQNOKlmmk9k7xLXIDtDXSC1 BHLQ== X-Gm-Message-State: APjAAAU2CjMQ9BuP3SJFV3bRMlpaERTj49O71d9pYjKo8e7sRUdrBR/u a7sSEb5ljBF6Dq4qXBBdDce1aQ== X-Google-Smtp-Source: APXvYqymBPN2fOiVKvJ95+sArRHW7L8w/SOhnKONfuNY4jEYxmOQid0DtmsLelmU+LjZAjug4enZtg== X-Received: by 2002:adf:fdcc:: with SMTP id i12mr1774830wrs.88.1565818298960; Wed, 14 Aug 2019 14:31:38 -0700 (PDT) Received: from kherbst.pingu.com ([2a02:8108:453f:d1a0:28d1:9d88:57f6:f95b]) by smtp.gmail.com with ESMTPSA id r17sm2095134wrg.93.2019.08.14.14.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 14:31:38 -0700 (PDT) From: Karol Herbst To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Cc: Karol Herbst , Lyude Paul , Alex Hung , "Rafael J . Wysocki" , Dave Airlie , Ben Skeggs Subject: [PATCH 6/7] drm/nouveau/pci: save the boot pcie link speed and restore it on fini Date: Wed, 14 Aug 2019 23:31:17 +0200 Message-Id: <20190814213118.28473-7-kherbst@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190814213118.28473-1-kherbst@redhat.com> References: <20190814213118.28473-1-kherbst@redhat.com> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Apperantly things go south if we suspend the device with a different PCIE link speed set than it got booted with. Fixes runtime suspend on my gp107. This all looks like some bug inside the pci subsystem and I would prefer a fix there instead of nouveau, but maybe there is no real nice way of doing that outside of drivers? v2: squashed together patch 4 and 5 v3: only restore pcie speed on machines with runpm add NvRunpmWorkaround config option to disable the workaround Signed-off-by: Karol Herbst Reviewed-by: Lyude Paul (v2) CC: Alex Hung CC: Rafael J. Wysocki CC: Dave Airlie CC: Lyude Paul CC: Ben Skeggs --- .../drm/nouveau/include/nvkm/core/device.h | 2 + .../gpu/drm/nouveau/include/nvkm/subdev/pci.h | 8 ++-- drivers/gpu/drm/nouveau/nouveau_drm.c | 1 + .../gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +- .../gpu/drm/nouveau/nvkm/subdev/pci/base.c | 9 ++++- .../gpu/drm/nouveau/nvkm/subdev/pci/pcie.c | 38 ++++++++++++++++--- .../gpu/drm/nouveau/nvkm/subdev/pci/priv.h | 2 + 7 files changed, 51 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h index 6d55cd0476aa..4fb3f972ff97 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h @@ -125,6 +125,8 @@ struct nvkm_device { u8 chiprev; u32 crystal; + bool has_runpm; + struct { struct notifier_block nb; } acpi; diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h index b29101e485f9..56e73412fe4a 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h @@ -26,8 +26,9 @@ struct nvkm_pci { } agp; struct { - enum nvkm_pcie_speed speed; - u8 width; + enum nvkm_pcie_speed cur_speed; + enum nvkm_pcie_speed def_speed; + u8 cur_width; } pcie; bool msi; @@ -52,6 +53,7 @@ int gk104_pci_new(struct nvkm_device *, int, struct nvkm_pci **); int gp100_pci_new(struct nvkm_device *, int, struct nvkm_pci **); /* pcie functions */ -int nvkm_pcie_set_link(struct nvkm_pci *, enum nvkm_pcie_speed, u8 width); +int nvkm_pcie_set_link(struct nvkm_pci *, enum nvkm_pcie_speed, u8 width, + bool save); enum nvkm_pcie_speed nvkm_pcie_get_speed(struct nvkm_pci *); #endif diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 7c2fcaba42d6..16441c5bf29c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -675,6 +675,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev, if (nouveau_atomic) driver_pci.driver_features |= DRIVER_ATOMIC; + device->has_runpm = nouveau_pmops_runtime(); drm_dev = drm_dev_alloc(&driver_pci, &pdev->dev); if (IS_ERR(drm_dev)) { diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c index 40e564524b7a..1a524ffa77a3 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c @@ -278,7 +278,7 @@ nvkm_pstate_prog(struct nvkm_clk *clk, int pstatei) nvkm_debug(subdev, "setting performance state %d\n", pstatei); clk->pstate = pstatei; - nvkm_pcie_set_link(pci, pstate->pcie_speed, pstate->pcie_width); + nvkm_pcie_set_link(pci, pstate->pcie_speed, pstate->pcie_width, true); if (fb && fb->ram && fb->ram->func->calc) { struct nvkm_ram *ram = fb->ram; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c index ee2431a7804e..d9fb5a83f7d2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c @@ -90,6 +90,8 @@ nvkm_pci_fini(struct nvkm_subdev *subdev, bool suspend) if (pci->agp.bridge) nvkm_agp_fini(pci); + else if (pci_is_pcie(pci->pdev)) + nvkm_pcie_fini(pci); return 0; } @@ -100,6 +102,8 @@ nvkm_pci_preinit(struct nvkm_subdev *subdev) struct nvkm_pci *pci = nvkm_pci(subdev); if (pci->agp.bridge) nvkm_agp_preinit(pci); + else if (pci_is_pcie(pci->pdev)) + nvkm_pcie_preinit(pci); return 0; } @@ -193,8 +197,9 @@ nvkm_pci_new_(const struct nvkm_pci_func *func, struct nvkm_device *device, pci->func = func; pci->pdev = device->func->pci(device)->pdev; pci->irq = -1; - pci->pcie.speed = -1; - pci->pcie.width = -1; + pci->pcie.cur_speed = -1; + pci->pcie.def_speed = -1; + pci->pcie.cur_width = -1; if (device->type == NVKM_DEVICE_AGP) nvkm_agp_ctor(pci); diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c index 03be24930c0e..d6b7ad6a8d0d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/pcie.c @@ -23,6 +23,8 @@ */ #include "priv.h" +#include + static char *nvkm_pcie_speeds[] = { "2.5GT/s", "5.0GT/s", @@ -85,6 +87,13 @@ nvkm_pcie_oneinit(struct nvkm_pci *pci) return 0; } +int +nvkm_pcie_preinit(struct nvkm_pci *pci) +{ + pci->pcie.def_speed = nvkm_pcie_get_speed(pci); + return 0; +} + int nvkm_pcie_init(struct nvkm_pci *pci) { @@ -105,14 +114,31 @@ nvkm_pcie_init(struct nvkm_pci *pci) if (pci->func->pcie.init) pci->func->pcie.init(pci); - if (pci->pcie.speed != -1) - nvkm_pcie_set_link(pci, pci->pcie.speed, pci->pcie.width); + if (pci->pcie.cur_speed != -1) + nvkm_pcie_set_link(pci, pci->pcie.cur_speed, + pci->pcie.cur_width, false); + + return 0; +} + +int +nvkm_pcie_fini(struct nvkm_pci *pci) +{ + struct nvkm_device *device = pci->subdev.device; + if (!device->has_runpm) + return 0; + + if (!nvkm_boolopt(device->cfgopt, "NvRunpmWorkaround", true)) + return 0; + if (!IS_ERR_VALUE(pci->pcie.def_speed)) + return nvkm_pcie_set_link(pci, pci->pcie.def_speed, 16, false); return 0; } int -nvkm_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width) +nvkm_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width, + bool save) { struct nvkm_subdev *subdev = &pci->subdev; enum nvkm_pcie_speed cur_speed, max_speed; @@ -146,8 +172,10 @@ nvkm_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width) speed = max_speed; } - pci->pcie.speed = speed; - pci->pcie.width = width; + if (save) { + pci->pcie.cur_speed = speed; + pci->pcie.cur_width = width; + } if (speed == cur_speed) { nvkm_debug(subdev, "requested matches current speed\n"); diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h index 162ed5dc6fc3..85be0594f11b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h @@ -60,5 +60,7 @@ enum nvkm_pcie_speed gk104_pcie_max_speed(struct nvkm_pci *); int gk104_pcie_version_supported(struct nvkm_pci *); int nvkm_pcie_oneinit(struct nvkm_pci *); +int nvkm_pcie_preinit(struct nvkm_pci *); int nvkm_pcie_init(struct nvkm_pci *); +int nvkm_pcie_fini(struct nvkm_pci *); #endif From patchwork Wed Aug 14 21:31:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Herbst X-Patchwork-Id: 11094643 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64303112C for ; Wed, 14 Aug 2019 21:31:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D1E2209CD for ; Wed, 14 Aug 2019 21:31:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3ED162880C; Wed, 14 Aug 2019 21:31:54 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 DE24F209CD for ; Wed, 14 Aug 2019 21:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730016AbfHNVbm (ORCPT ); Wed, 14 Aug 2019 17:31:42 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:34514 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729982AbfHNVbl (ORCPT ); Wed, 14 Aug 2019 17:31:41 -0400 Received: by mail-wm1-f67.google.com with SMTP id e8so4173751wme.1 for ; Wed, 14 Aug 2019 14:31:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JS9FDqsk2E6RQCD4HkMjbuys2g4pNRCG7WFODU185bI=; b=WP7qTGhc5r5DTZn4z5uIV/vYPFO5L67bxY3M2zZ3jFENipGJh1FZENkRWpg5xhNBgx irRPbcwcgu6Syn0Vu1nEPdq5rHRnzcrMOwrKXaqUXOvCfylgvCwECkEy0NWnRECyYkq3 nCGR+Qb2D2xqeb5sHtISAObCIn7BuBunVqTEj2G2/IWsJMA4NPQtEwgT3TmBbUemwvV4 XO62F54u48i74TmSScJg5KlbZ86qy/rCSwe2bFn0omqHDDQLTilyZ0Pz6ZsAo+JsDy8g UBXaqvsMPefpIftL9fL+X9PbBVPR7c8ApKcIdZwtpvTzV5uKSrsth2PPrrg1tOmaT6eh 64Ww== X-Gm-Message-State: APjAAAWfNURpoPI1k1CIIwqIfXo8NH50qsIq5oY2C4a2dNreItEoq/te VSdyzcfcsGx2fXKSJz1rL2wn2Q== X-Google-Smtp-Source: APXvYqzHDWQhfPJ6We27I1c01VEHmcH6AedqLJLeDfuYhTAnIpxtfMqyBLvyHd9LxsMu3eLuFy5VVA== X-Received: by 2002:a7b:cf21:: with SMTP id m1mr949715wmg.150.1565818300170; Wed, 14 Aug 2019 14:31:40 -0700 (PDT) Received: from kherbst.pingu.com ([2a02:8108:453f:d1a0:28d1:9d88:57f6:f95b]) by smtp.gmail.com with ESMTPSA id r17sm2095134wrg.93.2019.08.14.14.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 14:31:39 -0700 (PDT) From: Karol Herbst To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Cc: Karol Herbst , Alex Hung , "Rafael J . Wysocki" , Dave Airlie , Lyude Paul , Ben Skeggs Subject: [PATCH 7/7] drm/nouveau: abort runtime suspend if we hit an error Date: Wed, 14 Aug 2019 23:31:18 +0200 Message-Id: <20190814213118.28473-8-kherbst@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190814213118.28473-1-kherbst@redhat.com> References: <20190814213118.28473-1-kherbst@redhat.com> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Karol Herbst CC: Alex Hung CC: Rafael J. Wysocki CC: Dave Airlie CC: Lyude Paul CC: Ben Skeggs --- drivers/gpu/drm/nouveau/nouveau_drm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 16441c5bf29c..b16157a9c736 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -910,6 +910,7 @@ nouveau_pmops_runtime_suspend(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); struct drm_device *drm_dev = pci_get_drvdata(pdev); + struct nouveau_drm *drm = nouveau_drm(drm_dev); int ret; if (!nouveau_pmops_runtime()) { @@ -919,6 +920,10 @@ nouveau_pmops_runtime_suspend(struct device *dev) nouveau_switcheroo_optimus_dsm(); ret = nouveau_do_suspend(drm_dev, true); + if (ret) { + NV_ERROR(drm, "suspend failed with: %d\n", ret); + return ret; + } pci_save_state(pdev); pci_disable_device(pdev); pci_ignore_hotplug(pdev);