1 Star 0 Fork 121

ctyunsystem/qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
target-ppc-exit-1-on-failure-in-kvmppc_get_clockfreq.patch 1.57 KB
一键复制 编辑 原始数据 按行查看 历史
yezengruan 提交于 2022-08-11 19:08 . Qemu update to version 6.2.0-45
From 584a648e0de0b0bda49e87349f2db3b2f0f87c33 Mon Sep 17 00:00:00 2001
From: jianchunfu <jianchunfu_yewu@cmss.chinamobile.com>
Date: Thu, 4 Aug 2022 16:47:26 +0800
Subject: [PATCH 8/9] target/ppc: exit(1) on failure in kvmppc_get_clockfreq()
When running under KVM accel it is expected to have 'clock-frequency' in
the DT. Not having this attribute is too risky for both the machine
emulation and userspace.
We have a way of telling whether this error scenario might happen or not
via kvmppc_read_int_cpu_dt() now being able to report errors. From now
on, when running KVM, we will assume that 'clock-frequency' will always
be present in the DT.
Signed-off-by: jianchunfu <jianchunfu_yewu@cmss.chinamobile.com>
---
target/ppc/kvm.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 1a6c6b6fa0..d73563045b 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1944,9 +1944,24 @@ static uint64_t kvmppc_read_int_cpu_dt(const char *propname, Error **errp)
return kvmppc_read_int_dt(tmp, errp);
}
+/*
+ * Read the clock-frequency from the DT. On error (e.g.
+ * 'clock-frequency' is not present in the DT) will
+ * report an error and exit(1).
+ */
uint64_t kvmppc_get_clockfreq(void)
{
- return kvmppc_read_int_cpu_dt("clock-frequency", NULL);
+ Error *local_err = NULL;
+ int ret;
+
+ ret = kvmppc_read_int_cpu_dt("clock-frequency", &local_err);
+
+ if (local_err) {
+ error_report_err(local_err);
+ exit(1);
+ }
+
+ return ret;
}
static int kvmppc_get_dec_bits(void)
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ctyunsystem/qemu.git
git@gitee.com:ctyunsystem/qemu.git
ctyunsystem
qemu
qemu
master

搜索帮助