diff options
author | Christopher Clark <christopher.w.clark@gmail.com> | 2021-07-07 21:32:43 -0700 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2021-07-14 15:33:10 -0400 |
commit | 4d61693058271667a5f30a92d8f40c96ff1c16ba (patch) | |
tree | 92d639b06f7a70d7980d5bf0a68a00bf843ba81f | |
parent | 172d5f47d54c6cea5f3c229fbd078200930fb690 (diff) | |
download | meta-virtualization-4d61693058271667a5f30a92d8f40c96ff1c16ba.tar.gz |
xen, xen-tools: apply upstream fixes for gcc11 compilation
Apply patches for the tools and hypervisor to Xen 4.15 and the git
recipe and uprev Xen 4.14 to latest stable revision.
Retire the previous -Wno-vla-parameter workaround.
Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r-- | recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch | 33 | ||||
-rw-r--r-- | recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch | 111 | ||||
-rw-r--r-- | recipes-extended/xen/xen-tools.inc | 5 | ||||
-rw-r--r-- | recipes-extended/xen/xen-tools_4.14.bb | 3 | ||||
-rw-r--r-- | recipes-extended/xen/xen-tools_4.15.bb | 1 | ||||
-rw-r--r-- | recipes-extended/xen/xen-tools_git.bb | 1 | ||||
-rw-r--r-- | recipes-extended/xen/xen_4.14.bb | 2 | ||||
-rw-r--r-- | recipes-extended/xen/xen_4.15.bb | 1 | ||||
-rw-r--r-- | recipes-extended/xen/xen_git.bb | 1 |
9 files changed, 152 insertions, 6 deletions
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 00000000..2e3b1a67 --- /dev/null +++ b/recipes-extended/xen/files/0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 5d3e4ebb5c71477d74a0c503438545a0126d3863 Mon Sep 17 00:00:00 2001 | ||
2 | From: Anthony PERARD <anthony.perard@citrix.com> | ||
3 | Date: Tue, 1 Jun 2021 16:41:47 +0100 | ||
4 | Subject: [PATCH] libs/foreignmemory: Fix osdep_xenforeignmemory_map prototype | ||
5 | |||
6 | Commit cf8c4d3d13b8 made some preparation to have one day | ||
7 | variable-length-array argument, but didn't declare the array in the | ||
8 | function prototype the same way as in the function definition. And now | ||
9 | GCC 11 complains about it. | ||
10 | |||
11 | Fixes: cf8c4d3d13b8 ("tools/libs/foreignmemory: pull array length argument to map forward") | ||
12 | Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> | ||
13 | Reviewed-by: Jan Beulich <jbeulich@suse.com> | ||
14 | --- | ||
15 | tools/libs/foreignmemory/private.h | 2 +- | ||
16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
17 | |||
18 | diff --git a/tools/libs/foreignmemory/private.h b/tools/libs/foreignmemory/private.h | ||
19 | index 1ee3626dd2..5bb0cefb09 100644 | ||
20 | --- a/tools/libs/foreignmemory/private.h | ||
21 | +++ b/tools/libs/foreignmemory/private.h | ||
22 | @@ -32,7 +32,7 @@ int osdep_xenforeignmemory_close(xenforeignmemory_handle *fmem); | ||
23 | void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem, | ||
24 | uint32_t dom, void *addr, | ||
25 | int prot, int flags, size_t num, | ||
26 | - const xen_pfn_t arr[num], int err[num]); | ||
27 | + const xen_pfn_t arr[/*num*/], int err[/*num*/]); | ||
28 | int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem, | ||
29 | void *addr, size_t num); | ||
30 | |||
31 | -- | ||
32 | 2.25.1 | ||
33 | |||
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 00000000..72592c4b --- /dev/null +++ b/recipes-extended/xen/files/0001-x86-make-hypervisor-build-with-gcc11.patch | |||
@@ -0,0 +1,111 @@ | |||
1 | From 722f59d38c710a940ab05e542a83020eb5546dea Mon Sep 17 00:00:00 2001 | ||
2 | From: Jan Beulich <jbeulich@suse.com> | ||
3 | Date: Thu, 27 May 2021 14:40:29 +0200 | ||
4 | Subject: [PATCH] x86: make hypervisor build with gcc11 | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Gcc 11 looks to make incorrect assumptions about valid ranges that | ||
10 | pointers may be used for addressing when they are derived from e.g. a | ||
11 | plain constant. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100680. | ||
12 | |||
13 | Utilize RELOC_HIDE() to work around the issue, which for x86 manifests | ||
14 | in at least | ||
15 | - mpparse.c:efi_check_config(), | ||
16 | - tboot.c:tboot_probe(), | ||
17 | - tboot.c:tboot_gen_frametable_integrity(), | ||
18 | - x86_emulate.c:x86_emulate() (at -O2 only). | ||
19 | The last case is particularly odd not just because it only triggers at | ||
20 | higher optimization levels, but also because it only affects one of at | ||
21 | least three similar constructs. Various "note" diagnostics claim the | ||
22 | valid index range to be [0, 2⁶³-1]. | ||
23 | |||
24 | Signed-off-by: Jan Beulich <jbeulich@suse.com> | ||
25 | Tested-by: Jason Andryuk <jandryuk@gmail.com> | ||
26 | Acked-by: Roger Pau Monné <roger.pau@citrix.com> | ||
27 | --- | ||
28 | tools/tests/x86_emulator/x86-emulate.c | 7 +++++++ | ||
29 | xen/arch/x86/x86_emulate/x86_emulate.c | 2 +- | ||
30 | xen/include/asm-x86/fixmap.h | 2 +- | ||
31 | xen/include/xen/compiler.h | 6 ++++++ | ||
32 | xen/include/xen/pdx.h | 2 +- | ||
33 | 5 files changed, 16 insertions(+), 3 deletions(-) | ||
34 | |||
35 | diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c | ||
36 | index 07f892dbbb..ea286d6ad8 100644 | ||
37 | --- a/tools/tests/x86_emulator/x86-emulate.c | ||
38 | +++ b/tools/tests/x86_emulator/x86-emulate.c | ||
39 | @@ -8,6 +8,13 @@ | ||
40 | |||
41 | #define ERR_PTR(val) NULL | ||
42 | |||
43 | +/* See gcc bug 100680, but here don't bother making this version dependent. */ | ||
44 | +#define gcc11_wrap(x) ({ \ | ||
45 | + unsigned long x_; \ | ||
46 | + __asm__ ( "" : "=g" (x_) : "0" (x) ); \ | ||
47 | + (typeof(x))x_; \ | ||
48 | +}) | ||
49 | + | ||
50 | #define cpu_has_amd_erratum(nr) 0 | ||
51 | #define cpu_has_mpx false | ||
52 | #define read_bndcfgu() 0 | ||
53 | diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c | ||
54 | index c25d88d0d8..31fdec030c 100644 | ||
55 | --- a/xen/arch/x86/x86_emulate/x86_emulate.c | ||
56 | +++ b/xen/arch/x86/x86_emulate/x86_emulate.c | ||
57 | @@ -726,7 +726,7 @@ union vex { | ||
58 | #define copy_VEX(ptr, vex) ({ \ | ||
59 | if ( !mode_64bit() ) \ | ||
60 | (vex).reg |= 8; \ | ||
61 | - (ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \ | ||
62 | + gcc11_wrap(ptr)[0 - PFX_BYTES] = ext < ext_8f08 ? 0xc4 : 0x8f; \ | ||
63 | (ptr)[1 - PFX_BYTES] = (vex).raw[0]; \ | ||
64 | (ptr)[2 - PFX_BYTES] = (vex).raw[1]; \ | ||
65 | container_of((ptr) + 1 - PFX_BYTES, typeof(vex), raw[0]); \ | ||
66 | diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h | ||
67 | index 0db314baeb..20746afd0a 100644 | ||
68 | --- a/xen/include/asm-x86/fixmap.h | ||
69 | +++ b/xen/include/asm-x86/fixmap.h | ||
70 | @@ -78,7 +78,7 @@ extern void __set_fixmap( | ||
71 | |||
72 | #define clear_fixmap(idx) __set_fixmap(idx, 0, 0) | ||
73 | |||
74 | -#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
75 | +#define __fix_to_virt(x) gcc11_wrap(FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
76 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
77 | |||
78 | #define fix_to_virt(x) ((void *)__fix_to_virt(x)) | ||
79 | diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h | ||
80 | index 17cf00e1ec..696c7eb89e 100644 | ||
81 | --- a/xen/include/xen/compiler.h | ||
82 | +++ b/xen/include/xen/compiler.h | ||
83 | @@ -140,6 +140,12 @@ | ||
84 | __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ | ||
85 | (typeof(ptr)) (__ptr + (off)); }) | ||
86 | |||
87 | +#if CONFIG_GCC_VERSION >= 110000 /* See gcc bug 100680. */ | ||
88 | +# define gcc11_wrap(x) RELOC_HIDE(x, 0) | ||
89 | +#else | ||
90 | +# define gcc11_wrap(x) (x) | ||
91 | +#endif | ||
92 | + | ||
93 | #ifdef __GCC_ASM_FLAG_OUTPUTS__ | ||
94 | # define ASM_FLAG_OUT(yes, no) yes | ||
95 | #else | ||
96 | diff --git a/xen/include/xen/pdx.h b/xen/include/xen/pdx.h | ||
97 | index 770fadc06c..9fcfb0ce52 100644 | ||
98 | --- a/xen/include/xen/pdx.h | ||
99 | +++ b/xen/include/xen/pdx.h | ||
100 | @@ -19,7 +19,7 @@ extern u64 pdx_region_mask(u64 base, u64 len); | ||
101 | extern void set_pdx_range(unsigned long smfn, unsigned long emfn); | ||
102 | |||
103 | #define page_to_pdx(pg) ((pg) - frame_table) | ||
104 | -#define pdx_to_page(pdx) (frame_table + (pdx)) | ||
105 | +#define pdx_to_page(pdx) gcc11_wrap(frame_table + (pdx)) | ||
106 | |||
107 | bool __mfn_valid(unsigned long mfn); | ||
108 | |||
109 | -- | ||
110 | 2.25.1 | ||
111 | |||
diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc index e939c459..3560e798 100644 --- a/recipes-extended/xen/xen-tools.inc +++ b/recipes-extended/xen/xen-tools.inc | |||
@@ -725,12 +725,9 @@ do_configure() { | |||
725 | do_configure_common | 725 | do_configure_common |
726 | } | 726 | } |
727 | 727 | ||
728 | # Workaround when compiling with gcc-11 | ||
729 | EXTRA_CFLAGS_XEN_TOOLS_append = " -Wno-vla-parameter" | ||
730 | |||
731 | do_compile() { | 728 | do_compile() { |
732 | cd ${S} | 729 | cd ${S} |
733 | oe_runmake tools EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" PYTHON="${PYTHON}" | 730 | oe_runmake tools PYTHON="${PYTHON}" |
734 | } | 731 | } |
735 | 732 | ||
736 | do_install() { | 733 | do_install() { |
diff --git a/recipes-extended/xen/xen-tools_4.14.bb b/recipes-extended/xen/xen-tools_4.14.bb index 10982a2c..6fd6f7fe 100644 --- a/recipes-extended/xen/xen-tools_4.14.bb +++ b/recipes-extended/xen/xen-tools_4.14.bb | |||
@@ -1,4 +1,4 @@ | |||
1 | SRCREV ?= "ad844aa352559a8b1f36e391a27d9d7dbddbdc36" | 1 | SRCREV ?= "b6a8c4f72def4d1135ff42660a86276ce2565c8c" |
2 | 2 | ||
3 | XEN_REL ?= "4.14" | 3 | XEN_REL ?= "4.14" |
4 | XEN_BRANCH ?= "stable-${XEN_REL}" | 4 | XEN_BRANCH ?= "stable-${XEN_REL}" |
@@ -8,6 +8,7 @@ SRC_URI = " \ | |||
8 | file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \ | 8 | file://0001-python-pygrub-pass-DISTUTILS-xen-4.14.patch \ |
9 | file://0001-firmware-provide-a-stand-alone-set-of-headers-Xen-4.14.patch \ | 9 | file://0001-firmware-provide-a-stand-alone-set-of-headers-Xen-4.14.patch \ |
10 | file://0001-tools-firmware-Build-firmware-as-ffreestanding-Xen-4.14.patch \ | 10 | file://0001-tools-firmware-Build-firmware-as-ffreestanding-Xen-4.14.patch \ |
11 | file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \ | ||
11 | " | 12 | " |
12 | 13 | ||
13 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" | 14 | 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 314dc52e..f3f9cd31 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}" | |||
6 | SRC_URI = " \ | 6 | SRC_URI = " \ |
7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ | 7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ |
8 | file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \ | 8 | file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \ |
9 | file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \ | ||
9 | " | 10 | " |
10 | 11 | ||
11 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" | 12 | 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 0188bddf..0b2dce9f 100644 --- a/recipes-extended/xen/xen-tools_git.bb +++ b/recipes-extended/xen/xen-tools_git.bb | |||
@@ -6,6 +6,7 @@ XEN_BRANCH ?= "master" | |||
6 | SRC_URI = " \ | 6 | SRC_URI = " \ |
7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ | 7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ |
8 | file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \ | 8 | file://0001-python-pygrub-pass-DISTUTILS-xen-4.15.patch \ |
9 | file://0001-libs-foreignmemory-Fix-osdep_xenforeignmemory_map-pr.patch \ | ||
9 | " | 10 | " |
10 | 11 | ||
11 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" | 12 | 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 653e3b63..0dd9d3c2 100644 --- a/recipes-extended/xen/xen_4.14.bb +++ b/recipes-extended/xen/xen_4.14.bb | |||
@@ -1,4 +1,4 @@ | |||
1 | SRCREV ?= "ad844aa352559a8b1f36e391a27d9d7dbddbdc36" | 1 | SRCREV ?= "b6a8c4f72def4d1135ff42660a86276ce2565c8c" |
2 | 2 | ||
3 | XEN_REL ?= "4.14" | 3 | XEN_REL ?= "4.14" |
4 | XEN_BRANCH ?= "stable-${XEN_REL}" | 4 | XEN_BRANCH ?= "stable-${XEN_REL}" |
diff --git a/recipes-extended/xen/xen_4.15.bb b/recipes-extended/xen/xen_4.15.bb index 2842c0af..d0aa1761 100644 --- a/recipes-extended/xen/xen_4.15.bb +++ b/recipes-extended/xen/xen_4.15.bb | |||
@@ -7,6 +7,7 @@ SRC_URI = " \ | |||
7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ | 7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ |
8 | file://xen-arm64-implement-atomic-fetch-add.patch \ | 8 | file://xen-arm64-implement-atomic-fetch-add.patch \ |
9 | file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \ | 9 | file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \ |
10 | file://0001-x86-make-hypervisor-build-with-gcc11.patch \ | ||
10 | " | 11 | " |
11 | 12 | ||
12 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" | 13 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" |
diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb index eaf39566..7ce72280 100644 --- a/recipes-extended/xen/xen_git.bb +++ b/recipes-extended/xen/xen_git.bb | |||
@@ -7,6 +7,7 @@ SRC_URI = " \ | |||
7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ | 7 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ |
8 | file://xen-arm64-implement-atomic-fetch-add.patch \ | 8 | file://xen-arm64-implement-atomic-fetch-add.patch \ |
9 | file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \ | 9 | file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-location.patch \ |
10 | file://0001-x86-make-hypervisor-build-with-gcc11.patch \ | ||
10 | " | 11 | " |
11 | 12 | ||
12 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" | 13 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=419739e325a50f3d7b4501338e44a4e5" |