From: Shivansh Dhiman <shivansh.dhiman@amd.com>
To: <seanjc@google.com>, <pbonzini@redhat.com>,
<linux-kernel@vger.kernel.org>, <kvm@vger.kernel.org>
Cc: <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
<dave.hansen@linux.intel.com>, <x86@kernel.org>, <hpa@zytor.com>,
<xin@zytor.com>, <andrew.cooper3@citrix.com>,
<sohil.mehta@intel.com>, <dwmw@amazon.co.uk>, <yosry@kernel.org>,
<nikunj.dadhania@amd.com>, <santosh.shukla@amd.com>,
<shivansh.dhiman@amd.com>
Subject: [PATCH v3 7/9] KVM: SVM: Dump FRED context in dump_vmcb()
Date: Fri, 25 Sep 2026 11:40:15 +0000 [thread overview]
Message-ID: <20260925114017.2208531-8-shivansh.dhiman@amd.com> (raw)
In-Reply-To: <20260925114017.2208531-1-shivansh.dhiman@amd.com>
Add fields related to FRED to dump_vmcb() to dump FRED context.
Signed-off-by: Shivansh Dhiman <shivansh.dhiman@amd.com>
---
Changes in v3:
* Update the print statements to align with fields in VMCB save area.
Changes in v2:
* Gate all the FRED MSRs through guest_cpu_cap_has() (Sean Christopherson).
---
arch/x86/kvm/svm/svm.c | 43 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index fb6b94405f88..86a3ba54aab2 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -3589,6 +3589,11 @@ static void dump_vmcb(struct kvm_vcpu *vcpu)
pr_err("%-20s%016llx\n", "allowed_sev_features:", control->allowed_sev_features);
pr_err("%-20s%016llx\n", "guest_sev_features:", control->guest_sev_features);
+ if (guest_cpu_cap_has(vcpu, X86_FEATURE_FRED)) {
+ pr_err("%-20s%016llx\n", "exit_int_data:", control->exit_int_data);
+ pr_err("%-20s%016llx\n", "event_inj_data:", control->event_inj_data);
+ }
+
if (is_sev_es_guest(vcpu)) {
save = sev_decrypt_vmsa(vcpu);
if (!save)
@@ -3703,6 +3708,27 @@ static void dump_vmcb(struct kvm_vcpu *vcpu)
"r14:", vmsa->r14, "r15:", vmsa->r15);
pr_err("%-15s %016llx %-13s %016llx\n",
"xcr0:", vmsa->xcr0, "xss:", vmsa->xss);
+
+ if (guest_cpu_cap_has(vcpu, X86_FEATURE_FRED)) {
+ pr_err("%-27s %d %-18s%016llx\n",
+ "is_fred_enabled:", is_fred_enabled(vcpu),
+ "guest_evntinjdata:", vmsa->guest_event_inj_data);
+ pr_err("%-12s %016llx %-18s%016llx\n",
+ "fred_config:", vmsa->fred_config,
+ "guest_exitintdata:", vmsa->guest_exit_int_data);
+ pr_err("%-15s %016llx %-13s %016llx\n",
+ "fred_rsp0:", vmsa->fred_rsp0,
+ "fred_rsp1:", vmsa->fred_rsp1);
+ pr_err("%-15s %016llx %-13s %016llx\n",
+ "fred_rsp2:", vmsa->fred_rsp2,
+ "fred_rsp3:", vmsa->fred_rsp3);
+ pr_err("%-15s %016llx %-13s %016llx\n",
+ "fred_stklvls:", vmsa->fred_stklvls,
+ "fred_ssp1:", vmsa->fred_ssp1);
+ pr_err("%-15s %016llx %-13s %016llx\n",
+ "fred_ssp2:", vmsa->fred_ssp2,
+ "fred_ssp3:", vmsa->fred_ssp3);
+ }
} else {
pr_err("%-15s %016llx %-13s %016lx\n",
"rax:", save->rax, "rbx:",
@@ -3730,6 +3756,23 @@ static void dump_vmcb(struct kvm_vcpu *vcpu)
"r14:", vcpu->arch.regs[VCPU_REGS_R14],
"r15:", vcpu->arch.regs[VCPU_REGS_R15]);
#endif
+ if (guest_cpu_cap_has(vcpu, X86_FEATURE_FRED)) {
+ pr_err("%-15s %-15d %-13s %016llx\n",
+ "is_fred_enabled:", is_fred_enabled(vcpu),
+ "fred_config:", save->fred_config);
+ pr_err("%-15s %016llx %-13s %016llx\n",
+ "fred_rsp0:", svm_read_guest_fred_rsp0(svm),
+ "fred_rsp1:", save->fred_rsp1);
+ pr_err("%-15s %016llx %-13s %016llx\n",
+ "fred_rsp2:", save->fred_rsp2,
+ "fred_rsp3:", save->fred_rsp3);
+ pr_err("%-15s %016llx %-13s %016llx\n",
+ "fred_stklvls:", save->fred_stklvls,
+ "fred_ssp1:", save->fred_ssp1);
+ pr_err("%-15s %016llx %-13s %016llx\n",
+ "fred_ssp2:", save->fred_ssp2,
+ "fred_ssp3:", save->fred_ssp3);
+ }
}
no_vmsa:
--
2.43.0
next prev parent reply other threads:[~2026-09-25 11:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 11:40 [PATCH v3 0/9] KVM: SVM: Enable FRED support Shivansh Dhiman
2026-09-25 11:40 ` [PATCH v3 1/9] KVM: SVM: Initialize FRED VMCB fields Shivansh Dhiman
2026-09-25 11:40 ` [PATCH v3 2/9] KVM: SVM: Disable interception of FRED MSRs for FRED supported guests Shivansh Dhiman
2026-09-25 11:40 ` [PATCH v3 3/9] KVM: SVM: Save/restore FRED_RSP0 " Shivansh Dhiman
2026-09-25 11:40 ` [PATCH v3 4/9] KVM: SVM: Add support for saving and restoring FRED MSRs Shivansh Dhiman
2026-09-25 11:40 ` [PATCH v3 5/9] KVM: SVM: Populate FRED event data on event injection Shivansh Dhiman
2026-09-25 11:40 ` [PATCH v3 6/9] KVM: SVM: Support FRED nested exception injection Shivansh Dhiman
2026-09-25 11:40 ` Shivansh Dhiman [this message]
2026-09-25 11:40 ` [PATCH v3 8/9] KVM: SVM: Enable FRED virtualization Shivansh Dhiman
2026-09-25 11:40 ` [PATCH v3 9/9] KVM: SVM: Don't intercept ICEBP while the guest has FRED enabled Shivansh Dhiman
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=20260925114017.2208531-8-shivansh.dhiman@amd.com \
--to=shivansh.dhiman@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dwmw@amazon.co.uk \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nikunj.dadhania@amd.com \
--cc=pbonzini@redhat.com \
--cc=santosh.shukla@amd.com \
--cc=seanjc@google.com \
--cc=sohil.mehta@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xin@zytor.com \
--cc=yosry@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®