Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1016742pxk; Fri, 18 Sep 2020 01:17:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwg627fPbort53knuuEmToibFlj/w3zMsk9QVsmxgFCZd2QcV1l0PmcawO/C7+DizkjZ5kb X-Received: by 2002:a17:906:6d4c:: with SMTP id a12mr33407909ejt.64.1600417079622; Fri, 18 Sep 2020 01:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600417079; cv=none; d=google.com; s=arc-20160816; b=KkLgNYU2rZXIz82xHBoTYDJXKClFlN3HMRCj/KnRLE7Qu3ais/VVtFKhHvvf1dFUE6 fMjJj4fVjLmU20ZBDfoPMg+1MyABm9Ocm+1vou7OEaPCkJS3lxCuJC5wMM6lZ8u4mHt8 YrkEwr2AEOZvnV5TkSzV9QUzW1u/Rv7jrMm1pNy6E4zJDOHc+y9ZGBsB25zyvi3mqEHR BUa0fnZjbPA60JMpmIMfUuDXXZeIaWYQxJVGcvCQ4reDomK0037ibYzWd9qlh4K5LpV5 07X6Ko0vC17q7/0D87GXrVyUK60+oe6Vip/OLGlWrzJdz5NZZyDr9Jmcoh4Xwo++wJU1 8YVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jnwJikcww71OpZvMfJM4DztBbtdS4UTU0+T1J4/wPs0=; b=RiNt0WxI4IkH1GtxduH9FCfFl2L6RBatdMFfJZiG90NUDCNc1JVCw/4PJ57BXwAU4o GP2kWZ9TuB7KK5IO9xLVA37yi/4C+YD7iSWdE4gTLzvspA3Qf/4qwyMtu0nnAqJaKDJD XBWRL/j6J60Fo5cgI8PF93iAQoE00ykcCMMFcNdQj8swuKv0AZW7ZXsRVNRm2E/GnfaY Fny+ogBuakYgSKJoyKo0/ojWC0fF4MMALaOcguJE8XYxlTeck964/HnTygMlnNLcBKPJ B2CaruZNfhUG6Tr3JM7y7aLuHZ0DGWAnG0rnNj5bZsJI2RrLPB/TJ2CuATPg7kRPbDsd rFAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=OfHLTUb8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si1720215ejs.214.2020.09.18.01.17.36; Fri, 18 Sep 2020 01:17:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=OfHLTUb8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726308AbgIRH4y (ORCPT + 99 others); Fri, 18 Sep 2020 03:56:54 -0400 Received: from mail.skyhub.de ([5.9.137.197]:55772 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbgIRH4y (ORCPT ); Fri, 18 Sep 2020 03:56:54 -0400 Received: from zn.tnic (p200300ec2f0c2600a65c515d56d1ce56.dip0.t-ipconnect.de [IPv6:2003:ec:2f0c:2600:a65c:515d:56d1:ce56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id A8EA91EC032C; Fri, 18 Sep 2020 09:56:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1600415812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=jnwJikcww71OpZvMfJM4DztBbtdS4UTU0+T1J4/wPs0=; b=OfHLTUb8PkeWMxH4XxG7JJ+Qwg2krzoqTNIENSYVaEi0I7GC8BGXkXRoCppYdQ9yFaaddq +Qb75xXDQhVOYysOe0QbC7KgdnLagOf2h6VIyGfUWAjrZEMRc1zgaPcOVjkn9TLXXSyeQU 697UM/9Y+Y/JlmNEU2PQuXIegI2ugb0= Date: Fri, 18 Sep 2020 09:56:51 +0200 From: Borislav Petkov To: Krish Sadhukhan , Paolo Bonzini Cc: kvm@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com, tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, joro@8bytes.org, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, hpa@zytor.com Subject: Re: [PATCH 3/3 v4] KVM: SVM: Don't flush cache if hardware enforces cache coherency across encryption domains Message-ID: <20200918075651.GC6585@zn.tnic> References: <20200917212038.5090-1-krish.sadhukhan@oracle.com> <20200917212038.5090-4-krish.sadhukhan@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200917212038.5090-4-krish.sadhukhan@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 09:20:38PM +0000, Krish Sadhukhan wrote: > In some hardware implementations, coherency between the encrypted and > unencrypted mappings of the same physical page in a VM is enforced. In such a > system, it is not required for software to flush the VM's page from all CPU > caches in the system prior to changing the value of the C-bit for the page. > > Signed-off-by: Krish Sadhukhan > --- > arch/x86/kvm/svm/sev.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c > index 7bf7bf734979..3c9a45efdd4d 100644 > --- a/arch/x86/kvm/svm/sev.c > +++ b/arch/x86/kvm/svm/sev.c > @@ -384,7 +384,8 @@ static void sev_clflush_pages(struct page *pages[], unsigned long npages) > uint8_t *page_virtual; > unsigned long i; > > - if (npages == 0 || pages == NULL) > + if (this_cpu_has(X86_FEATURE_SME_COHERENT) || npages == 0 || > + pages == NULL) > return; > > for (i = 0; i < npages; i++) { > -- Took the first two, Paolo lemme know if I should route this one through tip too. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette