Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp154232ybl; Tue, 7 Jan 2020 16:08:22 -0800 (PST) X-Google-Smtp-Source: APXvYqyfAahhOjC0wOV90pjAAtKVyN/pjcdzRWU0z3TBoBIxYECgRCYypY8dGk5b2U80lEOBSY99 X-Received: by 2002:aca:1c1a:: with SMTP id c26mr909278oic.75.1578442102808; Tue, 07 Jan 2020 16:08:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578442102; cv=none; d=google.com; s=arc-20160816; b=i9fILLEBwEz33lUCRaHmdNDqXcXOVUv1Ebkv9IXxBUX0nDN2lMcyrOtOUZDCm6+VrQ WWUTp8ud1s4Uc/dgM6gElt3RX67y1oADnSVwmM3/ks00chBMAPgHxznJJ63KPl0qQbak RMrC99Bgv9fkMX34R6qC8iyllozABq94HHfYJL6mXAebUfCZaboR/A0g/fikdG8kNbcM sq/BXmCXVrE/oaLDd02B4539ALJHgFXIyuQLOP/LBqTBPt4U5Dl3dydnHCHFWz90gb1P RKv7rPAySCuixVTSyq3U7KctW3UsBDxVs4vO6+AAljLQXX2aBAE5AIT1eCgeRKeRBAtD f1Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=eC07yoi2CCtvDis66Klb1GBuLd+HCqvjfMfXTiKES3k=; b=YJqpsuOdMjzPuAbEJ7Uylt3qWAQqj5F9Sabrfmsv1qECWh/DHhihbFv/FUwor6e5Du sikY1SDFSUEdBrbARdBzWNK8XaY68EEdZfAVr72Kd6NJwQyvGr+lLCFbyThehWV5doWB 6XNSZlSc72akIuoV0qxHlwzKdxTOJBtWJOjXDNGsRFvzvoD1V5n2EPtzgfW9CfdClZop p2jFmfldSY2odHKJEoIBMmmw9ZPv2ctHgWOfD74gmVSF8ysxysypxPdIfewMA4T4wlm0 jR4iPTUrbm4bue50I4q90BAw6iEXp79ds9wOjV1PpzQM2yBQAKcCujcNdNKeB5Mc4eeZ JePA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14si794276otp.210.2020.01.07.16.08.10; Tue, 07 Jan 2020 16:08:22 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727142AbgAHAEO (ORCPT + 99 others); Tue, 7 Jan 2020 19:04:14 -0500 Received: from mga04.intel.com ([192.55.52.120]:19712 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgAHAEO (ORCPT ); Tue, 7 Jan 2020 19:04:14 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jan 2020 16:04:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,407,1571727600"; d="scan'208";a="211354742" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by orsmga007.jf.intel.com with ESMTP; 07 Jan 2020 16:04:12 -0800 Date: Tue, 7 Jan 2020 16:04:12 -0800 From: Sean Christopherson To: Tom Lendacky Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Brijesh Singh Subject: Re: [PATCH v2] KVM: SVM: Override default MMIO mask if memory encryption is enabled Message-ID: <20200108000412.GE16987@linux.intel.com> References: <20200106224931.GB12879@linux.intel.com> <20200106233846.GC12879@linux.intel.com> <20200107222813.GB16987@linux.intel.com> <298352c6-7670-2929-9621-1124775bfaed@amd.com> <20200107233102.GC16987@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 07, 2020 at 05:51:51PM -0600, Tom Lendacky wrote: > On 1/7/20 5:31 PM, Sean Christopherson wrote: > > AIUI, using phys_bits=48, then the standard scenario is Cbit=47 and some > > additional bits 46:M are reserved. Applying that logic to phys_bits=52, > > then Cbit=51 and bits 50:M are reserved, so there's a collision but it's > > There's no requirement that the C-bit correspond to phys_bits. So, for > example, you can have C-bit=51 and phys_bits=48 and so 47:M are reserved. But then using blindly using x86_phys_bits would break if the PA bits aren't reduced, e.g. C-bit=47 and phys_bits=47. AFAICT, there's no requirement that there be reduced PA bits when there is a C-bit. I'm guessing there aren't plans to ship such CPUs, but I don't see anything in the APM to prevent such a scenario. Maybe the least painful approach would be to go with a version of this patch and add a check that there are indeeded reserved/reduced bits? Probably with a WARN_ON_ONCE if the check fails.