From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jun Sun Subject: Re: boot-wrapped xen image barfs with overlapped sections Date: Tue, 20 Sep 2016 17:52:38 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0109674160347648275==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --===============0109674160347648275== Content-Type: multipart/alternative; boundary=001a114da09a33e026053cf9f63a --001a114da09a33e026053cf9f63a Content-Type: text/plain; charset=UTF-8 I finally resolved this issue after hunting around. The clue comes from this page, https://wiki.linaro.org/LEG/Engineering/Virtualization/Xen_ARM_Guide: /chosen/module@1/reg should match bootwrapper model.lds. > Basically if I increase memory region for kernel, I should also update dts file on /chosen/module@1/reg. Here is what in model.xen.lds. As you can see, kernel area is increased to 14MB. OUTPUT_FORMAT("elf64-littleaarch64") OUTPUT_ARCH(aarch64) TARGET(binary) INPUT(./boot.xen.o) INPUT(Xen) INPUT(Image) INPUT(./fdt.dtb) SECTIONS { . = 0x80000000; .text : { boot.xen.o } . = 0x80000000 + 0xfff8; mbox = .; .mbox : { QUAD(0x0) } . = 0x80000000 + 0xE00000; xen = .; .xen : { Xen } . = 0x80000000 + 0x80000; kernel = .; .kernel : { Image } . = 0x80000000 + 0x08000000; dtb = .; .dtb : { ./fdt.dtb } .data : { *(.data) } .bss : { *(.bss) } } And here is what in foundation-v8.dts for chosen: chosen { #address-cells = <0x1>; #size-cells = <0x1>; xen,xen-bootargs = "dom0_mem=512M dom0_max_vcpus=2 dtuart=serial0 conswitch=x loglvl=all guest_loglvl=all no-bootscrub"; module@1 { compatible = "xen,linux-zimage", "xen,multiboot-module"; reg = <0x80080000 0xe00000>; bootargs = "earlyprintk=pl011,0x1c090000 console=hvc0 root=/dev/vda2 debug rw"; }; }; Kernels can be any recent 4.x kernel from torvalds, stable or linaro trees. Now move to on to boot kernel with initrd. Jun On Fri, Sep 16, 2016 at 2:44 PM, Jun Sun wrote: > > Hi, all, > > I have been following the instructions at https://wiki.linaro.org/ > LEG/Engineering/Virtualization/Xen_on_ARMv8_Foundation to build xen for > arm64. > > When I tried to use the latest kernel instead of v3.13 as suggested, I > failed when building boot-wrapped image. See below. > > ======================= > jsun@ubuntu:~/work/xen/linaro-2014-guide/boot-wrapper-aarch64$ make > CROSS_COMPILE=aarch64-linux-gnu- FDT_SRC=foundation-v8.dts xen-system.axf > aarch64-linux-gnu-ld -o xen-system.axf --script=model.xen.lds > aarch64-linux-gnu-ld: section .xen loaded at [0000000080a00000,0000000080ac061f] > overlaps section .kernel loaded at [0000000080080000,0000000080c50dff] > Makefile:78: recipe for target 'xen-system.axf' failed > make: *** [xen-system.axf] Error 1 > ======================= > > Obviously the issue is that linker script gives about 8.5MB space for > kernel which is too small. If I modify the linker script to give more space > to kernel, the xen will halt during boot up right before Dom0 starts: > > ========================== > (XEN) *** LOADING DOMAIN 0 *** > (XEN) Loading kernel from boot module @ 0000000080080000 > (XEN) Allocating 1:1 mappings totalling 512MB for dom0: > (XEN) BANK[0] 0x000000a0000000-0x000000c0000000 (512MB) > (XEN) Grant table range: 0x000000ffe00000-0x000000ffe5e000 > (XEN) Loading zImage from 0000000080080000 to 00000000a0080000- > 00000000a0880000 > (XEN) Allocating PPI 16 for event channel interrupt > (XEN) Loading dom0 DTB to 0x00000000a8000000-0x00000000a8000fe7 > (XEN) Std. Loglevel: All > (XEN) Guest Loglevel: All > (XEN) *** Serial input -> DOM0 (type 'CTRL-x' three times to switch input > to Xen) > (XEN) Freed 276kB init memory. > ========================== > > Any pointers on the right way to get modern kernel working with xen on > ARM64? > > Thanks. > > Jun > --001a114da09a33e026053cf9f63a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I finally resolved this issue after hunting around.=C2=A0 = The clue comes from this page,=C2=A0https://wiki.linaro.org/LEG/Engin= eering/Virtualization/Xen_ARM_Guide:

/chosen/module@1/reg should match bootwrapper= model.lds.

Basically if I increase mem= ory region for kernel, I should also update dts file on =C2=A0/chosen/modul= e@1/reg.

Here is what in model.xen.lds.=C2=A0 As y= ou can see, kernel area is increased to 14MB. =C2=A0

OUTPUT_FORMAT("elf64-littleaarch64")
OUTPUT_ARC= H(aarch64)
TARGET(binary)
INPUT(./boot.xen.o)
INPUT(Xen)
INPUT(Image)
INPUT(./fdt.dtb)
SEC= TIONS
{
=C2=A0. =3D 0x80000000;
=C2=A0.text := { boot.xen.o }
=C2=A0. =3D 0x80000000 + 0xfff8;
=C2=A0= mbox =3D .;
=C2=A0.mbox : { QUAD(0x0) }
=C2=A0. =3D 0x8= 0000000 + 0xE00000;
=C2=A0xen =3D .;
=C2=A0.xen : { Xen= }
=C2=A0. =3D 0x80000000 + 0x80000;
=C2=A0kernel =3D .= ;
=C2=A0.kernel : { Image }
=C2=A0. =3D 0x80000000 + 0x= 08000000;
=C2=A0dtb =3D .;
=C2=A0.dtb : { ./fdt.dtb }
=C2=A0.data : { *(.data) }
=C2=A0.bss : { *(.bss) }
}

And here is what in foundation-v8.dt= s for chosen:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 cho= sen {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #ad= dress-cells =3D <0x1>;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 #size-cells =3D <0x1>;
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 xen,xen-bootargs =3D "dom0_m= em=3D512M dom0_max_vcpus=3D2 dtuart=3Dserial0 conswitch=3Dx loglvl=3Dall gu= est_loglvl=3Dall no-bootscrub";

=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 module@1 {
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 c= ompatible =3D "xen,linux-zimage", "xen,multiboot-module"= ;;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 reg =3D <0x80080000 0xe00000>;
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 bootargs =3D "earlyprintk=3Dpl011,0x1c090000 console=3Dhvc0 root= =3D/dev/vda2 debug rw";
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 };
=C2=A0 =C2=A0 =C2=A0 =C2=A0 };

Kernels can be any recent 4.x kernel from torvalds, st= able or linaro trees.

Now move to on to boot kerne= l with initrd.

Jun

On Fri, Sep 16, 2016 at 2:44 PM, Jun = Sun <jsun@junsun.net> wrote:

Hi, all,

I h= ave been following the instructions at=C2=A0https://wiki.linaro.org/LEG/Engineering/Virtualization/Xen_on_= ARMv8_Foundation to build xen for arm64.

= When I tried to use the latest kernel instead of v3.13 as suggested, I fail= ed when building boot-wrapped image.=C2=A0 See below.

<= div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
jsun@ubuntu:~/work/xen/linaro-2014-guide/boot-wrapper-aa= rch64$ make CROSS_COMPILE=3Daarch64-linux-gnu- FDT_SRC=3Dfoundation-v8= .dts xen-system.axf
aarch64-linux-gnu-ld -o xen-system.axf --scri= pt=3Dmodel.xen.lds
aarch64-linux-gnu-ld: section .xen loaded at [= 0000000080a00000,0000000080ac061f] overlaps section .kernel loaded at = [0000000080080000,0000000080c50dff]
Makefile:78: recipe for = target 'xen-system.axf' failed
make: *** [xen-system.axf]= Error 1
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D

Obviously the issue is that linker= script gives about 8.5MB space for kernel which is too small. If I modify = the linker script to give more space to kernel, the xen will halt during bo= ot up right before Dom0 starts:

=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
(XEN) *** LOADING DOMAIN 0 ***
(XEN) Loading kernel from boot mo= dule @ 0000000080080000
(XEN) Allocating 1:1 mappings totalling 5= 12MB for dom0:
(XEN) BANK[0] 0x000000a0000000-0x000000c00000= 00 (512MB)
(XEN) Grant table range: 0x000000ffe00000-0x00000= 0ffe5e000
(XEN) Loading zImage from 0000000080080000 to 00000000a= 0080000-00000000a0880000
(XEN) Allocating PPI 16 for event c= hannel interrupt
(XEN) Loading dom0 DTB to 0x00000000a8000000-0x00000000a8000fe7
(XEN) Std. Loglevel: All
(XEN) Gue= st Loglevel: All
(XEN) *** Serial input -> DOM0 (type 'CTR= L-x' three times to switch input to Xen)
(XEN) Freed 276kB in= it memory.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Any pointers on the= right way to get modern kernel working with xen on ARM64?

Thanks.
<= br>
Jun

--001a114da09a33e026053cf9f63a-- --===============0109674160347648275== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============0109674160347648275==--