[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241209194320.GCZ1dIWDMPppdXgzxJ@fat_crate.local>
Date: Mon, 9 Dec 2024 20:43:20 +0100
From: Borislav Petkov <bp@...en8.de>
To: Tom Lendacky <thomas.lendacky@....com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Michael Roth <michael.roth@....com>,
Ashish Kalra <ashish.kalra@....com>,
Nikunj A Dadhania <nikunj@....com>,
Neeraj Upadhyay <Neeraj.Upadhyay@....com>
Subject: Re: [PATCH v6 6/8] x86/sev: Treat the contiguous RMP table as a
single RMP segment
On Mon, Dec 02, 2024 at 02:50:51PM -0600, Tom Lendacky wrote:
> static struct rmpentry_raw *get_raw_rmpentry(u64 pfn)
> {
> - if (!rmptable)
> + u64 paddr, rst_index, segment_index;
> + struct rmp_segment_desc *desc;
> +
> + if (!rmp_segment_table)
> return ERR_PTR(-ENODEV);
>
> - if (unlikely(pfn > rmptable_max_pfn))
> + paddr = pfn << PAGE_SHIFT;
> +
> + rst_index = RST_ENTRY_INDEX(paddr);
> + if (unlikely(rst_index >= rst_max_index))
> + return ERR_PTR(-EFAULT);
> + rst_index = array_index_nospec(rst_index, rst_max_index);
I think we should collect the deliberation why we're doing this nospec stuff
from here:
https://lore.kernel.org/r/79be2e29-6487-dd60-9b6f-3daa48a2e93f@amd.com
into a comment around here for future reference.
This is the best example for those: "uff, why did we do it back then"?
questions when we stare at this months, years from now.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists