diff options
author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2024-05-31 14:54:41 +0000 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2024-05-31 16:20:17 +0000 |
commit | 79a282078f83b5d5e9bc4ec10094cbc398fa4aef (patch) | |
tree | 15652d64b9881a8104747631f7b0d8748339ffc7 | |
parent | acb0653af096c1a2d4d212ef2f8dc420e9f09ad9 (diff) | |
download | meta-virtualization-79a282078f83b5d5e9bc4ec10094cbc398fa4aef.tar.gz |
xen: fix arm64 build with gcc14
gcc14 isn't properly tracking if the irq array index is
greater than zero, and hence generates a warning that
chains to a build error.
This is a temporary patch to ensure that the variable
is greater than zero and hence keeps the warning from
happening. If it was less than zero, a different way
of dealing with it "officially" would be better, but we
lack the insight to know what to do in this case (plus,
it really isn't less than zero as it has never caused
an issue before)
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r-- | recipes-extended/xen/files/0001-arm-silence-gcc14-warning-error-on-irq-bounds-check.patch | 68 | ||||
-rw-r--r-- | recipes-extended/xen/xen_4.18.bb | 1 |
2 files changed, 69 insertions, 0 deletions
diff --git a/recipes-extended/xen/files/0001-arm-silence-gcc14-warning-error-on-irq-bounds-check.patch b/recipes-extended/xen/files/0001-arm-silence-gcc14-warning-error-on-irq-bounds-check.patch new file mode 100644 index 00000000..a3dbbbb4 --- /dev/null +++ b/recipes-extended/xen/files/0001-arm-silence-gcc14-warning-error-on-irq-bounds-check.patch | |||
@@ -0,0 +1,68 @@ | |||
1 | From 2258853a19b2d0b1fafd901cddf69f730c38d450 Mon Sep 17 00:00:00 2001 | ||
2 | From: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
3 | Date: Fri, 31 May 2024 14:50:33 +0000 | ||
4 | Subject: [PATCH] arm: silence gcc14 warning (error) on irq bounds check | ||
5 | |||
6 | While we wait for upstream to update to gcc14, we add a quick | ||
7 | check to avoid gcc14 not being able to confirm that IRQ is | ||
8 | greater than 0 and hence throws a warning, which leads to an | ||
9 | error. | ||
10 | |||
11 | | In function '__irq_to_desc', | ||
12 | | inlined from 'route_irq_to_guest' at arch/arm/irq.c:467:12: | ||
13 | | arch/arm/irq.c:65:16: error: array subscript -2 is below array bounds of 'irq_desc_t[32]' {aka 'struct irq_desc[32]'} [-Werror=array-bounds=] | ||
14 | | 65 | return &this_cpu(local_irq_desc)[irq]; | ||
15 | | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
16 | |||
17 | Upstream-Status: Pending [the xen folks understand the code and the right fix .. I don't] | ||
18 | |||
19 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
20 | --- | ||
21 | xen/arch/arm/irq.c | 19 ++++++++++++------- | ||
22 | 1 file changed, 12 insertions(+), 7 deletions(-) | ||
23 | |||
24 | diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c | ||
25 | index ae69fb4aeb..dcac86bd84 100644 | ||
26 | --- a/xen/arch/arm/irq.c | ||
27 | +++ b/xen/arch/arm/irq.c | ||
28 | @@ -58,8 +58,13 @@ hw_irq_controller no_irq_type = { | ||
29 | static irq_desc_t irq_desc[NR_IRQS]; | ||
30 | static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc); | ||
31 | |||
32 | + | ||
33 | struct irq_desc *__irq_to_desc(int irq) | ||
34 | { | ||
35 | + /* silence gcc14 warning */ | ||
36 | + if ( irq < 0 ) | ||
37 | + return &this_cpu(local_irq_desc)[0]; | ||
38 | + | ||
39 | if ( irq < NR_LOCAL_IRQS ) | ||
40 | return &this_cpu(local_irq_desc)[irq]; | ||
41 | |||
42 | @@ -723,16 +728,16 @@ int platform_get_irq(const struct dt_device_node *device, int index) | ||
43 | |||
44 | int platform_get_irq_byname(const struct dt_device_node *np, const char *name) | ||
45 | { | ||
46 | - int index; | ||
47 | + int index; | ||
48 | |||
49 | - if ( unlikely(!name) ) | ||
50 | - return -EINVAL; | ||
51 | + if ( unlikely(!name) ) | ||
52 | + return -EINVAL; | ||
53 | |||
54 | - index = dt_property_match_string(np, "interrupt-names", name); | ||
55 | - if ( index < 0 ) | ||
56 | - return index; | ||
57 | + index = dt_property_match_string(np, "interrupt-names", name); | ||
58 | + if ( index < 0 ) | ||
59 | + return index; | ||
60 | |||
61 | - return platform_get_irq(np, index); | ||
62 | + return platform_get_irq(np, index); | ||
63 | } | ||
64 | |||
65 | /* | ||
66 | -- | ||
67 | 2.39.2 | ||
68 | |||
diff --git a/recipes-extended/xen/xen_4.18.bb b/recipes-extended/xen/xen_4.18.bb index 4f235bd3..d0b19013 100644 --- a/recipes-extended/xen/xen_4.18.bb +++ b/recipes-extended/xen/xen_4.18.bb | |||
@@ -7,6 +7,7 @@ XEN_BRANCH ?= "stable-4.18" | |||
7 | SRC_URI = " \ | 7 | SRC_URI = " \ |
8 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ | 8 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ |
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-arm-silence-gcc14-warning-error-on-irq-bounds-check.patch \ | ||
10 | " | 11 | " |
11 | 12 | ||
12 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=d1a1e216f80b6d8da95fec897d0dbec9" | 13 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=d1a1e216f80b6d8da95fec897d0dbec9" |