From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751911AbdJYRfB (ORCPT ); Wed, 25 Oct 2017 13:35:01 -0400 Received: from mga14.intel.com ([192.55.52.115]:24639 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751725AbdJYRe7 (ORCPT ); Wed, 25 Oct 2017 13:34:59 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,432,1503385200"; d="scan'208";a="164905000" Subject: Re: [tip:x86/mm] x86/mm: Add support for early encryption/decryption of memory To: arnd@arndb.de, aryabinin@virtuozzo.com, dvyukov@google.com, mingo@kernel.org, pbonzini@redhat.com, peterz@infradead.org, torvalds@linux-foundation.org, toshi.kani@hpe.com, matt@codeblueprint.co.uk, corbet@lwn.net, hpa@zytor.com, konrad.wilk@oracle.com, dyoung@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, riel@redhat.com, bp@suse.de, lwoodman@redhat.com, glider@google.com, luto@kernel.org, mst@redhat.com, brijesh.singh@amd.com, thomas.lendacky@amd.com, rkrcmar@redhat.com, bp@alien8.de, linux-tip-commits@vger.kernel.org References: From: Dave Hansen Message-ID: <8a3b1467-a802-1a34-2f8d-7e4d0098cee6@intel.com> Date: Wed, 25 Oct 2017 10:34:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/18/2017 03:51 AM, tip-bot for Tom Lendacky wrote: > +/* > + * This routine does not change the underlying encryption setting of the > + * page(s) that map this memory. It assumes that eventually the memory is > + * meant to be accessed as either encrypted or decrypted but the contents > + * are currently not in the desired state. > + * > + * This routine follows the steps outlined in the AMD64 Architecture > + * Programmer's Manual Volume 2, Section 7.10.8 Encrypt-in-Place. > + */ > +static void __init __sme_early_enc_dec(resource_size_t paddr, > + unsigned long size, bool enc) > +{ > + void *src, *dst; > + size_t len; > + > + if (!sme_me_mask) > + return; > + > + local_flush_tlb(); > + wbinvd(); What is this TLB flush for? WBINVD is mentioned in "Volume 2, Section 7.10.8", but TLB flushes are not. Is it OK that this does not flush global pages?