Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751582AbdGZQr5 (ORCPT ); Wed, 26 Jul 2017 12:47:57 -0400 Received: from mail-by2nam03on0070.outbound.protection.outlook.com ([104.47.42.70]:27136 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751544AbdGZQru (ORCPT ); Wed, 26 Jul 2017 12:47:50 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Subject: Re: [RFC Part1 PATCH v3 03/17] x86/mm: Secure Encrypted Virtualization (SEV) support To: Borislav Petkov , Brijesh Singh Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-efi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andy Lutomirski , Tony Luck , Piotr Luc , Fenghua Yu , Lu Baolu , Reza Arbab , David Howells , Matt Fleming , "Kirill A . Shutemov" , Laura Abbott , Ard Biesheuvel , Andrew Morton , Eric Biederman , Benjamin Herrenschmidt , Paul Mackerras , Konrad Rzeszutek Wilk , Jonathan Corbet , Dave Airlie , Kees Cook , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Arnd Bergmann , Tejun Heo , Christoph Lameter References: <20170724190757.11278-1-brijesh.singh@amd.com> <20170724190757.11278-4-brijesh.singh@amd.com> <20170726042840.GB30702@nazgul.tnic> From: Tom Lendacky Message-ID: Date: Wed, 26 Jul 2017 11:47:32 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170726042840.GB30702@nazgul.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: CY4PR04CA0038.namprd04.prod.outlook.com (10.172.133.24) To MWHPR12MB1152.namprd12.prod.outlook.com (10.169.204.16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bcf66b7b-8d25-4644-45ef-08d4d4460a82 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:MWHPR12MB1152; X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1152;3:csjI/q+IM78tnDako5QMFJQ28fzj2NxGD7glKk9q+wCmVSRTiopAD2jkr9xnlafP3fMo4OEKgIRBG4/hZxtHexofsReHrVVCdt42PsrCN1EjEaTEm5L0aotIQcYzHbfWeLtP+HiecpA3JexkmU2WSM+HuMD9+07acDwgNZJrj0XOJ1V+4+O/ZWTSgbx5+1QPsH2o64jsMXfacqdIihobe3o64WTmRrjUzwoahd7UHuutfJ9wjCxi9KywqYVVnXyI/C2NvyyosrpnvM8XACdkq5qGFtVugQmKhkvJ/hKhqgMDc2wGZ2Tjge8nbvgD62044a2GbtRzQ/ef6JRqvhwVikpCItW7y4ZH3LwQRx2/X5wHuTBefZP8PUMWAWFYlALbl9kzebuQjIjhbKejJTEW6AVPgvmi/eu0OdRVYbPCJFR06WgzQG5J1+tdNrmXF98zSgpreqvJAXJ8DvBet13FDPn0m6j/VsBqBpkBcl1ISCPAQicuj4L9YgBGjKDV34dDrZ34BG1VQlWrU2CWa6wVZcFG1P54NYkEsaM/O39tMabsg8Hj3DlrWsx+v+sgIDowos/aRIdi0sByxBN29QjfE+1CzTYjLB2YnXnBEVOcJx6bjXguT2yXYCIUsOP2AoagzB3+Jdjt/zeaLrUIgEzW9ipL9OUC+Rf9NIIcO0u4sBEIvLLeiM4kXDcxdCFoEwBMXcMEGJI7SP9FAj+Gy4E2GwySpoj0aYqnt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re9Nw0ciiWw4LSHG5KJNhYa8xvFfg1DS2oI+xe2+DNxB/AOrCnUIuUOF502V4fd6WwPMTviUb8dq3hTH9/ln4m3BGcO++AYXyzvH7L6e4cHNtk2asFFcscTqXqX9BisusxTvzkNUyCIIcQvvoq/sW9K/yegtyU+Ld96JqawX5L7EqAa9Z9xX3 X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123564025)(20161123555025)(20161123558100)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:MWHPR12MB1152;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:MWHPR12MB1152; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjEyTUIxMTUyOzQ6S1pkU1ZJZE04Wkk4RWJ3TytDdGxEU0dWaDZt?= =?utf-8?B?MXdtOXdCRXZJc214bllRMGxPTUdjTHVOSW1LV0tXUkZYMVpiSlYzYUI0SVhj?= =?utf-8?B?MnRwMDYweTFVUlRKbTRsdHJqa0J6ZlZTNEZudStOK1ViSGJaaWhnc2JXUVZS?= =?utf-8?B?Q3BHMnNMTjN3Z2cvSzRqejNrSFo5TjIrYnFwWnk0aDE5cVJvUWFwUlFJYU9T?= =?utf-8?B?anJTdEFlQmxLTDJ1TC81dzZNVURSK1NTc0lEemk0VWFvaWk2blpwL2h5TGZX?= =?utf-8?B?cjNwV01kN2dyMVRXVExrYXlUR01KeHlReklSckdXZVZ1cjBEVEJqRU53Vk9k?= =?utf-8?B?cXpD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5RFVQeUZJ?= =?utf-8?B?b2laV3JhN1dKTG5uVjFBS0FhVGV3NmJOQjhtSUVINXFjRTk4alFjTEpXdHhy?= =?utf-8?B?Q2QzbTcwcjdRYnFvQy82eVhVWkVSMEdvMHBKNy9DTlVXTlE5ZnE4a29HcXAr?= =?utf-8?B?aStmUC83MnJKZVlWWlRoTE01OUhaTCs1bkZXY3FTL3ZBeVNkNUJqWGIwQ3F2?= =?utf-8?B?ZTk5VmtvajZadG1wQXhnSUt6SGVUVXJ2MlZOOGVPNnRvTXZLZmZ6Yi8xZjlv?= =?utf-8?B?YVllbCsxMDF5VjRDRTVVY0ZSbStJOE9yKytaQVAyWHZpM0pRWkhZSWdVQUZU?= =?utf-8?B?NEhmM2d2ZEpNakRKb2ZjTTljZXpGM0pQNWVjT2ErYjQ5UXNPUDBwUU5JcXB5?= =?utf-8?Q?3tnSAxFKA3vavqlH7f3?= X-Forefront-PRVS: 038002787A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(6049001)(39860400002)(39400400002)(39850400002)(39840400002)(39410400002)(39450400003)(377454003)(189002)(24454002)(199003)(23676002)(229853002)(53936002)(106356001)(47776003)(3846002)(3260700006)(31696002)(38730400002)(189998001)(105586002)(86362001)(6116002)(101416001)(6246003)(230700001)(478600001)(50986999)(4326008)(54906002)(76176999)(54356999)(7406005)(6666003)(6636002)(42186005)(5660300001)(64126003)(72206003)(65826007)(50466002)(7416002)(68736007)(7736002)(66066001)(65806001)(65956001)(7350300001)(77096006)(6486002)(2950100002)(305945005)(25786009)(81156014)(81166006)(90366009)(36756003)(97736004)(4001350100001)(2906002)(8676002)(33646002)(83506001)(31686004)(53546010)(309714004);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR12MB1152;H:[10.236.64.250];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjEyTUIxMTUyOzIzOlVCOG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Z3REV1hXRjBlelZ1YlV2Mkt3MXVoTUdU?= =?utf-8?B?cTVvWDZNblNwTjlKSHpuRXFvMCt2SFRIclc4cFlPUWJPeUJnUVZLT1h0V0lv?= =?utf-8?Q?8pBhz74?= X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1152;5:I107WuI/NTlIDTgrmJ1C7G3i6Fl21zL6FvCykKu0n5+dt4jGLaMHwJyl2Su6YkcQQma67Gjww2/qWtDMmL52bBluw46pjMCFMqXRDgTjNWV4l5tyzgDynRjI54vug0Qo1WHzM18nUKV6s1gzSr/we7+ZKlUJ8Gfry/W8tX7DAWtywuC1zm3gPIetwOZH339Unl7IrBC31xaa83PdtRh4jBfdoCUow8gg01YkumFVli1Tl4tNpyq/2ZSzGnBHQhut1S19npVK992La3zUENcE5uqIc6dIunvBkDr/RupiYzRejQkFusWTFkDutGsnVRcOMojgG9nLi9NrG3TIQlp9FJQFBZ6fM6SxTp5bn8Y1IogIE5TjgXqmQc7eTxDtpM7nhQuU3bvLwjyAXiMdKakHL4QsYyym9h27tvL1KNJlTp0XwYQP/GvYyk8VQRiVsMtWCq0ZYRdb/Mh7zLCvTTjO42nyJYhhEU5QRVwI2BOlNMUfFZbsoqUQ1BDMOeM/ubHL;24:SDgwSp2HKHzT1b2essMqwUIyQNGP7yLN9vQxB48ShQHQGDxD7LFfzVPurT5xH6lvw91EOwhNFRPtnp3Qz5V7VrGQN7czQ+8FjzVxXoMEOGk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1152;7:7owrNOY577mmbzAWH0mw8UsktXSOggbIRNLtxVoncznNyzJUQVeuVeQVANzOAjlnWx13TK76vdrw7o8ZQg6rTpwgBMC9nM8YZEhBk8gbbt1bJLpSckgoK8NBph6eTvPcI2yL+2pIDawd3bEVJwbKumNUT8lCbef2hxyZZHrhbJGdIL4+D8044y2RRlfXq+SsPc/4/xxnj93aEpsOBWWs5DpYMTzzw82c1JsYK3MCJJOZ0x5z4+XWT2FetwabmpOpD2gSYlNs8lbnHnDUXPkUnt4yrKdCLV+h8wLQZeH6Nff/J1u3Hyj0p6H75ymAJJwJzUISBzLHgQXwl6YdO+5NDWUDSmJtSjUud8DjpZE72XgXpgGm4ln9/H2fpNwYuoMmf6zuR3dzrZcHkin56Qt9UX+VpJMnbNdZGwxNfiuD6wQSlaG1V/rjI7dxdP8duxRXRc+eXj+0zFOkfo5BC32xtgsvBkEQuMMD3bPtzfe9zVFbea1EEFNXjT1LmBmpdqKgX5y8cHRPxCVFMuO3JZZqsjsi4Ue9ztQPgrIJOQD0AZcWsK5z9i5AeSI11D4UIepHhVgPFZ7ntmZS91IQi0JO4NG/AQ+I1hDAHSlVkxnBKQ1xWgtpZ1dN3X/Z8Zq6E5CsfkpciwijyyFhZR609E6k/p4yHTuua850dXl1zESPrpdOslnvjzOXIL2UizPu/3E9TU+xJjA/HdFLwrmJzO1fsZu1iWA01K3jIf4A2miqOS/iwLZPCGaltytuW18L69f+EAUkvFLE64DN8l8XRFyzSGgAIGYnYeCgjvCvEy+RpAw= X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1152;20:NBrn1W+DC2ukB9JVOteljRx01Q1VqoYdFAHiaxogsq4PKnBM2AvZLwB+MbW1yvQ/zMbjDjYSPeWv5XPhkrmhN3tOAmMDeJUjLuyevu2ocn254i8L6jyYgJsZcID4b6mNbqLHeCBovaGd90LcdwuW60tFBbtB3HsdaaT5iqFtpTwqTknv/6vwa22BS6q9L2D2LqXH5V3iMJQBOl0x1EGJFvAyljyaNfywjwRhkWORsT6KUKyK+yANTPcZgEguAT1Y X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2017 16:47:42.5972 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1152 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3120 Lines: 95 On 7/25/2017 11:28 PM, Borislav Petkov wrote: > On Mon, Jul 24, 2017 at 02:07:43PM -0500, Brijesh Singh wrote: >> From: Tom Lendacky >> >> Provide support for Secure Encyrpted Virtualization (SEV). This initial > > Your subject misses a verb and patch subjects should have an active verb > denoting what the patch does. The sentence above is a good example. Yup, will update. > >> support defines a flag that is used by the kernel to determine if it is >> running with SEV active. >> >> Signed-off-by: Tom Lendacky >> Signed-off-by: Brijesh Singh >> --- >> arch/x86/include/asm/mem_encrypt.h | 2 ++ >> arch/x86/mm/mem_encrypt.c | 3 +++ >> include/linux/mem_encrypt.h | 8 +++++++- >> 3 files changed, 12 insertions(+), 1 deletion(-) > > ... > >> diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c >> index 0fbd092..1e4643e 100644 >> --- a/arch/x86/mm/mem_encrypt.c >> +++ b/arch/x86/mm/mem_encrypt.c >> @@ -40,6 +40,9 @@ static char sme_cmdline_off[] __initdata = "off"; >> unsigned long sme_me_mask __section(.data) = 0; >> EXPORT_SYMBOL_GPL(sme_me_mask); >> >> +unsigned int sev_enabled __section(.data) = 0; >> +EXPORT_SYMBOL_GPL(sev_enabled); > > So sev_enabled is a pure bool used only in bool context, not like > sme_me_mask whose value is read too. Which means, you can make the > former static and query it only through accessor functions. If it's made static then the sme_active()/sev_active() inline functions would need to be turned into functions within the mem_encrypt.c file. So there's a trade-off to do that, which is the better one? > >> /* Buffer used for early in-place encryption by BSP, no locking needed */ >> static char sme_early_buffer[PAGE_SIZE] __aligned(PAGE_SIZE); >> >> diff --git a/include/linux/mem_encrypt.h b/include/linux/mem_encrypt.h >> index 1255f09..ea0831a 100644 >> --- a/include/linux/mem_encrypt.h >> +++ b/include/linux/mem_encrypt.h >> @@ -22,12 +22,18 @@ >> #else /* !CONFIG_ARCH_HAS_MEM_ENCRYPT */ >> >> #define sme_me_mask 0UL >> +#define sev_enabled 0 >> >> #endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */ >> >> static inline bool sme_active(void) >> { >> - return !!sme_me_mask; >> + return (sme_me_mask && !sev_enabled); > > You don't need the brackets. Below too. Ok. > >> +} >> + >> +static inline bool sev_active(void) >> +{ >> + return (sme_me_mask && sev_enabled); >> } > > So this is confusing, TBH. SME and SEV are not mutually exclusive and > yet the logic here says so. Why? > > I mean, in the hypervisor context, sme_active() is still true. > > /me is confused. The kernel needs to distinguish between running under SME and running under SEV. SME and SEV are similar but not the same. The trampoline code is a good example. Before paging is activated, SME will access all memory as decrypted, but SEV will access all memory as encrypted. So when APs are being brought up under SME the trampoline area cannot be encrypted, whereas under SEV the trampoline area must be encrypted. Thanks, Tom >