Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp238575pxt; Wed, 4 Aug 2021 21:21:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/BAbR39S0VAkeG6v3dEXA36YnhKWmSJRZ/vwRMCxaksb4nVyQu63ozpMu6rrgjN4NQO2+ X-Received: by 2002:a02:9386:: with SMTP id z6mr2683400jah.100.1628137305773; Wed, 04 Aug 2021 21:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628137305; cv=none; d=google.com; s=arc-20160816; b=YLFF5z8M6Z/KD/jubn7QwMyHAphpSdVlvZv6DYZZ51B9A5tEGrai5fF2TOJXOaLOae AvF2IrZw5JhIRe3Ra5762pfzqaW8tgFIiLbeAHxG6d43Q/7s00VqeX7S+ttD39Nr6u3k CA2sg2VapBoWxPjH2zYTTgJ8eqMxAcO6hOhwCqtU/1hNdJ3aXqIXxJCebPyZ4dxnNc/e e+RTd6h2d62/n8zlmmb9wPTznC5t/kv53wSGCjumJEMJQsDh99KlyMgr5zxDF1ka5Xhp lpjnLQJjlWNp3Wv4mEy6yRnADon7x6GDoAFMVH9n1X/RtWLonhBo9FmtgAx0OYv27L1o WAoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jc0aslgpt21thVCZHa+NK8gFATtAZR+u5ytt8ixSB+E=; b=GoT1KvILgErjsB/l9d+ZXjxjZdIIuDXy70UxFq+UJyILlxjItxYdajOOYljJIO0H6t 7xoEgAQlHpEaO5xvJs6bbYi8yVDaPuzY2Zp+en5FTsN/o4Nk8fRgEVly9l3NKcEZz87x YsVxgLZS6aGMGpBkRKmPw5TdKDxb5Rw5KeJ4L3k/9ZJEp2X0uojKxFhCAEqsf6gwdPu/ XJOm3S4PV0sHGCs/ozj6h7a/RfvOE+fQjg2tt0SJe1Tr9s/Uyj5GW0sk2U5rmgY/8u8n 7E9ZJyTR8o56NVurICQrwMKEKmzR+cF5X2ypSHAnjsorP+yeazY1pOAIy+rKXbcxEnGh Hu2Q== 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 d11si5087156ilc.143.2021.08.04.21.21.33; Wed, 04 Aug 2021 21:21:45 -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 S237055AbhHEAyA (ORCPT + 99 others); Wed, 4 Aug 2021 20:54:00 -0400 Received: from mga02.intel.com ([134.134.136.20]:12131 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236865AbhHEAxw (ORCPT ); Wed, 4 Aug 2021 20:53:52 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10066"; a="201215445" X-IronPort-AV: E=Sophos;i="5.84,296,1620716400"; d="scan'208";a="201215445" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2021 17:53:38 -0700 X-IronPort-AV: E=Sophos;i="5.84,296,1620716400"; d="scan'208";a="437617244" Received: from mjkendri-mobl.amr.corp.intel.com (HELO skuppusw-desk1.amr.corp.intel.com) ([10.254.17.117]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2021 17:53:36 -0700 From: Kuppuswamy Sathyanarayanan To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , Bjorn Helgaas , Richard Henderson , Thomas Bogendoerfer , James E J Bottomley , Helge Deller , "David S . Miller" , Arnd Bergmann , Jonathan Corbet , "Michael S . Tsirkin" Cc: Peter H Anvin , Dave Hansen , Tony Luck , Dan Williams , Andi Kleen , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , x86@kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH v4 08/15] x86/tdx: Enable shared memory protected guest flags for TDX guest Date: Wed, 4 Aug 2021 17:52:11 -0700 Message-Id: <20210805005218.2912076-9-sathyanarayanan.kuppuswamy@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210805005218.2912076-1-sathyanarayanan.kuppuswamy@linux.intel.com> References: <20210805005218.2912076-1-sathyanarayanan.kuppuswamy@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In TDX guest, since the memory is private to guest, it needs some extra configuration before sharing any data with VMM. AMD SEV also implements similar features and hence code can be shared. Currently memory sharing related code in the kernel is protected by PATTR_GUEST_MEM_ENCRYPT and PATTR_GUEST_SHARED_MAPPING_INIT flags. So enable them for TDX guest as well. Signed-off-by: Kuppuswamy Sathyanarayanan --- arch/x86/kernel/tdx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/tdx.c b/arch/x86/kernel/tdx.c index 01b758496e84..1cf2443edb90 100644 --- a/arch/x86/kernel/tdx.c +++ b/arch/x86/kernel/tdx.c @@ -78,6 +78,8 @@ bool tdx_prot_guest_has(unsigned long flag) switch (flag) { case PATTR_GUEST_TDX: case PATTR_GUEST_UNROLL_STRING_IO: + case PATTR_GUEST_MEM_ENCRYPT: + case PATTR_GUEST_SHARED_MAPPING_INIT: return cpu_feature_enabled(X86_FEATURE_TDX_GUEST); } -- 2.25.1