From: Zhao Liu <zhao1.liu@intel.com>
To: Gao Shiyuan <gaoshiyuan@baidu.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [PATCH v1 1/1] x86: Add support save/load HWCR MSR
Date: Wed, 9 Oct 2024 16:52:47 +0800 [thread overview]
Message-ID: <ZwZEXyRvZeb4eO6q@intel.com> (raw)
In-Reply-To: <20240926040808.9158-1-gaoshiyuan@baidu.com>
Hi Shiyuan,
On Thu, Sep 26, 2024 at 12:08:08PM +0800, Gao Shiyuan via wrote:
> Date: Thu, 26 Sep 2024 12:08:08 +0800
> From: Gao Shiyuan via <qemu-devel@nongnu.org>
> Subject: [PATCH v1 1/1] x86: Add support save/load HWCR MSR
> X-Mailer: git-send-email 2.39.3 (Apple Git-146)
>
> KVM commit 191c8137a939 ("x86/kvm: Implement HWCR support")
> introduced support for emulating HWCR MSR.
>
> Add support for QEMU to save/load this MSR for migration purposes.
>
> Signed-off-by: Gao Shiyuan <gaoshiyuan@baidu.com>
> ---
> target/i386/cpu.c | 1 +
> target/i386/cpu.h | 5 +++++
> target/i386/kvm/kvm.c | 12 ++++++++++++
> target/i386/machine.c | 20 ++++++++++++++++++++
> 4 files changed, 38 insertions(+)
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 85ef7452c0..339131a39a 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -7093,6 +7093,7 @@ static void x86_cpu_reset_hold(Object *obj, ResetType type)
> env->a20_mask = ~0x0;
> env->smbase = 0x30000;
> env->msr_smi_count = 0;
> + env->hwcr = 0;
Why we need to clear it here? This needs to be explained in the commit
message.
> env->idt.limit = 0xffff;
> env->gdt.limit = 0xffff;
> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index 14edd57a37..a19b1ceda4 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -539,6 +539,8 @@ typedef enum X86Seg {
>
> #define MSR_AMD64_TSC_RATIO_DEFAULT 0x100000000ULL
>
> +#define MSR_K7_HWCR 0xc0010015
> +
> #define MSR_VM_HSAVE_PA 0xc0010117
>
> #define MSR_IA32_XFD 0x000001c4
> @@ -1859,6 +1861,9 @@ typedef struct CPUArchState {
> uint64_t msr_lbr_depth;
> LBREntry lbr_records[ARCH_LBR_NR_ENTRIES];
>
> + /* Hardware Configuration MSR */
We can keep the same comment as msr_hwcr in KVM to emphasize this is an
AMD-specific MSR, i.e.,
/* AMD MSRC001_0015 Hardware Configuration */
> + uint64_t hwcr;
Add the msr_ prefix to indicate that this value is only intended to
store the MSR. Currently, for similar members, some have the msr_ prefix
and some do not, but it is better to have it for clarity.
> +
> /* exception/interrupt handling */
> int error_code;
> int exception_is_int;
-Zhao
next prev parent reply other threads:[~2024-10-09 8:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 4:08 [PATCH v1 1/1] x86: Add support save/load HWCR MSR Gao Shiyuan
2024-09-26 4:08 ` Gao Shiyuan via
2024-10-08 2:47 ` Gao,Shiyuan
2024-10-08 2:47 ` Gao,Shiyuan via
2024-10-09 8:52 ` Zhao Liu [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-10-09 8:59 Gao,Shiyuan
2024-10-09 8:59 ` Gao,Shiyuan via
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=ZwZEXyRvZeb4eO6q@intel.com \
--to=zhao1.liu@intel.com \
--cc=gaoshiyuan@baidu.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.