IRC logs for #openrisc Monday, 2017-04-10

--- Log opened Mon Apr 10 00:00:23 2017
shornemithro: not much other than looking at them in memory? or looking at the tlb01:58
shornesorry, I never had to debug something there yet01:58
mithroshorne: No worries01:58
mithroshorne_: I have working uart! http://paste.debian.net/926916/15:40
mithroshorne_: There is something foobared with the memory management15:40
mithroThe zone_sizes_init function is trashing the page cache15:41
mithroI'm pretty sure it has something to do with pfn's and max_low_pfn15:42
shorne_mithro: ah, did you get the self modifying code to work?22:03
mithroshorne_: Yeah22:03
mithroshorne_: Although I'm confused at the correct way to generate the j instruction22:04
shorne_`are these getting set correctly?22:04
shorne_        ram_start_pfn = PFN_UP(memory_start);22:04
shorne_        ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM());22:04
shorne_memory_start should be what is in your devicetree22:05
mithroI'm not sure what "correct" is?22:05
shorne_i.e. memory_start I think should be 0x4000000022:05
shorne_pulled from device tree22:05
shorne_memblock_end_of_DRAM should be 0x40000000 + size of dram (also pulled from device tree)..22:06
shorne_        memory {22:06
shorne_                device_type = "memory";22:06
shorne_                reg = <0x40000000 268435456>;22:06
shorne_};22:06
mithrosetup_memory: Memory: 0x40000000-0x4400000022:06
mithroSetting up paging and PTEs.22:06
mithromap_ram: Memory: 0x40000000-0x4400000022:06
shorne_during early init those ar scanned and set in memblock22:07
shorne_yeah, so should be ok22:07
shorne_PFN_UP and PFN_DOWN just set them as Page frame numbers22:07
shorne_rounding up, or down to nearest22:08
shorne_       /* setup bootmem globals (we use no_bootmem, but mm still depends on this) */22:08
shorne_        min_low_pfn = ram_start_pfn;22:08
shorne_        max_pfn = ram_end_pfn;22:08
shorne_        max_low_pfn = ram_end_pfn;22:08
shorne_Oh, correct way to generate the j instruction...22:08
mithroWhat should be the PFN the first memory position?22:09
mithro-- l.j instruction is opcode 0 and does a PC ←  exts(Immediate << 2) + JumpInsnAddr22:10
mithrohttps://github.com/mithro/linux/blob/master/arch/openrisc/mm/init.c#L158-L20322:11
shorne_well, for you it would be 0x40000000 > PAGE_SHIFT22:11
shorne_why are you doing << 2?22:15
shorne_shouldn't it be >> 2?22:15
shorne_sorry, reading wrong part22:16
mithroboot_itlb_miss_handler is trying to convert a l.j instruction back to a memory address22:16
shorne_right,22:16
shorne_right here22:18
shorne_unsigned long pa_itlb_miss_handler = __pa(&itlb_miss_handler);22:18
shorne_you want to get the physical address of the real handler22:18
mithro * IE pa(miss_handler)-pa(vector) == va(miss_handler)-va(vector)  ?22:19
shorne_defined in arch/openrisc/include/asm/page.h22:19
shorne___pq and __va, maybe its better to put the PHYSICAL_START thing in there?22:20
mithroshorne_: I plan to just use the EVAR value22:21
shorne_I see... you already did update __va() and __pa() in include the physical_offset22:23
mithrounsigned long *boot_itlb_miss_handler = ((*itlb_vector) << 2) + ((unsigned long)itlb_vector);22:26
mithroThat calculates the right address22:26
mithroSo to do the opposite22:26
mithro(((unsigned long)boot_itlb_miss_handler) - (unsigned long)itlb_vector) >> 2;22:28
mithroRight?22:28
shorne_so, give me a minute22:38
mithroNo worries22:44
shorne_this, looks right *boot_itlb_miss_handler = ((*itlb_vector) << 2) + ((unsigned long)itlb_vector);22:48
shorne_but thats not what I see on the link22:48
mithroshorne_: Yeah - I just fixed it then22:48
shorne_but... this looks correct22:49
shorne_*itlb_vector = (((unsigned long)&itlb_miss_handler) -22:49
shorne_(unsigned long)itlb_vector) >> 2;22:49
mithrohttps://gist.github.com/mithro/6a95b5506367463af1685f3c13c725af22:49
mithroshorne_: Yeah - the output in dmesg looks correct and it seems to be working22:50
shorne_since its all vritual22:50
mithroshorne_: I had a play at patching BNF and BF at https://gist.github.com/mithro/6a95b5506367463af1685f3c13c725af23:07
shorne_thats easier to read then what is there in the kernel23:13
shorne_it looks good, do you need it for anything?23:14
mithroshorne_: Not really23:19
mithroshorne_: BTW - Using watchpoints was a really good idea23:43
mithrohttp://paste.debian.net/926962/23:43
mithroI put a watchpoint on the page table address where I'm getting clobberred23:43
shorne_cool23:45
shorne_what is lx-dmesg defined as?23:45
mithroshorne_: Now I need to figure out why this is clobbering the value....23:46
shorne_thats pretty handy23:46
shorne_is that built into gdb?23:46
mithroshorne_: It's part of linux23:47
mithrogdb has python scripting support23:47
mithrohttps://github.com/mithro/linux/tree/master/scripts/gdb23:47
mithroIt would be nice if they had some page table stuff in there23:48
shorne_I never have seen this gdb helper script... I knew about scripting and I was doing some things myself23:49
shorne_this is better !23:49
shorne_I have been debugging with a serial console23:58
--- Log closed Tue Apr 11 00:00:25 2017

Generated by irclog2html.py 2.15.2 by Marius Gedminas - find it at mg.pov.lt!