<div dir="ltr">Hi,<div>I just created the ticket (#3322) with the patch in attachment.  Let's hope I filled the ticket with enough information.</div><div><br></div><div>If there is anything else you need let me know.</div><div><br></div><div>Eric</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 6, 2018 at 12:36 PM, Gedare Bloom <span dir="ltr"><<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Éric<br>
<br>
It would be preferable if you could create the ticket, so we have the<br>
right "reporter" in mind later.<br>
<br>
Gedare<br>
<br>
On Tue, Mar 6, 2018 at 12:25 PM, Éric Tremblay<br>
<<a href="mailto:e.tremblay@axis-canada.com">e.tremblay@axis-canada.com</a>> wrote:<br>
> Hi Gedare, Joel,<br>
> Unfortunately I do not have access to hw so I cannot test in this<br>
> environment.<br>
><br>
> Do you want me to create the ticket or one of you will take care of it?<br>
><br>
> Thanks,<br>
> Eric<br>
><br>
> On Tue, Mar 6, 2018 at 12:02 PM, Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br>
>><br>
>> On Mon, Mar 5, 2018 at 5:37 PM, Joel Sherrill <<a href="mailto:joel@rtems.org">joel@rtems.org</a>> wrote:<br>
>> > Can you file a ticket with the patch attached? We don't change things on<br>
>> > a<br>
>> > release<br>
>> > branch without a ticket? <a href="http://devel.rtems.org" rel="noreferrer" target="_blank">devel.rtems.org</a><br>
>> ><br>
>> +1<br>
>><br>
>> > Are you able to test this on real hardware? It touches files in shared<br>
>> > which<br>
>> > will<br>
>> > be used by multiple powerpc BSPs so it would be good to have feedback on<br>
>> > real HW.<br>
>> ><br>
>> +2<br>
>><br>
>> This should be verified on hw before applying especially to a release.<br>
>><br>
>> If it affects hw, also change the comments to just say "greater than<br>
>> 256 MiB" without specifying qemu -m option.<br>
>><br>
>> > FWIW we are trying to wrap up a set of patches for a 4.11 release and it<br>
>> > would<br>
>> > be good to have this in the ticket queue for consideration.<br>
>> ><br>
>> > Thanks.<br>
>> ><br>
>> > --joel<br>
>> ><br>
>> ><br>
>> > On Mon, Mar 5, 2018 at 2:31 PM, Éric Tremblay<br>
>> > <<a href="mailto:e.tremblay@axis-canada.com">e.tremblay@axis-canada.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Hi,<br>
>> >> I posted a question last week about a strange behavior I was getting<br>
>> >> using<br>
>> >> RTEMS with qemu-system-ppc.  Anytime I was specifying more than 256Mb<br>
>> >> of<br>
>> >> memory using the -m option the RTEMS kernel was not booting.  Here is<br>
>> >> an<br>
>> >> example of command line I was using:<br>
>> >><br>
>> >> qemu-system-ppc  -M prep -kernel ./hello.ralf  -bios<br>
>> >> /home/qemu_fakerom/qemu_<wbr>fakerom.bin -cpu 750cxe -nographic -no-reboot<br>
>> >> -m 384<br>
>> >><br>
>> >> Model:<br>
>> >> Serial:<br>
>> >> Processor/Bus frequencies (Hz): 300000000/100000000<br>
>> >> Time Base Divisor: 1000<br>
>> >> Memory Size: 18000000<br>
>> >> Residual: 102afd4 (length 27148)<br>
>> >><br>
>> >> PCI: Probing PCI hardware<br>
>> >><br>
>> >> RTEMS 4.x/PPC load:<br>
>> >> Uncompressing the kernel...<br>
>> >> Kernel at 0x00000000, size=0x495b0<br>
>> >> Initrd at 0x00000000, size=0x0<br>
>> >> Residual data at 0x0004a000<br>
>> >> Command line at 0x00051000<br>
>> >> done<br>
>> >> Now booting...                                 <<<<<<<<<<<<<<<<<br>
>> >> execution<br>
>> >> stuck here<br>
>> >><br>
>> >><br>
>> >> I have spent quite some time debugging this issue and I traced it back<br>
>> >> to<br>
>> >> two issues for which I am submitting a patch.  Please understand this<br>
>> >> is my<br>
>> >> first time using RTEMS and debugging a bootloader so my patch might not<br>
>> >> be<br>
>> >> accurate but it does fix the behavior I mentioned above.  With this<br>
>> >> patch I<br>
>> >> can successfully launch a "Hello World" and specify more memory (-m 512<br>
>> >> for<br>
>> >> example).<br>
>> >><br>
>> >> My patch is quite simple since it simply allows the system to access<br>
>> >> section of memory.  Please let me know if this is a suitable<br>
>> >> correction, if<br>
>> >> this is totally wrong I would like to know how this could be fixed<br>
>> >> since our<br>
>> >> application will use around 512Mb of memory and the current state of<br>
>> >> things<br>
>> >> won't work.<br>
>> >><br>
>> >> Thank you for your cooperation,<br>
>> >> Eric<br>
>> >><br>
>> >> PS: I am using RTEMS release 4.11.3.<br>
>> >>        I am using Qemu v 2.5.0<br>
>> >>        I am running in a Linux Ubuntu VM (intel 64 bits)<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >>  c/src/lib/libbsp/powerpc/<wbr>shared/start/start.S      | 18<br>
>> >> ++++++++++++++++++<br>
>> >>  c/src/lib/libbsp/powerpc/<wbr>shared/startup/bspstart.c | 18<br>
>> >> ++++++++++++++++++<br>
>> >>  2 files changed, 36 insertions(+)<br>
>> >><br>
>> >> diff --git a/c/src/lib/libbsp/powerpc/<wbr>shared/start/start.S<br>
>> >> b/c/src/lib/libbsp/powerpc/<wbr>shared/start/start.S<br>
>> >> index 729c89c40b..532c1f9ee4 100644<br>
>> >> --- a/c/src/lib/libbsp/powerpc/<wbr>shared/start/start.S<br>
>> >> +++ b/c/src/lib/libbsp/powerpc/<wbr>shared/start/start.S<br>
>> >> @@ -93,6 +93,24 @@ __rtems_entry_point:<br>
>> >>   mtspr IBAT0L,r8<br>
>> >>   mtspr IBAT0U,r11<br>
>> >>   isync<br>
>> >> +/*   Map section where residual is located if outside<br>
>> >> + *   the first 256Mb of RAM.  This is to support cases<br>
>> >> + *   where the user supplies the -m option with Qemu<br>
>> >> + *   in order to have more memory available to the system.<br>
>> >> + */<br>
>> >> + mr r9, r1    /* Get where residual was mapped */<br>
>> >> + lis r12,0xf0000000@h<br>
>> >> + and r9,r9,r12<br>
>> >> + cmpi 0,1,r9, 0<br>
>> >> + beq skip_BAT1_config<br>
>> >> + isync<br>
>> >> + ori r11,r9,0x1ffe<br>
>> >> + mtspr DBAT1L,r8 /* N.B. 6xx (not 601) have valid */<br>
>> >> + mtspr DBAT1U,r11 /* bit in upper BAT register */<br>
>> >> + mtspr IBAT1L,r8<br>
>> >> + mtspr IBAT1U,r11<br>
>> >> + isync<br>
>> >> +skip_BAT1_config:<br>
>> >><br>
>> >>  /*<br>
>> >>   * we now have the 1st 256M of ram mapped with the bats. We are still<br>
>> >> diff --git a/c/src/lib/libbsp/powerpc/<wbr>shared/startup/bspstart.c<br>
>> >> b/c/src/lib/libbsp/powerpc/<wbr>shared/startup/bspstart.c<br>
>> >> index 5a97cc8531..f80835b117 100644<br>
>> >> --- a/c/src/lib/libbsp/powerpc/<wbr>shared/startup/bspstart.c<br>
>> >> +++ b/c/src/lib/libbsp/powerpc/<wbr>shared/startup/bspstart.c<br>
>> >> @@ -300,6 +300,24 @@ void bsp_start( void )<br>
>> >>     */<br>
>> >>    _BSP_clear_hostbridge_errors(0 /* enableMCP */, 0/*quiet*/);<br>
>> >><br>
>> >> +   if (BSP_mem_size > 0x10000000)<br>
>> >> +   {<br>
>> >> +   /* Support cases with qemu supplied -m option and mem size larger<br>
>> >> than<br>
>> >> 256Mb.<br>
>> >> +    *<br>
>> >> +    * We use BAT3 in order to obtain access to the top section of the<br>
>> >> RAM.<br>
>> >> +    * We also need to do this just before setting up the page table<br>
>> >> because<br>
>> >> +    * this is where the page table will be located.<br>
>> >> +    */<br>
>> >> +   const unsigned int mem256Count = (BSP_mem_size / 0x10000000);<br>
>> >> +   const unsigned int BAT3Addr    = ((BSP_mem_size % 0x10000000)    ?<br>
>> >> + (mem256Count     * 0x10000000) :<br>
>> >> + ((mem256Count-1) * 0x10000000));<br>
>> >> +      setdbat(3, BAT3Addr, BAT3Addr, 0x10000000, IO_PAGE);<br>
>> >> +#ifdef SHOW_MORE_INIT_SETTINGS<br>
>> >> +      printk("Setting up BAT3 for large memory support. (BAT3 --><br>
>> >> 0x%x)\n", BAT3Addr);<br>
>> >> +#endif<br>
>> >> +   }<br>
>> >> +<br>
>> >>    /* Allocate and set up the page table mappings<br>
>> >>     * This is only available on >604 CPUs.<br>
>> >>     *<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >> ______________________________<wbr>_________________<br>
>> >> devel mailing list<br>
>> >> <a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
>> >> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/devel</a><br>
>> ><br>
>> ><br>
>> ><br>
>> > ______________________________<wbr>_________________<br>
>> > devel mailing list<br>
>> > <a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
>> > <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/devel</a><br>
><br>
><br>
</blockquote></div><br></div>