Skip to content

Instantly share code, notes, and snippets.

View kwilczynski's full-sized avatar
πŸ€

Krzysztof WilczyΕ„ski kwilczynski

πŸ€
View GitHub Profile
#!/usr/bin/env python3
import os, re, sys
def kib(v):
n, u = (v.split() + ['B'])[:2]
return int(n) * {'B': 1 / 1024, 'KiB': 1, 'MiB': 1024, 'GiB': 1024 * 1024}[u]
clients = {}
for pid in filter(str.isdigit, os.listdir('/proc')):
try:
@kwilczynski
kwilczynski / 9002-platform-x86-amd-pmc-ms-s1-max-lps0-quirk.patch
Created October 8, 2026 22:27 — forked from hjanuschka/9002-platform-x86-amd-pmc-ms-s1-max-lps0-quirk.patch
amd_pmc: skip LPS0 handler on MINISFORUM MS-S1 MAX (firmware only implements Microsoft LPS0 _DSM via SMI; OS_HINT hangs s2idle)
From: Helmut Januschka <helmut@januschka.com>
Subject: [PATCH] platform/x86/amd/pmc: firmware-handled LPS0 quirk for MINISFORUM MS-S1 MAX
The MINISFORUM MS-S1 MAX (SHWSA, Strix Halo) ships firmware whose LPS0
PEP device only implements the Microsoft _DSM UUID; its entry/exit
functions trap into SMM (port 0xB2, 0xEA/0xEB) and perform the platform
sleep handshake there. The AMD _DSM UUID advertises no entry/exit
functions at all (function mask 0x3).
When amd_pmc additionally sends OS_HINT, s2idle never resumes: with both
● The VRR power run is complete. The email (VRR power results plus the Bluetooth correction) went to kw@linux.com at 03:06, and msmtp returned 250. 107 runs its default kernel, linux-omarchy-bore.
Result (RAPL psys, mean of 3 windows per kernel and case; boot order ptl, base, bore, bore, base, ptl, ptl, base, bore):
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Case β”‚ linux-ptl 7.1.11 β”‚ linux-omarchy 7.2.8-2 β”‚ linux-omarchy-bore 7.2.8-2 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Panel off β”‚ 4.86 W β”‚ 4.88 W β”‚ 4.87 W β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
--- a/drivers/thunderbolt/domain.c
+++ b/drivers/thunderbolt/domain.c
@@ -909,6 +909,10 @@ int tb_domain_init(void)
{
int ret;
+ ret = tb_pci_rescan_init();
+ if (ret)
+ return ret;
@kwilczynski
kwilczynski / output.txt
Last active June 2, 2026 14:27
System Sensors Summary on B850 based motherboard
System Sensors Summary
CPU (AMD Ryzen)
──────────────────────────────────────────────────
Tctl: 47.6Β°C
CCD1: 39.6Β°C
CCD2: 37.6Β°C
Motherboard (ASUS)
──────────────────────────────────────────────────
@kwilczynski
kwilczynski / trailers.txt
Last active March 26, 2025 06:15
Linux kernel tag (trailers) order
* PCI legacy (from https://lore.kernel.org/all/20171026223701.GA25649@bhelgaas-glaptop.roam.corp.google.com):
Fixes:
Closes: (link or Message-ID]
Suggested-by:
Link:
Reported-by:
Tested-by:
Co-developed-by: (co-author)
Signed-off-by: (co-author)
Jan 11 11:48:06 rocinante kernel: [17610.105025] amdgpu 0000:03:00.0: amdgpu: Dumping IP State
Jan 11 11:48:06 rocinante kernel: [17610.106837] amdgpu 0000:03:00.0: amdgpu: Dumping IP State Completed
Jan 11 11:48:06 rocinante kernel: [17610.106864] amdgpu 0000:03:00.0: amdgpu: ring sdma0 timeout, signaled seq=165765, emitted seq=165768
Jan 11 11:48:06 rocinante kernel: [17610.106867] amdgpu 0000:03:00.0: amdgpu: GPU reset begin!
Jan 11 11:48:06 rocinante kernel: [17610.106918] amdgpu 0000:03:00.0: amdgpu: Failed to disallow df cstate
Jan 11 11:48:06 rocinante kernel: [17610.137182] ------------[ cut here ]------------
Jan 11 11:48:06 rocinante kernel: [17610.137183] WARNING: CPU: 18 PID: 2156760 at drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c:631 amdgpu_irq_put+0x9f/0xb0 [amdgpu]
Jan 11 11:48:06 rocinante kernel: [17610.137349] Modules linked in: uhid rfcomm cmac algif_hash algif_skcipher af_alg xt_conntrack nft_chain_nat xt_MASQUERADE nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 bridge stp llc xfrm_user xfrm
root@workstation:/home/kwilczynski/Projects/Personal/Linux/pci# make V=12 LLVM=-19 ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu -j$(nproc) drivers/pci/controller/pcie-rockchip-ep.o
make --no-print-directory -C /home/kwilczynski/Development/Projects/Personal/Linux/pci \
-f /home/kwilczynski/Development/Projects/Personal/Linux/pci/Makefile drivers/pci/controller/pcie-rockchip-ep.o
: " SYNC include/config/auto.conf.cmd"
make -f ./Makefile syncconfig
make -f ./scripts/Makefile.build obj=scripts/basic
make -f ./scripts/Makefile.build obj=scripts/kconfig syncconfig
scripts/kconfig/conf --syncconfig Kconfig
make -f ./scripts/Makefile.build obj=arch/x86/entry/syscalls all
make -f ./scripts/Makefile.build obj=scripts/basic
aarch64-linux-gnu-gcc -MM -H -Wp,-MMD,drivers/pci/controller/.pcie-rockchip-ep.o.d -nostdinc -I./arch/arm64/include -I./arch/arm64/include/generated -I./include -I./arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -mlittle-endian -DKASAN_SHADOW_SCALE_SHIFT= -fmacro-prefix-map=./= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -mgeneral-regs-only -DCONFIG_CC_HAS_K_CONSTRAINT=1 -Wno-psabi -mabi=lp64 -fno-asynchronous-unwind-tables -fno-unwind-tables -mbranch-protection=pac-ret -Wa,-march=armv8.5-a -DARM64_ASM_ARCH='"armv8.5-a"' -DKASAN_SHADOW_SCALE_SHIFT= -fno-delete-null-pointer-checks -O2 -fno-allow-store-data-races -fstack-protector-strong -fno-omit-frame-pointer -fno-optimize-sibling-calls -ftrivial-auto-var-init=zero -fno-stack-clash-protection -falign-functions=4 -fno-strict-overfl
@kwilczynski
kwilczynski / script.sh
Last active June 24, 2024 00:49
Build ccache
cd ./ccache/build
make clean
export PATH='/usr/local/bin:/usr/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
ccmake -DDEPS=DOWNLOAD -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF -DREDIS_STORAGE_BACKEND=OFF -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_SYSCONFDIR=/etc ..
make -j$(nproc)
make DESTDIR='/tmp/ccache' PREFIX='/usr' install