Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp888123imm; Fri, 14 Sep 2018 07:51:28 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZNRmjSNxU2moKq+DUFvmmntj2wrOp6xTNi/0NfglJij9ro7DX6XCoLrKKVDPR1lxjrt5xc X-Received: by 2002:a63:7e1c:: with SMTP id z28-v6mr12116678pgc.246.1536936688240; Fri, 14 Sep 2018 07:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536936688; cv=none; d=google.com; s=arc-20160816; b=JuVXfUuPz81azc2oAgC/rcMxmknf5Q56OctxMps5tyN281JPDiuk8H89RMih9LRjdb QPCaE6rBWfNTLdrIeuPuFlvdaRENRm5yVo0j24bVbfC5xkeSXTnub5s8l4RScQqHUJbl JjAtqMZo3s4GbrVOa3XctJltH5JuoqQMKBVYuNJs/HVjNDsY7JKNqCK32Hyr4NrALVVI TBpou/KckNuBV990dZcsn8eddCYt53bcEVWGxX5OXHaMA6nN/gem4Ll8k3b8o4uPymAU UopiCp0LTx2XE7KKFh8fGhRSpUXwWmLwaohFSzExG22gyQYAxPtMv+V/IGSEEuC/6d2h ogsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt :openpgp:from:references:cc:to:subject:dkim-signature; bh=mkvey89vMKLRLKD1o0qBldmSJOUtqtZZmCxqemvbsJE=; b=sXly/ByB2nN+JVsw0FHloQqzJ5qc5j0hvOAx6Eb6EPb3DhpVDmY0EYyziwtsErJmyE I/IveFH9+32F2IUsqX+OoboN5Et/y2LaHWhwYyKkU4DM9/Wnv/EyulGnIkLkezdLqnZC bfoJ9kbIxv+3VGGN3t7H9KyS2b1bbUvtrFsbzRD2F7+ldxiQI0ziiYUwhTlDh5qxRLv3 Umjvww5joYSsfWSl2YXGk+qjOI6d9aWjhfUx3ZmvfbauI5jqTIAbm124aKgmCs/+1Hfb ybpy9RnFHfWMM5of4JrIZ6FbkE3BmjL5QVNziSG1m7UGZK5s/iomNGc9v29xxSQp8OXr yMVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=JWdW99WC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x16-v6si6974015pgf.311.2018.09.14.07.51.10; Fri, 14 Sep 2018 07:51:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=JWdW99WC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728271AbeINUF2 (ORCPT + 99 others); Fri, 14 Sep 2018 16:05:28 -0400 Received: from mail-by2nam03on0053.outbound.protection.outlook.com ([104.47.42.53]:13715 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726900AbeINUF1 (ORCPT ); Fri, 14 Sep 2018 16:05:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mkvey89vMKLRLKD1o0qBldmSJOUtqtZZmCxqemvbsJE=; b=JWdW99WComr4TTnqmmSDJp8GqlZNlVhopACPWCvx06rR6/41+OM0QOD/80DBEn5zT6xB7bfo8hHozeY1Cjstn7vGB98sDiJxem7hi12VMVBYi5WXa6FBjE4QMvxwy1LCBuMlemntUO48VoYUdqt90cwJAE4bBqhFsbmit2TsXeQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from [10.236.18.82] (165.204.77.1) by SN1PR12MB0176.namprd12.prod.outlook.com (2a01:111:e400:5144::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.18; Fri, 14 Sep 2018 14:50:15 +0000 Subject: Re: [PATCH v8 1/2] x86/mm: add .bss..decrypted section to hold shared variables To: Borislav Petkov , Thomas Gleixner , Brijesh Singh Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, "H. Peter Anvin" , Paolo Bonzini , Sean Christopherson , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= References: <1536875471-17391-1-git-send-email-brijesh.singh@amd.com> <1536875471-17391-2-git-send-email-brijesh.singh@amd.com> <20180914071056.GA4747@zn.tnic> <3517a0db-2f64-6d09-7100-dced40561d08@amd.com> <20180914141216.GA29898@zn.tnic> From: Tom Lendacky Openpgp: preference=signencrypt Autocrypt: addr=thomas.lendacky@amd.com; prefer-encrypt=mutual; keydata= xsFNBFaNZYkBEADxg5OW/ajpUG7zgnUQPsMqWPjeAxtu4YH3lCUjWWcbUgc2qDGAijsLTFv1 kEbaJdblwYs28z3chM7QkfCGMSM29JWR1fSwPH18WyAA84YtxfPD8bfb1Exwo0CRw1RLRScn 6aJhsZJFLKyVeaPO1eequEsFQurRhLyAfgaH9iazmOVZZmxsGiNRJkQv4YnM2rZYi+4vWnxN 1ebHf4S1puN0xzQsULhG3rUyV2uIsqBFtlxZ8/r9MwOJ2mvyTXHzHdJBViOalZAUo7VFt3Fb aNkR5OR65eTL0ViQiRgFfPDBgkFCSlaxZvc7qSOcrhol160bK87qn0SbYLf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ykSmG8UHJ6FJ6cI2myru6uwzbOu n8DkNLspmZppoTpwzPCY/6iljBLUBzDDRD8rzEavva2IhzINkrAvNSW6VpBMSpUBgsEIKxrp AFS1ax5uXmwYGyFzOWy034Zz5fWi260qiFplzKCij8t7sCgzOXwEbIt76L1basrRMY7urJm8 4VM6MeG2mfa92FfrMeL0pnD5ONg1FIuleGlvvKdQdFnE4AlwGcKid5GUD+vNNj/pbZyUpe4r zBFsc21/8jXSlR6zJS4mgkNDIIBGiPny3tvKINMZ8VK00mR6INpd+NErd2LxwZ/DQ5ejVyVL 080CbiD55mxxhqkbd5fHSfdhvvXIIYN+nM/RFLwaQGW9g62iFWlqeNRXezkERDV5ahFqZMP4 YDdodn0nRVZYu2kaXfOclKPcH58HlrRb8pKTE3t/TNKGY3SmKoznH0QtM27TWeZ9R9RgTYiV zSNqP+QUNp6BotWI Message-ID: <07c76a33-7883-f407-5b1c-b6de7dda37b1@amd.com> Date: Fri, 14 Sep 2018 09:50:12 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180914141216.GA29898@zn.tnic> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR12CA0070.namprd12.prod.outlook.com (2603:10b6:3:103::32) To SN1PR12MB0176.namprd12.prod.outlook.com (2a01:111:e400:5144::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b1a1df3-39ff-42fa-34f5-08d61a51624e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:SN1PR12MB0176; X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0176;3:ee3znd6IMbiJxDQUr/NI3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RCMFOReAoRTrxoYA/FOqB3Mrl/ndoISu08d9FkDA+aW06nvLEpKJ+RcqnLjtSXfNsFWq8O9rfuQiZOSjCLbku/fi+cNF2Tc4fQjrLo51o+sOy8MK9Ky3okwXf8i40W2SvwU7NDmdKRpCoTcbd3WDzcmlkSZueXHH5qDkwgkNHZa1FjtAVjfJBlpEpjAoAe7NcPqwZJicLcZycQv/jpTmwBQgqmOvGYYU0xPdcap3JV8OIa5GAk3r1Dda8hTeeES1COjl9sYxaSD82nZhGRzY7eMC4vacvvY7K39GlmnXEbq9DjiMF/VO7fZHHcQYXxR7p9LgvpiJ;4:2+QYcngoTTtI5nzVmzttNoO/depGaoCot9KXbdKfeivDd6/7/QXuAFSDcWKBeVo0IziWTPt1vutUgtqItH4wDK6tH0QdYv9XniL5svZ46VLYbhzNasTnojvBRj/SYDhNTlZwWyvfM5gV5ZmkOumFrBAv+GuyFlPtinR/7rk5A+1hSEARCAlNXaTEWSbeX6pkuZOoN+3MLixQYSxurw1lQ4bg5ydU27tYDqbmqK+6Ls488fk5zJlxrfVZ128yrC3C4HdYMFRZxQfquUknr6Jadw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699050);SRVR:SN1PR12MB0176;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0176; X-Forefront-PRVS: 07954CC105 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(396003)(346002)(136003)(39860400002)(366004)(376002)(199004)(189003)(58126008)(446003)(72206003)(229853002)(386003)(52116002)(65806001)(2616005)(50466002)(23676004)(956004)(53546011)(7736002)(11346002)(97736004)(77096007)(575784001)(6116002)(2906002)(14444005)(31686004)(8936002)(186003)(86362001)(76176011)(486006)(54906003)(64126003)(52146003)(4326008)(81166006)(8676002)(16576012)(6246003)(316002)(6486002)(6666003)(81156014)(36756003)(31696002)(26005)(5660300001)(93886005)(105586002)(476003)(110136005)(2486003)(47776003)(2870700001)(53936002)(65956001)(106356001)(16526019)(305945005)(25786009)(6636002)(68736007)(66066001)(65826007)(478600001)(3846002)(142923001)(101420200001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR12MB0176;H:[10.236.18.82];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjEyTUIwMTc2OzIzOmdCOE90ai8raGp3Y01sd3ByNXpTNzNxSHlO?= =?utf-8?B?amFJTFdHUSt4aTk2a1QveTNISnhKNUp0cDNFTlZZSkJDcWdpQ1ViQUx2NG94?= =?utf-8?B?a2ZzL1ZWTkx0c2Vkc255N0FWTXNlMmR4NXYyMWx5MTNzU01LOWJ3TFZ6M0pQ?= =?utf-8?B?S1dlbWRZQmJSY0VoSDhTcVJPUndNWklVb056b0J4dFI0SE4vdGNkSE42Yzcw?= =?utf-8?B?UzJKRisxcVZsZ2lmNEdTUmNBNW91TnhRRlpheENPTkx1ejJtcFZ6TFB4UG8x?= =?utf-8?B?NTlFdHFJL0ZvemRhelc0MFFKUktMK1pRbi9oa096dkdkYnRFbUhJL3UwRXpW?= =?utf-8?B?QjltUzRlYmFzSjdLNklXazFRU1pXaUVXWFBoMUhUNHkxMzhrdGlpVmRJUi8w?= =?utf-8?B?dXZCU2NiQWVwVytQZklVUEhXaXdVakRObzJNR0Rqa1lNdFpHQkcxTzJqVWxz?= =?utf-8?B?WStnMHMvb2lIR1RkckFjQWk3TFU5bWVtTTlqajl4Q1ZGTFRtZW9HaW5TcnlD?=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+isrbCltQAIL0QjhkDbPKM5W9apy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0176;20:T7i9SDGZlx6Cv9EGQNthb3lbCF4QIbyyWUCk61HE5pvh/McpKs57qe9X/pBXmjZVusl4YA7vG1x59zhJiPWceR1PPi4lk6Nh2S7DwZZmYFNxQYeUWAGGzaJUOP5/44Rim1/McobdZON4QKcugy1h7zFWTqBRiJDOyeaOJ4cRlZIiE1DUGRkjg2n5Z392ldL0VU1+qvRU9JFxYTPOBtxtUKwMa/SpVZwleNI/6UYb84PVWiArIOg5VLRzMC4/Ah3Z X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2018 14:50:15.6750 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b1a1df3-39ff-42fa-34f5-08d61a51624e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0176 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/14/2018 09:12 AM, Borislav Petkov wrote: > On Fri, Sep 14, 2018 at 02:17:05PM +0200, Thomas Gleixner wrote: >>> The sme_encrypt_kernel() does not have access to pmd (after pointer >>> fixup is applied). You can extend the sme_encrypt_kernel() to pass an >>> additional arguments but then we start getting in include hell. The pmd >>> is defined as "pmdval_t". If we extend the sme_encrypt_kernel() thenĀ  >>> asm/mem_encrypt.h need to include the header file which defines >>> "pmdval_t". Adding the 'asm/pgtable_type.h' was causing all kind of >>> compilation errors. I didn't spend much time on it. IMO, we really don't >>> need to go in this path unless we see some value from doing this. >> >> Keep it here then. > > *For what is worth*, a simple forward declaration works. I've taken the > 64-bit forward declaration of pmdval_t as SME is 64-bit only anyway. Just my 2 cents, but I'd prefer it to be in head64.c. This is where the future pagetable entries are all updated to set the encryption mask by applying sme_get_me_mask() to load_delta. So, to me, it makes sense to keep the clearing of the encryption mask for the bss_decrypted section here. Thanks, Tom > > The below diff ontop passes the mandatory all*config smoke builds: > > --- > arch/x86/include/asm/mem_encrypt.h | 6 ++++-- > arch/x86/kernel/head64.c | 18 +----------------- > arch/x86/mm/mem_encrypt_identity.c | 18 +++++++++++++++++- > 3 files changed, 22 insertions(+), 20 deletions(-) > > diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h > index 616f8e637bc3..67c0e6cfdfb3 100644 > --- a/arch/x86/include/asm/mem_encrypt.h > +++ b/arch/x86/include/asm/mem_encrypt.h > @@ -19,6 +19,8 @@ > > #include > > +typedef unsigned long pmdval_t; > + > #ifdef CONFIG_AMD_MEM_ENCRYPT > > extern u64 sme_me_mask; > @@ -40,7 +42,7 @@ void __init sme_unmap_bootdata(char *real_mode_data); > > void __init sme_early_init(void); > > -void __init sme_encrypt_kernel(struct boot_params *bp); > +void __init sme_encrypt_kernel(struct boot_params *bp, pmdval_t *pmd); > void __init sme_enable(struct boot_params *bp); > > int __init early_set_memory_decrypted(unsigned long vaddr, unsigned long size); > @@ -69,7 +71,7 @@ static inline void __init sme_unmap_bootdata(char *real_mode_data) { } > > static inline void __init sme_early_init(void) { } > > -static inline void __init sme_encrypt_kernel(struct boot_params *bp) { } > +static inline void __init sme_encrypt_kernel(struct boot_params *bp, pmdval_t *pmd) { } > static inline void __init sme_enable(struct boot_params *bp) { } > > static inline bool sme_active(void) { return false; } > diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c > index c16af27eb23f..6f8e9b534e80 100644 > --- a/arch/x86/kernel/head64.c > +++ b/arch/x86/kernel/head64.c > @@ -112,7 +112,6 @@ static bool __head check_la57_support(unsigned long physaddr) > unsigned long __head __startup_64(unsigned long physaddr, > struct boot_params *bp) > { > - unsigned long vaddr, vaddr_end; > unsigned long load_delta, *p; > unsigned long pgtable_flags; > pgdval_t *pgd; > @@ -233,22 +232,7 @@ unsigned long __head __startup_64(unsigned long physaddr, > *fixup_long(&phys_base, physaddr) += load_delta - sme_get_me_mask(); > > /* Encrypt the kernel and related (if SME is active) */ > - sme_encrypt_kernel(bp); > - > - /* > - * Clear the memory encryption mask from the .bss..decrypted section. > - * The bss section will be memset to zero later in the initialization so > - * there is no need to zero it after changing the memory encryption > - * attribute. > - */ > - if (mem_encrypt_active()) { > - vaddr = (unsigned long)__start_bss_decrypted; > - vaddr_end = (unsigned long)__end_bss_decrypted; > - for (; vaddr < vaddr_end; vaddr += PMD_SIZE) { > - i = pmd_index(vaddr); > - pmd[i] -= sme_get_me_mask(); > - } > - } > + sme_encrypt_kernel(bp, pmd); > > /* > * Return the SME encryption mask (if SME is active) to be used as a > diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c > index a19ef1a416ff..9dbc145d10f8 100644 > --- a/arch/x86/mm/mem_encrypt_identity.c > +++ b/arch/x86/mm/mem_encrypt_identity.c > @@ -267,15 +267,17 @@ static unsigned long __init sme_pgtable_calc(unsigned long len) > return entries + tables; > } > > -void __init sme_encrypt_kernel(struct boot_params *bp) > +void __init sme_encrypt_kernel(struct boot_params *bp, pmdval_t *pmd) > { > unsigned long workarea_start, workarea_end, workarea_len; > unsigned long execute_start, execute_end, execute_len; > unsigned long kernel_start, kernel_end, kernel_len; > unsigned long initrd_start, initrd_end, initrd_len; > struct sme_populate_pgd_data ppd; > + unsigned long vaddr, vaddr_end; > unsigned long pgtable_area_len; > unsigned long decrypted_base; > + int i; > > if (!sme_active()) > return; > @@ -467,6 +469,20 @@ void __init sme_encrypt_kernel(struct boot_params *bp) > > /* Flush the TLB - no globals so cr3 is enough */ > native_write_cr3(__native_read_cr3()); > + > + /* > + * Clear the memory encryption mask from the .bss..decrypted section. > + * The bss section will be memset to zero later in the initialization so > + * there is no need to zero it after changing the memory encryption > + * attribute. > + */ > + vaddr = (unsigned long)__start_bss_decrypted; > + vaddr_end = (unsigned long)__end_bss_decrypted; > + > + for (; vaddr < vaddr_end; vaddr += PMD_SIZE) { > + i = pmd_index(vaddr); > + pmd[i] -= sme_get_me_mask(); > + } > } > > void __init sme_enable(struct boot_params *bp) >