Re: [PATCH v2 1/7] x86/sev: Prepare for using the RMPREAD instruction to access the RMP
From: Borislav Petkov
Date: Fri Oct 18 2024 - 07:12:11 EST
On Thu, Oct 17, 2024 at 01:16:36PM -0500, Tom Lendacky wrote:
> I can look at naming the new struct "rmpread" and see how that looks if you
> prefer.
I think I understand what you mean now and I guess something like the below
would make it more clear. Diff ontop:
diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
index 73d4f422829a..73d9295dd013 100644
--- a/arch/x86/virt/svm/sev.c
+++ b/arch/x86/virt/svm/sev.c
@@ -48,7 +48,8 @@ struct rmpentry {
/*
* The RMP entry format is not architectural. The format is defined in PPR
- * Family 19h Model 01h, Rev B1 processor.
+ * Family 19h Model 01h, Rev B1 processor. This is the raw, verbatim
+ * representation as it is found in the RMP table.
*/
struct rmpentry_raw {
union {
@@ -286,7 +287,7 @@ static int __init snp_rmptable_init(void)
*/
device_initcall(snp_rmptable_init);
-static struct rmpentry_raw *__get_rmpentry(unsigned long pfn)
+static struct rmpentry_raw *get_raw_rmpentry(unsigned long pfn)
{
if (!rmptable)
return ERR_PTR(-ENODEV);
@@ -312,7 +313,7 @@ static int get_rmpentry(u64 pfn, struct rmpentry *entry)
return ret;
}
- e = __get_rmpentry(pfn);
+ e = get_raw_rmpentry(pfn);
if (IS_ERR(e))
return PTR_ERR(e);
@@ -393,7 +394,7 @@ static void dump_rmpentry(u64 pfn)
}
if (e.assigned) {
- e_raw = __get_rmpentry(pfn);
+ e_raw = get_raw_rmpentry(pfn);
if (IS_ERR(e_raw)) {
pr_err("Failed to read RMP contents for PFN 0x%llx, error %ld\n",
pfn, PTR_ERR(e_raw));
@@ -420,7 +421,7 @@ static void dump_rmpentry(u64 pfn)
pfn, pfn_i, pfn_end);
while (pfn_i < pfn_end) {
- e_raw = __get_rmpentry(pfn_i);
+ e_raw = get_raw_rmpentry(pfn_i);
if (IS_ERR(e_raw)) {
pr_err("Error %ld reading RMP contents for PFN 0x%llx\n",
PTR_ERR(e_raw), pfn_i);
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette