Skip to content

Commit 47622aa

Browse files
committed
Merge tag 'loongarch-fixes-6.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
Pull LoongArch fixes from Huacai Chen: "Remove redundant code in head.S, fix PMU counter allocation for mixed- type event groups, fix a lot of dts build warnings, and fix kvm_device memory leaks" * tag 'loongarch-fixes-6.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: LoongArch: KVM: Fix kvm_device leak in kvm_pch_pic_destroy() LoongArch: KVM: Fix kvm_device leak in kvm_eiointc_destroy() LoongArch: KVM: Fix kvm_device leak in kvm_ipi_destroy() LoongArch: dts: loongson-2k1000: Fix i2c-gpio node names LoongArch: dts: loongson-2k2000: Add default interrupt controller address cells LoongArch: dts: loongson-2k1000: Add default interrupt controller address cells LoongArch: dts: loongson-2k0500: Add default interrupt controller address cells LoongArch: dts: Describe PCI sideband IRQ through interrupt-extended LoongArch: Fix PMU counter allocation for mixed-type event groups LoongArch: Remove redundant code in head.S
2 parents d12453c + 1cf342a commit 47622aa

8 files changed

Lines changed: 52 additions & 49 deletions

File tree

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: 13 additions & 18 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>;
@@ -437,54 +439,47 @@
437439

438440
gmac0: ethernet@3,0 {
439441
reg = <0x1800 0x0 0x0 0x0 0x0>;
440-
interrupt-parent = <&liointc0>;
441-
interrupts = <12 IRQ_TYPE_LEVEL_HIGH>,
442-
<13 IRQ_TYPE_LEVEL_HIGH>;
442+
interrupts-extended = <&liointc0 12 IRQ_TYPE_LEVEL_HIGH>,
443+
<&liointc0 13 IRQ_TYPE_LEVEL_HIGH>;
443444
interrupt-names = "macirq", "eth_lpi";
444445
status = "disabled";
445446
};
446447

447448
gmac1: ethernet@3,1 {
448449
reg = <0x1900 0x0 0x0 0x0 0x0>;
449-
interrupt-parent = <&liointc0>;
450-
interrupts = <14 IRQ_TYPE_LEVEL_HIGH>,
451-
<15 IRQ_TYPE_LEVEL_HIGH>;
450+
interrupts-extended = <&liointc0 14 IRQ_TYPE_LEVEL_HIGH>,
451+
<&liointc0 15 IRQ_TYPE_LEVEL_HIGH>;
452452
interrupt-names = "macirq", "eth_lpi";
453453
status = "disabled";
454454
};
455455

456456
ehci0: usb@4,1 {
457457
reg = <0x2100 0x0 0x0 0x0 0x0>;
458-
interrupt-parent = <&liointc1>;
459-
interrupts = <18 IRQ_TYPE_LEVEL_HIGH>;
458+
interrupts-extended = <&liointc1 18 IRQ_TYPE_LEVEL_HIGH>;
460459
status = "disabled";
461460
};
462461

463462
ohci0: usb@4,2 {
464463
reg = <0x2200 0x0 0x0 0x0 0x0>;
465-
interrupt-parent = <&liointc1>;
466-
interrupts = <19 IRQ_TYPE_LEVEL_HIGH>;
464+
interrupts-extended = <&liointc1 19 IRQ_TYPE_LEVEL_HIGH>;
467465
status = "disabled";
468466
};
469467

470468
display@6,0 {
471469
reg = <0x3000 0x0 0x0 0x0 0x0>;
472-
interrupt-parent = <&liointc0>;
473-
interrupts = <28 IRQ_TYPE_LEVEL_HIGH>;
470+
interrupts-extended = <&liointc0 28 IRQ_TYPE_LEVEL_HIGH>;
474471
status = "disabled";
475472
};
476473

477474
hda@7,0 {
478475
reg = <0x3800 0x0 0x0 0x0 0x0>;
479-
interrupt-parent = <&liointc0>;
480-
interrupts = <4 IRQ_TYPE_LEVEL_HIGH>;
476+
interrupts-extended = <&liointc0 4 IRQ_TYPE_LEVEL_HIGH>;
481477
status = "disabled";
482478
};
483479

484480
sata: sata@8,0 {
485481
reg = <0x4000 0x0 0x0 0x0 0x0>;
486-
interrupt-parent = <&liointc0>;
487-
interrupts = <19 IRQ_TYPE_LEVEL_HIGH>;
482+
interrupts-extended = <&liointc0 19 IRQ_TYPE_LEVEL_HIGH>;
488483
status = "disabled";
489484
};
490485

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

Lines changed: 15 additions & 20 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>;
@@ -291,65 +294,57 @@
291294

292295
gmac0: ethernet@3,0 {
293296
reg = <0x1800 0x0 0x0 0x0 0x0>;
294-
interrupts = <12 IRQ_TYPE_LEVEL_HIGH>,
295-
<13 IRQ_TYPE_LEVEL_HIGH>;
297+
interrupts-extended = <&pic 12 IRQ_TYPE_LEVEL_HIGH>,
298+
<&pic 13 IRQ_TYPE_LEVEL_HIGH>;
296299
interrupt-names = "macirq", "eth_lpi";
297-
interrupt-parent = <&pic>;
298300
status = "disabled";
299301
};
300302

301303
gmac1: ethernet@3,1 {
302304
reg = <0x1900 0x0 0x0 0x0 0x0>;
303-
interrupts = <14 IRQ_TYPE_LEVEL_HIGH>,
304-
<15 IRQ_TYPE_LEVEL_HIGH>;
305+
interrupts-extended = <&pic 14 IRQ_TYPE_LEVEL_HIGH>,
306+
<&pic 15 IRQ_TYPE_LEVEL_HIGH>;
305307
interrupt-names = "macirq", "eth_lpi";
306-
interrupt-parent = <&pic>;
307308
status = "disabled";
308309
};
309310

310311
gmac2: ethernet@3,2 {
311312
reg = <0x1a00 0x0 0x0 0x0 0x0>;
312-
interrupts = <17 IRQ_TYPE_LEVEL_HIGH>,
313-
<18 IRQ_TYPE_LEVEL_HIGH>;
313+
interrupts-extended = <&pic 17 IRQ_TYPE_LEVEL_HIGH>,
314+
<&pic 18 IRQ_TYPE_LEVEL_HIGH>;
314315
interrupt-names = "macirq", "eth_lpi";
315-
interrupt-parent = <&pic>;
316316
status = "disabled";
317317
};
318318

319319
xhci0: usb@4,0 {
320320
reg = <0x2000 0x0 0x0 0x0 0x0>;
321-
interrupts = <48 IRQ_TYPE_LEVEL_HIGH>;
322-
interrupt-parent = <&pic>;
321+
interrupts-extended = <&pic 48 IRQ_TYPE_LEVEL_HIGH>;
323322
status = "disabled";
324323
};
325324

326325
xhci1: usb@19,0 {
327326
reg = <0xc800 0x0 0x0 0x0 0x0>;
328-
interrupts = <22 IRQ_TYPE_LEVEL_HIGH>;
329-
interrupt-parent = <&pic>;
327+
interrupts-extended = <&pic 22 IRQ_TYPE_LEVEL_HIGH>;
330328
status = "disabled";
331329
};
332330

333331
display@6,1 {
334332
reg = <0x3100 0x0 0x0 0x0 0x0>;
335-
interrupts = <28 IRQ_TYPE_LEVEL_HIGH>;
336-
interrupt-parent = <&pic>;
333+
interrupts-extended = <&pic 28 IRQ_TYPE_LEVEL_HIGH>;
337334
status = "disabled";
338335
};
339336

340337
i2s@7,0 {
341338
reg = <0x3800 0x0 0x0 0x0 0x0>;
342-
interrupts = <78 IRQ_TYPE_LEVEL_HIGH>,
343-
<79 IRQ_TYPE_LEVEL_HIGH>;
339+
interrupts-extended = <&pic 78 IRQ_TYPE_LEVEL_HIGH>,
340+
<&pic 79 IRQ_TYPE_LEVEL_HIGH>;
344341
interrupt-names = "tx", "rx";
345-
interrupt-parent = <&pic>;
346342
status = "disabled";
347343
};
348344

349345
sata: sata@8,0 {
350346
reg = <0x4000 0x0 0x0 0x0 0x0>;
351-
interrupts = <16 IRQ_TYPE_LEVEL_HIGH>;
352-
interrupt-parent = <&pic>;
347+
interrupts-extended = <&pic 16 IRQ_TYPE_LEVEL_HIGH>;
353348
status = "disabled";
354349
};
355350

arch/loongarch/kernel/head.S

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,6 @@ SYM_CODE_START(smpboot_entry)
126126
LONG_LI t1, CSR_STFILL
127127
csrxchg t0, t1, LOONGARCH_CSR_IMPCTL1
128128
#endif
129-
/* Enable PG */
130-
li.w t0, 0xb0 # PLV=0, IE=0, PG=1
131-
csrwr t0, LOONGARCH_CSR_CRMD
132-
li.w t0, 0x04 # PLV=0, PIE=1, PWE=0
133-
csrwr t0, LOONGARCH_CSR_PRMD
134-
li.w t0, 0x00 # FPE=0, SXE=0, ASXE=0, BTE=0
135-
csrwr t0, LOONGARCH_CSR_EUEN
136-
137129
la.pcrel t0, cpuboot_data
138130
ld.d sp, t0, CPU_BOOT_STACK
139131
ld.d tp, t0, CPU_BOOT_TINFO

arch/loongarch/kernel/perf_event.c

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

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

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

636-
if (loongarch_pmu_alloc_counter(&fake_cpuc, &leader->hw) < 0)
648+
if (loongarch_pmu_event_requires_counter(leader) &&
649+
loongarch_pmu_alloc_counter(&fake_cpuc, &leader->hw) < 0)
637650
return -EINVAL;
638651

639652
for_each_sibling_event(sibling, leader) {
640-
if (loongarch_pmu_alloc_counter(&fake_cpuc, &sibling->hw) < 0)
653+
if (loongarch_pmu_event_requires_counter(sibling) &&
654+
loongarch_pmu_alloc_counter(&fake_cpuc, &sibling->hw) < 0)
641655
return -EINVAL;
642656
}
643657

644-
if (loongarch_pmu_alloc_counter(&fake_cpuc, &event->hw) < 0)
658+
if (loongarch_pmu_event_requires_counter(event) &&
659+
loongarch_pmu_alloc_counter(&fake_cpuc, &event->hw) < 0)
645660
return -EINVAL;
646661

647662
return 0;

arch/loongarch/kvm/intc/eiointc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ static void kvm_eiointc_destroy(struct kvm_device *dev)
679679
kvm_io_bus_unregister_dev(kvm, KVM_IOCSR_BUS, &eiointc->device);
680680
kvm_io_bus_unregister_dev(kvm, KVM_IOCSR_BUS, &eiointc->device_vext);
681681
kfree(eiointc);
682+
kfree(dev);
682683
}
683684

684685
static struct kvm_device_ops kvm_eiointc_dev_ops = {

arch/loongarch/kvm/intc/ipi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ static void kvm_ipi_destroy(struct kvm_device *dev)
459459
ipi = kvm->arch.ipi;
460460
kvm_io_bus_unregister_dev(kvm, KVM_IOCSR_BUS, &ipi->device);
461461
kfree(ipi);
462+
kfree(dev);
462463
}
463464

464465
static struct kvm_device_ops kvm_ipi_dev_ops = {

arch/loongarch/kvm/intc/pch_pic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ static void kvm_pch_pic_destroy(struct kvm_device *dev)
475475
/* unregister pch pic device and free it's memory */
476476
kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS, &s->device);
477477
kfree(s);
478+
kfree(dev);
478479
}
479480

480481
static struct kvm_device_ops kvm_pch_pic_dev_ops = {

0 commit comments

Comments
 (0)