[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/13] memory: count number of active VGA logging cli
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 10/13] memory: count number of active VGA logging clients |
Date: |
Fri, 24 Jul 2015 12:16:31 +0200 |
For a board that has multiple framebuffer devices, both of them
might want to use DIRTY_MEMORY_VGA on the same memory region.
The lack of reference counting in memory_region_set_log makes
this very awkward to implement.
Suggested-by: Peter Maydell <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/exec/memory.h | 1 +
memory.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 1394715..94d20ea 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -180,6 +180,7 @@ struct MemoryRegion {
bool warning_printed; /* For reservations */
bool flush_coalesced_mmio;
bool global_locking;
+ uint8_t vga_logging_count;
MemoryRegion *alias;
hwaddr alias_offset;
int32_t priority;
diff --git a/memory.c b/memory.c
index 0acebb1..5e5f325 100644
--- a/memory.c
+++ b/memory.c
@@ -1433,8 +1433,15 @@ void memory_region_notify_iommu(MemoryRegion *mr,
void memory_region_set_log(MemoryRegion *mr, bool log, unsigned client)
{
uint8_t mask = 1 << client;
+ uint8_t old_logging;
assert(client == DIRTY_MEMORY_VGA);
+ old_logging = mr->vga_logging_count;
+ mr->vga_logging_count += log ? 1 : -1;
+ if (!!old_logging == !!mr->vga_logging_count) {
+ return;
+ }
+
memory_region_transaction_begin();
mr->dirty_log_mask = (mr->dirty_log_mask & ~mask) | (log * mask);
memory_region_update_pending |= mr->enabled;
--
2.4.3
- [Qemu-devel] [PULL 00/13] Miscellaneous bugfixes for 2.4.0-rc3, Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 01/13] exec.c: Use atomic_rcu_read() to access dispatch in memory_region_section_get_iotlb(), Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 03/13] qemu-char: Fix missed data on unix socket, Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 02/13] qemu-char: handle EINTR for TCP character devices, Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 05/13] vnc: fix memory leak, Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 04/13] crypto: extend unit tests to cover decryption too, Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 07/13] rcu: actually register threads that have RCU read-side critical sections, Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 08/13] scsi: Handle no media case for scsi_get_configuration, Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 10/13] memory: count number of active VGA logging clients,
Paolo Bonzini <=
- [Qemu-devel] [PULL 06/13] scsi: fix buffer overflow in scsi_req_parse_cdb (CVE-2015-5158), Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 09/13] vl: Fix compiler warning for builds without VNC, Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 12/13] qemu-doc: fix typos, Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 11/13] framebuffer: set DIRTY_MEMORY_VGA on RAM that is used for the framebuffer, Paolo Bonzini, 2015/07/24
- [Qemu-devel] [PULL 13/13] target-i386/FPU: a misprint in helper_fistll_ST0, Paolo Bonzini, 2015/07/24
- Re: [Qemu-devel] [PULL 00/13] Miscellaneous bugfixes for 2.4.0-rc3, Peter Maydell, 2015/07/24