From ade11928761cce8fd32f95560b3ab7c6a6c03d55 Mon Sep 17 00:00:00 2001 From: LionHeartP Date: Mon, 17 Feb 2025 19:36:41 +0200 Subject: [PATCH] Kernel 6.13.3 --- ...-REBAR-size-quirk-for-Sapphire-RX-56.patch | 34 - .../kernel/6.13/0001-cachyos-base-all.patch | 661 +++--- .../PCI-fix-Sapphire-PCI-rebar-quirk.patch | 12 + baseos/kernel/6.13/asus-patch-series.patch | 2021 +++++++++-------- baseos/kernel/6.13/config | 7 +- baseos/kernel/6.13/kernel.spec | 7 +- .../6.13/legion-16arx8h-hda-quirk.patch | 13 - 7 files changed, 1444 insertions(+), 1311 deletions(-) delete mode 100644 baseos/kernel/6.13/0001-Revert-PCI-Add-a-REBAR-size-quirk-for-Sapphire-RX-56.patch create mode 100644 baseos/kernel/6.13/PCI-fix-Sapphire-PCI-rebar-quirk.patch delete mode 100644 baseos/kernel/6.13/legion-16arx8h-hda-quirk.patch diff --git a/baseos/kernel/6.13/0001-Revert-PCI-Add-a-REBAR-size-quirk-for-Sapphire-RX-56.patch b/baseos/kernel/6.13/0001-Revert-PCI-Add-a-REBAR-size-quirk-for-Sapphire-RX-56.patch deleted file mode 100644 index dd8f961..0000000 --- a/baseos/kernel/6.13/0001-Revert-PCI-Add-a-REBAR-size-quirk-for-Sapphire-RX-56.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 4b4ce124699c160925e5fdeb147a78f79d38351f Mon Sep 17 00:00:00 2001 -From: Simon May -Date: Sun, 19 Sep 2021 23:45:59 +0200 -Subject: [PATCH] Revert "PCI: Add a REBAR size quirk for Sapphire RX 5600 XT - Pulse" - -This reverts commit 907830b0fc9e374d00f3c83de5e426157b482c01. ---- - drivers/pci/pci.c | 9 +-------- - 1 file changed, 1 insertion(+), 8 deletions(-) - -diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c -index a607f277c..3174fa871 100644 ---- a/drivers/pci/pci.c -+++ b/drivers/pci/pci.c -@@ -3755,14 +3755,8 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar) - return 0; - - pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap); -- cap = FIELD_GET(PCI_REBAR_CAP_SIZES, cap); - -- /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */ -- if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f && -- bar == 0 && cap == 0x700) -- return 0x3f00; -- -- return cap; -+ return (cap & PCI_REBAR_CAP_SIZES) >> 4; - } - EXPORT_SYMBOL(pci_rebar_get_possible_sizes); - --- -2.30.2 - diff --git a/baseos/kernel/6.13/0001-cachyos-base-all.patch b/baseos/kernel/6.13/0001-cachyos-base-all.patch index 4d8a3c0..8108b0b 100644 --- a/baseos/kernel/6.13/0001-cachyos-base-all.patch +++ b/baseos/kernel/6.13/0001-cachyos-base-all.patch @@ -1,6 +1,6 @@ -From dd5205fde48cf230cebc74befe37b40f7fa82e71 Mon Sep 17 00:00:00 2001 +From 7ab1776e0655d3eee1b58834caa1a26994a08d67 Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:35:37 +0100 +Date: Mon, 17 Feb 2025 16:28:48 +0100 Subject: [PATCH 01/12] amd-pstate Signed-off-by: Peter Jung @@ -1035,36 +1035,39 @@ index cd573bc6b6db..9747e3be6cee 100644 -- 2.48.0.rc1 -From 767e13bd27f2b785fa83186a99106e5d349896cf Mon Sep 17 00:00:00 2001 +From c01c10767015f219e780922e3c96f575a12209c1 Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:36:03 +0100 +Date: Mon, 17 Feb 2025 16:30:20 +0100 Subject: [PATCH 02/12] amd-tlb-broadcast Signed-off-by: Peter Jung --- - arch/x86/Kconfig | 2 +- - arch/x86/Kconfig.cpu | 5 + - arch/x86/hyperv/mmu.c | 1 - - arch/x86/include/asm/cpufeatures.h | 1 + - arch/x86/include/asm/invlpgb.h | 106 +++++ - arch/x86/include/asm/mmu.h | 6 + - arch/x86/include/asm/mmu_context.h | 14 + - arch/x86/include/asm/msr-index.h | 2 + - arch/x86/include/asm/paravirt.h | 5 - - arch/x86/include/asm/paravirt_types.h | 2 - - arch/x86/include/asm/tlbflush.h | 98 ++++- - arch/x86/kernel/cpu/amd.c | 12 + - arch/x86/kernel/kvm.c | 1 - - arch/x86/kernel/paravirt.c | 6 - - arch/x86/mm/pgtable.c | 16 +- - arch/x86/mm/tlb.c | 518 +++++++++++++++++++++++-- - arch/x86/xen/mmu_pv.c | 1 - - mm/memory.c | 1 - - mm/mmap.c | 2 - - mm/swap_state.c | 1 - - mm/vma.c | 2 - - tools/arch/x86/include/asm/msr-index.h | 2 + - 22 files changed, 723 insertions(+), 81 deletions(-) + arch/x86/Kconfig | 2 +- + arch/x86/Kconfig.cpu | 5 + + arch/x86/hyperv/mmu.c | 1 - + arch/x86/include/asm/cpufeatures.h | 1 + + arch/x86/include/asm/disabled-features.h | 8 +- + arch/x86/include/asm/invlpgb.h | 107 +++++ + arch/x86/include/asm/mmu.h | 8 + + arch/x86/include/asm/mmu_context.h | 15 + + arch/x86/include/asm/msr-index.h | 2 + + arch/x86/include/asm/paravirt.h | 5 - + arch/x86/include/asm/paravirt_types.h | 2 - + arch/x86/include/asm/tlbflush.h | 101 ++++- + arch/x86/kernel/alternative.c | 10 +- + arch/x86/kernel/cpu/amd.c | 12 + + arch/x86/kernel/kvm.c | 1 - + arch/x86/kernel/paravirt.c | 6 - + arch/x86/mm/pgtable.c | 16 +- + arch/x86/mm/tlb.c | 553 +++++++++++++++++++++-- + arch/x86/xen/mmu_pv.c | 1 - + include/linux/mm_types.h | 1 + + mm/memory.c | 1 - + mm/mmap.c | 2 - + mm/swap_state.c | 1 - + mm/vma.c | 2 - + tools/arch/x86/include/asm/msr-index.h | 2 + + 25 files changed, 768 insertions(+), 97 deletions(-) create mode 100644 arch/x86/include/asm/invlpgb.h diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig @@ -1125,12 +1128,38 @@ index 645aa360628d..989e4c9cad2e 100644 #define X86_FEATURE_RDPRU (13*32+ 4) /* "rdpru" Read processor register at user level */ #define X86_FEATURE_WBNOINVD (13*32+ 9) /* "wbnoinvd" WBNOINVD instruction */ #define X86_FEATURE_AMD_IBPB (13*32+12) /* Indirect Branch Prediction Barrier */ +diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h +index c492bdc97b05..625a89259968 100644 +--- a/arch/x86/include/asm/disabled-features.h ++++ b/arch/x86/include/asm/disabled-features.h +@@ -129,6 +129,12 @@ + #define DISABLE_SEV_SNP (1 << (X86_FEATURE_SEV_SNP & 31)) + #endif + ++#ifdef CONFIG_X86_BROADCAST_TLB_FLUSH ++#define DISABLE_INVLPGB 0 ++#else ++#define DISABLE_INVLPGB (1 << (X86_FEATURE_INVLPGB & 31)) ++#endif ++ + /* + * Make sure to add features to the correct mask + */ +@@ -146,7 +152,7 @@ + #define DISABLED_MASK11 (DISABLE_RETPOLINE|DISABLE_RETHUNK|DISABLE_UNRET| \ + DISABLE_CALL_DEPTH_TRACKING|DISABLE_USER_SHSTK) + #define DISABLED_MASK12 (DISABLE_FRED|DISABLE_LAM) +-#define DISABLED_MASK13 0 ++#define DISABLED_MASK13 (DISABLE_INVLPGB) + #define DISABLED_MASK14 0 + #define DISABLED_MASK15 0 + #define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP| \ diff --git a/arch/x86/include/asm/invlpgb.h b/arch/x86/include/asm/invlpgb.h new file mode 100644 -index 000000000000..9df559974f78 +index 000000000000..220aba708b72 --- /dev/null +++ b/arch/x86/include/asm/invlpgb.h -@@ -0,0 +1,106 @@ +@@ -0,0 +1,107 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_INVLPGB +#define _ASM_X86_INVLPGB @@ -1166,6 +1195,7 @@ index 000000000000..9df559974f78 +/* Wait for INVLPGB originated by this CPU to complete. */ +static inline void __tlbsync(void) +{ ++ cant_migrate(); + /* TLBSYNC: supported in binutils >= 0.36. */ + asm volatile(".byte 0x0f, 0x01, 0xff" ::: "memory"); +} @@ -1238,10 +1268,19 @@ index 000000000000..9df559974f78 + +#endif /* _ASM_X86_INVLPGB */ diff --git a/arch/x86/include/asm/mmu.h b/arch/x86/include/asm/mmu.h -index ce4677b8b735..51f25d38de86 100644 +index ce4677b8b735..d71cd599fec4 100644 --- a/arch/x86/include/asm/mmu.h +++ b/arch/x86/include/asm/mmu.h -@@ -67,6 +67,12 @@ typedef struct { +@@ -37,6 +37,8 @@ typedef struct { + */ + atomic64_t tlb_gen; + ++ unsigned long next_trim_cpumask; ++ + #ifdef CONFIG_MODIFY_LDT_SYSCALL + struct rw_semaphore ldt_usr_sem; + struct ldt_struct *ldt; +@@ -67,6 +69,12 @@ typedef struct { u16 pkey_allocation_map; s16 execute_only_pkey; #endif @@ -1255,7 +1294,7 @@ index ce4677b8b735..51f25d38de86 100644 #define INIT_MM_CONTEXT(mm) \ diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h -index 2886cb668d7f..65f50464b5c3 100644 +index 2886cb668d7f..d670699d32c2 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h @@ -139,6 +139,8 @@ static inline void mm_reset_untag_mask(struct mm_struct *mm) @@ -1267,7 +1306,15 @@ index 2886cb668d7f..65f50464b5c3 100644 /* * Init a new mm. Used on mm copies, like at fork() * and on mm's that are brand-new, like at execve(). -@@ -160,6 +162,14 @@ static inline int init_new_context(struct task_struct *tsk, +@@ -151,6 +153,7 @@ static inline int init_new_context(struct task_struct *tsk, + + mm->context.ctx_id = atomic64_inc_return(&last_mm_ctx_id); + atomic64_set(&mm->context.tlb_gen, 0); ++ mm->context.next_trim_cpumask = jiffies + HZ; + + #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS + if (cpu_feature_enabled(X86_FEATURE_OSPKE)) { +@@ -160,6 +163,14 @@ static inline int init_new_context(struct task_struct *tsk, mm->context.execute_only_pkey = -1; } #endif @@ -1282,7 +1329,7 @@ index 2886cb668d7f..65f50464b5c3 100644 mm_reset_untag_mask(mm); init_new_context_ldt(mm); return 0; -@@ -169,6 +179,10 @@ static inline int init_new_context(struct task_struct *tsk, +@@ -169,6 +180,10 @@ static inline int init_new_context(struct task_struct *tsk, static inline void destroy_context(struct mm_struct *mm) { destroy_context_ldt(mm); @@ -1343,7 +1390,7 @@ index 8d4fbe1be489..13405959e4db 100644 void (*exit_mmap)(struct mm_struct *mm); void (*notify_page_enc_status_changed)(unsigned long pfn, int npages, bool enc); diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h -index 69e79fff41b8..30697dabf9e1 100644 +index 69e79fff41b8..89dddbcd1322 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -6,10 +6,12 @@ @@ -1359,15 +1406,17 @@ index 69e79fff41b8..30697dabf9e1 100644 #include #include #include -@@ -104,6 +106,7 @@ struct tlb_state { +@@ -104,6 +106,9 @@ struct tlb_state { * need to be invalidated. */ bool invalidate_other; ++#ifdef CONFIG_X86_BROADCAST_TLB_FLUSH + bool need_tlbsync; ++#endif #ifdef CONFIG_ADDRESS_MASKING /* -@@ -183,6 +186,13 @@ static inline void cr4_init_shadow(void) +@@ -183,6 +188,13 @@ static inline void cr4_init_shadow(void) extern unsigned long mmu_cr4_features; extern u32 *trampoline_cr4_features; @@ -1381,7 +1430,15 @@ index 69e79fff41b8..30697dabf9e1 100644 extern void initialize_tlbstate_and_flush(void); /* -@@ -230,6 +240,82 @@ void flush_tlb_one_kernel(unsigned long addr); +@@ -222,6 +234,7 @@ struct flush_tlb_info { + unsigned int initiating_cpu; + u8 stride_shift; + u8 freed_tables; ++ u8 trim_cpumask; + }; + + void flush_tlb_local(void); +@@ -230,6 +243,82 @@ void flush_tlb_one_kernel(unsigned long addr); void flush_tlb_multi(const struct cpumask *cpumask, const struct flush_tlb_info *info); @@ -1464,7 +1521,7 @@ index 69e79fff41b8..30697dabf9e1 100644 #ifdef CONFIG_PARAVIRT #include #endif -@@ -277,21 +363,15 @@ static inline u64 inc_mm_tlb_gen(struct mm_struct *mm) +@@ -277,21 +366,15 @@ static inline u64 inc_mm_tlb_gen(struct mm_struct *mm) return atomic64_inc_return(&mm->context.tlb_gen); } @@ -1489,6 +1546,39 @@ index 69e79fff41b8..30697dabf9e1 100644 static inline bool pte_flags_need_flush(unsigned long oldflags, unsigned long newflags, +diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c +index 243843e44e89..c71b575bf229 100644 +--- a/arch/x86/kernel/alternative.c ++++ b/arch/x86/kernel/alternative.c +@@ -1854,11 +1854,18 @@ static inline temp_mm_state_t use_temporary_mm(struct mm_struct *mm) + return temp_state; + } + ++__ro_after_init struct mm_struct *poking_mm; ++__ro_after_init unsigned long poking_addr; ++ + static inline void unuse_temporary_mm(temp_mm_state_t prev_state) + { + lockdep_assert_irqs_disabled(); ++ + switch_mm_irqs_off(NULL, prev_state.mm, current); + ++ /* Clear the cpumask, to indicate no TLB flushing is needed anywhere */ ++ cpumask_clear_cpu(raw_smp_processor_id(), mm_cpumask(poking_mm)); ++ + /* + * Restore the breakpoints if they were disabled before the temporary mm + * was loaded. +@@ -1867,9 +1874,6 @@ static inline void unuse_temporary_mm(temp_mm_state_t prev_state) + hw_breakpoint_restore(); + } + +-__ro_after_init struct mm_struct *poking_mm; +-__ro_after_init unsigned long poking_addr; +- + static void text_poke_memcpy(void *dst, const void *src, size_t len) + { + memcpy(dst, src, len); diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 79d2e17f6582..21076252a491 100644 --- a/arch/x86/kernel/cpu/amd.c @@ -1617,7 +1707,7 @@ index 5745a354a241..3dc4af1f7868 100644 #endif /* CONFIG_PGTABLE_LEVELS > 4 */ #endif /* CONFIG_PGTABLE_LEVELS > 3 */ diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c -index a2becb85bea7..e7f32b00d8fb 100644 +index a2becb85bea7..482b7def3677 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -74,13 +74,15 @@ @@ -1647,7 +1737,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 + * TLB consistency for global ASIDs is maintained with broadcast TLB + * flushing. The TLB is never outdated, and does not need flushing. + */ -+ if (IS_ENABLED(CONFIG_X86_BROADCAST_TLB_FLUSH) && static_cpu_has(X86_FEATURE_INVLPGB)) { ++ if (static_cpu_has(X86_FEATURE_INVLPGB)) { + u16 global_asid = mm_global_asid(next); + + if (global_asid) { @@ -1660,7 +1750,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 if (this_cpu_read(cpu_tlbstate.invalidate_other)) clear_asid_other(); -@@ -251,6 +267,304 @@ static void choose_new_asid(struct mm_struct *next, u64 next_tlb_gen, +@@ -251,6 +267,301 @@ static void choose_new_asid(struct mm_struct *next, u64 next_tlb_gen, *need_flush = true; } @@ -1717,7 +1807,8 @@ index a2becb85bea7..e7f32b00d8fb 100644 + + if (asid >= MAX_ASID_AVAILABLE) { + /* This should never happen. */ -+ VM_WARN_ONCE(1, "Unable to allocate global ASID despite %d available\n", global_asid_available); ++ VM_WARN_ONCE(1, "Unable to allocate global ASID despite %d available\n", ++ global_asid_available); + return 0; + } + @@ -1736,9 +1827,11 @@ index a2becb85bea7..e7f32b00d8fb 100644 +{ + u16 global_asid = mm_global_asid(next); + ++ /* Process is transitioning to a global ASID */ + if (global_asid && prev_asid != global_asid) + return true; + ++ /* Transition from global->local ASID does not currently happen. */ + if (!global_asid && is_global_asid(prev_asid)) + return true; + @@ -1821,18 +1914,12 @@ index a2becb85bea7..e7f32b00d8fb 100644 + smp_store_release(&mm->context.global_asid, asid); +} + -+static bool meets_global_asid_threshold(struct mm_struct *mm) -+{ -+ if (!global_asid_available) -+ return false; -+ -+ /* -+ * Assign a global ASID if the process is active on -+ * 4 or more CPUs simultaneously. -+ */ -+ return mm_active_cpus_exceeds(mm, 3); -+} -+ ++/* ++ * x86 has 4k ASIDs (2k when compiled with KPTI), but the largest ++ * x86 systems have over 8k CPUs. Because of this potential ASID ++ * shortage, global ASIDs are handed out to processes that have ++ * frequent TLB flushes and are active on 4 or more CPUs simultaneously. ++ */ +static void consider_global_asid(struct mm_struct *mm) +{ + if (!static_cpu_has(X86_FEATURE_INVLPGB)) @@ -1842,7 +1929,14 @@ index a2becb85bea7..e7f32b00d8fb 100644 + if ((current->pid & 0x1f) != (jiffies & 0x1f)) + return; + -+ if (meets_global_asid_threshold(mm)) ++ if (!READ_ONCE(global_asid_available)) ++ return; ++ ++ /* ++ * Assign a global ASID if the process is active on ++ * 4 or more CPUs simultaneously. ++ */ ++ if (mm_active_cpus_exceeds(mm, 3)) + use_global_asid(mm); +} + @@ -1920,14 +2014,8 @@ index a2becb85bea7..e7f32b00d8fb 100644 +static void broadcast_tlb_flush(struct flush_tlb_info *info) +{ + bool pmd = info->stride_shift == PMD_SHIFT; -+ unsigned long maxnr = invlpgb_count_max; + unsigned long asid = info->mm->context.global_asid; + unsigned long addr = info->start; -+ unsigned long nr; -+ -+ /* Flushing multiple pages at once is not supported with 1GB pages. */ -+ if (info->stride_shift > PMD_SHIFT) -+ maxnr = 1; + + /* + * TLB flushes with INVLPGB are kicked off asynchronously. @@ -1940,15 +2028,14 @@ index a2becb85bea7..e7f32b00d8fb 100644 + if (static_cpu_has(X86_FEATURE_PTI)) + invlpgb_flush_single_pcid_nosync(user_pcid(asid)); + } else do { -+ /* -+ * Calculate how many pages can be flushed at once; if the -+ * remainder of the range is less than one page, flush one. -+ */ -+ nr = min(maxnr, (info->end - addr) >> info->stride_shift); -+ nr = max(nr, 1); ++ unsigned long nr = 1; ++ ++ if (info->stride_shift <= PMD_SHIFT) { ++ nr = (info->end - addr) >> info->stride_shift; ++ nr = clamp_val(nr, 1, invlpgb_count_max); ++ } + + invlpgb_flush_user_nr_nosync(kern_pcid(asid), addr, nr, pmd, info->freed_tables); -+ /* Do any CPUs supporting INVLPGB need PTI? */ + if (static_cpu_has(X86_FEATURE_PTI)) + invlpgb_flush_user_nr_nosync(user_pcid(asid), addr, nr, pmd, info->freed_tables); + @@ -1965,7 +2052,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 /* * Given an ASID, flush the corresponding user ASID. We can delay this * until the next time we switch to it. -@@ -512,6 +826,8 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, +@@ -512,6 +823,8 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, if (IS_ENABLED(CONFIG_PROVE_LOCKING)) WARN_ON_ONCE(!irqs_disabled()); @@ -1974,7 +2061,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 /* * Verify that CR3 is what we think it is. This will catch * hypothetical buggy code that directly switches to swapper_pg_dir -@@ -556,8 +872,9 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, +@@ -556,8 +869,9 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, */ if (prev == next) { /* Not actually switching mm's */ @@ -1986,7 +2073,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 /* * If this races with another thread that enables lam, 'new_lam' -@@ -573,6 +890,23 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, +@@ -573,6 +887,23 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, !cpumask_test_cpu(cpu, mm_cpumask(next)))) cpumask_set_cpu(cpu, mm_cpumask(next)); @@ -2010,21 +2097,36 @@ index a2becb85bea7..e7f32b00d8fb 100644 /* * If the CPU is not in lazy TLB mode, we are just switching * from one thread in a process to another thread in the same -@@ -606,6 +940,13 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, - */ +@@ -607,30 +938,32 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, cond_mitigation(tsk); -+ /* + /* +- * Stop remote flushes for the previous mm. +- * Skip kernel threads; we never send init_mm TLB flushing IPIs, +- * but the bitmap manipulation can cause cache line contention. + * Let nmi_uaccess_okay() and finish_asid_transition() + * know that we're changing CR3. -+ */ + */ +- if (prev != &init_mm) { +- VM_WARN_ON_ONCE(!cpumask_test_cpu(cpu, +- mm_cpumask(prev))); +- cpumask_clear_cpu(cpu, mm_cpumask(prev)); +- } + this_cpu_write(cpu_tlbstate.loaded_mm, LOADED_MM_SWITCHING); + barrier(); + - /* - * Stop remote flushes for the previous mm. - * Skip kernel threads; we never send init_mm TLB flushing IPIs, -@@ -623,14 +964,12 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, ++ /* ++ * Leave this CPU in prev's mm_cpumask. Atomic writes to ++ * mm_cpumask can be expensive under contention. The CPU ++ * will be removed lazily at TLB flush time. ++ */ ++ VM_WARN_ON_ONCE(prev != &init_mm && !cpumask_test_cpu(cpu, ++ mm_cpumask(prev))); + + /* Start receiving IPIs and then read tlb_gen (and LAM below) */ +- if (next != &init_mm) ++ if (next != &init_mm && !cpumask_test_cpu(cpu, mm_cpumask(next))) + cpumask_set_cpu(cpu, mm_cpumask(next)); next_tlb_gen = atomic64_read(&next->context.tlb_gen); choose_new_asid(next, next_tlb_gen, &new_asid, &need_flush); @@ -2041,7 +2143,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 this_cpu_write(cpu_tlbstate.ctxs[new_asid].ctx_id, next->context.ctx_id); this_cpu_write(cpu_tlbstate.ctxs[new_asid].tlb_gen, next_tlb_gen); load_new_mm_cr3(next->pgd, new_asid, new_lam, true); -@@ -671,6 +1010,8 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, +@@ -671,6 +1004,8 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, */ void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) { @@ -2050,7 +2152,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 if (this_cpu_read(cpu_tlbstate.loaded_mm) == &init_mm) return; -@@ -749,7 +1090,7 @@ static void flush_tlb_func(void *info) +@@ -749,7 +1084,7 @@ static void flush_tlb_func(void *info) const struct flush_tlb_info *f = info; struct mm_struct *loaded_mm = this_cpu_read(cpu_tlbstate.loaded_mm); u32 loaded_mm_asid = this_cpu_read(cpu_tlbstate.loaded_mm_asid); @@ -2059,7 +2161,22 @@ index a2becb85bea7..e7f32b00d8fb 100644 bool local = smp_processor_id() == f->initiating_cpu; unsigned long nr_invalidate = 0; u64 mm_tlb_gen; -@@ -769,6 +1110,16 @@ static void flush_tlb_func(void *info) +@@ -760,15 +1095,28 @@ static void flush_tlb_func(void *info) + if (!local) { + inc_irq_stat(irq_tlb_count); + count_vm_tlb_event(NR_TLB_REMOTE_FLUSH_RECEIVED); ++ } + +- /* Can only happen on remote CPUs */ +- if (f->mm && f->mm != loaded_mm) +- return; ++ /* The CPU was left in the mm_cpumask of the target mm. Clear it. */ ++ if (f->mm && f->mm != loaded_mm) { ++ cpumask_clear_cpu(raw_smp_processor_id(), mm_cpumask(f->mm)); ++ trace_tlb_flush(TLB_REMOTE_WRONG_CPU, 0); ++ return; + } + if (unlikely(loaded_mm == &init_mm)) return; @@ -2076,7 +2193,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 VM_WARN_ON(this_cpu_read(cpu_tlbstate.ctxs[loaded_mm_asid].ctx_id) != loaded_mm->context.ctx_id); -@@ -786,6 +1137,8 @@ static void flush_tlb_func(void *info) +@@ -786,6 +1134,8 @@ static void flush_tlb_func(void *info) return; } @@ -2085,7 +2202,46 @@ index a2becb85bea7..e7f32b00d8fb 100644 if (unlikely(f->new_tlb_gen != TLB_GENERATION_INVALID && f->new_tlb_gen <= local_tlb_gen)) { /* -@@ -926,7 +1279,7 @@ STATIC_NOPV void native_flush_tlb_multi(const struct cpumask *cpumask, +@@ -893,9 +1243,36 @@ static void flush_tlb_func(void *info) + nr_invalidate); + } + +-static bool tlb_is_not_lazy(int cpu, void *data) ++static bool should_flush_tlb(int cpu, void *data) ++{ ++ struct flush_tlb_info *info = data; ++ ++ /* Lazy TLB will get flushed at the next context switch. */ ++ if (per_cpu(cpu_tlbstate_shared.is_lazy, cpu)) ++ return false; ++ ++ /* No mm means kernel memory flush. */ ++ if (!info->mm) ++ return true; ++ ++ /* The target mm is loaded, and the CPU is not lazy. */ ++ if (per_cpu(cpu_tlbstate.loaded_mm, cpu) == info->mm) ++ return true; ++ ++ /* In cpumask, but not the loaded mm? Periodically remove by flushing. */ ++ if (info->trim_cpumask) ++ return true; ++ ++ return false; ++} ++ ++static bool should_trim_cpumask(struct mm_struct *mm) + { +- return !per_cpu(cpu_tlbstate_shared.is_lazy, cpu); ++ if (time_after(jiffies, READ_ONCE(mm->context.next_trim_cpumask))) { ++ WRITE_ONCE(mm->context.next_trim_cpumask, jiffies + HZ); ++ return true; ++ } ++ return false; + } + + DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state_shared, cpu_tlbstate_shared); +@@ -926,10 +1303,10 @@ STATIC_NOPV void native_flush_tlb_multi(const struct cpumask *cpumask, * up on the new contents of what used to be page tables, while * doing a speculative memory access. */ @@ -2093,29 +2249,16 @@ index a2becb85bea7..e7f32b00d8fb 100644 + if (info->freed_tables || in_asid_transition(info->mm)) on_each_cpu_mask(cpumask, flush_tlb_func, (void *)info, true); else - on_each_cpu_cond_mask(tlb_is_not_lazy, flush_tlb_func, -@@ -973,14 +1326,32 @@ static struct flush_tlb_info *get_flush_tlb_info(struct mm_struct *mm, - BUG_ON(this_cpu_inc_return(flush_tlb_info_idx) != 1); - #endif +- on_each_cpu_cond_mask(tlb_is_not_lazy, flush_tlb_func, ++ on_each_cpu_cond_mask(should_flush_tlb, flush_tlb_func, + (void *)info, 1, cpumask); + } -- info->start = start; -- info->end = end; -+ /* -+ * Round the start and end addresses to the page size specified -+ * by the stride shift. This ensures partial pages at the end of -+ * a range get fully invalidated. -+ */ -+ info->start = round_down(start, 1 << stride_shift); -+ info->end = round_up(end, 1 << stride_shift); - info->mm = mm; - info->stride_shift = stride_shift; +@@ -980,6 +1357,16 @@ static struct flush_tlb_info *get_flush_tlb_info(struct mm_struct *mm, info->freed_tables = freed_tables; info->new_tlb_gen = new_tlb_gen; info->initiating_cpu = smp_processor_id(); - -+ WARN_ONCE(start != info->start || end != info->end, -+ "TLB flush not stride %x aligned. Start %lx, end %lx\n", -+ 1 << stride_shift, start, end); ++ info->trim_cpumask = 0; + + /* + * If the number of flushes is so large that a full flush @@ -2125,11 +2268,10 @@ index a2becb85bea7..e7f32b00d8fb 100644 + info->start = 0; + info->end = TLB_FLUSH_ALL; + } -+ + return info; } - -@@ -998,17 +1369,8 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, +@@ -998,17 +1385,8 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, bool freed_tables) { struct flush_tlb_info *info; @@ -2148,7 +2290,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 /* This is also a barrier that synchronizes with switch_mm(). */ new_tlb_gen = inc_mm_tlb_gen(mm); -@@ -1021,8 +1383,11 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, +@@ -1021,8 +1399,12 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, * a local TLB flush is needed. Optimize this use-case by calling * flush_tlb_func_local() directly in this case. */ @@ -2156,20 +2298,18 @@ index a2becb85bea7..e7f32b00d8fb 100644 + if (mm_global_asid(mm)) { + broadcast_tlb_flush(info); + } else if (cpumask_any_but(mm_cpumask(mm), cpu) < nr_cpu_ids) { ++ info->trim_cpumask = should_trim_cpumask(mm); flush_tlb_multi(mm_cpumask(mm), info); + consider_global_asid(mm); } else if (mm == this_cpu_read(cpu_tlbstate.loaded_mm)) { lockdep_assert_irqs_enabled(); local_irq_disable(); -@@ -1036,6 +1401,19 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, +@@ -1036,6 +1418,16 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, } +static bool broadcast_flush_tlb_all(void) +{ -+ if (!IS_ENABLED(CONFIG_X86_BROADCAST_TLB_FLUSH)) -+ return false; -+ + if (!cpu_feature_enabled(X86_FEATURE_INVLPGB)) + return false; + @@ -2181,7 +2321,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 static void do_flush_tlb_all(void *info) { count_vm_tlb_event(NR_TLB_REMOTE_FLUSH_RECEIVED); -@@ -1044,10 +1422,36 @@ static void do_flush_tlb_all(void *info) +@@ -1044,10 +1436,34 @@ static void do_flush_tlb_all(void *info) void flush_tlb_all(void) { @@ -2196,9 +2336,6 @@ index a2becb85bea7..e7f32b00d8fb 100644 + unsigned long addr; + unsigned long nr; + -+ if (!IS_ENABLED(CONFIG_X86_BROADCAST_TLB_FLUSH)) -+ return false; -+ + if (!cpu_feature_enabled(X86_FEATURE_INVLPGB)) + return false; + @@ -2208,7 +2345,8 @@ index a2becb85bea7..e7f32b00d8fb 100644 + } + + for (addr = info->start; addr < info->end; addr += nr << PAGE_SHIFT) { -+ nr = min((info->end - addr) >> PAGE_SHIFT, invlpgb_count_max); ++ nr = (info->end - addr) >> PAGE_SHIFT; ++ nr = clamp_val(nr, 1, invlpgb_count_max); + invlpgb_flush_addr_nosync(addr, nr); + } + tlbsync(); @@ -2218,7 +2356,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 static void do_kernel_range_flush(void *info) { struct flush_tlb_info *f = info; -@@ -1060,22 +1464,21 @@ static void do_kernel_range_flush(void *info) +@@ -1060,22 +1476,21 @@ static void do_kernel_range_flush(void *info) void flush_tlb_kernel_range(unsigned long start, unsigned long end) { @@ -2229,15 +2367,15 @@ index a2becb85bea7..e7f32b00d8fb 100644 - } else { - struct flush_tlb_info *info; + struct flush_tlb_info *info; -+ -+ guard(preempt)(); - preempt_disable(); - info = get_flush_tlb_info(NULL, start, end, 0, false, - TLB_GENERATION_INVALID); ++ guard(preempt)(); + + info = get_flush_tlb_info(NULL, start, end, PAGE_SHIFT, false, + TLB_GENERATION_INVALID); - ++ + if (broadcast_kernel_range_flush(info)) + ; /* Fall through. */ + else if (info->end == TLB_FLUSH_ALL) @@ -2252,16 +2390,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 } /* -@@ -1247,7 +1650,7 @@ void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch) - - int cpu = get_cpu(); - -- info = get_flush_tlb_info(NULL, 0, TLB_FLUSH_ALL, 0, false, -+ info = get_flush_tlb_info(NULL, 0, TLB_FLUSH_ALL, PAGE_SHIFT, false, - TLB_GENERATION_INVALID); - /* - * flush_tlb_multi() is not optimized for the common case in which only -@@ -1263,12 +1666,53 @@ void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch) +@@ -1263,12 +1678,52 @@ void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch) local_irq_enable(); } @@ -2270,8 +2399,7 @@ index a2becb85bea7..e7f32b00d8fb 100644 + * The cpumask above contains only CPUs that were running tasks + * not using broadcast TLB flushing. + */ -+ if (cpu_feature_enabled(X86_FEATURE_INVLPGB)) -+ tlbsync(); ++ tlbsync(); + cpumask_clear(&batch->cpumask); @@ -2327,6 +2455,18 @@ index 55a4996d0c04..041e17282af0 100644 .pgd_alloc = xen_pgd_alloc, .pgd_free = xen_pgd_free, +diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h +index 332cee285662..29e6d8e6d0e5 100644 +--- a/include/linux/mm_types.h ++++ b/include/linux/mm_types.h +@@ -1401,6 +1401,7 @@ enum tlb_flush_reason { + TLB_LOCAL_SHOOTDOWN, + TLB_LOCAL_MM_SHOOTDOWN, + TLB_REMOTE_SEND_IPI, ++ TLB_REMOTE_WRONG_CPU, + NR_TLB_FLUSH_REASONS, + }; + diff --git a/mm/memory.c b/mm/memory.c index 398c031be9ba..3d98aaf9b939 100644 --- a/mm/memory.c @@ -2414,9 +2554,9 @@ index 3ae84c3b8e6d..dc1c1057f26e 100644 -- 2.48.0.rc1 -From a801f55195137633b337b08ad9c5b18dc8eeb65b Mon Sep 17 00:00:00 2001 +From 479754290512670400557c6fb91a252676261db8 Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:36:17 +0100 +Date: Mon, 17 Feb 2025 16:30:31 +0100 Subject: [PATCH 03/12] bbr3 Signed-off-by: Peter Jung @@ -5800,9 +5940,9 @@ index b412ed88ccd9..d70f8b742b21 100644 -- 2.48.0.rc1 -From ccbcd886d7323bbd9acae1ddc2906c177cc24ae4 Mon Sep 17 00:00:00 2001 +From dbc43ac67696e3fbebdc6930aa7f057b255c2d6c Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:36:27 +0100 +Date: Mon, 17 Feb 2025 16:30:44 +0100 Subject: [PATCH 04/12] cachy Signed-off-by: Peter Jung @@ -6016,7 +6156,7 @@ index f48eaa98d22d..fc777c14cff6 100644 unprivileged_userfaultfd ======================== diff --git a/Makefile b/Makefile -index 9de0dc460a83..2b4204407087 100644 +index 423d087afad2..4af7030f914e 100644 --- a/Makefile +++ b/Makefile @@ -860,11 +860,19 @@ KBUILD_CFLAGS += -fno-delete-null-pointer-checks @@ -6996,10 +7136,10 @@ index cd4fac120834..1ab433d774cc 100644 if (amdgpu_emu_mode != 1) amdgpu_atombios_fini(adev); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c -index 38686203bea6..811d020f3f4b 100644 +index e63efe5c5b75..14a959a4f270 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c -@@ -137,6 +137,7 @@ enum AMDGPU_DEBUG_MASK { +@@ -138,6 +138,7 @@ enum AMDGPU_DEBUG_MASK { }; unsigned int amdgpu_vram_limit = UINT_MAX; @@ -7007,7 +7147,7 @@ index 38686203bea6..811d020f3f4b 100644 int amdgpu_vis_vram_limit; int amdgpu_gart_size = -1; /* auto */ int amdgpu_gtt_size = -1; /* auto */ -@@ -255,6 +256,15 @@ struct amdgpu_watchdog_timer amdgpu_watchdog_timer = { +@@ -256,6 +257,15 @@ struct amdgpu_watchdog_timer amdgpu_watchdog_timer = { .period = 0x0, /* default to 0x0 (timeout disable) */ }; @@ -7093,10 +7233,10 @@ index 11e3f2f3b174..7b1bd69dc29e 100644 + endmenu diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -index 53694baca966..f836ab663568 100644 +index f7c0d7625ff1..02e915268f33 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -177,6 +177,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev); +@@ -178,6 +178,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev); static void amdgpu_dm_fini(struct amdgpu_device *adev); static bool is_freesync_video_mode(const struct drm_display_mode *mode, struct amdgpu_dm_connector *aconnector); static void reset_freesync_config_for_crtc(struct dm_crtc_state *new_crtc_state); @@ -7105,7 +7245,7 @@ index 53694baca966..f836ab663568 100644 static enum drm_mode_subconnector get_subconnector_type(struct dc_link *link) { -@@ -2839,6 +2841,33 @@ static int amdgpu_dm_smu_write_watermarks_table(struct amdgpu_device *adev) +@@ -2842,6 +2844,33 @@ static int amdgpu_dm_smu_write_watermarks_table(struct amdgpu_device *adev) return 0; } @@ -7139,7 +7279,7 @@ index 53694baca966..f836ab663568 100644 /** * dm_hw_init() - Initialize DC device * @ip_block: Pointer to the amdgpu_ip_block for this hw instance. -@@ -2870,6 +2899,10 @@ static int dm_hw_init(struct amdgpu_ip_block *ip_block) +@@ -2873,6 +2902,10 @@ static int dm_hw_init(struct amdgpu_ip_block *ip_block) return r; amdgpu_dm_hpd_init(adev); @@ -7150,7 +7290,7 @@ index 53694baca966..f836ab663568 100644 return 0; } -@@ -2885,6 +2918,8 @@ static int dm_hw_fini(struct amdgpu_ip_block *ip_block) +@@ -2888,6 +2921,8 @@ static int dm_hw_fini(struct amdgpu_ip_block *ip_block) { struct amdgpu_device *adev = ip_block->adev; @@ -7159,7 +7299,7 @@ index 53694baca966..f836ab663568 100644 amdgpu_dm_hpd_fini(adev); amdgpu_dm_irq_fini(adev); -@@ -4516,7 +4551,7 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) +@@ -4524,7 +4559,7 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) return r; } @@ -7168,7 +7308,7 @@ index 53694baca966..f836ab663568 100644 if (amdgpu_dm_create_color_properties(adev)) { dc_state_release(state->context); kfree(state); -@@ -8218,7 +8253,7 @@ static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap, +@@ -8222,7 +8257,7 @@ static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap, int i; int result = -EIO; @@ -7177,7 +7317,7 @@ index 53694baca966..f836ab663568 100644 return result; cmd.payloads = kcalloc(num, sizeof(struct i2c_payload), GFP_KERNEL); -@@ -8237,11 +8272,18 @@ static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap, +@@ -8241,11 +8276,18 @@ static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap, cmd.payloads[i].data = msgs[i].buf; } @@ -7201,7 +7341,7 @@ index 53694baca966..f836ab663568 100644 kfree(cmd.payloads); return result; -@@ -8258,9 +8300,7 @@ static const struct i2c_algorithm amdgpu_dm_i2c_algo = { +@@ -8262,9 +8304,7 @@ static const struct i2c_algorithm amdgpu_dm_i2c_algo = { }; static struct amdgpu_i2c_adapter * @@ -7212,7 +7352,7 @@ index 53694baca966..f836ab663568 100644 { struct amdgpu_device *adev = ddc_service->ctx->driver_context; struct amdgpu_i2c_adapter *i2c; -@@ -8271,9 +8311,14 @@ create_i2c(struct ddc_service *ddc_service, +@@ -8275,9 +8315,14 @@ create_i2c(struct ddc_service *ddc_service, i2c->base.owner = THIS_MODULE; i2c->base.dev.parent = &adev->pdev->dev; i2c->base.algo = &amdgpu_dm_i2c_algo; @@ -7228,7 +7368,7 @@ index 53694baca966..f836ab663568 100644 return i2c; } -@@ -8298,7 +8343,7 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm, +@@ -8302,7 +8347,7 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm, link->priv = aconnector; @@ -7300,10 +7440,10 @@ index 36a830a7440f..a8fc8bd52d51 100644 #endif return 0; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c -index 495e3cd70426..704a48209657 100644 +index 83c7c8853ede..059d0ca29518 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c -@@ -1573,7 +1573,7 @@ static void amdgpu_dm_plane_drm_plane_destroy_state(struct drm_plane *plane, +@@ -1567,7 +1567,7 @@ static void amdgpu_dm_plane_drm_plane_destroy_state(struct drm_plane *plane, drm_atomic_helper_plane_destroy_state(plane, state); } @@ -7312,7 +7452,7 @@ index 495e3cd70426..704a48209657 100644 static void dm_atomic_plane_attach_color_mgmt_properties(struct amdgpu_display_manager *dm, struct drm_plane *plane) -@@ -1764,7 +1764,7 @@ static const struct drm_plane_funcs dm_plane_funcs = { +@@ -1758,7 +1758,7 @@ static const struct drm_plane_funcs dm_plane_funcs = { .atomic_duplicate_state = amdgpu_dm_plane_drm_plane_duplicate_state, .atomic_destroy_state = amdgpu_dm_plane_drm_plane_destroy_state, .format_mod_supported = amdgpu_dm_plane_format_mod_supported, @@ -7321,7 +7461,7 @@ index 495e3cd70426..704a48209657 100644 .atomic_set_property = dm_atomic_plane_set_property, .atomic_get_property = dm_atomic_plane_get_property, #endif -@@ -1857,7 +1857,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, +@@ -1851,7 +1851,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, drm_plane_helper_add(plane, &dm_plane_helper_funcs); @@ -7559,10 +7699,10 @@ index b5cbb57ee5f6..a0f7fa1518c6 100644 } diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c -index 1ae2c71bb383..784829ada178 100644 +index 78c975d7cd5f..965043bd2093 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c -@@ -3315,6 +3315,11 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) +@@ -3308,6 +3308,11 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) goto bad; } @@ -13375,7 +13515,7 @@ index 2ddb827e3bea..464049c4af3f 100644 return state; diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index 8800679b508d..eb95f524bea4 100644 +index 7d0a05660e5e..3a3116dca89c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -73,10 +73,19 @@ unsigned int sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_LOG; @@ -13639,10 +13779,10 @@ index 84000b016808..1d96c5cc35d3 100644 # diff --git a/mm/compaction.c b/mm/compaction.c -index a2b16b08cbbf..48d611e58ad3 100644 +index 384e4672998e..d122cbf8aa9e 100644 --- a/mm/compaction.c +++ b/mm/compaction.c -@@ -1920,7 +1920,11 @@ static int sysctl_compact_unevictable_allowed __read_mostly = CONFIG_COMPACT_UNE +@@ -1921,7 +1921,11 @@ static int sysctl_compact_unevictable_allowed __read_mostly = CONFIG_COMPACT_UNE * aggressively the kernel should compact memory in the * background. It takes values in the range [0, 100]. */ @@ -13764,7 +13904,7 @@ index bd5183dfd879..3a410f53a07c 100644 /* diff --git a/mm/vmscan.c b/mm/vmscan.c -index b1ec5ece067e..e258174d240a 100644 +index c22175120f5d..9c6451e872af 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -148,6 +148,15 @@ struct scan_control { @@ -13818,7 +13958,7 @@ index b1ec5ece067e..e258174d240a 100644 /* * The number of dirty pages determines if a node is marked * reclaim_congested. kswapd will stall and start writing -@@ -2423,6 +2449,15 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, +@@ -2424,6 +2450,15 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, goto out; } @@ -13834,7 +13974,7 @@ index b1ec5ece067e..e258174d240a 100644 /* * If there is enough inactive page cache, we do not reclaim * anything from the anonymous working right now. -@@ -2567,6 +2602,14 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, +@@ -2568,6 +2603,14 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, BUG(); } @@ -13849,7 +13989,7 @@ index b1ec5ece067e..e258174d240a 100644 nr[lru] = scan; } } -@@ -2586,6 +2629,96 @@ static bool can_age_anon_pages(struct pglist_data *pgdat, +@@ -2587,6 +2630,96 @@ static bool can_age_anon_pages(struct pglist_data *pgdat, return can_demote(pgdat->node_id, sc); } @@ -13946,7 +14086,7 @@ index b1ec5ece067e..e258174d240a 100644 #ifdef CONFIG_LRU_GEN #ifdef CONFIG_LRU_GEN_ENABLED -@@ -4539,6 +4672,12 @@ static int isolate_folios(struct lruvec *lruvec, struct scan_control *sc, int sw +@@ -4540,6 +4673,12 @@ static int isolate_folios(struct lruvec *lruvec, struct scan_control *sc, int sw */ if (!swappiness) type = LRU_GEN_FILE; @@ -13959,7 +14099,7 @@ index b1ec5ece067e..e258174d240a 100644 else if (min_seq[LRU_GEN_ANON] < min_seq[LRU_GEN_FILE]) type = LRU_GEN_ANON; else if (swappiness == 1) -@@ -4829,6 +4968,8 @@ static int shrink_one(struct lruvec *lruvec, struct scan_control *sc) +@@ -4830,6 +4969,8 @@ static int shrink_one(struct lruvec *lruvec, struct scan_control *sc) struct mem_cgroup *memcg = lruvec_memcg(lruvec); struct pglist_data *pgdat = lruvec_pgdat(lruvec); @@ -13968,7 +14108,7 @@ index b1ec5ece067e..e258174d240a 100644 /* lru_gen_age_node() called mem_cgroup_calculate_protection() */ if (mem_cgroup_below_min(NULL, memcg)) return MEMCG_LRU_YOUNG; -@@ -5977,6 +6118,8 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc) +@@ -5978,6 +6119,8 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc) prepare_scan_control(pgdat, sc); @@ -13993,9 +14133,9 @@ index 6872b5aff73e..1910fe1b2471 100644 -- 2.48.0.rc1 -From 8d2c24065426a10dbdc28e6dd390b67861d740c5 Mon Sep 17 00:00:00 2001 +From 65f50bcb3c1ee4ac40786548409e07869bdaece7 Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:36:39 +0100 +Date: Mon, 17 Feb 2025 16:32:16 +0100 Subject: [PATCH 05/12] crypto Signed-off-by: Peter Jung @@ -14767,26 +14907,22 @@ index fbf43482e1f5..11e95fc62636 100644 -- 2.48.0.rc1 -From 5b3c80caab0d7708c3a0ecc8b65c72f403fcd852 Mon Sep 17 00:00:00 2001 +From 5a1609eb06ee64b2b55edacaf5e79b521a46bbb3 Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:36:51 +0100 +Date: Mon, 17 Feb 2025 16:32:27 +0100 Subject: [PATCH 06/12] fixes Signed-off-by: Peter Jung --- - arch/Kconfig | 4 +- - arch/x86/boot/compressed/Makefile | 1 + - drivers/firmware/efi/libstub/Makefile | 2 +- - drivers/gpu/drm/drm_edid.c | 47 ++++++++++++++++++++-- - drivers/hid/hid-asus.c | 26 ++++++++++++ - drivers/hid/hid-ids.h | 1 + - fs/fuse/file.c | 6 ++- - include/linux/platform_data/x86/asus-wmi.h | 5 +++ - kernel/fork.c | 9 +++-- - kernel/kprobes.c | 23 +++++------ - kernel/sched/ext.c | 7 ++-- - scripts/package/PKGBUILD | 5 +++ - 12 files changed, 109 insertions(+), 27 deletions(-) + arch/Kconfig | 4 ++-- + drivers/gpu/drm/drm_edid.c | 47 +++++++++++++++++++++++++++++++++++--- + drivers/hid/hid-ids.h | 1 + + fs/fuse/file.c | 6 +++-- + kernel/fork.c | 9 ++++---- + kernel/kprobes.c | 23 +++++++++---------- + kernel/sched/ext.c | 7 +++--- + scripts/package/PKGBUILD | 5 ++++ + 8 files changed, 76 insertions(+), 26 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 6682b2a53e34..fe54298ae05c 100644 @@ -14810,33 +14946,8 @@ index 6682b2a53e34..fe54298ae05c 100644 depends on HAVE_ARCH_MMAP_RND_COMPAT_BITS help This value can be used to select the number of bits to use to -diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile -index f2051644de94..606c74f27459 100644 ---- a/arch/x86/boot/compressed/Makefile -+++ b/arch/x86/boot/compressed/Makefile -@@ -25,6 +25,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ - # avoid errors with '-march=i386', and future flags may depend on the target to - # be valid. - KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS) -+KBUILD_CFLAGS += -std=gnu11 - KBUILD_CFLAGS += -fno-strict-aliasing -fPIE - KBUILD_CFLAGS += -Wundef - KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING -diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile -index ed4e8ddbe76a..1141cd06011f 100644 ---- a/drivers/firmware/efi/libstub/Makefile -+++ b/drivers/firmware/efi/libstub/Makefile -@@ -11,7 +11,7 @@ cflags-y := $(KBUILD_CFLAGS) - - cflags-$(CONFIG_X86_32) := -march=i386 - cflags-$(CONFIG_X86_64) := -mcmodel=small --cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \ -+cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -std=gnu11 \ - -fPIC -fno-strict-aliasing -mno-red-zone \ - -mno-mmx -mno-sse -fshort-wchar \ - -Wno-pointer-sign \ diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c -index 855beafb76ff..ad78059ee954 100644 +index 13bc4c290b17..9b741e6262bc 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -94,6 +94,8 @@ static int oui(u8 first, u8 second, u8 third) @@ -14861,7 +14972,7 @@ index 855beafb76ff..ad78059ee954 100644 /* Sony PVM-2541A does up to 12 bpc, but only reports max 8 bpc */ EDID_QUIRK('S', 'N', 'Y', 0x2541, EDID_QUIRK_FORCE_12BPC), -@@ -6753,7 +6761,37 @@ static void update_display_info(struct drm_connector *connector, +@@ -6759,7 +6767,37 @@ static void update_display_info(struct drm_connector *connector, drm_edid_to_eld(connector, drm_edid); } @@ -14900,7 +15011,7 @@ index 855beafb76ff..ad78059ee954 100644 struct displayid_detailed_timings_1 *timings, bool type_7) { -@@ -6772,7 +6810,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d +@@ -6778,7 +6816,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d bool hsync_positive = (timings->hsync[1] >> 7) & 0x1; bool vsync_positive = (timings->vsync[1] >> 7) & 0x1; @@ -14909,7 +15020,7 @@ index 855beafb76ff..ad78059ee954 100644 if (!mode) return NULL; -@@ -6795,6 +6833,9 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d +@@ -6801,6 +6839,9 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d if (timings->flags & 0x80) mode->type |= DRM_MODE_TYPE_PREFERRED; @@ -14919,7 +15030,7 @@ index 855beafb76ff..ad78059ee954 100644 drm_mode_set_name(mode); return mode; -@@ -6817,7 +6858,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, +@@ -6823,7 +6864,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, for (i = 0; i < num_timings; i++) { struct displayid_detailed_timings_1 *timings = &det->timings[i]; @@ -14928,50 +15039,6 @@ index 855beafb76ff..ad78059ee954 100644 if (!newmode) continue; -diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c -index 506c6f377e7d..46e3e42f9eb5 100644 ---- a/drivers/hid/hid-asus.c -+++ b/drivers/hid/hid-asus.c -@@ -432,6 +432,26 @@ static int asus_kbd_get_functions(struct hid_device *hdev, - return ret; - } - -+static int asus_kbd_disable_oobe(struct hid_device *hdev) -+{ -+ const u8 init[][6] = { -+ { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 }, -+ { FEATURE_KBD_REPORT_ID, 0xBA, 0xC5, 0xC4 }, -+ { FEATURE_KBD_REPORT_ID, 0xD0, 0x8F, 0x01 }, -+ { FEATURE_KBD_REPORT_ID, 0xD0, 0x85, 0xFF } -+ }; -+ int ret; -+ -+ for (size_t i = 0; i < ARRAY_SIZE(init); i++) { -+ ret = asus_kbd_set_report(hdev, init[i], sizeof(init[i])); -+ if (ret < 0) -+ return ret; -+ } -+ -+ hid_info(hdev, "Disabled OOBE for keyboard\n"); -+ return 0; -+} -+ - static void asus_schedule_work(struct asus_kbd_leds *led) - { - unsigned long flags; -@@ -534,6 +554,12 @@ static int asus_kbd_register_leds(struct hid_device *hdev) - ret = asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID2); - if (ret < 0) - return ret; -+ -+ if (dmi_match(DMI_PRODUCT_FAMILY, "ProArt P16")) { -+ ret = asus_kbd_disable_oobe(hdev); -+ if (ret < 0) -+ return ret; -+ } - } else { - /* Initialize keyboard */ - ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID); diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index d1d479ca50a2..d1ab021e4a6a 100644 --- a/drivers/hid/hid-ids.h @@ -15009,22 +15076,6 @@ index 7d92a5479998..a40d65ffb94d 100644 ap->folios[ap->num_folios] = folio; ap->descs[ap->num_folios].length = folio_size(folio); ap->num_folios++; -diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index 365e119bebaa..783e2a336861 100644 ---- a/include/linux/platform_data/x86/asus-wmi.h -+++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -184,6 +184,11 @@ static const struct dmi_system_id asus_use_hid_led_dmi_ids[] = { - DMI_MATCH(DMI_PRODUCT_FAMILY, "ROG Flow"), - }, - }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_PRODUCT_FAMILY, "ProArt P16"), -+ }, -+ }, - { - .matches = { - DMI_MATCH(DMI_BOARD_NAME, "GA403U"), diff --git a/kernel/fork.c b/kernel/fork.c index 32bf5e30ba4a..e12de63bac76 100644 --- a/kernel/fork.c @@ -15152,9 +15203,9 @@ index dca706617adc..89d3aef160b7 100644 -- 2.48.0.rc1 -From b2d119ea62964c08fda952ffc8b5860dc9c67990 Mon Sep 17 00:00:00 2001 +From c683c53853220a36525db834e14be617dda17d0a Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:37:07 +0100 +Date: Mon, 17 Feb 2025 16:32:45 +0100 Subject: [PATCH 07/12] itmt-core-ranking Signed-off-by: Peter Jung @@ -15364,10 +15415,10 @@ index f1fac08fdef2..ef63b1c0b491 100644 #endif #ifdef CONFIG_SCHED_CLUSTER diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index eb95f524bea4..02c7cb4badea 100644 +index 3a3116dca89c..a27896a05103 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c -@@ -9845,6 +9845,8 @@ struct sg_lb_stats { +@@ -9864,6 +9864,8 @@ struct sg_lb_stats { unsigned int group_weight; enum group_type group_type; unsigned int group_asym_packing; /* Tasks should be moved to preferred CPU */ @@ -15376,7 +15427,7 @@ index eb95f524bea4..02c7cb4badea 100644 unsigned int group_smt_balance; /* Task on busy SMT be moved */ unsigned long group_misfit_task_load; /* A CPU has a task too big for its capacity */ #ifdef CONFIG_NUMA_BALANCING -@@ -10174,7 +10176,7 @@ sched_group_asym(struct lb_env *env, struct sg_lb_stats *sgs, struct sched_group +@@ -10193,7 +10195,7 @@ sched_group_asym(struct lb_env *env, struct sg_lb_stats *sgs, struct sched_group (sgs->group_weight - sgs->idle_cpus != 1)) return false; @@ -15385,7 +15436,7 @@ index eb95f524bea4..02c7cb4badea 100644 } /* One group has more than one SMT CPU while the other group does not */ -@@ -10255,6 +10257,17 @@ sched_reduced_capacity(struct rq *rq, struct sched_domain *sd) +@@ -10274,6 +10276,17 @@ sched_reduced_capacity(struct rq *rq, struct sched_domain *sd) return check_cpu_capacity(rq, sd); } @@ -15403,7 +15454,7 @@ index eb95f524bea4..02c7cb4badea 100644 /** * update_sg_lb_stats - Update sched_group's statistics for load balancing. * @env: The load balancing environment. -@@ -10271,11 +10284,13 @@ static inline void update_sg_lb_stats(struct lb_env *env, +@@ -10290,11 +10303,13 @@ static inline void update_sg_lb_stats(struct lb_env *env, bool *sg_overloaded, bool *sg_overutilized) { @@ -15418,7 +15469,7 @@ index eb95f524bea4..02c7cb4badea 100644 for_each_cpu_and(i, sched_group_span(group), env->cpus) { struct rq *rq = cpu_rq(i); -@@ -10289,16 +10304,12 @@ static inline void update_sg_lb_stats(struct lb_env *env, +@@ -10308,16 +10323,12 @@ static inline void update_sg_lb_stats(struct lb_env *env, nr_running = rq->nr_running; sgs->sum_nr_running += nr_running; @@ -15437,7 +15488,7 @@ index eb95f524bea4..02c7cb4badea 100644 /* * No need to call idle_cpu() if nr_running is not 0 */ -@@ -10308,10 +10319,21 @@ static inline void update_sg_lb_stats(struct lb_env *env, +@@ -10327,10 +10338,21 @@ static inline void update_sg_lb_stats(struct lb_env *env, continue; } @@ -15460,7 +15511,7 @@ index eb95f524bea4..02c7cb4badea 100644 /* Check for a misfit task on the cpu */ if (sgs->group_misfit_task_load < rq->misfit_task_load) { sgs->group_misfit_task_load = rq->misfit_task_load; -@@ -10406,7 +10428,7 @@ static bool update_sd_pick_busiest(struct lb_env *env, +@@ -10425,7 +10447,7 @@ static bool update_sd_pick_busiest(struct lb_env *env, case group_asym_packing: /* Prefer to move from lowest priority CPU's work */ @@ -15517,9 +15568,9 @@ index 9748a4c8d668..59b8157cb114 100644 -- 2.48.0.rc1 -From 12158f3774a49a2f0931b1333a2cb00e0ca785ca Mon Sep 17 00:00:00 2001 +From 98dab1891e0b8e8cae7ae4fbddaf87b94040c2a9 Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:37:31 +0100 +Date: Mon, 17 Feb 2025 16:32:59 +0100 Subject: [PATCH 08/12] ntsync Signed-off-by: Peter Jung @@ -15528,14 +15579,14 @@ Signed-off-by: Peter Jung Documentation/userspace-api/ntsync.rst | 385 +++++ MAINTAINERS | 9 + drivers/misc/Kconfig | 1 - - drivers/misc/ntsync.c | 1000 +++++++++++- + drivers/misc/ntsync.c | 1001 +++++++++++- include/uapi/linux/ntsync.h | 42 +- tools/testing/selftests/Makefile | 1 + .../selftests/drivers/ntsync/.gitignore | 1 + .../testing/selftests/drivers/ntsync/Makefile | 7 + tools/testing/selftests/drivers/ntsync/config | 1 + .../testing/selftests/drivers/ntsync/ntsync.c | 1343 +++++++++++++++++ - 11 files changed, 2772 insertions(+), 19 deletions(-) + 11 files changed, 2773 insertions(+), 19 deletions(-) create mode 100644 Documentation/userspace-api/ntsync.rst create mode 100644 tools/testing/selftests/drivers/ntsync/.gitignore create mode 100644 tools/testing/selftests/drivers/ntsync/Makefile @@ -15978,7 +16029,7 @@ index 09cbe3f0ab1e..fb772bfe27c3 100644 This module provides kernel support for emulation of Windows NT synchronization primitives. It is not a hardware driver. diff --git a/drivers/misc/ntsync.c b/drivers/misc/ntsync.c -index 4954553b7baa..055395cde42b 100644 +index 4954553b7baa..586b86243e1d 100644 --- a/drivers/misc/ntsync.c +++ b/drivers/misc/ntsync.c @@ -6,11 +6,17 @@ @@ -17111,6 +17162,14 @@ index 4954553b7baa..055395cde42b 100644 default: return -ENOIOCTLCMD; } +@@ -238,6 +1208,7 @@ static struct miscdevice ntsync_misc = { + .minor = MISC_DYNAMIC_MINOR, + .name = NTSYNC_NAME, + .fops = &ntsync_fops, ++ .mode = 0666, // Setting file permissions to 0666 + }; + + module_misc_device(ntsync_misc); diff --git a/include/uapi/linux/ntsync.h b/include/uapi/linux/ntsync.h index dcfa38fdc93c..6d06793512b1 100644 --- a/include/uapi/linux/ntsync.h @@ -18559,9 +18618,9 @@ index 000000000000..3aad311574c4 -- 2.48.0.rc1 -From 0e80a2fcc5009eaa2a3eca340eae386a091c5778 Mon Sep 17 00:00:00 2001 +From e959305333470311ce6636ab70e094197ce99351 Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:37:46 +0100 +Date: Mon, 17 Feb 2025 16:33:10 +0100 Subject: [PATCH 09/12] perf-per-core Signed-off-by: Peter Jung @@ -19457,9 +19516,9 @@ index 8277c64f88db..b5a5e1411469 100644 -- 2.48.0.rc1 -From c48b9373a303bb377c7a27beb74c589ef190172a Mon Sep 17 00:00:00 2001 +From cbe148fadf7905c3c9d85f4792427a5286b3d548 Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:37:57 +0100 +Date: Mon, 17 Feb 2025 16:33:25 +0100 Subject: [PATCH 10/12] pksm Signed-off-by: Peter Jung @@ -19890,9 +19949,9 @@ index e9115b4d8b63..2afc778f2d17 100644 -- 2.48.0.rc1 -From 470c59573e51507951213cec53c9183ed235648c Mon Sep 17 00:00:00 2001 +From ee21e489dd618c304f7f31415e389ba57ee5548e Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:38:07 +0100 +Date: Mon, 17 Feb 2025 16:33:34 +0100 Subject: [PATCH 11/12] t2 Signed-off-by: Peter Jung @@ -20066,10 +20125,10 @@ index efecb59adfe6..16af42c68cca 100644 S: Orphan T: git https://gitlab.freedesktop.org/drm/misc/kernel.git diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c -index 811d020f3f4b..ade5a5b597e4 100644 +index 14a959a4f270..e1a563cdb361 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c -@@ -2256,6 +2256,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, +@@ -2257,6 +2257,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, int ret, retry = 0, i; bool supports_atomic = false; @@ -21841,7 +21900,7 @@ index 000000000000..fa28a691da6a +MODULE_DESCRIPTION("MacBookPro Touch Bar Keyboard Mode Driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c -index 42c0bd9d2f31..c18e20175e9d 100644 +index 82900857bfd8..c16edd3f4a37 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -73,6 +73,7 @@ MODULE_LICENSE("GPL"); @@ -30240,9 +30299,9 @@ index 9eed3683ad76..7ddbf75f4c26 100755 -- 2.48.0.rc1 -From 54a923413ce52908459fb465882fed6624c10318 Mon Sep 17 00:00:00 2001 +From 3cff5b38b4b38bf4e6c96b0d7c0a9950c42f5673 Mon Sep 17 00:00:00 2001 From: Peter Jung -Date: Sat, 8 Feb 2025 10:38:19 +0100 +Date: Mon, 17 Feb 2025 16:33:45 +0100 Subject: [PATCH 12/12] zstd Signed-off-by: Peter Jung diff --git a/baseos/kernel/6.13/PCI-fix-Sapphire-PCI-rebar-quirk.patch b/baseos/kernel/6.13/PCI-fix-Sapphire-PCI-rebar-quirk.patch new file mode 100644 index 0000000..2b4fb7d --- /dev/null +++ b/baseos/kernel/6.13/PCI-fix-Sapphire-PCI-rebar-quirk.patch @@ -0,0 +1,12 @@ +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c +index 225a6cd2e9ca3..dec917636974e 100644 +--- a/drivers/pci/pci.c ++++ b/drivers/pci/pci.c +@@ -3766,6 +3766,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar) + + /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */ + if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f && ++ pdev->subsystem_vendor == 0x1da2 && + bar == 0 && cap == 0x700) + return 0x3f00; + diff --git a/baseos/kernel/6.13/asus-patch-series.patch b/baseos/kernel/6.13/asus-patch-series.patch index 13550ac..9574344 100644 --- a/baseos/kernel/6.13/asus-patch-series.patch +++ b/baseos/kernel/6.13/asus-patch-series.patch @@ -1,237 +1,83 @@ -From 2da2427f9b97edebaf226c6a35e6eddfb0c8650f Mon Sep 17 00:00:00 2001 +From fbeb8e1f27193acf368a6f67ecd8cfa203630fd8 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" -Date: Fri, 31 Jan 2025 09:14:52 +1300 -Subject: [PATCH 03/28] platform/x86: asus-wmi: Remove all ROG Ally CSEE hacks +Date: Tue, 17 Dec 2024 09:31:08 +1300 +Subject: [PATCH 01/30] Tmp: add GA605W & H7606W to AMD-PMF quirks. -Remove the hacks introduced by these commits: -- fc73fe3b8501 "platform/x86: asus-wmi: disable USB0 hub on ROG Ally before suspend" -- 6222853365c5 "platform/x86: asus-wmi: ROG Ally increase wait time, allow MCU powersave" -- 5e9a9192205f "platform/x86: asus-wmi: Add quirk for ROG Ally X" - -The suspend issue the above was trying to fix has been corrected in MCU -firmware updates by ASUS, where the root cause of issues was a flag in -the MCU powersave path that was not being cleared on resume, leading to -every second resume leaving the MCU in a powered off state. - -The fixed MCU firmware has been available since 2024/10/09. -Minimum versions: -- ROG Ally 1: v319 -- ROG Ally X: v313 +This will not be submitted upstream as the entire +quirk system is being removed in 6.14 kernel. Signed-off-by: Luke D. Jones --- - drivers/platform/x86/asus-wmi.c | 40 --------------------------------- - 1 file changed, 40 deletions(-) + drivers/platform/x86/amd/pmf/pmf-quirks.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) -diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index 8bd187e8b47f..01fc39d64f27 100644 ---- a/drivers/platform/x86/asus-wmi.c -+++ b/drivers/platform/x86/asus-wmi.c -@@ -142,11 +142,6 @@ module_param(fnlock_default, bool, 0444); - #define ASUS_MINI_LED_2024_STRONG 0x01 - #define ASUS_MINI_LED_2024_OFF 0x02 - --/* Controls the power state of the USB0 hub on ROG Ally which input is on */ --#define ASUS_USB0_PWR_EC0_CSEE "\\_SB.PCI0.SBRG.EC0.CSEE" --/* 300ms so far seems to produce a reliable result on AC and battery */ --#define ASUS_USB0_PWR_EC0_CSEE_WAIT 1500 -- - static const char * const ashs_ids[] = { "ATK4001", "ATK4002", NULL }; - - static int throttle_thermal_policy_write(struct asus_wmi *); -@@ -274,9 +269,6 @@ struct asus_wmi { - u32 tablet_switch_dev_id; - bool tablet_switch_inverted; - -- /* The ROG Ally device requires the MCU USB device be disconnected before suspend */ -- bool ally_mcu_usb_switch; -- - enum fan_type fan_type; - enum fan_type gpu_fan_type; - enum fan_type mid_fan_type; -@@ -4719,8 +4711,6 @@ static int asus_wmi_add(struct platform_device *pdev) - asus->egpu_enable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU); - asus->dgpu_disable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU); - asus->kbd_rgb_state_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_STATE); -- asus->ally_mcu_usb_switch = acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE) -- && dmi_check_system(asus_ally_mcu_quirk); - - if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE)) - asus->mini_led_dev_id = ASUS_WMI_DEVID_MINI_LED_MODE; -@@ -4911,34 +4901,6 @@ static int asus_hotk_resume(struct device *device) - return 0; - } - --static int asus_hotk_resume_early(struct device *device) --{ -- struct asus_wmi *asus = dev_get_drvdata(device); -- -- if (asus->ally_mcu_usb_switch) { -- /* sleep required to prevent USB0 being yanked then reappearing rapidly */ -- if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB8))) -- dev_err(device, "ROG Ally MCU failed to connect USB dev\n"); -- else -- msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); -- } -- return 0; --} -- --static int asus_hotk_prepare(struct device *device) --{ -- struct asus_wmi *asus = dev_get_drvdata(device); -- -- if (asus->ally_mcu_usb_switch) { -- /* sleep required to ensure USB0 is disabled before sleep continues */ -- if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB7))) -- dev_err(device, "ROG Ally MCU failed to disconnect USB dev\n"); -- else -- msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); -- } -- return 0; --} -- - static int asus_hotk_restore(struct device *device) - { - struct asus_wmi *asus = dev_get_drvdata(device); -@@ -4983,8 +4945,6 @@ static const struct dev_pm_ops asus_pm_ops = { - .thaw = asus_hotk_thaw, - .restore = asus_hotk_restore, - .resume = asus_hotk_resume, -- .resume_early = asus_hotk_resume_early, -- .prepare = asus_hotk_prepare, - }; - - /* Registration ***************************************************************/ +diff --git a/drivers/platform/x86/amd/pmf/pmf-quirks.c b/drivers/platform/x86/amd/pmf/pmf-quirks.c +index 7cde5733b9ca..02b9d0b49092 100644 +--- a/drivers/platform/x86/amd/pmf/pmf-quirks.c ++++ b/drivers/platform/x86/amd/pmf/pmf-quirks.c +@@ -29,6 +29,22 @@ static const struct dmi_system_id fwbug_list[] = { + }, + .driver_data = &quirk_no_sps_bug, + }, ++ { ++ .ident = "ROG Zephyrus G16", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "GA605W"), ++ }, ++ .driver_data = &quirk_no_sps_bug, ++ }, ++ { ++ .ident = "ProArt P16", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "H7606W"), ++ }, ++ .driver_data = &quirk_no_sps_bug, ++ }, + { + .ident = "ROG Ally X", + .matches = { -- -2.47.1 - +2.48.1 -From 228ab740c4377f7b9e11ae88e4429c3c060fe18b Mon Sep 17 00:00:00 2001 -From: "Luke D. Jones" -Date: Sun, 22 Sep 2024 21:40:46 +1200 -Subject: [PATCH 04/28] platform/x86: asus-wmi: export symbols used for - read/write WMI -Export some rather helpful read/write WMI symbols using a namespace. -These are DEVS and DSTS only, or require the arg0 input. +From 47f9536d4c5c60dca429fdbdbb17acec050776c9 Mon Sep 17 00:00:00 2001 +From: Mario Limonciello +Date: Tue, 21 Jan 2025 16:03:52 -0600 +Subject: [PATCH 02/30] drm/amd/display: Avoid divide by zero by initializing + dummy pitch to 1 -Also does a slight refactor of internals of these functions. +If the dummy values in `populate_dummy_dml_surface_cfg()` aren't updated +then they can lead to a divide by zero in downstream callers like +CalculateVMAndRowBytes() -Signed-off-by: Luke D. Jones -Reviewed-by: Mario Limonciello +Signed-off-by: Mario Limonciello --- - drivers/hid/hid-asus.c | 1 + - drivers/platform/x86/asus-wmi.c | 44 ++++++++++++++++++++-- - include/linux/platform_data/x86/asus-wmi.h | 10 +++++ - 3 files changed, 52 insertions(+), 3 deletions(-) + drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c -index 46e3e42f9eb5..2df6a1ca57ba 100644 ---- a/drivers/hid/hid-asus.c -+++ b/drivers/hid/hid-asus.c -@@ -1327,4 +1327,5 @@ static struct hid_driver asus_driver = { - }; - module_hid_driver(asus_driver); - -+MODULE_IMPORT_NS("ASUS_WMI"); - MODULE_LICENSE("GPL"); -diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index 01fc39d64f27..a0e0a7490688 100644 ---- a/drivers/platform/x86/asus-wmi.c -+++ b/drivers/platform/x86/asus-wmi.c -@@ -377,7 +377,7 @@ int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval) - { - return asus_wmi_evaluate_method3(method_id, arg0, arg1, 0, retval); - } --EXPORT_SYMBOL_GPL(asus_wmi_evaluate_method); -+EXPORT_SYMBOL_NS_GPL(asus_wmi_evaluate_method, "ASUS_WMI"); - - static int asus_wmi_evaluate_method5(u32 method_id, - u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 *retval) -@@ -541,12 +541,50 @@ static int asus_wmi_get_devstate(struct asus_wmi *asus, u32 dev_id, u32 *retval) - return 0; - } - --static int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, -- u32 *retval) -+/** -+ * asus_wmi_get_devstate_dsts() - Get the WMI function state. -+ * @dev_id: The WMI method ID to call. -+ * @retval: A pointer to where to store the value returned from WMI. -+ * -+ * On success the return value is 0, and the retval is a valid value returned -+ * by the successful WMI function call otherwise an error is returned if the -+ * call failed, or if the WMI method ID is unsupported. -+ */ -+int asus_wmi_get_devstate_dsts(u32 dev_id, u32 *retval) -+{ -+ int err; -+ -+ err = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS, dev_id, 0, retval); -+ if (err) -+ return err; -+ -+ if (*retval == ASUS_WMI_UNSUPPORTED_METHOD) -+ return -ENODEV; -+ -+ return 0; -+} -+EXPORT_SYMBOL_NS_GPL(asus_wmi_get_devstate_dsts, "ASUS_WMI"); -+ -+/** -+ * asus_wmi_set_devstate() - Set the WMI function state. -+ * @dev_id: The WMI function to call. -+ * @ctrl_param: The argument to be used for this WMI function. -+ * @retval: A pointer to where to store the value returned from WMI. -+ * -+ * The returned WMI function state if not checked here for error as -+ * asus_wmi_set_devstate() is not called unless first paired with a call to -+ * asus_wmi_get_devstate_dsts() to check that the WMI function is supported. -+ * -+ * On success the return value is 0, and the retval is a valid value returned -+ * by the successful WMI function call. An error value is returned only if the -+ * WMI function failed. -+ */ -+int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval) - { - return asus_wmi_evaluate_method(ASUS_WMI_METHODID_DEVS, dev_id, - ctrl_param, retval); - } -+EXPORT_SYMBOL_NS_GPL(asus_wmi_set_devstate, "ASUS_WMI"); - - /* Helper for special devices with magic return codes */ - static int asus_wmi_get_devstate_bits(struct asus_wmi *asus, -diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index 783e2a336861..466781cbb4bb 100644 ---- a/include/linux/platform_data/x86/asus-wmi.h -+++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -158,8 +158,18 @@ - #define ASUS_WMI_DSTS_LIGHTBAR_MASK 0x0000000F - - #if IS_REACHABLE(CONFIG_ASUS_WMI) -+int asus_wmi_get_devstate_dsts(u32 dev_id, u32 *retval); -+int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval); - int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval); - #else -+static inline int asus_wmi_get_devstate_dsts(u32 dev_id, u32 *retval) -+{ -+ return -ENODEV; -+} -+static inline int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval) -+{ -+ return -ENODEV; -+} - static inline int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, - u32 *retval) - { +diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +index bde4250853b1..f07afe451006 100644 +--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c ++++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +@@ -852,7 +852,7 @@ static void populate_dummy_dml_surface_cfg(struct dml_surface_cfg_st *out, unsig + out->SurfaceWidthC[location] = in->timing.h_addressable; + out->SurfaceHeightC[location] = in->timing.v_addressable; + out->PitchY[location] = ((out->SurfaceWidthY[location] + 127) / 128) * 128; +- out->PitchC[location] = 0; ++ out->PitchC[location] = 1; + out->DCCEnable[location] = false; + out->DCCMetaPitchY[location] = 0; + out->DCCMetaPitchC[location] = 0; -- -2.47.1 +2.48.1 -From a52d59fec1f510c974eab71221fe7b0088d3ac59 Mon Sep 17 00:00:00 2001 +From 5647afafd922de05d1d3c7e9da03cd5dabac0706 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Tue, 28 Jan 2025 19:29:27 +1300 -Subject: [PATCH 05/28] hid-asus: check ROG Ally MCU version and warn +Subject: [PATCH 05/30] hid-asus: check ROG Ally MCU version and warn Signed-off-by: Luke D. Jones --- @@ -239,7 +85,7 @@ Signed-off-by: Luke D. Jones 1 file changed, 95 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c -index 2df6a1ca57ba..adccc2346ec3 100644 +index 46e3e42f9eb5..040eeb25f706 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -52,6 +52,10 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); @@ -380,372 +226,286 @@ index 2df6a1ca57ba..adccc2346ec3 100644 USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD), QUIRK_ROG_CLAYMORE_II_KEYBOARD }, -- -2.47.1 +2.48.1 -From bdf1c20de6fb8fd2b61e64430db00732cb43d3f0 Mon Sep 17 00:00:00 2001 +From 68734910f718009aec4ce2e60d97430f4acc7b64 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" -Date: Thu, 30 Jan 2025 20:55:02 +1300 -Subject: [PATCH 06/28] asus-wmi: disable mcu_powersave if MCU version too low +Date: Sun, 1 Sep 2024 14:30:37 +1200 +Subject: [PATCH 06/30] platform/x86: asus-wmi: Refactor Ally suspend/resume + +The CSEE method from ACPI is now called only on module load. This fixes +an issues with USB device loss on Ally 1 after reboot. + +Both Ally 1 and Ally X now rely only of the _DSM screen off/on calls +exposed in AMD s2idle to call the CSEE (which is done in the _DSM), plus +a small additional delay to allow the MCU time to do USB unplug/plug. + +Note: a new MCU FW is being released on 2024/10/16 which will completely +fix the issue this quirk series has been trying to fix, and it will be +able to be removed in full some time in the future. This quirk series +has also been tested with a test version of this FW fix with no ill +effects - users will notice only that powersave becomes reliable 100% of +the time. Signed-off-by: Luke D. Jones --- - drivers/hid/hid-asus.c | 12 ++ - drivers/platform/x86/asus-wmi.c | 132 +------------------- - include/linux/platform_data/x86/asus-wmi.h | 138 +++++++++++++++++++++ - 3 files changed, 152 insertions(+), 130 deletions(-) + drivers/platform/x86/asus-wmi.c | 86 ++++++++++++++++++--------------- + 1 file changed, 48 insertions(+), 38 deletions(-) -diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c -index adccc2346ec3..641bf1f8c747 100644 ---- a/drivers/hid/hid-asus.c -+++ b/drivers/hid/hid-asus.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - #include - #include /* For to_usb_interface for T100 touchpad intf check */ - #include -@@ -594,6 +595,8 @@ static int mcu_request_version(struct hid_device *hdev) - static void mcu_maybe_warn_version(struct hid_device *hdev, int idProduct) - { - int min_version, version; -+ struct asus_wmi *asus; -+ struct device *dev; - - min_version = ROG_ALLY_X_MIN_MCU; - version = mcu_request_version(hdev); -@@ -614,6 +617,15 @@ static void mcu_maybe_warn_version(struct hid_device *hdev, int idProduct) - "The MCU version must be %d or greater\n" - "Please update your MCU with official ASUS firmware release\n", - min_version); -+ /* Get the asus platform device */ -+ dev = bus_find_device_by_name(&platform_bus_type, NULL, "asus-nb-wmi"); -+ if (dev) { -+ asus = dev_get_drvdata(dev); -+ /* Do not show the powersave attribute if MCU version too low */ -+ if (asus) -+ asus->mcu_powersave_available = false; -+ put_device(dev); -+ } - } - } - diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index a0e0a7490688..c02d9fa89799 100644 +index 8bd187e8b47f..5033dd45103c 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c -@@ -198,135 +198,6 @@ struct agfn_fan_args { - u32 speed; /* read: RPM/100 - write: 0-255 */ - } __packed; +@@ -142,16 +142,20 @@ module_param(fnlock_default, bool, 0444); + #define ASUS_MINI_LED_2024_STRONG 0x01 + #define ASUS_MINI_LED_2024_OFF 0x02 --/* -- * / - debugfs root directory -- * dev_id - current dev_id -- * ctrl_param - current ctrl_param -- * method_id - current method_id -- * devs - call DEVS(dev_id, ctrl_param) and print result -- * dsts - call DSTS(dev_id) and print result -- * call - call method_id(dev_id, ctrl_param) and print result -- */ --struct asus_wmi_debug { -- struct dentry *root; -- u32 method_id; -- u32 dev_id; -- u32 ctrl_param; --}; -- --struct asus_rfkill { -- struct asus_wmi *asus; -- struct rfkill *rfkill; -- u32 dev_id; --}; -- --enum fan_type { -- FAN_TYPE_NONE = 0, -- FAN_TYPE_AGFN, /* deprecated on newer platforms */ -- FAN_TYPE_SPEC83, /* starting in Spec 8.3, use CPU_FAN_CTRL */ --}; -- --struct fan_curve_data { -- bool enabled; -- u32 device_id; -- u8 temps[FAN_CURVE_POINTS]; -- u8 percents[FAN_CURVE_POINTS]; --}; -- --struct asus_wmi { -- int dsts_id; -- int spec; -- int sfun; -- -- struct input_dev *inputdev; -- struct backlight_device *backlight_device; -- struct backlight_device *screenpad_backlight_device; -- struct platform_device *platform_device; -- -- struct led_classdev wlan_led; -- int wlan_led_wk; -- struct led_classdev tpd_led; -- int tpd_led_wk; -- struct led_classdev kbd_led; -- int kbd_led_wk; -- struct led_classdev lightbar_led; -- int lightbar_led_wk; -- struct led_classdev micmute_led; -- struct led_classdev camera_led; -- struct workqueue_struct *led_workqueue; -- struct work_struct tpd_led_work; -- struct work_struct wlan_led_work; -- struct work_struct lightbar_led_work; -- -- struct asus_rfkill wlan; -- struct asus_rfkill bluetooth; -- struct asus_rfkill wimax; -- struct asus_rfkill wwan3g; -- struct asus_rfkill gps; -- struct asus_rfkill uwb; -- -- int tablet_switch_event_code; -- u32 tablet_switch_dev_id; -- bool tablet_switch_inverted; -- -- enum fan_type fan_type; -- enum fan_type gpu_fan_type; -- enum fan_type mid_fan_type; -- int fan_pwm_mode; -- int gpu_fan_pwm_mode; -- int mid_fan_pwm_mode; -- int agfn_pwm; -- -- bool fan_boost_mode_available; -- u8 fan_boost_mode_mask; -- u8 fan_boost_mode; -- -- bool egpu_enable_available; -- bool dgpu_disable_available; -- u32 gpu_mux_dev; -- -- /* Tunables provided by ASUS for gaming laptops */ -- u32 ppt_pl2_sppt; -- u32 ppt_pl1_spl; -- u32 ppt_apu_sppt; -- u32 ppt_platform_sppt; -- u32 ppt_fppt; -- u32 nv_dynamic_boost; -- u32 nv_temp_target; -- -- u32 kbd_rgb_dev; -- bool kbd_rgb_state_available; -- -- u8 throttle_thermal_policy_mode; -- u32 throttle_thermal_policy_dev; -- -- bool cpu_fan_curve_available; -- bool gpu_fan_curve_available; -- bool mid_fan_curve_available; -- struct fan_curve_data custom_fan_curves[3]; -- -- struct platform_profile_handler platform_profile_handler; -- bool platform_profile_support; -- -- // The RSOC controls the maximum charging percentage. -- bool battery_rsoc_available; -- -- bool panel_overdrive_available; -- u32 mini_led_dev_id; -- -- struct hotplug_slot hotplug_slot; -- struct mutex hotplug_lock; -- struct mutex wmi_lock; -- struct workqueue_struct *hotplug_workqueue; -- struct work_struct hotplug_work; -- -- bool fnlock_locked; -- -- struct asus_wmi_debug debug; -- -- struct asus_wmi_driver *driver; --}; +-/* Controls the power state of the USB0 hub on ROG Ally which input is on */ + #define ASUS_USB0_PWR_EC0_CSEE "\\_SB.PCI0.SBRG.EC0.CSEE" +-/* 300ms so far seems to produce a reliable result on AC and battery */ +-#define ASUS_USB0_PWR_EC0_CSEE_WAIT 1500 ++/* ++ * The period required to wait after screen off/on/s2idle.check in MS. ++ * Time here greatly impacts the wake behaviour. Used in suspend/wake. ++ */ ++#define ASUS_USB0_PWR_EC0_CSEE_WAIT 600 ++#define ASUS_USB0_PWR_EC0_CSEE_OFF 0xB7 ++#define ASUS_USB0_PWR_EC0_CSEE_ON 0xB8 + + static const char * const ashs_ids[] = { "ATK4001", "ATK4002", NULL }; + + static int throttle_thermal_policy_write(struct asus_wmi *); + +-static const struct dmi_system_id asus_ally_mcu_quirk[] = { ++static const struct dmi_system_id asus_rog_ally_device[] = { + { + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "RC71L"), +@@ -274,9 +278,6 @@ struct asus_wmi { + u32 tablet_switch_dev_id; + bool tablet_switch_inverted; + +- /* The ROG Ally device requires the MCU USB device be disconnected before suspend */ +- bool ally_mcu_usb_switch; - + enum fan_type fan_type; + enum fan_type gpu_fan_type; + enum fan_type mid_fan_type; +@@ -335,6 +336,8 @@ struct asus_wmi { + struct asus_wmi_driver *driver; + }; + ++static bool ally_mcu_usb_plug; ++ /* WMI ************************************************************************/ static int asus_wmi_evaluate_method3(u32 method_id, -@@ -4489,7 +4360,7 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, - else if (attr == &dev_attr_nv_temp_target.attr) - devid = ASUS_WMI_DEVID_NV_THERM_TARGET; - else if (attr == &dev_attr_mcu_powersave.attr) -- devid = ASUS_WMI_DEVID_MCU_POWERSAVE; -+ ok = asus->mcu_powersave_available; - else if (attr == &dev_attr_boot_sound.attr) - devid = ASUS_WMI_DEVID_BOOT_SOUND; - else if (attr == &dev_attr_panel_od.attr) -@@ -4749,6 +4620,7 @@ static int asus_wmi_add(struct platform_device *pdev) +@@ -4707,6 +4710,17 @@ static int asus_wmi_add(struct platform_device *pdev) + if (err) + goto fail_platform; + ++ ally_mcu_usb_plug = acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE) ++ && dmi_check_system(asus_rog_ally_device); ++ if (ally_mcu_usb_plug) { ++ /* ++ * These steps ensure the device is in a valid good state, this is ++ * especially important for the Ally 1 after a reboot. ++ */ ++ acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, ASUS_USB0_PWR_EC0_CSEE_ON); ++ msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); ++ } ++ + /* ensure defaults for tunables */ + asus->ppt_pl2_sppt = 5; + asus->ppt_pl1_spl = 5; +@@ -4719,8 +4733,6 @@ static int asus_wmi_add(struct platform_device *pdev) asus->egpu_enable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU); asus->dgpu_disable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU); asus->kbd_rgb_state_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_STATE); -+ asus->mcu_powersave_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MCU_POWERSAVE); +- asus->ally_mcu_usb_switch = acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE) +- && dmi_check_system(asus_ally_mcu_quirk); if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE)) asus->mini_led_dev_id = ASUS_WMI_DEVID_MINI_LED_MODE; -diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index 466781cbb4bb..4e6de0c97a78 100644 ---- a/include/linux/platform_data/x86/asus-wmi.h -+++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -5,6 +5,144 @@ - #include - #include - #include -+#include -+#include -+#include -+#include +@@ -4911,34 +4923,6 @@ static int asus_hotk_resume(struct device *device) + return 0; + } + +-static int asus_hotk_resume_early(struct device *device) +-{ +- struct asus_wmi *asus = dev_get_drvdata(device); +- +- if (asus->ally_mcu_usb_switch) { +- /* sleep required to prevent USB0 being yanked then reappearing rapidly */ +- if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB8))) +- dev_err(device, "ROG Ally MCU failed to connect USB dev\n"); +- else +- msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); +- } +- return 0; +-} +- +-static int asus_hotk_prepare(struct device *device) +-{ +- struct asus_wmi *asus = dev_get_drvdata(device); +- +- if (asus->ally_mcu_usb_switch) { +- /* sleep required to ensure USB0 is disabled before sleep continues */ +- if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB7))) +- dev_err(device, "ROG Ally MCU failed to disconnect USB dev\n"); +- else +- msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); +- } +- return 0; +-} +- + static int asus_hotk_restore(struct device *device) + { + struct asus_wmi *asus = dev_get_drvdata(device); +@@ -4979,11 +4963,32 @@ static int asus_hotk_restore(struct device *device) + return 0; + } + ++static void asus_ally_s2idle_restore(void) ++{ ++ if (ally_mcu_usb_plug) { ++ acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, ASUS_USB0_PWR_EC0_CSEE_ON); ++ msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); ++ } ++} + ++static int asus_hotk_prepare(struct device *device) ++{ ++ if (ally_mcu_usb_plug) { ++ acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, ASUS_USB0_PWR_EC0_CSEE_OFF); ++ msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); ++ } ++ return 0; ++} ++ ++/* Use only for Ally devices due to the wake_on_ac */ ++static struct acpi_s2idle_dev_ops asus_ally_s2idle_dev_ops = { ++ .restore = asus_ally_s2idle_restore, ++}; ++ + static const struct dev_pm_ops asus_pm_ops = { + .thaw = asus_hotk_thaw, + .restore = asus_hotk_restore, + .resume = asus_hotk_resume, +- .resume_early = asus_hotk_resume_early, + .prepare = asus_hotk_prepare, + }; + +@@ -5011,6 +5016,10 @@ static int asus_wmi_probe(struct platform_device *pdev) + return ret; + } + ++ ret = acpi_register_lps0_dev(&asus_ally_s2idle_dev_ops); ++ if (ret) ++ pr_warn("failed to register LPS0 sleep handler in asus-wmi\n"); ++ + return asus_wmi_add(pdev); + } + +@@ -5043,6 +5052,7 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver); + + void asus_wmi_unregister_driver(struct asus_wmi_driver *driver) + { ++ acpi_unregister_lps0_dev(&asus_ally_s2idle_dev_ops); + platform_device_unregister(driver->platform_device); + platform_driver_unregister(&driver->platform_driver); + used = false; +-- +2.48.1 + + +From cf54f159d77c17b2524c1686673e081f225ed4ce Mon Sep 17 00:00:00 2001 +From: Luke Jones +Date: Tue, 11 Feb 2025 00:05:08 +1300 +Subject: [PATCH 07/30] hid-asus: set mcu hack to off if required MCU version + +Signed-off-by: Luke Jones +--- + drivers/hid/hid-asus.c | 3 +++ + drivers/platform/x86/asus-wmi.c | 12 +++++++++++- + include/linux/platform_data/x86/asus-wmi.h | 4 ++++ + 3 files changed, 18 insertions(+), 1 deletion(-) + +diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c +index 040eeb25f706..93217442b4b6 100644 +--- a/drivers/hid/hid-asus.c ++++ b/drivers/hid/hid-asus.c +@@ -614,6 +614,8 @@ static void mcu_maybe_warn_version(struct hid_device *hdev, int idProduct) + "The MCU version must be %d or greater\n" + "Please update your MCU with official ASUS firmware release\n", + min_version); ++ } else { ++ set_ally_mcu_hack_available(false); + } + } + +@@ -1420,4 +1422,5 @@ static struct hid_driver asus_driver = { + }; + module_hid_driver(asus_driver); + ++MODULE_IMPORT_NS("ASUS_WMI"); + MODULE_LICENSE("GPL"); +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 5033dd45103c..2afb949ac397 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -338,6 +338,16 @@ struct asus_wmi { + + static bool ally_mcu_usb_plug; + +/* -+ * / - debugfs root directory -+ * dev_id - current dev_id -+ * ctrl_param - current ctrl_param -+ * method_id - current method_id -+ * devs - call DEVS(dev_id, ctrl_param) and print result -+ * dsts - call DSTS(dev_id) and print result -+ * call - call method_id(dev_id, ctrl_param) and print result ++ * The HID driver needs to check MCU version and set this to false if the MCU FW ++ * version is >= the minimum requirements. New FW do not need the hacks. + */ -+struct asus_wmi_debug { -+ struct dentry *root; -+ u32 method_id; -+ u32 dev_id; -+ u32 ctrl_param; -+}; -+ -+struct asus_rfkill { -+ struct asus_wmi *asus; -+ struct rfkill *rfkill; -+ u32 dev_id; -+}; -+ -+enum fan_type { -+ FAN_TYPE_NONE = 0, -+ FAN_TYPE_AGFN, /* deprecated on newer platforms */ -+ FAN_TYPE_SPEC83, /* starting in Spec 8.3, use CPU_FAN_CTRL */ -+}; -+ -+#define FAN_CURVE_POINTS 8 -+ -+struct fan_curve_data { -+ bool enabled; -+ u32 device_id; -+ u8 temps[FAN_CURVE_POINTS]; -+ u8 percents[FAN_CURVE_POINTS]; -+}; -+ -+struct asus_wmi { -+ int dsts_id; -+ int spec; -+ int sfun; -+ -+ struct input_dev *inputdev; -+ struct backlight_device *backlight_device; -+ struct backlight_device *screenpad_backlight_device; -+ struct platform_device *platform_device; -+ -+ struct led_classdev wlan_led; -+ int wlan_led_wk; -+ struct led_classdev tpd_led; -+ int tpd_led_wk; -+ struct led_classdev kbd_led; -+ int kbd_led_wk; -+ struct led_classdev lightbar_led; -+ int lightbar_led_wk; -+ struct led_classdev micmute_led; -+ struct led_classdev camera_led; -+ struct workqueue_struct *led_workqueue; -+ struct work_struct tpd_led_work; -+ struct work_struct wlan_led_work; -+ struct work_struct lightbar_led_work; -+ -+ struct asus_rfkill wlan; -+ struct asus_rfkill bluetooth; -+ struct asus_rfkill wimax; -+ struct asus_rfkill wwan3g; -+ struct asus_rfkill gps; -+ struct asus_rfkill uwb; -+ -+ int tablet_switch_event_code; -+ u32 tablet_switch_dev_id; -+ bool tablet_switch_inverted; -+ -+ bool mcu_powersave_available; -+ -+ enum fan_type fan_type; -+ enum fan_type gpu_fan_type; -+ enum fan_type mid_fan_type; -+ int fan_pwm_mode; -+ int gpu_fan_pwm_mode; -+ int mid_fan_pwm_mode; -+ int agfn_pwm; -+ -+ bool fan_boost_mode_available; -+ u8 fan_boost_mode_mask; -+ u8 fan_boost_mode; -+ -+ bool egpu_enable_available; -+ bool dgpu_disable_available; -+ u32 gpu_mux_dev; -+ -+ /* Tunables provided by ASUS for gaming laptops */ -+ u32 ppt_pl2_sppt; -+ u32 ppt_pl1_spl; -+ u32 ppt_apu_sppt; -+ u32 ppt_platform_sppt; -+ u32 ppt_fppt; -+ u32 nv_dynamic_boost; -+ u32 nv_temp_target; -+ -+ u32 kbd_rgb_dev; -+ bool kbd_rgb_state_available; -+ -+ u8 throttle_thermal_policy_mode; -+ u32 throttle_thermal_policy_dev; -+ -+ bool cpu_fan_curve_available; -+ bool gpu_fan_curve_available; -+ bool mid_fan_curve_available; -+ struct fan_curve_data custom_fan_curves[3]; -+ -+ // struct device *ppdev; -+ struct platform_profile_handler platform_profile_handler; -+ bool platform_profile_support; -+ -+ // The RSOC controls the maximum charging percentage. -+ bool battery_rsoc_available; -+ -+ bool panel_overdrive_available; -+ u32 mini_led_dev_id; -+ -+ struct hotplug_slot hotplug_slot; -+ struct mutex hotplug_lock; -+ struct mutex wmi_lock; -+ struct workqueue_struct *hotplug_workqueue; -+ struct work_struct hotplug_work; -+ -+ bool fnlock_locked; -+ -+ struct asus_wmi_debug debug; ++void set_ally_mcu_hack_available(bool enabled) ++{ ++ ally_mcu_usb_plug = enabled; ++} ++EXPORT_SYMBOL_NS_GPL(set_ally_mcu_hack_available, "ASUS_WMI"); + -+ struct asus_wmi_driver *driver; -+}; + /* WMI ************************************************************************/ - /* WMI Methods */ - #define ASUS_WMI_METHODID_SPEC 0x43455053 /* BIOS SPECification */ + static int asus_wmi_evaluate_method3(u32 method_id, +@@ -4712,7 +4722,7 @@ static int asus_wmi_add(struct platform_device *pdev) + + ally_mcu_usb_plug = acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE) + && dmi_check_system(asus_rog_ally_device); +- if (ally_mcu_usb_plug) { ++ if (ally_mcu_usb_plug && dmi_match(DMI_BOARD_NAME, "RC71")) { + /* + * These steps ensure the device is in a valid good state, this is + * especially important for the Ally 1 after a reboot. +diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h +index 783e2a336861..f1b96f90e8e2 100644 +--- a/include/linux/platform_data/x86/asus-wmi.h ++++ b/include/linux/platform_data/x86/asus-wmi.h +@@ -158,8 +158,12 @@ + #define ASUS_WMI_DSTS_LIGHTBAR_MASK 0x0000000F + + #if IS_REACHABLE(CONFIG_ASUS_WMI) ++void set_ally_mcu_hack_available(bool enabled); + int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval); + #else ++static inline void set_ally_mcu_hack_available(bool enabled) { ++ return -ENODEV; ++} + static inline int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, + u32 *retval) + { -- -2.47.1 +2.48.1 -From 9480632d43f796b298bfb2fdbea5e4bb9ca2a340 Mon Sep 17 00:00:00 2001 +From b6469d0b7d78a725f03f36da3432e915f8a53d86 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Mon, 26 Aug 2024 12:49:35 +1200 -Subject: [PATCH 07/28] hid-asus-ally: Add joystick LED ring support +Subject: [PATCH 08/30] hid-asus-ally: Add joystick LED ring support Adds basic support for the joystick RGB LED rings as a multicolour LED device with 4 LEDs. @@ -757,10 +517,10 @@ Signed-off-by: Luke D. Jones --- drivers/hid/Kconfig | 9 + drivers/hid/Makefile | 1 + - drivers/hid/hid-asus-ally.c | 627 ++++++++++++++++++++++++++++++++++++ + drivers/hid/hid-asus-ally.c | 619 ++++++++++++++++++++++++++++++++++++ drivers/hid/hid-asus-ally.h | 38 +++ - drivers/hid/hid-asus.c | 116 +------ - 5 files changed, 689 insertions(+), 102 deletions(-) + drivers/hid/hid-asus.c | 107 +------ + 5 files changed, 681 insertions(+), 93 deletions(-) create mode 100644 drivers/hid/hid-asus-ally.c create mode 100644 drivers/hid/hid-asus-ally.h @@ -798,10 +558,10 @@ index 24de45f3677d..f338c9eb4600 100644 obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c new file mode 100644 -index 000000000000..4ceb4aab8084 +index 000000000000..86b0c7deb719 --- /dev/null +++ b/drivers/hid/hid-asus-ally.c -@@ -0,0 +1,627 @@ +@@ -0,0 +1,619 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * HID driver for Asus ROG laptops and Ally @@ -1253,19 +1013,11 @@ index 000000000000..4ceb4aab8084 + + hid_info(hdev, "Ally device MCU version: %d\n", version); + if (version < min_version) { ++ set_ally_mcu_hack_available(false); + hid_warn(hdev, + "The MCU version must be %d or greater\n" + "Please update your MCU with official ASUS firmware release\n", + min_version); -+ /* Get the asus platform device */ -+ dev = bus_find_device_by_name(&platform_bus_type, NULL, "asus-nb-wmi"); -+ if (dev) { -+ asus = dev_get_drvdata(dev); -+ /* Do not show the powersave attribute if MCU version too low */ -+ if (asus) -+ asus->mcu_powersave_available = false; -+ put_device(dev); -+ } + } +} + @@ -1328,7 +1080,7 @@ index 000000000000..4ceb4aab8084 + + /* This should almost always exist */ + if (ep == ROG_ALLY_CFG_INTF_IN) { -+ mcu_maybe_warn_version(hdev, idProduct); ++ validate_mcu_fw_version(hdev, idProduct); + + drvdata.led_rgb_dev = ally_rgb_create(hdev); + if (IS_ERR(drvdata.led_rgb_dev)) @@ -1474,10 +1226,10 @@ index 000000000000..eb8617c80c2a + xpad_cmd_len_adz = 0x02, +}; diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c -index 641bf1f8c747..bd28250777f1 100644 +index 93217442b4b6..fb29486478f7 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c -@@ -53,9 +53,9 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); +@@ -52,9 +52,9 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); #define FEATURE_KBD_LED_REPORT_ID1 0x5d #define FEATURE_KBD_LED_REPORT_ID2 0x5e @@ -1490,7 +1242,7 @@ index 641bf1f8c747..bd28250777f1 100644 #define SUPPORT_KBD_BACKLIGHT BIT(0) -@@ -540,100 +540,9 @@ static bool asus_kbd_wmi_led_control_present(struct hid_device *hdev) +@@ -539,91 +539,9 @@ static bool asus_kbd_wmi_led_control_present(struct hid_device *hdev) return !!(value & ASUS_WMI_DSTS_PRESENCE_BIT); } @@ -1549,8 +1301,6 @@ index 641bf1f8c747..bd28250777f1 100644 -static void mcu_maybe_warn_version(struct hid_device *hdev, int idProduct) -{ - int min_version, version; -- struct asus_wmi *asus; -- struct device *dev; - - min_version = ROG_ALLY_X_MIN_MCU; - version = mcu_request_version(hdev); @@ -1571,15 +1321,8 @@ index 641bf1f8c747..bd28250777f1 100644 - "The MCU version must be %d or greater\n" - "Please update your MCU with official ASUS firmware release\n", - min_version); -- /* Get the asus platform device */ -- dev = bus_find_device_by_name(&platform_bus_type, NULL, "asus-nb-wmi"); -- if (dev) { -- asus = dev_get_drvdata(dev); -- /* Do not show the powersave attribute if MCU version too low */ -- if (asus) -- asus->mcu_powersave_available = false; -- put_device(dev); -- } +- } else { +- set_ally_mcu_hack_available(false); - } -} - @@ -1591,7 +1334,7 @@ index 641bf1f8c747..bd28250777f1 100644 unsigned char kbd_func; int ret; -@@ -657,14 +566,6 @@ static int asus_kbd_register_leds(struct hid_device *hdev) +@@ -647,14 +565,6 @@ static int asus_kbd_register_leds(struct hid_device *hdev) if (ret < 0) return ret; } @@ -1606,7 +1349,7 @@ index 641bf1f8c747..bd28250777f1 100644 } else { /* Initialize keyboard */ ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID); -@@ -1134,6 +1035,17 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) +@@ -1124,6 +1034,17 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) drvdata->quirks = id->driver_data; @@ -1625,13 +1368,13 @@ index 641bf1f8c747..bd28250777f1 100644 * T90CHI's keyboard dock returns same ID values as T100CHI's dock. * Thus, identify T90CHI dock with product name string. -- -2.47.1 +2.48.1 -From 7d7558f4323d8f9187fbb082f7bb3ad4286a78ec Mon Sep 17 00:00:00 2001 +From 81aec29f33af181e3004829f89673855ce6e9d13 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Wed, 2 Oct 2024 23:32:46 +1300 -Subject: [PATCH 08/28] hid-asus-ally: initial Ally-X gamepad +Subject: [PATCH 09/30] hid-asus-ally: initial Ally-X gamepad Signed-off-by: Luke D. Jones --- @@ -1640,7 +1383,7 @@ Signed-off-by: Luke D. Jones 2 files changed, 389 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index 4ceb4aab8084..3d950535c3e2 100644 +index 86b0c7deb719..b7d22c1747b0 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -50,6 +50,51 @@ static const struct hid_device_id rog_ally_devices[] = { @@ -2038,7 +1781,7 @@ index 4ceb4aab8084..3d950535c3e2 100644 /* * We don't care about any other part of the string except the version section. * Example strings: FGA80100.RC72LA.312_T01, FGA80100.RC71LS.318_T01 -@@ -493,7 +860,8 @@ static int ally_hid_probe(struct hid_device *hdev, const struct hid_device_id *_ +@@ -485,7 +852,8 @@ static int ally_hid_probe(struct hid_device *hdev, const struct hid_device_id *_ if (ep < 0) return ep; @@ -2048,7 +1791,7 @@ index 4ceb4aab8084..3d950535c3e2 100644 return -ENODEV; ret = hid_parse(hdev); -@@ -536,6 +904,17 @@ static int ally_hid_probe(struct hid_device *hdev, const struct hid_device_id *_ +@@ -528,6 +896,17 @@ static int ally_hid_probe(struct hid_device *hdev, const struct hid_device_id *_ goto err_close; } @@ -2066,7 +1809,7 @@ index 4ceb4aab8084..3d950535c3e2 100644 return 0; err_close: -@@ -550,6 +929,9 @@ static void ally_hid_remove(struct hid_device *hdev) +@@ -542,6 +921,9 @@ static void ally_hid_remove(struct hid_device *hdev) if (drvdata.led_rgb_dev) ally_rgb_remove(hdev); @@ -2076,7 +1819,7 @@ index 4ceb4aab8084..3d950535c3e2 100644 hid_hw_close(hdev); hid_hw_stop(hdev); } -@@ -602,6 +984,7 @@ static struct hid_driver +@@ -594,6 +976,7 @@ static struct hid_driver .id_table = rog_ally_devices, .probe = ally_hid_probe, .remove = ally_hid_remove, @@ -2098,13 +1841,13 @@ index eb8617c80c2a..458d02996bca 100644 + struct device_attribute dev_attr_##_name = \ + __ATTR(_sysfs_name, 0644, _name##_show, _name##_store) -- -2.47.1 +2.48.1 -From 146afa6c8d47142eff2e0de7dee7c4301f77aeae Mon Sep 17 00:00:00 2001 +From 2716866a4a92fe3a71ce72888599a5344c4ec0f7 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Wed, 2 Oct 2024 23:51:36 +1300 -Subject: [PATCH 09/28] hid-asus-ally: initial gamepad configuration +Subject: [PATCH 10/30] hid-asus-ally: initial gamepad configuration Signed-off-by: Luke D. Jones --- @@ -2113,7 +1856,7 @@ Signed-off-by: Luke D. Jones 2 files changed, 266 insertions(+), 18 deletions(-) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index 3d950535c3e2..822139e2a5c0 100644 +index b7d22c1747b0..4935ab36aa35 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -10,7 +10,6 @@ @@ -2397,7 +2140,7 @@ index 3d950535c3e2..822139e2a5c0 100644 return 0; } -@@ -900,7 +1130,13 @@ static int ally_hid_probe(struct hid_device *hdev, const struct hid_device_id *_ +@@ -892,7 +1122,13 @@ static int ally_hid_probe(struct hid_device *hdev, const struct hid_device_id *_ else hid_info(hdev, "Created Ally RGB LED controls.\n"); @@ -2412,7 +2155,7 @@ index 3d950535c3e2..822139e2a5c0 100644 goto err_close; } -@@ -913,6 +1149,12 @@ static int ally_hid_probe(struct hid_device *hdev, const struct hid_device_id *_ +@@ -905,6 +1141,12 @@ static int ally_hid_probe(struct hid_device *hdev, const struct hid_device_id *_ goto err_close; } hid_info(hdev, "Created Ally X controller.\n"); @@ -2488,13 +2231,13 @@ index 458d02996bca..2b298ad4da0e 100644 #define ALLY_DEVICE_ATTR_RW(_name, _sysfs_name) \ struct device_attribute dev_attr_##_name = \ -- -2.47.1 +2.48.1 -From 9bbfc9800a5489d1d6585d2174e2b34660026e1f Mon Sep 17 00:00:00 2001 +From 2e9a04a44b0b8ad6ae4b82aced1b78d0daf00af3 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 5 Oct 2024 14:58:33 +1300 -Subject: [PATCH 10/28] hid-asus-ally: add button remap attributes +Subject: [PATCH 11/30] hid-asus-ally: add button remap attributes Signed-off-by: Luke D. Jones --- @@ -2503,7 +2246,7 @@ Signed-off-by: Luke D. Jones 2 files changed, 586 insertions(+), 18 deletions(-) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index 822139e2a5c0..884cb688197e 100644 +index 4935ab36aa35..f5a50eaa7e75 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -57,6 +57,152 @@ struct btn_code_map { @@ -2958,7 +2701,7 @@ index 822139e2a5c0..884cb688197e 100644 /**************************************************************************************************/ /* ROG Ally gamepad i/o and force-feedback */ /**************************************************************************************************/ -@@ -1174,6 +1528,9 @@ static void ally_hid_remove(struct hid_device *hdev) +@@ -1166,6 +1520,9 @@ static void ally_hid_remove(struct hid_device *hdev) if (drvdata.ally_x) ally_x_remove(hdev); @@ -3200,13 +2943,13 @@ index 2b298ad4da0e..f985cbd698c3 100644 + .attrs = _fname##_attrs, \ + } -- -2.47.1 +2.48.1 -From 9bd5cccfdb79320029875979dede71904f068cc1 Mon Sep 17 00:00:00 2001 +From d714ade992b6ac4e2684bbb3f2c65b8a0c766afc Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Fri, 25 Oct 2024 08:56:54 +0200 -Subject: [PATCH 11/28] hid-asus-ally: add gamepad mode selection +Subject: [PATCH 12/30] hid-asus-ally: add gamepad mode selection --- drivers/hid/hid-asus-ally.c | 73 +++++++++++++++++++++++++++++++++++++ @@ -3214,7 +2957,7 @@ Subject: [PATCH 11/28] hid-asus-ally: add gamepad mode selection 2 files changed, 75 insertions(+) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index 884cb688197e..08e953f6a3c5 100644 +index f5a50eaa7e75..8a49d37c20e7 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -647,9 +647,82 @@ static ssize_t btn_mapping_reset_store(struct device *dev, struct device_attribu @@ -3321,13 +3064,13 @@ index f985cbd698c3..f7e21be50d8e 100644 xpad_cmd_len_leds = 0x0C, }; -- -2.47.1 +2.48.1 -From 7864114a616a7e485fd12afe6a80ebbcfd756215 Mon Sep 17 00:00:00 2001 +From aa0e8815323970879f5c92ae9f28242cd8d9ef54 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 5 Oct 2024 15:40:09 +1300 -Subject: [PATCH 12/28] hid-asus-ally: Turbo settings for buttons +Subject: [PATCH 13/30] hid-asus-ally: Turbo settings for buttons Signed-off-by: Luke D. Jones --- @@ -3336,7 +3079,7 @@ Signed-off-by: Luke D. Jones 2 files changed, 108 insertions(+), 14 deletions(-) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index 08e953f6a3c5..53c2b36c14fb 100644 +index 8a49d37c20e7..4812c060afa2 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -236,6 +236,7 @@ static const char* btn_to_name(u64 key) @@ -3521,13 +3264,13 @@ index f7e21be50d8e..63a3b5caa71c 100644 + .attrs = _fname##_turbo_attrs, \ + } -- -2.47.1 +2.48.1 -From f19752b0af90acea553188b1baa9f18dabc684c2 Mon Sep 17 00:00:00 2001 +From b221aa86e9c3d0459e07aa8d1878b427d6137ec0 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 5 Oct 2024 20:46:00 +1300 -Subject: [PATCH 13/28] hid-asus-ally: add vibration intensity settings +Subject: [PATCH 14/30] hid-asus-ally: add vibration intensity settings Signed-off-by: Luke D. Jones --- @@ -3536,7 +3279,7 @@ Signed-off-by: Luke D. Jones 2 files changed, 99 insertions(+) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index 53c2b36c14fb..8b40b806631c 100644 +index 4812c060afa2..01d0ff6169fd 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -270,6 +270,11 @@ struct ally_gamepad_cfg { @@ -3692,13 +3435,13 @@ index 63a3b5caa71c..6ac79ad3c5f2 100644 #define ALLY_BTN_SHOW(_fname, _btn_name, _secondary) \ static ssize_t _fname##_show(struct device *dev, \ -- -2.47.1 +2.48.1 -From e59c4657466b382c250568f87ec742bfefaa25bf Mon Sep 17 00:00:00 2001 +From d8b6f0e5e7bd8ae186455667c671cd0b5f1dd99f Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 5 Oct 2024 21:32:41 +1300 -Subject: [PATCH 14/28] hid-asus-ally: add JS deadzones +Subject: [PATCH 15/30] hid-asus-ally: add JS deadzones Signed-off-by: Luke D. Jones --- @@ -3707,7 +3450,7 @@ Signed-off-by: Luke D. Jones 2 files changed, 123 insertions(+) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index 8b40b806631c..64f4b466f0bb 100644 +index 01d0ff6169fd..08d66a179523 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -260,6 +260,11 @@ struct btn_mapping { @@ -3901,13 +3644,13 @@ index 6ac79ad3c5f2..3dc14a5226f3 100644 static struct attribute *_fname##_attrs[] = { \ &dev_attr_##_fname.attr, \ -- -2.47.1 +2.48.1 -From 2a5cd6d77dcc471ac4792100ef677c2beba316f0 Mon Sep 17 00:00:00 2001 +From 43ddec5698ccbdba43359e14c9837b05c9568df3 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 5 Oct 2024 21:37:27 +1300 -Subject: [PATCH 15/28] hid-asus-ally: add trigger deadzones +Subject: [PATCH 16/30] hid-asus-ally: add trigger deadzones Signed-off-by: Luke D. Jones --- @@ -3916,7 +3659,7 @@ Signed-off-by: Luke D. Jones 2 files changed, 44 insertions(+) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index 64f4b466f0bb..4a3e7cea1c5e 100644 +index 08d66a179523..066956922e17 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -284,6 +284,8 @@ struct ally_gamepad_cfg { @@ -4018,13 +3761,13 @@ index 3dc14a5226f3..32ed5caa3759 100644 xpad_cmd_set_leds = 0x08, xpad_cmd_check_ready = 0x0A, -- -2.47.1 +2.48.1 -From 8a42534a96ece50ab358fd5a15375aad1a89b39f Mon Sep 17 00:00:00 2001 +From 59bbde0bea81e630bc43d920c1ca06e204c6178a Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sun, 6 Oct 2024 19:49:24 +1300 -Subject: [PATCH 16/28] hid-asus-ally: add anti-deadzones +Subject: [PATCH 17/30] hid-asus-ally: add anti-deadzones Signed-off-by: Luke D. Jones --- @@ -4033,7 +3776,7 @@ Signed-off-by: Luke D. Jones 2 files changed, 112 insertions(+) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index 4a3e7cea1c5e..ff1c2cf61e66 100644 +index 066956922e17..8d2165b52b3b 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -286,6 +286,9 @@ struct ally_gamepad_cfg { @@ -4203,13 +3946,13 @@ index 32ed5caa3759..69f59592dd50 100644 /* Values correspond to the actual HID byte value required */ -- -2.47.1 +2.48.1 -From 29991f2b1cd7ff8af75db182707856f682f30a7e Mon Sep 17 00:00:00 2001 +From 7147a33b33d9370abf36025a92edf7a481795423 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sun, 6 Oct 2024 21:22:40 +1300 -Subject: [PATCH 17/28] hid-asus-ally: add JS response curves +Subject: [PATCH 18/30] hid-asus-ally: add JS response curves Signed-off-by: Luke D. Jones --- @@ -4218,7 +3961,7 @@ Signed-off-by: Luke D. Jones 2 files changed, 141 insertions(+) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index ff1c2cf61e66..aad965e069ee 100644 +index 8d2165b52b3b..705e6ab62d85 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -5,10 +5,12 @@ @@ -4445,13 +4188,100 @@ index 69f59592dd50..c83817589082 100644 static struct attribute *_fname##_attrs[] = { \ &dev_attr_##_fname.attr, \ -- -2.47.1 +2.48.1 + + +From 7687ce770f492f7c4ce0d3528e4a6dc994a6836e Mon Sep 17 00:00:00 2001 +From: Luke Jones +Date: Mon, 10 Feb 2025 17:15:01 +1300 +Subject: [PATCH 19/30] hid-asus-ally: mcu_version attribute +Signed-off-by: Luke Jones +--- + drivers/hid/hid-asus-ally.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) -From a46fa579d620183c76a594bf70df3864ee7c3f21 Mon Sep 17 00:00:00 2001 +diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c +index 705e6ab62d85..2783cc054acd 100644 +--- a/drivers/hid/hid-asus-ally.c ++++ b/drivers/hid/hid-asus-ally.c +@@ -380,6 +380,7 @@ static struct ally_drvdata { + struct ally_gamepad_cfg *gamepad_cfg; + struct ally_rgb_dev *led_rgb_dev; + struct ally_rgb_data led_rgb_data; ++ uint mcu_version; + } drvdata; + + /** +@@ -1184,6 +1185,13 @@ static ssize_t gamepad_mode_store(struct device *dev, struct device_attribute *a + + DEVICE_ATTR_RW(gamepad_mode); + ++static ssize_t mcu_version_show(struct device *dev, struct device_attribute *attr, char *buf) ++{ ++ return sysfs_emit(buf, "%d\n", drvdata.mcu_version); ++} ++ ++DEVICE_ATTR_RO(mcu_version); ++ + /* ROOT LEVEL ATTRS *******************************************************************************/ + static struct attribute *gamepad_device_attrs[] = { + &dev_attr_btn_mapping_reset.attr, +@@ -1191,6 +1199,7 @@ static struct attribute *gamepad_device_attrs[] = { + &dev_attr_gamepad_apply_all.attr, + &dev_attr_gamepad_vibration_intensity.attr, + &dev_attr_gamepad_vibration_intensity_index.attr, ++ &dev_attr_mcu_version.attr, + NULL + }; + +@@ -1929,14 +1938,13 @@ static int mcu_request_version(struct hid_device *hdev) + return ret; + } + +-static void mcu_maybe_warn_version(struct hid_device *hdev, int idProduct) ++static void validate_mcu_fw_version(struct hid_device *hdev, int idProduct) + { + int min_version, version; +- struct asus_wmi *asus; +- struct device *dev; + + min_version = ROG_ALLY_X_MIN_MCU; + version = mcu_request_version(hdev); ++ drvdata.mcu_version = version; + if (version) { + switch (idProduct) { + case USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY: +@@ -1950,11 +1958,12 @@ static void mcu_maybe_warn_version(struct hid_device *hdev, int idProduct) + + hid_info(hdev, "Ally device MCU version: %d\n", version); + if (version < min_version) { +- set_ally_mcu_hack_available(false); + hid_warn(hdev, + "The MCU version must be %d or greater\n" + "Please update your MCU with official ASUS firmware release\n", + min_version); ++ } else { ++ set_ally_mcu_hack_available(false); + } + } + +@@ -2146,6 +2155,7 @@ static void __exit rog_ally_exit(void) + module_init(rog_ally_init); + module_exit(rog_ally_exit); + ++MODULE_IMPORT_NS("ASUS_WMI"); + MODULE_AUTHOR("Luke D. Jones"); + MODULE_DESCRIPTION("HID Driver for ASUS ROG Ally gamepad configuration."); + MODULE_LICENSE("GPL"); +-- +2.48.1 + + +From 062c28dce932ffe640c95165a9cfe6b2e1e54aaa Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Thu, 10 Oct 2024 11:15:36 +1300 -Subject: [PATCH 18/28] hid-asus-ally: add calibrations (wip) +Subject: [PATCH 20/30] hid-asus-ally: add calibrations (wip) Signed-off-by: Luke D. Jones --- @@ -4459,7 +4289,7 @@ Signed-off-by: Luke D. Jones 1 file changed, 95 insertions(+) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index aad965e069ee..a1015713c245 100644 +index 2783cc054acd..79a3cfffc01d 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -278,6 +278,28 @@ struct response_curve { @@ -4501,8 +4331,8 @@ index aad965e069ee..a1015713c245 100644 }; /* The hatswitch outputs integers, we use them to index this X|Y pair */ -@@ -382,6 +407,18 @@ static struct ally_drvdata { - struct ally_rgb_data led_rgb_data; +@@ -383,6 +408,18 @@ static struct ally_drvdata { + uint mcu_version; } drvdata; +static void reverse_bytes_in_pairs(u8 *buf, size_t size) { @@ -4520,7 +4350,7 @@ index aad965e069ee..a1015713c245 100644 /** * asus_dev_set_report - send set report request to device. * -@@ -795,6 +832,63 @@ ALLY_JS_RC_POINT(axis_xy_right, response, 2); +@@ -796,6 +833,63 @@ ALLY_JS_RC_POINT(axis_xy_right, response, 2); ALLY_JS_RC_POINT(axis_xy_right, response, 3); ALLY_JS_RC_POINT(axis_xy_right, response, 4); @@ -4584,7 +4414,7 @@ index aad965e069ee..a1015713c245 100644 static struct attribute *axis_xy_left_attrs[] = { &dev_attr_axis_xy_left_anti_deadzone.attr, &dev_attr_axis_xy_left_deadzone.attr, -@@ -1266,6 +1360,7 @@ static struct ally_gamepad_cfg *ally_gamepad_cfg_create(struct hid_device *hdev) +@@ -1275,6 +1369,7 @@ static struct ally_gamepad_cfg *ally_gamepad_cfg_create(struct hid_device *hdev) ally_cfg->key_mapping[ally_cfg->mode - 1].btn_m1.button = BTN_KB_M1; ally_cfg->key_mapping[ally_cfg->mode - 1].btn_m2.button = BTN_KB_M2; _gamepad_apply_btn_pair(hdev, ally_cfg, btn_pair_m1_m2); @@ -4593,20 +4423,67 @@ index aad965e069ee..a1015713c245 100644 ally_cfg->vibration_intensity[0] = 0x64; ally_cfg->vibration_intensity[1] = 0x64; -- -2.47.1 +2.48.1 + + +From 747ff0ec3802785d28b703ab9f369fee6fd53376 Mon Sep 17 00:00:00 2001 +From: Luke Jones +Date: Tue, 11 Feb 2025 13:24:02 +1300 +Subject: [PATCH 21/30] hid-asus-ally: set default backface btns to F14/15 + +Signed-off-by: Luke Jones +--- + drivers/hid/hid-asus-ally.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c +index 79a3cfffc01d..f4d852c0481d 100644 +--- a/drivers/hid/hid-asus-ally.c ++++ b/drivers/hid/hid-asus-ally.c +@@ -1354,6 +1354,8 @@ static struct ally_gamepad_cfg *ally_gamepad_cfg_create(struct hid_device *hdev) + input_dev->uniq = hdev->uniq; + input_dev->name = "ASUS ROG Ally Config"; + input_set_capability(input_dev, EV_KEY, KEY_PROG1); ++ input_set_capability(input_dev, EV_KEY, KEY_F14); ++ input_set_capability(input_dev, EV_KEY, KEY_F15); + input_set_capability(input_dev, EV_KEY, KEY_F16); + input_set_capability(input_dev, EV_KEY, KEY_F17); + input_set_capability(input_dev, EV_KEY, KEY_F18); +@@ -1366,8 +1368,8 @@ static struct ally_gamepad_cfg *ally_gamepad_cfg_create(struct hid_device *hdev) + + /* ignore all errors for this as they are related to USB HID I/O */ + _gamepad_set_xpad_default(ally_cfg); +- ally_cfg->key_mapping[ally_cfg->mode - 1].btn_m1.button = BTN_KB_M1; +- ally_cfg->key_mapping[ally_cfg->mode - 1].btn_m2.button = BTN_KB_M2; ++ ally_cfg->key_mapping[ally_cfg->mode - 1].btn_m1.button = BTN_KB_F15; ++ ally_cfg->key_mapping[ally_cfg->mode - 1].btn_m2.button = BTN_KB_F14; + _gamepad_apply_btn_pair(hdev, ally_cfg, btn_pair_m1_m2); + gamepad_get_calibration(hdev); + +@@ -1594,6 +1596,8 @@ static struct input_dev *ally_x_setup_input(struct hid_device *hdev) + input_set_capability(input, EV_KEY, BTN_THUMBR); + + input_set_capability(input, EV_KEY, KEY_PROG1); ++ input_set_capability(input, EV_KEY, KEY_F14); ++ input_set_capability(input, EV_KEY, KEY_F15); + input_set_capability(input, EV_KEY, KEY_F16); + input_set_capability(input, EV_KEY, KEY_F17); + input_set_capability(input, EV_KEY, KEY_F18); +-- +2.48.1 -From ce9ddc7e913a1d52fa4fb4b6e1330e2746b0a8e9 Mon Sep 17 00:00:00 2001 +From a6761693908de1334694a354f4ad93a0a25e9f72 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Wed, 6 Nov 2024 00:27:03 +0300 -Subject: [PATCH 19/28] debug by default +Subject: [PATCH 22/30] debug by default --- drivers/hid/hid-asus-ally.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-asus-ally.c b/drivers/hid/hid-asus-ally.c -index a1015713c245..c10121ebcbb8 100644 +index f4d852c0481d..b5688f1401a5 100644 --- a/drivers/hid/hid-asus-ally.c +++ b/drivers/hid/hid-asus-ally.c @@ -21,6 +21,8 @@ @@ -4619,13 +4496,127 @@ index a1015713c245..c10121ebcbb8 100644 #define FEATURE_REPORT_ID 0x0d #define FEATURE_ROG_ALLY_REPORT_ID 0x5a -- -2.47.1 +2.48.1 -From c80e393a6ffe8c8085107bbe9b2fcb0a9eff199a Mon Sep 17 00:00:00 2001 +From 18cc2e984ebf1b7f7abf7d28e78c56b23840d64f Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" +Date: Sun, 22 Sep 2024 21:40:46 +1200 +Subject: [PATCH 23/30] platform/x86: asus-wmi: export symbols used for + read/write WMI + +Export some rather helpful read/write WMI symbols using a namespace. +These are DEVS and DSTS only, or require the arg0 input. + +Also does a slight refactor of internals of these functions. + +Signed-off-by: Luke D. Jones +Reviewed-by: Mario Limonciello +--- + drivers/platform/x86/asus-wmi.c | 44 ++++++++++++++++++++-- + include/linux/platform_data/x86/asus-wmi.h | 10 +++++ + 2 files changed, 51 insertions(+), 3 deletions(-) + +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 2afb949ac397..c39b79571ec2 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -398,7 +398,7 @@ int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval) + { + return asus_wmi_evaluate_method3(method_id, arg0, arg1, 0, retval); + } +-EXPORT_SYMBOL_GPL(asus_wmi_evaluate_method); ++EXPORT_SYMBOL_NS_GPL(asus_wmi_evaluate_method, "ASUS_WMI"); + + static int asus_wmi_evaluate_method5(u32 method_id, + u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 *retval) +@@ -562,12 +562,50 @@ static int asus_wmi_get_devstate(struct asus_wmi *asus, u32 dev_id, u32 *retval) + return 0; + } + +-static int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, +- u32 *retval) ++/** ++ * asus_wmi_get_devstate_dsts() - Get the WMI function state. ++ * @dev_id: The WMI method ID to call. ++ * @retval: A pointer to where to store the value returned from WMI. ++ * ++ * On success the return value is 0, and the retval is a valid value returned ++ * by the successful WMI function call otherwise an error is returned if the ++ * call failed, or if the WMI method ID is unsupported. ++ */ ++int asus_wmi_get_devstate_dsts(u32 dev_id, u32 *retval) ++{ ++ int err; ++ ++ err = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS, dev_id, 0, retval); ++ if (err) ++ return err; ++ ++ if (*retval == ASUS_WMI_UNSUPPORTED_METHOD) ++ return -ENODEV; ++ ++ return 0; ++} ++EXPORT_SYMBOL_NS_GPL(asus_wmi_get_devstate_dsts, "ASUS_WMI"); ++ ++/** ++ * asus_wmi_set_devstate() - Set the WMI function state. ++ * @dev_id: The WMI function to call. ++ * @ctrl_param: The argument to be used for this WMI function. ++ * @retval: A pointer to where to store the value returned from WMI. ++ * ++ * The returned WMI function state if not checked here for error as ++ * asus_wmi_set_devstate() is not called unless first paired with a call to ++ * asus_wmi_get_devstate_dsts() to check that the WMI function is supported. ++ * ++ * On success the return value is 0, and the retval is a valid value returned ++ * by the successful WMI function call. An error value is returned only if the ++ * WMI function failed. ++ */ ++int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval) + { + return asus_wmi_evaluate_method(ASUS_WMI_METHODID_DEVS, dev_id, + ctrl_param, retval); + } ++EXPORT_SYMBOL_NS_GPL(asus_wmi_set_devstate, "ASUS_WMI"); + + /* Helper for special devices with magic return codes */ + static int asus_wmi_get_devstate_bits(struct asus_wmi *asus, +diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h +index f1b96f90e8e2..7c886a93d554 100644 +--- a/include/linux/platform_data/x86/asus-wmi.h ++++ b/include/linux/platform_data/x86/asus-wmi.h +@@ -159,11 +159,21 @@ + + #if IS_REACHABLE(CONFIG_ASUS_WMI) + void set_ally_mcu_hack_available(bool enabled); ++int asus_wmi_get_devstate_dsts(u32 dev_id, u32 *retval); ++int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval); + int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval); + #else + static inline void set_ally_mcu_hack_available(bool enabled) { + return -ENODEV; + } ++static inline int asus_wmi_get_devstate_dsts(u32 dev_id, u32 *retval) ++{ ++ return -ENODEV; ++} ++static inline int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval) ++{ ++ return -ENODEV; ++} + static inline int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, + u32 *retval) + { +-- +2.48.1 + + +From 61ce3d6b7e6dbcfbdaff51bd2cb707c79a3a071f Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sun, 22 Sep 2024 21:39:43 +1200 -Subject: [PATCH 20/28] platform/x86: asus-armoury: move existing tunings to +Subject: [PATCH 24/30] platform/x86: asus-armoury: move existing tunings to asus-armoury module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -5416,7 +5407,7 @@ index 000000000000..440f41c5df3b + +#endif /* _ASUS_ARMOURY_H_ */ diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index c02d9fa89799..b91cb5538b2d 100644 +index c39b79571ec2..9f0153ee8601 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -55,8 +55,6 @@ module_param(fnlock_default, bool, 0444); @@ -5438,12 +5429,12 @@ index c02d9fa89799..b91cb5538b2d 100644 #define FAN_CURVE_POINTS 8 diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index 4e6de0c97a78..ff0e762b83a4 100644 +index 7c886a93d554..3fd11c782ee2 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -144,6 +144,9 @@ struct asus_wmi { - struct asus_wmi_driver *driver; - }; +@@ -6,6 +6,9 @@ + #include + #include +#define ASUS_WMI_MGMT_GUID "97845ED0-4E6D-11DE-8A39-0800200C9A66" +#define ASUS_ACPI_UID_ASUSWMI "ASUSWMI" @@ -5452,13 +5443,13 @@ index 4e6de0c97a78..ff0e762b83a4 100644 #define ASUS_WMI_METHODID_SPEC 0x43455053 /* BIOS SPECification */ #define ASUS_WMI_METHODID_SFBD 0x44424653 /* Set First Boot Device */ -- -2.47.1 +2.48.1 -From 291c0678506e20bdeef67949b18a24c820c13697 Mon Sep 17 00:00:00 2001 +From 28377eeea2e83f8c7335d8d1a2c91b52a6b06165 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Thu, 19 Sep 2024 17:23:35 +1200 -Subject: [PATCH 21/28] platform/x86: asus-armoury: add panel_hd_mode attribute +Subject: [PATCH 25/30] platform/x86: asus-armoury: add panel_hd_mode attribute Add panel_hd_mode to toggle the panel mode between single and high definition modes. @@ -5502,10 +5493,10 @@ index d2e8c21d62dc..716bf96b6b58 100644 static int asus_fw_attr_add(void) diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index ff0e762b83a4..28d9ec1326ab 100644 +index 3fd11c782ee2..e1ae2c1e229c 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -214,6 +214,7 @@ struct asus_wmi { +@@ -76,6 +76,7 @@ #define ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY_VIVO 0x00110019 /* Misc */ @@ -5514,13 +5505,13 @@ index ff0e762b83a4..28d9ec1326ab 100644 #define ASUS_WMI_DEVID_CAMERA 0x00060013 #define ASUS_WMI_DEVID_LID_FLIP 0x00060062 -- -2.47.1 +2.48.1 -From 6db68b4041e9a6b74d071f9f5088148916964fcc Mon Sep 17 00:00:00 2001 +From 43a9bdf26bb75ad00ba05559e05956a6ac525369 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sun, 2 Jun 2024 14:44:31 +1200 -Subject: [PATCH 22/28] platform/x86: asus-armoury: add apu-mem control support +Subject: [PATCH 26/30] platform/x86: asus-armoury: add apu-mem control support Implement the APU memory size control under the asus-armoury module using the fw_attributes class. @@ -5668,10 +5659,10 @@ index 716bf96b6b58..298f7b203d7c 100644 { &charge_mode_attr_group, ASUS_WMI_DEVID_CHARGE_MODE }, { &boot_sound_attr_group, ASUS_WMI_DEVID_BOOT_SOUND }, diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index 28d9ec1326ab..ba397d7d0825 100644 +index e1ae2c1e229c..b7e2582763a8 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -275,6 +275,8 @@ struct asus_wmi { +@@ -137,6 +137,8 @@ /* dgpu on/off */ #define ASUS_WMI_DEVID_DGPU 0x00090020 @@ -5681,13 +5672,13 @@ index 28d9ec1326ab..ba397d7d0825 100644 #define ASUS_WMI_DEVID_GPU_MUX 0x00090016 #define ASUS_WMI_DEVID_GPU_MUX_VIVO 0x00090026 -- -2.47.1 +2.48.1 -From c9c56bcc8fca365ed6a80f1012dbd29d8c3070f6 Mon Sep 17 00:00:00 2001 +From d1452cbaa217541e9b5ebcb7c9c963241df75731 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Wed, 18 Sep 2024 21:19:12 +1200 -Subject: [PATCH 23/28] platform/x86: asus-armoury: add core count control +Subject: [PATCH 27/30] platform/x86: asus-armoury: add core count control Implement Intel core enablement under the asus-armoury module using the fw_attributes class. @@ -6033,10 +6024,10 @@ index 440f41c5df3b..5d6bef6d2b12 100644 + #endif /* _ASUS_ARMOURY_H_ */ diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index ba397d7d0825..5af4430c863f 100644 +index b7e2582763a8..0f45d5549e10 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -275,6 +275,11 @@ struct asus_wmi { +@@ -137,6 +137,11 @@ /* dgpu on/off */ #define ASUS_WMI_DEVID_DGPU 0x00090020 @@ -6049,13 +6040,13 @@ index ba397d7d0825..5af4430c863f 100644 /* gpu mux switch, 0 = dGPU, 1 = Optimus */ -- -2.47.1 +2.48.1 -From 4be3d720922e9488adf138754fb9c9ba47247448 Mon Sep 17 00:00:00 2001 +From 7946d6a16668295187f687ad0d3992cce3273641 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Mon, 3 Jun 2024 12:04:41 +1200 -Subject: [PATCH 24/28] platform/x86: asus-wmi: deprecate bios features +Subject: [PATCH 28/30] platform/x86: asus-wmi: deprecate bios features With the existence of the asus-armoury module the attributes no-longer need to live under the /sys/devices/platform/asus-nb-wmi/ path. @@ -6069,8 +6060,7 @@ Reviewed-by: Mario Limonciello .../ABI/testing/sysfs-platform-asus-wmi | 17 +++ drivers/platform/x86/Kconfig | 9 ++ drivers/platform/x86/asus-wmi.c | 123 ++++++++++++++---- - include/linux/platform_data/x86/asus-wmi.h | 17 ++- - 4 files changed, 134 insertions(+), 32 deletions(-) + 3 files changed, 124 insertions(+), 25 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi index 28144371a0f1..765d50b0d9df 100644 @@ -6233,12 +6223,12 @@ index 294364cc7478..b160173a530e 100644 tristate "Asus Notebook WMI Driver" depends on ASUS_WMI diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index b91cb5538b2d..7e9878851f40 100644 +index 9f0153ee8601..bcf0cab8f9ae 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c -@@ -194,6 +194,15 @@ struct agfn_fan_args { - u32 speed; /* read: RPM/100 - write: 0-255 */ - } __packed; +@@ -344,6 +344,15 @@ void set_ally_mcu_hack_available(bool enabled) + } + EXPORT_SYMBOL_NS_GPL(set_ally_mcu_hack_available, "ASUS_WMI"); +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) +static void asus_wmi_show_deprecated(void) @@ -6252,7 +6242,7 @@ index b91cb5538b2d..7e9878851f40 100644 /* WMI ************************************************************************/ static int asus_wmi_evaluate_method3(u32 method_id, -@@ -584,6 +593,7 @@ static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus) +@@ -734,6 +743,7 @@ static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus) } /* Charging mode, 1=Barrel, 2=USB ******************************************/ @@ -6260,7 +6250,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t charge_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { -@@ -594,12 +604,16 @@ static ssize_t charge_mode_show(struct device *dev, +@@ -744,12 +754,16 @@ static ssize_t charge_mode_show(struct device *dev, if (result < 0) return result; @@ -6277,7 +6267,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t dgpu_disable_show(struct device *dev, struct device_attribute *attr, char *buf) { -@@ -610,6 +624,8 @@ static ssize_t dgpu_disable_show(struct device *dev, +@@ -760,6 +774,8 @@ static ssize_t dgpu_disable_show(struct device *dev, if (result < 0) return result; @@ -6286,7 +6276,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%d\n", result); } -@@ -663,8 +679,10 @@ static ssize_t dgpu_disable_store(struct device *dev, +@@ -813,8 +829,10 @@ static ssize_t dgpu_disable_store(struct device *dev, return count; } static DEVICE_ATTR_RW(dgpu_disable); @@ -6297,7 +6287,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t egpu_enable_show(struct device *dev, struct device_attribute *attr, char *buf) { -@@ -675,6 +693,8 @@ static ssize_t egpu_enable_show(struct device *dev, +@@ -825,6 +843,8 @@ static ssize_t egpu_enable_show(struct device *dev, if (result < 0) return result; @@ -6306,7 +6296,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%d\n", result); } -@@ -731,8 +751,10 @@ static ssize_t egpu_enable_store(struct device *dev, +@@ -881,8 +901,10 @@ static ssize_t egpu_enable_store(struct device *dev, return count; } static DEVICE_ATTR_RW(egpu_enable); @@ -6317,7 +6307,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t egpu_connected_show(struct device *dev, struct device_attribute *attr, char *buf) { -@@ -743,12 +765,16 @@ static ssize_t egpu_connected_show(struct device *dev, +@@ -893,12 +915,16 @@ static ssize_t egpu_connected_show(struct device *dev, if (result < 0) return result; @@ -6334,7 +6324,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t gpu_mux_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { -@@ -759,6 +785,8 @@ static ssize_t gpu_mux_mode_show(struct device *dev, +@@ -909,6 +935,8 @@ static ssize_t gpu_mux_mode_show(struct device *dev, if (result < 0) return result; @@ -6343,7 +6333,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%d\n", result); } -@@ -817,6 +845,7 @@ static ssize_t gpu_mux_mode_store(struct device *dev, +@@ -967,6 +995,7 @@ static ssize_t gpu_mux_mode_store(struct device *dev, return count; } static DEVICE_ATTR_RW(gpu_mux_mode); @@ -6351,7 +6341,7 @@ index b91cb5538b2d..7e9878851f40 100644 /* TUF Laptop Keyboard RGB Modes **********************************************/ static ssize_t kbd_rgb_mode_store(struct device *dev, -@@ -940,6 +969,7 @@ static const struct attribute_group *kbd_rgb_mode_groups[] = { +@@ -1090,6 +1119,7 @@ static const struct attribute_group *kbd_rgb_mode_groups[] = { }; /* Tunable: PPT: Intel=PL1, AMD=SPPT *****************************************/ @@ -6359,7 +6349,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t ppt_pl2_sppt_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) -@@ -978,6 +1008,8 @@ static ssize_t ppt_pl2_sppt_show(struct device *dev, +@@ -1128,6 +1158,8 @@ static ssize_t ppt_pl2_sppt_show(struct device *dev, { struct asus_wmi *asus = dev_get_drvdata(dev); @@ -6368,7 +6358,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%u\n", asus->ppt_pl2_sppt); } static DEVICE_ATTR_RW(ppt_pl2_sppt); -@@ -1020,6 +1052,8 @@ static ssize_t ppt_pl1_spl_show(struct device *dev, +@@ -1170,6 +1202,8 @@ static ssize_t ppt_pl1_spl_show(struct device *dev, { struct asus_wmi *asus = dev_get_drvdata(dev); @@ -6377,7 +6367,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%u\n", asus->ppt_pl1_spl); } static DEVICE_ATTR_RW(ppt_pl1_spl); -@@ -1063,6 +1097,8 @@ static ssize_t ppt_fppt_show(struct device *dev, +@@ -1213,6 +1247,8 @@ static ssize_t ppt_fppt_show(struct device *dev, { struct asus_wmi *asus = dev_get_drvdata(dev); @@ -6386,7 +6376,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%u\n", asus->ppt_fppt); } static DEVICE_ATTR_RW(ppt_fppt); -@@ -1106,6 +1142,8 @@ static ssize_t ppt_apu_sppt_show(struct device *dev, +@@ -1256,6 +1292,8 @@ static ssize_t ppt_apu_sppt_show(struct device *dev, { struct asus_wmi *asus = dev_get_drvdata(dev); @@ -6395,7 +6385,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%u\n", asus->ppt_apu_sppt); } static DEVICE_ATTR_RW(ppt_apu_sppt); -@@ -1149,6 +1187,8 @@ static ssize_t ppt_platform_sppt_show(struct device *dev, +@@ -1299,6 +1337,8 @@ static ssize_t ppt_platform_sppt_show(struct device *dev, { struct asus_wmi *asus = dev_get_drvdata(dev); @@ -6404,7 +6394,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%u\n", asus->ppt_platform_sppt); } static DEVICE_ATTR_RW(ppt_platform_sppt); -@@ -1192,6 +1232,8 @@ static ssize_t nv_dynamic_boost_show(struct device *dev, +@@ -1342,6 +1382,8 @@ static ssize_t nv_dynamic_boost_show(struct device *dev, { struct asus_wmi *asus = dev_get_drvdata(dev); @@ -6413,7 +6403,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%u\n", asus->nv_dynamic_boost); } static DEVICE_ATTR_RW(nv_dynamic_boost); -@@ -1235,11 +1277,15 @@ static ssize_t nv_temp_target_show(struct device *dev, +@@ -1385,11 +1427,15 @@ static ssize_t nv_temp_target_show(struct device *dev, { struct asus_wmi *asus = dev_get_drvdata(dev); @@ -6429,7 +6419,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t mcu_powersave_show(struct device *dev, struct device_attribute *attr, char *buf) { -@@ -1250,6 +1296,8 @@ static ssize_t mcu_powersave_show(struct device *dev, +@@ -1400,6 +1446,8 @@ static ssize_t mcu_powersave_show(struct device *dev, if (result < 0) return result; @@ -6438,7 +6428,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%d\n", result); } -@@ -1285,6 +1333,7 @@ static ssize_t mcu_powersave_store(struct device *dev, +@@ -1435,6 +1483,7 @@ static ssize_t mcu_powersave_store(struct device *dev, return count; } static DEVICE_ATTR_RW(mcu_powersave); @@ -6446,7 +6436,7 @@ index b91cb5538b2d..7e9878851f40 100644 /* Battery ********************************************************************/ -@@ -2158,6 +2207,7 @@ static int asus_wmi_rfkill_init(struct asus_wmi *asus) +@@ -2308,6 +2357,7 @@ static int asus_wmi_rfkill_init(struct asus_wmi *asus) } /* Panel Overdrive ************************************************************/ @@ -6454,7 +6444,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t panel_od_show(struct device *dev, struct device_attribute *attr, char *buf) { -@@ -2168,6 +2218,8 @@ static ssize_t panel_od_show(struct device *dev, +@@ -2318,6 +2368,8 @@ static ssize_t panel_od_show(struct device *dev, if (result < 0) return result; @@ -6463,7 +6453,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%d\n", result); } -@@ -2204,9 +2256,10 @@ static ssize_t panel_od_store(struct device *dev, +@@ -2354,9 +2406,10 @@ static ssize_t panel_od_store(struct device *dev, return count; } static DEVICE_ATTR_RW(panel_od); @@ -6475,7 +6465,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t boot_sound_show(struct device *dev, struct device_attribute *attr, char *buf) { -@@ -2217,6 +2270,8 @@ static ssize_t boot_sound_show(struct device *dev, +@@ -2367,6 +2420,8 @@ static ssize_t boot_sound_show(struct device *dev, if (result < 0) return result; @@ -6484,7 +6474,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%d\n", result); } -@@ -2252,8 +2307,10 @@ static ssize_t boot_sound_store(struct device *dev, +@@ -2402,8 +2457,10 @@ static ssize_t boot_sound_store(struct device *dev, return count; } static DEVICE_ATTR_RW(boot_sound); @@ -6495,7 +6485,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t mini_led_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { -@@ -2284,6 +2341,8 @@ static ssize_t mini_led_mode_show(struct device *dev, +@@ -2434,6 +2491,8 @@ static ssize_t mini_led_mode_show(struct device *dev, } } @@ -6504,7 +6494,7 @@ index b91cb5538b2d..7e9878851f40 100644 return sysfs_emit(buf, "%d\n", value); } -@@ -2354,10 +2413,13 @@ static ssize_t available_mini_led_mode_show(struct device *dev, +@@ -2504,10 +2563,13 @@ static ssize_t available_mini_led_mode_show(struct device *dev, return sysfs_emit(buf, "0 1 2\n"); } @@ -6518,7 +6508,7 @@ index b91cb5538b2d..7e9878851f40 100644 /* Quirks *********************************************************************/ -@@ -3645,6 +3707,7 @@ static int throttle_thermal_policy_set_default(struct asus_wmi *asus) +@@ -3795,6 +3857,7 @@ static int throttle_thermal_policy_set_default(struct asus_wmi *asus) return throttle_thermal_policy_write(asus); } @@ -6526,7 +6516,7 @@ index b91cb5538b2d..7e9878851f40 100644 static ssize_t throttle_thermal_policy_show(struct device *dev, struct device_attribute *attr, char *buf) { -@@ -3688,6 +3751,7 @@ static ssize_t throttle_thermal_policy_store(struct device *dev, +@@ -3838,6 +3901,7 @@ static ssize_t throttle_thermal_policy_store(struct device *dev, * Throttle thermal policy: 0 - default, 1 - overboost, 2 - silent */ static DEVICE_ATTR_RW(throttle_thermal_policy); @@ -6534,7 +6524,7 @@ index b91cb5538b2d..7e9878851f40 100644 /* Platform profile ***********************************************************/ static int asus_wmi_platform_profile_get(struct platform_profile_handler *pprof, -@@ -4285,27 +4349,29 @@ static struct attribute *platform_attributes[] = { +@@ -4435,27 +4499,29 @@ static struct attribute *platform_attributes[] = { &dev_attr_camera.attr, &dev_attr_cardr.attr, &dev_attr_touchpad.attr, @@ -6582,7 +6572,7 @@ index b91cb5538b2d..7e9878851f40 100644 NULL }; -@@ -4327,7 +4393,11 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, +@@ -4477,7 +4543,11 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, devid = ASUS_WMI_DEVID_LID_RESUME; else if (attr == &dev_attr_als_enable.attr) devid = ASUS_WMI_DEVID_ALS_ENABLE; @@ -6595,7 +6585,7 @@ index b91cb5538b2d..7e9878851f40 100644 devid = ASUS_WMI_DEVID_CHARGE_MODE; else if (attr == &dev_attr_egpu_enable.attr) ok = asus->egpu_enable_available; -@@ -4365,6 +4435,7 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, +@@ -4515,6 +4585,7 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, ok = asus->mini_led_dev_id != 0; else if (attr == &dev_attr_available_mini_led_mode.attr) ok = asus->mini_led_dev_id != 0; @@ -6603,15 +6593,15 @@ index b91cb5538b2d..7e9878851f40 100644 if (devid != -1) { ok = !(asus_wmi_get_devstate_simple(asus, devid) < 0); -@@ -4605,6 +4676,7 @@ static int asus_wmi_add(struct platform_device *pdev) - goto fail_platform; +@@ -4766,6 +4837,7 @@ static int asus_wmi_add(struct platform_device *pdev) + } /* ensure defaults for tunables */ +#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) asus->ppt_pl2_sppt = 5; asus->ppt_pl1_spl = 5; asus->ppt_apu_sppt = 5; -@@ -4627,17 +4699,18 @@ static int asus_wmi_add(struct platform_device *pdev) +@@ -4787,17 +4859,18 @@ static int asus_wmi_add(struct platform_device *pdev) asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX; else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX_VIVO)) asus->gpu_mux_dev = ASUS_WMI_DEVID_GPU_MUX_VIVO; @@ -6622,124 +6612,27 @@ index b91cb5538b2d..7e9878851f40 100644 - asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE2; +#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */ - if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY)) - asus->throttle_thermal_policy_dev = ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY; - else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY_VIVO)) - asus->throttle_thermal_policy_dev = ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY_VIVO; - -+ if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE)) -+ asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE; -+ else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE2)) -+ asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE2; -+ - err = fan_boost_mode_check_present(asus); - if (err) - goto fail_fan_boost_mode; -diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index 5af4430c863f..3ba0f8fef150 100644 ---- a/include/linux/platform_data/x86/asus-wmi.h -+++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -10,6 +10,8 @@ - #include - #include - -+#define FAN_CURVE_POINTS 8 -+ - /* - * / - debugfs root directory - * dev_id - current dev_id -@@ -32,14 +34,14 @@ struct asus_rfkill { - u32 dev_id; - }; - -+#define FAN_CURVE_POINTS 8 -+ - enum fan_type { - FAN_TYPE_NONE = 0, - FAN_TYPE_AGFN, /* deprecated on newer platforms */ - FAN_TYPE_SPEC83, /* starting in Spec 8.3, use CPU_FAN_CTRL */ - }; - --#define FAN_CURVE_POINTS 8 -- - struct fan_curve_data { - bool enabled; - u32 device_id; -@@ -97,11 +99,12 @@ struct asus_wmi { - u8 fan_boost_mode_mask; - u8 fan_boost_mode; - -+ -+ /* Tunables provided by ASUS for gaming laptops */ -+#if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) - bool egpu_enable_available; - bool dgpu_disable_available; - u32 gpu_mux_dev; -- -- /* Tunables provided by ASUS for gaming laptops */ - u32 ppt_pl2_sppt; - u32 ppt_pl1_spl; - u32 ppt_apu_sppt; -@@ -109,6 +112,9 @@ struct asus_wmi { - u32 ppt_fppt; - u32 nv_dynamic_boost; - u32 nv_temp_target; -+ bool panel_overdrive_available; -+ u32 mini_led_dev_id; -+#endif /* IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) */ - - u32 kbd_rgb_dev; - bool kbd_rgb_state_available; -@@ -128,9 +134,6 @@ struct asus_wmi { - // The RSOC controls the maximum charging percentage. - bool battery_rsoc_available; + if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY)) + asus->throttle_thermal_policy_dev = ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY; + else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY_VIVO)) + asus->throttle_thermal_policy_dev = ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY_VIVO; -- bool panel_overdrive_available; -- u32 mini_led_dev_id; -- - struct hotplug_slot hotplug_slot; - struct mutex hotplug_lock; - struct mutex wmi_lock; --- -2.47.1 - - -From a874558b5b9953e216c0f17582cd6c91f4214840 Mon Sep 17 00:00:00 2001 -From: Mario Limonciello -Date: Tue, 21 Jan 2025 16:03:52 -0600 -Subject: [PATCH 25/28] drm/amd/display: Avoid divide by zero by initializing - dummy pitch to 1 - -If the dummy values in `populate_dummy_dml_surface_cfg()` aren't updated -then they can lead to a divide by zero in downstream callers like -CalculateVMAndRowBytes() - -Signed-off-by: Mario Limonciello ---- - drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c -index bde4250853b1..f07afe451006 100644 ---- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c -+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c -@@ -852,7 +852,7 @@ static void populate_dummy_dml_surface_cfg(struct dml_surface_cfg_st *out, unsig - out->SurfaceWidthC[location] = in->timing.h_addressable; - out->SurfaceHeightC[location] = in->timing.v_addressable; - out->PitchY[location] = ((out->SurfaceWidthY[location] + 127) / 128) * 128; -- out->PitchC[location] = 0; -+ out->PitchC[location] = 1; - out->DCCEnable[location] = false; - out->DCCMetaPitchY[location] = 0; - out->DCCMetaPitchC[location] = 0; ++ if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE)) ++ asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE; ++ else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE2)) ++ asus->kbd_rgb_dev = ASUS_WMI_DEVID_TUF_RGB_MODE2; ++ + err = fan_boost_mode_check_present(asus); + if (err) + goto fail_fan_boost_mode; -- -2.47.1 +2.48.1 -From 4f6e377bcec0ed811d32a96098b7adf69f72fa51 Mon Sep 17 00:00:00 2001 +From 81635e56f75e745444df8dd5dd182ba114c38e1f Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Thu, 19 Sep 2024 17:19:37 +1200 -Subject: [PATCH 26/28] platform/x86: asus-armoury: add the ppt_* and nv_* +Subject: [PATCH 29/30] platform/x86: asus-armoury: add the ppt_* and nv_* tuning knobs Adds the ppt_* and nv_* tuning knobs that are available via WMI methods @@ -6747,10 +6640,10 @@ and adds proper min/max levels plus defaults. Signed-off-by: Luke D. Jones --- - drivers/platform/x86/asus-armoury.c | 182 ++++- - drivers/platform/x86/asus-armoury.h | 778 ++++++++++++++++++++- - include/linux/platform_data/x86/asus-wmi.h | 3 + - 3 files changed, 950 insertions(+), 13 deletions(-) + drivers/platform/x86/asus-armoury.c | 182 +++- + drivers/platform/x86/asus-armoury.h | 1028 +++++++++++++++++++- + include/linux/platform_data/x86/asus-wmi.h | 3 + + 3 files changed, 1200 insertions(+), 13 deletions(-) diff --git a/drivers/platform/x86/asus-armoury.c b/drivers/platform/x86/asus-armoury.c index 49e1788d8bba..5768997ea2d3 100644 @@ -7004,7 +6897,7 @@ index 49e1788d8bba..5768997ea2d3 100644 if (err) return err; diff --git a/drivers/platform/x86/asus-armoury.h b/drivers/platform/x86/asus-armoury.h -index 5d6bef6d2b12..9adc07ba6d6b 100644 +index 5d6bef6d2b12..60c36529c11e 100644 --- a/drivers/platform/x86/asus-armoury.h +++ b/drivers/platform/x86/asus-armoury.h @@ -8,6 +8,7 @@ @@ -7072,7 +6965,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 #define ATTR_GROUP_BOOL_RO(_attrname, _fsname, _wmi, _dispname) \ __ATTR_CURRENT_INT_RO(_attrname, _wmi); \ __ATTR_GROUP_ENUM(_attrname, _fsname, "0;1", _dispname) -@@ -178,4 +197,751 @@ static ssize_t int_type_show(struct kobject *kobj, struct kobj_attribute *attr, +@@ -178,4 +197,1001 @@ static ssize_t int_type_show(struct kobject *kobj, struct kobj_attribute *attr, .name = _fsname, .attrs = _attrname##_attrs \ } @@ -7164,7 +7057,6 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .name = _fsname, .attrs = _attrname##_attrs \ + } + -+ +/* Default is always the maximum value unless *_def is specified */ +struct power_limits { + u32 ppt_pl1_spl_min; @@ -7197,6 +7089,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 +struct power_data { + const struct power_limits *ac_data; + const struct power_limits *dc_data; ++ bool requires_fan_curve; +}; + +/* @@ -7206,10 +7099,41 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 +static const struct dmi_system_id power_limits[] = { + { + .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "FA401W"), ++ }, ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 15, ++ .ppt_pl1_spl_max = 80, ++ .ppt_pl2_sppt_min = 35, ++ .ppt_pl2_sppt_max = 80, ++ .ppt_pl3_fppt_min = 35, ++ .ppt_pl3_fppt_max = 80, ++ .nv_dynamic_boost_min = 5, ++ .nv_dynamic_boost_max = 25, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ .nv_tgp_min = 55, ++ .nv_tgp_max = 75, ++ }, ++ .dc_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 25, ++ .ppt_pl1_spl_max = 30, ++ .ppt_pl2_sppt_min = 31, ++ .ppt_pl2_sppt_max = 44, ++ .ppt_pl3_fppt_min = 45, ++ .ppt_pl3_fppt_max = 65, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ }, ++ }, ++ }, ++ { ++ .matches = { + DMI_MATCH(DMI_BOARD_NAME, "FA507R"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_max = 80, + .ppt_pl2_sppt_min = 25, @@ -7224,8 +7148,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "FA507X"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_max = 80, + .ppt_pl2_sppt_min = 35, @@ -7239,7 +7163,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_tgp_min = 55, + .nv_tgp_max = 85, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_def = 45, + .ppt_pl1_spl_max = 65, @@ -7257,8 +7181,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "FA507Z"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 28, + .ppt_pl1_spl_max = 65, + .ppt_pl2_sppt_min = 28, @@ -7270,7 +7194,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_tgp_min = 55, + .nv_tgp_max = 85, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 45, + .ppt_pl2_sppt_min = 35, @@ -7284,8 +7208,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "FA607P"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 30, + .ppt_pl1_spl_def = 100, + .ppt_pl1_spl_max = 135, @@ -7301,7 +7225,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_tgp_min = 55, + .nv_tgp_max = 115, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_def = 45, + .ppt_pl1_spl_max = 80, @@ -7319,14 +7243,14 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "FA617NS"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_apu_sppt_min = 15, + .ppt_apu_sppt_max = 80, + .ppt_platform_sppt_min = 30, + .ppt_platform_sppt_max = 120 + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_apu_sppt_min = 25, + .ppt_apu_sppt_max = 35, + .ppt_platform_sppt_min = 45, @@ -7338,14 +7262,14 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "FA617NT"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_apu_sppt_min = 15, + .ppt_apu_sppt_max = 80, + .ppt_platform_sppt_min = 30, + .ppt_platform_sppt_max = 115 + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_apu_sppt_min = 15, + .ppt_apu_sppt_max = 45, + .ppt_platform_sppt_min = 30, @@ -7357,8 +7281,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "FA617XS"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_apu_sppt_min = 15, + .ppt_apu_sppt_max = 80, + .ppt_platform_sppt_min = 30, @@ -7366,7 +7290,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_apu_sppt_min = 25, + .ppt_apu_sppt_max = 35, + .ppt_platform_sppt_min = 45, @@ -7380,8 +7304,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "FX507Z"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 28, + .ppt_pl1_spl_max = 90, + .ppt_pl2_sppt_min = 28, @@ -7389,20 +7313,21 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_dynamic_boost_min = 5, + .nv_dynamic_boost_max = 15, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 45, + .ppt_pl2_sppt_min = 35, + .ppt_pl2_sppt_max = 60, -+ } ++ }, ++ .requires_fan_curve = true, + }, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GA401Q"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_max = 80, + .ppt_pl2_sppt_min = 15, @@ -7416,14 +7341,14 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + // This model is full AMD. No Nvidia dGPU. + DMI_MATCH(DMI_BOARD_NAME, "GA402R"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_apu_sppt_min = 15, + .ppt_apu_sppt_max = 80, + .ppt_platform_sppt_min = 30, + .ppt_platform_sppt_max = 115, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_apu_sppt_min = 25, + .ppt_apu_sppt_def = 30, + .ppt_apu_sppt_max = 45, @@ -7436,8 +7361,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GA402X"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_def = 35, + .ppt_pl1_spl_max = 80, @@ -7449,7 +7374,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_max = 35, + .ppt_pl2_sppt_min = 25, @@ -7458,15 +7383,16 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .ppt_pl3_fppt_max = 65, + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, -+ } ++ }, ++ .requires_fan_curve = true, + }, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GA403U"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_max = 80, + .ppt_pl2_sppt_min = 25, @@ -7474,22 +7400,23 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .ppt_pl3_fppt_min = 35, + .ppt_pl3_fppt_max = 80 + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_max = 35, + .ppt_pl2_sppt_min = 25, + .ppt_pl2_sppt_max = 35, + .ppt_pl3_fppt_min = 35, + .ppt_pl3_fppt_max = 65 -+ } ++ }, ++ .requires_fan_curve = true, + }, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GA503R"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_def = 35, + .ppt_pl1_spl_max = 80, @@ -7503,7 +7430,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_def = 25, + .ppt_pl1_spl_max = 65, @@ -7519,8 +7446,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GA605W"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_max = 80, + .ppt_pl2_sppt_min = 35, @@ -7534,7 +7461,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_tgp_min = 55, + .nv_tgp_max = 85, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 35, + .ppt_pl2_sppt_min = 31, @@ -7543,6 +7470,33 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .ppt_pl3_fppt_max = 65, + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, ++ }, ++ .requires_fan_curve = true, ++ }, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "GU603Z"), ++ }, ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 25, ++ .ppt_pl1_spl_max = 60, ++ .ppt_pl2_sppt_min = 25, ++ .ppt_pl2_sppt_max = 135, ++ /* Only allowed in AC mode */ ++ .nv_dynamic_boost_min = 5, ++ .nv_dynamic_boost_max = 20, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ }, ++ .dc_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 25, ++ .ppt_pl1_spl_max = 40, ++ .ppt_pl2_sppt_min = 25, ++ .ppt_pl2_sppt_max = 40, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, + } + }, + }, @@ -7550,8 +7504,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GU604V"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 65, + .ppt_pl1_spl_max = 120, + .ppt_pl2_sppt_min = 65, @@ -7562,7 +7516,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 40, + .ppt_pl2_sppt_min = 35, @@ -7577,8 +7531,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GU605M"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 28, + .ppt_pl1_spl_max = 90, + .ppt_pl2_sppt_min = 28, @@ -7588,13 +7542,91 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 35, + .ppt_pl2_sppt_min = 38, + .ppt_pl2_sppt_max = 53, + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, ++ }, ++ .requires_fan_curve = true, ++ }, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "GV301Q"), ++ }, ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 15, ++ .ppt_pl1_spl_max = 45, ++ .ppt_pl2_sppt_min = 65, ++ .ppt_pl2_sppt_max = 80, ++ }, ++ .dc_data = NULL ++ }, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "GV301R"), ++ }, ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 15, ++ .ppt_pl1_spl_max = 45, ++ .ppt_pl2_sppt_min = 25, ++ .ppt_pl2_sppt_max = 54, ++ .ppt_pl3_fppt_min = 35, ++ .ppt_pl3_fppt_max = 65, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ }, ++ .dc_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 15, ++ .ppt_pl1_spl_max = 35, ++ .ppt_pl2_sppt_min = 25, ++ .ppt_pl2_sppt_max = 35, ++ .ppt_pl3_fppt_min = 35, ++ .ppt_pl3_fppt_max = 65, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ } ++ }, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "GV601R"), ++ }, ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 15, ++ .ppt_pl1_spl_def = 35, ++ .ppt_pl1_spl_max = 90, ++ .ppt_pl2_sppt_min = 35, ++ .ppt_pl2_sppt_def = 54, ++ .ppt_pl2_sppt_max = 100, ++ .ppt_pl3_fppt_min = 35, ++ .ppt_pl3_fppt_def = 80, ++ .ppt_pl3_fppt_max = 125, ++ .nv_dynamic_boost_min = 5, ++ .nv_dynamic_boost_max = 25, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ }, ++ .dc_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 15, ++ .ppt_pl1_spl_def = 28, ++ .ppt_pl1_spl_max = 65, ++ .ppt_pl2_sppt_min = 35, ++ .ppt_pl2_sppt_def = 54, ++ .ppt_pl2_sppt_def = 40, ++ .ppt_pl2_sppt_max = 60, ++ .ppt_pl3_fppt_min = 35, ++ .ppt_pl3_fppt_def = 80, ++ .ppt_pl3_fppt_max = 65, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, + } + }, + }, @@ -7602,20 +7634,19 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GV601V"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 28, + .ppt_pl1_spl_def = 100, + .ppt_pl1_spl_max = 110, + .ppt_pl2_sppt_min = 28, + .ppt_pl2_sppt_max = 135, -+ /* Only allowed in AC mode */ + .nv_dynamic_boost_min = 5, + .nv_dynamic_boost_max = 20, + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 40, + .ppt_pl2_sppt_min = 35, @@ -7628,25 +7659,107 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + }, + { + .matches = { -+ DMI_MATCH(DMI_BOARD_NAME, "G513Q"), ++ DMI_MATCH(DMI_BOARD_NAME, "GX650P"), ++ }, ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 15, ++ .ppt_pl1_spl_def = 110, ++ .ppt_pl1_spl_max = 130, ++ .ppt_pl2_sppt_min = 35, ++ .ppt_pl2_sppt_def = 125, ++ .ppt_pl2_sppt_max = 130, ++ .ppt_pl3_fppt_min = 35, ++ .ppt_pl3_fppt_def = 125, ++ .ppt_pl3_fppt_max = 135, ++ .nv_dynamic_boost_min = 5, ++ .nv_dynamic_boost_max = 25, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ }, ++ .dc_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 15, ++ .ppt_pl1_spl_def = 25, ++ .ppt_pl1_spl_max = 65, ++ .ppt_pl2_sppt_min = 35, ++ .ppt_pl2_sppt_def = 35, ++ .ppt_pl2_sppt_max = 65, ++ .ppt_pl3_fppt_min = 35, ++ .ppt_pl3_fppt_def = 42, ++ .ppt_pl3_fppt_max = 65, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ } ++ }, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "G513I"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + /* Yes this laptop is very limited */ + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_max = 80, + .ppt_pl2_sppt_min = 15, + .ppt_pl2_sppt_max = 80, + }, -+ .dc_data = NULL ++ .dc_data = NULL, ++ .requires_fan_curve = true, ++ }, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "G513QM"), ++ }, ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { ++ /* Yes this laptop is very limited */ ++ .ppt_pl1_spl_min = 15, ++ .ppt_pl1_spl_max = 100, ++ .ppt_pl2_sppt_min = 15, ++ .ppt_pl2_sppt_max = 190, ++ }, ++ .dc_data = NULL, ++ .requires_fan_curve = true, ++ }, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "G513R"), ++ }, ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 35, ++ .ppt_pl1_spl_max = 90, ++ .ppt_pl2_sppt_min = 54, ++ .ppt_pl2_sppt_max = 100, ++ .ppt_pl3_fppt_min = 54, ++ .ppt_pl3_fppt_max = 125, ++ .nv_dynamic_boost_min = 5, ++ .nv_dynamic_boost_max = 25, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ }, ++ .dc_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 28, ++ .ppt_pl1_spl_max = 50, ++ .ppt_pl2_sppt_min = 28, ++ .ppt_pl2_sppt_max = 50, ++ .ppt_pl3_fppt_min = 28, ++ .ppt_pl3_fppt_max = 65, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ }, ++ .requires_fan_curve = true, + }, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "G614J"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 28, + .ppt_pl1_spl_max = 140, + .ppt_pl2_sppt_min = 28, @@ -7656,22 +7769,23 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_dynamic_boost_min = 5, + .nv_dynamic_boost_max = 25, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 55, + .ppt_pl2_sppt_min = 25, + .ppt_pl2_sppt_max = 70, + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, -+ } ++ }, ++ .requires_fan_curve = true, + }, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "G634J"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 28, + .ppt_pl1_spl_max = 140, + .ppt_pl2_sppt_min = 28, @@ -7681,22 +7795,49 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_dynamic_boost_min = 5, + .nv_dynamic_boost_max = 25, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 55, + .ppt_pl2_sppt_min = 25, + .ppt_pl2_sppt_max = 70, + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, -+ } ++ }, ++ .requires_fan_curve = true, ++ }, ++ }, ++ { ++ .matches = { ++ DMI_MATCH(DMI_BOARD_NAME, "G733C"), ++ }, ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 28, ++ .ppt_pl1_spl_max = 170, ++ .ppt_pl2_sppt_min = 28, ++ .ppt_pl2_sppt_max = 175, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ .nv_dynamic_boost_min = 5, ++ .nv_dynamic_boost_max = 25, ++ }, ++ .dc_data = &(struct power_limits) { ++ .ppt_pl1_spl_min = 28, ++ .ppt_pl1_spl_max = 35, ++ .ppt_pl2_sppt_min = 28, ++ .ppt_pl2_sppt_max = 35, ++ .nv_temp_target_min = 75, ++ .nv_temp_target_max = 87, ++ }, ++ .requires_fan_curve = true, + }, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "G814J"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 28, + .ppt_pl1_spl_max = 140, + .ppt_pl2_sppt_min = 28, @@ -7704,20 +7845,21 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_dynamic_boost_min = 5, + .nv_dynamic_boost_max = 25, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 55, + .ppt_pl2_sppt_min = 25, + .ppt_pl2_sppt_max = 70, -+ } ++ }, ++ .requires_fan_curve = true, + }, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "G834J"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 28, + .ppt_pl1_spl_max = 140, + .ppt_pl2_sppt_min = 28, @@ -7727,22 +7869,23 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 55, + .ppt_pl2_sppt_min = 25, + .ppt_pl2_sppt_max = 70, + .nv_temp_target_min = 75, + .nv_temp_target_max = 87, -+ } ++ }, ++ .requires_fan_curve = true, + }, + }, + { + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "H7606W"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 15, + .ppt_pl1_spl_max = 80, + .ppt_pl2_sppt_min = 35, @@ -7756,7 +7899,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .nv_tgp_min = 55, + .nv_tgp_max = 85, + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 25, + .ppt_pl1_spl_max = 35, + .ppt_pl2_sppt_min = 31, @@ -7772,8 +7915,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "RC71"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 7, + .ppt_pl1_spl_max = 30, + .ppt_pl2_sppt_min = 15, @@ -7781,7 +7924,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .ppt_pl3_fppt_min = 15, + .ppt_pl3_fppt_max = 53 + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 7, + .ppt_pl1_spl_def = 15, + .ppt_pl1_spl_max = 25, @@ -7798,8 +7941,8 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "RC72"), + }, -+ .driver_data = &(struct power_data){ -+ .ac_data = &(struct power_limits){ ++ .driver_data = &(struct power_data) { ++ .ac_data = &(struct power_limits) { + .ppt_pl1_spl_min = 7, + .ppt_pl1_spl_max = 30, + .ppt_pl2_sppt_min = 15, @@ -7807,7 +7950,7 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + .ppt_pl3_fppt_min = 15, + .ppt_pl3_fppt_max = 53 + }, -+ .dc_data = &(struct power_limits){ ++ .dc_data = &(struct power_limits) { + .ppt_pl1_spl_min = 7, + .ppt_pl1_spl_def = 17, + .ppt_pl1_spl_max = 25, @@ -7825,10 +7968,10 @@ index 5d6bef6d2b12..9adc07ba6d6b 100644 + #endif /* _ASUS_ARMOURY_H_ */ diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index 3ba0f8fef150..34eddaee5983 100644 +index 0f45d5549e10..8e90d2221706 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -285,6 +285,9 @@ struct asus_wmi { +@@ -144,6 +144,9 @@ #define ASUS_WMI_DEVID_APU_MEM 0x000600C1 @@ -7839,49 +7982,13 @@ index 3ba0f8fef150..34eddaee5983 100644 #define ASUS_WMI_DEVID_GPU_MUX 0x00090016 #define ASUS_WMI_DEVID_GPU_MUX_VIVO 0x00090026 -- -2.47.1 - - -From 51da1eea5ae6e86da671d31aa94693af04e1d1e2 Mon Sep 17 00:00:00 2001 -From: "Luke D. Jones" -Date: Tue, 28 Jan 2025 14:44:43 +1300 -Subject: [PATCH 27/28] asus-wmi: change quiet to low-power - -Signed-off-by: Luke D. Jones ---- - drivers/platform/x86/asus-wmi.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index 7e9878851f40..9a71a49d2c6a 100644 ---- a/drivers/platform/x86/asus-wmi.c -+++ b/drivers/platform/x86/asus-wmi.c -@@ -3771,7 +3771,7 @@ static int asus_wmi_platform_profile_get(struct platform_profile_handler *pprof, - *profile = PLATFORM_PROFILE_PERFORMANCE; - break; - case ASUS_THROTTLE_THERMAL_POLICY_SILENT: -- *profile = PLATFORM_PROFILE_QUIET; -+ *profile = PLATFORM_PROFILE_LOW_POWER; - break; - default: - return -EINVAL; -@@ -3795,7 +3795,7 @@ static int asus_wmi_platform_profile_set(struct platform_profile_handler *pprof, - case PLATFORM_PROFILE_BALANCED: - tp = ASUS_THROTTLE_THERMAL_POLICY_DEFAULT; - break; -- case PLATFORM_PROFILE_QUIET: -+ case PLATFORM_PROFILE_LOW_POWER: - tp = ASUS_THROTTLE_THERMAL_POLICY_SILENT; - break; - default: --- -2.47.1 +2.48.1 -From e1cf942d39b9999fc1694a232c9d28dcaf51b5b0 Mon Sep 17 00:00:00 2001 +From c6e3fde2aacadd7b5a3a8ab70b8877c445af132b Mon Sep 17 00:00:00 2001 From: Luke Jones Date: Wed, 5 Feb 2025 12:37:47 +1300 -Subject: [PATCH 28/28] backport: fix fw_attr use +Subject: [PATCH 30/30] backport: fix fw_attr use Signed-off-by: Luke Jones --- @@ -7889,18 +7996,18 @@ Signed-off-by: Luke Jones 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/asus-armoury.c b/drivers/platform/x86/asus-armoury.c -index 5768997ea2d3..47f3bf381825 100644 +index 5768997ea2d3..a9c18a0caffb 100644 --- a/drivers/platform/x86/asus-armoury.c +++ b/drivers/platform/x86/asus-armoury.c -@@ -82,6 +82,8 @@ struct rog_tunables { - u32 nv_tgp; +@@ -94,6 +94,8 @@ struct asus_armoury_priv { + struct mutex mutex; }; +static const struct class *fw_attr_class; + - struct asus_armoury_priv { - struct device *fw_attr_dev; - struct kset *fw_attr_kset; + static struct asus_armoury_priv asus_armoury = { + .mutex = __MUTEX_INITIALIZER(asus_armoury.mutex) + }; @@ -812,7 +814,11 @@ static int asus_fw_attr_add(void) const char *name; int err, i; @@ -7936,5 +8043,5 @@ index 5768997ea2d3..47f3bf381825 100644 mutex_unlock(&asus_armoury.mutex); } -- -2.47.1 +2.48.1 diff --git a/baseos/kernel/6.13/config b/baseos/kernel/6.13/config index e339851..a2f1986 100644 --- a/baseos/kernel/6.13/config +++ b/baseos/kernel/6.13/config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86 6.13.1 Kernel Configuration +# Linux/x86 6.13.3 Kernel Configuration # CONFIG_CC_VERSION_TEXT="gcc (GCC) 14.2.1 20240910" CONFIG_CC_IS_GCC=y @@ -20,7 +20,8 @@ CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y CONFIG_TOOLS_SUPPORT_RELR=y CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y -CONFIG_PAHOLE_VERSION=128 +CONFIG_CC_HAS_COUNTED_BY=y +CONFIG_PAHOLE_VERSION=129 CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_TABLE_SORT=y CONFIG_THREAD_INFO_IN_TASK=y @@ -3160,6 +3161,7 @@ CONFIG_PATA_LEGACY=m CONFIG_MD=y CONFIG_BLK_DEV_MD=m CONFIG_MD_BITMAP_FILE=y +CONFIG_MD_LINEAR=m CONFIG_MD_RAID0=m CONFIG_MD_RAID1=m CONFIG_MD_RAID10=m @@ -7172,6 +7174,7 @@ CONFIG_DRM_SSD130X=m CONFIG_DRM_SSD130X_I2C=m CONFIG_DRM_SSD130X_SPI=m CONFIG_DRM_HYPERV=m +CONFIG_DRM_PANEL_BACKLIGHT_QUIRKS=m CONFIG_DRM_PRIVACY_SCREEN=y CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y diff --git a/baseos/kernel/6.13/kernel.spec b/baseos/kernel/6.13/kernel.spec index 68bfbc8..f323b1d 100644 --- a/baseos/kernel/6.13/kernel.spec +++ b/baseos/kernel/6.13/kernel.spec @@ -37,7 +37,7 @@ Name: kernel Summary: The Linux Kernel with Cachyos and Nobara Patches %define _basekver 6.13 -%define _stablekver 2 +%define _stablekver 3 %if %{_stablekver} == 0 %define _tarkver %{_basekver} %else @@ -105,7 +105,8 @@ Patch13: valve-gamescope-framerate-control-fixups.patch # fixes HAINAN amdgpu card not being bootable # https://gitlab.freedesktop.org/drm/amd/-/issues/1839 Patch14: amdgpu-HAINAN-variant-fixup.patch -Patch15: 0001-Revert-PCI-Add-a-REBAR-size-quirk-for-Sapphire-RX-56.patch +# https://lore.kernel.org/amd-gfx/20250217151053.420882-1-alexander.deucher@amd.com/T/#u +Patch15: PCI-fix-Sapphire-PCI-rebar-quirk.patch # Allow to set custom USB pollrate for specific devices like so: # usbcore.interrupt_interval_override=045e:00db:16,1bcf:0005:1 # useful for setting polling rate of wired PS4/PS5 controller to 1000Hz @@ -114,7 +115,6 @@ Patch15: 0001-Revert-PCI-Add-a-REBAR-size-quirk-for-Sapphire-RX-56.patch Patch16: 0001-Allow-to-set-custom-USB-pollrate-for-specific-device.patch # Add xpadneo as patch instead of using dkms module Patch17: 0001-Add-xpadneo-bluetooth-hid-driver-module.patch -Patch18: legion-16arx8h-hda-quirk.patch %define __spec_install_post /usr/lib/rpm/brp-compress || : %define debug_package %{nil} @@ -421,7 +421,6 @@ patch -p1 -i %{PATCH14} patch -p1 -i %{PATCH15} patch -p1 -i %{PATCH16} patch -p1 -i %{PATCH17} -patch -p1 -i %{PATCH18} # Fetch the config and move it to the proper directory cp %{SOURCE1} .config diff --git a/baseos/kernel/6.13/legion-16arx8h-hda-quirk.patch b/baseos/kernel/6.13/legion-16arx8h-hda-quirk.patch deleted file mode 100644 index 9ad40ef..0000000 --- a/baseos/kernel/6.13/legion-16arx8h-hda-quirk.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 4210bc8..453835b 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -10888,7 +10888,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN), - HDA_CODEC_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7", ALC287_FIXUP_CS35L41_I2C_2), - SND_PCI_QUIRK(0x17aa, 0x386e, "Yoga Pro 7 14ARP8", ALC285_FIXUP_SPEAKER2_TO_DAC1), -- HDA_CODEC_QUIRK(0x17aa, 0x386f, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C), -+ HDA_CODEC_QUIRK(0x17aa, 0x38a8, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C), /* this must match before PCI SSID 17aa:386f below */ - SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2), - SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C), - SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2), -- knotmirror 0.0.1