代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/qemu 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From ec2518709b8d461c3a165c1722ccd2e585cec161 Mon Sep 17 00:00:00 2001
From: hanliyang <hanliyang@hygon.cn>
Date: Sun, 16 Jan 2022 20:05:02 -0500
Subject: [PATCH] migration/ram: Fix calculation of gfn correpond to a page in
ramblock
A RAMBlock contains a host memory region which may consist of many
discontiguous MemoryRegion in AddressSpace of a Guest, so we cannot
get gpa by MemoryRegion.addr. Since KVM memslot records the relationship
between gpa and hva, so we can pass the hva of page in RAMBlock to
kvm_phisical_memory_addr_from_host() to get the expected gpa.
Signed-off-by: hanliyang <hanliyang@hygon.cn>
---
migration/ram.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/migration/ram.c b/migration/ram.c
index 66a36736ad..1abe8476f7 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -67,6 +67,7 @@
/* Defines RAM_SAVE_ENCRYPTED_PAGE and RAM_SAVE_SHARED_REGION_LIST */
#include "target/i386/sev.h"
+#include "sysemu/kvm.h"
#include "hw/boards.h" /* for machine_dump_guest_core() */
@@ -2145,6 +2146,8 @@ static bool encrypted_test_list(RAMState *rs, RAMBlock *block,
struct ConfidentialGuestMemoryEncryptionOps *ops =
cgs_class->memory_encryption_ops;
unsigned long gfn;
+ hwaddr paddr = 0;
+ int ret;
/* ROM devices contains the unencrypted data */
if (memory_region_is_rom(block->mr)) {
@@ -2167,7 +2170,14 @@ static bool encrypted_test_list(RAMState *rs, RAMBlock *block,
* Translate page in ram_addr_t address space to GPA address
* space using memory region.
*/
- gfn = page + (block->mr->addr >> TARGET_PAGE_BITS);
+ if (kvm_enabled()) {
+ ret = kvm_physical_memory_addr_from_host(kvm_state,
+ block->host + (page << TARGET_PAGE_BITS), &paddr);
+ if (ret == 0) {
+ return false;
+ }
+ }
+ gfn = paddr >> TARGET_PAGE_BITS;
return ops->is_gfn_in_unshared_region(gfn);
}
--
2.41.0.windows.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。