Skip to content

Commit e2f3d40

Browse files
tlendackybp3tk0v
authored andcommitted
x86/sev: Move the SNP probe routine out of the way
To make patch review easier for the segmented RMP support, move the SNP probe function out from in between the initialization-related routines. No functional change. Signed-off-by: Tom Lendacky <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Nikunj A Dadhania <[email protected]> Reviewed-by: Neeraj Upadhyay <[email protected]> Link: https://lore.kernel.org/r/6c2975bbf132d567dd12e1435be1d18c0bf9131c.1733172653.git.thomas.lendacky@amd.com
1 parent 4972808 commit e2f3d40

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

arch/x86/virt/svm/sev.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -135,36 +135,6 @@ static __init void snp_enable(void *arg)
135135
__snp_enable(smp_processor_id());
136136
}
137137

138-
#define RMP_ADDR_MASK GENMASK_ULL(51, 13)
139-
140-
bool snp_probe_rmptable_info(void)
141-
{
142-
u64 rmp_sz, rmp_base, rmp_end;
143-
144-
rdmsrl(MSR_AMD64_RMP_BASE, rmp_base);
145-
rdmsrl(MSR_AMD64_RMP_END, rmp_end);
146-
147-
if (!(rmp_base & RMP_ADDR_MASK) || !(rmp_end & RMP_ADDR_MASK)) {
148-
pr_err("Memory for the RMP table has not been reserved by BIOS\n");
149-
return false;
150-
}
151-
152-
if (rmp_base > rmp_end) {
153-
pr_err("RMP configuration not valid: base=%#llx, end=%#llx\n", rmp_base, rmp_end);
154-
return false;
155-
}
156-
157-
rmp_sz = rmp_end - rmp_base + 1;
158-
159-
probed_rmp_base = rmp_base;
160-
probed_rmp_size = rmp_sz;
161-
162-
pr_info("RMP table physical range [0x%016llx - 0x%016llx]\n",
163-
rmp_base, rmp_end);
164-
165-
return true;
166-
}
167-
168138
static void __init __snp_fixup_e820_tables(u64 pa)
169139
{
170140
if (IS_ALIGNED(pa, PMD_SIZE))
@@ -291,6 +261,36 @@ static int __init snp_rmptable_init(void)
291261
*/
292262
device_initcall(snp_rmptable_init);
293263

264+
#define RMP_ADDR_MASK GENMASK_ULL(51, 13)
265+
266+
bool snp_probe_rmptable_info(void)
267+
{
268+
u64 rmp_sz, rmp_base, rmp_end;
269+
270+
rdmsrl(MSR_AMD64_RMP_BASE, rmp_base);
271+
rdmsrl(MSR_AMD64_RMP_END, rmp_end);
272+
273+
if (!(rmp_base & RMP_ADDR_MASK) || !(rmp_end & RMP_ADDR_MASK)) {
274+
pr_err("Memory for the RMP table has not been reserved by BIOS\n");
275+
return false;
276+
}
277+
278+
if (rmp_base > rmp_end) {
279+
pr_err("RMP configuration not valid: base=%#llx, end=%#llx\n", rmp_base, rmp_end);
280+
return false;
281+
}
282+
283+
rmp_sz = rmp_end - rmp_base + 1;
284+
285+
probed_rmp_base = rmp_base;
286+
probed_rmp_size = rmp_sz;
287+
288+
pr_info("RMP table physical range [0x%016llx - 0x%016llx]\n",
289+
rmp_base, rmp_end);
290+
291+
return true;
292+
}
293+
294294
static struct rmpentry_raw *get_raw_rmpentry(u64 pfn)
295295
{
296296
if (!rmptable)

0 commit comments

Comments
 (0)