mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Mike Rapoport <rppt@kernel.org>, Borislav Petkov <bp@alien8.de>
Cc: 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: Tue, 19 Apr 2022 11:57:47 -0700	[thread overview]
Message-ID: <3f27999a-35bc-3499-2bf8-afd0e8666068@intel.com> (raw)
In-Reply-To: <20220419143545.30295-1-rppt@kernel.org>

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;
}

  reply	other threads:[~2022-04-19 18:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 14:35 Mike Rapoport
2022-04-19 18:57 ` Dave Hansen [this message]
2022-04-20  7:17   ` Mike Rapoport
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=3f27999a-35bc-3499-2bf8-afd0e8666068@intel.com \
    --to=dave.hansen@intel.com \
    --cc=bp@alien8.de \
    --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@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®