Skip to content

Commit 619bd34

Browse files
committed
Merge remote-tracking branch 'stable/linux-6.12.y' into rpi-6.12.y
2 parents 8b22b5c + abf529a commit 619bd34

166 files changed

Lines changed: 1424 additions & 596 deletions

File tree

Some content is hidden

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

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 6
33
PATCHLEVEL = 12
4-
SUBLEVEL = 66
4+
SUBLEVEL = 67
55
EXTRAVERSION =
66
NAME = Baby Opossum Posse
77

arch/loongarch/boot/dts/loongson-2k0500.dtsi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
reg-names = "main", "isr0";
132132

133133
interrupt-controller;
134+
#address-cells = <0>;
134135
#interrupt-cells = <2>;
135136
interrupt-parent = <&cpuintc>;
136137
interrupts = <2>;
@@ -149,6 +150,7 @@
149150
reg-names = "main", "isr0";
150151

151152
interrupt-controller;
153+
#address-cells = <0>;
152154
#interrupt-cells = <2>;
153155
interrupt-parent = <&cpuintc>;
154156
interrupts = <4>;
@@ -164,6 +166,7 @@
164166
compatible = "loongson,ls2k0500-eiointc";
165167
reg = <0x0 0x1fe11600 0x0 0xea00>;
166168
interrupt-controller;
169+
#address-cells = <0>;
167170
#interrupt-cells = <1>;
168171
interrupt-parent = <&cpuintc>;
169172
interrupts = <3>;

arch/loongarch/boot/dts/loongson-2k1000.dtsi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
};
4747

4848
/* i2c of the dvi eeprom edid */
49-
i2c-gpio-0 {
49+
i2c-0 {
5050
compatible = "i2c-gpio";
5151
scl-gpios = <&gpio0 0 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
5252
sda-gpios = <&gpio0 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
@@ -57,7 +57,7 @@
5757
};
5858

5959
/* i2c of the eeprom edid */
60-
i2c-gpio-1 {
60+
i2c-1 {
6161
compatible = "i2c-gpio";
6262
scl-gpios = <&gpio0 33 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
6363
sda-gpios = <&gpio0 32 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
@@ -114,6 +114,7 @@
114114
<0x0 0x1fe01140 0x0 0x8>;
115115
reg-names = "main", "isr0", "isr1";
116116
interrupt-controller;
117+
#address-cells = <0>;
117118
#interrupt-cells = <2>;
118119
interrupt-parent = <&cpuintc>;
119120
interrupts = <2>;
@@ -131,6 +132,7 @@
131132
<0x0 0x1fe01148 0x0 0x8>;
132133
reg-names = "main", "isr0", "isr1";
133134
interrupt-controller;
135+
#address-cells = <0>;
134136
#interrupt-cells = <2>;
135137
interrupt-parent = <&cpuintc>;
136138
interrupts = <3>;

arch/loongarch/boot/dts/loongson-2k2000.dtsi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
reg = <0x0 0x1fe01400 0x0 0x64>;
127127

128128
interrupt-controller;
129+
#address-cells = <0>;
129130
#interrupt-cells = <2>;
130131
interrupt-parent = <&cpuintc>;
131132
interrupts = <2>;
@@ -140,6 +141,7 @@
140141
compatible = "loongson,ls2k2000-eiointc";
141142
reg = <0x0 0x1fe01600 0x0 0xea00>;
142143
interrupt-controller;
144+
#address-cells = <0>;
143145
#interrupt-cells = <1>;
144146
interrupt-parent = <&cpuintc>;
145147
interrupts = <3>;
@@ -149,6 +151,7 @@
149151
compatible = "loongson,pch-pic-1.0";
150152
reg = <0x0 0x10000000 0x0 0x400>;
151153
interrupt-controller;
154+
#address-cells = <0>;
152155
#interrupt-cells = <2>;
153156
loongson,pic-base-vec = <0>;
154157
interrupt-parent = <&eiointc>;

arch/loongarch/kernel/perf_event.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,22 +627,37 @@ static const struct loongarch_perf_event *loongarch_pmu_map_cache_event(u64 conf
627627
return pev;
628628
}
629629

630+
static inline bool loongarch_pmu_event_requires_counter(const struct perf_event *event)
631+
{
632+
switch (event->attr.type) {
633+
case PERF_TYPE_HARDWARE:
634+
case PERF_TYPE_HW_CACHE:
635+
case PERF_TYPE_RAW:
636+
return true;
637+
default:
638+
return false;
639+
}
640+
}
641+
630642
static int validate_group(struct perf_event *event)
631643
{
632644
struct cpu_hw_events fake_cpuc;
633645
struct perf_event *sibling, *leader = event->group_leader;
634646

635647
memset(&fake_cpuc, 0, sizeof(fake_cpuc));
636648

637-
if (loongarch_pmu_alloc_counter(&fake_cpuc, &leader->hw) < 0)
649+
if (loongarch_pmu_event_requires_counter(leader) &&
650+
loongarch_pmu_alloc_counter(&fake_cpuc, &leader->hw) < 0)
638651
return -EINVAL;
639652

640653
for_each_sibling_event(sibling, leader) {
641-
if (loongarch_pmu_alloc_counter(&fake_cpuc, &sibling->hw) < 0)
654+
if (loongarch_pmu_event_requires_counter(sibling) &&
655+
loongarch_pmu_alloc_counter(&fake_cpuc, &sibling->hw) < 0)
642656
return -EINVAL;
643657
}
644658

645-
if (loongarch_pmu_alloc_counter(&fake_cpuc, &event->hw) < 0)
659+
if (loongarch_pmu_event_requires_counter(event) &&
660+
loongarch_pmu_alloc_counter(&fake_cpuc, &event->hw) < 0)
646661
return -EINVAL;
647662

648663
return 0;

arch/x86/kernel/cpu/resctrl/core.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,8 @@ static __init bool get_mem_config(void)
892892

893893
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
894894
return __get_mem_config_intel(&hw_res->r_resctrl);
895-
else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
895+
else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
896+
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
896897
return __rdt_get_mem_config_amd(&hw_res->r_resctrl);
897898

898899
return false;
@@ -1043,7 +1044,8 @@ static __init void rdt_init_res_defs(void)
10431044
{
10441045
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
10451046
rdt_init_res_defs_intel();
1046-
else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
1047+
else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
1048+
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
10471049
rdt_init_res_defs_amd();
10481050
}
10491051

@@ -1074,8 +1076,19 @@ void resctrl_cpu_detect(struct cpuinfo_x86 *c)
10741076
c->x86_cache_occ_scale = ebx;
10751077
c->x86_cache_mbm_width_offset = eax & 0xff;
10761078

1077-
if (c->x86_vendor == X86_VENDOR_AMD && !c->x86_cache_mbm_width_offset)
1078-
c->x86_cache_mbm_width_offset = MBM_CNTR_WIDTH_OFFSET_AMD;
1079+
if (!c->x86_cache_mbm_width_offset) {
1080+
switch (c->x86_vendor) {
1081+
case X86_VENDOR_AMD:
1082+
c->x86_cache_mbm_width_offset = MBM_CNTR_WIDTH_OFFSET_AMD;
1083+
break;
1084+
case X86_VENDOR_HYGON:
1085+
c->x86_cache_mbm_width_offset = MBM_CNTR_WIDTH_OFFSET_HYGON;
1086+
break;
1087+
default:
1088+
/* Leave c->x86_cache_mbm_width_offset as 0 */
1089+
break;
1090+
}
1091+
}
10791092
}
10801093
}
10811094

arch/x86/kernel/cpu/resctrl/internal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#define MBA_IS_LINEAR 0x4
2424
#define MBM_CNTR_WIDTH_OFFSET_AMD 20
2525

26+
/* Hygon MBM counter width as an offset from MBM_CNTR_WIDTH_BASE */
27+
#define MBM_CNTR_WIDTH_OFFSET_HYGON 8
28+
2629
#define RMID_VAL_ERROR BIT_ULL(63)
2730
#define RMID_VAL_UNAVAIL BIT_ULL(62)
2831
/*

arch/x86/kernel/fpu/core.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,29 @@ EXPORT_SYMBOL_GPL(fpu_enable_guest_xfd_features);
294294
#ifdef CONFIG_X86_64
295295
void fpu_update_guest_xfd(struct fpu_guest *guest_fpu, u64 xfd)
296296
{
297+
struct fpstate *fpstate = guest_fpu->fpstate;
298+
297299
fpregs_lock();
298-
guest_fpu->fpstate->xfd = xfd;
299-
if (guest_fpu->fpstate->in_use)
300-
xfd_update_state(guest_fpu->fpstate);
300+
301+
/*
302+
* KVM's guest ABI is that setting XFD[i]=1 *can* immediately revert the
303+
* save state to its initial configuration. Likewise, KVM_GET_XSAVE does
304+
* the same as XSAVE and returns XSTATE_BV[i]=0 whenever XFD[i]=1.
305+
*
306+
* If the guest's FPU state is in hardware, just update XFD: the XSAVE
307+
* in fpu_swap_kvm_fpstate will clear XSTATE_BV[i] whenever XFD[i]=1.
308+
*
309+
* If however the guest's FPU state is NOT resident in hardware, clear
310+
* disabled components in XSTATE_BV now, or a subsequent XRSTOR will
311+
* attempt to load disabled components and generate #NM _in the host_.
312+
*/
313+
if (xfd && test_thread_flag(TIF_NEED_FPU_LOAD))
314+
fpstate->regs.xsave.header.xfeatures &= ~xfd;
315+
316+
fpstate->xfd = xfd;
317+
if (fpstate->in_use)
318+
xfd_update_state(fpstate);
319+
301320
fpregs_unlock();
302321
}
303322
EXPORT_SYMBOL_GPL(fpu_update_guest_xfd);
@@ -405,6 +424,13 @@ int fpu_copy_uabi_to_guest_fpstate(struct fpu_guest *gfpu, const void *buf,
405424
if (ustate->xsave.header.xfeatures & ~xcr0)
406425
return -EINVAL;
407426

427+
/*
428+
* Disabled features must be in their initial state, otherwise XRSTOR
429+
* causes an exception.
430+
*/
431+
if (WARN_ON_ONCE(ustate->xsave.header.xfeatures & kstate->xfd))
432+
return -EINVAL;
433+
408434
/*
409435
* Nullify @vpkru to preserve its current value if PKRU's bit isn't set
410436
* in the header. KVM's odd ABI is to leave PKRU untouched in this

arch/x86/kvm/x86.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5625,9 +5625,18 @@ static int kvm_vcpu_ioctl_x86_get_xsave(struct kvm_vcpu *vcpu,
56255625
static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,
56265626
struct kvm_xsave *guest_xsave)
56275627
{
5628+
union fpregs_state *xstate = (union fpregs_state *)guest_xsave->region;
5629+
56285630
if (fpstate_is_confidential(&vcpu->arch.guest_fpu))
56295631
return vcpu->kvm->arch.has_protected_state ? -EINVAL : 0;
56305632

5633+
/*
5634+
* For backwards compatibility, do not expect disabled features to be in
5635+
* their initial state. XSTATE_BV[i] must still be cleared whenever
5636+
* XFD[i]=1, or XRSTOR would cause a #NM.
5637+
*/
5638+
xstate->xsave.header.xfeatures &= ~vcpu->arch.guest_fpu.fpstate->xfd;
5639+
56315640
return fpu_copy_uabi_to_guest_fpstate(&vcpu->arch.guest_fpu,
56325641
guest_xsave->region,
56335642
kvm_caps.supported_xcr0,

arch/x86/mm/kaslr.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ void __init kernel_randomize_memory(void)
111111

112112
/*
113113
* Adapt physical memory region size based on available memory,
114-
* except when CONFIG_PCI_P2PDMA is enabled. P2PDMA exposes the
115-
* device BAR space assuming the direct map space is large enough
116-
* for creating a ZONE_DEVICE mapping in the direct map corresponding
117-
* to the physical BAR address.
114+
* except when CONFIG_ZONE_DEVICE is enabled. ZONE_DEVICE wants to map
115+
* any physical address into the direct-map. KASLR wants to reliably
116+
* steal some physical address bits. Those design choices are in direct
117+
* conflict.
118118
*/
119-
if (!IS_ENABLED(CONFIG_PCI_P2PDMA) && (memory_tb < kaslr_regions[0].size_tb))
119+
if (!IS_ENABLED(CONFIG_ZONE_DEVICE) && (memory_tb < kaslr_regions[0].size_tb))
120120
kaslr_regions[0].size_tb = memory_tb;
121121

122122
/*

0 commit comments

Comments
 (0)