!93 target/arm: ignore evtstrm and cpuid CPU features

Merge pull request !93 from PengLiang/master
This commit is contained in:
openeuler-ci-bot 2020-09-09 11:37:40 +08:00 committed by Gitee
commit 486f9ba588
2 changed files with 71 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: qemu Name: qemu
Version: 4.1.0 Version: 4.1.0
Release: 22 Release: 23
Epoch: 2 Epoch: 2
Summary: QEMU is a generic and open source machine emulator and virtualizer Summary: QEMU is a generic and open source machine emulator and virtualizer
License: GPLv2 and BSD and MIT and CC-BY License: GPLv2 and BSD and MIT and CC-BY
@ -227,6 +227,7 @@ Patch0214: target-arm-Add-CPU-features-to-query-cpu-model-expan.patch
Patch0215: target-arm-Update-ID-fields.patch Patch0215: target-arm-Update-ID-fields.patch
Patch0216: target-arm-Add-more-CPU-features.patch Patch0216: target-arm-Add-more-CPU-features.patch
Patch0217: hw-usb-core-fix-buffer-overflow.patch Patch0217: hw-usb-core-fix-buffer-overflow.patch
Patch0218: target-arm-ignore-evtstrm-and-cpuid-CPU-features.patch
BuildRequires: flex BuildRequires: flex
BuildRequires: bison BuildRequires: bison
@ -573,6 +574,9 @@ getent passwd qemu >/dev/null || \
%endif %endif
%changelog %changelog
* Tue Sep 08 2020 Huawei Technologies Co., Ltd <liangpeng10@huawei.com>
- target/arm: ignore evtstrm and cpuid CPU features
* Fri Aug 21 2020 Huawei Technologies Co., Ltd <lijiajie11@huawei.com> * Fri Aug 21 2020 Huawei Technologies Co., Ltd <lijiajie11@huawei.com>
- hw/usb/core.c: fix buffer overflow in do_token_setup function - hw/usb/core.c: fix buffer overflow in do_token_setup function

View File

@ -0,0 +1,66 @@
From dfedc889fafd35efd4f8382b7672bf0e556f9f45 Mon Sep 17 00:00:00 2001
From: Peng Liang <liangpeng10@huawei.com>
Date: Mon, 7 Sep 2020 14:07:07 +0800
Subject: [PATCH] target/arm: ignore evtstrm and cpuid CPU features
evtstrm and cpuid cann't be controlled by VMM:
1. evtstrm: The generic timer is configured to generate events at a
frequency of approximately 100KHz. It's controlled by the linux
kernel config CONFIG_ARM_ARCH_TIMER_EVTSTREAM.
2. cpuid: EL0 access to certain ID registers is available. It's always
set by linux kernel after 77c97b4ee2129 ("arm64: cpufeature: Expose
CPUID registers by emulation").
However, they are exposed by getauxval() and /proc/cpuinfo. Hence,
let's report and ignore the CPU features if someone set them.
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
---
target/arm/cpu64.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index 7de20848..726d123d 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -506,10 +506,37 @@ static void arm_cpu_parse_featurestr(const char *typename, char *features,
}
}
+static const char *unconfigurable_feats[] = {
+ "evtstrm",
+ "cpuid",
+ NULL
+};
+
+static bool is_configurable_feat(const char *name)
+{
+ int i;
+
+ for (i = 0; unconfigurable_feats[i]; ++i) {
+ if (g_strcmp0(unconfigurable_feats[i], name) == 0) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
static void
cpu_add_feat_as_prop(const char *typename, const char *name, const char *val)
{
- GlobalProperty *prop = g_new0(typeof(*prop), 1);
+ GlobalProperty *prop;
+
+ if (!is_configurable_feat(name)) {
+ info_report("CPU feature '%s' is not configurable by QEMU. Ignore it.",
+ name);
+ return;
+ }
+
+ prop = g_new0(typeof(*prop), 1);
prop->driver = typename;
prop->property = g_strdup(name);
prop->value = g_strdup(val);
--
2.28.0