Re: [PATCH v3 5/8] x86/sev: Map only the RMP table entries instead of the full RMP range
From: Neeraj Upadhyay
Date: Fri Oct 18 2024 - 00:38:24 EST
> /*
> * Do the necessary preparations which are verified by the firmware as
> * described in the SNP_INIT_EX firmware command description in the SNP
> @@ -205,12 +222,17 @@ static int __init snp_rmptable_init(void)
> goto nosnp;
> }
>
> - rmptable_start = memremap(probed_rmp_base, probed_rmp_size, MEMREMAP_WB);
> + /* Map only the RMP entries */
> + rmptable_start = memremap(probed_rmp_base + RMPTABLE_CPU_BOOKKEEPING_SZ,
> + probed_rmp_size - RMPTABLE_CPU_BOOKKEEPING_SZ,
> + MEMREMAP_WB);
> if (!rmptable_start) {
> pr_err("Failed to map RMP table\n");
> goto nosnp;
> }
>
> + rmptable_size = probed_rmp_size - RMPTABLE_CPU_BOOKKEEPING_SZ;
> +
Nit: Move this assignment above 'rmptable_start = memremap(...)', so that
rmptable_size can be used there.
- Neeraj