Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1375574pxj; Fri, 21 May 2021 12:38:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVq4ulzjdimjtGIOOEbuwUgoBuJPf/fDck+8UqXEfhod9J36Dq7F8PhN3GU6RYgbu7p2qu X-Received: by 2002:a6b:d918:: with SMTP id r24mr382282ioc.25.1621625896917; Fri, 21 May 2021 12:38:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621625896; cv=none; d=google.com; s=arc-20160816; b=S0sD4te/G6G8vHN41enCgBg+KMZusVQ9E4fbAxc/hl3jjNTZn5zUu30IfO0BcUy/tc i0IRb5caWN/lfxvMo5LLuzGEVfLwT8QroVNUMCB+8/MHD2uk36NcE5y6wpd2qZxTDUJr a/56ST7VNsFiGeYOvNHMKY8JotCbWeUuJkCgCiSnAxOGSGpI9E8mY6Xn+lerSVcSgruv JaXIpf/5TLKAUBD2XZe9j1SxAtRy7ZxZbP12Z4uENZphkZvbnq9crmK37gCkDJ6XorUj TGPqenJDT8wCA/icOWqKA9uKm836rpfWNsMuV86QnG8xenkvGxEkj45dljQKg86bph/Z omMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=ScSIGEutpr65SB0QAZc4FaKpDNPam828r2Nm3P7qQWk=; b=ppmKzdA21UbMcEkjWPHaU6WMEiUEaliOfGmxTvSkh6qJK80DmP3owUTPo3p/8sLFhO MQ92PojtOhE/paJZB85/qnPfyonh+9hWeky6VtsYKAvixFONl9Eq7is6gWzFqlDb+hTB OaSrwSIKruyq0PYjbtstedCfZ2Nb5YYfUxmkOyRXDoQp9jxx9k4Ns6E3qmyrhG8EoIsd XZOxaMyVLqAWCK+yyLV+RSfuSE8KS6tZNMiGfViUa4tuVr6EjIgD7GbL+GrKrONXECdL Twj48a0pGf9LDD5RiCQjDtLdgA2V/iXJgxm9GGsoHRMVcgyCf0ybMrMcKzpAGcFFLhF6 OJ2w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q186si5908707iof.83.2021.05.21.12.38.03; Fri, 21 May 2021 12:38:16 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237528AbhETUOY (ORCPT + 99 others); Thu, 20 May 2021 16:14:24 -0400 Received: from mga05.intel.com ([192.55.52.43]:52814 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233675AbhETUOY (ORCPT ); Thu, 20 May 2021 16:14:24 -0400 IronPort-SDR: XdQ4xIC0XhtdNbr2rStTFbweZr3Mr/UjNcnh4Jubfq38ixePmP2dacq5dRhASxMUqmfdLdLxJ7 4GasDXB4FBUQ== X-IronPort-AV: E=McAfee;i="6200,9189,9990"; a="286857636" X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="286857636" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2021 13:13:02 -0700 IronPort-SDR: PFMPvpd4Uj3LcG5c8OukCx6maliUMMhlb+FaQCXIQcziEQ3CnQlgO9OAsZ7v3sMBXzHpB26+iT jUhgvX8E8tLA== X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="440602602" Received: from shaunnab-mobl2.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.212.65.6]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2021 13:13:01 -0700 Subject: Re: [RFC v2 28/32] x86/tdx: Make pages shared in ioremap() To: Borislav Petkov , Sean Christopherson Cc: Dave Hansen , Andi Kleen , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , linux-kernel@vger.kernel.org References: <312879fb-d201-a16d-2568-150152044c54@linux.intel.com> <797c95bf-9516-8aee-59d0-f5259d77bb75@linux.intel.com> <5b4b4fc0-aaa8-3407-6602-537d59572bc1@intel.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: <0e233779-9c10-11df-b527-ef61e003ea35@linux.intel.com> Date: Thu, 20 May 2021 13:12:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/11/21 2:35 AM, Borislav Petkov wrote: > Preach brother!:) > > /me goes and greps mailboxes... > > ah, do you mean this, per chance: > > https://lore.kernel.org/kvm/20210421144402.GB5004@zn.tnic/ > > ? > > And yes, this has "sev" in the name and dhansen makes sense to me in > wishing to unify all the protected guest feature queries under a common > name. And then depending on the vendor, that common name will call the > respective vendor's helper to answer the protected guest aspect asked > about. > > This way, generic code will call > > protected_guest_has() > > or so and be nicely abstracted away from the underlying implementation. > > Hohumm, yap, sounds nice to me. > > Thx. I see many variants of SEV/SME related checks in the common code path between TDX and SEV/SME. Can a generic call like protected_guest_has(MEMORY_ENCRYPTION) or is_protected_guest() replace all these variants? We will not be able to test AMD related features. So I need to confirm it with AMD code maintainers/developers before making this change. arch/x86/include/asm/io.h:313: if (sev_key_active() || is_tdx_guest()) { \ arch/x86/include/asm/io.h:329: if (sev_key_active() || is_tdx_guest()) { \ arch/x86/kernel/pci-swiotlb.c:52: if (sme_active() || is_tdx_guest()) arch/x86/mm/ioremap.c:96: if (!sev_active() && !is_tdx_guest()) arch/x86/mm/pat/set_memory.c:1984: if (!mem_encrypt_active() && !is_tdx_guest()) -- Sathyanarayanan Kuppuswamy Linux Kernel Developer