Is it possible to set a hardware breakpoint on a memory write in Linux on the i.MX6ULL?

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

Is it possible to set a hardware breakpoint on a memory write in Linux on the i.MX6ULL?

753 次查看
JohnKlug
Senior Contributor I
		attr.bp_addr = (unsigned long)&mydata;
		attr.bp_len = HW_BREAKPOINT_LEN_4;
		attr.bp_type = HW_BREAKPOINT_W;
		bps = register_wide_hw_breakpoint(&attr, gpio_dump_stack, NULL);
		if(IS_ERR(bps)) {
		    pr_err("Failed to register hardware breakpoint: %ld\n",PTR_ERR(bps));
		    bps = NULL;
NULL);
		}

This prints:
Failed to register hardware breakpoint: -19

 

-19 is ENODEV.


I have the following flags added to the kernel:
CONFIG_HAVE_HW_BREAKPOINT=y
CONFIG_KPROBES=y


I am using kernel:
https://github.com/nxp-imx/linux-imx.git

With branch lf-5.15.y

0 项奖励
回复
4 回复数

725 次查看
JohnKlug
Senior Contributor I

Unfortunately the sample fails in symbol_get:



bash# modprobe databrkpt
[ 3868.245139] failing symbol_get of non-GPLONLY symbol jiffies.
modprobe: ERROR: could not insert 'databrkpt': No such device or address

I shortened the driver name to databrkpt.


This error is found in the code here:

Symbol not found error 

 

0 项奖励
回复

717 次查看
JohnKlug
Senior Contributor I
Maybe this code is obsolete that you sent?

jiffies probably is no longer a symbol.

Here is a symbol:

bash# modprobe databrkpt ksym=pm_power_off_prepare
[ 1405.440261] Failed to register hardware breakpoint: -19
[ 1405.445552] Breakpoint registration failed
modprobe: ERROR: could not insert 'databrkpt': No such device


pm_poweroff_prepare is found here:


kernel/reboot.c:EXPORT_SYMBOL_GPL(pm_power_off_prepare);

So the question remains, how does one set a hardware breakpoint? Are there kernel configuration parameters that I have not set?
0 项奖励
回复

747 次查看
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi,

Thank you for your interest in NXP Semiconductor products,

You can base the usage of HW BP in the next sample.

It should support any transaction of SDMA memory bus and the core.

Regards

0 项奖励
回复

604 次查看
JohnKlug
Senior Contributor I
We happen to have the Technexion PICO-PI-IMX8M with four cores. The driver you suggests works fine on the i.MX8 CPU on this board. So I will have to move my driver to this platform to debug it.
0 项奖励
回复