qemu-patch-raspberry4/scripts/coccinelle
Peter Maydell 19f7034773 Avoid address_space_rw() with a constant is_write argument
The address_space_rw() function allows either reads or writes
depending on the is_write argument passed to it; this is useful
when the direction of the access is determined programmatically
(as for instance when handling the KVM_EXIT_MMIO exit reason).
Under the hood it just calls either address_space_write() or
address_space_read_full().

We also use it a lot with a constant is_write argument, though,
which has two issues:
 * when reading "address_space_rw(..., 1)" this is less
   immediately clear to the reader as being a write than
   "address_space_write(...)"
 * calling address_space_rw() bypasses the optimization
   in address_space_read() that fast-paths reads of a
   fixed length

This commit was produced with the included Coccinelle script
scripts/coccinelle/exec_rw_const.cocci.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20200218112457.22712-1-peter.maydell@linaro.org>
[PMD: Update macvm_set_cr0() reported by Laurent Vivier]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-02-20 14:47:08 +01:00
..
cpu_restore_state.cocci target/*helper: don't check retaddr before calling cpu_restore_state 2017-12-27 17:20:44 -08:00
err-bad-newline.cocci error: Strip trailing '\n' from error string arguments (again) 2016-08-08 09:00:44 +02:00
error_propagate_null.cocci error: Remove NULL checks on error_propagate() calls 2016-06-20 16:38:13 +02:00
exec_rw_const.cocci Avoid address_space_rw() with a constant is_write argument 2020-02-20 14:47:08 +01:00
inplace-byteswaps.cocci coccinelle: new inplace-byteswaps.cocci to remove inplace-byteswapping calls 2018-10-16 17:14:55 +01:00
memory-region-init-ram.cocci scripts/coccinelle/memory-region-init-ram.cocci: New script 2017-07-14 17:59:42 +01:00
overflow_muldiv64.cocci
qobject.cocci qobject: Replace qobject_incref/QINCREF qobject_decref/QDECREF 2018-05-04 08:27:53 +02:00
remove_local_err.cocci error: Remove unnecessary local_err variables 2016-06-20 16:38:13 +02:00
remove_muldiv64.cocci
return_directly.cocci coccinelle: fix typo in comment 2017-06-07 14:38:44 +01:00
round.cocci coccinelle: use macro DIV_ROUND_UP instead of (((n) + (d) - 1) /(d)) 2016-06-07 18:19:24 +03:00
simplify_muldiv64.cocci
swap_muldiv64.cocci
tcg_gen_extract.cocci qemu-iotests: convert pwd and $(pwd) to $PWD 2018-11-19 10:08:19 -06:00
typecast.cocci coccinelle: add a script to remove useless casts 2016-09-15 15:32:22 +03:00
use-error_fatal.cocci Use error_fatal to simplify obvious fatal errors (again) 2018-10-19 14:51:34 +02:00