Received: by 10.223.185.116 with SMTP id b49csp357470wrg; Tue, 13 Feb 2018 23:31:18 -0800 (PST) X-Google-Smtp-Source: AH8x225kjOLHEzprYGqsMHHFtp4v+uVfqhcp0P/shN/Wr9+N6rl6h2//SLU9SXBe4LAkcjFfEbCB X-Received: by 10.101.72.198 with SMTP id o6mr3112532pgs.279.1518593478674; Tue, 13 Feb 2018 23:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518593478; cv=none; d=google.com; s=arc-20160816; b=lE31OkTASnX/eAc5Do5TO5kiOJk5tPcZzj+7lNrcxXf1ZAK2pBuf+du/oDXU235bpK 4UAsZjDROpAm2TBWA5ktW42JUx3SDO7D0cWHlZ6W9E61jTQbDrbjb728l8fZzx1SUoKX 0bmhlSvijkP2JvCl0t0iGQFBgEFwk0PzDhZfAYm8C5Ku5IX3u7eyi304sCvQSaUki1cJ r9sZ4OsT2m1INhSZvX4Pwmj0U9gB7KI5K3fzAuT4/STJU1LumXz6cSLJKWYj/PBLjNCN 9pT72mas+ZbZO0ksGYuEPfE6nwP//G0rKUKgfab3xMAazigLVIOSZnwYY0w0bR9cuzJ/ 0r8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=dIuKLmKf4fEZx5qk7vhmgLtjAGoghL9TriQeB72QUf8=; b=uHKcvFPoRgBbDwlJqNiuaCV5NDWg7iQQRw/3aQXrGXd3tgW13RIV40NyKuHpnmVNNi /j9elrTjkUmUpGlsYR3oB3gnJVEIV+n/YZLX2/cya8L9haOYOyk9CNQJANVDrubMO1XE g2lbPVz+lMpMfQgFY+/oKAo979qp3+mHNsr2Ie6s27TsaP/UlQSQ2yOtygN6JNwDJqof eig3V6Ffn83I5Ks+zqN4a5IE+3T+yrtBKE/j41XTXKNKCAVcT06BJxd/qvSC9rq5BCSh jcUo0HRylEpYJA7aMPXvu/F2uWsUk/3uPinzau7AOiP0zGTTUntozPNTMxW1PoK5Skl+ euPQ== ARC-Authentication-Results: i=1; mx.google.com; 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 l8si544641pgq.35.2018.02.13.23.31.04; Tue, 13 Feb 2018 23:31:18 -0800 (PST) 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; 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 S1754539AbeBNHaY (ORCPT + 99 others); Wed, 14 Feb 2018 02:30:24 -0500 Received: from mga18.intel.com ([134.134.136.126]:18211 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754489AbeBNHaX (ORCPT ); Wed, 14 Feb 2018 02:30:23 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2018 23:30:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,511,1511856000"; d="scan'208";a="174921668" Received: from khuang2-desk.gar.corp.intel.com ([10.254.7.170]) by orsmga004.jf.intel.com with ESMTP; 13 Feb 2018 23:30:20 -0800 Message-ID: <1518593420.13066.11.camel@linux.intel.com> Subject: Re: [PATCH] x86/mm: Decouple dynamic __PHYSICAL_MASK from AMD SME From: Kai Huang To: Tom Lendacky , "Kirill A. Shutemov" Cc: "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Dave Hansen , linux-kernel@vger.kernel.org Date: Wed, 14 Feb 2018 20:30:20 +1300 In-Reply-To: <37cf20a3-653b-1ad7-1e65-6bed935cf325@amd.com> References: <20180208125524.88795-1-kirill.shutemov@linux.intel.com> <5199949d-6795-aa55-888c-7ba8abd406e2@amd.com> <20180214042121.tza3cpvrnpztjeme@node.shutemov.name> <37cf20a3-653b-1ad7-1e65-6bed935cf325@amd.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.6 (3.24.6-1.fc26) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-02-13 at 22:57 -0600, Tom Lendacky wrote: > On 2/13/2018 10:21 PM, Kirill A. Shutemov wrote: > > On Tue, Feb 13, 2018 at 10:10:22PM -0600, Tom Lendacky wrote: > > > On 2/8/2018 6:55 AM, Kirill A. Shutemov wrote: > > > > AMD SME claims one bit from physical address to indicate > > > > whether the > > > > page is encrypted or not. To achieve that we clear out the bit > > > > from > > > > __PHYSICAL_MASK. > > > > > > I was actually working on a suggestion by Linus to use one of the > > > software > > > page table bits to indicate encryption and translate that to the > > > hardware > > > bit when writing the actual page table entry. With that, > > > __PHYSICAL_MASK > > > would go back to its original definition. > > > > But you would need to mask it on reading of pfn from page table > > entry, > > right? I expect it to have more overhead than this one. > > When reading back an entry it would translate the hardware bit > position > back to the software bit position. The suggestion for changing it > was > to make _PAGE_ENC a constant and not tied to the sme_me_mask. > > See https://marc.info/?l=linux-kernel&m=151017622615894&w=2 > > > > > And software bits are valuable. Do we still have a spare one for > > this? > > I was looking at possibly using bit 57 (_PAGE_BIT_SOFTW5). But MK-TME supports upto 15 bits (architectually) as keyID. How is this supposed to work with MK-TME? Thanks, -Kai > > Thanks, > Tom > > >