Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp12289pxj; Wed, 26 May 2021 14:41:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCgfehTb4vrsL2jbhkab0GXTbc5gFgu94lV7qPMMTp2uPpwa9dIjEClbKwtjg6A0wLbTOd X-Received: by 2002:a05:6402:128e:: with SMTP id w14mr279456edv.99.1622065272694; Wed, 26 May 2021 14:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622065272; cv=none; d=google.com; s=arc-20160816; b=JCVZJ43m0TvnCI01reCc4dfTOj45zgKkIwTN6Icj5NiDpGQzA7sOLXGpbZATJ3k57G cBagLpE0ozJPGmB34qdBAoqrT0AoaKDRDmHGDT2I7yPTvkh7iKMsHPcpp5KOLp39f9m+ Ggjsa8eHd73FV+4ccNlywccf7NZqO2ySu9JZZradtCCBkT8Q+sAgZb94e3EvZU5Xyssk dF16/jEnrl7GXMfl4FH5ZXmCRvVY8WTVLBevdRCDAWgAD71lbJArdjZVcIED+djEbFMc PPPHvLTDh3UVkL53A71ageyAnZmAcqaPWq2Kx1s/V3Gq/PqDJHwMsJsmr+PrA36RFrCe Ohiw== 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=qqYBvLSBLdYmTcocpOKdAJS+ExVSDifLCGlgr0ERAw4=; b=ixuT4Xj3yiPL5IFZMi4xNJSB71ZiNeDuFxeTvL9f+ZHBBeYtLZm9R5HFqRSS+H0cz9 lnOrNe5PlDKS2M0XUqmSoSxuKbzr7LM+h3aPBWJ3HMXou2HC74cx3nMnRXj6QBD2Dg79 G+CM7naf9tGZbdBeD0q/VP2ZbiG9HFXxNmNLPZtnh2Feb/XqZSKb19D2qDQoTSB4TlrP 1zm/U1LI6wvdC8OtApGCmNbMieI3s5k90KSB/8b1JnRA4bQBYdTDSWh8i9HvIKpHQyDX 8vn4j+CiuipOxiIOCkL9qG5Xm3pOw4IkDtTANzNxKB2mrc+IbIEVzwaiv1ThxFdND4/k tT0g== 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 l23si228798ejb.573.2021.05.26.14.40.37; Wed, 26 May 2021 14:41:12 -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 S233040AbhEZVjV (ORCPT + 99 others); Wed, 26 May 2021 17:39:21 -0400 Received: from mga02.intel.com ([134.134.136.20]:4030 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232250AbhEZVjT (ORCPT ); Wed, 26 May 2021 17:39:19 -0400 IronPort-SDR: HKKgB+h8a3yK+7R/fYCZYdbnOdk7zlWyeuBnGiH0Mtsdjrt09jAnZYQ1smtbsIkmQqyrueLmJb sCtaWy1ymIxQ== X-IronPort-AV: E=McAfee;i="6200,9189,9996"; a="189705637" X-IronPort-AV: E=Sophos;i="5.82,331,1613462400"; d="scan'208";a="189705637" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2021 14:37:44 -0700 IronPort-SDR: B+C9Mk8p7JICAVQrvXzXDmFMaIO7LGs20hUpYkAejRCSFiApi7ahziZVrCEVBNRZiFbYksQhwW c8BHhqSY5Ghw== X-IronPort-AV: E=Sophos;i="5.82,331,1613462400"; d="scan'208";a="547387010" Received: from skgiroua-mobl2.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.251.151.24]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2021 14:37:41 -0700 Subject: Re: [RFC v2 28/32] x86/tdx: Make pages shared in ioremap() To: Tom Lendacky , Borislav Petkov Cc: 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 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> From: "Kuppuswamy, Sathyanarayanan" Message-ID: Date: Wed, 26 May 2021 14:37:39 -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/21/21 9:19 AM, 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. You mean sme_active() check in arch/x86/kernel/pci-swiotlb.c is redundant? 41 int __init pci_swiotlb_detect_4gb(void) 42 { 43 /* don't initialize swiotlb if iommu=off (no_iommu=1) */ 44 if (!no_iommu && max_possible_pfn > MAX_DMA32_PFN) 45 swiotlb = 1; 46 47 /* 48 * If SME is active then swiotlb will be set to 1 so that bounce 49 * buffers are allocated and used for devices that do not support 50 * the addressing range required for the encryption mask. 51 */ 52 if (sme_active() || is_tdx_guest()) 53 swiotlb = 1; -- Sathyanarayanan Kuppuswamy Linux Kernel Developer