UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor alibarzegar
Visitor
9,256 Views
Registered: ‎04-07-2012

limiting DDR in devicetree does not apply when linux booted (in ZYNQ)

Jump to solution

Hey Guys,

 

I have a system that PS and PL have both access to DDR on zynq zed board. PS is running ubunutu and there is an DMA in PL that writes into DDR. Once the DMA starts to write into DDR, OS crashes! It's obviouse, I have to limit DDR so the linux does not see that address space.

 

As you know zedboard has 512MB DDR. So,I changed the device tree so the kernel only sees only 256MB as below:

 

    memory {
        device_type = "memory";
        reg = <0x0 0x10000000>;
    };

 

However, when the linux brings up and I type the command "cat /proc/iomem" and I see this:

00000000-1fffffff : System RAM
  00008000-00635ac7 : Kernel code
  0066c000-006df5f7 : Kernel data
e0001000-e0001ffe : xuartps
e0002000-e0002fff : /amba/usb@e0002000
  e0002000-e0002fff : /amba/usb@e0002000
e000a000-e000afff : /amba/gpio@e000a000

 

It seems changing devicetree does not have any effect on limiting DDR! I also run DMA, and the system crashes. Again it's obviouse, OS is using DDR!

 

I searched everywhever in the linux kernel configuration and I couldn't find the place that I can limit the DDR.

 

My question is, where can I limit DDR? should I change something in the bitstream, bootloader or what?

 

Thank you in advance,

 

0 Kudos
1 Solution

Accepted Solutions
Visitor alibarzegar
Visitor
15,337 Views
Registered: ‎04-07-2012

Re: limiting DDR in devicetree does not apply when linux booted (in ZYNQ)

Jump to solution
Finally I could figured out the problem! the "zynq_zed.h" file in uboot repository should be set to desired value

View solution in original post

0 Kudos
6 Replies
Xilinx Employee
Xilinx Employee
9,251 Views
Registered: ‎09-10-2008

Re: limiting DDR in devicetree does not apply when linux booted (in ZYNQ)

Jump to solution
Hi,

You didn't say what version of the kernel you are running. I have not seen what you are experiencing and have altered the memory in the device tree fine, but maybe you are seeing something new.

Can you check the device tree memory node from the command line of the running kernel to make sure it really got built with the kernel (/proc/device-tree)?

You can also limit memory on the kernel command line from the device tree or altering bootargs in u-boot with MEM=256M.

Thanks
John
0 Kudos
Visitor alibarzegar
Visitor
9,235 Views
Registered: ‎04-07-2012

Re: limiting DDR in devicetree does not apply when linux booted (in ZYNQ)

Jump to solution

Thank you for your quick reply. Actually it is strange for me too! I don't know how it's altered!

 

First I'm sure that I built the device tree correctly, because I took out devicetree.dtb file and generated the dts file from the dtb file from script in xilinx-linux repository, and when I checked it the DDR was limited there.

 

The kernel version I'm using is "3.18.0-xilinx-06188-gc31fb6b"

 

I also appended MEM=256M in my bootrage like this:

bootargs = "console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait devtmpfs.mount=0 MEM=256M"; 

again no luck! still when system RAM is 00000000-1fffffff.

 

In my proc/device-tree folder I have these file: #address-cells, #size-cell, compatible, name; and these folders: aliases,amba,chosen,cpues,fixdregulator@0,memory, and pmu... in " proc/device-tree/memory" folder I have these files: device_type, name, and reg..... the reg file contains: \00\00\00\00 \00\00\00

 

Untitled.png

 

I'm skeptical about the bitsream that might overright the devicetree memory value, but haven't figured it yet

 

0 Kudos
Xilinx Employee
Xilinx Employee
9,215 Views
Registered: ‎03-13-2012

Re: limiting DDR in devicetree does not apply when linux booted (in ZYNQ)

Jump to solution

Did you check /proc/device-tree for what memory size is actually passed to the kernel?

I think there were some circumstances under which U-Boot updates the DDR size. But I don't know the details.

0 Kudos
Visitor alibarzegar
Visitor
9,210 Views
Registered: ‎04-07-2012

Re: limiting DDR in devicetree does not apply when linux booted (in ZYNQ)

Jump to solution
I'm not expert in Linux, I'm sorry can I ask how I can check the memory size that is passed to kernel?
The other think I did, in creating FSBL application, I changed the "#define XPAR_PS7_DDR_0_S_AXI_HIGHADDR" from 0x1FFFFFFF to 0x0FFFFFFF in xparameters.h and recompiled the FSBL and regenerated the BOOT.bin but it didn't work either.
0 Kudos
Visitor alibarzegar
Visitor
9,171 Views
Registered: ‎04-07-2012

Re: limiting DDR in devicetree does not apply when linux booted (in ZYNQ)

Jump to solution

I want to add to my previous reply, here is what is printed in uart when linux starts up:

 

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 3.18.0-xilinx-06188-gc31fb6b-dirty (gcc version 4.7.3 (U               buntu/Linaro 4.7.3-12ubuntu1) ) #4 SMP PREEMPT 
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: xlnx,zynq-7000
cma: Reserved 16 MiB at 0x1f000000
Memory policy: Data cache writealloc
PERCPU: Embedded 10 pages/cpu @9ebd2000 s8768 r8192 d24000 u40960
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
Kernel command line: console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ex               t4 rootwait devtmpfs.mount=0 MEM=256M
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 496188K/524288K available (4714K kernel code, 242K rwdata, 1612K rodata, 216K init,                219K bss, 28100K reserved, 0K highmem)

 Anybody has any idea where these Memory values comming from?

0 Kudos
Visitor alibarzegar
Visitor
15,338 Views
Registered: ‎04-07-2012

Re: limiting DDR in devicetree does not apply when linux booted (in ZYNQ)

Jump to solution
Finally I could figured out the problem! the "zynq_zed.h" file in uboot repository should be set to desired value

View solution in original post

0 Kudos