Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1439249pxj; Fri, 21 May 2021 14:27:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzehD0uEQ8f4K51FjbTBxGZwvbs7rGfAxqX/SlPPayWVfiRiAqy47zuYBMllhE7L1ViDqgi X-Received: by 2002:a02:6d6c:: with SMTP id e44mr7193267jaf.81.1621632468096; Fri, 21 May 2021 14:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621632468; cv=none; d=google.com; s=arc-20160816; b=GraquIHbyK6Y5fo4C7hnqxrkdTDFuIj137FeF3kk+0KqHrQTaH4mp8r6bHzMc/9xGh uAldieNFogOsYqdWUiPMyS9eZOzcxbwY3xiupwCaegOlxB+7XznZv/cUlOPoFRJ73hZ1 0VTi4FnAuylJhXKjgMU3E1gaXQPU9BLXL78yUxwwYaqGrfM/NgPMAHS5cOokdcPBgm/W MPG21Xhh+nFN6x8z0VZDFG9NJ+pJBjxcRhd2aqnja41pJSEV/RyK2zzIPcdfpNrGbJ7A MgOHzGKzVu2jFbGy/tZKJQ+R7q8QLgkE9HD8oNqUr3zZvzI+Za33Yk40eydzOGACcQ+o 4mUg== 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=3LJAZhxKWmjimDmIEpS1OanKuj4fPuQC6Ji2my1ffes=; b=PxzBRe4Ti4PzrUNUYxJJI5GrmxcTgNipliDCrzCWiJ8o2hoGMkY5ZJy/f+FclPe9nq gCh/S8xQNG0voz7TxIpEE9WtKqardqrPex6V8Bg2nlb+gq54+LiX1uCU4ZrZ8v1duSWy SLV+zxGqF+KgPxJ6jUQjfIZ+FTYzPkehnVBBJ0ls8tE1PkleD+MOU0Qg5mvtiF2rOc5F mFIR38EOhpbtc29/+/zYYo6rF9NNBlZ49nWlG3R7EdzOBYi3yA+vZk19hbpA7faqMKC0 b5TRZXeXwF0mJC/Mb2U/7lNNTATMI+zed8P13hu0SD3EhSA8frjBy37WJh5ZdWlANVDq kwJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=LhfojBS1; 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 f11si7782542ila.138.2021.05.21.14.27.35; Fri, 21 May 2021 14:27:48 -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=LhfojBS1; 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 S232011AbhEUSvX (ORCPT + 99 others); Fri, 21 May 2021 14:51:23 -0400 Received: from mail.skyhub.de ([5.9.137.197]:41900 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbhEUSvX (ORCPT ); Fri, 21 May 2021 14:51:23 -0400 Received: from zn.tnic (p200300ec2f0ea400fbcd5718c7a034c2.dip0.t-ipconnect.de [IPv6:2003:ec:2f0e:a400:fbcd:5718:c7a0:34c2]) (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 BEBD81EC06F0; Fri, 21 May 2021 20:49:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1621622998; 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=3LJAZhxKWmjimDmIEpS1OanKuj4fPuQC6Ji2my1ffes=; b=LhfojBS1PUhodfjrWgeTAsonPiAiCqCd5Qw+d14N+N+2WZLh9Y31jKKS0w2FYp/RjaIfbz rcoKwns8hndz4ox1V1miUKrT+cJtA1H6A9J59ERyre1a2ABx2qzoS6JsBCQhC14gGfazQV ET0gfdk8nnGDaIpBMXAP3jjtV4hwOkI= Date: Fri, 21 May 2021 20:49:58 +0200 From: Borislav Petkov To: Tom Lendacky Cc: "Kuppuswamy, Sathyanarayanan" , Sean Christopherson , Dave Hansen , Andi Kleen , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , linux-kernel@vger.kernel.org, Brijesh Singh Subject: Re: [RFC v2 28/32] x86/tdx: Make pages shared in ioremap() Message-ID: References: <312879fb-d201-a16d-2568-150152044c54@linux.intel.com> <797c95bf-9516-8aee-59d0-f5259d77bb75@linux.intel.com> <5b4b4fc0-aaa8-3407-6602-537d59572bc1@intel.com> <0e233779-9c10-11df-b527-ef61e003ea35@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 21, 2021 at 11:19:15AM -0500, Tom Lendacky wrote: > In arch/x86/mm/mem_encrypt.c, sme_early_init() (should have renamed that > when SEV support was added), we do: > if (sev_active()) > swiotlb_force = SWIOTLB_FORCE; > > TDX should be able to do a similar thing without having to touch > arch/x86/kernel/pci-swiotlb.c. > > That would remove any confusion over SME being part of a > protected_guest_has() call. Even better. > I kinda like the separate function, though. Only if you clean it up and get rid of the inverted logic and drop that silly switch-case. > Except mem_encrypt_active() covers both SME and SEV, so > protected_guest_has() would be confusing. I don't understand - the AMD-specific function amd_protected_guest_has() would return sme_me_mask just like mem_encrypt_active() does and we can get rid of latter. Or do you have a problem with the name protected_guest_has() containing "guest" while we're talking about SME here? If so, feel free to suggest a better one - the name does not have to have "guest" in it. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette