Skip to contentSkip to conversation

xen: public interface (and foreign check) changes for arm

PATCH Superseded Ian Campbell 2 participants 7 messages Feb 14, 2013 – Feb 21, 2013

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover xen: public interface (and foreign check) changes for arm

Changes in v2 are to the first patch which I botched a fair bit in the first cut.

The main change here is to switch evtchns to xen_ulong_t on arm, this enables us to have the same interface on arm32 and arm64. I will post a Linux side series shortly. This is an ABI change for ARM but not x86.

The remainder of the series fixes the tools/include/xen-foreign checks to cover more stuff on ARM.

As part of this I have moved start_info out of the generic public headers and into x86-specific public headers -- ARM does not use this struct in its ABI and the majority of start_info is PV MMU stuff. Removing it from ARM means I don't have to worry about the unsigned longs in there.

#1 lore raw

PATCH v2 1/4 tools: s/arm/arm32/ in foreign header checks.

Also define __arm__ARM32 as required.

---
v2: s/x86_32/arm32/ in the right place

    s/__arm__ARM32/__arm___ARM32/
    Update gitignore
---
 .gitignore                               |    2 +-
 tools/include/xen-foreign/Makefile       |    4 ++--
 tools/include/xen-foreign/mkheader.py    |    6 +++++-
 tools/include/xen-foreign/reference.size |    2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)
.gitignore +1 -1
index 125a582..73c5b77 100644
@@ -363,7 +363,7 @@ tools/include/xen-foreign/checker.c
 tools/include/xen-foreign/structs.pyc
 tools/include/xen-foreign/x86_32.h
 tools/include/xen-foreign/x86_64.h
-tools/include/xen-foreign/arm.h
+tools/include/xen-foreign/arm32.h
 
 .git
 tools/misc/xen-hptool
tools/include/xen-foreign/Makefile +2 -2
index cfaf790..5bc2d46 100644
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 ROOT = $(XEN_ROOT)/xen/include/public
 
-architectures := arm x86_32 x86_64
+architectures := arm32 x86_32 x86_64
 headers := $(patsubst %, %.h, $(architectures))
 
 .PHONY: all clean check-headers
@@ -22,7 +22,7 @@ check-headers: checker
 	diff -u reference.size tmp.size
 	rm tmp.size
 
-arm.h: mkheader.py structs.py $(ROOT)/arch-arm.h
+arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h
 	$(PYTHON) $< $* $@ $(filter %.h,$^)
 
 x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
tools/include/xen-foreign/mkheader.py +5 -1
index d189b07..eee28f3 100644
@@ -17,11 +17,15 @@ header = {};
 footer = {};
 
 #arm
-inttypes["arm"] = {
+inttypes["arm32"] = {
     "unsigned long" : "uint32_t",
     "long"          : "uint32_t",
     "xen_pfn_t"     : "uint64_t",
 };
+header["arm32"] = """
+#define __arm___ARM32 1
+""";
+
 
 # x86_32
 inttypes["x86_32"] = {
tools/include/xen-foreign/reference.size +1 -1
index a2cbfd6..9f1bfac 100644
@@ -1,5 +1,5 @@
 
-structs                   |     arm  x86_32  x86_64
+structs                   |   arm32  x86_32  x86_64
 
 start_info                |       -    1112    1168
 trap_info                 |       -       8      16
Signature · 1 line
1.7.2.5
Acked-by on v2 1/4
#2 lore raw

Re: [PATCH 1/4] tools: s/arm/arm32/ in foreign header checks.

Quoted 8 lines · Ian Campbell

Also define __arm__ARM32 as required.

---
v2: s/x86_32/arm32/ in the right place

    s/__arm__ARM32/__arm___ARM32/
    Update gitignore

It looks OK to me

Quoted 82 lines
 .gitignore                               |    2 +-
 tools/include/xen-foreign/Makefile       |    4 ++--
 tools/include/xen-foreign/mkheader.py    |    6 +++++-
 tools/include/xen-foreign/reference.size |    2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)
.gitignore +1 -1
index 125a582..73c5b77 100644
@@ -363,7 +363,7 @@ tools/include/xen-foreign/checker.c
 tools/include/xen-foreign/structs.pyc
 tools/include/xen-foreign/x86_32.h
 tools/include/xen-foreign/x86_64.h
-tools/include/xen-foreign/arm.h
+tools/include/xen-foreign/arm32.h
 
 .git
 tools/misc/xen-hptool
tools/include/xen-foreign/Makefile +2 -2
index cfaf790..5bc2d46 100644
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 ROOT = $(XEN_ROOT)/xen/include/public
 
-architectures := arm x86_32 x86_64
+architectures := arm32 x86_32 x86_64
 headers := $(patsubst %, %.h, $(architectures))
 
 .PHONY: all clean check-headers
@@ -22,7 +22,7 @@ check-headers: checker
 	diff -u reference.size tmp.size
 	rm tmp.size
 
-arm.h: mkheader.py structs.py $(ROOT)/arch-arm.h
+arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h
 	$(PYTHON) $< $* $@ $(filter %.h,$^)
 
 x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
tools/include/xen-foreign/mkheader.py +5 -1
index d189b07..eee28f3 100644
@@ -17,11 +17,15 @@ header = {};
 footer = {};
 
 #arm
-inttypes["arm"] = {
+inttypes["arm32"] = {
     "unsigned long" : "uint32_t",
     "long"          : "uint32_t",
     "xen_pfn_t"     : "uint64_t",
 };
+header["arm32"] = """
+#define __arm___ARM32 1
+""";
+
 
 # x86_32
 inttypes["x86_32"] = {
tools/include/xen-foreign/reference.size +1 -1
index a2cbfd6..9f1bfac 100644
@@ -1,5 +1,5 @@
 
-structs                   |     arm  x86_32  x86_64
+structs                   |   arm32  x86_32  x86_64
 
 start_info                |       -    1112    1168
 trap_info                 |       -       8      16
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#3 lore raw

PATCH v2 2/4 xen: event channel arrays are xen_ulong_t and not unsigned long

In reply to Ian Campbell

On ARM we want these to be the same size on 32- and 64-bit.

This is an ABI change on ARM. X86 does not change.

Cc Jan Beulich <[email protected]>
Cc Keir (Xen.org) <[email protected]>
Cc Tim Deegan <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
---
 tools/include/xen-foreign/mkheader.py |    4 +++-
 xen/include/public/xen.h              |    8 ++++----
 2 files changed, 7 insertions(+), 5 deletions(-)
tools/include/xen-foreign/mkheader.py +3 -1
index eee28f3..e3e61f3 100644
@@ -21,17 +21,18 @@ inttypes["arm32"] = {
     "unsigned long" : "uint32_t",
     "long"          : "uint32_t",
     "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
 };
 header["arm32"] = """
 #define __arm___ARM32 1
 """;
 
-
 # x86_32
 inttypes["x86_32"] = {
     "unsigned long" : "uint32_t",
     "long"          : "uint32_t",
     "xen_pfn_t"     : "uint32_t",
+    "xen_ulong_t"   : "uint32_t",
 };
 header["x86_32"] = """
 #define __i386___X86_32 1
@@ -46,6 +47,7 @@ inttypes["x86_64"] = {
     "unsigned long" : "__align8__ uint64_t",
     "long"          : "__align8__ uint64_t",
     "xen_pfn_t"     : "__align8__ uint64_t",
+    "xen_ulong_t"   : "__align8__ uint64_t",
 };
 header["x86_64"] = """
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
xen/include/public/xen.h +4 -4
index 5593066..99c8212 100644
@@ -556,7 +556,7 @@ DEFINE_XEN_GUEST_HANDLE(multicall_entry_t);
  * Event channel endpoints per domain:
  *  1024 if a long is 32 bits; 4096 if a long is 64 bits.
  */
-#define NR_EVENT_CHANNELS (sizeof(unsigned long) * sizeof(unsigned long) * 64)
+#define NR_EVENT_CHANNELS (sizeof(xen_ulong_t) * sizeof(xen_ulong_t) * 64)
 
 struct vcpu_time_info {
     /*
@@ -613,7 +613,7 @@ struct vcpu_info {
      */
     uint8_t evtchn_upcall_pending;
     uint8_t evtchn_upcall_mask;
-    unsigned long evtchn_pending_sel;
+    xen_ulong_t evtchn_pending_sel;
     struct arch_vcpu_info arch;
     struct vcpu_time_info time;
 }; /* 64 bytes (x86) */
@@ -663,8 +663,8 @@ struct shared_info {
      * per-vcpu selector word to be set. Each bit in the selector covers a
      * 'C long' in the PENDING bitfield array.
      */
-    unsigned long evtchn_pending[sizeof(unsigned long) * 8];
-    unsigned long evtchn_mask[sizeof(unsigned long) * 8];
+    xen_ulong_t evtchn_pending[sizeof(xen_ulong_t) * 8];
+    xen_ulong_t evtchn_mask[sizeof(xen_ulong_t) * 8];
 
     /*
      * Wallclock time: updated only by control software. Guests should base
Signature · 1 line
1.7.2.5
Acked-by on v2 2/4
#4 lore raw

Re: [PATCH 2/4] xen: event channel arrays are xen_ulong_t and not unsigned long

Quoted 10 lines · Ian Campbell

On ARM we want these to be the same size on 32- and 64-bit.

This is an ABI change on ARM. X86 does not change.

Cc Jan Beulich <[email protected]>
Cc Keir (Xen.org) <[email protected]>
Cc Tim Deegan <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Quoted 72 lines
 tools/include/xen-foreign/mkheader.py |    4 +++-
 xen/include/public/xen.h              |    8 ++++----
 2 files changed, 7 insertions(+), 5 deletions(-)
tools/include/xen-foreign/mkheader.py +3 -1
index eee28f3..e3e61f3 100644
@@ -21,17 +21,18 @@ inttypes["arm32"] = {
     "unsigned long" : "uint32_t",
     "long"          : "uint32_t",
     "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
 };
 header["arm32"] = """
 #define __arm___ARM32 1
 """;
 
-
 # x86_32
 inttypes["x86_32"] = {
     "unsigned long" : "uint32_t",
     "long"          : "uint32_t",
     "xen_pfn_t"     : "uint32_t",
+    "xen_ulong_t"   : "uint32_t",
 };
 header["x86_32"] = """
 #define __i386___X86_32 1
@@ -46,6 +47,7 @@ inttypes["x86_64"] = {
     "unsigned long" : "__align8__ uint64_t",
     "long"          : "__align8__ uint64_t",
     "xen_pfn_t"     : "__align8__ uint64_t",
+    "xen_ulong_t"   : "__align8__ uint64_t",
 };
 header["x86_64"] = """
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
xen/include/public/xen.h +4 -4
index 5593066..99c8212 100644
@@ -556,7 +556,7 @@ DEFINE_XEN_GUEST_HANDLE(multicall_entry_t);
  * Event channel endpoints per domain:
  *  1024 if a long is 32 bits; 4096 if a long is 64 bits.
  */
-#define NR_EVENT_CHANNELS (sizeof(unsigned long) * sizeof(unsigned long) * 64)
+#define NR_EVENT_CHANNELS (sizeof(xen_ulong_t) * sizeof(xen_ulong_t) * 64)
 
 struct vcpu_time_info {
     /*
@@ -613,7 +613,7 @@ struct vcpu_info {
      */
     uint8_t evtchn_upcall_pending;
     uint8_t evtchn_upcall_mask;
-    unsigned long evtchn_pending_sel;
+    xen_ulong_t evtchn_pending_sel;
     struct arch_vcpu_info arch;
     struct vcpu_time_info time;
 }; /* 64 bytes (x86) */
@@ -663,8 +663,8 @@ struct shared_info {
      * per-vcpu selector word to be set. Each bit in the selector covers a
      * 'C long' in the PENDING bitfield array.
      */
-    unsigned long evtchn_pending[sizeof(unsigned long) * 8];
-    unsigned long evtchn_mask[sizeof(unsigned long) * 8];
+    xen_ulong_t evtchn_pending[sizeof(xen_ulong_t) * 8];
+    xen_ulong_t evtchn_mask[sizeof(xen_ulong_t) * 8];
 
     /*
      * Wallclock time: updated only by control software. Guests should base
Signature · 1 line
1.7.2.5
#5 lore raw

PATCH v2 3/4 xen: make start_info x86 specific.

In reply to Ian Campbell

Most of this struct is PV MMU specific and it is not used on ARM at all.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir (Xen.org) <[email protected]>
Cc Tim Deegan <[email protected]>
Cc Stefano Stabellini <[email protected]>
---
 tools/libxc/xenctrl.h             |    5 +--
 xen/include/public/arch-x86/xen.h |   73 +++++++++++++++++++++++++++++++++++++
 xen/include/public/xen.h          |   73 -------------------------------------
 xen/include/xlat.lst              |    2 +-
 4 files changed, 76 insertions(+), 77 deletions(-)
tools/libxc/xenctrl.h +2 -3
index 32122fd..9e4a741 100644
@@ -395,15 +395,14 @@ typedef union
     shared_info_t s;
 } shared_info_any_t;
 
+#if defined(__i386__) || defined(__x86_64__)
 typedef union
 {
-#if defined(__i386__) || defined(__x86_64__)
     start_info_x86_64_t x64;
     start_info_x86_32_t x32;
-#endif
     start_info_t s;
 } start_info_any_t;
-
+#endif
 
 int xc_domain_create(xc_interface *xch,
                      uint32_t ssidref,
xen/include/public/arch-x86/xen.h +73 -0

79 lines not on this page · raw message

xen/include/public/xen.h +0 -73

79 lines not on this page · raw message

xen/include/xlat.lst +1 -1
index 3d4f1e3..5b0ff35 100644
@@ -5,10 +5,10 @@
 ?	xenctl_cpumap			xen.h
 ?	mmu_update			xen.h
 !	mmuext_op			xen.h
-!	start_info			xen.h
 ?	vcpu_info			xen.h
 ?	vcpu_time_info			xen.h
 !	cpu_user_regs			arch-x86/xen-@[email protected]
+!	start_info			arch-x86/xen.h
 !	trap_info			arch-x86/xen.h
 ?	cpu_offline_action		arch-x86/xen-mca.h
 ?	mc				arch-x86/xen-mca.h
Signature · 1 line
1.7.2.5
#6 lore raw

PATCH v2 4/4 xen: arm: include public/xen.h in foreign interface checking

In reply to Ian Campbell

mkheader.py doesn't cope with

	structr foo { };

so add a newline.

Define unsigned long and long to a non-existent type on ARM so as to catch their use.

Cc Jan Beulich <[email protected]>
Cc Keir (Xen.org) <[email protected]>
Cc Tim Deegan <[email protected]>
Cc Stefano Stabellini <[email protected]>
---
 tools/include/xen-foreign/Makefile       |    2 +-
 tools/include/xen-foreign/mkheader.py    |    4 ++--
 tools/include/xen-foreign/reference.size |   10 +++++-----
 xen/include/public/arch-arm.h            |    8 +++++---
 4 files changed, 13 insertions(+), 11 deletions(-)
tools/include/xen-foreign/Makefile +1 -1
index 5bc2d46..53cc6b4 100644
@@ -22,7 +22,7 @@ check-headers: checker
 	diff -u reference.size tmp.size
 	rm tmp.size
 
-arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h
+arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
 	$(PYTHON) $< $* $@ $(filter %.h,$^)
 
 x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
tools/include/xen-foreign/mkheader.py +2 -2
index e3e61f3..b7c34b1 100644
@@ -18,8 +18,8 @@ footer = {};
 
 #arm
 inttypes["arm32"] = {
-    "unsigned long" : "uint32_t",
-    "long"          : "uint32_t",
+    "unsigned long" : "__danger_unsigned_long_on_arm32",
+    "long"          : "__danger_long_on_arm32",
     "xen_pfn_t"     : "uint64_t",
     "xen_ulong_t"   : "uint64_t",
 };
tools/include/xen-foreign/reference.size +5 -5
index 9f1bfac..0e5529d 100644
@@ -5,9 +5,9 @@ start_info                |       -    1112    1168
 trap_info                 |       -       8      16
 cpu_user_regs             |     160      68     200
 vcpu_guest_context        |     180    2800    5168
-arch_vcpu_info            |       -      24      16
-vcpu_time_info            |       -      32      32
-vcpu_info                 |       -      64      64
-arch_shared_info          |       -     268     280
-shared_info               |       -    2584    3368
+arch_vcpu_info            |       0      24      16
+vcpu_time_info            |      32      32      32
+vcpu_info                 |      48      64      64
+arch_shared_info          |       0     268     280
+shared_info               |    1088    2584    3368
 
xen/include/public/arch-arm.h +5 -3
index d8788f2..8dd9062 100644
@@ -159,14 +159,16 @@ struct vcpu_guest_context {
 typedef struct vcpu_guest_context vcpu_guest_context_t;
 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 
-struct arch_vcpu_info { };
+struct arch_vcpu_info {
+};
 typedef struct arch_vcpu_info arch_vcpu_info_t;
 
-struct arch_shared_info { };
+struct arch_shared_info {
+};
 typedef struct arch_shared_info arch_shared_info_t;
 typedef uint64_t xen_callback_t;
 
-#endif /* ifndef __ASSEMBLY __ */
+#endif
 
 /* PSR bits (CPSR, SPSR)*/
 
Signature · 1 line
1.7.2.5