]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch
add patches to fix regression with LSI SCSI controller
[pve-qemu.git] / debian / patches / extra / 0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Alexander Bulekov <alxndr@bu.edu>
3 Date: Mon, 13 Mar 2023 04:24:16 -0400
4 Subject: [PATCH] memory: Allow disabling re-entrancy checking per-MR
5
6 Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
7 ---
8 include/exec/memory.h | 3 +++
9 softmmu/memory.c | 2 +-
10 2 files changed, 4 insertions(+), 1 deletion(-)
11
12 diff --git a/include/exec/memory.h b/include/exec/memory.h
13 index 91f8a2395a..d7268d9f39 100644
14 --- a/include/exec/memory.h
15 +++ b/include/exec/memory.h
16 @@ -765,6 +765,9 @@ struct MemoryRegion {
17 unsigned ioeventfd_nb;
18 MemoryRegionIoeventfd *ioeventfds;
19 RamDiscardManager *rdm; /* Only for RAM */
20 +
21 + /* For devices designed to perform re-entrant IO into their own IO MRs */
22 + bool disable_reentrancy_guard;
23 };
24
25 struct IOMMUMemoryRegion {
26 diff --git a/softmmu/memory.c b/softmmu/memory.c
27 index 7dcb3347aa..2b46714191 100644
28 --- a/softmmu/memory.c
29 +++ b/softmmu/memory.c
30 @@ -544,7 +544,7 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
31 }
32
33 /* Do not allow more than one simultanous access to a device's IO Regions */
34 - if (mr->owner &&
35 + if (mr->owner && !mr->disable_reentrancy_guard &&
36 !mr->ram_device && !mr->ram && !mr->rom_device && !mr->readonly) {
37 dev = (DeviceState *) object_dynamic_cast(mr->owner, TYPE_DEVICE);
38 if (dev) {