Skip to content

Commit 7a3984b

Browse files
committed
Merge tag 'mips_6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS updates from Thomas Bogendoerfer: "Just cleanups and fixes" * tag 'mips_6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: MIPS: Fix whitespace damage in r4k_wait from VS timer fix mips: kvm: simplify kvm_mips_deliver_interrupts() MIPS: alchemy: mtx1: switch to static device properties mips: Remove __GFP_HIGHMEM masking MIPS: ftrace: Fix memory corruption when kernel is located beyond 32 bits MIPS: dts: Always descend vendor subdirectories mips: configs: loongson1: Update defconfig MIPS: Fix HOTPLUG_PARALLEL dependency
2 parents 12eef14 + 2b6d718 commit 7a3984b

9 files changed

Lines changed: 178 additions & 116 deletions

File tree

arch/mips/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ config EYEQ
658658
select USB_UHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
659659
select USB_UHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
660660
select USE_OF
661-
select HOTPLUG_PARALLEL if SMP
661+
select HOTPLUG_PARALLEL if HOTPLUG_CPU
662662
help
663663
Select this to build a kernel supporting EyeQ SoC from Mobileye.
664664

arch/mips/alchemy/board-mtx1.c

Lines changed: 124 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
#include <linux/interrupt.h>
1010
#include <linux/kernel.h>
1111
#include <linux/platform_device.h>
12-
#include <linux/leds.h>
13-
#include <linux/gpio.h>
1412
#include <linux/gpio/machine.h>
15-
#include <linux/gpio_keys.h>
13+
#include <linux/gpio/property.h>
1614
#include <linux/input.h>
1715
#include <linux/mtd/partitions.h>
1816
#include <linux/mtd/physmap.h>
@@ -80,64 +78,134 @@ void __init board_setup(void)
8078

8179
/******************************************************************************/
8280

83-
static struct gpio_keys_button mtx1_gpio_button[] = {
84-
{
85-
.gpio = 207,
86-
.code = BTN_0,
87-
.desc = "System button",
88-
}
81+
static const struct software_node mtx1_gpiochip_node = {
82+
.name = "alchemy-gpio2",
8983
};
9084

91-
static struct gpio_keys_platform_data mtx1_buttons_data = {
92-
.buttons = mtx1_gpio_button,
93-
.nbuttons = ARRAY_SIZE(mtx1_gpio_button),
85+
static const struct software_node mtx1_gpio_keys_node = {
86+
.name = "mtx1-gpio-keys",
9487
};
9588

96-
static struct platform_device mtx1_button = {
97-
.name = "gpio-keys",
98-
.id = -1,
99-
.dev = {
100-
.platform_data = &mtx1_buttons_data,
101-
}
89+
static const struct property_entry mtx1_button_props[] = {
90+
PROPERTY_ENTRY_U32("linux,code", BTN_0),
91+
PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 7, GPIO_ACTIVE_HIGH),
92+
PROPERTY_ENTRY_STRING("label", "System button"),
93+
{ }
10294
};
10395

104-
static struct gpiod_lookup_table mtx1_wdt_gpio_table = {
105-
.dev_id = "mtx1-wdt.0",
106-
.table = {
107-
/* Global number 215 is offset 15 on Alchemy GPIO 2 */
108-
GPIO_LOOKUP("alchemy-gpio2", 15, NULL, GPIO_ACTIVE_HIGH),
109-
{ },
110-
},
96+
static const struct software_node mtx1_button_node = {
97+
.parent = &mtx1_gpio_keys_node,
98+
.properties = mtx1_button_props,
99+
};
100+
101+
static const struct software_node *mtx1_gpio_keys_swnodes[] __initconst = {
102+
&mtx1_gpio_keys_node,
103+
&mtx1_button_node,
104+
NULL
111105
};
112106

113-
static struct platform_device mtx1_wdt = {
107+
static void __init mtx1_keys_init(void)
108+
{
109+
struct platform_device_info keys_info = {
110+
.name = "gpio-keys",
111+
.id = PLATFORM_DEVID_NONE,
112+
};
113+
struct platform_device *pd;
114+
int err;
115+
116+
err = software_node_register_node_group(mtx1_gpio_keys_swnodes);
117+
if (err) {
118+
pr_err("failed to register gpio-keys software nodes: %d\n", err);
119+
return;
120+
}
121+
122+
keys_info.fwnode = software_node_fwnode(&mtx1_gpio_keys_node);
123+
124+
pd = platform_device_register_full(&keys_info);
125+
err = PTR_ERR_OR_ZERO(pd);
126+
if (err)
127+
pr_err("failed to create gpio-keys device: %d\n", err);
128+
}
129+
130+
/* Global number 215 is offset 15 on Alchemy GPIO 2 */
131+
static const struct property_entry mtx1_wdt_props[] = {
132+
PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 15, GPIO_ACTIVE_HIGH),
133+
{ }
134+
};
135+
136+
static struct platform_device_info mtx1_wdt_info __initconst = {
114137
.name = "mtx1-wdt",
115138
.id = 0,
139+
.properties = mtx1_wdt_props,
116140
};
117141

118-
static const struct gpio_led default_leds[] = {
119-
{
120-
.name = "mtx1:green",
121-
.gpio = 211,
122-
}, {
123-
.name = "mtx1:red",
124-
.gpio = 212,
125-
},
142+
static void __init mtx1_wdt_init(void)
143+
{
144+
struct platform_device *pd;
145+
int err;
146+
147+
pd = platform_device_register_full(&mtx1_wdt_info);
148+
err = PTR_ERR_OR_ZERO(pd);
149+
if (err)
150+
pr_err("failed to create gpio-keys device: %d\n", err);
151+
}
152+
153+
static const struct software_node mtx1_gpio_leds_node = {
154+
.name = "mtx1-leds",
126155
};
127156

128-
static struct gpio_led_platform_data mtx1_led_data = {
129-
.num_leds = ARRAY_SIZE(default_leds),
130-
.leds = default_leds,
157+
static const struct property_entry mtx1_green_led_props[] = {
158+
PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 11, GPIO_ACTIVE_HIGH),
159+
{ }
131160
};
132161

133-
static struct platform_device mtx1_gpio_leds = {
134-
.name = "leds-gpio",
135-
.id = -1,
136-
.dev = {
137-
.platform_data = &mtx1_led_data,
138-
}
162+
static const struct software_node mtx1_green_led_node = {
163+
.name = "mtx1:green",
164+
.parent = &mtx1_gpio_leds_node,
165+
.properties = mtx1_green_led_props,
139166
};
140167

168+
static const struct property_entry mtx1_red_led_props[] = {
169+
PROPERTY_ENTRY_GPIO("gpios", &mtx1_gpiochip_node, 12, GPIO_ACTIVE_HIGH),
170+
{ }
171+
};
172+
173+
static const struct software_node mtx1_red_led_node = {
174+
.name = "mtx1:red",
175+
.parent = &mtx1_gpio_leds_node,
176+
.properties = mtx1_red_led_props,
177+
};
178+
179+
static const struct software_node *mtx1_gpio_leds_swnodes[] = {
180+
&mtx1_gpio_leds_node,
181+
&mtx1_green_led_node,
182+
&mtx1_red_led_node,
183+
NULL
184+
};
185+
186+
static void __init mtx1_leds_init(void)
187+
{
188+
struct platform_device_info led_info = {
189+
.name = "leds-gpio",
190+
.id = PLATFORM_DEVID_NONE,
191+
};
192+
struct platform_device *led_dev;
193+
int err;
194+
195+
err = software_node_register_node_group(mtx1_gpio_leds_swnodes);
196+
if (err) {
197+
pr_err("failed to register LED software nodes: %d\n", err);
198+
return;
199+
}
200+
201+
led_info.fwnode = software_node_fwnode(&mtx1_gpio_leds_node);
202+
203+
led_dev = platform_device_register_full(&led_info);
204+
err = PTR_ERR_OR_ZERO(led_dev);
205+
if (err)
206+
pr_err("failed to create LED device: %d\n", err);
207+
}
208+
141209
static struct mtd_partition mtx1_mtd_partitions[] = {
142210
{
143211
.name = "filesystem",
@@ -247,9 +315,6 @@ static struct platform_device mtx1_pci_host = {
247315

248316
static struct platform_device *mtx1_devs[] __initdata = {
249317
&mtx1_pci_host,
250-
&mtx1_gpio_leds,
251-
&mtx1_wdt,
252-
&mtx1_button,
253318
&mtx1_mtd,
254319
};
255320

@@ -270,16 +335,18 @@ static int __init mtx1_register_devices(void)
270335

271336
au1xxx_override_eth_cfg(0, &mtx1_au1000_eth0_pdata);
272337

273-
rc = gpio_request(mtx1_gpio_button[0].gpio,
274-
mtx1_gpio_button[0].desc);
275-
if (rc < 0) {
276-
printk(KERN_INFO "mtx1: failed to request %d\n",
277-
mtx1_gpio_button[0].gpio);
278-
goto out;
279-
}
280-
gpio_direction_input(mtx1_gpio_button[0].gpio);
281-
out:
282-
gpiod_add_lookup_table(&mtx1_wdt_gpio_table);
283-
return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
338+
rc = software_node_register(&mtx1_gpiochip_node);
339+
if (rc)
340+
return rc;
341+
342+
rc = platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
343+
if (rc)
344+
return rc;
345+
346+
mtx1_leds_init();
347+
mtx1_wdt_init();
348+
mtx1_keys_init();
349+
350+
return 0;
284351
}
285352
arch_initcall(mtx1_register_devices);

arch/mips/boot/dts/Makefile

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
subdir-$(CONFIG_BMIPS_GENERIC) += brcm
3-
subdir-$(CONFIG_CAVIUM_OCTEON_SOC) += cavium-octeon
4-
subdir-$(CONFIG_ECONET) += econet
5-
subdir-$(CONFIG_EYEQ) += mobileye
6-
subdir-$(CONFIG_FIT_IMAGE_FDT_MARDUK) += img
7-
subdir-$(CONFIG_FIT_IMAGE_FDT_BOSTON) += img
8-
subdir-$(CONFIG_MACH_INGENIC) += ingenic
9-
subdir-$(CONFIG_LANTIQ) += lantiq
10-
subdir-$(CONFIG_MACH_LOONGSON64) += loongson
11-
subdir-$(CONFIG_MACH_LOONGSON32) += loongson
12-
subdir-$(CONFIG_SOC_VCOREIII) += mscc
13-
subdir-$(CONFIG_MIPS_MALTA) += mti
14-
subdir-$(CONFIG_LEGACY_BOARD_SEAD3) += mti
15-
subdir-$(CONFIG_FIT_IMAGE_FDT_NI169445) += ni
16-
subdir-$(CONFIG_MACH_PIC32) += pic32
17-
subdir-$(CONFIG_ATH79) += qca
18-
subdir-$(CONFIG_RALINK) += ralink
19-
subdir-$(CONFIG_MACH_REALTEK_RTL) += realtek
20-
subdir-$(CONFIG_FIT_IMAGE_FDT_XILFPGA) += xilfpga
2+
subdir-y += brcm
3+
subdir-y += cavium-octeon
4+
subdir-y += econet
5+
subdir-y += mobileye
6+
subdir-y += img
7+
subdir-y += ingenic
8+
subdir-y += lantiq
9+
subdir-y += loongson
10+
subdir-y += mscc
11+
subdir-y += mti
12+
subdir-y += ni
13+
subdir-y += pic32
14+
subdir-y += qca
15+
subdir-y += ralink
16+
subdir-y += realtek
17+
subdir-y += xilfpga
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
dtb-y += cisco_sg220-26.dtb
3-
dtb-y += cameo-rtl9302c-2x-rtl8224-2xge.dtb
2+
dtb-$(CONFIG_MACH_REALTEK_RTL) += cisco_sg220-26.dtb
3+
dtb-$(CONFIG_MACH_REALTEK_RTL) += cameo-rtl9302c-2x-rtl8224-2xge.dtb

arch/mips/configs/loongson1_defconfig

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CONFIG_EXPERT=y
1313
CONFIG_PERF_EVENTS=y
1414
CONFIG_MACH_LOONGSON32=y
1515
# CONFIG_SUSPEND is not set
16+
CONFIG_JUMP_LABEL=y
1617
# CONFIG_SECCOMP is not set
1718
# CONFIG_GCC_PLUGINS is not set
1819
CONFIG_MODULES=y
@@ -30,16 +31,16 @@ CONFIG_IP_PNP_DHCP=y
3031
CONFIG_SYN_COOKIES=y
3132
# CONFIG_INET_DIAG is not set
3233
# CONFIG_IPV6 is not set
34+
# CONFIG_BQL is not set
3335
# CONFIG_WIRELESS is not set
34-
# CONFIG_ETHTOOL_NETLINK is not set
3536
CONFIG_DEVTMPFS=y
3637
CONFIG_DEVTMPFS_MOUNT=y
3738
# CONFIG_STANDALONE is not set
3839
CONFIG_MTD=y
3940
CONFIG_MTD_CMDLINE_PARTS=y
4041
CONFIG_MTD_BLOCK=y
4142
CONFIG_MTD_RAW_NAND=y
42-
CONFIG_MTD_NAND_LOONGSON1=y
43+
CONFIG_MTD_NAND_LOONGSON=y
4344
CONFIG_MTD_UBI=y
4445
CONFIG_BLK_DEV_LOOP=y
4546
CONFIG_SCSI=m
@@ -72,6 +73,7 @@ CONFIG_NETDEVICES=y
7273
# CONFIG_NET_VENDOR_MICROCHIP is not set
7374
# CONFIG_NET_VENDOR_MICROSEMI is not set
7475
# CONFIG_NET_VENDOR_MICROSOFT is not set
76+
# CONFIG_NET_VENDOR_MUCSE is not set
7577
# CONFIG_NET_VENDOR_NI is not set
7678
# CONFIG_NET_VENDOR_NATSEMI is not set
7779
# CONFIG_NET_VENDOR_NETRONOME is not set
@@ -166,15 +168,11 @@ CONFIG_ROOT_NFS=y
166168
CONFIG_NLS_CODEPAGE_437=m
167169
CONFIG_NLS_ISO8859_1=m
168170
# CONFIG_CRYPTO_HW is not set
169-
# CONFIG_XZ_DEC_X86 is not set
170-
# CONFIG_XZ_DEC_POWERPC is not set
171-
# CONFIG_XZ_DEC_ARM is not set
172-
# CONFIG_XZ_DEC_ARMTHUMB is not set
173-
# CONFIG_XZ_DEC_ARM64 is not set
174-
# CONFIG_XZ_DEC_SPARC is not set
175-
# CONFIG_XZ_DEC_RISCV is not set
176171
CONFIG_DYNAMIC_DEBUG=y
177172
# CONFIG_DEBUG_MISC is not set
178173
CONFIG_MAGIC_SYSRQ=y
174+
# CONFIG_SLUB_DEBUG is not set
175+
# CONFIG_RCU_TRACE is not set
179176
# CONFIG_FTRACE is not set
180177
# CONFIG_EARLY_PRINTK is not set
178+
CONFIG_TEST_DHRY=m

arch/mips/include/asm/pgalloc.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
8181
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
8282
{
8383
pud_t *pud;
84-
struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL & ~__GFP_HIGHMEM,
85-
PUD_TABLE_ORDER);
84+
struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL, PUD_TABLE_ORDER);
8685

8786
if (!ptdesc)
8887
return NULL;

arch/mips/kernel/ftrace.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,20 @@ static inline void ftrace_dyn_arch_init_insns(void)
5454
u32 *buf;
5555
unsigned int v1;
5656

57-
/* la v1, _mcount */
58-
v1 = 3;
59-
buf = (u32 *)&insn_la_mcount[0];
60-
UASM_i_LA(&buf, v1, MCOUNT_ADDR);
57+
/* If we are not in compat space, the number of generated
58+
* instructions will exceed the maximum expected limit of 2.
59+
* To prevent buffer overflow, we avoid generating them.
60+
* insn_la_mcount will not be used later in ftrace_make_call.
61+
*/
62+
if (uasm_in_compat_space_p(MCOUNT_ADDR)) {
63+
/* la v1, _mcount */
64+
v1 = 3;
65+
buf = (u32 *)&insn_la_mcount[0];
66+
UASM_i_LA(&buf, v1, MCOUNT_ADDR);
67+
} else {
68+
pr_warn("ftrace: mcount address beyond 32 bits is not supported (%lX)\n",
69+
MCOUNT_ADDR);
70+
}
6171

6272
/* jal (ftrace_caller + 8), jump over the first two instruction */
6373
buf = (u32 *)&insn_jal_ftrace_caller;
@@ -189,6 +199,13 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
189199
unsigned int new;
190200
unsigned long ip = rec->ip;
191201

202+
/* When the code to patch does not belong to the kernel code
203+
* space, we must use insn_la_mcount. However, if MCOUNT_ADDR
204+
* is not in compat space, insn_la_mcount is not usable.
205+
*/
206+
if (!core_kernel_text(ip) && !uasm_in_compat_space_p(MCOUNT_ADDR))
207+
return -EFAULT;
208+
192209
new = core_kernel_text(ip) ? insn_jal_ftrace_caller : insn_la_mcount[0];
193210

194211
#ifdef CONFIG_64BIT

0 commit comments

Comments
 (0)