1
Arm patch queue -- these are all bug fix patches but we might
1
Almost nothing in here is arm-related, but the target-arm
2
as well put them in to rc0...
2
queue was convenient for these last minute bits and pieces
3
for 5.0...
3
4
4
thanks
5
thanks
5
-- PMM
6
-- PMM
6
7
7
The following changes since commit 2c8cfc0b52b5a4d123c26c0b5fdf941be24805be:
8
The following changes since commit 14e5526b51910efd62cd31cd95b49baca975c83f:
8
9
9
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2018-03-19 11:44:26 +0000)
10
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2020-04-13 15:42:51 +0100)
10
11
11
are available in the Git repository at:
12
are available in the Git repository at:
12
13
13
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180319
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200414
14
15
15
for you to fetch changes up to ff72cb6b46b95bb530787add5277c211af3d31c6:
16
for you to fetch changes up to 84f82ddcbb4ac4ed04c8675e85155329f23184f0:
16
17
17
hw/arm/raspi: Provide spin-loop code for AArch64 CPUs (2018-03-19 18:23:24 +0000)
18
Deprecate KVM support for AArch32 (2020-04-14 17:20:22 +0100)
18
19
19
----------------------------------------------------------------
20
----------------------------------------------------------------
20
target-arm queue:
21
patch queue:
21
* fsl-imx6: Fix incorrect Ethernet interrupt defines
22
* Fix some problems that trip up Coverity's scanner
22
* dump: Update correct kdump phys_base field for AArch64
23
* run-coverity-scan: New script automating the scan-and-upload process
23
* char: i.MX: Add support for "TX complete" interrupt
24
* docs: Improve our gdbstub documentation
24
* bcm2836/raspi: Fix various bugs resulting in panics trying
25
* configure: Honour --disable-werror for Sphinx
25
to boot a Debian Linux kernel on raspi3
26
* docs: Fix errors produced when building with Sphinx 3.0
27
* docs: Require Sphinx 1.6 or better
28
* Add deprecation notice for KVM support on AArch32 hosts
26
29
27
----------------------------------------------------------------
30
----------------------------------------------------------------
28
Andrey Smirnov (2):
31
Peter Maydell (12):
29
char: i.MX: Simplify imx_update()
32
osdep.h: Drop no-longer-needed Coverity workarounds
30
char: i.MX: Add support for "TX complete" interrupt
33
thread.h: Fix Coverity version of qemu_cond_timedwait()
34
thread.h: Remove trailing semicolons from Coverity qemu_mutex_lock() etc
35
linux-user/flatload.c: Use "" for include of QEMU header target_flat.h
36
scripts/run-coverity-scan: Script to run Coverity Scan build
37
scripts/coverity-scan: Add Docker support
38
docs: Improve our gdbstub documentation
39
configure: Honour --disable-werror for Sphinx
40
scripts/kernel-doc: Add missing close-paren in c:function directives
41
kernel-doc: Use c:struct for Sphinx 3.0 and later
42
docs: Require Sphinx 1.6 or better
43
Deprecate KVM support for AArch32
31
44
32
Guenter Roeck (1):
45
configure | 9 +-
33
fsl-imx6: Swap Ethernet interrupt defines
46
Makefile | 2 +-
47
include/qemu/osdep.h | 14 -
48
include/qemu/thread.h | 12 +-
49
linux-user/flatload.c | 2 +-
50
MAINTAINERS | 5 +
51
docs/conf.py | 6 +-
52
docs/sphinx/kerneldoc.py | 1 +
53
docs/system/deprecated.rst | 8 +
54
docs/system/gdb.rst | 22 +-
55
qemu-options.hx | 24 +-
56
scripts/coverity-scan/coverity-scan.docker | 131 ++++++++++
57
scripts/coverity-scan/run-coverity-scan | 401 +++++++++++++++++++++++++++++
58
scripts/kernel-doc | 18 +-
59
14 files changed, 615 insertions(+), 40 deletions(-)
60
create mode 100644 scripts/coverity-scan/coverity-scan.docker
61
create mode 100755 scripts/coverity-scan/run-coverity-scan
34
62
35
Peter Maydell (9):
36
hw/arm/raspi: Don't do board-setup or secure-boot for raspi3
37
hw/arm/boot: assert that secure_boot and secure_board_setup are false for AArch64
38
hw/arm/boot: If booting a kernel in EL2, set SCR_EL3.HCE
39
hw/arm/bcm2386: Fix parent type of bcm2386
40
hw/arm/bcm2836: Rename bcm2836 type/struct to bcm283x
41
hw/arm/bcm2836: Create proper bcm2837 device
42
hw/arm/bcm2836: Use correct affinity values for BCM2837
43
hw/arm/bcm2836: Hardcode correct CPU type
44
hw/arm/raspi: Provide spin-loop code for AArch64 CPUs
45
46
Wei Huang (1):
47
dump: Update correct kdump phys_base field for AArch64
48
49
include/hw/arm/bcm2836.h | 31 +++++++++++++---
50
include/hw/arm/fsl-imx6.h | 4 +-
51
include/hw/char/imx_serial.h | 3 ++
52
dump.c | 14 +++++--
53
hw/arm/bcm2836.c | 87 +++++++++++++++++++++++++++++++-------------
54
hw/arm/boot.c | 12 ++++++
55
hw/arm/raspi.c | 77 +++++++++++++++++++++++++++++++--------
56
hw/char/imx_serial.c | 44 ++++++++++++++++------
57
hw/net/imx_fec.c | 28 +++++++++++++-
58
9 files changed, 237 insertions(+), 63 deletions(-)
59
diff view generated by jsdifflib
Deleted patch
1
From: Guenter Roeck <linux@roeck-us.net>
2
1
3
The sabrelite machine model used by qemu-system-arm is based on the
4
Freescale/NXP i.MX6Q processor. This SoC has an on-board ethernet
5
controller which is supported in QEMU using the imx_fec.c module
6
(actually called imx.enet for this model.)
7
8
The include/hw/arm/fsm-imx6.h file defines the interrupt vectors for the
9
imx.enet device like this:
10
11
#define FSL_IMX6_ENET_MAC_1588_IRQ 118
12
#define FSL_IMX6_ENET_MAC_IRQ 119
13
14
According to https://www.nxp.com/docs/en/reference-manual/IMX6DQRM.pdf,
15
page 225, in Table 3-1. ARM Cortex A9 domain interrupt summary,
16
interrupts are as follows.
17
18
150 ENET MAC 0 IRQ
19
151 ENET MAC 0 1588 Timer interrupt
20
21
where
22
23
150 - 32 == 118
24
151 - 32 == 119
25
26
In other words, the vector definitions in the fsl-imx6.h file are reversed.
27
28
Fixing the interrupts alone causes problems with older Linux kernels:
29
The Ethernet interface will fail to probe with Linux v4.9 and earlier.
30
Linux v4.1 and earlier will crash due to a bug in Ethernet driver probe
31
error handling. This is a Linux kernel problem, not a qemu problem:
32
the Linux kernel only worked by accident since it requested both interrupts.
33
34
For backward compatibility, generate the Ethernet interrupt on both interrupt
35
lines. This was shown to work from all Linux kernel releases starting with
36
v3.16.
37
38
Link: https://bugs.launchpad.net/qemu/+bug/1753309
39
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
40
Message-id: 1520723090-22130-1-git-send-email-linux@roeck-us.net
41
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
42
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
43
---
44
include/hw/arm/fsl-imx6.h | 4 ++--
45
hw/net/imx_fec.c | 28 +++++++++++++++++++++++++++-
46
2 files changed, 29 insertions(+), 3 deletions(-)
47
48
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
49
index XXXXXXX..XXXXXXX 100644
50
--- a/include/hw/arm/fsl-imx6.h
51
+++ b/include/hw/arm/fsl-imx6.h
52
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6State {
53
#define FSL_IMX6_HDMI_MASTER_IRQ 115
54
#define FSL_IMX6_HDMI_CEC_IRQ 116
55
#define FSL_IMX6_MLB150_LOW_IRQ 117
56
-#define FSL_IMX6_ENET_MAC_1588_IRQ 118
57
-#define FSL_IMX6_ENET_MAC_IRQ 119
58
+#define FSL_IMX6_ENET_MAC_IRQ 118
59
+#define FSL_IMX6_ENET_MAC_1588_IRQ 119
60
#define FSL_IMX6_PCIE1_IRQ 120
61
#define FSL_IMX6_PCIE2_IRQ 121
62
#define FSL_IMX6_PCIE3_IRQ 122
63
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/hw/net/imx_fec.c
66
+++ b/hw/net/imx_fec.c
67
@@ -XXX,XX +XXX,XX @@ static void imx_enet_write_bd(IMXENETBufDesc *bd, dma_addr_t addr)
68
69
static void imx_eth_update(IMXFECState *s)
70
{
71
- if (s->regs[ENET_EIR] & s->regs[ENET_EIMR] & ENET_INT_TS_TIMER) {
72
+ /*
73
+ * Previous versions of qemu had the ENET_INT_MAC and ENET_INT_TS_TIMER
74
+ * interrupts swapped. This worked with older versions of Linux (4.14
75
+ * and older) since Linux associated both interrupt lines with Ethernet
76
+ * MAC interrupts. Specifically,
77
+ * - Linux 4.15 and later have separate interrupt handlers for the MAC and
78
+ * timer interrupts. Those versions of Linux fail with versions of QEMU
79
+ * with swapped interrupt assignments.
80
+ * - In linux 4.14, both interrupt lines were registered with the Ethernet
81
+ * MAC interrupt handler. As a result, all versions of qemu happen to
82
+ * work, though that is accidental.
83
+ * - In Linux 4.9 and older, the timer interrupt was registered directly
84
+ * with the Ethernet MAC interrupt handler. The MAC interrupt was
85
+ * redirected to a GPIO interrupt to work around erratum ERR006687.
86
+ * This was implemented using the SOC's IOMUX block. In qemu, this GPIO
87
+ * interrupt never fired since IOMUX is currently not supported in qemu.
88
+ * Linux instead received MAC interrupts on the timer interrupt.
89
+ * As a result, qemu versions with the swapped interrupt assignment work,
90
+ * albeit accidentally, but qemu versions with the correct interrupt
91
+ * assignment fail.
92
+ *
93
+ * To ensure that all versions of Linux work, generate ENET_INT_MAC
94
+ * interrrupts on both interrupt lines. This should be changed if and when
95
+ * qemu supports IOMUX.
96
+ */
97
+ if (s->regs[ENET_EIR] & s->regs[ENET_EIMR] &
98
+ (ENET_INT_MAC | ENET_INT_TS_TIMER)) {
99
qemu_set_irq(s->irq[1], 1);
100
} else {
101
qemu_set_irq(s->irq[1], 0);
102
--
103
2.16.2
104
105
diff view generated by jsdifflib
1
Now we have separate types for BCM2386 and BCM2387, we might as well
1
In commit a1a98357e3fd in 2018 we added some workarounds for Coverity
2
just hard-code the CPU type they use rather than having it passed
2
not being able to handle the _Float* types introduced by recent
3
through as an object property. This then lets us put the initialization
3
glibc. Newer versions of the Coverity scan tools have support for
4
of the CPU object in init rather than realize.
4
these types, and will fail with errors about duplicate typedefs if we
5
5
have our workaround. Remove our copy of the typedefs.
6
Note that this change means that it's no longer possible on
7
the command line to use -cpu to ask for a different kind of
8
CPU than the SoC supports. This was never a supported thing to
9
do anyway; we were just not sanity-checking the command line.
10
11
This does require us to only build the bcm2837 object on
12
TARGET_AARCH64 configs, since otherwise it won't instantiate
13
due to the missing cortex-a53 device and "make check" will fail.
14
6
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 20200319193323.2038-2-peter.maydell@linaro.org
18
Message-id: 20180313153458.26822-9-peter.maydell@linaro.org
19
---
10
---
20
hw/arm/bcm2836.c | 24 +++++++++++++++---------
11
include/qemu/osdep.h | 14 --------------
21
hw/arm/raspi.c | 2 --
12
1 file changed, 14 deletions(-)
22
2 files changed, 15 insertions(+), 11 deletions(-)
23
13
24
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
14
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
25
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/arm/bcm2836.c
16
--- a/include/qemu/osdep.h
27
+++ b/hw/arm/bcm2836.c
17
+++ b/include/qemu/osdep.h
28
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@
29
19
#else
30
struct BCM283XInfo {
20
#include "exec/poison.h"
31
const char *name;
21
#endif
32
+ const char *cpu_type;
22
-#ifdef __COVERITY__
33
int clusterid;
23
-/* Coverity does not like the new _Float* types that are used by
34
};
24
- * recent glibc, and croaks on every single file that includes
35
25
- * stdlib.h. These typedefs are enough to please it.
36
static const BCM283XInfo bcm283x_socs[] = {
26
- *
37
{
27
- * Note that these fix parse errors so they cannot be placed in
38
.name = TYPE_BCM2836,
28
- * scripts/coverity-model.c.
39
+ .cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"),
29
- */
40
.clusterid = 0xf,
30
-typedef float _Float32;
41
},
31
-typedef double _Float32x;
42
+#ifdef TARGET_AARCH64
32
-typedef double _Float64;
43
{
33
-typedef __float80 _Float64x;
44
.name = TYPE_BCM2837,
34
-typedef __float128 _Float128;
45
+ .cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"),
35
-#endif
46
.clusterid = 0x0,
36
47
},
37
#include "qemu/compiler.h"
48
+#endif
38
49
};
50
51
static void bcm2836_init(Object *obj)
52
{
53
BCM283XState *s = BCM283X(obj);
54
+ BCM283XClass *bc = BCM283X_GET_CLASS(obj);
55
+ const BCM283XInfo *info = bc->info;
56
+ int n;
57
+
58
+ for (n = 0; n < BCM283X_NCPUS; n++) {
59
+ object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
60
+ info->cpu_type);
61
+ object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
62
+ &error_abort);
63
+ }
64
65
object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL);
66
object_property_add_child(obj, "control", OBJECT(&s->control), NULL);
67
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
68
69
/* common peripherals from bcm2835 */
70
71
- obj = OBJECT(dev);
72
- for (n = 0; n < BCM283X_NCPUS; n++) {
73
- object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
74
- s->cpu_type);
75
- object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
76
- &error_abort);
77
- }
78
-
79
obj = object_property_get_link(OBJECT(dev), "ram", &err);
80
if (obj == NULL) {
81
error_setg(errp, "%s: required ram link not found: %s",
82
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
83
}
84
85
static Property bcm2836_props[] = {
86
- DEFINE_PROP_STRING("cpu-type", BCM283XState, cpu_type),
87
DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus,
88
BCM283X_NCPUS),
89
DEFINE_PROP_END_OF_LIST()
90
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
91
index XXXXXXX..XXXXXXX 100644
92
--- a/hw/arm/raspi.c
93
+++ b/hw/arm/raspi.c
94
@@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version)
95
/* Setup the SOC */
96
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram),
97
&error_abort);
98
- object_property_set_str(OBJECT(&s->soc), machine->cpu_type, "cpu-type",
99
- &error_abort);
100
object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus",
101
&error_abort);
102
int board_rev = version == 3 ? 0xa02082 : 0xa21041;
103
--
39
--
104
2.16.2
40
2.20.1
105
41
106
42
diff view generated by jsdifflib
1
The BCM2837 sets the Aff1 field of the MPIDR affinity values for the
1
For Coverity's benefit, we provide simpler versions of functions like
2
CPUs to 0, whereas the BCM2836 uses 0xf. Set this correctly, as it
2
qemu_mutex_lock(), qemu_cond_wait() and qemu_cond_timedwait(). When
3
is required for Linux to boot.
3
we added qemu_cond_timedwait() in commit 3dcc9c6ec4ea, a cut and
4
paste error meant that the Coverity version of qemu_cond_timedwait()
5
was using the wrong _impl function, which makes the Coverity parser
6
complain:
7
8
"/qemu/include/qemu/thread.h", line 159: warning #140: too many arguments in
9
function call
10
return qemu_cond_timedwait(cond, mutex, ms);
11
^
12
13
"/qemu/include/qemu/thread.h", line 159: warning #120: return value type does
14
not match the function type
15
return qemu_cond_timedwait(cond, mutex, ms);
16
^
17
18
"/qemu/include/qemu/thread.h", line 156: warning #1563: function
19
"qemu_cond_timedwait" not emitted, consider modeling it or review
20
parse diagnostics to improve fidelity
21
static inline bool (qemu_cond_timedwait)(QemuCond *cond, QemuMutex *mutex,
22
^
23
24
These aren't fatal, but reduce the scope of the analysis. Fix the error.
4
25
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
27
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
28
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Message-id: 20180313153458.26822-8-peter.maydell@linaro.org
29
Message-id: 20200319193323.2038-3-peter.maydell@linaro.org
9
---
30
---
10
hw/arm/bcm2836.c | 11 +++++++----
31
include/qemu/thread.h | 2 +-
11
1 file changed, 7 insertions(+), 4 deletions(-)
32
1 file changed, 1 insertion(+), 1 deletion(-)
12
33
13
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
34
diff --git a/include/qemu/thread.h b/include/qemu/thread.h
14
index XXXXXXX..XXXXXXX 100644
35
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/bcm2836.c
36
--- a/include/qemu/thread.h
16
+++ b/hw/arm/bcm2836.c
37
+++ b/include/qemu/thread.h
17
@@ -XXX,XX +XXX,XX @@
38
@@ -XXX,XX +XXX,XX @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func;
18
39
#define qemu_cond_wait(c, m) \
19
struct BCM283XInfo {
40
qemu_cond_wait_impl(c, m, __FILE__, __LINE__);
20
const char *name;
41
#define qemu_cond_timedwait(c, m, ms) \
21
+ int clusterid;
42
- qemu_cond_wait_impl(c, m, ms, __FILE__, __LINE__);
22
};
43
+ qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__);
23
44
#else
24
static const BCM283XInfo bcm283x_socs[] = {
45
#define qemu_mutex_lock(m) ({ \
25
{
46
QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \
26
.name = TYPE_BCM2836,
27
+ .clusterid = 0xf,
28
},
29
{
30
.name = TYPE_BCM2837,
31
+ .clusterid = 0x0,
32
},
33
};
34
35
@@ -XXX,XX +XXX,XX @@ static void bcm2836_init(Object *obj)
36
static void bcm2836_realize(DeviceState *dev, Error **errp)
37
{
38
BCM283XState *s = BCM283X(dev);
39
+ BCM283XClass *bc = BCM283X_GET_CLASS(dev);
40
+ const BCM283XInfo *info = bc->info;
41
Object *obj;
42
Error *err = NULL;
43
int n;
44
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
45
qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0));
46
47
for (n = 0; n < BCM283X_NCPUS; n++) {
48
- /* Mirror bcm2836, which has clusterid set to 0xf
49
- * TODO: this should be converted to a property of ARM_CPU
50
- */
51
- s->cpus[n].mp_affinity = 0xF00 | n;
52
+ /* TODO: this should be converted to a property of ARM_CPU */
53
+ s->cpus[n].mp_affinity = (info->clusterid << 8) | n;
54
55
/* set periphbase/CBAR value for CPU-local registers */
56
object_property_set_int(OBJECT(&s->cpus[n]),
57
--
47
--
58
2.16.2
48
2.20.1
59
49
60
50
diff view generated by jsdifflib
1
Our BCM2836 type is really a generic one that can be any of
1
All the Coverity-specific definitions of qemu_mutex_lock() and friends
2
the bcm283x family. Rename it accordingly. We change only
2
have a trailing semicolon. This works fine almost everywhere because
3
the names which are visible via the header file to the
3
of QEMU's mandatory-braces coding style and because most callsites are
4
rest of the QEMU code, leaving private function names
4
simple, but target/s390x/sigp.c has a use of qemu_mutex_trylock() as
5
in bcm2836.c as they are.
5
an if() statement, which makes the ';' a syntax error:
6
"../target/s390x/sigp.c", line 461: warning #18: expected a ")"
7
if (qemu_mutex_trylock(&qemu_sigp_mutex)) {
8
^
6
9
7
This is a preliminary to making bcm283x be an abstract
10
Remove the bogus semicolons from the macro definitions.
8
parent class to specific types for the bcm2836 and bcm2837.
9
11
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Message-id: 20180313153458.26822-6-peter.maydell@linaro.org
15
Message-id: 20200319193323.2038-4-peter.maydell@linaro.org
14
---
16
---
15
include/hw/arm/bcm2836.h | 12 ++++++------
17
include/qemu/thread.h | 12 ++++++------
16
hw/arm/bcm2836.c | 17 +++++++++--------
18
1 file changed, 6 insertions(+), 6 deletions(-)
17
hw/arm/raspi.c | 16 ++++++++--------
18
3 files changed, 23 insertions(+), 22 deletions(-)
19
19
20
diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h
20
diff --git a/include/qemu/thread.h b/include/qemu/thread.h
21
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/arm/bcm2836.h
22
--- a/include/qemu/thread.h
23
+++ b/include/hw/arm/bcm2836.h
23
+++ b/include/qemu/thread.h
24
@@ -XXX,XX +XXX,XX @@
24
@@ -XXX,XX +XXX,XX @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func;
25
#include "hw/arm/bcm2835_peripherals.h"
25
* hide them.
26
#include "hw/intc/bcm2836_control.h"
26
*/
27
27
#define qemu_mutex_lock(m) \
28
-#define TYPE_BCM2836 "bcm2836"
28
- qemu_mutex_lock_impl(m, __FILE__, __LINE__);
29
-#define BCM2836(obj) OBJECT_CHECK(BCM2836State, (obj), TYPE_BCM2836)
29
+ qemu_mutex_lock_impl(m, __FILE__, __LINE__)
30
+#define TYPE_BCM283X "bcm283x"
30
#define qemu_mutex_trylock(m) \
31
+#define BCM283X(obj) OBJECT_CHECK(BCM283XState, (obj), TYPE_BCM283X)
31
- qemu_mutex_trylock_impl(m, __FILE__, __LINE__);
32
32
+ qemu_mutex_trylock_impl(m, __FILE__, __LINE__)
33
-#define BCM2836_NCPUS 4
33
#define qemu_rec_mutex_lock(m) \
34
+#define BCM283X_NCPUS 4
34
- qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__);
35
35
+ qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__)
36
-typedef struct BCM2836State {
36
#define qemu_rec_mutex_trylock(m) \
37
+typedef struct BCM283XState {
37
- qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__);
38
/*< private >*/
38
+ qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__)
39
DeviceState parent_obj;
39
#define qemu_cond_wait(c, m) \
40
/*< public >*/
40
- qemu_cond_wait_impl(c, m, __FILE__, __LINE__);
41
@@ -XXX,XX +XXX,XX @@ typedef struct BCM2836State {
41
+ qemu_cond_wait_impl(c, m, __FILE__, __LINE__)
42
char *cpu_type;
42
#define qemu_cond_timedwait(c, m, ms) \
43
uint32_t enabled_cpus;
43
- qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__);
44
44
+ qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__)
45
- ARMCPU cpus[BCM2836_NCPUS];
45
#else
46
+ ARMCPU cpus[BCM283X_NCPUS];
46
#define qemu_mutex_lock(m) ({ \
47
BCM2836ControlState control;
47
QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \
48
BCM2835PeripheralState peripherals;
49
-} BCM2836State;
50
+} BCM283XState;
51
52
#endif /* BCM2836_H */
53
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
54
index XXXXXXX..XXXXXXX 100644
55
--- a/hw/arm/bcm2836.c
56
+++ b/hw/arm/bcm2836.c
57
@@ -XXX,XX +XXX,XX @@
58
59
static void bcm2836_init(Object *obj)
60
{
61
- BCM2836State *s = BCM2836(obj);
62
+ BCM283XState *s = BCM283X(obj);
63
64
object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL);
65
object_property_add_child(obj, "control", OBJECT(&s->control), NULL);
66
@@ -XXX,XX +XXX,XX @@ static void bcm2836_init(Object *obj)
67
68
static void bcm2836_realize(DeviceState *dev, Error **errp)
69
{
70
- BCM2836State *s = BCM2836(dev);
71
+ BCM283XState *s = BCM283X(dev);
72
Object *obj;
73
Error *err = NULL;
74
int n;
75
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
76
/* common peripherals from bcm2835 */
77
78
obj = OBJECT(dev);
79
- for (n = 0; n < BCM2836_NCPUS; n++) {
80
+ for (n = 0; n < BCM283X_NCPUS; n++) {
81
object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
82
s->cpu_type);
83
object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
84
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
85
sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1,
86
qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0));
87
88
- for (n = 0; n < BCM2836_NCPUS; n++) {
89
+ for (n = 0; n < BCM283X_NCPUS; n++) {
90
/* Mirror bcm2836, which has clusterid set to 0xf
91
* TODO: this should be converted to a property of ARM_CPU
92
*/
93
@@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
94
}
95
96
static Property bcm2836_props[] = {
97
- DEFINE_PROP_STRING("cpu-type", BCM2836State, cpu_type),
98
- DEFINE_PROP_UINT32("enabled-cpus", BCM2836State, enabled_cpus, BCM2836_NCPUS),
99
+ DEFINE_PROP_STRING("cpu-type", BCM283XState, cpu_type),
100
+ DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus,
101
+ BCM283X_NCPUS),
102
DEFINE_PROP_END_OF_LIST()
103
};
104
105
@@ -XXX,XX +XXX,XX @@ static void bcm2836_class_init(ObjectClass *oc, void *data)
106
}
107
108
static const TypeInfo bcm2836_type_info = {
109
- .name = TYPE_BCM2836,
110
+ .name = TYPE_BCM283X,
111
.parent = TYPE_DEVICE,
112
- .instance_size = sizeof(BCM2836State),
113
+ .instance_size = sizeof(BCM283XState),
114
.instance_init = bcm2836_init,
115
.class_init = bcm2836_class_init,
116
};
117
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
118
index XXXXXXX..XXXXXXX 100644
119
--- a/hw/arm/raspi.c
120
+++ b/hw/arm/raspi.c
121
@@ -XXX,XX +XXX,XX @@
122
static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};
123
124
typedef struct RasPiState {
125
- BCM2836State soc;
126
+ BCM283XState soc;
127
MemoryRegion ram;
128
} RasPiState;
129
130
@@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version)
131
BusState *bus;
132
DeviceState *carddev;
133
134
- object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM2836);
135
+ object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM283X);
136
object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
137
&error_abort);
138
139
@@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc)
140
mc->no_floppy = 1;
141
mc->no_cdrom = 1;
142
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
143
- mc->max_cpus = BCM2836_NCPUS;
144
- mc->min_cpus = BCM2836_NCPUS;
145
- mc->default_cpus = BCM2836_NCPUS;
146
+ mc->max_cpus = BCM283X_NCPUS;
147
+ mc->min_cpus = BCM283X_NCPUS;
148
+ mc->default_cpus = BCM283X_NCPUS;
149
mc->default_ram_size = 1024 * 1024 * 1024;
150
mc->ignore_memory_transaction_failures = true;
151
};
152
@@ -XXX,XX +XXX,XX @@ static void raspi3_machine_init(MachineClass *mc)
153
mc->no_floppy = 1;
154
mc->no_cdrom = 1;
155
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53");
156
- mc->max_cpus = BCM2836_NCPUS;
157
- mc->min_cpus = BCM2836_NCPUS;
158
- mc->default_cpus = BCM2836_NCPUS;
159
+ mc->max_cpus = BCM283X_NCPUS;
160
+ mc->min_cpus = BCM283X_NCPUS;
161
+ mc->default_cpus = BCM283X_NCPUS;
162
mc->default_ram_size = 1024 * 1024 * 1024;
163
}
164
DEFINE_MACHINE("raspi3", raspi3_machine_init)
165
--
48
--
166
2.16.2
49
2.20.1
167
50
168
51
diff view generated by jsdifflib
1
The bcm2837 is pretty similar to the bcm2836, but it does have
1
The target_flat.h file is a QEMU header, so we should include it using
2
some differences. Notably, the MPIDR affinity aff1 values it
2
quotes, not angle brackets.
3
sets for the CPUs are 0x0, rather than the 0xf that the bcm2836
4
uses, and if this is wrong Linux will not boot.
5
3
6
Rather than trying to have one device with properties that
4
Coverity otherwise is unable to find the header:
7
configure it differently for the two cases, create two
5
8
separate QOM devices for the two SoCs. We use the same approach
6
"../linux-user/flatload.c", line 40: error #1712: cannot open source file
9
as hw/arm/aspeed_soc.c and share code and have a data table
7
"target_flat.h"
10
that might differ per-SoC. For the moment the two types don't
8
#include <target_flat.h>
11
actually have different behaviour.
9
^
10
11
because the relevant directory is only on the -iquote path, not the -I path.
12
12
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20180313153458.26822-7-peter.maydell@linaro.org
15
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
16
Message-id: 20200319193323.2038-5-peter.maydell@linaro.org
16
---
17
---
17
include/hw/arm/bcm2836.h | 19 +++++++++++++++++++
18
linux-user/flatload.c | 2 +-
18
hw/arm/bcm2836.c | 37 ++++++++++++++++++++++++++++++++-----
19
1 file changed, 1 insertion(+), 1 deletion(-)
19
hw/arm/raspi.c | 3 ++-
20
3 files changed, 53 insertions(+), 6 deletions(-)
21
20
22
diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h
21
diff --git a/linux-user/flatload.c b/linux-user/flatload.c
23
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
24
--- a/include/hw/arm/bcm2836.h
23
--- a/linux-user/flatload.c
25
+++ b/include/hw/arm/bcm2836.h
24
+++ b/linux-user/flatload.c
26
@@ -XXX,XX +XXX,XX @@
25
@@ -XXX,XX +XXX,XX @@
27
26
28
#define BCM283X_NCPUS 4
27
#include "qemu.h"
29
28
#include "flat.h"
30
+/* These type names are for specific SoCs; other than instantiating
29
-#include <target_flat.h>
31
+ * them, code using these devices should always handle them via the
30
+#include "target_flat.h"
32
+ * BCM283x base class, so they have no BCM2836(obj) etc macros.
31
33
+ */
32
//#define DEBUG
34
+#define TYPE_BCM2836 "bcm2836"
35
+#define TYPE_BCM2837 "bcm2837"
36
+
37
typedef struct BCM283XState {
38
/*< private >*/
39
DeviceState parent_obj;
40
@@ -XXX,XX +XXX,XX @@ typedef struct BCM283XState {
41
BCM2835PeripheralState peripherals;
42
} BCM283XState;
43
44
+typedef struct BCM283XInfo BCM283XInfo;
45
+
46
+typedef struct BCM283XClass {
47
+ DeviceClass parent_class;
48
+ const BCM283XInfo *info;
49
+} BCM283XClass;
50
+
51
+#define BCM283X_CLASS(klass) \
52
+ OBJECT_CLASS_CHECK(BCM283XClass, (klass), TYPE_BCM283X)
53
+#define BCM283X_GET_CLASS(obj) \
54
+ OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X)
55
+
56
#endif /* BCM2836_H */
57
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
58
index XXXXXXX..XXXXXXX 100644
59
--- a/hw/arm/bcm2836.c
60
+++ b/hw/arm/bcm2836.c
61
@@ -XXX,XX +XXX,XX @@
62
/* "QA7" (Pi2) interrupt controller and mailboxes etc. */
63
#define BCM2836_CONTROL_BASE 0x40000000
64
65
+struct BCM283XInfo {
66
+ const char *name;
67
+};
68
+
69
+static const BCM283XInfo bcm283x_socs[] = {
70
+ {
71
+ .name = TYPE_BCM2836,
72
+ },
73
+ {
74
+ .name = TYPE_BCM2837,
75
+ },
76
+};
77
+
78
static void bcm2836_init(Object *obj)
79
{
80
BCM283XState *s = BCM283X(obj);
81
@@ -XXX,XX +XXX,XX @@ static Property bcm2836_props[] = {
82
DEFINE_PROP_END_OF_LIST()
83
};
84
85
-static void bcm2836_class_init(ObjectClass *oc, void *data)
86
+static void bcm283x_class_init(ObjectClass *oc, void *data)
87
{
88
DeviceClass *dc = DEVICE_CLASS(oc);
89
+ BCM283XClass *bc = BCM283X_CLASS(oc);
90
91
- dc->props = bcm2836_props;
92
+ bc->info = data;
93
dc->realize = bcm2836_realize;
94
+ dc->props = bcm2836_props;
95
}
96
97
-static const TypeInfo bcm2836_type_info = {
98
+static const TypeInfo bcm283x_type_info = {
99
.name = TYPE_BCM283X,
100
.parent = TYPE_DEVICE,
101
.instance_size = sizeof(BCM283XState),
102
.instance_init = bcm2836_init,
103
- .class_init = bcm2836_class_init,
104
+ .class_size = sizeof(BCM283XClass),
105
+ .abstract = true,
106
};
107
108
static void bcm2836_register_types(void)
109
{
110
- type_register_static(&bcm2836_type_info);
111
+ int i;
112
+
113
+ type_register_static(&bcm283x_type_info);
114
+ for (i = 0; i < ARRAY_SIZE(bcm283x_socs); i++) {
115
+ TypeInfo ti = {
116
+ .name = bcm283x_socs[i].name,
117
+ .parent = TYPE_BCM283X,
118
+ .class_init = bcm283x_class_init,
119
+ .class_data = (void *) &bcm283x_socs[i],
120
+ };
121
+ type_register(&ti);
122
+ }
123
}
124
125
type_init(bcm2836_register_types)
126
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
127
index XXXXXXX..XXXXXXX 100644
128
--- a/hw/arm/raspi.c
129
+++ b/hw/arm/raspi.c
130
@@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version)
131
BusState *bus;
132
DeviceState *carddev;
133
134
- object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM283X);
135
+ object_initialize(&s->soc, sizeof(s->soc),
136
+ version == 3 ? TYPE_BCM2837 : TYPE_BCM2836);
137
object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
138
&error_abort);
139
33
140
--
34
--
141
2.16.2
35
2.20.1
142
36
143
37
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
1
Add a new script to automate the process of running the Coverity
2
2
Scan build tools and uploading the resulting tarball to the
3
Code of imx_update() is slightly confusing since the "flags" variable
3
website.
4
doesn't really corespond to anything in real hardware and server as a
4
5
kitchensink accumulating events normally reported via USR1 and USR2
5
This is intended eventually to be driven from Travis,
6
registers.
6
but it can be run locally, if you are a maintainer of the
7
7
QEMU project on the Coverity Scan website and have the secret
8
Change the code to explicitly evaluate state of interrupts reported
8
upload token.
9
via USR1 and USR2 against corresponding masking bits and use the to
9
10
detemine if IRQ line should be asserted or not.
10
The script must be run on a Fedora 30 system. Support for using a
11
11
Docker container is added in a following commit.
12
NOTE: Check for UTS1_TXEMPTY being set has been dropped for two
12
13
reasons:
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
14
15
1. Emulation code implements a single character FIFO, so this flag
16
will always be set since characters are trasmitted as a part of
17
the code emulating "push" into the FIFO
18
19
2. imx_update() is really just a function doing ORing and maksing
20
of reported events, so checking for UTS1_TXEMPTY should happen,
21
if it's ever really needed should probably happen outside of
22
it.
23
24
Cc: qemu-devel@nongnu.org
25
Cc: qemu-arm@nongnu.org
26
Cc: Bill Paul <wpaul@windriver.com>
27
Cc: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
29
Message-id: 20180315191141.6789-1-andrew.smirnov@gmail.com
30
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
31
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Message-id: 20200319193323.2038-6-peter.maydell@linaro.org
32
---
16
---
33
hw/char/imx_serial.c | 24 ++++++++++++++++--------
17
MAINTAINERS | 5 +
34
1 file changed, 16 insertions(+), 8 deletions(-)
18
scripts/coverity-scan/run-coverity-scan | 311 ++++++++++++++++++++++++
35
19
2 files changed, 316 insertions(+)
36
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
20
create mode 100755 scripts/coverity-scan/run-coverity-scan
21
22
diff --git a/MAINTAINERS b/MAINTAINERS
37
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/char/imx_serial.c
24
--- a/MAINTAINERS
39
+++ b/hw/char/imx_serial.c
25
+++ b/MAINTAINERS
40
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_serial = {
26
@@ -XXX,XX +XXX,XX @@ M: Markus Armbruster <armbru@redhat.com>
41
27
S: Supported
42
static void imx_update(IMXSerialState *s)
28
F: scripts/coverity-model.c
43
{
29
44
- uint32_t flags;
30
+Coverity Scan integration
45
+ uint32_t usr1;
31
+M: Peter Maydell <peter.maydell@linaro.org>
46
+ uint32_t usr2;
32
+S: Maintained
47
+ uint32_t mask;
33
+F: scripts/coverity-scan/
48
34
+
49
- flags = (s->usr1 & s->ucr1) & (USR1_TRDY|USR1_RRDY);
35
Device Tree
50
- if (s->ucr1 & UCR1_TXMPTYEN) {
36
M: Alistair Francis <alistair.francis@wdc.com>
51
- flags |= (s->uts1 & UTS1_TXEMPTY);
37
R: David Gibson <david@gibson.dropbear.id.au>
52
- } else {
38
diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan
53
- flags &= ~USR1_TRDY;
39
new file mode 100755
54
- }
40
index XXXXXXX..XXXXXXX
55
+ /*
41
--- /dev/null
56
+ * Lucky for us TRDY and RRDY has the same offset in both USR1 and
42
+++ b/scripts/coverity-scan/run-coverity-scan
57
+ * UCR1, so we can get away with something as simple as the
43
@@ -XXX,XX +XXX,XX @@
58
+ * following:
44
+#!/bin/sh -e
59
+ */
45
+
60
+ usr1 = s->usr1 & s->ucr1 & (USR1_TRDY | USR1_RRDY);
46
+# Upload a created tarball to Coverity Scan, as per
61
+ /*
47
+# https://scan.coverity.com/projects/qemu/builds/new
62
+ * Bits that we want in USR2 are not as conveniently laid out,
48
+
63
+ * unfortunately.
49
+# This work is licensed under the terms of the GNU GPL version 2,
64
+ */
50
+# or (at your option) any later version.
65
+ mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0;
51
+# See the COPYING file in the top-level directory.
66
+ usr2 = s->usr2 & mask;
52
+#
67
53
+# Copyright (c) 2017-2020 Linaro Limited
68
- qemu_set_irq(s->irq, !!flags);
54
+# Written by Peter Maydell
69
+ qemu_set_irq(s->irq, usr1 || usr2);
55
+
70
}
56
+# Note that this script will automatically download and
71
57
+# run the (closed-source) coverity build tools, so don't
72
static void imx_serial_reset(IMXSerialState *s)
58
+# use it if you don't trust them!
59
+
60
+# This script assumes that you're running it from a QEMU source
61
+# tree, and that tree is a fresh clean one, because we do an in-tree
62
+# build. (This is necessary so that the filenames that the Coverity
63
+# Scan server sees are relative paths that match up with the component
64
+# regular expressions it uses; an out-of-tree build won't work for this.)
65
+# The host machine should have as many of QEMU's dependencies
66
+# installed as possible, for maximum coverity coverage.
67
+
68
+# To do an upload you need to be a maintainer in the Coverity online
69
+# service, and you will need to know the "Coverity token", which is a
70
+# secret 8 digit hex string. You can find that from the web UI in the
71
+# project settings, if you have maintainer access there.
72
+
73
+# Command line options:
74
+# --dry-run : run the tools, but don't actually do the upload
75
+# --update-tools-only : update the cached copy of the tools, but don't run them
76
+# --tokenfile : file to read Coverity token from
77
+# --version ver : specify version being analyzed (default: ask git)
78
+# --description desc : specify description of this version (default: ask git)
79
+# --srcdir : QEMU source tree to analyze (default: current working dir)
80
+# --results-tarball : path to copy the results tarball to (default: don't
81
+# copy it anywhere, just upload it)
82
+#
83
+# User-specifiable environment variables:
84
+# COVERITY_TOKEN -- Coverity token
85
+# COVERITY_EMAIL -- the email address to use for uploads (default:
86
+# looks at your git user.email config)
87
+# COVERITY_BUILD_CMD -- make command (default: 'make -jN' where N is
88
+# number of CPUs as determined by 'nproc')
89
+# COVERITY_TOOL_BASE -- set to directory to put coverity tools
90
+# (default: /tmp/coverity-tools)
91
+#
92
+# You must specify the token, either by environment variable or by
93
+# putting it in a file and using --tokenfile. Everything else has
94
+# a reasonable default if this is run from a git tree.
95
+
96
+check_upload_permissions() {
97
+ # Check whether we can do an upload to the server; will exit the script
98
+ # with status 1 if the check failed (usually a bad token);
99
+ # will exit the script with status 0 if the check indicated that we
100
+ # can't upload yet (ie we are at quota)
101
+ # Assumes that PROJTOKEN, PROJNAME and DRYRUN have been initialized.
102
+
103
+ echo "Checking upload permissions..."
104
+
105
+ if ! up_perm="$(wget https://scan.coverity.com/api/upload_permitted --post-data "token=$PROJTOKEN&project=$PROJNAME" -q -O -)"; then
106
+ echo "Coverity Scan API access denied: bad token?"
107
+ exit 1
108
+ fi
109
+
110
+ # Really up_perm is a JSON response with either
111
+ # {upload_permitted:true} or {next_upload_permitted_at:<date>}
112
+ # We do some hacky string parsing instead of properly parsing it.
113
+ case "$up_perm" in
114
+ *upload_permitted*true*)
115
+ echo "Coverity Scan: upload permitted"
116
+ ;;
117
+ *next_upload_permitted_at*)
118
+ if [ "$DRYRUN" = yes ]; then
119
+ echo "Coverity Scan: upload quota reached, continuing dry run"
120
+ else
121
+ echo "Coverity Scan: upload quota reached; stopping here"
122
+ # Exit success as this isn't a build error.
123
+ exit 0
124
+ fi
125
+ ;;
126
+ *)
127
+ echo "Coverity Scan upload check: unexpected result $up_perm"
128
+ exit 1
129
+ ;;
130
+ esac
131
+}
132
+
133
+
134
+update_coverity_tools () {
135
+ # Check for whether we need to download the Coverity tools
136
+ # (either because we don't have a copy, or because it's out of date)
137
+ # Assumes that COVERITY_TOOL_BASE, PROJTOKEN and PROJNAME are set.
138
+
139
+ mkdir -p "$COVERITY_TOOL_BASE"
140
+ cd "$COVERITY_TOOL_BASE"
141
+
142
+ echo "Checking for new version of coverity build tools..."
143
+ wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME&md5=1" -O coverity_tool.md5.new
144
+
145
+ if ! cmp -s coverity_tool.md5 coverity_tool.md5.new; then
146
+ # out of date md5 or no md5: download new build tool
147
+ # blow away the old build tool
148
+ echo "Downloading coverity build tools..."
149
+ rm -rf coverity_tool coverity_tool.tgz
150
+ wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME" -O coverity_tool.tgz
151
+ if ! (cat coverity_tool.md5.new; echo " coverity_tool.tgz") | md5sum -c --status; then
152
+ echo "Downloaded tarball didn't match md5sum!"
153
+ exit 1
154
+ fi
155
+ # extract the new one, keeping it corralled in a 'coverity_tool' directory
156
+ echo "Unpacking coverity build tools..."
157
+ mkdir -p coverity_tool
158
+ cd coverity_tool
159
+ tar xf ../coverity_tool.tgz
160
+ cd ..
161
+ mv coverity_tool.md5.new coverity_tool.md5
162
+ fi
163
+
164
+ rm -f coverity_tool.md5.new
165
+}
166
+
167
+
168
+# Check user-provided environment variables and arguments
169
+DRYRUN=no
170
+UPDATE_ONLY=no
171
+
172
+while [ "$#" -ge 1 ]; do
173
+ case "$1" in
174
+ --dry-run)
175
+ shift
176
+ DRYRUN=yes
177
+ ;;
178
+ --update-tools-only)
179
+ shift
180
+ UPDATE_ONLY=yes
181
+ ;;
182
+ --version)
183
+ shift
184
+ if [ $# -eq 0 ]; then
185
+ echo "--version needs an argument"
186
+ exit 1
187
+ fi
188
+ VERSION="$1"
189
+ shift
190
+ ;;
191
+ --description)
192
+ shift
193
+ if [ $# -eq 0 ]; then
194
+ echo "--description needs an argument"
195
+ exit 1
196
+ fi
197
+ DESCRIPTION="$1"
198
+ shift
199
+ ;;
200
+ --tokenfile)
201
+ shift
202
+ if [ $# -eq 0 ]; then
203
+ echo "--tokenfile needs an argument"
204
+ exit 1
205
+ fi
206
+ COVERITY_TOKEN="$(cat "$1")"
207
+ shift
208
+ ;;
209
+ --srcdir)
210
+ shift
211
+ if [ $# -eq 0 ]; then
212
+ echo "--srcdir needs an argument"
213
+ exit 1
214
+ fi
215
+ SRCDIR="$1"
216
+ shift
217
+ ;;
218
+ --results-tarball)
219
+ shift
220
+ if [ $# -eq 0 ]; then
221
+ echo "--results-tarball needs an argument"
222
+ exit 1
223
+ fi
224
+ RESULTSTARBALL="$1"
225
+ shift
226
+ ;;
227
+ *)
228
+ echo "Unexpected argument '$1'"
229
+ exit 1
230
+ ;;
231
+ esac
232
+done
233
+
234
+if [ -z "$COVERITY_TOKEN" ]; then
235
+ echo "COVERITY_TOKEN environment variable not set"
236
+ exit 1
237
+fi
238
+
239
+if [ -z "$COVERITY_BUILD_CMD" ]; then
240
+ NPROC=$(nproc)
241
+ COVERITY_BUILD_CMD="make -j$NPROC"
242
+ echo "COVERITY_BUILD_CMD: using default '$COVERITY_BUILD_CMD'"
243
+fi
244
+
245
+if [ -z "$COVERITY_TOOL_BASE" ]; then
246
+ echo "COVERITY_TOOL_BASE: using default /tmp/coverity-tools"
247
+ COVERITY_TOOL_BASE=/tmp/coverity-tools
248
+fi
249
+
250
+if [ -z "$SRCDIR" ]; then
251
+ SRCDIR="$PWD"
252
+fi
253
+
254
+PROJTOKEN="$COVERITY_TOKEN"
255
+PROJNAME=QEMU
256
+TARBALL=cov-int.tar.xz
257
+
258
+
259
+if [ "$UPDATE_ONLY" = yes ]; then
260
+ # Just do the tools update; we don't need to check whether
261
+ # we are in a source tree or have upload rights for this,
262
+ # so do it before some of the command line and source tree checks.
263
+ update_coverity_tools
264
+ exit 0
265
+fi
266
+
267
+cd "$SRCDIR"
268
+
269
+echo "Checking this is a QEMU source tree..."
270
+if ! [ -e "$SRCDIR/VERSION" ]; then
271
+ echo "Not in a QEMU source tree?"
272
+ exit 1
273
+fi
274
+
275
+# Fill in defaults used by the non-update-only process
276
+if [ -z "$VERSION" ]; then
277
+ VERSION="$(git describe --always HEAD)"
278
+fi
279
+
280
+if [ -z "$DESCRIPTION" ]; then
281
+ DESCRIPTION="$(git rev-parse HEAD)"
282
+fi
283
+
284
+if [ -z "$COVERITY_EMAIL" ]; then
285
+ COVERITY_EMAIL="$(git config user.email)"
286
+fi
287
+
288
+check_upload_permissions
289
+
290
+update_coverity_tools
291
+
292
+TOOLBIN="$(cd "$COVERITY_TOOL_BASE" && echo $PWD/coverity_tool/cov-analysis-*/bin)"
293
+
294
+if ! test -x "$TOOLBIN/cov-build"; then
295
+ echo "Couldn't find cov-build in the coverity build-tool directory??"
296
+ exit 1
297
+fi
298
+
299
+export PATH="$TOOLBIN:$PATH"
300
+
301
+cd "$SRCDIR"
302
+
303
+echo "Doing make distclean..."
304
+make distclean
305
+
306
+echo "Configuring..."
307
+# We configure with a fixed set of enables here to ensure that we don't
308
+# accidentally reduce the scope of the analysis by doing the build on
309
+# the system that's missing a dependency that we need to build part of
310
+# the codebase.
311
+./configure --disable-modules --enable-sdl --enable-gtk \
312
+ --enable-opengl --enable-vte --enable-gnutls \
313
+ --enable-nettle --enable-curses --enable-curl \
314
+ --audio-drv-list=oss,alsa,sdl,pa --enable-virtfs \
315
+ --enable-vnc --enable-vnc-sasl --enable-vnc-jpeg --enable-vnc-png \
316
+ --enable-xen --enable-brlapi \
317
+ --enable-linux-aio --enable-attr \
318
+ --enable-cap-ng --enable-trace-backends=log --enable-spice --enable-rbd \
319
+ --enable-xfsctl --enable-libusb --enable-usb-redir \
320
+ --enable-libiscsi --enable-libnfs --enable-seccomp \
321
+ --enable-tpm --enable-libssh --enable-lzo --enable-snappy --enable-bzip2 \
322
+ --enable-numa --enable-rdma --enable-smartcard --enable-virglrenderer \
323
+ --enable-mpath --enable-libxml2 --enable-glusterfs \
324
+ --enable-virtfs --enable-zstd
325
+
326
+echo "Making libqemustub.a..."
327
+make libqemustub.a
328
+
329
+echo "Running cov-build..."
330
+rm -rf cov-int
331
+mkdir cov-int
332
+cov-build --dir cov-int $COVERITY_BUILD_CMD
333
+
334
+echo "Creating results tarball..."
335
+tar cvf - cov-int | xz > "$TARBALL"
336
+
337
+if [ ! -z "$RESULTSTARBALL" ]; then
338
+ echo "Copying results tarball to $RESULTSTARBALL..."
339
+ cp "$TARBALL" "$RESULTSTARBALL"
340
+fi
341
+
342
+echo "Uploading results tarball..."
343
+
344
+if [ "$DRYRUN" = yes ]; then
345
+ echo "Dry run only, not uploading $TARBALL"
346
+ exit 0
347
+fi
348
+
349
+curl --form token="$PROJTOKEN" --form email="$COVERITY_EMAIL" \
350
+ --form file=@"$TARBALL" --form version="$VERSION" \
351
+ --form description="$DESCRIPTION" \
352
+ https://scan.coverity.com/builds?project="$PROJNAME"
353
+
354
+echo "Done."
73
--
355
--
74
2.16.2
356
2.20.1
75
357
76
358
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
1
Add support for running the Coverity Scan tools inside a Docker
2
2
container rather than directly on the host system.
3
Add support for "TX complete"/TXDC interrupt generate by real HW since
3
4
it is needed to support guests other than Linux.
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
6
Based on the patch by Bill Paul as found here:
7
https://bugs.launchpad.net/qemu/+bug/1753314
8
9
Cc: qemu-devel@nongnu.org
10
Cc: qemu-arm@nongnu.org
11
Cc: Bill Paul <wpaul@windriver.com>
12
Cc: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Bill Paul <wpaul@windriver.com>
14
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
15
Message-id: 20180315191141.6789-2-andrew.smirnov@gmail.com
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Message-id: 20200319193323.2038-7-peter.maydell@linaro.org
18
---
7
---
19
include/hw/char/imx_serial.h | 3 +++
8
scripts/coverity-scan/coverity-scan.docker | 131 +++++++++++++++++++++
20
hw/char/imx_serial.c | 20 +++++++++++++++++---
9
scripts/coverity-scan/run-coverity-scan | 90 ++++++++++++++
21
2 files changed, 20 insertions(+), 3 deletions(-)
10
2 files changed, 221 insertions(+)
22
11
create mode 100644 scripts/coverity-scan/coverity-scan.docker
23
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
12
24
index XXXXXXX..XXXXXXX 100644
13
diff --git a/scripts/coverity-scan/coverity-scan.docker b/scripts/coverity-scan/coverity-scan.docker
25
--- a/include/hw/char/imx_serial.h
14
new file mode 100644
26
+++ b/include/hw/char/imx_serial.h
15
index XXXXXXX..XXXXXXX
16
--- /dev/null
17
+++ b/scripts/coverity-scan/coverity-scan.docker
27
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@
28
#define UCR2_RXEN (1<<1) /* Receiver enable */
19
+# syntax=docker/dockerfile:1.0.0-experimental
29
#define UCR2_SRST (1<<0) /* Reset complete */
20
+#
30
21
+# Docker setup for running the "Coverity Scan" tools over the source
31
+#define UCR4_TCEN BIT(3) /* TX complete interrupt enable */
22
+# tree and uploading them to the website, as per
32
+
23
+# https://scan.coverity.com/projects/qemu/builds/new
33
#define UTS1_TXEMPTY (1<<6)
24
+# We do this on a fixed config (currently Fedora 30 with a known
34
#define UTS1_RXEMPTY (1<<5)
25
+# set of dependencies and a configure command that enables a specific
35
#define UTS1_TXFULL (1<<4)
26
+# set of options) so that random changes don't result in our accidentally
36
@@ -XXX,XX +XXX,XX @@ typedef struct IMXSerialState {
27
+# dropping some files from the scan.
37
uint32_t ubmr;
28
+#
38
uint32_t ubrc;
29
+# We don't build on top of the fedora.docker file because we don't
39
uint32_t ucr3;
30
+# want to accidentally change or break the scan config when that
40
+ uint32_t ucr4;
31
+# is updated.
41
32
+
42
qemu_irq irq;
33
+# The work of actually doing the build is handled by the
43
CharBackend chr;
34
+# run-coverity-scan script.
44
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
35
+
45
index XXXXXXX..XXXXXXX 100644
36
+FROM fedora:30
46
--- a/hw/char/imx_serial.c
37
+ENV PACKAGES \
47
+++ b/hw/char/imx_serial.c
38
+ alsa-lib-devel \
39
+ bc \
40
+ bison \
41
+ brlapi-devel \
42
+ bzip2 \
43
+ bzip2-devel \
44
+ ccache \
45
+ clang \
46
+ curl \
47
+ cyrus-sasl-devel \
48
+ dbus-daemon \
49
+ device-mapper-multipath-devel \
50
+ findutils \
51
+ flex \
52
+ gcc \
53
+ gcc-c++ \
54
+ gettext \
55
+ git \
56
+ glib2-devel \
57
+ glusterfs-api-devel \
58
+ gnutls-devel \
59
+ gtk3-devel \
60
+ hostname \
61
+ libaio-devel \
62
+ libasan \
63
+ libattr-devel \
64
+ libblockdev-mpath-devel \
65
+ libcap-devel \
66
+ libcap-ng-devel \
67
+ libcurl-devel \
68
+ libepoxy-devel \
69
+ libfdt-devel \
70
+ libgbm-devel \
71
+ libiscsi-devel \
72
+ libjpeg-devel \
73
+ libpmem-devel \
74
+ libnfs-devel \
75
+ libpng-devel \
76
+ librbd-devel \
77
+ libseccomp-devel \
78
+ libssh-devel \
79
+ libubsan \
80
+ libudev-devel \
81
+ libusbx-devel \
82
+ libxml2-devel \
83
+ libzstd-devel \
84
+ llvm \
85
+ lzo-devel \
86
+ make \
87
+ mingw32-bzip2 \
88
+ mingw32-curl \
89
+ mingw32-glib2 \
90
+ mingw32-gmp \
91
+ mingw32-gnutls \
92
+ mingw32-gtk3 \
93
+ mingw32-libjpeg-turbo \
94
+ mingw32-libpng \
95
+ mingw32-libtasn1 \
96
+ mingw32-nettle \
97
+ mingw32-nsis \
98
+ mingw32-pixman \
99
+ mingw32-pkg-config \
100
+ mingw32-SDL2 \
101
+ mingw64-bzip2 \
102
+ mingw64-curl \
103
+ mingw64-glib2 \
104
+ mingw64-gmp \
105
+ mingw64-gnutls \
106
+ mingw64-gtk3 \
107
+ mingw64-libjpeg-turbo \
108
+ mingw64-libpng \
109
+ mingw64-libtasn1 \
110
+ mingw64-nettle \
111
+ mingw64-pixman \
112
+ mingw64-pkg-config \
113
+ mingw64-SDL2 \
114
+ ncurses-devel \
115
+ nettle-devel \
116
+ nss-devel \
117
+ numactl-devel \
118
+ perl \
119
+ perl-Test-Harness \
120
+ pixman-devel \
121
+ pulseaudio-libs-devel \
122
+ python3 \
123
+ python3-sphinx \
124
+ PyYAML \
125
+ rdma-core-devel \
126
+ SDL2-devel \
127
+ snappy-devel \
128
+ sparse \
129
+ spice-server-devel \
130
+ systemd-devel \
131
+ systemtap-sdt-devel \
132
+ tar \
133
+ texinfo \
134
+ usbredir-devel \
135
+ virglrenderer-devel \
136
+ vte291-devel \
137
+ wget \
138
+ which \
139
+ xen-devel \
140
+ xfsprogs-devel \
141
+ zlib-devel
142
+ENV QEMU_CONFIGURE_OPTS --python=/usr/bin/python3
143
+
144
+RUN dnf install -y $PACKAGES
145
+RUN rpm -q $PACKAGES | sort > /packages.txt
146
+ENV PATH $PATH:/usr/libexec/python3-sphinx/
147
+ENV COVERITY_TOOL_BASE=/coverity-tools
148
+COPY run-coverity-scan run-coverity-scan
149
+RUN --mount=type=secret,id=coverity.token,required ./run-coverity-scan --update-tools-only --tokenfile /run/secrets/coverity.token
150
diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan
151
index XXXXXXX..XXXXXXX 100755
152
--- a/scripts/coverity-scan/run-coverity-scan
153
+++ b/scripts/coverity-scan/run-coverity-scan
48
@@ -XXX,XX +XXX,XX @@
154
@@ -XXX,XX +XXX,XX @@
49
155
50
static const VMStateDescription vmstate_imx_serial = {
156
# Command line options:
51
.name = TYPE_IMX_SERIAL,
157
# --dry-run : run the tools, but don't actually do the upload
52
- .version_id = 1,
158
+# --docker : create and work inside a docker container
53
- .minimum_version_id = 1,
159
# --update-tools-only : update the cached copy of the tools, but don't run them
54
+ .version_id = 2,
160
# --tokenfile : file to read Coverity token from
55
+ .minimum_version_id = 2,
161
# --version ver : specify version being analyzed (default: ask git)
56
.fields = (VMStateField[]) {
162
@@ -XXX,XX +XXX,XX @@
57
VMSTATE_INT32(readbuff, IMXSerialState),
163
# --srcdir : QEMU source tree to analyze (default: current working dir)
58
VMSTATE_UINT32(usr1, IMXSerialState),
164
# --results-tarball : path to copy the results tarball to (default: don't
59
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_serial = {
165
# copy it anywhere, just upload it)
60
VMSTATE_UINT32(ubmr, IMXSerialState),
166
+# --src-tarball : tarball to untar into src dir (default: none); this
61
VMSTATE_UINT32(ubrc, IMXSerialState),
167
+# is intended mainly for internal use by the Docker support
62
VMSTATE_UINT32(ucr3, IMXSerialState),
168
#
63
+ VMSTATE_UINT32(ucr4, IMXSerialState),
169
# User-specifiable environment variables:
64
VMSTATE_END_OF_LIST()
170
# COVERITY_TOKEN -- Coverity token
65
},
171
@@ -XXX,XX +XXX,XX @@ update_coverity_tools () {
66
};
172
# Check user-provided environment variables and arguments
67
@@ -XXX,XX +XXX,XX @@ static void imx_update(IMXSerialState *s)
173
DRYRUN=no
68
* unfortunately.
174
UPDATE_ONLY=no
69
*/
175
+DOCKER=no
70
mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0;
176
71
+ /*
177
while [ "$#" -ge 1 ]; do
72
+ * TCEN and TXDC are both bit 3
178
case "$1" in
73
+ */
179
@@ -XXX,XX +XXX,XX @@ while [ "$#" -ge 1 ]; do
74
+ mask |= s->ucr4 & UCR4_TCEN;
180
RESULTSTARBALL="$1"
75
+
181
shift
76
usr2 = s->usr2 & mask;
182
;;
77
183
+ --src-tarball)
78
qemu_set_irq(s->irq, usr1 || usr2);
184
+ shift
79
@@ -XXX,XX +XXX,XX @@ static uint64_t imx_serial_read(void *opaque, hwaddr offset,
185
+ if [ $# -eq 0 ]; then
80
return s->ucr3;
186
+ echo "--src-tarball needs an argument"
81
187
+ exit 1
82
case 0x23: /* UCR4 */
188
+ fi
83
+ return s->ucr4;
189
+ SRCTARBALL="$1"
84
+
190
+ shift
85
case 0x29: /* BRM Incremental */
191
+ ;;
86
return 0x0; /* TODO */
192
+ --docker)
87
193
+ DOCKER=yes
88
@@ -XXX,XX +XXX,XX @@ static void imx_serial_write(void *opaque, hwaddr offset,
194
+ shift
89
* qemu_chr_fe_write and background I/O callbacks */
195
+ ;;
90
qemu_chr_fe_write_all(&s->chr, &ch, 1);
196
*)
91
s->usr1 &= ~USR1_TRDY;
197
echo "Unexpected argument '$1'"
92
+ s->usr2 &= ~USR2_TXDC;
198
exit 1
93
imx_update(s);
199
@@ -XXX,XX +XXX,XX @@ PROJTOKEN="$COVERITY_TOKEN"
94
s->usr1 |= USR1_TRDY;
200
PROJNAME=QEMU
95
+ s->usr2 |= USR2_TXDC;
201
TARBALL=cov-int.tar.xz
96
imx_update(s);
202
97
}
203
+if [ "$UPDATE_ONLY" = yes ] && [ "$DOCKER" = yes ]; then
98
break;
204
+ echo "Combining --docker and --update-only is not supported"
99
@@ -XXX,XX +XXX,XX @@ static void imx_serial_write(void *opaque, hwaddr offset,
205
+ exit 1
100
s->ucr3 = value & 0xffff;
206
+fi
101
break;
207
102
208
if [ "$UPDATE_ONLY" = yes ]; then
103
- case 0x2d: /* UTS1 */
209
# Just do the tools update; we don't need to check whether
104
case 0x23: /* UCR4 */
210
@@ -XXX,XX +XXX,XX @@ if [ "$UPDATE_ONLY" = yes ]; then
105
+ s->ucr4 = value & 0xffff;
211
exit 0
106
+ imx_update(s);
212
fi
107
+ break;
213
108
+
214
+if [ ! -e "$SRCDIR" ]; then
109
+ case 0x2d: /* UTS1 */
215
+ mkdir "$SRCDIR"
110
qemu_log_mask(LOG_UNIMP, "[%s]%s: Unimplemented reg 0x%"
216
+fi
111
HWADDR_PRIx "\n", TYPE_IMX_SERIAL, __func__, offset);
217
+
112
/* TODO */
218
cd "$SRCDIR"
219
220
+if [ ! -z "$SRCTARBALL" ]; then
221
+ echo "Untarring source tarball into $SRCDIR..."
222
+ tar xvf "$SRCTARBALL"
223
+fi
224
+
225
echo "Checking this is a QEMU source tree..."
226
if ! [ -e "$SRCDIR/VERSION" ]; then
227
echo "Not in a QEMU source tree?"
228
@@ -XXX,XX +XXX,XX @@ if [ -z "$COVERITY_EMAIL" ]; then
229
COVERITY_EMAIL="$(git config user.email)"
230
fi
231
232
+# Run ourselves inside docker if that's what the user wants
233
+if [ "$DOCKER" = yes ]; then
234
+ # build docker container including the coverity-scan tools
235
+ # Put the Coverity token into a temporary file that only
236
+ # we have read access to, and then pass it to docker build
237
+ # using --secret. This requires at least Docker 18.09.
238
+ # Mostly what we are trying to do here is ensure we don't leak
239
+ # the token into the Docker image.
240
+ umask 077
241
+ SECRETDIR=$(mktemp -d)
242
+ if [ -z "$SECRETDIR" ]; then
243
+ echo "Failed to create temporary directory"
244
+ exit 1
245
+ fi
246
+ trap 'rm -rf "$SECRETDIR"' INT TERM EXIT
247
+ echo "Created temporary directory $SECRETDIR"
248
+ SECRET="$SECRETDIR/token"
249
+ echo "$COVERITY_TOKEN" > "$SECRET"
250
+ echo "Building docker container..."
251
+ # TODO: This re-downloads the tools every time, rather than
252
+ # caching and reusing the image produced with the downloaded tools.
253
+ # Not sure why.
254
+ # TODO: how do you get 'docker build' to print the output of the
255
+ # commands it is running to its stdout? This would be useful for debug.
256
+ DOCKER_BUILDKIT=1 docker build -t coverity-scanner \
257
+ --secret id=coverity.token,src="$SECRET" \
258
+ -f scripts/coverity-scan/coverity-scan.docker \
259
+ scripts/coverity-scan
260
+ echo "Archiving sources to be analyzed..."
261
+ ./scripts/archive-source.sh "$SECRETDIR/qemu-sources.tgz"
262
+ if [ "$DRYRUN" = yes ]; then
263
+ DRYRUNARG=--dry-run
264
+ fi
265
+ echo "Running scanner..."
266
+ # If we need to capture the output tarball, get the inner run to
267
+ # save it to the secrets directory so we can copy it out before the
268
+ # directory is cleaned up.
269
+ if [ ! -z "$RESULTSTARBALL" ]; then
270
+ RTARGS="--results-tarball /work/cov-int.tar.xz"
271
+ else
272
+ RTARGS=""
273
+ fi
274
+ # Arrange for this docker run to get access to the sources with -v.
275
+ # We pass through all the configuration from the outer script to the inner.
276
+ export COVERITY_EMAIL COVERITY_BUILD_CMD
277
+ docker run -it --env COVERITY_EMAIL --env COVERITY_BUILD_CMD \
278
+ -v "$SECRETDIR:/work" coverity-scanner \
279
+ ./run-coverity-scan --version "$VERSION" \
280
+ --description "$DESCRIPTION" $DRYRUNARG --tokenfile /work/token \
281
+ --srcdir /qemu --src-tarball /work/qemu-sources.tgz $RTARGS
282
+ if [ ! -z "$RESULTSTARBALL" ]; then
283
+ echo "Copying results tarball to $RESULTSTARBALL..."
284
+ cp "$SECRETDIR/cov-int.tar.xz" "$RESULTSTARBALL"
285
+ fi
286
+ echo "Docker work complete."
287
+ exit 0
288
+fi
289
+
290
+# Otherwise, continue with the full build and upload process.
291
+
292
check_upload_permissions
293
294
update_coverity_tools
113
--
295
--
114
2.16.2
296
2.20.1
115
297
116
298
diff view generated by jsdifflib
1
If we're directly booting a Linux kernel and the CPU supports both
1
The documentation of our -s and -gdb options is quite old; in
2
EL3 and EL2, we start the kernel in EL2, as it expects. We must also
2
particular it still claims that it will cause QEMU to stop and wait
3
set the SCR_EL3.HCE bit in this situation, so that the HVC
3
for the gdb connection, when this has not been true for some time:
4
instruction is enabled rather than UNDEFing. Otherwise at least some
4
you also need to pass -S if you want to make QEMU not launch the
5
kernels will panic when trying to initialize KVM in the guest.
5
guest on startup.
6
7
Improve the documentation to mention this requirement in the
8
executable's --help output, the documentation of the -gdb option in
9
the manual, and in the "GDB usage" chapter.
10
11
Includes some minor tweaks to these paragraphs of documentation
12
since I was editing them anyway (such as dropping the description
13
of our gdb support as "primitive").
6
14
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20180313153458.26822-4-peter.maydell@linaro.org
16
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
19
Message-id: 20200403094014.9589-1-peter.maydell@linaro.org
9
---
20
---
10
hw/arm/boot.c | 5 +++++
21
docs/system/gdb.rst | 22 +++++++++++++++-------
11
1 file changed, 5 insertions(+)
22
qemu-options.hx | 24 ++++++++++++++++++------
23
2 files changed, 33 insertions(+), 13 deletions(-)
12
24
13
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
25
diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst
14
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/boot.c
27
--- a/docs/system/gdb.rst
16
+++ b/hw/arm/boot.c
28
+++ b/docs/system/gdb.rst
17
@@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque)
29
@@ -XXX,XX +XXX,XX @@
18
assert(!info->secure_board_setup);
30
GDB usage
19
}
31
---------
20
32
21
+ if (arm_feature(env, ARM_FEATURE_EL2)) {
33
-QEMU has a primitive support to work with gdb, so that you can do
22
+ /* If we have EL2 then Linux expects the HVC insn to work */
34
-'Ctrl-C' while the virtual machine is running and inspect its state.
23
+ env->cp15.scr_el3 |= SCR_HCE;
35
+QEMU supports working with gdb via gdb's remote-connection facility
24
+ }
36
+(the "gdbstub"). This allows you to debug guest code in the same
37
+way that you might with a low-level debug facility like JTAG
38
+on real hardware. You can stop and start the virtual machine,
39
+examine state like registers and memory, and set breakpoints and
40
+watchpoints.
41
42
-In order to use gdb, launch QEMU with the '-s' option. It will wait for
43
-a gdb connection:
44
+In order to use gdb, launch QEMU with the ``-s`` and ``-S`` options.
45
+The ``-s`` option will make QEMU listen for an incoming connection
46
+from gdb on TCP port 1234, and ``-S`` will make QEMU not start the
47
+guest until you tell it to from gdb. (If you want to specify which
48
+TCP port to use or to use something other than TCP for the gdbstub
49
+connection, use the ``-gdb dev`` option instead of ``-s``.)
50
51
.. parsed-literal::
52
53
- |qemu_system| -s -kernel bzImage -hda rootdisk.img -append "root=/dev/hda"
54
- Connected to host network interface: tun0
55
- Waiting gdb connection on port 1234
56
+ |qemu_system| -s -S -kernel bzImage -hda rootdisk.img -append "root=/dev/hda"
25
+
57
+
26
/* Set to non-secure if not a secure boot */
58
+QEMU will launch but will silently wait for gdb to connect.
27
if (!info->secure_boot &&
59
28
(cs != first_cpu || !info->secure_board_setup)) {
60
Then launch gdb on the 'vmlinux' executable::
61
62
diff --git a/qemu-options.hx b/qemu-options.hx
63
index XXXXXXX..XXXXXXX 100644
64
--- a/qemu-options.hx
65
+++ b/qemu-options.hx
66
@@ -XXX,XX +XXX,XX @@ SRST
67
ERST
68
69
DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \
70
- "-gdb dev wait for gdb connection on 'dev'\n", QEMU_ARCH_ALL)
71
+ "-gdb dev accept gdb connection on 'dev'. (QEMU defaults to starting\n"
72
+ " the guest without waiting for gdb to connect; use -S too\n"
73
+ " if you want it to not start execution.)\n",
74
+ QEMU_ARCH_ALL)
75
SRST
76
``-gdb dev``
77
- Wait for gdb connection on device dev (see
78
- :ref:`gdb_005fusage`). Typical connections will likely be
79
- TCP-based, but also UDP, pseudo TTY, or even stdio are reasonable
80
- use case. The latter is allowing to start QEMU from within gdb and
81
- establish the connection via a pipe:
82
+ Accept a gdb connection on device dev (see
83
+ :ref:`gdb_005fusage`). Note that this option does not pause QEMU
84
+ execution -- if you want QEMU to not start the guest until you
85
+ connect with gdb and issue a ``continue`` command, you will need to
86
+ also pass the ``-S`` option to QEMU.
87
+
88
+ The most usual configuration is to listen on a local TCP socket::
89
+
90
+ -gdb tcp::3117
91
+
92
+ but you can specify other backends; UDP, pseudo TTY, or even stdio
93
+ are all reasonable use cases. For example, a stdio connection
94
+ allows you to start QEMU from within gdb and establish the
95
+ connection via a pipe:
96
97
.. parsed-literal::
98
29
--
99
--
30
2.16.2
100
2.20.1
31
101
32
102
diff view generated by jsdifflib
1
Add some assertions that if we're about to boot an AArch64 kernel,
1
If we are not making warnings fatal for compilation, make them
2
the board code has not mistakenly set either secure_boot or
2
non-fatal when building the Sphinx documentation also. (For instance
3
secure_board_setup. It doesn't make sense to set secure_boot,
3
Sphinx 3.0 warns about some constructs that older versions were happy
4
because all AArch64 kernels must be booted in non-secure mode.
4
with, which is a build failure if we use the warnings-as-errors
5
flag.)
5
6
6
It might in theory make sense to set secure_board_setup, but
7
This provides a workaround at least for LP:1872113.
7
we don't currently support that, because only the AArch32
8
bootloader[] code calls this hook; bootloader_aarch64[] does not.
9
Since we don't have a current need for this functionality, just
10
assert that we don't try to use it. If it's needed we'll add
11
it later.
12
8
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20180313153458.26822-3-peter.maydell@linaro.org
11
Message-id: 20200411182934.28678-2-peter.maydell@linaro.org
12
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
16
---
13
---
17
hw/arm/boot.c | 7 +++++++
14
configure | 9 ++++++++-
18
1 file changed, 7 insertions(+)
15
Makefile | 2 +-
16
2 files changed, 9 insertions(+), 2 deletions(-)
19
17
20
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
18
diff --git a/configure b/configure
19
index XXXXXXX..XXXXXXX 100755
20
--- a/configure
21
+++ b/configure
22
@@ -XXX,XX +XXX,XX @@ if check_include sys/kcov.h ; then
23
kcov=yes
24
fi
25
26
+# If we're making warnings fatal, apply this to Sphinx runs as well
27
+sphinx_werror=""
28
+if test "$werror" = "yes"; then
29
+ sphinx_werror="-W"
30
+fi
31
+
32
# Check we have a new enough version of sphinx-build
33
has_sphinx_build() {
34
# This is a bit awkward but works: create a trivial document and
35
@@ -XXX,XX +XXX,XX @@ has_sphinx_build() {
36
# sphinx-build doesn't exist at all or if it is too old.
37
mkdir -p "$TMPDIR1/sphinx"
38
touch "$TMPDIR1/sphinx/index.rst"
39
- "$sphinx_build" -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1
40
+ "$sphinx_build" $sphinx_werror -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1
41
}
42
43
# Check if tools are available to build documentation.
44
@@ -XXX,XX +XXX,XX @@ echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
45
echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
46
echo "PYTHON=$python" >> $config_host_mak
47
echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
48
+echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak
49
echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
50
echo "CC=$cc" >> $config_host_mak
51
if $iasl -h > /dev/null 2>&1; then
52
diff --git a/Makefile b/Makefile
21
index XXXXXXX..XXXXXXX 100644
53
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/boot.c
54
--- a/Makefile
23
+++ b/hw/arm/boot.c
55
+++ b/Makefile
24
@@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque)
56
@@ -XXX,XX +XXX,XX @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
25
} else {
57
# Note the use of different doctree for each (manual, builder) tuple;
26
env->pstate = PSTATE_MODE_EL1h;
58
# this works around Sphinx not handling parallel invocation on
27
}
59
# a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
28
+ /* AArch64 kernels never boot in secure mode */
60
-build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) -W -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
29
+ assert(!info->secure_boot);
61
+build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) $(SPHINX_WERROR) -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
30
+ /* This hook is only supported for AArch32 currently:
62
# We assume all RST files in the manual's directory are used in it
31
+ * bootloader_aarch64[] will not call the hook, and
63
manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \
32
+ * the code above has already dropped us into EL2 or EL1.
64
$(SRC_PATH)/docs/defs.rst.inc \
33
+ */
34
+ assert(!info->secure_board_setup);
35
}
36
37
/* Set to non-secure if not a secure boot */
38
--
65
--
39
2.16.2
66
2.20.1
40
67
41
68
diff view generated by jsdifflib
1
The TypeInfo and state struct for bcm2386 disagree about what the
1
When kernel-doc generates a 'c:function' directive for a function
2
parent class is -- the TypeInfo says it's TYPE_SYS_BUS_DEVICE,
2
one of whose arguments is a function pointer, it fails to print
3
but the BCM2386State struct only defines the parent_obj field
3
the close-paren after the argument list of the function pointer
4
as DeviceState. This would have caused problems if anything
4
argument, for instance in the memory API documentation:
5
actually tried to treat the object as a TYPE_SYS_BUS_DEVICE.
5
.. c:function:: void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp)
6
Fix the TypeInfo to use TYPE_DEVICE as the parent, since we don't
6
7
need any of the additional functionality TYPE_SYS_BUS_DEVICE
7
which should have a ')' after the 'void *host' which is the
8
provides.
8
last argument to 'resized'.
9
10
Older versions of Sphinx don't try to parse the argumnet
11
to c:function, but Sphinx 3.0 does do this and will complain:
12
13
/home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:834: WARNING: Error in declarator or parameters
14
Invalid C declaration: Expecting "," or ")" in parameters, got "EOF". [error at 208]
15
void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp)
16
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^
17
18
Add the missing close-paren.
9
19
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
21
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
22
Message-id: 20200411182934.28678-3-peter.maydell@linaro.org
13
Message-id: 20180313153458.26822-5-peter.maydell@linaro.org
23
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
14
---
24
---
15
hw/arm/bcm2836.c | 2 +-
25
scripts/kernel-doc | 2 +-
16
1 file changed, 1 insertion(+), 1 deletion(-)
26
1 file changed, 1 insertion(+), 1 deletion(-)
17
27
18
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
28
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
19
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100755
20
--- a/hw/arm/bcm2836.c
30
--- a/scripts/kernel-doc
21
+++ b/hw/arm/bcm2836.c
31
+++ b/scripts/kernel-doc
22
@@ -XXX,XX +XXX,XX @@ static void bcm2836_class_init(ObjectClass *oc, void *data)
32
@@ -XXX,XX +XXX,XX @@ sub output_function_rst(%) {
23
33
24
static const TypeInfo bcm2836_type_info = {
34
    if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
25
.name = TYPE_BCM2836,
35
     # pointer-to-function
26
- .parent = TYPE_SYS_BUS_DEVICE,
36
-     print $1 . $parameter . ") (" . $2;
27
+ .parent = TYPE_DEVICE,
37
+     print $1 . $parameter . ") (" . $2 . ")";
28
.instance_size = sizeof(BCM2836State),
38
    } else {
29
.instance_init = bcm2836_init,
39
     print $type . " " . $parameter;
30
.class_init = bcm2836_class_init,
40
    }
31
--
41
--
32
2.16.2
42
2.20.1
33
43
34
44
diff view generated by jsdifflib
1
From: Wei Huang <wei@redhat.com>
1
The kernel-doc Sphinx plugin and associated script currently emit
2
'c:type' directives for "struct foo" documentation.
2
3
3
For guest kernel that supports KASLR, the load address can change every
4
Sphinx 3.0 warns about this:
4
time when guest VM runs. To find the physical base address correctly,
5
/home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:3: WARNING: Type must be either just a name or a typedef-like declaration.
5
current QEMU dump searches VMCOREINFO for the string "NUMBER(phys_base)=".
6
If just a name:
6
However this string pattern is only available on x86_64. AArch64 uses a
7
Error in declarator or parameters
7
different field, called "NUMBER(PHYS_OFFSET)=". This patch makes sure
8
Invalid C declaration: Expected identifier in nested name, got keyword: struct [error at 6]
8
QEMU dump uses the correct string on AArch64.
9
struct MemoryListener
10
------^
11
If typedef-like declaration:
12
Error in declarator or parameters
13
Invalid C declaration: Expected identifier in nested name. [error at 21]
14
struct MemoryListener
15
---------------------^
9
16
10
Signed-off-by: Wei Huang <wei@redhat.com>
17
because it wants us to use the new-in-3.0 'c:struct' instead.
11
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
18
12
Message-id: 1520615003-20869-1-git-send-email-wei@redhat.com
19
Plumb the Sphinx version through to the kernel-doc script
20
and use it to select 'c:struct' for newer versions than 3.0.
21
22
Fixes: LP:1872113
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
14
---
25
---
15
dump.c | 14 +++++++++++---
26
docs/sphinx/kerneldoc.py | 1 +
16
1 file changed, 11 insertions(+), 3 deletions(-)
27
scripts/kernel-doc | 16 +++++++++++++++-
28
2 files changed, 16 insertions(+), 1 deletion(-)
17
29
18
diff --git a/dump.c b/dump.c
30
diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py
19
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
20
--- a/dump.c
32
--- a/docs/sphinx/kerneldoc.py
21
+++ b/dump.c
33
+++ b/docs/sphinx/kerneldoc.py
22
@@ -XXX,XX +XXX,XX @@ static void vmcoreinfo_update_phys_base(DumpState *s)
34
@@ -XXX,XX +XXX,XX @@ class KernelDocDirective(Directive):
23
35
env.note_dependency(os.path.abspath(f))
24
lines = g_strsplit((char *)vmci, "\n", -1);
36
cmd += ['-export-file', f]
25
for (i = 0; lines[i]; i++) {
37
26
- if (g_str_has_prefix(lines[i], "NUMBER(phys_base)=")) {
38
+ cmd += ['-sphinx-version', sphinx.__version__]
27
- if (qemu_strtou64(lines[i] + 18, NULL, 16,
39
cmd += [filename]
28
+ const char *prefix = NULL;
40
29
+
41
try:
30
+ if (s->dump_info.d_machine == EM_X86_64) {
42
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
31
+ prefix = "NUMBER(phys_base)=";
43
index XXXXXXX..XXXXXXX 100755
32
+ } else if (s->dump_info.d_machine == EM_AARCH64) {
44
--- a/scripts/kernel-doc
33
+ prefix = "NUMBER(PHYS_OFFSET)=";
45
+++ b/scripts/kernel-doc
34
+ }
46
@@ -XXX,XX +XXX,XX @@ Output selection (mutually exclusive):
35
+
47
            DOC: sections. May be specified multiple times.
36
+ if (prefix && g_str_has_prefix(lines[i], prefix)) {
48
37
+ if (qemu_strtou64(lines[i] + strlen(prefix), NULL, 16,
49
Output selection modifiers:
38
&phys_base) < 0) {
50
+ -sphinx-version VER Generate rST syntax for the specified Sphinx version.
39
- warn_report("Failed to read NUMBER(phys_base)=");
51
+ Only works with reStructuredTextFormat.
40
+ warn_report("Failed to read %s", prefix);
52
-no-doc-sections    Do not output DOC: sections.
41
} else {
53
-enable-lineno Enable output of #define LINENO lines. Only works with
42
s->dump_info.phys_base = phys_base;
54
reStructuredText format.
43
}
55
@@ -XXX,XX +XXX,XX @@ use constant {
56
};
57
my $output_selection = OUTPUT_ALL;
58
my $show_not_found = 0;    # No longer used
59
+my $sphinx_version = "0.0"; # if not specified, assume old
60
61
my @export_file_list;
62
63
@@ -XXX,XX +XXX,XX @@ while ($ARGV[0] =~ m/^--?(.*)/) {
64
     $enable_lineno = 1;
65
} elsif ($cmd eq 'show-not-found') {
66
    $show_not_found = 1; # A no-op but don't fail
67
+ } elsif ($cmd eq 'sphinx-version') {
68
+ $sphinx_version = shift @ARGV;
69
} else {
70
    # Unknown argument
71
usage();
72
@@ -XXX,XX +XXX,XX @@ sub output_struct_rst(%) {
73
my $oldprefix = $lineprefix;
74
my $name = $args{'type'} . " " . $args{'struct'};
75
76
- print "\n\n.. c:type:: " . $name . "\n\n";
77
+ # Sphinx 3.0 and up will emit warnings for "c:type:: struct Foo".
78
+ # It wants to see "c:struct:: Foo" (and will add the word 'struct' in
79
+ # the rendered output).
80
+ if ((split(/\./, $sphinx_version))[0] >= 3) {
81
+ my $sname = $name;
82
+ $sname =~ s/^struct //;
83
+ print "\n\n.. c:struct:: " . $sname . "\n\n";
84
+ } else {
85
+ print "\n\n.. c:type:: " . $name . "\n\n";
86
+ }
87
print_lineno($declaration_start_line);
88
$lineprefix = " ";
89
output_highlight_rst($args{'purpose'});
44
--
90
--
45
2.16.2
91
2.20.1
46
92
47
93
diff view generated by jsdifflib
1
For the rpi1 and 2 we want to boot the Linux kernel via some
1
Versions of Sphinx older than 1.6 can't build all of our documentation,
2
custom setup code that makes sure that the SMC instruction
2
because they are too picky about the syntax of the argument to the
3
acts as a no-op, because it's used for cache maintenance.
3
option:: directive; see Sphinx bugs #646, #3366:
4
The rpi3 boots AArch64 kernels, which don't need SMC for
4
5
cache maintenance and always expect to be booted non-secure.
5
https://github.com/sphinx-doc/sphinx/issues/646
6
Don't fill in the aarch32-specific parts of the binfo struct.
6
https://github.com/sphinx-doc/sphinx/issues/3366
7
8
Trying to build with a 1.4.x Sphinx fails with
9
docs/system/images.rst:4: SEVERE: Duplicate ID: "cmdoption-qcow2-arg-encrypt"
10
and a 1.5.x Sphinx fails with
11
docs/system/invocation.rst:544: WARNING: Malformed option description '[enable=]PATTERN', should look like "opt", "-opt
12
args", "--opt args", "/opt args" or "+opt args"
13
14
Update our needs_sphinx setting to indicate that we require at least
15
1.6. This will allow configure to fall back to "don't build the
16
docs" rather than causing the build to fail entirely, which is
17
probably what most users building on a host old enough to have such
18
an old Sphinx would want; if they do want the docs then they'll have
19
a useful indication of what they need to do (upgrade Sphinx!) rather
20
than a confusing error message.
21
22
In theory our distro support policy would suggest that we should
23
support building on the Sphinx shipped in those distros, but:
24
* EPEL7 has Sphinx 1.2.3 (which we've never supported!)
25
* Debian Stretch has Sphinx 1.4.8
26
27
Trying to get our docs to work with Sphinx 1.4 is not tractable
28
for the 5.0 release and I'm not sure it's worthwhile effort anyway;
29
at least with this change the build as a whole now succeeds.
30
31
Thanks to John Snow for doing the investigation and testing to
32
confirm what Sphinx versions fail in what ways and what distros
33
shipped what.
7
34
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
35
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
36
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Message-id: 20180313153458.26822-2-peter.maydell@linaro.org
12
---
37
---
13
hw/arm/raspi.c | 17 +++++++++++++----
38
docs/conf.py | 6 ++++--
14
1 file changed, 13 insertions(+), 4 deletions(-)
39
1 file changed, 4 insertions(+), 2 deletions(-)
15
40
16
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
41
diff --git a/docs/conf.py b/docs/conf.py
17
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/raspi.c
43
--- a/docs/conf.py
19
+++ b/hw/arm/raspi.c
44
+++ b/docs/conf.py
20
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
45
@@ -XXX,XX +XXX,XX @@ sys.path.insert(0, os.path.join(qemu_docdir, "sphinx"))
21
binfo.board_id = raspi_boardid[version];
46
22
binfo.ram_size = ram_size;
47
# If your documentation needs a minimal Sphinx version, state it here.
23
binfo.nb_cpus = smp_cpus;
48
#
24
- binfo.board_setup_addr = BOARDSETUP_ADDR;
49
-# 1.3 is where the 'alabaster' theme was shipped with Sphinx.
25
- binfo.write_board_setup = write_board_setup;
50
-needs_sphinx = '1.3'
26
- binfo.secure_board_setup = true;
51
+# Sphinx 1.5 and earlier can't build our docs because they are too
27
- binfo.secure_boot = true;
52
+# picky about the syntax of the argument to the option:: directive
28
+
53
+# (see Sphinx bugs #646, #3366).
29
+ if (version <= 2) {
54
+needs_sphinx = '1.6'
30
+ /* The rpi1 and 2 require some custom setup code to run in Secure
55
31
+ * mode before booting a kernel (to set up the SMC vectors so
56
# Add any Sphinx extension module names here, as strings. They can be
32
+ * that we get a no-op SMC; this is used by Linux to call the
57
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33
+ * firmware for some cache maintenance operations.
34
+ * The rpi3 doesn't need this.
35
+ */
36
+ binfo.board_setup_addr = BOARDSETUP_ADDR;
37
+ binfo.write_board_setup = write_board_setup;
38
+ binfo.secure_board_setup = true;
39
+ binfo.secure_boot = true;
40
+ }
41
42
/* Pi2 and Pi3 requires SMP setup */
43
if (version >= 2) {
44
--
58
--
45
2.16.2
59
2.20.1
46
60
47
61
diff view generated by jsdifflib
1
The raspi3 has AArch64 CPUs, which means that our smpboot
1
The Linux kernel has dropped support for allowing 32-bit Arm systems
2
code for keeping the secondary CPUs in a pen needs to have
2
to host KVM guests (kernel commit 541ad0150ca4aa663a2, which just
3
a version for A64 as well as A32. Without this, the
3
landed upstream in the 5.7 merge window). Mark QEMU's support for
4
secondary CPUs go into an infinite loop of taking undefined
4
this configuration as deprecated, so that we can delete that support
5
instruction exceptions.
5
code in 5.2.
6
6
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Andrew Jones <drjones@redhat.com>
9
Message-id: 20180313153458.26822-10-peter.maydell@linaro.org
10
---
9
---
11
hw/arm/raspi.c | 41 ++++++++++++++++++++++++++++++++++++++++-
10
docs/system/deprecated.rst | 8 ++++++++
12
1 file changed, 40 insertions(+), 1 deletion(-)
11
1 file changed, 8 insertions(+)
13
12
14
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
13
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/raspi.c
15
--- a/docs/system/deprecated.rst
17
+++ b/hw/arm/raspi.c
16
+++ b/docs/system/deprecated.rst
18
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ The ``compat`` property used to set backwards compatibility modes for
19
#define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */
18
the processor has been deprecated. The ``max-cpu-compat`` property of
20
#define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default */
19
the ``pseries`` machine type should be used instead.
21
#define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */
20
22
+#define SPINTABLE_ADDR 0xd8 /* Pi 3 bootloader spintable */
21
+KVM guest support on 32-bit Arm hosts (since 5.0)
23
22
+'''''''''''''''''''''''''''''''''''''''''''''''''
24
/* Table of Linux board IDs for different Pi versions */
25
static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};
26
@@ -XXX,XX +XXX,XX @@ static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
27
info->smp_loader_start);
28
}
29
30
+static void write_smpboot64(ARMCPU *cpu, const struct arm_boot_info *info)
31
+{
32
+ /* Unlike the AArch32 version we don't need to call the board setup hook.
33
+ * The mechanism for doing the spin-table is also entirely different.
34
+ * We must have four 64-bit fields at absolute addresses
35
+ * 0xd8, 0xe0, 0xe8, 0xf0 in RAM, which are the flag variables for
36
+ * our CPUs, and which we must ensure are zero initialized before
37
+ * the primary CPU goes into the kernel. We put these variables inside
38
+ * a rom blob, so that the reset for ROM contents zeroes them for us.
39
+ */
40
+ static const uint32_t smpboot[] = {
41
+ 0xd2801b05, /* mov x5, 0xd8 */
42
+ 0xd53800a6, /* mrs x6, mpidr_el1 */
43
+ 0x924004c6, /* and x6, x6, #0x3 */
44
+ 0xd503205f, /* spin: wfe */
45
+ 0xf86678a4, /* ldr x4, [x5,x6,lsl #3] */
46
+ 0xb4ffffc4, /* cbz x4, spin */
47
+ 0xd2800000, /* mov x0, #0x0 */
48
+ 0xd2800001, /* mov x1, #0x0 */
49
+ 0xd2800002, /* mov x2, #0x0 */
50
+ 0xd2800003, /* mov x3, #0x0 */
51
+ 0xd61f0080, /* br x4 */
52
+ };
53
+
23
+
54
+ static const uint64_t spintables[] = {
24
+The Linux kernel has dropped support for allowing 32-bit Arm systems
55
+ 0, 0, 0, 0
25
+to host KVM guests as of the 5.7 kernel. Accordingly, QEMU is deprecating
56
+ };
26
+its support for this configuration and will remove it in a future version.
27
+Running 32-bit guests on a 64-bit Arm host remains supported.
57
+
28
+
58
+ rom_add_blob_fixed("raspi_smpboot", smpboot, sizeof(smpboot),
29
System emulator devices
59
+ info->smp_loader_start);
30
-----------------------
60
+ rom_add_blob_fixed("raspi_spintables", spintables, sizeof(spintables),
61
+ SPINTABLE_ADDR);
62
+}
63
+
64
static void write_board_setup(ARMCPU *cpu, const struct arm_boot_info *info)
65
{
66
arm_write_secure_board_setup_dummy_smc(cpu, info, MVBAR_ADDR);
67
@@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
68
/* Pi2 and Pi3 requires SMP setup */
69
if (version >= 2) {
70
binfo.smp_loader_start = SMPBOOT_ADDR;
71
- binfo.write_secondary_boot = write_smpboot;
72
+ if (version == 2) {
73
+ binfo.write_secondary_boot = write_smpboot;
74
+ } else {
75
+ binfo.write_secondary_boot = write_smpboot64;
76
+ }
77
binfo.secondary_cpu_reset_hook = reset_secondary;
78
}
79
31
80
--
32
--
81
2.16.2
33
2.20.1
82
34
83
35
diff view generated by jsdifflib