[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yl+zdNP/5iHtPolv@kernel.org>
Date: Wed, 20 Apr 2022 10:17:08 +0300
From: Mike Rapoport <rppt@...nel.org>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Borislav Petkov <bp@...en8.de>, Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Mike Rapoport <rppt@...ux.ibm.com>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/mm/ptdump: display page encryption state
On Tue, Apr 19, 2022 at 11:57:47AM -0700, Dave Hansen wrote:
> On 4/19/22 07:35, Mike Rapoport wrote:
> > When memory encryption is enabled, for instance in SEV guest, it is useful
> > to see what memory ranges are mapped as encrypted in the kernel page tables
> > and what ranges are left plain.
> >
> > Add printing of 'ENC' for the encrypted ranges to the page table dumps.
> >
> > Signed-off-by: Mike Rapoport <rppt@...ux.ibm.com>
> > ---
> > arch/x86/mm/dump_pagetables.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
> > index e1b599ecbbc2..187dd17b8780 100644
> > --- a/arch/x86/mm/dump_pagetables.c
> > +++ b/arch/x86/mm/dump_pagetables.c
> > @@ -201,6 +201,10 @@ static void printk_prot(struct seq_file *m, pgprotval_t pr, int level, bool dmsg
> > pt_dump_cont_printf(m, dmsg, "PCD ");
> > else
> > pt_dump_cont_printf(m, dmsg, " ");
> > + if (pr & _PAGE_ENC)
> > + pt_dump_cont_printf(m, dmsg, "ENC ");
> > + else
> > + pt_dump_cont_printf(m, dmsg, " ");
>
> _PAGE_ENC is AMD-specific. Could we do this with a new generic "cc_"
> function, maybe cc_is_enc()?
>
> Something like this would (I think) work for both SEV and TDX:
>
> bool cc_is_enc(u64 prot)
> {
> return cc_mkdec(prot) != prot;
> }
It works for SEV. I can repost with this and you'll confirm it works on
TDX?
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists