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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 81C72C4707A for ; Fri, 21 May 2021 18:50:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CA69613DF for ; Fri, 21 May 2021 18:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232319AbhEUSvY (ORCPT ); Fri, 21 May 2021 14:51:24 -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