From patchwork Tue Oct 20 06:18:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 11845763 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0250416C0 for ; Tue, 20 Oct 2020 06:19:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A77D3222E8 for ; Tue, 20 Oct 2020 06:19:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="uRxBxRP0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A77D3222E8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C0A506B0071; Tue, 20 Oct 2020 02:19:11 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B95C76B0074; Tue, 20 Oct 2020 02:19:11 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A14626B0078; Tue, 20 Oct 2020 02:19:11 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0033.hostedemail.com [216.40.44.33]) by kanga.kvack.org (Postfix) with ESMTP id 62D526B0071 for ; Tue, 20 Oct 2020 02:19:11 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 13A9A180AD807 for ; Tue, 20 Oct 2020 06:19:11 +0000 (UTC) X-FDA: 77391301302.16.coal68_42006652723d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id E4FA7101D65F4 for ; Tue, 20 Oct 2020 06:19:10 +0000 (UTC) X-Spam-Summary: 1,0,0,b9cbedd7e78437f8,d41d8cd98f00b204,kirill@shutemov.name,,RULES_HIT:41:355:379:541:960:973:988:989:1260:1311:1314:1345:1359:1431:1437:1515:1535:1541:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2693:2731:2897:3138:3139:3140:3141:3142:3352:3865:3867:3870:3871:4250:4321:5007:6119:6120:6261:6653:6742:7901:8603:9036:10004:11026:11658:11914:12043:12048:12297:12438:12517:12519:12555:12895:13069:13255:13311:13357:13894:14096:14181:14384:14721:21080:21444:21451:21627:30054,0,RBL:209.85.208.194:@shutemov.name:.lbl8.mailshell.net-62.8.84.100 66.201.201.201;04ygoggdig3kii7y49uamfwbrcqk4ophnpaaxsfrqwykobmdjpezfb1wm9wftyj.1rapr7wid3hpecjtp3uekn1seub6he88eiybw3fzhcncjptwfnbmqzr5jsghf6q.e-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: coal68_42006652723d X-Filterd-Recvd-Size: 5165 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Tue, 20 Oct 2020 06:19:10 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id a5so725954ljj.11 for ; Mon, 19 Oct 2020 23:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vaud5LDoCMN7VYhH4oLnzKJ275PDylYsQEFgwO7dM1A=; b=uRxBxRP022DKNAknogcT1hVjFyXYSFc3HjPH/yHkhWIPPZ5/a2m0cy+pO6EHn8x+pC cQccGGl77VGFHrSaBgF+dCQv80xDnzvt3ORVquoJbp2plCK9KYKacYaCn7Neqkm4B/oD Mk6URhr1Qqhh+mYOKukSQtQDPQXG6MeJ6XHh1md445K+c2dAh4xTMEIdBd8bBqtmOkoO N8KVTNaKjDwZsA2HgAIOOPvnPvR33QIlN1BUfsiBOvcOUnrulKXPrMyZnAwoH6v9AQrT /jXZ+Yj6YnnKzR2FB/soZsY6Ey6nxbP1P2AfmLn38McxO4SUWVgzzZmVm2UilsP0hTxY 2sjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vaud5LDoCMN7VYhH4oLnzKJ275PDylYsQEFgwO7dM1A=; b=DTFa2RUqZgOxNgKy+3K2SlZZFHtT0xLX5T2XzCIihcb9OtP3lERdJZeaBqtXYi2I9k 2C1PFvIoVEg1y7Tpos6/cQP3mrRtf71uVQ6gu9757qg1YTos2cr/YLtqceKb6CS1E0Ku iWthtvCGpjfWEejNJTvQNNNV2LdH73cttNRBy2ZanYFIvY2NEIbXRxuUJ9laRQDdi3gs iKzyh7XoGiDR8IUikpdRTOcQ31FbnSGcYBMY/PGkOj4cJ0v7lUZgpdaIr+Qxz2UBMOfF TGrQNAR+Tq1EksJLnSiQ1Bu0TGgkg0Ug+QEz56CGOABfc63hJniO9dakLRN3N5153jHX oJkg== X-Gm-Message-State: AOAM530PxSFmj8rGNlUrjEHBSOkXkPJn5UZQ5+uRURakviSZ+5Gm8OfZ RO25LC++0/yUi6C6OCI2KQ+97w== X-Google-Smtp-Source: ABdhPJywmvEpa7Ydh3L77EwVrCq7+3fO4YdtEd4vP4JBqRv2DbR3YE4NZhPbQkl4Hp+GW9rY1xZDOQ== X-Received: by 2002:a2e:9f49:: with SMTP id v9mr512286ljk.369.1603174749329; Mon, 19 Oct 2020 23:19:09 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id k19sm194793ljg.88.2020.10.19.23.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2020 23:19:07 -0700 (PDT) From: "Kirill A. Shutemov" X-Google-Original-From: "Kirill A. Shutemov" Received: by box.localdomain (Postfix, from userid 1000) id E7995102F66; Tue, 20 Oct 2020 09:19:01 +0300 (+03) To: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel Cc: David Rientjes , Andrea Arcangeli , Kees Cook , Will Drewry , "Edgecombe, Rick P" , "Kleen, Andi" , Liran Alon , Mike Rapoport , x86@kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [RFCv2 07/16] x86/realmode: Share trampoline area if KVM memory protection enabled Date: Tue, 20 Oct 2020 09:18:50 +0300 Message-Id: <20201020061859.18385-8-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201020061859.18385-1-kirill.shutemov@linux.intel.com> References: <20201020061859.18385-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: If KVM memory protection is active, the trampoline area will need to be in shared memory. Signed-off-by: Kirill A. Shutemov --- arch/x86/realmode/init.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c index 1ed1208931e0..7392940a7f96 100644 --- a/arch/x86/realmode/init.c +++ b/arch/x86/realmode/init.c @@ -9,6 +9,7 @@ #include #include #include +#include struct real_mode_header *real_mode_header; u32 *trampoline_cr4_features; @@ -55,11 +56,11 @@ static void __init setup_real_mode(void) base = (unsigned char *)real_mode_header; /* - * If SME is active, the trampoline area will need to be in - * decrypted memory in order to bring up other processors + * If SME or KVM memory protection is active, the trampoline area will + * need to be in decrypted memory in order to bring up other processors * successfully. This is not needed for SEV. */ - if (sme_active()) + if (sme_active() || kvm_mem_protected()) set_memory_decrypted((unsigned long)base, size >> PAGE_SHIFT); memcpy(base, real_mode_blob, size);