All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/mm/ptdump: display page encryption state
Date: Wed, 20 Apr 2022 10:17:08 +0300	[thread overview]
Message-ID: <Yl+zdNP/5iHtPolv@kernel.org> (raw)
In-Reply-To: <3f27999a-35bc-3499-2bf8-afd0e8666068@intel.com>

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@linux.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.

  reply	other threads:[~2022-04-20  7:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 14:35 [PATCH] x86/mm/ptdump: display page encryption state Mike Rapoport
2022-04-19 18:57 ` Dave Hansen
2022-04-20  7:17   ` Mike Rapoport [this message]
2022-04-20 14:30     ` Dave Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yl+zdNP/5iHtPolv@kernel.org \
    --to=rppt@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=rppt@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.