[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC][PATCH v1 03/10] Introduce new interface KVMState::set_mr_debug_ops
From: |
Yuan Yao |
Subject: |
[RFC][PATCH v1 03/10] Introduce new interface KVMState::set_mr_debug_ops and its wrapper |
Date: |
Thu, 6 May 2021 09:40:30 +0800 |
From: Yuan Yao <yuan.yao@intel.com>
This interface is designed to setup the MemoryRegion::debug_ops.
Also introduced 2 wrapper functions for installing/calling the
KVMState::set_mr_debug_ops from different targets easily.
Signed-off-by: Yuan Yao <yuan.yao@intel.com>
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index b6d5c9fd7d..1482561bd7 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -129,6 +129,8 @@ struct KVMState
KVMMemoryListener *ml;
AddressSpace *as;
} *as;
+
+ set_memory_region_debug_ops set_mr_debug_ops;
};
KVMState *kvm_state;
@@ -3157,6 +3159,21 @@ static void kvm_set_kernel_irqchip(Object *obj, Visitor
*v,
}
}
+void kvm_setup_memory_region_debug_ops(struct KVMState *s,
+ set_memory_region_debug_ops new_ops)
+{
+ if (s)
+ s->set_mr_debug_ops = new_ops;
+}
+
+void kvm_set_memory_region_debug_ops(void *handle, MemoryRegion *mr)
+{
+ if (!kvm_state || !kvm_state->set_mr_debug_ops)
+ return;
+
+ kvm_state->set_mr_debug_ops(handle, mr);
+}
+
bool kvm_kernel_irqchip_allowed(void)
{
return kvm_state->kernel_irqchip_allowed;
diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index 0f17acfac0..f1c57ad8d7 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -148,4 +148,15 @@ bool kvm_arm_supports_user_irq(void)
{
return false;
}
+
+void kvm_setup_memory_region_debug_ops(struct KVMState *s,
+ set_memory_region_debug_ops new_ops)
+{
+
+}
+
+void kvm_set_memory_region_debug_ops(void *handle, MemoryRegion *mr)
+{
+
+}
#endif
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index a1ab1ee12d..64685cad57 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -547,4 +547,9 @@ bool kvm_cpu_check_are_resettable(void);
bool kvm_arch_cpu_check_are_resettable(void);
+typedef void (*set_memory_region_debug_ops)(void *handle, MemoryRegion *mr);
+void kvm_setup_memory_region_debug_ops(struct KVMState *s,
set_memory_region_debug_ops new_ops);
+
+void kvm_set_memory_region_debug_ops(void *handle, MemoryRegion *mr);
+
#endif
--
2.20.1
- [RFC][PATCH v1 00/10] Enable encrypted guest memory access in QEMU, Yuan Yao, 2021/05/05
- [RFC][PATCH v1 01/10] Extend the MemTxAttrs to include a 'debug' flag. The flag can be used as general indicator that operation was triggered by the debugger., Yuan Yao, 2021/05/05
- [RFC][PATCH v1 02/10] Currently, guest memory access for debugging purposes is performed using memcpy(). Extend the 'struct MemoryRegion' to include new callbacks that can be used to override the use of memcpy() with something else., Yuan Yao, 2021/05/05
- [RFC][PATCH v1 03/10] Introduce new interface KVMState::set_mr_debug_ops and its wrapper,
Yuan Yao <=
- [RFC][PATCH v1 04/10] Implements the common MemoryRegion::ram_debug_ops for encrypted guests, Yuan Yao, 2021/05/05
- [RFC][PATCH v1 05/10] Set the RAM's MemoryRegion::debug_ops for INTEL TD guests, Yuan Yao, 2021/05/05
- [RFC][PATCH v1 06/10] Introduce new MemoryDebugOps which hook into guest virtual and physical memory debug interfaces such as cpu_memory_rw_debug, to allow vendor specific assist/hooks for debugging and delegating accessing the guest memory. This is required for example in case of AMD SEV platform where the guest memory is encrypted and a SEV specific debug assist/hook will be required to access the guest memory., Yuan Yao, 2021/05/05
- [RFC][PATCH v1 07/10] Add new address_space_read and address_space_write debug helper interfaces which can be invoked by vendor specific guest memory debug assist/hooks to do guest RAM memory accesses using the added MemoryRegion callbacks., Yuan Yao, 2021/05/05
- [RFC][PATCH v1 08/10] Introduce debug version of physical memory read/write API, Yuan Yao, 2021/05/05
- [RFC][PATCH v1 09/10] Change the monitor and other commands and gdbstub to use the debug API, Yuan Yao, 2021/05/05
- [RFC][PATCH v1 10/10] Introduce new CPUClass::get_phys_page_attrs_debug implementation for encrypted guests, Yuan Yao, 2021/05/05