diff mbox

[v1] Livepatch ARM 64 implementation

Message ID 20160815154900.GA5296@localhost.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk Aug. 15, 2016, 3:49 p.m. UTC
On Mon, Aug 15, 2016 at 04:52:58PM +0200, Julien Grall wrote:
> 
> 
> On 15/08/2016 01:07, Konrad Rzeszutek Wilk wrote:
> > Hey!
> 
> Hi Konrad,
> 
> > This is the first (non RFC) posting of the enablement of Livepatch under ARM64.
> > 
> > The patches are based on: [PATCH v3] Livepatch fixes and features for v4.8.
> > (https://lists.xen.org/archives/html/xen-devel/2016-08/msg01825.html)
> > 
> > And the git tree is:
> >  git://xenbits.xen.org/people/konradwilk/xen.git livepatch.v4.8.v3
> > 
> > I've only tested this under Foundation Platform with only one CPU working
> > (the other CPUs wouldn't boot up for some reason) and without a proper working
> > disk image (can't recall why, but it did have an initramfs) - I ended
> > up building the hypervisor with the livepatch built in and loading it during
> > dom0 execution (via timers), see
> > (http://xenbits.xen.org/gitweb/?p=people/konradwilk/xen.git;a=commit;h=39517b2b807025d0d63d4f042ada5eb3de32ff45)
> > [That patch is not part of this patchset of course]
> 
> I am able to use both SMP and the rootfs on the foundation model. What is
> hte command line you are using? How about the device tree?

~/ARM/Foundation_Platformpkg/models/Linux64_GCC-4.7/Foundation_Platform --image ~/ARM/boot-wrapper-aarch64.git/xen-system.axf 

And the boot-wrapper-aarch64.git does:
aarch64 <konrad@localhost:~/ARM/boot-wrapper-aarch64.git> git log
--oneline | head -1
b564cbf Fix build when USE_INITRD not set
aarch64 <konrad@localhost:~/ARM/boot-wrapper-aarch64.git> make xen-system.axf
aarch64-linux-gnu-gcc  -DCNTFRQ=0x01800000	 -DUART_BASE=0x1c090000 -DLED=0x0008 -DSYSREGS_BASE=0x1c010000 -DGIC_DIST_BASE=0x2c001000 -DGIC_CPU_BASE=0x2c002000 -c -o boot.xen.o boot.S -DXEN
aarch64-linux-gnu-gcc  -DPHYS_OFFSET=0x80000000 -DMBOX_OFFSET=0xfff8 -DBOOT=boot.xen.o -DXEN_OFFSET=0xA00000 -DKERNEL_OFFSET=0x80000 -DFDT_OFFSET=0x08000000 -DFS_OFFSET=0x10000000 -DXEN=Xen -DKERNEL=Image -DFILESYSTEM=filesystem.cpio.gz -E -P -C -o model.xen.lds model.lds.S

And it looks I tried at some point to play with the LEDs (not very well)


> Cheers,
> 
> -- 
> Julien Grall
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 241091f..dd50f09 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@  SYSREGS_BASE	:= 0x1c010000
 GIC_DIST_BASE	:= 0x2c001000
 GIC_CPU_BASE	:= 0x2c002000
 CNTFRQ		:= 0x01800000	# 24Mhz
-
+LED		:= 0x0008
 #INITRD_FLAGS	:= -DUSE_INITRD
 CPPFLAGS	+= $(INITRD_FLAGS)
 
@@ -78,13 +78,13 @@  $(XIMAGE): boot.xen.o model.xen.lds fdt.dtb $(XEN) $(KERNEL) $(FILESYSTEM)
 	$(LD) -o $@ --script=model.xen.lds
 
 boot.o: $(BOOTLOADER) Makefile
-	$(CC) $(CPPFLAGS) -DCNTFRQ=$(CNTFRQ) -DUART_BASE=$(UART_BASE) -DSYSREGS_BASE=$(SYSREGS_BASE) -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DGIC_CPU_BASE=$(GIC_CPU_BASE) -c -o $@ $(BOOTLOADER)
+	$(CC) $(CPPFLAGS) -DCNTFRQ=$(CNTFRQ) -DUART_BASE=$(UART_BASE) -DLED=$(LED) -DSYSREGS_BASE=$(SYSREGS_BASE) -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DGIC_CPU_BASE=$(GIC_CPU_BASE) -c -o $@ $(BOOTLOADER)
 
 model.lds: $(LD_SCRIPT) Makefile
 	$(CC) $(CPPFLAGS) -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DBOOT=boot.o -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) -DKERNEL=$(KERNEL) -DFILESYSTEM=$(FILESYSTEM) -E -P -C -o $@ $<
 
 boot.xen.o: $(BOOTLOADER) Makefile
-	$(CC) $(CPPFLAGS) -DCNTFRQ=$(CNTFRQ) -DUART_BASE=$(UART_BASE) -DSYSREGS_BASE=$(SYSREGS_BASE) -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DGIC_CPU_BASE=$(GIC_CPU_BASE) -c -o $@ $(BOOTLOADER) -DXEN
+	$(CC) $(CPPFLAGS) -DCNTFRQ=$(CNTFRQ) -DUART_BASE=$(UART_BASE) -DLED=$(LED) -DSYSREGS_BASE=$(SYSREGS_BASE) -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DGIC_CPU_BASE=$(GIC_CPU_BASE) -c -o $@ $(BOOTLOADER) -DXEN
 
 model.xen.lds: $(LD_SCRIPT) Makefile
 	$(CC) $(CPPFLAGS) -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DBOOT=boot.xen.o -DXEN_OFFSET=$(XEN_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) -DXEN=$(XEN) -DKERNEL=$(KERNEL) -DFILESYSTEM=$(FILESYSTEM) -E -P -C -o $@ $<
diff --git a/boot.S b/boot.S
index 3e2cecd..60b642c 100644
--- a/boot.S
+++ b/boot.S
@@ -107,6 +107,13 @@  start_ns:
 	str	wzr, [x4, #0xa0]		// V2M_SYS_CFGDATA
 	str	w5, [x4, #0xa4]			// V2M_SYS_CFGCTRL
 
+	ldr	x4, =LED
+	mov	w5, #0xFF
+	str	w5, [x4]
+
+	mov	x4, #0x00A4
+	mov	w5, #0xC0800000	
+	str	w5, [x4]
 	/*
 	 * Primary CPU
 	 */

Anyhow the more important is the DTS:

total 248784
drwxrwxr-x.  3 konrad konrad     4096 Aug 15 11:46 .
drwxrwxr-x. 11 konrad konrad     4096 Aug 15 11:40 ..
-rw-rw-r--.  1 konrad konrad 90957497 Apr 15 15:50 64
-rw-rw-r--.  1 konrad konrad 90571528 Apr 15 15:49 a
-rw-rw-r--.  1 konrad konrad     2388 Apr 15 22:54 boot.S
-rw-rw-r--.  1 konrad konrad     1544 Aug 15 11:46 boot.xen.o
lrwxrwxrwx.  1 konrad konrad       41 Apr 15 14:17 fdt.dtb -> ../arm-dts/fast_models/rtsm_ve-aemv8a.dtb
drwxrwxr-x.  8 konrad konrad     4096 Apr 15 14:17 .git
-rw-rw-r--.  1 konrad konrad       44 Apr 15 14:17 .gitignore
lrwxrwxrwx.  1 konrad konrad       10 Apr 15 14:24 Image -> ../vmlinuz
-rw-rw-r--.  1 konrad konrad     1508 Apr 15 14:17 LICENSE.txt
-rw-rw-r--.  1 konrad konrad     3701 Apr 15 22:53 Makefile
-rw-rw-r--.  1 konrad konrad      935 Apr 15 14:17 model.lds.S
-rw-rw-r--.  1 konrad konrad     2457 Aug 15 11:46 model.xen.lds
-rw-rw-r--.  1 konrad konrad      667 Apr 15 14:17 README
lrwxrwxrwx.  1 konrad konrad       41 Apr 15 15:26 rtsm_ve-aemv8a.dts -> ../arm-dts/fast_models/rtsm_ve-aemv8a.dts
-rw-rw-r--.  1 konrad konrad     6007 Apr 15 15:28 rtsm_ve-motherboard.dtsi
lrwxrwxrwx.  1 konrad konrad       14 Apr 22 15:19 Xen -> ../xen/xen/xen
-rwxrwxr-x.  1 konrad konrad   853552 Apr 15 15:40 xen64
-rwxrwxr-x.  1 konrad konrad   853552 Apr 15 23:12 Xen.ok
lrwxrwxrwx.  1 konrad konrad       24 Apr 15 21:55 Xen.old -> /home/konrad/xen/xen/xen
-rwxrwxr-x.  1 konrad konrad  6761469 Aug 15 11:46 xen-system.axf
-rw-rw-r--.  1 konrad konrad 64854103 Apr 15 15:46 z

aarch64 <konrad@localhost:~/ARM/arm-dts> git log --oneline | head -1
cbfbe3d versatile_express: Update to 3.19 state

With this change:

diff --git a/fast_models/rtsm_ve-aemv8a.dts b/fast_models/rtsm_ve-aemv8a.dts
index 50b544d..6c6240c 100644
--- a/fast_models/rtsm_ve-aemv8a.dts
+++ b/fast_models/rtsm_ve-aemv8a.dts
@@ -18,7 +18,17 @@ 
 	#address-cells = <2>;
 	#size-cells = <2>;
 
-	chosen { };
+	chosen {
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		xen,xen-bootargs = "dtuart=serial0 loglvl=all guesd_loglvl=all dom0_mem=512M,max:512";
+		module@1 {
+			compatible = "xen,linux-zimage", "xen,multiboot-module";
+			reg = <0x80080000 0x800000>;
+			bootargs = "";
+		};
+	};
 
 	aliases {
 		serial0 = &v2m_serial0;