From: Zhao Liu <zhao1.liu@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Cc: Zhenyu Wang <zhenyu.z.wang@intel.com>,
Zhuocheng Ding <zhuocheng.ding@intel.com>,
Dapeng Mi <dapeng1.mi@intel.com>,
Yanting Jiang <yanting.jiang@intel.com>,
Yongwei Ma <yongwei.ma@intel.com>, Zhao Liu <zhao1.liu@intel.com>
Subject: [RFC 6/6] i386: Add a new property to set ITD related feature bits for Guest
Date: Sat, 3 Feb 2024 17:30:54 +0800 [thread overview]
Message-ID: <20240203093054.412135-7-zhao1.liu@linux.intel.com> (raw)
In-Reply-To: <20240203093054.412135-1-zhao1.liu@linux.intel.com>
From: Zhao Liu <zhao1.liu@intel.com>
The property enable-itd will be used to set ITD related feature bits
for Guest, which includes PTS, HFI, ITD and HRESET.
Now PTS, HFI, ITD and HRESET are marked as no_autoenable_flags, since
PTS, HFI and ITD have additional restrictions on CPU topology, and
HRESET is only used in ITD case. If user wants to enable ITD for Guest,
he need to specify PTS, HFI, ITD and HRESET explicitly in the -cpu
command.
Thus it's necessary to introduce "-cpu enable-itd" to help set these
feature bits.
Tested-by: Yanting Jiang <yanting.jiang@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
target/i386/cpu.c | 20 +++++++++++++++-----
target/i386/cpu.h | 3 +++
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 3b26b471b861..070f7ff43a1b 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -7304,6 +7304,12 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
*/
x86_cpu_hyperv_realize(cpu);
+ if (cpu->enable_itd) {
+ env->features[FEAT_6_EAX] |= CPUID_6_EAX_PTS | CPUID_6_EAX_HFI |
+ CPUID_6_EAX_ITD;
+ env->features[FEAT_7_1_EAX] |= CPUID_7_1_EAX_HRESET;
+ }
+
x86_cpu_expand_features(cpu, &local_err);
if (local_err) {
goto out;
@@ -7494,22 +7500,25 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
if (env->features[FEAT_6_EAX] & CPUID_6_EAX_PTS && ms->smp.sockets > 1) {
error_setg(errp,
- "PTS currently only supports 1 package, "
- "please set by \"-smp ...,sockets=1\"");
+ "%s currently only supports 1 package, "
+ "please set by \"-smp ...,sockets=1\"",
+ cpu->enable_itd ? "enable-itd" : "PTS");
return;
}
if (env->features[FEAT_6_EAX] & (CPUID_6_EAX_HFI | CPUID_6_EAX_ITD) &&
(ms->smp.dies > 1 || ms->smp.sockets > 1)) {
error_setg(errp,
- "HFI/ITD currently only supports die/package, "
- "please set by \"-smp ...,sockets=1,dies=1\"");
+ "%s currently only supports 1 die/package, "
+ "please set by \"-smp ...,sockets=1,dies=1\"",
+ cpu->enable_itd ? "enable-itd" : "HFI/ITD");
return;
}
if (env->features[FEAT_6_EAX] & (CPUID_6_EAX_PTS | CPUID_6_EAX_HFI) &&
!(env->features[FEAT_6_EAX] & CPUID_6_EAX_ITD)) {
- error_setg(errp,
+ error_setg(errp, "%s", cpu->enable_itd ?
+ "Host doesn't support ITD" :
"In the absence of ITD, Guest does "
"not need PTS/HFI");
return;
@@ -8003,6 +8012,7 @@ static Property x86_cpu_properties[] = {
false),
DEFINE_PROP_BOOL("x-intel-pt-auto-level", X86CPU, intel_pt_auto_level,
true),
+ DEFINE_PROP_BOOL("enable-itd", X86CPU, enable_itd, false),
DEFINE_PROP_END_OF_LIST()
};
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index a68c9d8a8660..009ec66dead0 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -2071,6 +2071,9 @@ struct ArchCPU {
int32_t hv_max_vps;
bool xen_vapic;
+
+ /* Set ITD and related feature bits (PTS, HFI and HRESET) for Guest. */
+ bool enable_itd;
};
typedef struct X86CPUModel X86CPUModel;
--
2.34.1
next prev parent reply other threads:[~2024-02-03 9:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-03 9:30 [RFC 0/6] Intel Thread Director Virtualization Support in QEMU Zhao Liu
2024-02-03 9:30 ` [RFC 1/6] target/i386: Add support for save/load of ACPI thermal MSRs Zhao Liu
2024-02-03 9:30 ` [RFC 2/6] target/i386: Add support for Package Thermal Management feature Zhao Liu
2024-02-03 9:30 ` [RFC 3/6] target/i386: Add support for Hardware Feedback Interface feature Zhao Liu
2024-02-03 9:30 ` [RFC 4/6] target/i386: Add support for Intel Thread Director feature Zhao Liu
2024-02-03 9:30 ` [RFC 5/6] target/i386: Add support for HRESET feature Zhao Liu
2024-02-03 9:30 ` Zhao Liu [this message]
2024-02-03 9:37 ` [RFC 0/6] Intel Thread Director Virtualization Support in QEMU Zhao Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240203093054.412135-7-zhao1.liu@linux.intel.com \
--to=zhao1.liu@linux.intel.com \
--cc=dapeng1.mi@intel.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yanting.jiang@intel.com \
--cc=yongwei.ma@intel.com \
--cc=zhao1.liu@intel.com \
--cc=zhenyu.z.wang@intel.com \
--cc=zhuocheng.ding@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).