dtsi for imx8mm single core

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

dtsi for imx8mm single core

跳至解决方案
510 次查看
MB_stek
Contributor III

Hi,

we're using a imx8mm (4x Cortex A53) with Linux. So, our device tree dts includes imx8mm.dtsi (https://elixir.bootlin.com/linux/v6.11/source/arch/arm64/boot/dts/freescale/imx8mm.dtsi) which defines all four A53 cores.

Now our HW department has asked if they can simply replace the imx8mm with a single-core imx8mm (like e.g. the MIMX8MM1CVTKZAA), which are pin compatible, but have only one core. Is it safe to use the same imx8mm.dtsi? If so, will the Linux kernel simply ignore the non-existent other three cores?

Or is there maybe a dedicated .dtsi file for single core?

Or do we need to modify imx8mm.dtsi?

Kind regards,

Markus

标签 (2)
0 项奖励
回复
1 解答
426 次查看
vodix
Contributor II

The iMX's u-boot automatically modifies the Linux device tree to disable the number of cores based on the fuses of different chips.

All you need to do is solder the different chips—it's that simple.

I'm using the lf-5.10.72-2.2.3 code for this demonstration to illustrate that this code was available several years ago, around October 2022.

 
lf-5.10.72-2.2.3
 
 
This is code for iMX8MM single core. It deletes 3 core of Linux dts and leave only one.
else if (is_imx8mms() || is_imx8mmsl())
		disable_cpu_nodes(blob, 3);
 
 
#elif defined(CONFIG_IMX8MM)
if (is_imx8mml() || is_imx8mmdl() ||  is_imx8mmsl())
disable_vpu_nodes(blob);

if (is_imx8mmd() || is_imx8mmdl())
disable_cpu_nodes(blob, 2);
else if (is_imx8mms() || is_imx8mmsl())
disable_cpu_nodes(blob, 3);
 

 

在原帖中查看解决方案

0 项奖励
回复
10 回复数
427 次查看
vodix
Contributor II

The iMX's u-boot automatically modifies the Linux device tree to disable the number of cores based on the fuses of different chips.

All you need to do is solder the different chips—it's that simple.

I'm using the lf-5.10.72-2.2.3 code for this demonstration to illustrate that this code was available several years ago, around October 2022.

 
lf-5.10.72-2.2.3
 
 
This is code for iMX8MM single core. It deletes 3 core of Linux dts and leave only one.
else if (is_imx8mms() || is_imx8mmsl())
		disable_cpu_nodes(blob, 3);
 
 
#elif defined(CONFIG_IMX8MM)
if (is_imx8mml() || is_imx8mmdl() ||  is_imx8mmsl())
disable_vpu_nodes(blob);

if (is_imx8mmd() || is_imx8mmdl())
disable_cpu_nodes(blob, 2);
else if (is_imx8mms() || is_imx8mmsl())
disable_cpu_nodes(blob, 3);
 

 

0 项奖励
回复
328 次查看
MB_stek
Contributor III

Thanks for the hint with imx u-boot!

We're using mainline u-boot, but this of course helps for inspiration

Kind regards,

Markus

0 项奖励
回复
303 次查看
vodix
Contributor II

Mainline u-boot also has this code.

https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-imx/imx8m/soc.c#L1415

 #elif IS_ENABLED(CONFIG_IMX8MM)
	if (is_imx8mml() || is_imx8mmdl() ||  is_imx8mmsl())
		disable_vpu_nodes(blob);

	if (is_imx8mmd() || is_imx8mmdl())
		disable_cpu_nodes(blob, nodes_path, 2, 4);
	else if (is_imx8mms() || is_imx8mmsl())
		disable_cpu_nodes(blob, nodes_path, 3, 4);
0 项奖励
回复
311 次查看
vodix
Contributor II

This is long-standing code from the NXP iMX BSP.

However, @JorgeCas @ stated that there's no existing code for a single core. We might need to confirm this with @JorgeCas .

0 项奖励
回复
292 次查看
MB_stek
Contributor III

Ok, interesting.

So, in addition to removing the CPU nodes in the DT, one would also need to change the cooling maps node.

Kind regards,

Markus

0 项奖励
回复
485 次查看
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Leave the 4 cores device tree as it is without remove the unused/non-existent cores in 1 core device is not the best option, could cause from a simple warning to a system hang. 

We do not have a special device tree for single core device but I suggest you remove the non-existent cores in your device tree for the new part number.

Best regards. 

0 项奖励
回复
307 次查看
vodix
Contributor II

@JorgeCas @, could you please comment on your answer to confirm that the code for dynamically modifying the DTB in the NXP IMX BSP is valid and correct

0 项奖励
回复
256 次查看
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

You are right.

U-boot code will change the CPU node status to "disabled" based on CPU information mentioned in fuses.

Just make sure that source code includes this feature.

Best regards.

0 项奖励
回复
239 次查看
kawateb265
Contributor II

@JorgeCas 

disable_cpu_nodes does two things: delete the cpu node and disable the thermal nodes related to the deleted cpu node.
It is not change the CPU node status to "disabled" you mentioned.

 

rc = fdt_del_node(blob, nodeoff);

 

https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-imx/fdt.c

int disable_cpu_nodes(void *blob, const char * const *nodes_path, u32 num_disabled_cores,
		      u32 max_cores)
{
	u32 i = 0;
	int rc;
	int nodeoff;

	if (max_cores == 0 || (num_disabled_cores > (max_cores - 1)))
		return -EINVAL;

	i = max_cores - num_disabled_cores;

	for (; i < max_cores; i++) {
		nodeoff = fdt_path_offset(blob, nodes_path[i]);
		if (nodeoff < 0)
			continue; /* Not found, skip it */

		debug("Found %s node\n", nodes_path[i]);

		rc = fdt_del_node(blob, nodeoff);
		if (rc < 0) {
			printf("Unable to delete node %s, err=%s\n",
			       nodes_path[i], fdt_strerror(rc));
		} else {
			printf("Delete node %s\n", nodes_path[i]);
		}
	}

	disable_thermal_cpu_nodes(blob, num_disabled_cores, max_cores);

	return 0;
}

 

 

 

 

0 项奖励
回复
460 次查看
MB_stek
Contributor III

Thanks for the answer, Jorge!

So, we'll plan to use a dedicated device tree there, based on imx8mm.dtsi with the three missing cores removed as CPU nodes.

Kind regards,

Markus

0 项奖励
回复