[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 11/16] livepatch: tests: Make them compile under ARM64



On 09/23/2016 02:33 AM, Konrad Rzeszutek Wilk wrote:
.snip..
diff --git a/xen/test/Makefile b/xen/test/Makefile
index 8c53040..95c1755 100644
--- a/xen/test/Makefile
+++ b/xen/test/Makefile
@@ -1,6 +1,6 @@
 .PHONY: tests
 tests:
I am wondering if there is any way to use the
-ifeq ($(XEN_TARGET_ARCH),x86_64)
+ifneq $(XEN_TARGET_ARCH),arm32)

NIT: I am wondering if you could instead use CONFIG_LIVEPATCH here, so the
tests would only be built when livepatch is enabled.

Lets leave it as is and do it in the future. Right now the tests
are not compiled by default so not much harm here. But I do agree that
somehow exposing the CONFIG_LIVEPATCH and latching it off (in say
tests/livepatch/ directory) is a good TODO item..

        $(MAKE) -f $(BASEDIR)/Rules.mk -C livepatch livepatch
 endif

diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile
index 48ff843..5db4d9c 100644
--- a/xen/test/livepatch/Makefile
+++ b/xen/test/livepatch/Makefile
@@ -1,5 +1,12 @@
 include $(XEN_ROOT)/Config.mk

+ifeq ($(XEN_TARGET_ARCH),x86_64)
+OBJCOPY_MAGIC := -I binary -O elf64-x86-64 -B i386:x86-64
+endif
+ifeq ($(XEN_TARGET_ARCH),arm64)
+OBJCOPY_MAGIC := -I binary -O elf64-littleaarch64 -B aarch64
+endif
+
 CODE_ADDR=$(shell nm --defined $(1) | grep $(2) | awk '{print "0x"$$1}')
 CODE_SZ=$(shell nm --defined -S $(1) | grep $(2) | awk '{ print "0x"$$2}')

@@ -54,8 +61,9 @@ $(LIVEPATCH): xen_hello_world_func.o xen_hello_world.o note.o
 .PHONY: note.o
 note.o:
        $(OBJCOPY) -O binary --only-section=.note.gnu.build-id 
$(BASEDIR)/xen-syms $@.bin
-       $(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 \
+       $(OBJCOPY) $(OBJCOPY_MAGIC) \
                   
--rename-section=.data=.livepatch.depends,alloc,load,readonly,data,contents -S 
$@.bin $@
+                  --rename-section=.data=.livepatch.depends -S $@.bin $@

I am not sure why you added this line. Did you intend to replace the
previous one?

Fixed.
..snip..
@@ -25,6 +28,10 @@ const char *xen_hello_world(void)
      */
     rc = __get_user(tmp, non_canonical_addr);
     BUG_ON(rc != -EFAULT);
+#endif
+#ifdef CONFIG_ARM_64

NIT: I would use:

#if defined(CONFIG_ARM) && defined(CONFIG_HAS_ALTERNATIVE)

in order to handle alternative if we decide to add support for ARM32.

Done!

Here is the updated patch:


From c0dac442d15b5f0095b199ab4fff1fc414fb5719 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Mon, 19 Sep 2016 16:04:55 -0400
Subject: [PATCH v6] livepatch: tests: Make them compile under ARM64

We need to two things:
1) Wrap the platform-specific objcopy parameters in defines
   The input and output parameters for $(OBJCOPY) are different
   based on the platforms. As such provide them in the
   OBJCOPY_MAGIC define and use that.

2) The alternative is a bit different (exists only under ARM64
   and x86), while and there are no exceptions under ARM at all.
   We use the LIVEPATCH_FEATURE CPU id feature for ARM similar to
   how it is done on x86.

We are not yet attempting to build them under ARM32 so
that is still ifdefed out.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>


Reviewed-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.