linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brijesh Singh <brijesh.singh@amd.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Brijesh Singh" <brijesh.singh@amd.com>,
	"Tom Lendacky" <thomas.lendacky@amd.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Borislav Petkov" <bp@suse.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Sean Christopherson" <sean.j.christopherson@intel.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>
Subject: [PATCH v5 0/5] x86: Fix SEV guest regression
Date: Thu,  6 Sep 2018 06:42:57 -0500	[thread overview]
Message-ID: <1536234182-2809-1-git-send-email-brijesh.singh@amd.com> (raw)

The following commit

"
x86/kvmclock: Remove memblock dependency

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=368a540e0232ad446931f5a4e8a5e06f69f21343
"

introduced SEV guest regression.

The guest physical address holding the wall_clock and hv_clock_boot
are shared with the hypervisor must be mapped with C=0 when SEV
is active. To clear the C-bit we use  kernel_physical_mapping_init() to
split the large pages. The above commit moved the kvmclock initialization
very early and kernel_physical_mapping_init() fails to allocate memory
while spliting the large page.

To solve it, we add a special .data..decrypted section, this section can be
used to hold the shared variables. Early boot code maps this section with
C=0. The section is pmd aligned and sized to avoid the need to split the pages.
Caller can use __decrypted attribute to add the variables in .data..decrypted
section. 

Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>

Changes since v4:
 - define few static pages in .data..decrypted which can be used
   for cpus > HVC_BOOT_ARRAY_SIZE when SEV is active.

Changes since v3:
 - commit message improvements (based on Sean's feedback)

Changes since v2:
 - commit message and code comment improvements (based on Boris feedback)
 - move sme_populate_pgd fixes in new patch.
 - drop stable Cc - will submit to stable after patch is upstreamed.

Changes since v1:
 - move the logic to re-arrange mapping in new patch
 - move the definition of __start_data_* in mem_encrypt.h
 - map the workarea buffer as encrypted when SEV is enabled
 - enhance the sme_populate_pgd to update the pte/pmd flags when mapping exist

Brijesh Singh (5):
  x86/mm: Restructure sme_encrypt_kernel()
  x86/mm: fix sme_populate_pgd() to update page flags
  x86/mm: add .data..decrypted section to hold shared variables
  x86/kvm: use __decrypted attribute in shared variables
  x86/kvm: Avoid dynamic allocation of pvclock data when SEV is active

 arch/x86/include/asm/mem_encrypt.h |  10 ++
 arch/x86/kernel/head64.c           |  11 ++
 arch/x86/kernel/kvmclock.c         |  26 ++++-
 arch/x86/kernel/vmlinux.lds.S      |  20 ++++
 arch/x86/mm/init.c                 |   3 +
 arch/x86/mm/mem_encrypt.c          |  10 ++
 arch/x86/mm/mem_encrypt_identity.c | 232 +++++++++++++++++++++++++++----------
 7 files changed, 245 insertions(+), 67 deletions(-)

-- 
2.7.4


             reply	other threads:[~2018-09-06 11:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06 11:42 Brijesh Singh [this message]
2018-09-06 11:42 ` [PATCH v5 1/5] x86/mm: Restructure sme_encrypt_kernel() Brijesh Singh
2018-09-06 11:42 ` [PATCH v5 2/5] x86/mm: fix sme_populate_pgd() to update page flags Brijesh Singh
2018-09-06 11:43 ` [PATCH v5 3/5] x86/mm: add .data..decrypted section to hold shared variables Brijesh Singh
2018-09-06 11:43 ` [PATCH v5 4/5] x86/kvm: use __decrypted attribute in " Brijesh Singh
2018-09-06 11:43 ` [PATCH v5 5/5] x86/kvm: Avoid dynamic allocation of pvclock data when SEV is active Brijesh Singh
2018-09-06 12:24   ` Borislav Petkov
2018-09-06 13:50     ` Sean Christopherson
2018-09-06 14:18       ` Sean Christopherson
2018-09-06 14:44         ` Borislav Petkov
2018-09-06 18:37         ` Brijesh Singh
2018-09-06 18:47           ` Sean Christopherson
2018-09-06 19:24             ` Brijesh Singh
2018-09-06 19:46               ` Brijesh Singh
2018-09-06 19:47               ` Sean Christopherson
2018-09-06 20:20                 ` Brijesh Singh
2018-09-06 20:39                   ` Sean Christopherson
2018-09-06 21:56                     ` Brijesh Singh
2018-09-06 14:43       ` Borislav Petkov
2018-09-06 14:56         ` Sean Christopherson
2018-09-06 15:19           ` Borislav Petkov
2018-09-06 15:54             ` Sean Christopherson
2018-09-06 18:33               ` Borislav Petkov
2018-09-06 18:43                 ` Brijesh Singh
2018-09-06 18:45                 ` Sean Christopherson
2018-09-06 19:03                   ` Borislav Petkov
2018-09-06 17:50       ` Brijesh Singh
2018-09-06 14:07   ` Sean Christopherson
2018-09-06 18:50     ` Brijesh Singh
2018-09-07  3:57       ` Brijesh Singh

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=1536234182-2809-1-git-send-email-brijesh.singh@amd.com \
    --to=brijesh.singh@amd.com \
    --cc=bp@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --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;
as well as URLs for NNTP newsgroup(s).