Skip to content

Commit b4d846e

Browse files
committed
Merge branch '7.0/cachy' into 7.0/base
Signed-off-by: Eric Naim <dnaim@cachyos.org>
2 parents a0795bf + 23af731 commit b4d846e

69 files changed

Lines changed: 10624 additions & 126 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
*.zst
5757
Module.symvers
5858
dtbs-list
59+
builtin.order
5960
modules.order
6061

6162
#
@@ -67,6 +68,7 @@ modules.order
6768
/vmlinux.32
6869
/vmlinux.map
6970
/vmlinux.symvers
71+
/vmlinux.thinlto-index
7072
/vmlinux.unstripped
7173
/vmlinux-gdb.py
7274
/vmlinuz

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,9 @@ Kernel parameters
25332533
disable
25342534
Do not enable intel_pstate as the default
25352535
scaling driver for the supported processors
2536+
enable
2537+
Enable intel_pstate in-case "disable" was passed
2538+
previously in the kernel boot parameters
25362539
active
25372540
Use intel_pstate driver to bypass the scaling
25382541
governors layer of cpufreq and provides it own
@@ -5114,6 +5117,15 @@ Kernel parameters
51145117
nomsi [MSI] If the PCI_MSI kernel config parameter is
51155118
enabled, this kernel boot option can be used to
51165119
disable the use of MSI interrupts system-wide.
5120+
pcie_acs_override =
5121+
[PCIE] Override missing PCIe ACS support for:
5122+
downstream
5123+
All downstream ports - full ACS capabilities
5124+
multfunction
5125+
All multifunction devices - multifunction ACS subset
5126+
id:nnnn:nnnn
5127+
Specfic device - full ACS capabilities
5128+
Specified as vid:did (vendor/device ID) in hex
51175129
noioapicquirk [APIC] Disable all boot interrupt quirks.
51185130
Safety option to keep boot IRQs enabled. This
51195131
should never be necessary.

Makefile

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -893,11 +893,20 @@ KBUILD_CFLAGS += -fno-delete-null-pointer-checks
893893
ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
894894
KBUILD_CFLAGS += -O2
895895
KBUILD_RUSTFLAGS += -Copt-level=2
896+
else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
897+
KBUILD_CFLAGS += -O3
898+
KBUILD_RUSTFLAGS += -Copt-level=3
896899
else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
897900
KBUILD_CFLAGS += -Os
898901
KBUILD_RUSTFLAGS += -Copt-level=s
899902
endif
900903

904+
# Perform swing modulo scheduling immediately before the first scheduling pass.
905+
# This pass looks at innermost loops and reorders their instructions by
906+
# overlapping different iterations.
907+
KBUILD_CFLAGS += $(call cc-option,-fmodulo-sched -fmodulo-sched-allow-regmoves -fivopts)
908+
KBUILD_CFLAGS += $(call cc-option,-mllvm -enable-pipeliner)
909+
901910
# Always set `debug-assertions` and `overflow-checks` because their default
902911
# depends on `opt-level` and `debug-assertions`, respectively.
903912
KBUILD_RUSTFLAGS += -Cdebug-assertions=$(if $(CONFIG_RUST_DEBUG_ASSERTIONS),y,n)
@@ -1033,10 +1042,10 @@ export CC_FLAGS_SCS
10331042
endif
10341043

10351044
ifdef CONFIG_LTO_CLANG
1036-
ifdef CONFIG_LTO_CLANG_THIN
1037-
CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
1038-
else
1045+
ifdef CONFIG_LTO_CLANG_FULL
10391046
CC_FLAGS_LTO := -flto
1047+
else
1048+
CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
10401049
endif
10411050
CC_FLAGS_LTO += -fvisibility=hidden
10421051

@@ -1255,7 +1264,7 @@ export ARCH_DRIVERS := $(drivers-y) $(drivers-m)
12551264
KBUILD_VMLINUX_OBJS := built-in.a $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
12561265
KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y))
12571266

1258-
export KBUILD_VMLINUX_LIBS
1267+
export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS
12591268
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
12601269

12611270
ifdef CONFIG_TRIM_UNUSED_KSYMS
@@ -1264,16 +1273,12 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS
12641273
KBUILD_MODULES := y
12651274
endif
12661275

1267-
# '$(AR) mPi' needs 'T' to workaround the bug of llvm-ar <= 14
1268-
quiet_cmd_ar_vmlinux.a = AR $@
1269-
cmd_ar_vmlinux.a = \
1270-
rm -f $@; \
1271-
$(AR) cDPrST $@ $(KBUILD_VMLINUX_OBJS); \
1272-
$(AR) mPiT $$($(AR) t $@ | sed -n 1p) $@ $$($(AR) t $@ | grep -F -f $(srctree)/scripts/head-object-list.txt)
1276+
PHONY += vmlinux_a
1277+
vmlinux_a: $(KBUILD_VMLINUX_OBJS) scripts/head-object-list.txt FORCE
1278+
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux_a
12731279

1274-
targets += vmlinux.a
1275-
vmlinux.a: $(KBUILD_VMLINUX_OBJS) scripts/head-object-list.txt FORCE
1276-
$(call if_changed,ar_vmlinux.a)
1280+
vmlinux.a: vmlinux_a
1281+
@:
12771282

12781283
PHONY += vmlinux_o
12791284
vmlinux_o: vmlinux.a $(KBUILD_VMLINUX_LIBS)
@@ -1652,6 +1657,7 @@ endif # CONFIG_MODULES
16521657
CLEAN_FILES += vmlinux.symvers modules-only.symvers \
16531658
modules.builtin modules.builtin.modinfo modules.nsdeps \
16541659
modules.builtin.ranges vmlinux.o.map vmlinux.unstripped \
1660+
vmlinux.thinlto-index builtin.order \
16551661
compile_commands.json rust/test \
16561662
rust-project.json .vmlinux.objs .vmlinux.export.c \
16571663
.builtin-dtbs-list .builtin-dtbs.S
@@ -2113,7 +2119,7 @@ clean: $(clean-dirs)
21132119
$(call cmd,rmfiles)
21142120
@find . $(RCS_FIND_IGNORE) \
21152121
\( -name '*.[aios]' -o -name '*.rsi' -o -name '*.ko' -o -name '.*.cmd' \
2116-
-o -name '*.ko.*' \
2122+
-o -name '*.ko.*' -o -name '*.o.thinlto.bc' \
21172123
-o -name '*.dtb' -o -name '*.dtbo' \
21182124
-o -name '*.dtb.S' -o -name '*.dtbo.S' \
21192125
-o -name '*.dt.yaml' -o -name 'dtbs-list' \

arch/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,25 @@ config LTO_CLANG_THIN
861861
https://clang.llvm.org/docs/ThinLTO.html
862862

863863
If unsure, say Y.
864+
865+
config LTO_CLANG_THIN_DIST
866+
bool "Clang ThinLTO in distributed mode (EXPERIMENTAL)"
867+
depends on HAS_LTO_CLANG && ARCH_SUPPORTS_LTO_CLANG_THIN
868+
select LTO_CLANG
869+
help
870+
This option enables Clang's ThinLTO in distributed build mode.
871+
In this mode, the linker performs the thin-link, generating
872+
ThinLTO index files. Subsequently, the build system explicitly
873+
invokes ThinLTO backend compilation using these index files
874+
and pre-linked IR objects. The resulting native object files
875+
are with the .thinlto-native.o suffix.
876+
877+
This build mode offers improved visibility into the ThinLTO
878+
process through explicit subcommand exposure. It also makes
879+
final native object files directly available, benefiting
880+
tools like objtool and kpatch. Additionally, it provides
881+
crucial granular control over back-end options, enabling
882+
module-specific compiler options, and simplifies debugging.
864883
endchoice
865884

866885
config ARCH_SUPPORTS_AUTOFDO_CLANG

arch/x86/Kconfig.cpu

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ config CC_HAS_MARCH_NATIVE
255255
# usage warnings that only appear wth '-march=native'.
256256
depends on CC_IS_GCC || CLANG_VERSION >= 190100
257257

258+
259+
choice
260+
prompt "x86_64 Compiler Build Optimization"
261+
default GENERIC_CPU
262+
258263
config X86_NATIVE_CPU
259264
bool "Build and optimize for local/native CPU"
260265
depends on X86_64
@@ -269,6 +274,47 @@ config X86_NATIVE_CPU
269274

270275
If unsure, say N.
271276

277+
config GENERIC_CPU
278+
bool "Generic-x86-64"
279+
depends on X86_64
280+
help
281+
Generic x86-64 CPU.
282+
Runs equally well on all x86-64 CPUs.
283+
284+
config MZEN4
285+
bool "AMD Ryzen 4"
286+
depends on (CC_IS_GCC && GCC_VERSION >= 130000) || (CC_IS_CLANG && CLANG_VERSION >= 160000)
287+
help
288+
Select this for AMD Family 19h Zen 4 processors.
289+
290+
Enables -march=znver4
291+
292+
endchoice
293+
294+
config X86_64_VERSION
295+
int "x86-64 compiler ISA level"
296+
range 1 4
297+
depends on (CC_IS_GCC && GCC_VERSION > 110000) || (CC_IS_CLANG && CLANG_VERSION >= 120000)
298+
depends on X86_64 && GENERIC_CPU
299+
help
300+
Specify a specific x86-64 compiler ISA level.
301+
302+
There are three x86-64 ISA levels that work on top of
303+
the x86-64 baseline, namely: x86-64-v2 and x86-64-v3.
304+
305+
x86-64-v2 brings support for vector instructions up to Streaming SIMD
306+
Extensions 4.2 (SSE4.2) and Supplemental Streaming SIMD Extensions 3
307+
(SSSE3), the POPCNT instruction, and CMPXCHG16B.
308+
309+
x86-64-v3 adds vector instructions up to AVX2, MOVBE, and additional
310+
bit-manipulation instructions.
311+
312+
x86-64-v4 is not included since the kernel does not use AVX512 instructions
313+
314+
You can find the best version for your CPU by running one of the following:
315+
/lib/ld-linux-x86-64.so.2 --help | grep supported
316+
/lib64/ld-linux-x86-64.so.2 --help | grep supported
317+
272318
config X86_GENERIC
273319
bool "Generic x86 support"
274320
depends on X86_32

arch/x86/Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,22 @@ else
167167
ifdef CONFIG_X86_NATIVE_CPU
168168
KBUILD_CFLAGS += -march=native
169169
KBUILD_RUSTFLAGS += -Ctarget-cpu=native
170-
else
170+
endif
171+
172+
ifdef CONFIG_MZEN4
173+
KBUILD_CFLAGS += -march=znver4
174+
KBUILD_RUSTFLAGS += -Ctarget-cpu=znver4
175+
endif
176+
177+
ifdef CONFIG_GENERIC_CPU
178+
ifeq ($(CONFIG_X86_64_VERSION),1)
171179
KBUILD_CFLAGS += -march=x86-64 -mtune=generic
172180
KBUILD_RUSTFLAGS += -Ctarget-cpu=x86-64 -Ztune-cpu=generic
173-
endif
181+
else
182+
KBUILD_CFLAGS +=-march=x86-64-v$(CONFIG_X86_64_VERSION)
183+
KBUILD_RUSTFLAGS += -Ctarget-cpu=x86-64-v$(CONFIG_X86_64_VERSION)
184+
endif # CONFIG_X86_64_VERSION
185+
endif # CONFIG_GENERIC_CPU
174186

175187
KBUILD_CFLAGS += -mno-red-zone
176188
KBUILD_CFLAGS += -mcmodel=kernel

arch/x86/include/asm/pci.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct pci_sysdata {
2626
#if IS_ENABLED(CONFIG_VMD)
2727
struct pci_dev *vmd_dev; /* VMD Device if in Intel VMD domain */
2828
#endif
29+
struct pci_dev *nvme_remap_dev; /* AHCI Device if NVME remapped bus */
2930
};
3031

3132
extern int pci_routeirq;
@@ -69,6 +70,11 @@ static inline bool is_vmd(struct pci_bus *bus)
6970
#define is_vmd(bus) false
7071
#endif /* CONFIG_VMD */
7172

73+
static inline bool is_nvme_remap(struct pci_bus *bus)
74+
{
75+
return to_pci_sysdata(bus)->nvme_remap_dev != NULL;
76+
}
77+
7278
/* Can be used to override the logic in pci_scan_bus for skipping
7379
already-configured bus numbers - to be used for buggy BIOSes
7480
or architectures with incomplete PCI setup by the loader */

arch/x86/kernel/cpu/bus_lock.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ static const struct {
4747

4848
static struct ratelimit_state bld_ratelimit;
4949

50+
#ifdef CONFIG_CACHY
51+
static unsigned int sysctl_sld_mitigate = 0;
52+
#else
5053
static unsigned int sysctl_sld_mitigate = 1;
54+
#endif /* CONFIG_CACHY */
5155
static DEFINE_SEMAPHORE(buslock_sem, 1);
5256

5357
#ifdef CONFIG_PROC_SYSCTL

arch/x86/pci/common.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,12 +723,15 @@ int pci_ext_cfg_avail(void)
723723
return 0;
724724
}
725725

726-
#if IS_ENABLED(CONFIG_VMD)
727726
struct pci_dev *pci_real_dma_dev(struct pci_dev *dev)
728727
{
728+
#if IS_ENABLED(CONFIG_VMD)
729729
if (is_vmd(dev->bus))
730730
return to_pci_sysdata(dev->bus)->vmd_dev;
731+
#endif
732+
733+
if (is_nvme_remap(dev->bus))
734+
return to_pci_sysdata(dev->bus)->nvme_remap_dev;
731735

732736
return dev;
733737
}
734-
#endif

block/Kconfig.iosched

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ config MQ_IOSCHED_KYBER
1616
synchronous writes, it will self-tune queue depths to achieve that
1717
goal.
1818

19+
config MQ_IOSCHED_ADIOS
20+
tristate "Adaptive Deadline I/O scheduler"
21+
default m
22+
help
23+
The Adaptive Deadline I/O Scheduler (ADIOS) is a multi-queue I/O
24+
scheduler with learning-based adaptive latency control.
25+
26+
config MQ_IOSCHED_DEFAULT_ADIOS
27+
bool "Enable ADIOS I/O scheduler as default MQ I/O scheduler"
28+
depends on MQ_IOSCHED_ADIOS=y
29+
default n
30+
help
31+
Enable the ADIOS I/O scheduler as the default scheduler for MQ I/O.
32+
1933
config IOSCHED_BFQ
2034
tristate "BFQ I/O scheduler"
2135
select BLK_ICQ

0 commit comments

Comments
 (0)