From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D07B7C43464 for ; Fri, 18 Sep 2020 07:56:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55D5E2100A for ; Fri, 18 Sep 2020 07:56:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="OfHLTUb8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726368AbgIRH4y (ORCPT ); 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