All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-virtualization][PATCH 0/3] Xen and XTF build fixes series
@ 2021-07-02  0:32 Christopher Clark
  2021-07-02  0:32 ` [meta-virtualization][PATCH 1/3] xen, xen-tools: add upstream patches for gcc11 compilation fixes Christopher Clark
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Christopher Clark @ 2021-07-02  0:32 UTC (permalink / raw)
  To: meta-virtualization
  Cc: bruce.ashfield, cardoe, diego.sueiro, Bertrand.Marquis,
	andrew.cooper3, dpsmith, persaur

Pull in updates from upstream Xen and XTF for GCC 11 and fix passing
compiler flags for the Xen hypervisor, tools and test framework.

Build and boot tested for both Arm64 and x86-64.

Christopher


Christopher Clark (3):
  xen, xen-tools: add upstream patches for gcc11 compilation fixes
  xen, xen-tools: fix build and passing of CFLAGS via Xen vars
  xtf: fix build with gcc11 SRCREV and specifying linker

 ...-rijndaelEncrypt-prototype-for-gcc11.patch |  52 ++++++++
 ...ry-Fix-osdep_xenforeignmemory_map-pr.patch |  33 ++++++
 ...x86-make-hypervisor-build-with-gcc11.patch | 111 ++++++++++++++++++
 recipes-extended/xen/xen-hypervisor.inc       |   3 +-
 recipes-extended/xen/xen-tools.inc            |   6 +-
 recipes-extended/xen/xen-tools_4.14.bb        |   1 +
 recipes-extended/xen/xen-tools_4.15.bb        |   1 +
 recipes-extended/xen/xen-tools_git.bb         |   1 +
 recipes-extended/xen/xen.inc                  |  12 +-
 recipes-extended/xen/xen_4.14.bb              |   2 +
 recipes-extended/xen/xen_4.15.bb              |   1 +
 recipes-extended/xen/xen_git.bb               |   1 +
 recipes-extended/xen/xtf_git.bb               |   3 +-
 13 files changed, 219 insertions(+), 8 deletions(-)
 create mode 100644 recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
 create mode 100644 recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
 create mode 100644 recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch

-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [meta-virtualization][PATCH 1/3] xen, xen-tools: add upstream patches for gcc11 compilation fixes
  2021-07-02  0:32 [meta-virtualization][PATCH 0/3] Xen and XTF build fixes series Christopher Clark
@ 2021-07-02  0:32 ` Christopher Clark
  2021-07-02 12:02   ` Bertrand Marquis
  2021-07-02  0:32 ` [meta-virtualization][PATCH 2/3] xen, xen-tools: fix build and passing of CFLAGS via Xen vars Christopher Clark
  2021-07-02  0:32 ` [meta-virtualization][PATCH 3/3] xtf: fix build with gcc11 SRCREV and specifying linker Christopher Clark
  2 siblings, 1 reply; 9+ messages in thread
From: Christopher Clark @ 2021-07-02  0:32 UTC (permalink / raw)
  To: meta-virtualization
  Cc: bruce.ashfield, cardoe, diego.sueiro, Bertrand.Marquis,
	andrew.cooper3, dpsmith, persaur

This allows the -Wno-vla-parameter workaround that was previously
applied (e99974aa57) to be retired.

Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
---
 ...-rijndaelEncrypt-prototype-for-gcc11.patch |  52 ++++++++
 ...ry-Fix-osdep_xenforeignmemory_map-pr.patch |  33 ++++++
 ...x86-make-hypervisor-build-with-gcc11.patch | 111 ++++++++++++++++++
 recipes-extended/xen/xen-tools.inc            |   5 +-
 recipes-extended/xen/xen-tools_4.14.bb        |   1 +
 recipes-extended/xen/xen-tools_4.15.bb        |   1 +
 recipes-extended/xen/xen-tools_git.bb         |   1 +
 recipes-extended/xen/xen_4.14.bb              |   2 +
 recipes-extended/xen/xen_4.15.bb              |   1 +
 recipes-extended/xen/xen_git.bb               |   1 +
 10 files changed, 204 insertions(+), 4 deletions(-)
 create mode 100644 recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
 create mode 100644 recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
 create mode 100644 recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch

diff --git a/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch b/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
new file mode 100644
index 0000000..1fc06f8
--- /dev/null
+++ b/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
@@ -0,0 +1,52 @@
+From c6ad5a701b9a6df443a6c98d9e7201c958bbcafc Mon Sep 17 00:00:00 2001
+From: Jan Beulich <jbeulich@suse.com>
+Date: Thu, 4 Mar 2021 16:47:51 +0100
+Subject: [PATCH] crypto: adjust rijndaelEncrypt() prototype for gcc11
+
+The upcoming release complains, not entirely unreasonably:
+
+In file included from rijndael.c:33:
+.../xen/include/crypto/rijndael.h:55:53: note: previously declared as 'const unsigned char[]'
+   55 | void    rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
+      |                                                     ^~~~~~~~~~~~~~~~~~~~~~
+rijndael.c:865:8: error: argument 4 of type 'u8[16]' {aka 'unsigned char[16]'} with mismatched bound [-Werror=array-parameter=]
+  865 |     u8 ct[16])
+      |     ~~~^~~~~~
+In file included from rijndael.c:33:
+.../xen/include/crypto/rijndael.h:56:13: note: previously declared as 'unsigned char[]'
+   56 |             unsigned char []);
+      |             ^~~~~~~~~~~~~~~~
+
+Simply declare the correct array dimensions right away. This then allows
+compilers to apply checking at call sites, which seems desirable anyway.
+
+For the moment I'm leaving untouched the disagreement between u8/u32
+used in the function definition and unsigned {char,int} used in the
+declaration, as making this consistent would call for touching further
+functions.
+
+Reported-by: Charles Arnold <carnold@suse.com>
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Reviewed-by: Julien Grall <jgrall@amazon.com>
+Release-Acked-by: Ian Jackson <iwj@xenproject.org>
+---
+ xen/include/crypto/rijndael.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/xen/include/crypto/rijndael.h b/xen/include/crypto/rijndael.h
+index 69965783c5..4386be5878 100644
+--- a/xen/include/crypto/rijndael.h
++++ b/xen/include/crypto/rijndael.h
+@@ -52,7 +52,7 @@ void	 rijndael_encrypt(rijndael_ctx *, const unsigned char *, unsigned char *);
+ 
+ int	rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int);
+ int	rijndaelKeySetupDec(unsigned int [], const unsigned char [], int);
+-void	rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
+-	    unsigned char []);
++void	rijndaelEncrypt(const unsigned int [], int, const unsigned char [16],
++	    unsigned char [16]);
+ 
+ #endif /* __RIJNDAEL_H */
+-- 
+2.25.1
+
diff --git a/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch b/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
new file mode 100644
index 0000000..2e3b1a6
--- /dev/null
+++ b/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
@@ -0,0 +1,33 @@
+From 5d3e4ebb5c71477d74a0c503438545a0126d3863 Mon Sep 17 00:00:00 2001
+From: Anthony PERARD <anthony.perard@citrix.com>
+Date: Tue, 1 Jun 2021 16:41:47 +0100
+Subject: [PATCH] libs/foreignmemory: Fix osdep_xenforeignmemory_map prototype
+
+Commit cf8c4d3d13b8 made some preparation to have one day
+variable-length-array argument, but didn't declare the array in the
+function prototype the same way as in the function definition. And now
+GCC 11 complains about it.
+
+Fixes: cf8c4d3d13b8 ("tools/libs/foreignmemory: pull array length argument to map forward")
+Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
+Reviewed-by: Jan Beulich <jbeulich@suse.com>
+---
+ tools/libs/foreignmemory/private.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/libs/foreignmemory/private.h b/tools/libs/foreignmemory/private.h
+index 1ee3626dd2..5bb0cefb09 100644
+--- a/tools/libs/foreignmemory/private.h
++++ b/tools/libs/foreignmemory/private.h
+@@ -32,7 +32,7 @@ int osdep_xenforeignmemory_close(xenforeignmemory_handle *fmem);
+ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
+                                  uint32_t dom, void *addr,
+                                  int prot, int flags, size_t num,
+-                                 const xen_pfn_t arr[num], int err[num]);
++                                 const xen_pfn_t arr[/*num*/], int err[/*num*/]);
+ int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem,
+                                  void *addr, size_t num);
+ 
+-- 
+2.25.1
+
diff --git a/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch b/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
new file mode 100644
index 0000000..72592c4
--- /dev/null
+++ b/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
@@ -0,0 +1,111 @@
+From 722f59d38c710a940ab05e542a83020eb5546dea Mon Sep 17 00:00:00 2001
+From: Jan Beulich <jbeulich@suse.com>
+Date: Thu, 27 May 2021 14:40:29 +0200
+Subject: [PATCH] x86: make hypervisor build with gcc11
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Gcc 11 looks to make incorrect assumptions about valid ranges that
+pointers may be used for addressing when they are derived from e.g. a
+plain constant. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100680.
+
+Utilize RELOC_HIDE() to work around the issue, which for x86 manifests
+in at least
+- mpparse.c:efi_check_config(),
+- tboot.c:tboot_probe(),
+- tboot.c:tboot_gen_frametable_integrity(),
+- x86_emulate.c:x86_emulate() (at -O2 only).
+The last case is particularly odd not just because it only triggers at
+higher optimization levels, but also because it only affects one of at
+least three similar constructs. Various "note" diagnostics claim the
+valid index range to be [0, 2⁶³-1].
+
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Tested-by: Jason Andryuk <jandryuk@gmail.com>
+Acked-by: Roger Pau Monné <roger.pau@citrix.com>
+---
+ tools/tests/x86_emulator/x86-emulate.c | 7 +++++++
+ xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
+ xen/include/asm-x86/fixmap.h           | 2 +-
+ xen/include/xen/compiler.h             | 6 ++++++
+ xen/include/xen/pdx.h                  | 2 +-
+ 5 files changed, 16 insertions(+), 3 deletions(-)
+
+diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
+index 07f892dbbb..ea286d6ad8 100644
+--- a/tools/tests/x86_emulator/x86-emulate.c
++++ b/tools/tests/x86_emulator/x86-emulate.c
+@@ -8,6 +8,13 @@
+ 
+ #define ERR_PTR(val) NULL
+ 
++/* See gcc bug 100680, but here don't bother making this version dependent. */
++#define gcc11_wrap(x) ({                  \
++    unsigned long x_;                     \
++    __asm__ ( "" : "=g" (x_) : "0" (x) ); \
++    (typeof(x))x_;                        \
++})
++
+ #define cpu_has_amd_erratum(nr) 0
+ #define cpu_has_mpx false
+ #define read_bndcfgu() 0
+diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
+index c25d88d0d8..31fdec030c 100644
+--- a/xen/arch/x86/x86_emulate/x86_emulate.c
++++ b/xen/arch/x86/x86_emulate/x86_emulate.c
+@@ -726,7 +726,7 @@ union vex {
+ #define copy_VEX(ptr, vex) ({ \
+     if ( !mode_64bit() ) \
+         (vex).reg |= 8; \
+-    (ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
++    gcc11_wrap(ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
+     (ptr)[1 - PFX_BYTES] = (vex).raw[0]; \
+     (ptr)[2 - PFX_BYTES] = (vex).raw[1]; \
+     container_of((ptr) + 1 - PFX_BYTES, typeof(vex), raw[0]); \
+diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h
+index 0db314baeb..20746afd0a 100644
+--- a/xen/include/asm-x86/fixmap.h
++++ b/xen/include/asm-x86/fixmap.h
+@@ -78,7 +78,7 @@ extern void __set_fixmap(
+ 
+ #define clear_fixmap(idx) __set_fixmap(idx, 0, 0)
+ 
+-#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
++#define __fix_to_virt(x) gcc11_wrap(FIXADDR_TOP - ((x) << PAGE_SHIFT))
+ #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
+ 
+ #define fix_to_virt(x)   ((void *)__fix_to_virt(x))
+diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
+index 17cf00e1ec..696c7eb89e 100644
+--- a/xen/include/xen/compiler.h
++++ b/xen/include/xen/compiler.h
+@@ -140,6 +140,12 @@
+     __asm__ ("" : "=r"(__ptr) : "0"(ptr));      \
+     (typeof(ptr)) (__ptr + (off)); })
+ 
++#if CONFIG_GCC_VERSION >= 110000 /* See gcc bug 100680. */
++# define gcc11_wrap(x) RELOC_HIDE(x, 0)
++#else
++# define gcc11_wrap(x) (x)
++#endif
++
+ #ifdef __GCC_ASM_FLAG_OUTPUTS__
+ # define ASM_FLAG_OUT(yes, no) yes
+ #else
+diff --git a/xen/include/xen/pdx.h b/xen/include/xen/pdx.h
+index 770fadc06c..9fcfb0ce52 100644
+--- a/xen/include/xen/pdx.h
++++ b/xen/include/xen/pdx.h
+@@ -19,7 +19,7 @@ extern u64 pdx_region_mask(u64 base, u64 len);
+ extern void set_pdx_range(unsigned long smfn, unsigned long emfn);
+ 
+ #define page_to_pdx(pg)  ((pg) - frame_table)
+-#define pdx_to_page(pdx) (frame_table + (pdx))
++#define pdx_to_page(pdx) gcc11_wrap(frame_table + (pdx))
+ 
+ bool __mfn_valid(unsigned long mfn);
+ 
+-- 
+2.25.1
+
diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
index e939c45..3560e79 100644
--- a/recipes-extended/xen/xen-tools.inc
+++ b/recipes-extended/xen/xen-tools.inc
@@ -725,12 +725,9 @@ do_configure() {
     do_configure_common
 }
 
-# Workaround when compiling with gcc-11
-EXTRA_CFLAGS_XEN_TOOLS_append = " -Wno-vla-parameter"
-
 do_compile() {
     cd ${S}
-    oe_runmake tools EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" PYTHON="${PYTHON}"
+    oe_runmake tools PYTHON="${PYTHON}"
 }
 
 do_install() {
diff --git a/recipes-extended/xen/xen-tools_4.14.bb b/recipes-extended/xen/xen-tools_4.14.bb
index 10982a2..13c484c 100644
--- a/recipes-extended/xen/xen-tools_4.14.bb
+++ b/recipes-extended/xen/xen-tools_4.14.bb
@@ -8,6 +8,7 @@ SRC_URI = " \
     file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \
     file://0001-firmware-provide-a-stand-alone-set-of-headers-Xen-4.14.patch \
     file://0001-tools-firmware-Build-firmware-as-ffreestanding-Xen-4.14.patch \
+    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
diff --git a/recipes-extended/xen/xen-tools_4.15.bb b/recipes-extended/xen/xen-tools_4.15.bb
index 314dc52..f3f9cd3 100644
--- a/recipes-extended/xen/xen-tools_4.15.bb
+++ b/recipes-extended/xen/xen-tools_4.15.bb
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \
+    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
diff --git a/recipes-extended/xen/xen-tools_git.bb b/recipes-extended/xen/xen-tools_git.bb
index 0188bdd..0b2dce9 100644
--- a/recipes-extended/xen/xen-tools_git.bb
+++ b/recipes-extended/xen/xen-tools_git.bb
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
 SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \
+    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
diff --git a/recipes-extended/xen/xen_4.14.bb b/recipes-extended/xen/xen_4.14.bb
index 653e3b6..aee4130 100644
--- a/recipes-extended/xen/xen_4.14.bb
+++ b/recipes-extended/xen/xen_4.14.bb
@@ -7,6 +7,8 @@ SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
+    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
+    file://0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
diff --git a/recipes-extended/xen/xen_4.15.bb b/recipes-extended/xen/xen_4.15.bb
index 2842c0a..d0aa176 100644
--- a/recipes-extended/xen/xen_4.15.bb
+++ b/recipes-extended/xen/xen_4.15.bb
@@ -7,6 +7,7 @@ SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
+    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb
index eaf3956..7ce7228 100644
--- a/recipes-extended/xen/xen_git.bb
+++ b/recipes-extended/xen/xen_git.bb
@@ -7,6 +7,7 @@ SRC_URI = " \
     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
     file://xen-arm64-implement-atomic-fetch-add.patch \
     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
+    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
     "
 
 LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [meta-virtualization][PATCH 2/3] xen, xen-tools: fix build and passing of CFLAGS via Xen vars
  2021-07-02  0:32 [meta-virtualization][PATCH 0/3] Xen and XTF build fixes series Christopher Clark
  2021-07-02  0:32 ` [meta-virtualization][PATCH 1/3] xen, xen-tools: add upstream patches for gcc11 compilation fixes Christopher Clark
@ 2021-07-02  0:32 ` Christopher Clark
  2021-07-02 12:02   ` Bertrand Marquis
  2021-07-02  0:32 ` [meta-virtualization][PATCH 3/3] xtf: fix build with gcc11 SRCREV and specifying linker Christopher Clark
  2 siblings, 1 reply; 9+ messages in thread
From: Christopher Clark @ 2021-07-02  0:32 UTC (permalink / raw)
  To: meta-virtualization
  Cc: bruce.ashfield, cardoe, diego.sueiro, Bertrand.Marquis,
	andrew.cooper3, dpsmith, persaur

Ensure that the Xen build system variables EXTRA_CFLAGS_XEN_CORE and
EXTRA_CFLAGS_XEN_TOOLS are passed into the compile steps.

Update the hypervisor compilation to avoid passing in most compile flags
from the build environment via EXTRA_CFLAGS_XEN_CORE -- prefer the
compiler defaults and the flags set by the Xen build system, so only the
debug prefix flags are provided.

Observeration derived from the prior commit e99974aa, so:
Reported-by: Diego Sueiro <diego.sueiro@arm.com>
Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
---
 recipes-extended/xen/xen-hypervisor.inc |  3 ++-
 recipes-extended/xen/xen-tools.inc      |  3 ++-
 recipes-extended/xen/xen.inc            | 12 ++++++++++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/recipes-extended/xen/xen-hypervisor.inc b/recipes-extended/xen/xen-hypervisor.inc
index 916bd3c..9b96d91 100644
--- a/recipes-extended/xen/xen-hypervisor.inc
+++ b/recipes-extended/xen/xen-hypervisor.inc
@@ -49,7 +49,8 @@ do_configure() {
 }
 
 do_compile() {
-    oe_runmake xen PYTHON="${PYTHON}"
+    oe_runmake xen PYTHON="${PYTHON}" \
+                   EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}"
 }
 
 do_install() {
diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
index 3560e79..2930097 100644
--- a/recipes-extended/xen/xen-tools.inc
+++ b/recipes-extended/xen/xen-tools.inc
@@ -727,7 +727,8 @@ do_configure() {
 
 do_compile() {
     cd ${S}
-    oe_runmake tools PYTHON="${PYTHON}"
+    oe_runmake tools PYTHON="${PYTHON}" \
+                     EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}"
 }
 
 do_install() {
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc
index 2fbdb3a..5aa2d5a 100644
--- a/recipes-extended/xen/xen.inc
+++ b/recipes-extended/xen/xen.inc
@@ -92,6 +92,16 @@ export LDFLAGS=""
 
 # Pass through the Yocto distro compiler flags via the Xen-provided variables.
 # Special handling:
+# - The Yocto distro compiler flags are typically set to be appropriate for
+#   user-space software rather than for generation of a hypervisor binary, so
+#   only pass the debug prefix map to the hypervisor build:
+EXTRA_CFLAGS_XEN_CORE="${DEBUG_PREFIX_MAP}"
+
+# - The Xen tools build for x86 systems with HVM-mode enabled includes hvmloader
+#   which fails to build when "-m64" is included in flags set via the
+#   EXTRA_CFLAGS_XEN_TOOLS: so clear TUNE_CCARGS on x86 to prevent that.
+TUNE_CCARGS_x86-64=""
+
 # - Yocto supplies the _FORTIFY_SOURCE flag via CC/CPP/CXX but then passes the
 #   optimization -O via C*FLAGS which is problematic when the CFLAGS are cleared
 #   within the build because compilation fails with the compiler stating
@@ -102,12 +112,10 @@ export LDFLAGS=""
 #   explicitly clears CFLAGS to ensure that, so such options must not be passed
 #   in via the tool variable. hvmloader is required to run HVM-mode guest VMs.
 CC="${CCACHE}${HOST_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${CC_REPRODUCIBLE_OPTIONS}"
-EXTRA_CFLAGS_XEN_CORE="${HOST_CC_ARCH} ${CFLAGS}"
 EXTRA_CFLAGS_XEN_TOOLS="${HOST_CC_ARCH} ${CFLAGS}"
 # 32-bit ARM needs the TUNE_CCARGS component of HOST_CC_ARCH to be passed
 # in CC to ensure that configure can compile binaries for the right arch.
 CC_arm="${CCACHE}${HOST_PREFIX}gcc ${TUNE_CCARGS} ${TOOLCHAIN_OPTIONS} ${CC_REPRODUCIBLE_OPTIONS}"
-EXTRA_CFLAGS_XEN_CORE_arm="${SECURITY_CFLAGS} ${CFLAGS}"
 EXTRA_CFLAGS_XEN_TOOLS_arm="${SECURITY_CFLAGS} ${CFLAGS}"
 
 # There are no Xen-provided variables for C++, so append to the tool variables:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [meta-virtualization][PATCH 3/3] xtf: fix build with gcc11 SRCREV and specifying linker
  2021-07-02  0:32 [meta-virtualization][PATCH 0/3] Xen and XTF build fixes series Christopher Clark
  2021-07-02  0:32 ` [meta-virtualization][PATCH 1/3] xen, xen-tools: add upstream patches for gcc11 compilation fixes Christopher Clark
  2021-07-02  0:32 ` [meta-virtualization][PATCH 2/3] xen, xen-tools: fix build and passing of CFLAGS via Xen vars Christopher Clark
@ 2021-07-02  0:32 ` Christopher Clark
  2021-07-02 12:04   ` Bertrand Marquis
  2 siblings, 1 reply; 9+ messages in thread
From: Christopher Clark @ 2021-07-02  0:32 UTC (permalink / raw)
  To: meta-virtualization
  Cc: bruce.ashfield, cardoe, diego.sueiro, Bertrand.Marquis,
	andrew.cooper3, dpsmith, persaur

Newer XTF revision works around GCC 11.1 issue 99578 and
supplying the correct linker to use fixes the build.

Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
---
 recipes-extended/xen/xtf_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/recipes-extended/xen/xtf_git.bb b/recipes-extended/xen/xtf_git.bb
index 3580324..bf7470e 100644
--- a/recipes-extended/xen/xtf_git.bb
+++ b/recipes-extended/xen/xtf_git.bb
@@ -6,7 +6,7 @@ LICENSE = "BSD-2-Clause"
 # https://static.sched.com/hosted_files/xendeveloperanddesignsummit2017/79/xtf.pdf
 
 SRC_URI = "git://xenbits.xen.org/xtf"
-SRCREV = "b0bc49846c154b79243f39d461a4515804bcaf53"
+SRCREV = "3e800027016ea4eb19887bf626b46f45fc43fa5d"
 
 COMPATIBLE_HOST = '(x86_64.*).*-linux'
 
@@ -32,6 +32,7 @@ RDEPENDS_${PN} = " \
 do_compile() {
     oe_runmake CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" \
                CPP="${CPP}" \
+               LD="${LD}" \
                OBJCOPY="${OBJCOPY}" \
                PYTHON="${PYTHON}"
     # switch the shebang to python3
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [meta-virtualization][PATCH 1/3] xen, xen-tools: add upstream patches for gcc11 compilation fixes
  2021-07-02  0:32 ` [meta-virtualization][PATCH 1/3] xen, xen-tools: add upstream patches for gcc11 compilation fixes Christopher Clark
@ 2021-07-02 12:02   ` Bertrand Marquis
  2021-07-04 21:09     ` Christopher Clark
  0 siblings, 1 reply; 9+ messages in thread
From: Bertrand Marquis @ 2021-07-02 12:02 UTC (permalink / raw)
  To: Christopher Clark
  Cc: meta-virtualization, bruce.ashfield, cardoe, Diego Sueiro,
	andrew.cooper3, dpsmith, persaur

Hi Christopher,

> On 2 Jul 2021, at 01:32, Christopher Clark <christopher.w.clark@gmail.com> wrote:
>
> This allows the -Wno-vla-parameter workaround that was previously
> applied (e99974aa57) to be retired.
>
> Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
> ---
> ...-rijndaelEncrypt-prototype-for-gcc11.patch |  52 ++++++++
> ...ry-Fix-osdep_xenforeignmemory_map-pr.patch |  33 ++++++
> ...x86-make-hypervisor-build-with-gcc11.patch | 111 ++++++++++++++++++
> recipes-extended/xen/xen-tools.inc            |   5 +-
> recipes-extended/xen/xen-tools_4.14.bb        |   1 +
> recipes-extended/xen/xen-tools_4.15.bb        |   1 +
> recipes-extended/xen/xen-tools_git.bb         |   1 +
> recipes-extended/xen/xen_4.14.bb              |   2 +
> recipes-extended/xen/xen_4.15.bb              |   1 +
> recipes-extended/xen/xen_git.bb               |   1 +
> 10 files changed, 204 insertions(+), 4 deletions(-)
> create mode 100644 recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> create mode 100644 recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
> create mode 100644 recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
>

On my tests git and 4.15 are working and compiling for arm32, arm64 and x86_64 but xen-4.14 does not work:

ERROR: xen-4.14+stableAUTOINC+ad844aa352-r0 do_patch: Command Error: 'quilt --quiltrc /home/bermar01/Development/xen-dev/build-master/metavirt-host-arm32-4.14-release.prj/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/xen/4.14+stableAUTOINC+ad844aa352-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0  Output:
stdout: Applying patch 0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
patching file xen/include/crypto/rijndael.h
Hunk #1 FAILED at 52.
1 out of 1 hunk FAILED -- rejects in file xen/include/crypto/rijndael.h
Patch 0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch does not apply (enforce with -f)

stderr:
ERROR: Logfile of failure stored in: /home/bermar01/Development/xen-dev/build-master/metavirt-host-arm32-4.14-release.prj/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/xen/4.14+stableAUTOINC+ad844aa352-r0/temp/log.do_patch.34794
NOTE: recipe xen-4.14+stableAUTOINC+ad844aa352-r0: task do_patch: Failed

I used latest master from everything (yocto, open embedded and meta-dirt).

Regards
Bertrand

> diff --git a/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch b/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> new file mode 100644
> index 0000000..1fc06f8
> --- /dev/null
> +++ b/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> @@ -0,0 +1,52 @@
> +From c6ad5a701b9a6df443a6c98d9e7201c958bbcafc Mon Sep 17 00:00:00 2001
> +From: Jan Beulich <jbeulich@suse.com>
> +Date: Thu, 4 Mar 2021 16:47:51 +0100
> +Subject: [PATCH] crypto: adjust rijndaelEncrypt() prototype for gcc11
> +
> +The upcoming release complains, not entirely unreasonably:
> +
> +In file included from rijndael.c:33:
> +.../xen/include/crypto/rijndael.h:55:53: note: previously declared as 'const unsigned char[]'
> +   55 | void    rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
> +      |                                                     ^~~~~~~~~~~~~~~~~~~~~~
> +rijndael.c:865:8: error: argument 4 of type 'u8[16]' {aka 'unsigned char[16]'} with mismatched bound [-Werror=array-parameter=]
> +  865 |     u8 ct[16])
> +      |     ~~~^~~~~~
> +In file included from rijndael.c:33:
> +.../xen/include/crypto/rijndael.h:56:13: note: previously declared as 'unsigned char[]'
> +   56 |             unsigned char []);
> +      |             ^~~~~~~~~~~~~~~~
> +
> +Simply declare the correct array dimensions right away. This then allows
> +compilers to apply checking at call sites, which seems desirable anyway.
> +
> +For the moment I'm leaving untouched the disagreement between u8/u32
> +used in the function definition and unsigned {char,int} used in the
> +declaration, as making this consistent would call for touching further
> +functions.
> +
> +Reported-by: Charles Arnold <carnold@suse.com>
> +Signed-off-by: Jan Beulich <jbeulich@suse.com>
> +Reviewed-by: Julien Grall <jgrall@amazon.com>
> +Release-Acked-by: Ian Jackson <iwj@xenproject.org>
> +---
> + xen/include/crypto/rijndael.h | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/xen/include/crypto/rijndael.h b/xen/include/crypto/rijndael.h
> +index 69965783c5..4386be5878 100644
> +--- a/xen/include/crypto/rijndael.h
> ++++ b/xen/include/crypto/rijndael.h
> +@@ -52,7 +52,7 @@ void        rijndael_encrypt(rijndael_ctx *, const unsigned char *, unsigned char *);
> +
> + int rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int);
> + int rijndaelKeySetupDec(unsigned int [], const unsigned char [], int);
> +-void        rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
> +-        unsigned char []);
> ++void        rijndaelEncrypt(const unsigned int [], int, const unsigned char [16],
> ++        unsigned char [16]);
> +
> + #endif /* __RIJNDAEL_H */
> +--
> +2.25.1
> +
> diff --git a/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch b/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
> new file mode 100644
> index 0000000..2e3b1a6
> --- /dev/null
> +++ b/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
> @@ -0,0 +1,33 @@
> +From 5d3e4ebb5c71477d74a0c503438545a0126d3863 Mon Sep 17 00:00:00 2001
> +From: Anthony PERARD <anthony.perard@citrix.com>
> +Date: Tue, 1 Jun 2021 16:41:47 +0100
> +Subject: [PATCH] libs/foreignmemory: Fix osdep_xenforeignmemory_map prototype
> +
> +Commit cf8c4d3d13b8 made some preparation to have one day
> +variable-length-array argument, but didn't declare the array in the
> +function prototype the same way as in the function definition. And now
> +GCC 11 complains about it.
> +
> +Fixes: cf8c4d3d13b8 ("tools/libs/foreignmemory: pull array length argument to map forward")
> +Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> +Reviewed-by: Jan Beulich <jbeulich@suse.com>
> +---
> + tools/libs/foreignmemory/private.h | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/tools/libs/foreignmemory/private.h b/tools/libs/foreignmemory/private.h
> +index 1ee3626dd2..5bb0cefb09 100644
> +--- a/tools/libs/foreignmemory/private.h
> ++++ b/tools/libs/foreignmemory/private.h
> +@@ -32,7 +32,7 @@ int osdep_xenforeignmemory_close(xenforeignmemory_handle *fmem);
> + void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
> +                                  uint32_t dom, void *addr,
> +                                  int prot, int flags, size_t num,
> +-                                 const xen_pfn_t arr[num], int err[num]);
> ++                                 const xen_pfn_t arr[/*num*/], int err[/*num*/]);
> + int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem,
> +                                  void *addr, size_t num);
> +
> +--
> +2.25.1
> +
> diff --git a/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch b/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
> new file mode 100644
> index 0000000..72592c4
> --- /dev/null
> +++ b/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
> @@ -0,0 +1,111 @@
> +From 722f59d38c710a940ab05e542a83020eb5546dea Mon Sep 17 00:00:00 2001
> +From: Jan Beulich <jbeulich@suse.com>
> +Date: Thu, 27 May 2021 14:40:29 +0200
> +Subject: [PATCH] x86: make hypervisor build with gcc11
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Gcc 11 looks to make incorrect assumptions about valid ranges that
> +pointers may be used for addressing when they are derived from e.g. a
> +plain constant. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100680.
> +
> +Utilize RELOC_HIDE() to work around the issue, which for x86 manifests
> +in at least
> +- mpparse.c:efi_check_config(),
> +- tboot.c:tboot_probe(),
> +- tboot.c:tboot_gen_frametable_integrity(),
> +- x86_emulate.c:x86_emulate() (at -O2 only).
> +The last case is particularly odd not just because it only triggers at
> +higher optimization levels, but also because it only affects one of at
> +least three similar constructs. Various "note" diagnostics claim the
> +valid index range to be [0, 2⁶³-1].
> +
> +Signed-off-by: Jan Beulich <jbeulich@suse.com>
> +Tested-by: Jason Andryuk <jandryuk@gmail.com>
> +Acked-by: Roger Pau Monné <roger.pau@citrix.com>
> +---
> + tools/tests/x86_emulator/x86-emulate.c | 7 +++++++
> + xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
> + xen/include/asm-x86/fixmap.h           | 2 +-
> + xen/include/xen/compiler.h             | 6 ++++++
> + xen/include/xen/pdx.h                  | 2 +-
> + 5 files changed, 16 insertions(+), 3 deletions(-)
> +
> +diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
> +index 07f892dbbb..ea286d6ad8 100644
> +--- a/tools/tests/x86_emulator/x86-emulate.c
> ++++ b/tools/tests/x86_emulator/x86-emulate.c
> +@@ -8,6 +8,13 @@
> +
> + #define ERR_PTR(val) NULL
> +
> ++/* See gcc bug 100680, but here don't bother making this version dependent. */
> ++#define gcc11_wrap(x) ({                  \
> ++    unsigned long x_;                     \
> ++    __asm__ ( "" : "=g" (x_) : "0" (x) ); \
> ++    (typeof(x))x_;                        \
> ++})
> ++
> + #define cpu_has_amd_erratum(nr) 0
> + #define cpu_has_mpx false
> + #define read_bndcfgu() 0
> +diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
> +index c25d88d0d8..31fdec030c 100644
> +--- a/xen/arch/x86/x86_emulate/x86_emulate.c
> ++++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> +@@ -726,7 +726,7 @@ union vex {
> + #define copy_VEX(ptr, vex) ({ \
> +     if ( !mode_64bit() ) \
> +         (vex).reg |= 8; \
> +-    (ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
> ++    gcc11_wrap(ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
> +     (ptr)[1 - PFX_BYTES] = (vex).raw[0]; \
> +     (ptr)[2 - PFX_BYTES] = (vex).raw[1]; \
> +     container_of((ptr) + 1 - PFX_BYTES, typeof(vex), raw[0]); \
> +diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h
> +index 0db314baeb..20746afd0a 100644
> +--- a/xen/include/asm-x86/fixmap.h
> ++++ b/xen/include/asm-x86/fixmap.h
> +@@ -78,7 +78,7 @@ extern void __set_fixmap(
> +
> + #define clear_fixmap(idx) __set_fixmap(idx, 0, 0)
> +
> +-#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
> ++#define __fix_to_virt(x) gcc11_wrap(FIXADDR_TOP - ((x) << PAGE_SHIFT))
> + #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
> +
> + #define fix_to_virt(x)   ((void *)__fix_to_virt(x))
> +diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
> +index 17cf00e1ec..696c7eb89e 100644
> +--- a/xen/include/xen/compiler.h
> ++++ b/xen/include/xen/compiler.h
> +@@ -140,6 +140,12 @@
> +     __asm__ ("" : "=r"(__ptr) : "0"(ptr));      \
> +     (typeof(ptr)) (__ptr + (off)); })
> +
> ++#if CONFIG_GCC_VERSION >= 110000 /* See gcc bug 100680. */
> ++# define gcc11_wrap(x) RELOC_HIDE(x, 0)
> ++#else
> ++# define gcc11_wrap(x) (x)
> ++#endif
> ++
> + #ifdef __GCC_ASM_FLAG_OUTPUTS__
> + # define ASM_FLAG_OUT(yes, no) yes
> + #else
> +diff --git a/xen/include/xen/pdx.h b/xen/include/xen/pdx.h
> +index 770fadc06c..9fcfb0ce52 100644
> +--- a/xen/include/xen/pdx.h
> ++++ b/xen/include/xen/pdx.h
> +@@ -19,7 +19,7 @@ extern u64 pdx_region_mask(u64 base, u64 len);
> + extern void set_pdx_range(unsigned long smfn, unsigned long emfn);
> +
> + #define page_to_pdx(pg)  ((pg) - frame_table)
> +-#define pdx_to_page(pdx) (frame_table + (pdx))
> ++#define pdx_to_page(pdx) gcc11_wrap(frame_table + (pdx))
> +
> + bool __mfn_valid(unsigned long mfn);
> +
> +--
> +2.25.1
> +
> diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
> index e939c45..3560e79 100644
> --- a/recipes-extended/xen/xen-tools.inc
> +++ b/recipes-extended/xen/xen-tools.inc
> @@ -725,12 +725,9 @@ do_configure() {
>     do_configure_common
> }
>
> -# Workaround when compiling with gcc-11
> -EXTRA_CFLAGS_XEN_TOOLS_append = " -Wno-vla-parameter"
> -
> do_compile() {
>     cd ${S}
> -    oe_runmake tools EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" PYTHON="${PYTHON}"
> +    oe_runmake tools PYTHON="${PYTHON}"
> }
>
> do_install() {
> diff --git a/recipes-extended/xen/xen-tools_4.14.bb b/recipes-extended/xen/xen-tools_4.14.bb
> index 10982a2..13c484c 100644
> --- a/recipes-extended/xen/xen-tools_4.14.bb
> +++ b/recipes-extended/xen/xen-tools_4.14.bb
> @@ -8,6 +8,7 @@ SRC_URI = " \
>     file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \
>     file://0001-firmware-provide-a-stand-alone-set-of-headers-Xen-4.14.patch \
>     file://0001-tools-firmware-Build-firmware-as-ffreestanding-Xen-4.14.patch \
> +    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
>     "
>
> LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> diff --git a/recipes-extended/xen/xen-tools_4.15.bb b/recipes-extended/xen/xen-tools_4.15.bb
> index 314dc52..f3f9cd3 100644
> --- a/recipes-extended/xen/xen-tools_4.15.bb
> +++ b/recipes-extended/xen/xen-tools_4.15.bb
> @@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
> SRC_URI = " \
>     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
>     file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \
> +    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
>     "
>
> LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> diff --git a/recipes-extended/xen/xen-tools_git.bb b/recipes-extended/xen/xen-tools_git.bb
> index 0188bdd..0b2dce9 100644
> --- a/recipes-extended/xen/xen-tools_git.bb
> +++ b/recipes-extended/xen/xen-tools_git.bb
> @@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
> SRC_URI = " \
>     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
>     file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \
> +    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
>     "
>
> LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> diff --git a/recipes-extended/xen/xen_4.14.bb b/recipes-extended/xen/xen_4.14.bb
> index 653e3b6..aee4130 100644
> --- a/recipes-extended/xen/xen_4.14.bb
> +++ b/recipes-extended/xen/xen_4.14.bb
> @@ -7,6 +7,8 @@ SRC_URI = " \
>     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
>     file://xen-arm64-implement-atomic-fetch-add.patch \
>     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
> +    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
> +    file://0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch \
>     "
>
> LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> diff --git a/recipes-extended/xen/xen_4.15.bb b/recipes-extended/xen/xen_4.15.bb
> index 2842c0a..d0aa176 100644
> --- a/recipes-extended/xen/xen_4.15.bb
> +++ b/recipes-extended/xen/xen_4.15.bb
> @@ -7,6 +7,7 @@ SRC_URI = " \
>     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
>     file://xen-arm64-implement-atomic-fetch-add.patch \
>     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
> +    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
>     "
>
> LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb
> index eaf3956..7ce7228 100644
> --- a/recipes-extended/xen/xen_git.bb
> +++ b/recipes-extended/xen/xen_git.bb
> @@ -7,6 +7,7 @@ SRC_URI = " \
>     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
>     file://xen-arm64-implement-atomic-fetch-add.patch \
>     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
> +    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
>     "
>
> LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> --
> 2.25.1
>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [meta-virtualization][PATCH 2/3] xen, xen-tools: fix build and passing of CFLAGS via Xen vars
  2021-07-02  0:32 ` [meta-virtualization][PATCH 2/3] xen, xen-tools: fix build and passing of CFLAGS via Xen vars Christopher Clark
@ 2021-07-02 12:02   ` Bertrand Marquis
  0 siblings, 0 replies; 9+ messages in thread
From: Bertrand Marquis @ 2021-07-02 12:02 UTC (permalink / raw)
  To: Christopher Clark
  Cc: meta-virtualization, bruce.ashfield, cardoe, Diego Sueiro,
	andrew.cooper3, dpsmith, persaur

[-- Attachment #1: Type: text/plain, Size: 4259 bytes --]

Hi Christopher,

On 2 Jul 2021, at 01:32, Christopher Clark <christopher.w.clark@gmail.com<mailto:christopher.w.clark@gmail.com>> wrote:

Ensure that the Xen build system variables EXTRA_CFLAGS_XEN_CORE and
EXTRA_CFLAGS_XEN_TOOLS are passed into the compile steps.

Update the hypervisor compilation to avoid passing in most compile flags
from the build environment via EXTRA_CFLAGS_XEN_CORE -- prefer the
compiler defaults and the flags set by the Xen build system, so only the
debug prefix flags are provided.

Observeration derived from the prior commit e99974aa, so:
Reported-by: Diego Sueiro <diego.sueiro@arm.com<mailto:diego.sueiro@arm.com>>
Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com<mailto:christopher.w.clark@gmail.com>>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com<mailto:bertrand.marquis@arm.com>>

Cheers
Bertrand


---
recipes-extended/xen/xen-hypervisor.inc |  3 ++-
recipes-extended/xen/xen-tools.inc      |  3 ++-
recipes-extended/xen/xen.inc            | 12 ++++++++++--
3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/recipes-extended/xen/xen-hypervisor.inc b/recipes-extended/xen/xen-hypervisor.inc
index 916bd3c..9b96d91 100644
--- a/recipes-extended/xen/xen-hypervisor.inc
+++ b/recipes-extended/xen/xen-hypervisor.inc
@@ -49,7 +49,8 @@ do_configure() {
}

do_compile() {
-    oe_runmake xen PYTHON="${PYTHON}"
+    oe_runmake xen PYTHON="${PYTHON}" \
+                   EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}"
}

do_install() {
diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
index 3560e79..2930097 100644
--- a/recipes-extended/xen/xen-tools.inc
+++ b/recipes-extended/xen/xen-tools.inc
@@ -727,7 +727,8 @@ do_configure() {

do_compile() {
    cd ${S}
-    oe_runmake tools PYTHON="${PYTHON}"
+    oe_runmake tools PYTHON="${PYTHON}" \
+                     EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}"
}

do_install() {
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc
index 2fbdb3a..5aa2d5a 100644
--- a/recipes-extended/xen/xen.inc
+++ b/recipes-extended/xen/xen.inc
@@ -92,6 +92,16 @@ export LDFLAGS=""

# Pass through the Yocto distro compiler flags via the Xen-provided variables.
# Special handling:
+# - The Yocto distro compiler flags are typically set to be appropriate for
+#   user-space software rather than for generation of a hypervisor binary, so
+#   only pass the debug prefix map to the hypervisor build:
+EXTRA_CFLAGS_XEN_CORE="${DEBUG_PREFIX_MAP}"
+
+# - The Xen tools build for x86 systems with HVM-mode enabled includes hvmloader
+#   which fails to build when "-m64" is included in flags set via the
+#   EXTRA_CFLAGS_XEN_TOOLS: so clear TUNE_CCARGS on x86 to prevent that.
+TUNE_CCARGS_x86-64=""
+
# - Yocto supplies the _FORTIFY_SOURCE flag via CC/CPP/CXX but then passes the
#   optimization -O via C*FLAGS which is problematic when the CFLAGS are cleared
#   within the build because compilation fails with the compiler stating
@@ -102,12 +112,10 @@ export LDFLAGS=""
#   explicitly clears CFLAGS to ensure that, so such options must not be passed
#   in via the tool variable. hvmloader is required to run HVM-mode guest VMs.
CC="${CCACHE}${HOST_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${CC_REPRODUCIBLE_OPTIONS}"
-EXTRA_CFLAGS_XEN_CORE="${HOST_CC_ARCH} ${CFLAGS}"
EXTRA_CFLAGS_XEN_TOOLS="${HOST_CC_ARCH} ${CFLAGS}"
# 32-bit ARM needs the TUNE_CCARGS component of HOST_CC_ARCH to be passed
# in CC to ensure that configure can compile binaries for the right arch.
CC_arm="${CCACHE}${HOST_PREFIX}gcc ${TUNE_CCARGS} ${TOOLCHAIN_OPTIONS} ${CC_REPRODUCIBLE_OPTIONS}"
-EXTRA_CFLAGS_XEN_CORE_arm="${SECURITY_CFLAGS} ${CFLAGS}"
EXTRA_CFLAGS_XEN_TOOLS_arm="${SECURITY_CFLAGS} ${CFLAGS}"

# There are no Xen-provided variables for C++, so append to the tool variables:
--
2.25.1


IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[-- Attachment #2: Type: text/html, Size: 6670 bytes --]

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [meta-virtualization][PATCH 3/3] xtf: fix build with gcc11 SRCREV and specifying linker
  2021-07-02  0:32 ` [meta-virtualization][PATCH 3/3] xtf: fix build with gcc11 SRCREV and specifying linker Christopher Clark
@ 2021-07-02 12:04   ` Bertrand Marquis
  0 siblings, 0 replies; 9+ messages in thread
From: Bertrand Marquis @ 2021-07-02 12:04 UTC (permalink / raw)
  To: Christopher Clark
  Cc: meta-virtualization, bruce.ashfield, cardoe, Diego Sueiro,
	andrew.cooper3, dpsmith, persaur

[-- Attachment #1: Type: text/plain, Size: 1764 bytes --]

Hi Christopher,

On 2 Jul 2021, at 01:32, Christopher Clark <christopher.w.clark@gmail.com<mailto:christopher.w.clark@gmail.com>> wrote:

Newer XTF revision works around GCC 11.1 issue 99578 and
supplying the correct linker to use fixes the build.

Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com<mailto:christopher.w.clark@gmail.com>>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com<mailto:bertrand.marquis@arm.com>>

It is properly compiling with master of everything.

Cheers
Bertrand

---
recipes-extended/xen/xtf_git.bb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/recipes-extended/xen/xtf_git.bb b/recipes-extended/xen/xtf_git.bb
index 3580324..bf7470e 100644
--- a/recipes-extended/xen/xtf_git.bb
+++ b/recipes-extended/xen/xtf_git.bb
@@ -6,7 +6,7 @@ LICENSE = "BSD-2-Clause"
# https://static.sched.com/hosted_files/xendeveloperanddesignsummit2017/79/xtf.pdf

SRC_URI = "git://xenbits.xen.org/xtf"
-SRCREV = "b0bc49846c154b79243f39d461a4515804bcaf53"
+SRCREV = "3e800027016ea4eb19887bf626b46f45fc43fa5d"

COMPATIBLE_HOST = '(x86_64.*).*-linux'

@@ -32,6 +32,7 @@ RDEPENDS_${PN} = " \
do_compile() {
    oe_runmake CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" \
               CPP="${CPP}" \
+               LD="${LD}" \
               OBJCOPY="${OBJCOPY}" \
               PYTHON="${PYTHON}"
    # switch the shebang to python3
--
2.25.1


IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[-- Attachment #2: Type: text/html, Size: 3483 bytes --]

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [meta-virtualization][PATCH 1/3] xen, xen-tools: add upstream patches for gcc11 compilation fixes
  2021-07-02 12:02   ` Bertrand Marquis
@ 2021-07-04 21:09     ` Christopher Clark
  2021-07-05 13:35       ` Bruce Ashfield
  0 siblings, 1 reply; 9+ messages in thread
From: Christopher Clark @ 2021-07-04 21:09 UTC (permalink / raw)
  To: Bertrand Marquis
  Cc: meta-virtualization, bruce.ashfield, cardoe, Diego Sueiro,
	andrew.cooper3, dpsmith, persaur

On Fri, Jul 2, 2021 at 5:02 AM Bertrand Marquis
<bertrand.marquis@arm.com> wrote:
>
> Hi Christopher,
>
> > On 2 Jul 2021, at 01:32, Christopher Clark <christopher.w.clark@gmail.com> wrote:
> >
> > This allows the -Wno-vla-parameter workaround that was previously
> > applied (e99974aa57) to be retired.
> >
> > Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
> > ---
> > ...-rijndaelEncrypt-prototype-for-gcc11.patch |  52 ++++++++
> > ...ry-Fix-osdep_xenforeignmemory_map-pr.patch |  33 ++++++
> > ...x86-make-hypervisor-build-with-gcc11.patch | 111 ++++++++++++++++++
> > recipes-extended/xen/xen-tools.inc            |   5 +-
> > recipes-extended/xen/xen-tools_4.14.bb        |   1 +
> > recipes-extended/xen/xen-tools_4.15.bb        |   1 +
> > recipes-extended/xen/xen-tools_git.bb         |   1 +
> > recipes-extended/xen/xen_4.14.bb              |   2 +
> > recipes-extended/xen/xen_4.15.bb              |   1 +
> > recipes-extended/xen/xen_git.bb               |   1 +
> > 10 files changed, 204 insertions(+), 4 deletions(-)
> > create mode 100644 recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> > create mode 100644 recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
> > create mode 100644 recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
> >
>
> On my tests git and 4.15 are working and compiling for arm32, arm64 and x86_64 but xen-4.14 does not work:

Thanks, Bertrand -- I appreciate the reviews and testing. I'm taking a
look into this and will post a v2.

Christopher


>
> ERROR: xen-4.14+stableAUTOINC+ad844aa352-r0 do_patch: Command Error: 'quilt --quiltrc /home/bermar01/Development/xen-dev/build-master/metavirt-host-arm32-4.14-release.prj/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/xen/4.14+stableAUTOINC+ad844aa352-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0  Output:
> stdout: Applying patch 0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> patching file xen/include/crypto/rijndael.h
> Hunk #1 FAILED at 52.
> 1 out of 1 hunk FAILED -- rejects in file xen/include/crypto/rijndael.h
> Patch 0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch does not apply (enforce with -f)
>
> stderr:
> ERROR: Logfile of failure stored in: /home/bermar01/Development/xen-dev/build-master/metavirt-host-arm32-4.14-release.prj/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/xen/4.14+stableAUTOINC+ad844aa352-r0/temp/log.do_patch.34794
> NOTE: recipe xen-4.14+stableAUTOINC+ad844aa352-r0: task do_patch: Failed
>
> I used latest master from everything (yocto, open embedded and meta-dirt).
>
> Regards
> Bertrand
>
> > diff --git a/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch b/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> > new file mode 100644
> > index 0000000..1fc06f8
> > --- /dev/null
> > +++ b/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> > @@ -0,0 +1,52 @@
> > +From c6ad5a701b9a6df443a6c98d9e7201c958bbcafc Mon Sep 17 00:00:00 2001
> > +From: Jan Beulich <jbeulich@suse.com>
> > +Date: Thu, 4 Mar 2021 16:47:51 +0100
> > +Subject: [PATCH] crypto: adjust rijndaelEncrypt() prototype for gcc11
> > +
> > +The upcoming release complains, not entirely unreasonably:
> > +
> > +In file included from rijndael.c:33:
> > +.../xen/include/crypto/rijndael.h:55:53: note: previously declared as 'const unsigned char[]'
> > +   55 | void    rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
> > +      |                                                     ^~~~~~~~~~~~~~~~~~~~~~
> > +rijndael.c:865:8: error: argument 4 of type 'u8[16]' {aka 'unsigned char[16]'} with mismatched bound [-Werror=array-parameter=]
> > +  865 |     u8 ct[16])
> > +      |     ~~~^~~~~~
> > +In file included from rijndael.c:33:
> > +.../xen/include/crypto/rijndael.h:56:13: note: previously declared as 'unsigned char[]'
> > +   56 |             unsigned char []);
> > +      |             ^~~~~~~~~~~~~~~~
> > +
> > +Simply declare the correct array dimensions right away. This then allows
> > +compilers to apply checking at call sites, which seems desirable anyway.
> > +
> > +For the moment I'm leaving untouched the disagreement between u8/u32
> > +used in the function definition and unsigned {char,int} used in the
> > +declaration, as making this consistent would call for touching further
> > +functions.
> > +
> > +Reported-by: Charles Arnold <carnold@suse.com>
> > +Signed-off-by: Jan Beulich <jbeulich@suse.com>
> > +Reviewed-by: Julien Grall <jgrall@amazon.com>
> > +Release-Acked-by: Ian Jackson <iwj@xenproject.org>
> > +---
> > + xen/include/crypto/rijndael.h | 4 ++--
> > + 1 file changed, 2 insertions(+), 2 deletions(-)
> > +
> > +diff --git a/xen/include/crypto/rijndael.h b/xen/include/crypto/rijndael.h
> > +index 69965783c5..4386be5878 100644
> > +--- a/xen/include/crypto/rijndael.h
> > ++++ b/xen/include/crypto/rijndael.h
> > +@@ -52,7 +52,7 @@ void        rijndael_encrypt(rijndael_ctx *, const unsigned char *, unsigned char *);
> > +
> > + int rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int);
> > + int rijndaelKeySetupDec(unsigned int [], const unsigned char [], int);
> > +-void        rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
> > +-        unsigned char []);
> > ++void        rijndaelEncrypt(const unsigned int [], int, const unsigned char [16],
> > ++        unsigned char [16]);
> > +
> > + #endif /* __RIJNDAEL_H */
> > +--
> > +2.25.1
> > +
> > diff --git a/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch b/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
> > new file mode 100644
> > index 0000000..2e3b1a6
> > --- /dev/null
> > +++ b/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
> > @@ -0,0 +1,33 @@
> > +From 5d3e4ebb5c71477d74a0c503438545a0126d3863 Mon Sep 17 00:00:00 2001
> > +From: Anthony PERARD <anthony.perard@citrix.com>
> > +Date: Tue, 1 Jun 2021 16:41:47 +0100
> > +Subject: [PATCH] libs/foreignmemory: Fix osdep_xenforeignmemory_map prototype
> > +
> > +Commit cf8c4d3d13b8 made some preparation to have one day
> > +variable-length-array argument, but didn't declare the array in the
> > +function prototype the same way as in the function definition. And now
> > +GCC 11 complains about it.
> > +
> > +Fixes: cf8c4d3d13b8 ("tools/libs/foreignmemory: pull array length argument to map forward")
> > +Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > +Reviewed-by: Jan Beulich <jbeulich@suse.com>
> > +---
> > + tools/libs/foreignmemory/private.h | 2 +-
> > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/tools/libs/foreignmemory/private.h b/tools/libs/foreignmemory/private.h
> > +index 1ee3626dd2..5bb0cefb09 100644
> > +--- a/tools/libs/foreignmemory/private.h
> > ++++ b/tools/libs/foreignmemory/private.h
> > +@@ -32,7 +32,7 @@ int osdep_xenforeignmemory_close(xenforeignmemory_handle *fmem);
> > + void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
> > +                                  uint32_t dom, void *addr,
> > +                                  int prot, int flags, size_t num,
> > +-                                 const xen_pfn_t arr[num], int err[num]);
> > ++                                 const xen_pfn_t arr[/*num*/], int err[/*num*/]);
> > + int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem,
> > +                                  void *addr, size_t num);
> > +
> > +--
> > +2.25.1
> > +
> > diff --git a/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch b/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
> > new file mode 100644
> > index 0000000..72592c4
> > --- /dev/null
> > +++ b/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
> > @@ -0,0 +1,111 @@
> > +From 722f59d38c710a940ab05e542a83020eb5546dea Mon Sep 17 00:00:00 2001
> > +From: Jan Beulich <jbeulich@suse.com>
> > +Date: Thu, 27 May 2021 14:40:29 +0200
> > +Subject: [PATCH] x86: make hypervisor build with gcc11
> > +MIME-Version: 1.0
> > +Content-Type: text/plain; charset=UTF-8
> > +Content-Transfer-Encoding: 8bit
> > +
> > +Gcc 11 looks to make incorrect assumptions about valid ranges that
> > +pointers may be used for addressing when they are derived from e.g. a
> > +plain constant. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100680.
> > +
> > +Utilize RELOC_HIDE() to work around the issue, which for x86 manifests
> > +in at least
> > +- mpparse.c:efi_check_config(),
> > +- tboot.c:tboot_probe(),
> > +- tboot.c:tboot_gen_frametable_integrity(),
> > +- x86_emulate.c:x86_emulate() (at -O2 only).
> > +The last case is particularly odd not just because it only triggers at
> > +higher optimization levels, but also because it only affects one of at
> > +least three similar constructs. Various "note" diagnostics claim the
> > +valid index range to be [0, 2⁶³-1].
> > +
> > +Signed-off-by: Jan Beulich <jbeulich@suse.com>
> > +Tested-by: Jason Andryuk <jandryuk@gmail.com>
> > +Acked-by: Roger Pau Monné <roger.pau@citrix.com>
> > +---
> > + tools/tests/x86_emulator/x86-emulate.c | 7 +++++++
> > + xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
> > + xen/include/asm-x86/fixmap.h           | 2 +-
> > + xen/include/xen/compiler.h             | 6 ++++++
> > + xen/include/xen/pdx.h                  | 2 +-
> > + 5 files changed, 16 insertions(+), 3 deletions(-)
> > +
> > +diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
> > +index 07f892dbbb..ea286d6ad8 100644
> > +--- a/tools/tests/x86_emulator/x86-emulate.c
> > ++++ b/tools/tests/x86_emulator/x86-emulate.c
> > +@@ -8,6 +8,13 @@
> > +
> > + #define ERR_PTR(val) NULL
> > +
> > ++/* See gcc bug 100680, but here don't bother making this version dependent. */
> > ++#define gcc11_wrap(x) ({                  \
> > ++    unsigned long x_;                     \
> > ++    __asm__ ( "" : "=g" (x_) : "0" (x) ); \
> > ++    (typeof(x))x_;                        \
> > ++})
> > ++
> > + #define cpu_has_amd_erratum(nr) 0
> > + #define cpu_has_mpx false
> > + #define read_bndcfgu() 0
> > +diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
> > +index c25d88d0d8..31fdec030c 100644
> > +--- a/xen/arch/x86/x86_emulate/x86_emulate.c
> > ++++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> > +@@ -726,7 +726,7 @@ union vex {
> > + #define copy_VEX(ptr, vex) ({ \
> > +     if ( !mode_64bit() ) \
> > +         (vex).reg |= 8; \
> > +-    (ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
> > ++    gcc11_wrap(ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
> > +     (ptr)[1 - PFX_BYTES] = (vex).raw[0]; \
> > +     (ptr)[2 - PFX_BYTES] = (vex).raw[1]; \
> > +     container_of((ptr) + 1 - PFX_BYTES, typeof(vex), raw[0]); \
> > +diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h
> > +index 0db314baeb..20746afd0a 100644
> > +--- a/xen/include/asm-x86/fixmap.h
> > ++++ b/xen/include/asm-x86/fixmap.h
> > +@@ -78,7 +78,7 @@ extern void __set_fixmap(
> > +
> > + #define clear_fixmap(idx) __set_fixmap(idx, 0, 0)
> > +
> > +-#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
> > ++#define __fix_to_virt(x) gcc11_wrap(FIXADDR_TOP - ((x) << PAGE_SHIFT))
> > + #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
> > +
> > + #define fix_to_virt(x)   ((void *)__fix_to_virt(x))
> > +diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
> > +index 17cf00e1ec..696c7eb89e 100644
> > +--- a/xen/include/xen/compiler.h
> > ++++ b/xen/include/xen/compiler.h
> > +@@ -140,6 +140,12 @@
> > +     __asm__ ("" : "=r"(__ptr) : "0"(ptr));      \
> > +     (typeof(ptr)) (__ptr + (off)); })
> > +
> > ++#if CONFIG_GCC_VERSION >= 110000 /* See gcc bug 100680. */
> > ++# define gcc11_wrap(x) RELOC_HIDE(x, 0)
> > ++#else
> > ++# define gcc11_wrap(x) (x)
> > ++#endif
> > ++
> > + #ifdef __GCC_ASM_FLAG_OUTPUTS__
> > + # define ASM_FLAG_OUT(yes, no) yes
> > + #else
> > +diff --git a/xen/include/xen/pdx.h b/xen/include/xen/pdx.h
> > +index 770fadc06c..9fcfb0ce52 100644
> > +--- a/xen/include/xen/pdx.h
> > ++++ b/xen/include/xen/pdx.h
> > +@@ -19,7 +19,7 @@ extern u64 pdx_region_mask(u64 base, u64 len);
> > + extern void set_pdx_range(unsigned long smfn, unsigned long emfn);
> > +
> > + #define page_to_pdx(pg)  ((pg) - frame_table)
> > +-#define pdx_to_page(pdx) (frame_table + (pdx))
> > ++#define pdx_to_page(pdx) gcc11_wrap(frame_table + (pdx))
> > +
> > + bool __mfn_valid(unsigned long mfn);
> > +
> > +--
> > +2.25.1
> > +
> > diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
> > index e939c45..3560e79 100644
> > --- a/recipes-extended/xen/xen-tools.inc
> > +++ b/recipes-extended/xen/xen-tools.inc
> > @@ -725,12 +725,9 @@ do_configure() {
> >     do_configure_common
> > }
> >
> > -# Workaround when compiling with gcc-11
> > -EXTRA_CFLAGS_XEN_TOOLS_append = " -Wno-vla-parameter"
> > -
> > do_compile() {
> >     cd ${S}
> > -    oe_runmake tools EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" PYTHON="${PYTHON}"
> > +    oe_runmake tools PYTHON="${PYTHON}"
> > }
> >
> > do_install() {
> > diff --git a/recipes-extended/xen/xen-tools_4.14.bb b/recipes-extended/xen/xen-tools_4.14.bb
> > index 10982a2..13c484c 100644
> > --- a/recipes-extended/xen/xen-tools_4.14.bb
> > +++ b/recipes-extended/xen/xen-tools_4.14.bb
> > @@ -8,6 +8,7 @@ SRC_URI = " \
> >     file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \
> >     file://0001-firmware-provide-a-stand-alone-set-of-headers-Xen-4.14.patch \
> >     file://0001-tools-firmware-Build-firmware-as-ffreestanding-Xen-4.14.patch \
> > +    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
> >     "
> >
> > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > diff --git a/recipes-extended/xen/xen-tools_4.15.bb b/recipes-extended/xen/xen-tools_4.15.bb
> > index 314dc52..f3f9cd3 100644
> > --- a/recipes-extended/xen/xen-tools_4.15.bb
> > +++ b/recipes-extended/xen/xen-tools_4.15.bb
> > @@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
> > SRC_URI = " \
> >     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
> >     file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \
> > +    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
> >     "
> >
> > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > diff --git a/recipes-extended/xen/xen-tools_git.bb b/recipes-extended/xen/xen-tools_git.bb
> > index 0188bdd..0b2dce9 100644
> > --- a/recipes-extended/xen/xen-tools_git.bb
> > +++ b/recipes-extended/xen/xen-tools_git.bb
> > @@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
> > SRC_URI = " \
> >     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
> >     file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \
> > +    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
> >     "
> >
> > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > diff --git a/recipes-extended/xen/xen_4.14.bb b/recipes-extended/xen/xen_4.14.bb
> > index 653e3b6..aee4130 100644
> > --- a/recipes-extended/xen/xen_4.14.bb
> > +++ b/recipes-extended/xen/xen_4.14.bb
> > @@ -7,6 +7,8 @@ SRC_URI = " \
> >     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
> >     file://xen-arm64-implement-atomic-fetch-add.patch \
> >     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
> > +    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
> > +    file://0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch \
> >     "
> >
> > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > diff --git a/recipes-extended/xen/xen_4.15.bb b/recipes-extended/xen/xen_4.15.bb
> > index 2842c0a..d0aa176 100644
> > --- a/recipes-extended/xen/xen_4.15.bb
> > +++ b/recipes-extended/xen/xen_4.15.bb
> > @@ -7,6 +7,7 @@ SRC_URI = " \
> >     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
> >     file://xen-arm64-implement-atomic-fetch-add.patch \
> >     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
> > +    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
> >     "
> >
> > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb
> > index eaf3956..7ce7228 100644
> > --- a/recipes-extended/xen/xen_git.bb
> > +++ b/recipes-extended/xen/xen_git.bb
> > @@ -7,6 +7,7 @@ SRC_URI = " \
> >     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
> >     file://xen-arm64-implement-atomic-fetch-add.patch \
> >     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
> > +    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
> >     "
> >
> > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > --
> > 2.25.1
> >
>
> IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
>
> 
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [meta-virtualization][PATCH 1/3] xen, xen-tools: add upstream patches for gcc11 compilation fixes
  2021-07-04 21:09     ` Christopher Clark
@ 2021-07-05 13:35       ` Bruce Ashfield
  0 siblings, 0 replies; 9+ messages in thread
From: Bruce Ashfield @ 2021-07-05 13:35 UTC (permalink / raw)
  To: Christopher Clark
  Cc: Bertrand Marquis, meta-virtualization, cardoe, Diego Sueiro,
	andrew.cooper3, dpsmith, persaur

On Sun, Jul 4, 2021 at 5:10 PM Christopher Clark
<christopher.w.clark@gmail.com> wrote:
>
> On Fri, Jul 2, 2021 at 5:02 AM Bertrand Marquis
> <bertrand.marquis@arm.com> wrote:
> >
> > Hi Christopher,
> >
> > > On 2 Jul 2021, at 01:32, Christopher Clark <christopher.w.clark@gmail.com> wrote:
> > >
> > > This allows the -Wno-vla-parameter workaround that was previously
> > > applied (e99974aa57) to be retired.
> > >
> > > Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
> > > ---
> > > ...-rijndaelEncrypt-prototype-for-gcc11.patch |  52 ++++++++
> > > ...ry-Fix-osdep_xenforeignmemory_map-pr.patch |  33 ++++++
> > > ...x86-make-hypervisor-build-with-gcc11.patch | 111 ++++++++++++++++++
> > > recipes-extended/xen/xen-tools.inc            |   5 +-
> > > recipes-extended/xen/xen-tools_4.14.bb        |   1 +
> > > recipes-extended/xen/xen-tools_4.15.bb        |   1 +
> > > recipes-extended/xen/xen-tools_git.bb         |   1 +
> > > recipes-extended/xen/xen_4.14.bb              |   2 +
> > > recipes-extended/xen/xen_4.15.bb              |   1 +
> > > recipes-extended/xen/xen_git.bb               |   1 +
> > > 10 files changed, 204 insertions(+), 4 deletions(-)
> > > create mode 100644 recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> > > create mode 100644 recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
> > > create mode 100644 recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
> > >
> >
> > On my tests git and 4.15 are working and compiling for arm32, arm64 and x86_64 but xen-4.14 does not work:
>
> Thanks, Bertrand -- I appreciate the reviews and testing. I'm taking a
> look into this and will post a v2.

I assume you'll send all three patches in the v2.

If you'd like me to apply any of the others before the v2, just let me know.

Bruce

>
> Christopher
>
>
> >
> > ERROR: xen-4.14+stableAUTOINC+ad844aa352-r0 do_patch: Command Error: 'quilt --quiltrc /home/bermar01/Development/xen-dev/build-master/metavirt-host-arm32-4.14-release.prj/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/xen/4.14+stableAUTOINC+ad844aa352-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0  Output:
> > stdout: Applying patch 0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> > patching file xen/include/crypto/rijndael.h
> > Hunk #1 FAILED at 52.
> > 1 out of 1 hunk FAILED -- rejects in file xen/include/crypto/rijndael.h
> > Patch 0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch does not apply (enforce with -f)
> >
> > stderr:
> > ERROR: Logfile of failure stored in: /home/bermar01/Development/xen-dev/build-master/metavirt-host-arm32-4.14-release.prj/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/xen/4.14+stableAUTOINC+ad844aa352-r0/temp/log.do_patch.34794
> > NOTE: recipe xen-4.14+stableAUTOINC+ad844aa352-r0: task do_patch: Failed
> >
> > I used latest master from everything (yocto, open embedded and meta-dirt).
> >
> > Regards
> > Bertrand
> >
> > > diff --git a/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch b/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> > > new file mode 100644
> > > index 0000000..1fc06f8
> > > --- /dev/null
> > > +++ b/recipes-extended/xen/files/0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch
> > > @@ -0,0 +1,52 @@
> > > +From c6ad5a701b9a6df443a6c98d9e7201c958bbcafc Mon Sep 17 00:00:00 2001
> > > +From: Jan Beulich <jbeulich@suse.com>
> > > +Date: Thu, 4 Mar 2021 16:47:51 +0100
> > > +Subject: [PATCH] crypto: adjust rijndaelEncrypt() prototype for gcc11
> > > +
> > > +The upcoming release complains, not entirely unreasonably:
> > > +
> > > +In file included from rijndael.c:33:
> > > +.../xen/include/crypto/rijndael.h:55:53: note: previously declared as 'const unsigned char[]'
> > > +   55 | void    rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
> > > +      |                                                     ^~~~~~~~~~~~~~~~~~~~~~
> > > +rijndael.c:865:8: error: argument 4 of type 'u8[16]' {aka 'unsigned char[16]'} with mismatched bound [-Werror=array-parameter=]
> > > +  865 |     u8 ct[16])
> > > +      |     ~~~^~~~~~
> > > +In file included from rijndael.c:33:
> > > +.../xen/include/crypto/rijndael.h:56:13: note: previously declared as 'unsigned char[]'
> > > +   56 |             unsigned char []);
> > > +      |             ^~~~~~~~~~~~~~~~
> > > +
> > > +Simply declare the correct array dimensions right away. This then allows
> > > +compilers to apply checking at call sites, which seems desirable anyway.
> > > +
> > > +For the moment I'm leaving untouched the disagreement between u8/u32
> > > +used in the function definition and unsigned {char,int} used in the
> > > +declaration, as making this consistent would call for touching further
> > > +functions.
> > > +
> > > +Reported-by: Charles Arnold <carnold@suse.com>
> > > +Signed-off-by: Jan Beulich <jbeulich@suse.com>
> > > +Reviewed-by: Julien Grall <jgrall@amazon.com>
> > > +Release-Acked-by: Ian Jackson <iwj@xenproject.org>
> > > +---
> > > + xen/include/crypto/rijndael.h | 4 ++--
> > > + 1 file changed, 2 insertions(+), 2 deletions(-)
> > > +
> > > +diff --git a/xen/include/crypto/rijndael.h b/xen/include/crypto/rijndael.h
> > > +index 69965783c5..4386be5878 100644
> > > +--- a/xen/include/crypto/rijndael.h
> > > ++++ b/xen/include/crypto/rijndael.h
> > > +@@ -52,7 +52,7 @@ void        rijndael_encrypt(rijndael_ctx *, const unsigned char *, unsigned char *);
> > > +
> > > + int rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int);
> > > + int rijndaelKeySetupDec(unsigned int [], const unsigned char [], int);
> > > +-void        rijndaelEncrypt(const unsigned int [], int, const unsigned char [],
> > > +-        unsigned char []);
> > > ++void        rijndaelEncrypt(const unsigned int [], int, const unsigned char [16],
> > > ++        unsigned char [16]);
> > > +
> > > + #endif /* __RIJNDAEL_H */
> > > +--
> > > +2.25.1
> > > +
> > > diff --git a/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch b/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
> > > new file mode 100644
> > > index 0000000..2e3b1a6
> > > --- /dev/null
> > > +++ b/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch
> > > @@ -0,0 +1,33 @@
> > > +From 5d3e4ebb5c71477d74a0c503438545a0126d3863 Mon Sep 17 00:00:00 2001
> > > +From: Anthony PERARD <anthony.perard@citrix.com>
> > > +Date: Tue, 1 Jun 2021 16:41:47 +0100
> > > +Subject: [PATCH] libs/foreignmemory: Fix osdep_xenforeignmemory_map prototype
> > > +
> > > +Commit cf8c4d3d13b8 made some preparation to have one day
> > > +variable-length-array argument, but didn't declare the array in the
> > > +function prototype the same way as in the function definition. And now
> > > +GCC 11 complains about it.
> > > +
> > > +Fixes: cf8c4d3d13b8 ("tools/libs/foreignmemory: pull array length argument to map forward")
> > > +Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > > +Reviewed-by: Jan Beulich <jbeulich@suse.com>
> > > +---
> > > + tools/libs/foreignmemory/private.h | 2 +-
> > > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > > +
> > > +diff --git a/tools/libs/foreignmemory/private.h b/tools/libs/foreignmemory/private.h
> > > +index 1ee3626dd2..5bb0cefb09 100644
> > > +--- a/tools/libs/foreignmemory/private.h
> > > ++++ b/tools/libs/foreignmemory/private.h
> > > +@@ -32,7 +32,7 @@ int osdep_xenforeignmemory_close(xenforeignmemory_handle *fmem);
> > > + void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
> > > +                                  uint32_t dom, void *addr,
> > > +                                  int prot, int flags, size_t num,
> > > +-                                 const xen_pfn_t arr[num], int err[num]);
> > > ++                                 const xen_pfn_t arr[/*num*/], int err[/*num*/]);
> > > + int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem,
> > > +                                  void *addr, size_t num);
> > > +
> > > +--
> > > +2.25.1
> > > +
> > > diff --git a/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch b/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
> > > new file mode 100644
> > > index 0000000..72592c4
> > > --- /dev/null
> > > +++ b/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch
> > > @@ -0,0 +1,111 @@
> > > +From 722f59d38c710a940ab05e542a83020eb5546dea Mon Sep 17 00:00:00 2001
> > > +From: Jan Beulich <jbeulich@suse.com>
> > > +Date: Thu, 27 May 2021 14:40:29 +0200
> > > +Subject: [PATCH] x86: make hypervisor build with gcc11
> > > +MIME-Version: 1.0
> > > +Content-Type: text/plain; charset=UTF-8
> > > +Content-Transfer-Encoding: 8bit
> > > +
> > > +Gcc 11 looks to make incorrect assumptions about valid ranges that
> > > +pointers may be used for addressing when they are derived from e.g. a
> > > +plain constant. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100680.
> > > +
> > > +Utilize RELOC_HIDE() to work around the issue, which for x86 manifests
> > > +in at least
> > > +- mpparse.c:efi_check_config(),
> > > +- tboot.c:tboot_probe(),
> > > +- tboot.c:tboot_gen_frametable_integrity(),
> > > +- x86_emulate.c:x86_emulate() (at -O2 only).
> > > +The last case is particularly odd not just because it only triggers at
> > > +higher optimization levels, but also because it only affects one of at
> > > +least three similar constructs. Various "note" diagnostics claim the
> > > +valid index range to be [0, 2⁶³-1].
> > > +
> > > +Signed-off-by: Jan Beulich <jbeulich@suse.com>
> > > +Tested-by: Jason Andryuk <jandryuk@gmail.com>
> > > +Acked-by: Roger Pau Monné <roger.pau@citrix.com>
> > > +---
> > > + tools/tests/x86_emulator/x86-emulate.c | 7 +++++++
> > > + xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
> > > + xen/include/asm-x86/fixmap.h           | 2 +-
> > > + xen/include/xen/compiler.h             | 6 ++++++
> > > + xen/include/xen/pdx.h                  | 2 +-
> > > + 5 files changed, 16 insertions(+), 3 deletions(-)
> > > +
> > > +diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
> > > +index 07f892dbbb..ea286d6ad8 100644
> > > +--- a/tools/tests/x86_emulator/x86-emulate.c
> > > ++++ b/tools/tests/x86_emulator/x86-emulate.c
> > > +@@ -8,6 +8,13 @@
> > > +
> > > + #define ERR_PTR(val) NULL
> > > +
> > > ++/* See gcc bug 100680, but here don't bother making this version dependent. */
> > > ++#define gcc11_wrap(x) ({                  \
> > > ++    unsigned long x_;                     \
> > > ++    __asm__ ( "" : "=g" (x_) : "0" (x) ); \
> > > ++    (typeof(x))x_;                        \
> > > ++})
> > > ++
> > > + #define cpu_has_amd_erratum(nr) 0
> > > + #define cpu_has_mpx false
> > > + #define read_bndcfgu() 0
> > > +diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
> > > +index c25d88d0d8..31fdec030c 100644
> > > +--- a/xen/arch/x86/x86_emulate/x86_emulate.c
> > > ++++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> > > +@@ -726,7 +726,7 @@ union vex {
> > > + #define copy_VEX(ptr, vex) ({ \
> > > +     if ( !mode_64bit() ) \
> > > +         (vex).reg |= 8; \
> > > +-    (ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
> > > ++    gcc11_wrap(ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \
> > > +     (ptr)[1 - PFX_BYTES] = (vex).raw[0]; \
> > > +     (ptr)[2 - PFX_BYTES] = (vex).raw[1]; \
> > > +     container_of((ptr) + 1 - PFX_BYTES, typeof(vex), raw[0]); \
> > > +diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h
> > > +index 0db314baeb..20746afd0a 100644
> > > +--- a/xen/include/asm-x86/fixmap.h
> > > ++++ b/xen/include/asm-x86/fixmap.h
> > > +@@ -78,7 +78,7 @@ extern void __set_fixmap(
> > > +
> > > + #define clear_fixmap(idx) __set_fixmap(idx, 0, 0)
> > > +
> > > +-#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
> > > ++#define __fix_to_virt(x) gcc11_wrap(FIXADDR_TOP - ((x) << PAGE_SHIFT))
> > > + #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
> > > +
> > > + #define fix_to_virt(x)   ((void *)__fix_to_virt(x))
> > > +diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
> > > +index 17cf00e1ec..696c7eb89e 100644
> > > +--- a/xen/include/xen/compiler.h
> > > ++++ b/xen/include/xen/compiler.h
> > > +@@ -140,6 +140,12 @@
> > > +     __asm__ ("" : "=r"(__ptr) : "0"(ptr));      \
> > > +     (typeof(ptr)) (__ptr + (off)); })
> > > +
> > > ++#if CONFIG_GCC_VERSION >= 110000 /* See gcc bug 100680. */
> > > ++# define gcc11_wrap(x) RELOC_HIDE(x, 0)
> > > ++#else
> > > ++# define gcc11_wrap(x) (x)
> > > ++#endif
> > > ++
> > > + #ifdef __GCC_ASM_FLAG_OUTPUTS__
> > > + # define ASM_FLAG_OUT(yes, no) yes
> > > + #else
> > > +diff --git a/xen/include/xen/pdx.h b/xen/include/xen/pdx.h
> > > +index 770fadc06c..9fcfb0ce52 100644
> > > +--- a/xen/include/xen/pdx.h
> > > ++++ b/xen/include/xen/pdx.h
> > > +@@ -19,7 +19,7 @@ extern u64 pdx_region_mask(u64 base, u64 len);
> > > + extern void set_pdx_range(unsigned long smfn, unsigned long emfn);
> > > +
> > > + #define page_to_pdx(pg)  ((pg) - frame_table)
> > > +-#define pdx_to_page(pdx) (frame_table + (pdx))
> > > ++#define pdx_to_page(pdx) gcc11_wrap(frame_table + (pdx))
> > > +
> > > + bool __mfn_valid(unsigned long mfn);
> > > +
> > > +--
> > > +2.25.1
> > > +
> > > diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
> > > index e939c45..3560e79 100644
> > > --- a/recipes-extended/xen/xen-tools.inc
> > > +++ b/recipes-extended/xen/xen-tools.inc
> > > @@ -725,12 +725,9 @@ do_configure() {
> > >     do_configure_common
> > > }
> > >
> > > -# Workaround when compiling with gcc-11
> > > -EXTRA_CFLAGS_XEN_TOOLS_append = " -Wno-vla-parameter"
> > > -
> > > do_compile() {
> > >     cd ${S}
> > > -    oe_runmake tools EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" PYTHON="${PYTHON}"
> > > +    oe_runmake tools PYTHON="${PYTHON}"
> > > }
> > >
> > > do_install() {
> > > diff --git a/recipes-extended/xen/xen-tools_4.14.bb b/recipes-extended/xen/xen-tools_4.14.bb
> > > index 10982a2..13c484c 100644
> > > --- a/recipes-extended/xen/xen-tools_4.14.bb
> > > +++ b/recipes-extended/xen/xen-tools_4.14.bb
> > > @@ -8,6 +8,7 @@ SRC_URI = " \
> > >     file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \
> > >     file://0001-firmware-provide-a-stand-alone-set-of-headers-Xen-4.14.patch \
> > >     file://0001-tools-firmware-Build-firmware-as-ffreestanding-Xen-4.14.patch \
> > > +    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
> > >     "
> > >
> > > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > > diff --git a/recipes-extended/xen/xen-tools_4.15.bb b/recipes-extended/xen/xen-tools_4.15.bb
> > > index 314dc52..f3f9cd3 100644
> > > --- a/recipes-extended/xen/xen-tools_4.15.bb
> > > +++ b/recipes-extended/xen/xen-tools_4.15.bb
> > > @@ -6,6 +6,7 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
> > > SRC_URI = " \
> > >     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
> > >     file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \
> > > +    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
> > >     "
> > >
> > > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > > diff --git a/recipes-extended/xen/xen-tools_git.bb b/recipes-extended/xen/xen-tools_git.bb
> > > index 0188bdd..0b2dce9 100644
> > > --- a/recipes-extended/xen/xen-tools_git.bb
> > > +++ b/recipes-extended/xen/xen-tools_git.bb
> > > @@ -6,6 +6,7 @@ XEN_BRANCH ?= "master"
> > > SRC_URI = " \
> > >     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
> > >     file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \
> > > +    file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \
> > >     "
> > >
> > > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > > diff --git a/recipes-extended/xen/xen_4.14.bb b/recipes-extended/xen/xen_4.14.bb
> > > index 653e3b6..aee4130 100644
> > > --- a/recipes-extended/xen/xen_4.14.bb
> > > +++ b/recipes-extended/xen/xen_4.14.bb
> > > @@ -7,6 +7,8 @@ SRC_URI = " \
> > >     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
> > >     file://xen-arm64-implement-atomic-fetch-add.patch \
> > >     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
> > > +    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
> > > +    file://0001-crypto-adjust-rijndaelEncrypt-prototype-for-gcc11.patch \
> > >     "
> > >
> > > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > > diff --git a/recipes-extended/xen/xen_4.15.bb b/recipes-extended/xen/xen_4.15.bb
> > > index 2842c0a..d0aa176 100644
> > > --- a/recipes-extended/xen/xen_4.15.bb
> > > +++ b/recipes-extended/xen/xen_4.15.bb
> > > @@ -7,6 +7,7 @@ SRC_URI = " \
> > >     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
> > >     file://xen-arm64-implement-atomic-fetch-add.patch \
> > >     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
> > > +    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
> > >     "
> > >
> > > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > > diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb
> > > index eaf3956..7ce7228 100644
> > > --- a/recipes-extended/xen/xen_git.bb
> > > +++ b/recipes-extended/xen/xen_git.bb
> > > @@ -7,6 +7,7 @@ SRC_URI = " \
> > >     git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
> > >     file://xen-arm64-implement-atomic-fetch-add.patch \
> > >     file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \
> > > +    file://0001-x86-make-hypervisor-build-with-gcc11.patch \
> > >     "
> > >
> > > LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5"
> > > --
> > > 2.25.1
> > >
> >
> > IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
> >
> > 
> >



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-07-05 13:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02  0:32 [meta-virtualization][PATCH 0/3] Xen and XTF build fixes series Christopher Clark
2021-07-02  0:32 ` [meta-virtualization][PATCH 1/3] xen, xen-tools: add upstream patches for gcc11 compilation fixes Christopher Clark
2021-07-02 12:02   ` Bertrand Marquis
2021-07-04 21:09     ` Christopher Clark
2021-07-05 13:35       ` Bruce Ashfield
2021-07-02  0:32 ` [meta-virtualization][PATCH 2/3] xen, xen-tools: fix build and passing of CFLAGS via Xen vars Christopher Clark
2021-07-02 12:02   ` Bertrand Marquis
2021-07-02  0:32 ` [meta-virtualization][PATCH 3/3] xtf: fix build with gcc11 SRCREV and specifying linker Christopher Clark
2021-07-02 12:04   ` Bertrand Marquis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.