Device memory access issue on sel4 user driver
Hello sel4 developers,
I am using seL4 for in our arm64 based hardware platform.
I need to write a simple driver where i need to read/write some memory
mapped registers
The device physical address is "0x40520000"
When i print the bootinfo using the below code:
/*-- filter TaskContent("untyped-start", TaskContentType.ALL,
subtask='init') -*/
printf(" CSlot \tPaddr \tSize\tType\n");
for (seL4_CPtr slot = info->untyped.start; slot != info->untyped.end;
slot++) {
seL4_UntypedDesc *desc = &info->untypedList[slot -
info->untyped.start];
printf("%8p\t%16p\t2^%d\t%s\n", (void *) slot,
(void *) desc->paddr, desc->sizeBits, desc->isDevice ? "device untyped" :
"untyped");
I get the following output:
CSlot Paddr Size Type
0x1ac 0 2^30 device untyped
0x1ad 0x40000000 2^28 device untyped
0x1ae 0x50000000 2^23 device untyped
0x1af 0x50810000 2^16 device untyped
0x1b0 0x50820000 2^17 device untyped
I am mappint the physical address to virtual and trying to access it as:
va = ps_io_map(&ops.io_mapper, (uintptr_t) 0x40520000,0x3000,
PS_MEM_NORMAL);
ZF_LOGE("Physical address 0x%x mapped to virtual address %p
\n",DEV_REG_PADDR,va);
for(int j=0;j
Hi Misbah,
"misbah" == misbah khan
writes:
misbah> I am using seL4 for in our arm64 based hardware platform. misbah> I need to write a simple driver where i need to read/write misbah> some memory mapped registers misbah> The device physical address is "0x40520000" Are you sure there are readable registers at all addresses starting there, and that they are all 4 bytes wide? What does the corresponding fragment of the DTS say? Because the mapping must be OK if you can read even the first two 4-byte values; getting a fault at 0x40520000 + 8 implies perhaps a write-only register or no register there. -- Dr Peter Chubb https://trustworthy.systems/ Trustworthy Systems Group CSE, UNSW Core hours: Mon 8am-3pm; Wed: 8am-5pm; Fri 8am-12pm.
Hi All,
I did some test with different reg.
I performed read of some reg and could see that I can read the value
correct as per the data sheet (default values)
Then I tried to write and then read back the same. It gave halt with error
as :
"Kernel entry via unknown syscall, word: 3"
Please find attached zip file with the code change, data sheet reg
reference, and the output log.
Can you suggest as what can cause this error because the data sheet says
it's read/write reg with default enable.
Regards,
Misbah
On Thu, 24 Oct 2024, 9:33 pm misbah khan,
Hello sel4 developers,
I am using seL4 for in our arm64 based hardware platform.
I need to write a simple driver where i need to read/write some memory mapped registers
The device physical address is "0x40520000"
When i print the bootinfo using the below code:
/*-- filter TaskContent("untyped-start", TaskContentType.ALL, subtask='init') -*/
printf(" CSlot \tPaddr \tSize\tType\n");
for (seL4_CPtr slot = info->untyped.start; slot != info->untyped.end; slot++) {
seL4_UntypedDesc *desc = &info->untypedList[slot - info->untyped.start];
printf("%8p\t%16p\t2^%d\t%s\n", (void *) slot, (void *) desc->paddr, desc->sizeBits, desc->isDevice ? "device untyped" : "untyped");
I get the following output:
CSlot Paddr Size Type
0x1ac 0 2^30 device untyped
0x1ad 0x40000000 2^28 device untyped
0x1ae 0x50000000 2^23 device untyped
0x1af 0x50810000 2^16 device untyped
0x1b0 0x50820000 2^17 device untyped
I am mappint the physical address to virtual and trying to access it as:
va = ps_io_map(&ops.io_mapper, (uintptr_t) 0x40520000,0x3000, PS_MEM_NORMAL);
ZF_LOGE("Physical address 0x%x mapped to virtual address %p \n",DEV_REG_PADDR,va);
for(int j=0;j
{
ZF_LOGE("Loc %d --> 0x%x ",j,*(unsigned int*)(va+j));
}
I am able to access some registers, but then it gives a fault (after printing 5-6 register values)
Similar is the behaviour with any reg between the range 0x40000000 - 0x50000000
Attaching the sample code and output: I am able to access first two address location, after that it gives halt.
Regards, Misbah
participants (2)
-
misbah khan
-
Peter Chubb