[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a29c83a2-3450-b459-880e-a0737825f381@amd.com>
Date: Wed, 16 Oct 2024 16:35:28 +0530
From: "Nikunj A. Dadhania" <nikunj@....com>
To: Tom Lendacky <thomas.lendacky@....com>, linux-kernel@...r.kernel.org,
x86@...nel.org
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
Michael Roth <michael.roth@....com>, Ashish Kalra <ashish.kalra@....com>
Subject: Re: [PATCH v3 4/8] x86/sev: Move the SNP probe routine out of the way
On 9/30/2024 8:52 PM, Tom Lendacky wrote:
> 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 <thomas.lendacky@....com>
Reviewed-by: Nikunj A Dadhania <nikunj@....com>
> ---
> arch/x86/virt/svm/sev.c | 60 ++++++++++++++++++++---------------------
> 1 file changed, 30 insertions(+), 30 deletions(-)
>
> diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
> index 73d4f422829a..31d1510ae119 100644
> --- a/arch/x86/virt/svm/sev.c
> +++ b/arch/x86/virt/svm/sev.c
> @@ -132,36 +132,6 @@ static __init void snp_enable(void *arg)
> __snp_enable(smp_processor_id());
> }
>
> -#define RMP_ADDR_MASK GENMASK_ULL(51, 13)
> -
> -bool snp_probe_rmptable_info(void)
> -{
> - u64 rmp_sz, rmp_base, rmp_end;
> -
> - rdmsrl(MSR_AMD64_RMP_BASE, rmp_base);
> - rdmsrl(MSR_AMD64_RMP_END, rmp_end);
> -
> - if (!(rmp_base & RMP_ADDR_MASK) || !(rmp_end & RMP_ADDR_MASK)) {
> - pr_err("Memory for the RMP table has not been reserved by BIOS\n");
> - return false;
> - }
> -
> - if (rmp_base > rmp_end) {
> - pr_err("RMP configuration not valid: base=%#llx, end=%#llx\n", rmp_base, rmp_end);
> - return false;
> - }
> -
> - rmp_sz = rmp_end - rmp_base + 1;
> -
> - probed_rmp_base = rmp_base;
> - probed_rmp_size = rmp_sz;
> -
> - pr_info("RMP table physical range [0x%016llx - 0x%016llx]\n",
> - rmp_base, rmp_end);
> -
> - return true;
> -}
> -
> static void __init __snp_fixup_e820_tables(u64 pa)
> {
> if (IS_ALIGNED(pa, PMD_SIZE))
> @@ -286,6 +256,36 @@ static int __init snp_rmptable_init(void)
> */
> device_initcall(snp_rmptable_init);
>
> +#define RMP_ADDR_MASK GENMASK_ULL(51, 13)
> +
> +bool snp_probe_rmptable_info(void)
> +{
> + u64 rmp_sz, rmp_base, rmp_end;
> +
> + rdmsrl(MSR_AMD64_RMP_BASE, rmp_base);
> + rdmsrl(MSR_AMD64_RMP_END, rmp_end);
> +
> + if (!(rmp_base & RMP_ADDR_MASK) || !(rmp_end & RMP_ADDR_MASK)) {
> + pr_err("Memory for the RMP table has not been reserved by BIOS\n");
> + return false;
> + }
> +
> + if (rmp_base > rmp_end) {
> + pr_err("RMP configuration not valid: base=%#llx, end=%#llx\n", rmp_base, rmp_end);
> + return false;
> + }
> +
> + rmp_sz = rmp_end - rmp_base + 1;
> +
> + probed_rmp_base = rmp_base;
> + probed_rmp_size = rmp_sz;
> +
> + pr_info("RMP table physical range [0x%016llx - 0x%016llx]\n",
> + rmp_base, rmp_end);
> +
> + return true;
> +}
> +
> static struct rmpentry_raw *__get_rmpentry(unsigned long pfn)
> {
> if (!rmptable)
Powered by blists - more mailing lists