- Jul 11, 2020
-
-
Michael Rolnik authored
This is a simple device of just one register, and whenever this register is written to it calls qemu_set_irq function for each of 8 bits/IRQs. It is used to implement AVR Power Reduction. [AM: Remove word 'Atmel' from filenames and all elements of code] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> [rth: Squash include fix and file rename from f4bug] Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-22-huth@tuxfamily.org>
-
Michael Rolnik authored
These were designed to facilitate testing but should provide enough function to be useful in other contexts. Only a subset of the functions of each peripheral is implemented, mainly due to the lack of a standard way to handle electrical connections (like GPIO pins). [AM: Remove word 'Atmel' from filenames and all elements of code] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Ed Robbins <E.J.C.Robbins@kent.ac.uk> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> [rth: Squash info mtree fixes and a file rename from f4bug] Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> [PMD: Use qemu_log_mask(LOG_UNIMP), replace goto by return] Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-21-huth@tuxfamily.org> [PMD: Check cpu-frequency-hz property in realize()] Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
These were designed to facilitate testing but should provide enough function to be useful in other contexts. Only a subset of the functions of each peripheral is implemented, mainly due to the lack of a standard way to handle electrical connections (like GPIO pins). [AM: Remove word 'Atmel' from filenames and all elements of code] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> [rth: Squash I/O size fix and file rename from f4bug] Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Reviewed-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-20-huth@tuxfamily.org>
-
Michael Rolnik authored
Add a single code line that will automatically provide 'machine none' test. Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by:
Thomas Huth <thuth@redhat.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-28-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
Add AVR related definitions into QEMU, make AVR support buildable. [AM: Remove word 'Atmel' from filenames and all elements of code] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-23-huth@tuxfamily.org> [PMD: Fixed @avr tag in qapi/machine.json] Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
Provide function disassembles executed instruction when '-d in_asm' is provided. Example: $ qemu-system-avr -bios free-rtos/Demo/AVR_ATMega2560_GCC/demo.elf -d in_asm ... IN: 0x0000014a: CALL 0x3808 IN: main 0x00003808: CALL 0x4b4 IN: vParTestInitialise 0x000004b4: LDI r24, 255 0x000004b6: STS r24, 0 0x000004b8: MULS r16, r20 0x000004ba: OUT $1, r24 0x000004bc: LDS r24, 0 0x000004be: MULS r16, r20 0x000004c0: OUT $2, r24 0x000004c2: RET ... Suggested-by:
Richard Henderson <richard.henderson@linaro.org> Suggested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> [rth: Fix spacing and const mnemonic arrays] Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-19-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
Initialize TCG register variables. Co-developed-by:
Richard Henderson <richard.henderson@linaro.org> Co-developed-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-18-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
Add the core of translation mechanism. Co-developed-by:
Richard Henderson <richard.henderson@linaro.org> Co-developed-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-17-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This includes: - BREAK - NOP - SLEEP - WDR Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Reviewed-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-16-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This includes: - LSR, ROR - ASR - SWAP - SBI, CBI - BST, BLD - BSET, BCLR Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-15-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This includes: - MOV, MOVW - LDI, LDS LDX LDY LDZ - LDDY, LDDZ - STS, STX STY STZ - STDY, STDZ - LPM, LPMX - ELPM, ELPMX - SPM, SPMX - IN, OUT - PUSH, POP - XCH - LAS, LAC LAT Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-14-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This includes: - RJMP, IJMP, EIJMP, JMP - RCALL, ICALL, EICALL, CALL - RET, RETI - CPSE, CP, CPC, CPI - SBRC, SBRS, SBIC, SBIS - BRBC, BRBS Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-13-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This includes: - ADD, ADC, ADIW - SBIW, SUB, SUBI, SBC, SBCI - AND, ANDI - OR, ORI, EOR - COM, NEG - INC, DEC - MUL, MULS, MULSU - FMUL, FMULS, FMULSU - DES Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-12-huth@tuxfamily.org> [PMD: Added qemu_log_mask(LOG_UNIMP) in trans_DES()] Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
Start implementation of instructions by adding register definitions. Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-11-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
Add helpers for instructions that need to interact with QEMU. Also, add stubs for unimplemented instructions. Instructions SPM and WDR are left unimplemented because they require emulation of complex peripherals. The implementation of instruction SLEEP is very limited due to the lack of peripherals to generate wake interrupts. Memory access instructions are implemented here because some address ranges actually refer to CPU registers. Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-10-huth@tuxfamily.org> [PMD: Replace cpu_physical_memory() API by address_space_ldst() API to fix running on big-endian host, reported and suggested by Peter Maydell] Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
- Jul 10, 2020
-
-
Michael Rolnik authored
AVR core types are: - avr5 - avr51 - avr6 Each core type covers multiple AVR MCUs, mentioned in the comments before definition of particular AVR core type (part of this patch). AVR core type defines shared features that are valid for all AVR MCUs belonging in that type. [AM: Split a larger AVR introduction patch into logical units] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Co-developed-by:
Michael Rolnik <mrolnik@gmail.com> Co-developed-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Acked-by:
Igor Mammedov <imammedo@redhat.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-9-huth@tuxfamily.org> [PMD: Only include reviewed cores: avr5/avr51/avr6] Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This patch introduces enumeration "AVRFeature" that will be used for defining various AVR core types. [AM: Split a larger AVR introduction patch into logical units] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Co-developed-by:
Michael Rolnik <mrolnik@gmail.com> Co-developed-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Acked-by:
Igor Mammedov <imammedo@redhat.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-8-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This includes GDB hooks for reading from wnd wrtiting to AVR registers, and xml register definition file as well. [AM: Split a larger AVR introduction patch into logical units] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Co-developed-by:
Michael Rolnik <mrolnik@gmail.com> Co-developed-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Acked-by:
Igor Mammedov <imammedo@redhat.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> [thuth: Fixed avr_cpu_gdb_read_register() parameter] Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-7-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
Add migration-related functions of AVR CPU class object. [AM: Split a larger AVR introduction patch into logical units] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Co-developed-by:
Michael Rolnik <mrolnik@gmail.com> Co-developed-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Acked-by:
Igor Mammedov <imammedo@redhat.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-6-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This patch introduces three memory-management-related functions that will become part of AVR CPU class object. [AM: Split a larger AVR introduction patch into logical units] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Co-developed-by:
Michael Rolnik <mrolnik@gmail.com> Co-developed-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Acked-by:
Igor Mammedov <imammedo@redhat.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-5-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This patch introduces functions avr_cpu_do_interrupt() and avr_cpu_exec_interrupt() that are part of AVR CPU class object. [AM: Split a larger AVR introduction patch into logical units] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Co-developed-by:
Michael Rolnik <mrolnik@gmail.com> Co-developed-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Acked-by:
Igor Mammedov <imammedo@redhat.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-4-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This patch introduces AVR CPU class object and its basic elements and functions. [AM: Split a larger AVR introduction patch into logical units] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Co-developed-by:
Michael Rolnik <mrolnik@gmail.com> Co-developed-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Acked-by:
Igor Mammedov <imammedo@redhat.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> [thuth: Adjusted reset and parent_reset handling] Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-3-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Michael Rolnik authored
This includes definitions of various basic parameters needed for integration of a new platform into QEMU. [AM: Split a larger AVR introduction patch into logical units] Suggested-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Co-developed-by:
Michael Rolnik <mrolnik@gmail.com> Co-developed-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Michael Rolnik <mrolnik@gmail.com> Signed-off-by:
Sarah Harris <S.E.Harris@kent.ac.uk> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Aleksandar Markovic <aleksandar.m.mail@gmail.com> Acked-by:
Igor Mammedov <imammedo@redhat.com> Tested-by:
Philippe Mathieu-Daudé <philmd@redhat.com> [thuth: Simplify MAINTAINERS right from the start] Signed-off-by:
Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-2-huth@tuxfamily.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org>
-
Peter Maydell authored
Error reporting patches patches for 2020-07-07 # gpg: Signature made Fri 10 Jul 2020 14:24:42 BST # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-error-2020-07-07-v2: (53 commits) xen: Use ERRP_GUARD() nbd: Use ERRP_GUARD() virtio-9p: Use ERRP_GUARD() fw_cfg: Use ERRP_GUARD() pflash: Use ERRP_GUARD() sd: Use ERRP_GUARD() scripts: Coccinelle script to use ERRP_GUARD() error: New macro ERRP_GUARD() hmp: Ignore Error objects where the return value suffices qdev: Ignore Error objects where the return value suffices qemu-img: Ignore Error objects where the return value suffices error: Avoid error_propagate() after migrate_add_blocker() qapi: Purge error_propagate() from QAPI core qapi: Smooth visitor error checking in generated code qapi: Smooth another visitor error checking pattern block/parallels: Simplify parallels_open() after previous commit error: Reduce unnecessary error propagation error: Eliminate error_propagate() manually error: Eliminate error_propagate() with Coccinelle, part 2 error: Eliminate error_propagate() with Coccinelle, part 1 ... Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
Vladimir Sementsov-Ogievskiy authored
If we want to check error after errp-function call, we need to introduce local_err and then propagate it to errp. Instead, use the ERRP_GUARD() macro, benefits are: 1. No need of explicit error_propagate call 2. No need of explicit local_err variable: use errp directly 3. ERRP_GUARD() leaves errp as is if it's not NULL or &error_fatal, this means that we don't break error_abort (we'll abort on error_set, not on error_propagate) If we want to add some info to errp (by error_prepend() or error_append_hint()), we must use the ERRP_GUARD() macro. Otherwise, this info will not be added when errp == &error_fatal (the program will exit prior to the error_append_hint() or error_prepend() call). No such cases are being fixed here. This commit is generated by command sed -n '/^X86 Xen CPUs$/,/^$/{s/^F: //p}' MAINTAINERS | \ xargs git ls-files | grep '\.[hc]$' | \ xargs spatch \ --sp-file scripts/coccinelle/errp-guard.cocci \ --macro-file scripts/cocci-macro-file.h \ --in-place --no-show-diff --max-width 80 Reported-by:
Kevin Wolf <kwolf@redhat.com> Reported-by:
Greg Kurz <groug@kaod.org> Signed-off-by:
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> [Commit message tweaked] Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20200707165037.1026246-9-armbru@redhat.com> [ERRP_AUTO_PROPAGATE() renamed to ERRP_GUARD(), and auto-propagated-errp.cocci to errp-guard.cocci. Commit message tweaked again.]
-
Vladimir Sementsov-Ogievskiy authored
If we want to check error after errp-function call, we need to introduce local_err and then propagate it to errp. Instead, use the ERRP_GUARD() macro, benefits are: 1. No need of explicit error_propagate call 2. No need of explicit local_err variable: use errp directly 3. ERRP_GUARD() leaves errp as is if it's not NULL or &error_fatal, this means that we don't break error_abort (we'll abort on error_set, not on error_propagate) If we want to add some info to errp (by error_prepend() or error_append_hint()), we must use the ERRP_GUARD() macro. Otherwise, this info will not be added when errp == &error_fatal (the program will exit prior to the error_append_hint() or error_prepend() call). Fix several such cases, e.g. in nbd_read(). This commit is generated by command sed -n '/^Network Block Device (NBD)$/,/^$/{s/^F: //p}' \ MAINTAINERS | \ xargs git ls-files | grep '\.[hc]$' | \ xargs spatch \ --sp-file scripts/coccinelle/errp-guard.cocci \ --macro-file scripts/cocci-macro-file.h \ --in-place --no-show-diff --max-width 80 Reported-by:
Kevin Wolf <kwolf@redhat.com> Reported-by:
Greg Kurz <groug@kaod.org> Signed-off-by:
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> [Commit message tweaked] Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20200707165037.1026246-8-armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> [ERRP_AUTO_PROPAGATE() renamed to ERRP_GUARD(), and auto-propagated-errp.cocci to errp-guard.cocci. Commit message tweaked again.]
-
Vladimir Sementsov-Ogievskiy authored
If we want to check error after errp-function call, we need to introduce local_err and then propagate it to errp. Instead, use the ERRP_GUARD() macro, benefits are: 1. No need of explicit error_propagate call 2. No need of explicit local_err variable: use errp directly 3. ERRP_GUARD() leaves errp as is if it's not NULL or &error_fatal, this means that we don't break error_abort (we'll abort on error_set, not on error_propagate) If we want to add some info to errp (by error_prepend() or error_append_hint()), we must use the ERRP_GUARD() macro. Otherwise, this info will not be added when errp == &error_fatal (the program will exit prior to the error_append_hint() or error_prepend() call). Fix such a case in v9fs_device_realize_common(). This commit is generated by command sed -n '/^virtio-9p$/,/^$/{s/^F: //p}' MAINTAINERS | \ xargs git ls-files | grep '\.[hc]$' | \ xargs spatch \ --sp-file scripts/coccinelle/errp-guard.cocci \ --macro-file scripts/cocci-macro-file.h \ --in-place --no-show-diff --max-width 80 Reported-by:
Kevin Wolf <kwolf@redhat.com> Reported-by:
Greg Kurz <groug@kaod.org> Signed-off-by:
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Acked-by:
Greg Kurz <groug@kaod.org> Reviewed-by:
Christian Schoenebeck <qemu_oss@crudebyte.com> [Commit message tweaked] Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20200707165037.1026246-7-armbru@redhat.com> [ERRP_AUTO_PROPAGATE() renamed to ERRP_GUARD(), and auto-propagated-errp.cocci to errp-guard.cocci. Commit message tweaked again.]
-
Vladimir Sementsov-Ogievskiy authored
If we want to check error after errp-function call, we need to introduce local_err and then propagate it to errp. Instead, use the ERRP_GUARD() macro, benefits are: 1. No need of explicit error_propagate call 2. No need of explicit local_err variable: use errp directly 3. ERRP_GUARD() leaves errp as is if it's not NULL or &error_fatal, this means that we don't break error_abort (we'll abort on error_set, not on error_propagate) If we want to add some info to errp (by error_prepend() or error_append_hint()), we must use the ERRP_GUARD() macro. Otherwise, this info will not be added when errp == &error_fatal (the program will exit prior to the error_append_hint() or error_prepend() call). No such cases are being fixed here. This commit is generated by command sed -n '/^Firmware configuration (fw_cfg)$/,/^$/{s/^F: //p}' \ MAINTAINERS | \ xargs git ls-files | grep '\.[hc]$' | \ xargs spatch \ --sp-file scripts/coccinelle/errp-guard.cocci \ --macro-file scripts/cocci-macro-file.h \ --in-place --no-show-diff --max-width 80 Reported-by:
Kevin Wolf <kwolf@redhat.com> Reported-by:
Greg Kurz <groug@kaod.org> Signed-off-by:
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> [Commit message tweaked] Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20200707165037.1026246-6-armbru@redhat.com> [ERRP_AUTO_PROPAGATE() renamed to ERRP_GUARD(), and auto-propagated-errp.cocci to errp-guard.cocci. Commit message tweaked again. Coccinelle script rerun for commit 32031489 "hw/nvram/fw_cfg: Add the FW_CFG_DATA_GENERATOR interface"]
-
Vladimir Sementsov-Ogievskiy authored
If we want to check error after errp-function call, we need to introduce local_err and then propagate it to errp. Instead, use the ERRP_GUARD() macro, benefits are: 1. No need of explicit error_propagate call 2. No need of explicit local_err variable: use errp directly 3. ERRP_GUARD() leaves errp as is if it's not NULL or &error_fatal, this means that we don't break error_abort (we'll abort on error_set, not on error_propagate) If we want to add some info to errp (by error_prepend() or error_append_hint()), we must use the ERRP_GUARD() macro. Otherwise, this info will not be added when errp == &error_fatal (the program will exit prior to the error_append_hint() or error_prepend() call). No such cases are being fixed here. This commit is generated by command sed -n '/^Parallel NOR Flash devices$/,/^$/{s/^F: //p}' \ MAINTAINERS | \ xargs git ls-files | grep '\.[hc]$' | \ xargs spatch \ --sp-file scripts/coccinelle/errp-guard.cocci \ --macro-file scripts/cocci-macro-file.h \ --in-place --no-show-diff --max-width 80 Reported-by:
Kevin Wolf <kwolf@redhat.com> Reported-by:
Greg Kurz <groug@kaod.org> Signed-off-by:
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> [Commit message tweaked] Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20200707165037.1026246-5-armbru@redhat.com> [ERRP_AUTO_PROPAGATE() renamed to ERRP_GUARD(), and auto-propagated-errp.cocci to errp-guard.cocci. Commit message tweaked again.]
-
Vladimir Sementsov-Ogievskiy authored
If we want to check error after errp-function call, we need to introduce local_err and then propagate it to errp. Instead, use the ERRP_GUARD() macro, benefits are: 1. No need of explicit error_propagate call 2. No need of explicit local_err variable: use errp directly 3. ERRP_GUARD() leaves errp as is if it's not NULL or &error_fatal, this means that we don't break error_abort (we'll abort on error_set, not on error_propagate) If we want to add some info to errp (by error_prepend() or error_append_hint()), we must use the ERRP_GUARD() macro. Otherwise, this info will not be added when errp == &error_fatal (the program will exit prior to the error_append_hint() or error_prepend() call). No such cases are being fixed here. This commit is generated by command sed -n '/^SD (Secure Card)$/,/^$/{s/^F: //p}' \ MAINTAINERS | \ xargs git ls-files | grep '\.[hc]$' | \ xargs spatch \ --sp-file scripts/coccinelle/errp-guard.cocci \ --macro-file scripts/cocci-macro-file.h \ --in-place --no-show-diff --max-width 80 Reported-by:
Kevin Wolf <kwolf@redhat.com> Reported-by:
Greg Kurz <groug@kaod.org> Signed-off-by:
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> [Commit message tweaked] Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20200707165037.1026246-4-armbru@redhat.com> [ERRP_AUTO_PROPAGATE() renamed to ERRP_GUARD(), and auto-propagated-errp.cocci to errp-guard.cocci. Commit message tweaked again.]
-
Vladimir Sementsov-Ogievskiy authored
Script adds ERRP_GUARD() macro invocations where appropriate and does corresponding changes in code (look for details in include/qapi/error.h) Usage example: spatch --sp-file scripts/coccinelle/errp-guard.cocci \ --macro-file scripts/cocci-macro-file.h --in-place --no-show-diff \ --max-width 80 FILES... Signed-off-by:
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20200707165037.1026246-3-armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> [ERRP_AUTO_PROPAGATE() renamed to ERRP_GUARD(), and auto-propagated-errp.cocci to errp-guard.cocci]
-
Vladimir Sementsov-Ogievskiy authored
Introduce a new ERRP_GUARD() macro, to be used at start of functions with an errp OUT parameter. It has three goals: 1. Fix issue with error_fatal and error_prepend/error_append_hint: the user can't see this additional information, because exit() happens in error_setg earlier than information is added. [Reported by Greg Kurz] 2. Fix issue with error_abort and error_propagate: when we wrap error_abort by local_err+error_propagate, the resulting coredump will refer to error_propagate and not to the place where error happened. (the macro itself doesn't fix the issue, but it allows us to [3.] drop the local_err+error_propagate pattern, which will definitely fix the issue) [Reported by Kevin Wolf] 3. Drop local_err+error_propagate pattern, which is used to workaround void functions with errp parameter, when caller wants to know resulting status. (Note: actually these functions could be merely updated to return int error code). To achieve these goals, later patches will add invocations of this macro at the start of functions with either use error_prepend/error_append_hint (solving 1) or which use local_err+error_propagate to check errors, switching those functions to use *errp instead (solving 2 and 3). Signed-off-by:
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by:
Paul Durrant <paul@xen.org> Reviewed-by:
Greg Kurz <groug@kaod.org> Reviewed-by:
Eric Blake <eblake@redhat.com> [Merge comments properly with recent commit "error: Document Error API usage rules", and edit for clarity. Put ERRP_AUTO_PROPAGATE() before its helpers, and touch up style. Tweak commit message.] Signed-off-by:
Markus Armbruster <armbru@redhat.com> Message-Id: <20200707165037.1026246-2-armbru@redhat.com> [Rename ERRP_AUTO_PROPAGATE() to ERRP_GUARD(), tweak commit message again]
-
Markus Armbruster authored
qdev_print_props() receives and throws away Error objects just to check for object_property_get_str() and object_property_print() failure. Unnecessary, both return suitable values, so use those instead. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Message-Id: <20200707160613.848843-46-armbru@redhat.com>
-
Markus Armbruster authored
Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Message-Id: <20200707160613.848843-45-armbru@redhat.com>
-
Markus Armbruster authored
Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Message-Id: <20200707160613.848843-44-armbru@redhat.com> [One more in img_amend() due to commit 0bc2a50e17 "qemu-option: Use returned bool to check for failure"]
-
Markus Armbruster authored
When migrate_add_blocker(blocker, &errp) is followed by error_propagate(errp, err), we can often just as well do migrate_add_blocker(..., errp). Do that with this Coccinelle script: @@ expression blocker, err, errp; expression ret; @@ - ret = migrate_add_blocker(blocker, &err); - if (err) { + ret = migrate_add_blocker(blocker, errp); + if (ret < 0) { ... when != err; - error_propagate(errp, err); ... } @@ expression blocker, err, errp; @@ - migrate_add_blocker(blocker, &err); - if (err) { + if (migrate_add_blocker(blocker, errp) < 0) { ... when != err; - error_propagate(errp, err); ... } Double-check @err is not used afterwards. Dereferencing it would be use after free, but checking whether it's null would be legitimate. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Reviewed-by:
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200707160613.848843-43-armbru@redhat.com>
-
Markus Armbruster authored
Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Message-Id: <20200707160613.848843-42-armbru@redhat.com>
-
Markus Armbruster authored
Use visitor functions' return values to check for failure. Eliminate error_propagate() that are now unnecessary. Delete @err that are now unused. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Message-Id: <20200707160613.848843-41-armbru@redhat.com>
-
Markus Armbruster authored
Convert visit_type_FOO(v, ..., &ptr, &err); ... if (err) { ... } to visit_type_FOO(v, ..., &ptr, errp); ... if (!ptr) { ... } for functions that set @ptr to non-null / null on success / error. Eliminate error_propagate() that are now unnecessary. Delete @err that are now unused. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Message-Id: <20200707160613.848843-40-armbru@redhat.com>
-
Markus Armbruster authored
Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Reviewed-by:
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200707160613.848843-39-armbru@redhat.com>
-