1 | Almost nothing in here is arm-related, but the target-arm | 1 | arm pullreq for rc1. All minor bugfixes, except for the sve-default-vector-length |
---|---|---|---|
2 | queue was convenient for these last minute bits and pieces | 2 | patches, which are somewhere between a bugfix and a new feature. |
3 | for 5.0... | ||
4 | 3 | ||
5 | thanks | 4 | thanks |
6 | -- PMM | 5 | -- PMM |
7 | 6 | ||
8 | The following changes since commit 14e5526b51910efd62cd31cd95b49baca975c83f: | 7 | The following changes since commit c08ccd1b53f488ac86c1f65cf7623dc91acc249a: |
9 | 8 | ||
10 | Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2020-04-13 15:42:51 +0100) | 9 | Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210726' into staging (2021-07-27 08:35:01 +0100) |
11 | 10 | ||
12 | are available in the Git repository at: | 11 | are available in the Git repository at: |
13 | 12 | ||
14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200414 | 13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210727 |
15 | 14 | ||
16 | for you to fetch changes up to 84f82ddcbb4ac4ed04c8675e85155329f23184f0: | 15 | for you to fetch changes up to e229a179a503f2aee43a76888cf12fbdfe8a3749: |
17 | 16 | ||
18 | Deprecate KVM support for AArch32 (2020-04-14 17:20:22 +0100) | 17 | hw: aspeed_gpio: Fix memory size (2021-07-27 11:00:00 +0100) |
19 | 18 | ||
20 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
21 | patch queue: | 20 | target-arm queue: |
22 | * Fix some problems that trip up Coverity's scanner | 21 | * hw/arm/smmuv3: Check 31st bit to see if CD is valid |
23 | * run-coverity-scan: New script automating the scan-and-upload process | 22 | * qemu-options.hx: Fix formatting of -machine memory-backend option |
24 | * docs: Improve our gdbstub documentation | 23 | * hw: aspeed_gpio: Fix memory size |
25 | * configure: Honour --disable-werror for Sphinx | 24 | * hw/arm/nseries: Display hexadecimal value with '0x' prefix |
26 | * docs: Fix errors produced when building with Sphinx 3.0 | 25 | * Add sve-default-vector-length cpu property |
27 | * docs: Require Sphinx 1.6 or better | 26 | * docs: Update path that mentions deprecated.rst |
28 | * Add deprecation notice for KVM support on AArch32 hosts | 27 | * hw/intc/armv7m_nvic: for v8.1M VECTPENDING hides S exceptions from NS |
28 | * hw/intc/armv7m_nvic: Correct size of ICSR.VECTPENDING | ||
29 | * hw/intc/armv7m_nvic: ISCR.ISRPENDING is set for non-enabled pending interrupts | ||
30 | * target/arm: Report M-profile alignment faults correctly to the guest | ||
31 | * target/arm: Add missing 'return's after calling v7m_exception_taken() | ||
32 | * target/arm: Enforce that M-profile SP low 2 bits are always zero | ||
29 | 33 | ||
30 | ---------------------------------------------------------------- | 34 | ---------------------------------------------------------------- |
31 | Peter Maydell (12): | 35 | Joe Komlodi (1): |
32 | osdep.h: Drop no-longer-needed Coverity workarounds | 36 | hw/arm/smmuv3: Check 31st bit to see if CD is valid |
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 | ||
44 | 37 | ||
45 | configure | 9 +- | 38 | Joel Stanley (1): |
46 | Makefile | 2 +- | 39 | hw: aspeed_gpio: Fix memory size |
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 | ||
62 | 40 | ||
41 | Mao Zhongyi (1): | ||
42 | docs: Update path that mentions deprecated.rst | ||
43 | |||
44 | Peter Maydell (7): | ||
45 | qemu-options.hx: Fix formatting of -machine memory-backend option | ||
46 | target/arm: Enforce that M-profile SP low 2 bits are always zero | ||
47 | target/arm: Add missing 'return's after calling v7m_exception_taken() | ||
48 | target/arm: Report M-profile alignment faults correctly to the guest | ||
49 | hw/intc/armv7m_nvic: ISCR.ISRPENDING is set for non-enabled pending interrupts | ||
50 | hw/intc/armv7m_nvic: Correct size of ICSR.VECTPENDING | ||
51 | hw/intc/armv7m_nvic: for v8.1M VECTPENDING hides S exceptions from NS | ||
52 | |||
53 | Philippe Mathieu-Daudé (1): | ||
54 | hw/arm/nseries: Display hexadecimal value with '0x' prefix | ||
55 | |||
56 | Richard Henderson (3): | ||
57 | target/arm: Correctly bound length in sve_zcr_get_valid_len | ||
58 | target/arm: Export aarch64_sve_zcr_get_valid_len | ||
59 | target/arm: Add sve-default-vector-length cpu property | ||
60 | |||
61 | docs/system/arm/cpu-features.rst | 15 ++++++++++ | ||
62 | configure | 2 +- | ||
63 | hw/arm/smmuv3-internal.h | 2 +- | ||
64 | target/arm/cpu.h | 5 ++++ | ||
65 | target/arm/internals.h | 10 +++++++ | ||
66 | hw/arm/nseries.c | 2 +- | ||
67 | hw/gpio/aspeed_gpio.c | 3 +- | ||
68 | hw/intc/armv7m_nvic.c | 40 +++++++++++++++++++-------- | ||
69 | target/arm/cpu.c | 14 ++++++++-- | ||
70 | target/arm/cpu64.c | 60 ++++++++++++++++++++++++++++++++++++++++ | ||
71 | target/arm/gdbstub.c | 4 +++ | ||
72 | target/arm/helper.c | 8 ++++-- | ||
73 | target/arm/m_helper.c | 24 ++++++++++++---- | ||
74 | target/arm/translate.c | 3 ++ | ||
75 | target/i386/cpu.c | 2 +- | ||
76 | MAINTAINERS | 2 +- | ||
77 | qemu-options.hx | 30 +++++++++++--------- | ||
78 | 17 files changed, 183 insertions(+), 43 deletions(-) | ||
79 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Joe Komlodi <joe.komlodi@xilinx.com> | ||
1 | 2 | ||
3 | The bit to see if a CD is valid is the last bit of the first word of the CD. | ||
4 | |||
5 | Signed-off-by: Joe Komlodi <joe.komlodi@xilinx.com> | ||
6 | Message-id: 1626728232-134665-2-git-send-email-joe.komlodi@xilinx.com | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/arm/smmuv3-internal.h | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/arm/smmuv3-internal.h | ||
16 | +++ b/hw/arm/smmuv3-internal.h | ||
17 | @@ -XXX,XX +XXX,XX @@ static inline int pa_range(STE *ste) | ||
18 | |||
19 | /* CD fields */ | ||
20 | |||
21 | -#define CD_VALID(x) extract32((x)->word[0], 30, 1) | ||
22 | +#define CD_VALID(x) extract32((x)->word[0], 31, 1) | ||
23 | #define CD_ASID(x) extract32((x)->word[1], 16, 16) | ||
24 | #define CD_TTB(x, sel) \ | ||
25 | ({ \ | ||
26 | -- | ||
27 | 2.20.1 | ||
28 | |||
29 | diff view generated by jsdifflib |
1 | The documentation of our -s and -gdb options is quite old; in | 1 | The documentation of the -machine memory-backend has some minor |
---|---|---|---|
2 | particular it still claims that it will cause QEMU to stop and wait | 2 | formatting errors: |
3 | for the gdb connection, when this has not been true for some time: | 3 | * Misindentation of the initial line meant that the whole option |
4 | you also need to pass -S if you want to make QEMU not launch the | 4 | section is incorrectly indented in the HTML output compared to |
5 | guest on startup. | 5 | the other -machine options |
6 | * The examples weren't indented, which meant that they were formatted | ||
7 | as plain run-on text including outputting the "::" as text. | ||
8 | * The a) b) list has no rst-format markup so it is rendered as | ||
9 | a single run-on paragraph | ||
6 | 10 | ||
7 | Improve the documentation to mention this requirement in the | 11 | Fix the formatting. |
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"). | ||
14 | 12 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 14 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Message-id: 20210719105257.3599-1-peter.maydell@linaro.org |
18 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
19 | Message-id: 20200403094014.9589-1-peter.maydell@linaro.org | ||
20 | --- | 16 | --- |
21 | docs/system/gdb.rst | 22 +++++++++++++++------- | 17 | qemu-options.hx | 30 +++++++++++++++++------------- |
22 | qemu-options.hx | 24 ++++++++++++++++++------ | 18 | 1 file changed, 17 insertions(+), 13 deletions(-) |
23 | 2 files changed, 33 insertions(+), 13 deletions(-) | ||
24 | 19 | ||
25 | diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/docs/system/gdb.rst | ||
28 | +++ b/docs/system/gdb.rst | ||
29 | @@ -XXX,XX +XXX,XX @@ | ||
30 | GDB usage | ||
31 | --------- | ||
32 | |||
33 | -QEMU has a primitive support to work with gdb, so that you can do | ||
34 | -'Ctrl-C' while the virtual machine is running and inspect its state. | ||
35 | +QEMU supports working with gdb via gdb's remote-connection facility | ||
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" | ||
57 | + | ||
58 | +QEMU will launch but will silently wait for gdb to connect. | ||
59 | |||
60 | Then launch gdb on the 'vmlinux' executable:: | ||
61 | |||
62 | diff --git a/qemu-options.hx b/qemu-options.hx | 20 | diff --git a/qemu-options.hx b/qemu-options.hx |
63 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
64 | --- a/qemu-options.hx | 22 | --- a/qemu-options.hx |
65 | +++ b/qemu-options.hx | 23 | +++ b/qemu-options.hx |
66 | @@ -XXX,XX +XXX,XX @@ SRST | 24 | @@ -XXX,XX +XXX,XX @@ SRST |
25 | Enables or disables ACPI Heterogeneous Memory Attribute Table | ||
26 | (HMAT) support. The default is off. | ||
27 | |||
28 | - ``memory-backend='id'`` | ||
29 | + ``memory-backend='id'`` | ||
30 | An alternative to legacy ``-mem-path`` and ``mem-prealloc`` options. | ||
31 | Allows to use a memory backend as main RAM. | ||
32 | |||
33 | For example: | ||
34 | :: | ||
35 | - -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on | ||
36 | - -machine memory-backend=pc.ram | ||
37 | - -m 512M | ||
38 | + | ||
39 | + -object memory-backend-file,id=pc.ram,size=512M,mem-path=/hugetlbfs,prealloc=on,share=on | ||
40 | + -machine memory-backend=pc.ram | ||
41 | + -m 512M | ||
42 | |||
43 | Migration compatibility note: | ||
44 | - a) as backend id one shall use value of 'default-ram-id', advertised by | ||
45 | - machine type (available via ``query-machines`` QMP command), if migration | ||
46 | - to/from old QEMU (<5.0) is expected. | ||
47 | - b) for machine types 4.0 and older, user shall | ||
48 | - use ``x-use-canonical-path-for-ramblock-id=off`` backend option | ||
49 | - if migration to/from old QEMU (<5.0) is expected. | ||
50 | + | ||
51 | + * as backend id one shall use value of 'default-ram-id', advertised by | ||
52 | + machine type (available via ``query-machines`` QMP command), if migration | ||
53 | + to/from old QEMU (<5.0) is expected. | ||
54 | + * for machine types 4.0 and older, user shall | ||
55 | + use ``x-use-canonical-path-for-ramblock-id=off`` backend option | ||
56 | + if migration to/from old QEMU (<5.0) is expected. | ||
57 | + | ||
58 | For example: | ||
59 | :: | ||
60 | - -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off | ||
61 | - -machine memory-backend=pc.ram | ||
62 | - -m 512M | ||
63 | + | ||
64 | + -object memory-backend-ram,id=pc.ram,size=512M,x-use-canonical-path-for-ramblock-id=off | ||
65 | + -machine memory-backend=pc.ram | ||
66 | + -m 512M | ||
67 | ERST | 67 | ERST |
68 | 68 | ||
69 | DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \ | 69 | HXCOMM Deprecated by -machine |
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 | |||
99 | -- | 70 | -- |
100 | 2.20.1 | 71 | 2.20.1 |
101 | 72 | ||
102 | 73 | diff view generated by jsdifflib |
1 | When kernel-doc generates a 'c:function' directive for a function | 1 | For M-profile, unlike A-profile, the low 2 bits of SP are defined to be |
---|---|---|---|
2 | one of whose arguments is a function pointer, it fails to print | 2 | RES0H, which is to say that they must be hardwired to zero so that |
3 | the close-paren after the argument list of the function pointer | 3 | guest attempts to write non-zero values to them are ignored. |
4 | argument, for instance in the memory API documentation: | ||
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 | 4 | ||
7 | which should have a ')' after the 'void *host' which is the | 5 | Implement this behaviour by masking out the low bits: |
8 | last argument to 'resized'. | 6 | * for writes to r13 by the gdbstub |
7 | * for writes to any of the various flavours of SP via MSR | ||
8 | * for writes to r13 via store_reg() in generated code | ||
9 | 9 | ||
10 | Older versions of Sphinx don't try to parse the argumnet | 10 | Note that all the direct uses of cpu_R[] in translate.c are in places |
11 | to c:function, but Sphinx 3.0 does do this and will complain: | 11 | where the register is definitely not r13 (usually because that has |
12 | been checked for as an UNDEFINED or UNPREDICTABLE case and handled as | ||
13 | UNDEF). | ||
12 | 14 | ||
13 | /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:834: WARNING: Error in declarator or parameters | 15 | All the other writes to regs[13] in C code are either: |
14 | Invalid C declaration: Expecting "," or ")" in parameters, got "EOF". [error at 208] | 16 | * A-profile only code |
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) | 17 | * writes of values we can guarantee to be aligned, such as |
16 | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^ | 18 | - writes of previous-SP-value plus or minus a 4-aligned constant |
17 | 19 | - writes of the value in an SP limit register (which we already | |
18 | Add the missing close-paren. | 20 | enforce to be aligned) |
19 | 21 | ||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
21 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 23 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
22 | Message-id: 20200411182934.28678-3-peter.maydell@linaro.org | 24 | Message-id: 20210723162146.5167-2-peter.maydell@linaro.org |
23 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
24 | --- | 25 | --- |
25 | scripts/kernel-doc | 2 +- | 26 | target/arm/gdbstub.c | 4 ++++ |
26 | 1 file changed, 1 insertion(+), 1 deletion(-) | 27 | target/arm/m_helper.c | 14 ++++++++------ |
28 | target/arm/translate.c | 3 +++ | ||
29 | 3 files changed, 15 insertions(+), 6 deletions(-) | ||
27 | 30 | ||
28 | diff --git a/scripts/kernel-doc b/scripts/kernel-doc | 31 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c |
29 | index XXXXXXX..XXXXXXX 100755 | 32 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/scripts/kernel-doc | 33 | --- a/target/arm/gdbstub.c |
31 | +++ b/scripts/kernel-doc | 34 | +++ b/target/arm/gdbstub.c |
32 | @@ -XXX,XX +XXX,XX @@ sub output_function_rst(%) { | 35 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) |
33 | 36 | ||
34 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | 37 | if (n < 16) { |
35 | # pointer-to-function | 38 | /* Core integer register. */ |
36 | - print $1 . $parameter . ") (" . $2; | 39 | + if (n == 13 && arm_feature(env, ARM_FEATURE_M)) { |
37 | + print $1 . $parameter . ") (" . $2 . ")"; | 40 | + /* M profile SP low bits are always 0 */ |
38 | } else { | 41 | + tmp &= ~3; |
39 | print $type . " " . $parameter; | 42 | + } |
40 | } | 43 | env->regs[n] = tmp; |
44 | return 4; | ||
45 | } | ||
46 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/target/arm/m_helper.c | ||
49 | +++ b/target/arm/m_helper.c | ||
50 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
51 | if (!env->v7m.secure) { | ||
52 | return; | ||
53 | } | ||
54 | - env->v7m.other_ss_msp = val; | ||
55 | + env->v7m.other_ss_msp = val & ~3; | ||
56 | return; | ||
57 | case 0x89: /* PSP_NS */ | ||
58 | if (!env->v7m.secure) { | ||
59 | return; | ||
60 | } | ||
61 | - env->v7m.other_ss_psp = val; | ||
62 | + env->v7m.other_ss_psp = val & ~3; | ||
63 | return; | ||
64 | case 0x8a: /* MSPLIM_NS */ | ||
65 | if (!env->v7m.secure) { | ||
66 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
67 | |||
68 | limit = is_psp ? env->v7m.psplim[false] : env->v7m.msplim[false]; | ||
69 | |||
70 | + val &= ~0x3; | ||
71 | + | ||
72 | if (val < limit) { | ||
73 | raise_exception_ra(env, EXCP_STKOF, 0, 1, GETPC()); | ||
74 | } | ||
75 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
76 | break; | ||
77 | case 8: /* MSP */ | ||
78 | if (v7m_using_psp(env)) { | ||
79 | - env->v7m.other_sp = val; | ||
80 | + env->v7m.other_sp = val & ~3; | ||
81 | } else { | ||
82 | - env->regs[13] = val; | ||
83 | + env->regs[13] = val & ~3; | ||
84 | } | ||
85 | break; | ||
86 | case 9: /* PSP */ | ||
87 | if (v7m_using_psp(env)) { | ||
88 | - env->regs[13] = val; | ||
89 | + env->regs[13] = val & ~3; | ||
90 | } else { | ||
91 | - env->v7m.other_sp = val; | ||
92 | + env->v7m.other_sp = val & ~3; | ||
93 | } | ||
94 | break; | ||
95 | case 10: /* MSPLIM */ | ||
96 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/target/arm/translate.c | ||
99 | +++ b/target/arm/translate.c | ||
100 | @@ -XXX,XX +XXX,XX @@ void store_reg(DisasContext *s, int reg, TCGv_i32 var) | ||
101 | */ | ||
102 | tcg_gen_andi_i32(var, var, s->thumb ? ~1 : ~3); | ||
103 | s->base.is_jmp = DISAS_JUMP; | ||
104 | + } else if (reg == 13 && arm_dc_feature(s, ARM_FEATURE_M)) { | ||
105 | + /* For M-profile SP bits [1:0] are always zero */ | ||
106 | + tcg_gen_andi_i32(var, var, ~3); | ||
107 | } | ||
108 | tcg_gen_mov_i32(cpu_R[reg], var); | ||
109 | tcg_temp_free_i32(var); | ||
41 | -- | 110 | -- |
42 | 2.20.1 | 111 | 2.20.1 |
43 | 112 | ||
44 | 113 | diff view generated by jsdifflib |
1 | Versions of Sphinx older than 1.6 can't build all of our documentation, | 1 | In do_v7m_exception_exit(), we perform various checks as part of |
---|---|---|---|
2 | because they are too picky about the syntax of the argument to the | 2 | performing the exception return. If one of these checks fails, the |
3 | option:: directive; see Sphinx bugs #646, #3366: | 3 | architecture requires that we take an appropriate exception on the |
4 | existing stackframe. We implement this by calling | ||
5 | v7m_exception_taken() to set up to take the new exception, and then | ||
6 | immediately returning from do_v7m_exception_exit() without proceeding | ||
7 | any further with the unstack-and-exception-return process. | ||
4 | 8 | ||
5 | https://github.com/sphinx-doc/sphinx/issues/646 | 9 | In a couple of checks that are new in v8.1M, we forgot the "return" |
6 | https://github.com/sphinx-doc/sphinx/issues/3366 | 10 | statement, with the effect that if bad code in the guest tripped over |
11 | these checks we would set up to take a UsageFault exception but then | ||
12 | blunder on trying to also unstack and return from the original | ||
13 | exception, with the probable result that the guest would crash. | ||
7 | 14 | ||
8 | Trying to build with a 1.4.x Sphinx fails with | 15 | Add the missing return statements. |
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. | ||
34 | 16 | ||
35 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
36 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
19 | Message-id: 20210723162146.5167-3-peter.maydell@linaro.org | ||
37 | --- | 20 | --- |
38 | docs/conf.py | 6 ++++-- | 21 | target/arm/m_helper.c | 2 ++ |
39 | 1 file changed, 4 insertions(+), 2 deletions(-) | 22 | 1 file changed, 2 insertions(+) |
40 | 23 | ||
41 | diff --git a/docs/conf.py b/docs/conf.py | 24 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c |
42 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
43 | --- a/docs/conf.py | 26 | --- a/target/arm/m_helper.c |
44 | +++ b/docs/conf.py | 27 | +++ b/target/arm/m_helper.c |
45 | @@ -XXX,XX +XXX,XX @@ sys.path.insert(0, os.path.join(qemu_docdir, "sphinx")) | 28 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) |
46 | 29 | qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing " | |
47 | # If your documentation needs a minimal Sphinx version, state it here. | 30 | "stackframe: NSACR prevents clearing FPU registers\n"); |
48 | # | 31 | v7m_exception_taken(cpu, excret, true, false); |
49 | -# 1.3 is where the 'alabaster' theme was shipped with Sphinx. | 32 | + return; |
50 | -needs_sphinx = '1.3' | 33 | } else if (!cpacr_pass) { |
51 | +# Sphinx 1.5 and earlier can't build our docs because they are too | 34 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, |
52 | +# picky about the syntax of the argument to the option:: directive | 35 | exc_secure); |
53 | +# (see Sphinx bugs #646, #3366). | 36 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) |
54 | +needs_sphinx = '1.6' | 37 | qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing " |
55 | 38 | "stackframe: CPACR prevents clearing FPU registers\n"); | |
56 | # Add any Sphinx extension module names here, as strings. They can be | 39 | v7m_exception_taken(cpu, excret, true, false); |
57 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | 40 | + return; |
41 | } | ||
42 | } | ||
43 | /* Clear s0..s15, FPSCR and VPR */ | ||
58 | -- | 44 | -- |
59 | 2.20.1 | 45 | 2.20.1 |
60 | 46 | ||
61 | 47 | diff view generated by jsdifflib |
1 | The Linux kernel has dropped support for allowing 32-bit Arm systems | 1 | For M-profile, we weren't reporting alignment faults triggered by the |
---|---|---|---|
2 | to host KVM guests (kernel commit 541ad0150ca4aa663a2, which just | 2 | generic TCG code correctly to the guest. These get passed into |
3 | landed upstream in the 5.7 merge window). Mark QEMU's support for | 3 | arm_v7m_cpu_do_interrupt() as an EXCP_DATA_ABORT with an A-profile |
4 | this configuration as deprecated, so that we can delete that support | 4 | style exception.fsr value of 1. We didn't check for this, and so |
5 | code in 5.2. | 5 | they fell through into the default of "assume this is an MPU fault" |
6 | and were reported to the guest as a data access violation MPU fault. | ||
7 | |||
8 | Report these alignment faults as UsageFaults which set the UNALIGNED | ||
9 | bit in the UFSR. | ||
6 | 10 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Andrew Jones <drjones@redhat.com> | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
13 | Message-id: 20210723162146.5167-4-peter.maydell@linaro.org | ||
9 | --- | 14 | --- |
10 | docs/system/deprecated.rst | 8 ++++++++ | 15 | target/arm/m_helper.c | 8 ++++++++ |
11 | 1 file changed, 8 insertions(+) | 16 | 1 file changed, 8 insertions(+) |
12 | 17 | ||
13 | diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst | 18 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c |
14 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/docs/system/deprecated.rst | 20 | --- a/target/arm/m_helper.c |
16 | +++ b/docs/system/deprecated.rst | 21 | +++ b/target/arm/m_helper.c |
17 | @@ -XXX,XX +XXX,XX @@ The ``compat`` property used to set backwards compatibility modes for | 22 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) |
18 | the processor has been deprecated. The ``max-cpu-compat`` property of | 23 | env->v7m.sfsr |= R_V7M_SFSR_LSERR_MASK; |
19 | the ``pseries`` machine type should be used instead. | 24 | break; |
20 | 25 | case EXCP_UNALIGNED: | |
21 | +KVM guest support on 32-bit Arm hosts (since 5.0) | 26 | + /* Unaligned faults reported by M-profile aware code */ |
22 | +''''''''''''''''''''''''''''''''''''''''''''''''' | 27 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, env->v7m.secure); |
23 | + | 28 | env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNALIGNED_MASK; |
24 | +The Linux kernel has dropped support for allowing 32-bit Arm systems | 29 | break; |
25 | +to host KVM guests as of the 5.7 kernel. Accordingly, QEMU is deprecating | 30 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) |
26 | +its support for this configuration and will remove it in a future version. | 31 | } |
27 | +Running 32-bit guests on a 64-bit Arm host remains supported. | 32 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS, false); |
28 | + | 33 | break; |
29 | System emulator devices | 34 | + case 0x1: /* Alignment fault reported by generic code */ |
30 | ----------------------- | 35 | + qemu_log_mask(CPU_LOG_INT, |
31 | 36 | + "...really UsageFault with UFSR.UNALIGNED\n"); | |
37 | + env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNALIGNED_MASK; | ||
38 | + armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, | ||
39 | + env->v7m.secure); | ||
40 | + break; | ||
41 | default: | ||
42 | /* | ||
43 | * All other FSR values are either MPU faults or "can't happen | ||
32 | -- | 44 | -- |
33 | 2.20.1 | 45 | 2.20.1 |
34 | 46 | ||
35 | 47 | diff view generated by jsdifflib |
1 | All the Coverity-specific definitions of qemu_mutex_lock() and friends | 1 | The ISCR.ISRPENDING bit is set when an external interrupt is pending. |
---|---|---|---|
2 | have a trailing semicolon. This works fine almost everywhere because | 2 | This is true whether that external interrupt is enabled or not. |
3 | of QEMU's mandatory-braces coding style and because most callsites are | 3 | This means that we can't use 's->vectpending == 0' as a shortcut to |
4 | simple, but target/s390x/sigp.c has a use of qemu_mutex_trylock() as | 4 | "ISRPENDING is zero", because s->vectpending indicates only the |
5 | an if() statement, which makes the ';' a syntax error: | 5 | highest priority pending enabled interrupt. |
6 | "../target/s390x/sigp.c", line 461: warning #18: expected a ")" | ||
7 | if (qemu_mutex_trylock(&qemu_sigp_mutex)) { | ||
8 | ^ | ||
9 | 6 | ||
10 | Remove the bogus semicolons from the macro definitions. | 7 | Remove the incorrect optimization so that if there is no pending |
8 | enabled interrupt we fall through to scanning through the whole | ||
9 | interrupt array. | ||
11 | 10 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
14 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 13 | Message-id: 20210723162146.5167-5-peter.maydell@linaro.org |
15 | Message-id: 20200319193323.2038-4-peter.maydell@linaro.org | ||
16 | --- | 14 | --- |
17 | include/qemu/thread.h | 12 ++++++------ | 15 | hw/intc/armv7m_nvic.c | 9 ++++----- |
18 | 1 file changed, 6 insertions(+), 6 deletions(-) | 16 | 1 file changed, 4 insertions(+), 5 deletions(-) |
19 | 17 | ||
20 | diff --git a/include/qemu/thread.h b/include/qemu/thread.h | 18 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
21 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/qemu/thread.h | 20 | --- a/hw/intc/armv7m_nvic.c |
23 | +++ b/include/qemu/thread.h | 21 | +++ b/hw/intc/armv7m_nvic.c |
24 | @@ -XXX,XX +XXX,XX @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; | 22 | @@ -XXX,XX +XXX,XX @@ static bool nvic_isrpending(NVICState *s) |
25 | * hide them. | 23 | { |
26 | */ | 24 | int irq; |
27 | #define qemu_mutex_lock(m) \ | 25 | |
28 | - qemu_mutex_lock_impl(m, __FILE__, __LINE__); | 26 | - /* We can shortcut if the highest priority pending interrupt |
29 | + qemu_mutex_lock_impl(m, __FILE__, __LINE__) | 27 | - * happens to be external or if there is nothing pending. |
30 | #define qemu_mutex_trylock(m) \ | 28 | + /* |
31 | - qemu_mutex_trylock_impl(m, __FILE__, __LINE__); | 29 | + * We can shortcut if the highest priority pending interrupt |
32 | + qemu_mutex_trylock_impl(m, __FILE__, __LINE__) | 30 | + * happens to be external; if not we need to check the whole |
33 | #define qemu_rec_mutex_lock(m) \ | 31 | + * vectors[] array. |
34 | - qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__); | 32 | */ |
35 | + qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__) | 33 | if (s->vectpending > NVIC_FIRST_IRQ) { |
36 | #define qemu_rec_mutex_trylock(m) \ | 34 | return true; |
37 | - qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__); | 35 | } |
38 | + qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__) | 36 | - if (s->vectpending == 0) { |
39 | #define qemu_cond_wait(c, m) \ | 37 | - return false; |
40 | - qemu_cond_wait_impl(c, m, __FILE__, __LINE__); | 38 | - } |
41 | + qemu_cond_wait_impl(c, m, __FILE__, __LINE__) | 39 | |
42 | #define qemu_cond_timedwait(c, m, ms) \ | 40 | for (irq = NVIC_FIRST_IRQ; irq < s->num_irq; irq++) { |
43 | - qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); | 41 | if (s->vectors[irq].pending) { |
44 | + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__) | ||
45 | #else | ||
46 | #define qemu_mutex_lock(m) ({ \ | ||
47 | QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \ | ||
48 | -- | 42 | -- |
49 | 2.20.1 | 43 | 2.20.1 |
50 | 44 | ||
51 | 45 | diff view generated by jsdifflib |
1 | For Coverity's benefit, we provide simpler versions of functions like | 1 | The VECTPENDING field in the ICSR is 9 bits wide, in bits [20:12] of |
---|---|---|---|
2 | qemu_mutex_lock(), qemu_cond_wait() and qemu_cond_timedwait(). When | 2 | the register. We were incorrectly masking it to 8 bits, so it would |
3 | we added qemu_cond_timedwait() in commit 3dcc9c6ec4ea, a cut and | 3 | report the wrong value if the pending exception was greater than 256. |
4 | paste error meant that the Coverity version of qemu_cond_timedwait() | 4 | Fix the bug. |
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. | ||
25 | 5 | ||
26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
27 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
28 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Message-id: 20210723162146.5167-6-peter.maydell@linaro.org |
29 | Message-id: 20200319193323.2038-3-peter.maydell@linaro.org | ||
30 | --- | 9 | --- |
31 | include/qemu/thread.h | 2 +- | 10 | hw/intc/armv7m_nvic.c | 2 +- |
32 | 1 file changed, 1 insertion(+), 1 deletion(-) | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
33 | 12 | ||
34 | diff --git a/include/qemu/thread.h b/include/qemu/thread.h | 13 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
35 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/include/qemu/thread.h | 15 | --- a/hw/intc/armv7m_nvic.c |
37 | +++ b/include/qemu/thread.h | 16 | +++ b/hw/intc/armv7m_nvic.c |
38 | @@ -XXX,XX +XXX,XX @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; | 17 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) |
39 | #define qemu_cond_wait(c, m) \ | 18 | /* VECTACTIVE */ |
40 | qemu_cond_wait_impl(c, m, __FILE__, __LINE__); | 19 | val = cpu->env.v7m.exception; |
41 | #define qemu_cond_timedwait(c, m, ms) \ | 20 | /* VECTPENDING */ |
42 | - qemu_cond_wait_impl(c, m, ms, __FILE__, __LINE__); | 21 | - val |= (s->vectpending & 0xff) << 12; |
43 | + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); | 22 | + val |= (s->vectpending & 0x1ff) << 12; |
44 | #else | 23 | /* ISRPENDING - set if any external IRQ is pending */ |
45 | #define qemu_mutex_lock(m) ({ \ | 24 | if (nvic_isrpending(s)) { |
46 | QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \ | 25 | val |= (1 << 22); |
47 | -- | 26 | -- |
48 | 2.20.1 | 27 | 2.20.1 |
49 | 28 | ||
50 | 29 | diff view generated by jsdifflib |
1 | In commit a1a98357e3fd in 2018 we added some workarounds for Coverity | 1 | In Arm v8.1M the VECTPENDING field in the ICSR has new behaviour: if |
---|---|---|---|
2 | not being able to handle the _Float* types introduced by recent | 2 | the register is accessed NonSecure and the highest priority pending |
3 | glibc. Newer versions of the Coverity scan tools have support for | 3 | enabled exception (that would be returned in the VECTPENDING field) |
4 | these types, and will fail with errors about duplicate typedefs if we | 4 | targets Secure, then the VECTPENDING field must read 1 rather than |
5 | have our workaround. Remove our copy of the typedefs. | 5 | the exception number of the pending exception. Implement this. |
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: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20200319193323.2038-2-peter.maydell@linaro.org | 9 | Message-id: 20210723162146.5167-7-peter.maydell@linaro.org |
10 | --- | 10 | --- |
11 | include/qemu/osdep.h | 14 -------------- | 11 | hw/intc/armv7m_nvic.c | 31 ++++++++++++++++++++++++------- |
12 | 1 file changed, 14 deletions(-) | 12 | 1 file changed, 24 insertions(+), 7 deletions(-) |
13 | 13 | ||
14 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | 14 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/qemu/osdep.h | 16 | --- a/hw/intc/armv7m_nvic.c |
17 | +++ b/include/qemu/osdep.h | 17 | +++ b/hw/intc/armv7m_nvic.c |
18 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque) |
19 | #else | 19 | nvic_irq_update(s); |
20 | #include "exec/poison.h" | 20 | } |
21 | #endif | 21 | |
22 | -#ifdef __COVERITY__ | 22 | +static bool vectpending_targets_secure(NVICState *s) |
23 | -/* Coverity does not like the new _Float* types that are used by | 23 | +{ |
24 | - * recent glibc, and croaks on every single file that includes | 24 | + /* Return true if s->vectpending targets Secure state */ |
25 | - * stdlib.h. These typedefs are enough to please it. | 25 | + if (s->vectpending_is_s_banked) { |
26 | - * | 26 | + return true; |
27 | - * Note that these fix parse errors so they cannot be placed in | 27 | + } |
28 | - * scripts/coverity-model.c. | 28 | + return !exc_is_banked(s->vectpending) && |
29 | - */ | 29 | + exc_targets_secure(s, s->vectpending); |
30 | -typedef float _Float32; | 30 | +} |
31 | -typedef double _Float32x; | 31 | + |
32 | -typedef double _Float64; | 32 | void armv7m_nvic_get_pending_irq_info(void *opaque, |
33 | -typedef __float80 _Float64x; | 33 | int *pirq, bool *ptargets_secure) |
34 | -typedef __float128 _Float128; | 34 | { |
35 | -#endif | 35 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_get_pending_irq_info(void *opaque, |
36 | 36 | ||
37 | #include "qemu/compiler.h" | 37 | assert(pending > ARMV7M_EXCP_RESET && pending < s->num_irq); |
38 | 38 | ||
39 | - if (s->vectpending_is_s_banked) { | ||
40 | - targets_secure = true; | ||
41 | - } else { | ||
42 | - targets_secure = !exc_is_banked(pending) && | ||
43 | - exc_targets_secure(s, pending); | ||
44 | - } | ||
45 | + targets_secure = vectpending_targets_secure(s); | ||
46 | |||
47 | trace_nvic_get_pending_irq_info(pending, targets_secure); | ||
48 | |||
49 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | ||
50 | /* VECTACTIVE */ | ||
51 | val = cpu->env.v7m.exception; | ||
52 | /* VECTPENDING */ | ||
53 | - val |= (s->vectpending & 0x1ff) << 12; | ||
54 | + if (s->vectpending) { | ||
55 | + /* | ||
56 | + * From v8.1M VECTPENDING must read as 1 if accessed as | ||
57 | + * NonSecure and the highest priority pending and enabled | ||
58 | + * exception targets Secure. | ||
59 | + */ | ||
60 | + int vp = s->vectpending; | ||
61 | + if (!attrs.secure && arm_feature(&cpu->env, ARM_FEATURE_V8_1M) && | ||
62 | + vectpending_targets_secure(s)) { | ||
63 | + vp = 1; | ||
64 | + } | ||
65 | + val |= (vp & 0x1ff) << 12; | ||
66 | + } | ||
67 | /* ISRPENDING - set if any external IRQ is pending */ | ||
68 | if (nvic_isrpending(s)) { | ||
69 | val |= (1 << 22); | ||
39 | -- | 70 | -- |
40 | 2.20.1 | 71 | 2.20.1 |
41 | 72 | ||
42 | 73 | diff view generated by jsdifflib |
1 | If we are not making warnings fatal for compilation, make them | 1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> |
---|---|---|---|
2 | non-fatal when building the Sphinx documentation also. (For instance | ||
3 | Sphinx 3.0 warns about some constructs that older versions were happy | ||
4 | with, which is a build failure if we use the warnings-as-errors | ||
5 | flag.) | ||
6 | 2 | ||
7 | This provides a workaround at least for LP:1872113. | 3 | Missed in commit f3478392 "docs: Move deprecation, build |
4 | and license info out of system/" | ||
8 | 5 | ||
6 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Message-id: 20210723065828.1336760-1-maozhongyi@cmss.chinamobile.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20200411182934.28678-2-peter.maydell@linaro.org | ||
12 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
13 | --- | 10 | --- |
14 | configure | 9 ++++++++- | 11 | configure | 2 +- |
15 | Makefile | 2 +- | 12 | target/i386/cpu.c | 2 +- |
16 | 2 files changed, 9 insertions(+), 2 deletions(-) | 13 | MAINTAINERS | 2 +- |
14 | 3 files changed, 3 insertions(+), 3 deletions(-) | ||
17 | 15 | ||
18 | diff --git a/configure b/configure | 16 | diff --git a/configure b/configure |
19 | index XXXXXXX..XXXXXXX 100755 | 17 | index XXXXXXX..XXXXXXX 100755 |
20 | --- a/configure | 18 | --- a/configure |
21 | +++ b/configure | 19 | +++ b/configure |
22 | @@ -XXX,XX +XXX,XX @@ if check_include sys/kcov.h ; then | 20 | @@ -XXX,XX +XXX,XX @@ fi |
23 | kcov=yes | 21 | |
22 | if test -n "${deprecated_features}"; then | ||
23 | echo "Warning, deprecated features enabled." | ||
24 | - echo "Please see docs/system/deprecated.rst" | ||
25 | + echo "Please see docs/about/deprecated.rst" | ||
26 | echo " features: ${deprecated_features}" | ||
24 | fi | 27 | fi |
25 | 28 | ||
26 | +# If we're making warnings fatal, apply this to Sphinx runs as well | 29 | diff --git a/target/i386/cpu.c b/target/i386/cpu.c |
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 | ||
53 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
54 | --- a/Makefile | 31 | --- a/target/i386/cpu.c |
55 | +++ b/Makefile | 32 | +++ b/target/i386/cpu.c |
56 | @@ -XXX,XX +XXX,XX @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \ | 33 | @@ -XXX,XX +XXX,XX @@ static const X86CPUDefinition builtin_x86_defs[] = { |
57 | # Note the use of different doctree for each (manual, builder) tuple; | 34 | * none", but this is just for compatibility while libvirt isn't |
58 | # this works around Sphinx not handling parallel invocation on | 35 | * adapted to resolve CPU model versions before creating VMs. |
59 | # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946 | 36 | * See "Runnability guarantee of CPU models" at |
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") | 37 | - * docs/system/deprecated.rst. |
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") | 38 | + * docs/about/deprecated.rst. |
62 | # We assume all RST files in the manual's directory are used in it | 39 | */ |
63 | manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \ | 40 | X86CPUVersion default_cpu_version = 1; |
64 | $(SRC_PATH)/docs/defs.rst.inc \ | 41 | |
42 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/MAINTAINERS | ||
45 | +++ b/MAINTAINERS | ||
46 | @@ -XXX,XX +XXX,XX @@ F: contrib/gitdm/* | ||
47 | |||
48 | Incompatible changes | ||
49 | R: libvir-list@redhat.com | ||
50 | -F: docs/system/deprecated.rst | ||
51 | +F: docs/about/deprecated.rst | ||
52 | |||
53 | Build System | ||
54 | ------------ | ||
65 | -- | 55 | -- |
66 | 2.20.1 | 56 | 2.20.1 |
67 | 57 | ||
68 | 58 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Currently, our only caller is sve_zcr_len_for_el, which has | ||
4 | already masked the length extracted from ZCR_ELx, so the | ||
5 | masking done here is a nop. But we will shortly have uses | ||
6 | from other locations, where the length will be unmasked. | ||
7 | |||
8 | Saturate the length to ARM_MAX_VQ instead of truncating to | ||
9 | the low 4 bits. | ||
10 | |||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Message-id: 20210723203344.968563-2-richard.henderson@linaro.org | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | target/arm/helper.c | 4 +++- | ||
17 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/target/arm/helper.c | ||
22 | +++ b/target/arm/helper.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len) | ||
24 | { | ||
25 | uint32_t end_len; | ||
26 | |||
27 | - end_len = start_len &= 0xf; | ||
28 | + start_len = MIN(start_len, ARM_MAX_VQ - 1); | ||
29 | + end_len = start_len; | ||
30 | + | ||
31 | if (!test_bit(start_len, cpu->sve_vq_map)) { | ||
32 | end_len = find_last_bit(cpu->sve_vq_map, start_len); | ||
33 | assert(end_len < start_len); | ||
34 | -- | ||
35 | 2.20.1 | ||
36 | |||
37 | diff view generated by jsdifflib |
1 | The kernel-doc Sphinx plugin and associated script currently emit | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 'c:type' directives for "struct foo" documentation. | ||
3 | 2 | ||
4 | Sphinx 3.0 warns about this: | 3 | Rename from sve_zcr_get_valid_len and make accessible |
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. | 4 | from outside of helper.c. |
6 | If just a name: | ||
7 | Error in declarator or parameters | ||
8 | Invalid C declaration: Expected identifier in nested name, got keyword: struct [error at 6] | ||
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 | ---------------------^ | ||
16 | 5 | ||
17 | because it wants us to use the new-in-3.0 'c:struct' instead. | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Message-id: 20210723203344.968563-3-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/internals.h | 10 ++++++++++ | ||
12 | target/arm/helper.c | 4 ++-- | ||
13 | 2 files changed, 12 insertions(+), 2 deletions(-) | ||
18 | 14 | ||
19 | Plumb the Sphinx version through to the kernel-doc script | 15 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
20 | and use it to select 'c:struct' for newer versions than 3.0. | ||
21 | |||
22 | Fixes: LP:1872113 | ||
23 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
24 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
25 | --- | ||
26 | docs/sphinx/kerneldoc.py | 1 + | ||
27 | scripts/kernel-doc | 16 +++++++++++++++- | ||
28 | 2 files changed, 16 insertions(+), 1 deletion(-) | ||
29 | |||
30 | diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py | ||
31 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/docs/sphinx/kerneldoc.py | 17 | --- a/target/arm/internals.h |
33 | +++ b/docs/sphinx/kerneldoc.py | 18 | +++ b/target/arm/internals.h |
34 | @@ -XXX,XX +XXX,XX @@ class KernelDocDirective(Directive): | 19 | @@ -XXX,XX +XXX,XX @@ void arm_translate_init(void); |
35 | env.note_dependency(os.path.abspath(f)) | 20 | void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb); |
36 | cmd += ['-export-file', f] | 21 | #endif /* CONFIG_TCG */ |
37 | 22 | ||
38 | + cmd += ['-sphinx-version', sphinx.__version__] | 23 | +/** |
39 | cmd += [filename] | 24 | + * aarch64_sve_zcr_get_valid_len: |
40 | 25 | + * @cpu: cpu context | |
41 | try: | 26 | + * @start_len: maximum len to consider |
42 | diff --git a/scripts/kernel-doc b/scripts/kernel-doc | 27 | + * |
43 | index XXXXXXX..XXXXXXX 100755 | 28 | + * Return the maximum supported sve vector length <= @start_len. |
44 | --- a/scripts/kernel-doc | 29 | + * Note that both @start_len and the return value are in units |
45 | +++ b/scripts/kernel-doc | 30 | + * of ZCR_ELx.LEN, so the vector bit length is (x + 1) * 128. |
46 | @@ -XXX,XX +XXX,XX @@ Output selection (mutually exclusive): | 31 | + */ |
47 | DOC: sections. May be specified multiple times. | 32 | +uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len); |
48 | 33 | ||
49 | Output selection modifiers: | 34 | enum arm_fprounding { |
50 | + -sphinx-version VER Generate rST syntax for the specified Sphinx version. | 35 | FPROUNDING_TIEEVEN, |
51 | + Only works with reStructuredTextFormat. | 36 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
52 | -no-doc-sections Do not output DOC: sections. | 37 | index XXXXXXX..XXXXXXX 100644 |
53 | -enable-lineno Enable output of #define LINENO lines. Only works with | 38 | --- a/target/arm/helper.c |
54 | reStructuredText format. | 39 | +++ b/target/arm/helper.c |
55 | @@ -XXX,XX +XXX,XX @@ use constant { | 40 | @@ -XXX,XX +XXX,XX @@ int sve_exception_el(CPUARMState *env, int el) |
56 | }; | 41 | return 0; |
57 | my $output_selection = OUTPUT_ALL; | 42 | } |
58 | my $show_not_found = 0; # No longer used | 43 | |
59 | +my $sphinx_version = "0.0"; # if not specified, assume old | 44 | -static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len) |
60 | 45 | +uint32_t aarch64_sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len) | |
61 | my @export_file_list; | 46 | { |
62 | 47 | uint32_t end_len; | |
63 | @@ -XXX,XX +XXX,XX @@ while ($ARGV[0] =~ m/^--?(.*)/) { | 48 | |
64 | $enable_lineno = 1; | 49 | @@ -XXX,XX +XXX,XX @@ uint32_t sve_zcr_len_for_el(CPUARMState *env, int el) |
65 | } elsif ($cmd eq 'show-not-found') { | 50 | zcr_len = MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[3]); |
66 | $show_not_found = 1; # A no-op but don't fail | 51 | } |
67 | + } elsif ($cmd eq 'sphinx-version') { | 52 | |
68 | + $sphinx_version = shift @ARGV; | 53 | - return sve_zcr_get_valid_len(cpu, zcr_len); |
69 | } else { | 54 | + return aarch64_sve_zcr_get_valid_len(cpu, zcr_len); |
70 | # Unknown argument | 55 | } |
71 | usage(); | 56 | |
72 | @@ -XXX,XX +XXX,XX @@ sub output_struct_rst(%) { | 57 | static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri, |
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'}); | ||
90 | -- | 58 | -- |
91 | 2.20.1 | 59 | 2.20.1 |
92 | 60 | ||
93 | 61 | diff view generated by jsdifflib |
1 | Add a new script to automate the process of running the Coverity | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | Scan build tools and uploading the resulting tarball to the | ||
3 | website. | ||
4 | 2 | ||
5 | This is intended eventually to be driven from Travis, | 3 | Mirror the behavour of /proc/sys/abi/sve_default_vector_length |
6 | but it can be run locally, if you are a maintainer of the | 4 | under the real linux kernel. We have no way of passing along |
7 | QEMU project on the Coverity Scan website and have the secret | 5 | a real default across exec like the kernel can, but this is a |
8 | upload token. | 6 | decent way of adjusting the startup vector length of a process. |
9 | 7 | ||
10 | The script must be run on a Fedora 30 system. Support for using a | 8 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/482 |
11 | Docker container is added in a following commit. | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Message-id: 20210723203344.968563-4-richard.henderson@linaro.org | ||
12 | [PMM: tweaked docs formatting, document -1 special-case, | ||
13 | added fixup patch from RTH mentioning QEMU's maximum veclen.] | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | docs/system/arm/cpu-features.rst | 15 ++++++++ | ||
17 | target/arm/cpu.h | 5 +++ | ||
18 | target/arm/cpu.c | 14 ++++++-- | ||
19 | target/arm/cpu64.c | 60 ++++++++++++++++++++++++++++++++ | ||
20 | 4 files changed, 92 insertions(+), 2 deletions(-) | ||
12 | 21 | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 22 | diff --git a/docs/system/arm/cpu-features.rst b/docs/system/arm/cpu-features.rst |
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Message-id: 20200319193323.2038-6-peter.maydell@linaro.org | ||
16 | --- | ||
17 | MAINTAINERS | 5 + | ||
18 | scripts/coverity-scan/run-coverity-scan | 311 ++++++++++++++++++++++++ | ||
19 | 2 files changed, 316 insertions(+) | ||
20 | create mode 100755 scripts/coverity-scan/run-coverity-scan | ||
21 | |||
22 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
23 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/MAINTAINERS | 24 | --- a/docs/system/arm/cpu-features.rst |
25 | +++ b/MAINTAINERS | 25 | +++ b/docs/system/arm/cpu-features.rst |
26 | @@ -XXX,XX +XXX,XX @@ M: Markus Armbruster <armbru@redhat.com> | 26 | @@ -XXX,XX +XXX,XX @@ verbose command lines. However, the recommended way to select vector |
27 | S: Supported | 27 | lengths is to explicitly enable each desired length. Therefore only |
28 | F: scripts/coverity-model.c | 28 | example's (1), (4), and (6) exhibit recommended uses of the properties. |
29 | 29 | ||
30 | +Coverity Scan integration | 30 | +SVE User-mode Default Vector Length Property |
31 | +M: Peter Maydell <peter.maydell@linaro.org> | 31 | +-------------------------------------------- |
32 | +S: Maintained | ||
33 | +F: scripts/coverity-scan/ | ||
34 | + | 32 | + |
35 | Device Tree | 33 | +For qemu-aarch64, the cpu property ``sve-default-vector-length=N`` is |
36 | M: Alistair Francis <alistair.francis@wdc.com> | 34 | +defined to mirror the Linux kernel parameter file |
37 | R: David Gibson <david@gibson.dropbear.id.au> | 35 | +``/proc/sys/abi/sve_default_vector_length``. The default length, ``N``, |
38 | diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan | 36 | +is in units of bytes and must be between 16 and 8192. |
39 | new file mode 100755 | 37 | +If not specified, the default vector length is 64. |
40 | index XXXXXXX..XXXXXXX | ||
41 | --- /dev/null | ||
42 | +++ b/scripts/coverity-scan/run-coverity-scan | ||
43 | @@ -XXX,XX +XXX,XX @@ | ||
44 | +#!/bin/sh -e | ||
45 | + | 38 | + |
46 | +# Upload a created tarball to Coverity Scan, as per | 39 | +If the default length is larger than the maximum vector length enabled, |
47 | +# https://scan.coverity.com/projects/qemu/builds/new | 40 | +the actual vector length will be reduced. Note that the maximum vector |
41 | +length supported by QEMU is 256. | ||
48 | + | 42 | + |
49 | +# This work is licensed under the terms of the GNU GPL version 2, | 43 | +If this property is set to ``-1`` then the default vector length |
50 | +# or (at your option) any later version. | 44 | +is set to the maximum possible length. |
51 | +# See the COPYING file in the top-level directory. | 45 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
52 | +# | 46 | index XXXXXXX..XXXXXXX 100644 |
53 | +# Copyright (c) 2017-2020 Linaro Limited | 47 | --- a/target/arm/cpu.h |
54 | +# Written by Peter Maydell | 48 | +++ b/target/arm/cpu.h |
49 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | ||
50 | /* Used to set the maximum vector length the cpu will support. */ | ||
51 | uint32_t sve_max_vq; | ||
52 | |||
53 | +#ifdef CONFIG_USER_ONLY | ||
54 | + /* Used to set the default vector length at process start. */ | ||
55 | + uint32_t sve_default_vq; | ||
56 | +#endif | ||
55 | + | 57 | + |
56 | +# Note that this script will automatically download and | 58 | /* |
57 | +# run the (closed-source) coverity build tools, so don't | 59 | * In sve_vq_map each set bit is a supported vector length of |
58 | +# use it if you don't trust them! | 60 | * (bit-number + 1) * 16 bytes, i.e. each bit number + 1 is the vector |
61 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/target/arm/cpu.c | ||
64 | +++ b/target/arm/cpu.c | ||
65 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(DeviceState *dev) | ||
66 | env->cp15.cpacr_el1 = deposit64(env->cp15.cpacr_el1, 16, 2, 3); | ||
67 | /* with reasonable vector length */ | ||
68 | if (cpu_isar_feature(aa64_sve, cpu)) { | ||
69 | - env->vfp.zcr_el[1] = MIN(cpu->sve_max_vq - 1, 3); | ||
70 | + env->vfp.zcr_el[1] = | ||
71 | + aarch64_sve_zcr_get_valid_len(cpu, cpu->sve_default_vq - 1); | ||
72 | } | ||
73 | /* | ||
74 | * Enable TBI0 but not TBI1. | ||
75 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_initfn(Object *obj) | ||
76 | QLIST_INIT(&cpu->pre_el_change_hooks); | ||
77 | QLIST_INIT(&cpu->el_change_hooks); | ||
78 | |||
79 | -#ifndef CONFIG_USER_ONLY | ||
80 | +#ifdef CONFIG_USER_ONLY | ||
81 | +# ifdef TARGET_AARCH64 | ||
82 | + /* | ||
83 | + * The linux kernel defaults to 512-bit vectors, when sve is supported. | ||
84 | + * See documentation for /proc/sys/abi/sve_default_vector_length, and | ||
85 | + * our corresponding sve-default-vector-length cpu property. | ||
86 | + */ | ||
87 | + cpu->sve_default_vq = 4; | ||
88 | +# endif | ||
89 | +#else | ||
90 | /* Our inbound IRQ and FIQ lines */ | ||
91 | if (kvm_enabled()) { | ||
92 | /* VIRQ and VFIQ are unused with KVM but we add them to maintain | ||
93 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/target/arm/cpu64.c | ||
96 | +++ b/target/arm/cpu64.c | ||
97 | @@ -XXX,XX +XXX,XX @@ static void cpu_arm_set_sve(Object *obj, bool value, Error **errp) | ||
98 | cpu->isar.id_aa64pfr0 = t; | ||
99 | } | ||
100 | |||
101 | +#ifdef CONFIG_USER_ONLY | ||
102 | +/* Mirror linux /proc/sys/abi/sve_default_vector_length. */ | ||
103 | +static void cpu_arm_set_sve_default_vec_len(Object *obj, Visitor *v, | ||
104 | + const char *name, void *opaque, | ||
105 | + Error **errp) | ||
106 | +{ | ||
107 | + ARMCPU *cpu = ARM_CPU(obj); | ||
108 | + int32_t default_len, default_vq, remainder; | ||
59 | + | 109 | + |
60 | +# This script assumes that you're running it from a QEMU source | 110 | + if (!visit_type_int32(v, name, &default_len, errp)) { |
61 | +# tree, and that tree is a fresh clean one, because we do an in-tree | 111 | + return; |
62 | +# build. (This is necessary so that the filenames that the Coverity | 112 | + } |
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 | + | 113 | + |
68 | +# To do an upload you need to be a maintainer in the Coverity online | 114 | + /* Undocumented, but the kernel allows -1 to indicate "maximum". */ |
69 | +# service, and you will need to know the "Coverity token", which is a | 115 | + if (default_len == -1) { |
70 | +# secret 8 digit hex string. You can find that from the web UI in the | 116 | + cpu->sve_default_vq = ARM_MAX_VQ; |
71 | +# project settings, if you have maintainer access there. | 117 | + return; |
118 | + } | ||
72 | + | 119 | + |
73 | +# Command line options: | 120 | + default_vq = default_len / 16; |
74 | +# --dry-run : run the tools, but don't actually do the upload | 121 | + remainder = default_len % 16; |
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 | + | 122 | + |
96 | +check_upload_permissions() { | 123 | + /* |
97 | + # Check whether we can do an upload to the server; will exit the script | 124 | + * Note that the 512 max comes from include/uapi/asm/sve_context.h |
98 | + # with status 1 if the check failed (usually a bad token); | 125 | + * and is the maximum architectural width of ZCR_ELx.LEN. |
99 | + # will exit the script with status 0 if the check indicated that we | 126 | + */ |
100 | + # can't upload yet (ie we are at quota) | 127 | + if (remainder || default_vq < 1 || default_vq > 512) { |
101 | + # Assumes that PROJTOKEN, PROJNAME and DRYRUN have been initialized. | 128 | + error_setg(errp, "cannot set sve-default-vector-length"); |
129 | + if (remainder) { | ||
130 | + error_append_hint(errp, "Vector length not a multiple of 16\n"); | ||
131 | + } else if (default_vq < 1) { | ||
132 | + error_append_hint(errp, "Vector length smaller than 16\n"); | ||
133 | + } else { | ||
134 | + error_append_hint(errp, "Vector length larger than %d\n", | ||
135 | + 512 * 16); | ||
136 | + } | ||
137 | + return; | ||
138 | + } | ||
102 | + | 139 | + |
103 | + echo "Checking upload permissions..." | 140 | + cpu->sve_default_vq = default_vq; |
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 | +} | 141 | +} |
132 | + | 142 | + |
143 | +static void cpu_arm_get_sve_default_vec_len(Object *obj, Visitor *v, | ||
144 | + const char *name, void *opaque, | ||
145 | + Error **errp) | ||
146 | +{ | ||
147 | + ARMCPU *cpu = ARM_CPU(obj); | ||
148 | + int32_t value = cpu->sve_default_vq * 16; | ||
133 | + | 149 | + |
134 | +update_coverity_tools () { | 150 | + visit_type_int32(v, name, &value, errp); |
135 | + # Check for whether we need to download the Coverity tools | 151 | +} |
136 | + # (either because we don't have a copy, or because it's out of date) | 152 | +#endif |
137 | + # Assumes that COVERITY_TOOL_BASE, PROJTOKEN and PROJNAME are set. | ||
138 | + | 153 | + |
139 | + mkdir -p "$COVERITY_TOOL_BASE" | 154 | void aarch64_add_sve_properties(Object *obj) |
140 | + cd "$COVERITY_TOOL_BASE" | 155 | { |
156 | uint32_t vq; | ||
157 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_sve_properties(Object *obj) | ||
158 | object_property_add(obj, name, "bool", cpu_arm_get_sve_vq, | ||
159 | cpu_arm_set_sve_vq, NULL, NULL); | ||
160 | } | ||
141 | + | 161 | + |
142 | + echo "Checking for new version of coverity build tools..." | 162 | +#ifdef CONFIG_USER_ONLY |
143 | + wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME&md5=1" -O coverity_tool.md5.new | 163 | + /* Mirror linux /proc/sys/abi/sve_default_vector_length. */ |
144 | + | 164 | + object_property_add(obj, "sve-default-vector-length", "int32", |
145 | + if ! cmp -s coverity_tool.md5 coverity_tool.md5.new; then | 165 | + cpu_arm_get_sve_default_vec_len, |
146 | + # out of date md5 or no md5: download new build tool | 166 | + cpu_arm_set_sve_default_vec_len, NULL, NULL); |
147 | + # blow away the old build tool | 167 | +#endif |
148 | + echo "Downloading coverity build tools..." | 168 | } |
149 | + rm -rf coverity_tool coverity_tool.tgz | 169 | |
150 | + wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME" -O coverity_tool.tgz | 170 | void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) |
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." | ||
355 | -- | 171 | -- |
356 | 2.20.1 | 172 | 2.20.1 |
357 | 173 | ||
358 | 174 | diff view generated by jsdifflib |
1 | The target_flat.h file is a QEMU header, so we should include it using | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | quotes, not angle brackets. | ||
3 | 2 | ||
4 | Coverity otherwise is unable to find the header: | 3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
5 | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | |
6 | "../linux-user/flatload.c", line 40: error #1712: cannot open source file | 5 | Message-id: 20210726150953.1218690-1-f4bug@amsat.org |
7 | "target_flat.h" | ||
8 | #include <target_flat.h> | ||
9 | ^ | ||
10 | |||
11 | because the relevant directory is only on the -iquote path, not the -I path. | ||
12 | |||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
16 | Message-id: 20200319193323.2038-5-peter.maydell@linaro.org | ||
17 | --- | 7 | --- |
18 | linux-user/flatload.c | 2 +- | 8 | hw/arm/nseries.c | 2 +- |
19 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+), 1 deletion(-) |
20 | 10 | ||
21 | diff --git a/linux-user/flatload.c b/linux-user/flatload.c | 11 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c |
22 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/linux-user/flatload.c | 13 | --- a/hw/arm/nseries.c |
24 | +++ b/linux-user/flatload.c | 14 | +++ b/hw/arm/nseries.c |
25 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ static uint32_t mipid_txrx(void *opaque, uint32_t cmd, int len) |
26 | 16 | default: | |
27 | #include "qemu.h" | 17 | bad_cmd: |
28 | #include "flat.h" | 18 | qemu_log_mask(LOG_GUEST_ERROR, |
29 | -#include <target_flat.h> | 19 | - "%s: unknown command %02x\n", __func__, s->cmd); |
30 | +#include "target_flat.h" | 20 | + "%s: unknown command 0x%02x\n", __func__, s->cmd); |
31 | 21 | break; | |
32 | //#define DEBUG | 22 | } |
33 | 23 | ||
34 | -- | 24 | -- |
35 | 2.20.1 | 25 | 2.20.1 |
36 | 26 | ||
37 | 27 | diff view generated by jsdifflib |
1 | Add support for running the Coverity Scan tools inside a Docker | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | container rather than directly on the host system. | ||
3 | 2 | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 3 | The macro used to calculate the maximum memory size of the MMIO region |
4 | had a mistake, causing all GPIO models to create a mapping of 0x9D8. | ||
5 | The intent was to have it be 0x9D8 - 0x800. | ||
6 | |||
7 | This extra size doesn't matter on ast2400 and ast2500, which have a 4KB | ||
8 | region set aside for the GPIO controller. | ||
9 | |||
10 | On the ast2600 the 3.3V and 1.8V GPIO controllers are 2KB apart, so the | ||
11 | regions would overlap. Worse was the 1.8V controller would map over the | ||
12 | top of the following peripheral, which happens to be the RTC. | ||
13 | |||
14 | The mmio region used by each device is a maximum of 2KB, so avoid the | ||
15 | calculations and hard code this as the maximum. | ||
16 | |||
17 | Fixes: 36d737ee82b2 ("hw/gpio: Add in AST2600 specific implementation") | ||
18 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
19 | Reviewed-by: Rashmica Gupta <rashmica.g@gmail.com> | ||
20 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
21 | Message-id: 20210713065854.134634-2-joel@jms.id.au | ||
22 | [PMM: fix autocorrect error in commit message] | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 23 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Message-id: 20200319193323.2038-7-peter.maydell@linaro.org | ||
7 | --- | 24 | --- |
8 | scripts/coverity-scan/coverity-scan.docker | 131 +++++++++++++++++++++ | 25 | hw/gpio/aspeed_gpio.c | 3 +-- |
9 | scripts/coverity-scan/run-coverity-scan | 90 ++++++++++++++ | 26 | 1 file changed, 1 insertion(+), 2 deletions(-) |
10 | 2 files changed, 221 insertions(+) | ||
11 | create mode 100644 scripts/coverity-scan/coverity-scan.docker | ||
12 | 27 | ||
13 | diff --git a/scripts/coverity-scan/coverity-scan.docker b/scripts/coverity-scan/coverity-scan.docker | 28 | diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c |
14 | new file mode 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
15 | index XXXXXXX..XXXXXXX | 30 | --- a/hw/gpio/aspeed_gpio.c |
16 | --- /dev/null | 31 | +++ b/hw/gpio/aspeed_gpio.c |
17 | +++ b/scripts/coverity-scan/coverity-scan.docker | ||
18 | @@ -XXX,XX +XXX,XX @@ | 32 | @@ -XXX,XX +XXX,XX @@ |
19 | +# syntax=docker/dockerfile:1.0.0-experimental | 33 | #define GPIO_1_8V_MEM_SIZE 0x9D8 |
20 | +# | 34 | #define GPIO_1_8V_REG_ARRAY_SIZE ((GPIO_1_8V_MEM_SIZE - \ |
21 | +# Docker setup for running the "Coverity Scan" tools over the source | 35 | GPIO_1_8V_REG_OFFSET) >> 2) |
22 | +# tree and uploading them to the website, as per | 36 | -#define GPIO_MAX_MEM_SIZE MAX(GPIO_3_6V_MEM_SIZE, GPIO_1_8V_MEM_SIZE) |
23 | +# https://scan.coverity.com/projects/qemu/builds/new | 37 | |
24 | +# We do this on a fixed config (currently Fedora 30 with a known | 38 | static int aspeed_evaluate_irq(GPIOSets *regs, int gpio_prev_high, int gpio) |
25 | +# set of dependencies and a configure command that enables a specific | 39 | { |
26 | +# set of options) so that random changes don't result in our accidentally | 40 | @@ -XXX,XX +XXX,XX @@ static void aspeed_gpio_realize(DeviceState *dev, Error **errp) |
27 | +# dropping some files from the scan. | 41 | } |
28 | +# | 42 | |
29 | +# We don't build on top of the fedora.docker file because we don't | 43 | memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_gpio_ops, s, |
30 | +# want to accidentally change or break the scan config when that | 44 | - TYPE_ASPEED_GPIO, GPIO_MAX_MEM_SIZE); |
31 | +# is updated. | 45 | + TYPE_ASPEED_GPIO, 0x800); |
32 | + | 46 | |
33 | +# The work of actually doing the build is handled by the | 47 | sysbus_init_mmio(sbd, &s->iomem); |
34 | +# run-coverity-scan script. | 48 | } |
35 | + | ||
36 | +FROM fedora:30 | ||
37 | +ENV PACKAGES \ | ||
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 | ||
154 | @@ -XXX,XX +XXX,XX @@ | ||
155 | |||
156 | # Command line options: | ||
157 | # --dry-run : run the tools, but don't actually do the upload | ||
158 | +# --docker : create and work inside a docker container | ||
159 | # --update-tools-only : update the cached copy of the tools, but don't run them | ||
160 | # --tokenfile : file to read Coverity token from | ||
161 | # --version ver : specify version being analyzed (default: ask git) | ||
162 | @@ -XXX,XX +XXX,XX @@ | ||
163 | # --srcdir : QEMU source tree to analyze (default: current working dir) | ||
164 | # --results-tarball : path to copy the results tarball to (default: don't | ||
165 | # copy it anywhere, just upload it) | ||
166 | +# --src-tarball : tarball to untar into src dir (default: none); this | ||
167 | +# is intended mainly for internal use by the Docker support | ||
168 | # | ||
169 | # User-specifiable environment variables: | ||
170 | # COVERITY_TOKEN -- Coverity token | ||
171 | @@ -XXX,XX +XXX,XX @@ update_coverity_tools () { | ||
172 | # Check user-provided environment variables and arguments | ||
173 | DRYRUN=no | ||
174 | UPDATE_ONLY=no | ||
175 | +DOCKER=no | ||
176 | |||
177 | while [ "$#" -ge 1 ]; do | ||
178 | case "$1" in | ||
179 | @@ -XXX,XX +XXX,XX @@ while [ "$#" -ge 1 ]; do | ||
180 | RESULTSTARBALL="$1" | ||
181 | shift | ||
182 | ;; | ||
183 | + --src-tarball) | ||
184 | + shift | ||
185 | + if [ $# -eq 0 ]; then | ||
186 | + echo "--src-tarball needs an argument" | ||
187 | + exit 1 | ||
188 | + fi | ||
189 | + SRCTARBALL="$1" | ||
190 | + shift | ||
191 | + ;; | ||
192 | + --docker) | ||
193 | + DOCKER=yes | ||
194 | + shift | ||
195 | + ;; | ||
196 | *) | ||
197 | echo "Unexpected argument '$1'" | ||
198 | exit 1 | ||
199 | @@ -XXX,XX +XXX,XX @@ PROJTOKEN="$COVERITY_TOKEN" | ||
200 | PROJNAME=QEMU | ||
201 | TARBALL=cov-int.tar.xz | ||
202 | |||
203 | +if [ "$UPDATE_ONLY" = yes ] && [ "$DOCKER" = yes ]; then | ||
204 | + echo "Combining --docker and --update-only is not supported" | ||
205 | + exit 1 | ||
206 | +fi | ||
207 | |||
208 | if [ "$UPDATE_ONLY" = yes ]; then | ||
209 | # Just do the tools update; we don't need to check whether | ||
210 | @@ -XXX,XX +XXX,XX @@ if [ "$UPDATE_ONLY" = yes ]; then | ||
211 | exit 0 | ||
212 | fi | ||
213 | |||
214 | +if [ ! -e "$SRCDIR" ]; then | ||
215 | + mkdir "$SRCDIR" | ||
216 | +fi | ||
217 | + | ||
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 | ||
295 | -- | 49 | -- |
296 | 2.20.1 | 50 | 2.20.1 |
297 | 51 | ||
298 | 52 | diff view generated by jsdifflib |