aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-03-05 09:29:04 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2018-03-06 14:01:28 +0100
commitdb84fd973eba3f1e121416dcab73a4e8a60f2526 (patch)
tree74ecf8d70b8171e5d23b312c38b802069eda74ef /exec.c
parentad0c60fa572d4050255b698ecdb67294dd4c0125 (diff)
address_space_rw: address_space_to_flatview needs RCU lock
address_space_rw is calling address_space_to_flatview but it can be called outside the RCU lock. To fix it, transform flatview_rw into address_space_rw, since flatview_rw is otherwise unused. Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/exec.c b/exec.c
index bffb959a1f..604f03c535 100644
--- a/exec.c
+++ b/exec.c
@@ -3181,24 +3181,6 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
addr1, l, mr);
}
-static MemTxResult flatview_rw(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
- uint8_t *buf, int len, bool is_write)
-{
- if (is_write) {
- return flatview_write(fv, addr, attrs, (uint8_t *)buf, len);
- } else {
- return flatview_read(fv, addr, attrs, (uint8_t *)buf, len);
- }
-}
-
-MemTxResult address_space_rw(AddressSpace *as, hwaddr addr,
- MemTxAttrs attrs, uint8_t *buf,
- int len, bool is_write)
-{
- return flatview_rw(address_space_to_flatview(as),
- addr, attrs, buf, len, is_write);
-}
-
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf, int len)
{
@@ -3232,6 +3214,16 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
return result;
}
+MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
+ uint8_t *buf, int len, bool is_write)
+{
+ if (is_write) {
+ return address_space_write(as, addr, attrs, buf, len);
+ } else {
+ return address_space_read_full(as, addr, attrs, buf, len);
+ }
+}
+
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
int len, int is_write)
{