Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1094928pxj; Wed, 2 Jun 2021 21:04:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5v8wPKnFxvT/XKDPDbY5ujjR6A6pjUIE22oC6oSBWzO4/6y6ieVMGniFK8r4vvTEbpHfI X-Received: by 2002:aa7:da81:: with SMTP id q1mr7614409eds.60.1622693054227; Wed, 02 Jun 2021 21:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622693054; cv=none; d=google.com; s=arc-20160816; b=sqeUPx1UnbkdGs4JiDVwaG70ikjzt3cMw2JBESzuv/QGqDXI7U3BXwlnRke8H6cWTi Aw+9Ast4WdV3EjyI6r/8TvHh1HVjXypfKrGYt9C0Bu3Y41QsPxjS6QUyV/Ee6qfeHq1O UdDj6fOG0Wh8enCzvv7FcuQ2hMji/4U20AV0kfICFVjz/aE7dXqzeUYFvprJVMWUjpDm BNk7XdzUT4IHki8RVCYjPu6gRueKBJz2YlSYaMx763y4HW3FOSsA2oWgI7FOyVmhD6T4 6eDf+xgPpMIy9J3a6Wq5HAsDbQo/UffXJEzkGjV21Ntx+3fKh/o70GPIzWbz90D1iD+1 dDFw== 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=9DsUOuzkNvh0kpdrvab18q1Fg8go10Bzg9HAsbW5p3Q=; b=FeB/DPEPZwljGmRkuvsNw/RDR6tZmzvjrp/EKxXNNAKWrZOnPHzPeKTOfyNaOv+9DY Rs1kVEt1Ij1ZOOdB/93LN3EkGw6sUwa/gRYrDD2RGXMhy85HBrWCYYiDXXrJQkHTxlvP jAWkbnuVGQGMIe98/O1tB5qgt3N+SlM9OxCqK2Tuz9WT3FB7gP8L7Rcbw6PNy+JmhPHo dNXwCU+G97gf98fFkzNLP3skRrQ58ukJ+Ris80NTakq4LesZY2uP0vI1J49X+eSx0Z7N gGhvTUa2q2jVOn4+UGLALQgTlC4WglIpf3M8O/3W8ETw9Psc5D7j4qA55waXgeln4MB/ 7aKA== 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 y15si1567084edv.320.2021.06.02.21.03.49; Wed, 02 Jun 2021 21:04:14 -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 S229487AbhFCEEQ (ORCPT + 99 others); Thu, 3 Jun 2021 00:04:16 -0400 Received: from mga03.intel.com ([134.134.136.65]:61449 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbhFCEEP (ORCPT ); Thu, 3 Jun 2021 00:04:15 -0400 IronPort-SDR: nA1mvO6xdl617qgFT3hojha54zW0hGOpvwnSrBfAl5vMKvoxcGrk+9mh53v9TSAL6c/QmribeT wQ8NPwcwhbqw== X-IronPort-AV: E=McAfee;i="6200,9189,10003"; a="203988459" X-IronPort-AV: E=Sophos;i="5.83,244,1616482800"; d="scan'208";a="203988459" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2021 21:02:31 -0700 IronPort-SDR: eEPbiSnatcxwFz1MIHAGiqlURWg97YVMLLchQhh6e6iCeiUcbEie29Jt0yKv9fUFRmBH2QL+yg Gh0zCTGCIDmA== X-IronPort-AV: E=Sophos;i="5.83,244,1616482800"; d="scan'208";a="417188440" Received: from sboinap-mobl1.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.209.150.149]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2021 21:02:31 -0700 Subject: Re: [PATCH v1 4/8] x86/tdx: Add arch_has_restricted_memory_access for TDX To: Andi Kleen , mst@redhat.com Cc: jasowang@redhat.com, virtualization@lists.linux-foundation.org, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, iommu@lists.linux-foundation.org, x86@kernel.org, jpoimboe@redhat.com, linux-kernel@vger.kernel.org References: <20210603004133.4079390-1-ak@linux.intel.com> <20210603004133.4079390-5-ak@linux.intel.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: <2dd6a4a1-e5f7-23e2-9c5b-abfe8ff20e79@linux.intel.com> Date: Wed, 2 Jun 2021 21:02:28 -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: <20210603004133.4079390-5-ak@linux.intel.com> 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 6/2/21 5:41 PM, Andi Kleen wrote: > +int arch_has_restricted_virtio_memory_access(void) > +{ > + return is_tdx_guest(); > +} > +EXPORT_SYMBOL_GPL(arch_has_restricted_virtio_memory_access); > + This function definition had to be removed from arch/x86/mm/mem_encrypt.c. Otherwise, if you enable both CONFIG_AMD_MEM_ENCRYPT, CONFIG_X86_MEM_ENCRYPT_COMMON it will generate multiple definition error. --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -493,9 +493,3 @@ void __init amd_mem_encrypt_init(void) print_mem_encrypt_feature_info(); } - -int arch_has_restricted_virtio_memory_access(void) -{ - return sev_active(); -} -EXPORT_SYMBOL_GPL(arch_has_restricted_virtio_memory_access); --- a/arch/x86/mm/mem_encrypt_common.c +++ b/arch/x86/mm/mem_encrypt_common.c @@ -40,7 +40,7 @@ void __init mem_encrypt_init(void) int arch_has_restricted_virtio_memory_access(void) { - return is_tdx_guest(); + return (is_tdx_guest() || sev_active()); } EXPORT_SYMBOL_GPL(arch_has_restricted_virtio_memory_access); -- Sathyanarayanan Kuppuswamy Linux Kernel Developer