Access to Qualcomm Debug Subsystem

Hello,

I’m trying to get access to Qualcomm Debug Subsystem on my DragonBoard 410c by using the mmap. Just want to read data available in DQSS_DAPROM. However when I try to do that, the system is rebooting. Any idea why I can’t do that?

int size = 4096;
off_t addr_to_map = 0x00800000; //according to docs this is an address of QDSS_DAPROM

int mem_fd = open("/dev/mem", O_RDWR);
localv = mmap(0, size, PROT_READ, MAP_SHARED, mem_fd, addr_to_map);
printf ("mmap completed %p.\n", localv);
tab = (unsigned int *)localv;
printf ("%u\n", tab[0]);

Result of my application execution:
mmap completed 0x7fa29f0000.[ 484.585864] Synchronous External Abort: synchronous external abort (0x92000010) at 0x0000007fa29f0000

Regards
Marek

1 Like

Could you provide the full function src code (localv declaration…).
That basically works for me with mmap:
mmap completed 0xffff8f69c000.
4099

You can also check with devmem:
busybox devmem 0x00800000

This address does not sound good to me.
check your localv is a void *.

yes. It works for me too.

mmap completed 0xffffa70d5000.
4099

Like Loic suspected there should be something wrong with your variable declaration. Also, please note the register type is Read Only.

Thanks,
Mani

Here is the full code:
int main()
{
int size = 4096;
off_t addr_to_map = 0x00800000;
int mem_fd = open("/dev/mem", O_RDWR);
unsigned int *tab;
void * localv;

        if (mem_fd < 0)
        {
                printf ("Can't open /dev/mem!\n");
                return 1;
        }

        localv = mmap(0, size, PROT_READ, MAP_SHARED, mem_fd, addr_to_map);
        if (localv == MAP_FAILED)
        {
                printf ("mmap failed!\n");
                close (mem_fd);
                return 1;
        }
        printf ("mmap completed %p.\n", localv);
        tab = (unsigned int *)localv;
        printf ("xxx: %u\n", tab[1]);
        close (mem_fd);
        return 0;
}

And result of the busybox command:

root@linaro-developer:~# busybox devmem 0x00800000
[ 7942.394614] Synchronous External Abort: synchronous external abort (0x92000010) at 0x0000007fa8e3b000

Regards
Marek

This code works for me!

Can you provide us more information on your Dragonboard410c configuration?

  1. Which image are you using?
  2. Are you using custom compiled kernel?

Regards,
Mani

Linux linaro-developer 4.14.0-rc1+ #2 SMP PREEMPT Thu Sep 21 10:39:33 CEST 2017 aarch64 GNU/Linux
I turned on the CoreSight feauters. Is there any config options that requires to be on?

Regards
Marek

Issue solved. Sorry for being an idiot :wink:

echo 1 > /sys/kernel/debug/coresight_cpu_debug/enable

1 Like

Great, good to know, but don’t really understand why this solve this resister access issue.

yeah. Since you have enabled Coresight features it is mandatory to enable the debugging functionality to access the registers.

@Loic

As far as I understood, when debugging is disabled then the power domain for CoreSight feature is turned off [1] which is causing Synchronous External Abort while trying to access the CoreSight registers using mmap.

[1] https://github.com/torvalds/linux/blob/master/drivers/hwtracing/coresight/coresight-cpu-debug.c#L636

Let me know if I miss something!

Thanks,
Mani