From 4e3978fa9c496ab91f6536365f3cc7da9637c815 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Fri, 19 Mar 2021 02:42:25 +0100 Subject: [PATCH] Update v4.19 patches Changes: - Update D3cold fix for Surface Book 2 and 3 Links: - kernel: https://github.com/linux-surface/kernel/commit/8709678d1618b75fd086803eeb608a07c4b14e9a --- patches/4.19/0011-surface-hotplug.patch | 134 +++++++++--------- patches/4.19/0012-surface-typecover.patch | 2 +- .../4.19/0013-ath10k-firmware-override.patch | 2 +- pkg/arch/kernel-lts/PKGBUILD | 6 +- 4 files changed, 75 insertions(+), 69 deletions(-) diff --git a/patches/4.19/0011-surface-hotplug.patch b/patches/4.19/0011-surface-hotplug.patch index ad3733e62..1e257cf1f 100644 --- a/patches/4.19/0011-surface-hotplug.patch +++ b/patches/4.19/0011-surface-hotplug.patch @@ -3822,69 +3822,7 @@ index a60eb5780cc0..65bb9c2c1a5b 100644 -- 2.30.2 -From 5891271561fab3ceab1776e4ff74f07252f8deab Mon Sep 17 00:00:00 2001 -From: Maximilian Luz -Date: Mon, 9 Nov 2020 14:23:00 +0100 -Subject: [PATCH] PCI: Run platform power transition on initial D0 entry - -On some devices and platforms, the initial platform power state is not -in sync with the power state of the PCI device. - -pci_enable_device_flags() updates the state of a PCI device by reading -from the the PCI_PM_CTRL register. This may change the stored power -state of the device without running the appropriate platform power -transition. - -Due to the stored power-state being changed, the later call to -pci_set_power_state(..., PCI_D0) in do_pci_enable_device() can evaluate -to a no-op if the stored state has been changed to D0 via that. This -will then prevent the appropriate platform power transition to be run, -which can on some devices and platforms lead to platform and PCI power -state being entirely different, i.e. out-of-sync. On ACPI platforms, -this can lead to power resources not being turned on, even though they -are marked as required for D0. - -Specifically, on the Microsoft Surface Book 2 and 3, some ACPI power -regions that should be "on" for the D0 state (and others) are -initialized as "off" in ACPI, whereas the PCI device is in D0. As the -state is updated in pci_enable_device_flags() without ensuring that the -platform state is also updated, the power resource will never be -properly turned on. Instead, it lives in a sort of on-but-marked-as-off -zombie-state, which confuses things down the line when attempting to -transition the device into D3cold: As the resource is already marked as -off, it won't be turned off and the device does not fully enter D3cold, -causing increased power consumption during (runtime-)suspend. - -By replacing pci_set_power_state() in do_pci_enable_device() with -pci_power_up(), we can force pci_platform_power_transition() to be -called, which will then check if the platform power state needs updating -and appropriate actions need to be taken. - -Signed-off-by: Maximilian Luz -Patchset: surface-hotplug ---- - drivers/pci/pci.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c -index 65bb9c2c1a5b..32491d59c228 100644 ---- a/drivers/pci/pci.c -+++ b/drivers/pci/pci.c -@@ -1520,9 +1520,7 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars) - u16 cmd; - u8 pin; - -- err = pci_set_power_state(dev, PCI_D0); -- if (err < 0 && err != -EIO) -- return err; -+ pci_power_up(dev); - - bridge = pci_upstream_bridge(dev); - if (bridge) --- -2.30.2 - -From a7232efca9e5a255e641d5fc3c2d7799ca9ff0c9 Mon Sep 17 00:00:00 2001 +From 610e7027dab8df21e4b3a2326362ae78a6d51d5b Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 31 Oct 2020 20:46:33 +0100 Subject: [PATCH] PCI: Add sysfs attribute for PCI device power state @@ -3957,7 +3895,75 @@ index 1edf5a1836ea..ee1518650d55 100644 -- 2.30.2 -From 92b49edc96eae541234d8b82fc7a6b63e1c5b545 Mon Sep 17 00:00:00 2001 +From 2a041fad726dd3e677d1864ac497b5013ebcb31a Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Tue, 16 Mar 2021 16:51:40 +0100 +Subject: [PATCH] PCI: PM: Do not read power state in pci_enable_device_flags() + +It should not be necessary to update the current_state field of +struct pci_dev in pci_enable_device_flags() before calling +do_pci_enable_device() for the device, because none of the +code between that point and the pci_set_power_state() call in +do_pci_enable_device() invoked later depends on it. + +Moreover, doing that is actively harmful in some cases. For example, +if the given PCI device depends on an ACPI power resource whose _STA +method initially returns 0 ("off"), but the config space of the PCI +device is accessible and the power state retrieved from the +PCI_PM_CTRL register is D0, the current_state field in the struct +pci_dev representing that device will get out of sync with the +power.state of its ACPI companion object and that will lead to +power management issues going forward. + +To avoid such issues it is better to leave the current_state value +as is until it is changed to PCI_D0 by do_pci_enable_device() as +appropriate. However, the power state of the device is not changed +to PCI_D0 if it is already enabled when pci_enable_device_flags() +gets called for it, so update its current_state in that case, but +use pci_update_current_state() covering platform PM too for that. + +Link: https://lore.kernel.org/lkml/20210314000439.3138941-1-luzmaximilian@gmail.com/ +Reported-by: Maximilian Luz +Tested-by: Maximilian Luz +Signed-off-by: Rafael J. Wysocki +Reviewed-by: Mika Westerberg +Patchset: surface-hotplug +--- + drivers/pci/pci.c | 16 +++------------- + 1 file changed, 3 insertions(+), 13 deletions(-) + +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c +index 65bb9c2c1a5b..5f3f35d314c3 100644 +--- a/drivers/pci/pci.c ++++ b/drivers/pci/pci.c +@@ -1590,20 +1590,10 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags) + int err; + int i, bars = 0; + +- /* +- * Power state could be unknown at this point, either due to a fresh +- * boot or a device removal call. So get the current power state +- * so that things like MSI message writing will behave as expected +- * (e.g. if the device really is in D0 at enable time). +- */ +- if (dev->pm_cap) { +- u16 pmcsr; +- pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); +- dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); +- } +- +- if (atomic_inc_return(&dev->enable_cnt) > 1) ++ if (atomic_inc_return(&dev->enable_cnt) > 1) { ++ pci_update_current_state(dev, dev->current_state); + return 0; /* already enabled */ ++ } + + bridge = pci_upstream_bridge(dev); + if (bridge) +-- +2.30.2 + +From 2a5d784212915740b6b5214bad16caadcd9f53da Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Mon, 14 Dec 2020 20:50:59 +0100 Subject: [PATCH] platform/x86: Add Surface Hotplug driver diff --git a/patches/4.19/0012-surface-typecover.patch b/patches/4.19/0012-surface-typecover.patch index 2e1202f9a..182439189 100644 --- a/patches/4.19/0012-surface-typecover.patch +++ b/patches/4.19/0012-surface-typecover.patch @@ -1,4 +1,4 @@ -From a93521a5b016978f2375de8382eee6d283fcf8b0 Mon Sep 17 00:00:00 2001 +From 26b1ded3e1e9c5481e6297284f8d7dbd515c7138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Thu, 5 Nov 2020 13:09:45 +0100 Subject: [PATCH] hid/multitouch: Turn off Type Cover keyboard backlight when diff --git a/patches/4.19/0013-ath10k-firmware-override.patch b/patches/4.19/0013-ath10k-firmware-override.patch index 7e6f8bda8..0a2a64d1a 100644 --- a/patches/4.19/0013-ath10k-firmware-override.patch +++ b/patches/4.19/0013-ath10k-firmware-override.patch @@ -1,4 +1,4 @@ -From 70905cabdae3c7878e84370bca9ba5972e8102de Mon Sep 17 00:00:00 2001 +From 83c097cfcd24122510c3a2364567e246b8451a11 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 27 Feb 2021 00:45:52 +0100 Subject: [PATCH] ath10k: Add module parameters to override board files diff --git a/pkg/arch/kernel-lts/PKGBUILD b/pkg/arch/kernel-lts/PKGBUILD index e975b7b53..3edb517d1 100644 --- a/pkg/arch/kernel-lts/PKGBUILD +++ b/pkg/arch/kernel-lts/PKGBUILD @@ -55,9 +55,9 @@ sha256sums=('5218ee33e92d9010e28d6cab62bf8c774a4f22d89747045920dc60fdd531a9cd' 'e943d455ffbf11b3a5fa596246c4246440b9b8fd7aaec63bcaeb04698f8a8b32' '8726cce41fe52662d67521703bfcda366b9e451bd161eaa457bc4bc9da057407' '2de5dc56ae244166e4fc9d0cb9469573a91e4c1ef757e2a6a27839b8342a19bc' - '1a43b2da6b1c5ea732e6214b9bfa8e06eab7395c066eb1618cd34d20451b45cd' - 'bd7c10da26c584249a0ce3aef42ed92077dd5826ce67a9e8f9df829dbb23943c' - 'fba372e779b9dd6c243ea1d7f70f46edbf009cfb9fdce5dc231896cf894b393d') + 'dee8749585043597227ba07873f57576247f5e3307e53c2694f370bb6f17303b' + 'dbd7cd2a7360c0fcd91d282abc81086a7a6f3bc848818f9019dd856530a00863' + '4bcad50b9c92e1039e39b9bea57416b606b5cc78842a62108fa4135d17ea67c1') export KBUILD_BUILD_HOST=archlinux export KBUILD_BUILD_USER=$pkgbase