Message ID | 20240614095904.1345461-10-kirill.shutemov@linux.intel.com |
---|---|
State | Accepted |
Commit | c3abbf1376874f0d6eb22859a8655831644efa42 |
Headers | show
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5FDD195FE5; Fri, 14 Jun 2024 09:59:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718359166; cv=none; b=XF8ECXQYL4kXJYoJuCF/KbzC/4GN9JZK4S2l1zpHmsNkMP4NveDXWq61k8zeZ+LqTHFRaxFyg6hc6Ls1rsZRNkBGNqOmPfzPdv50bVrZufppcD9N25kA78vl23qR1o7LCi7UwLNsaPA1fBqkVv5Nfvx7/YIc2Hfwn9Jga/DRFzY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718359166; c=relaxed/simple; bh=vMAUzycpMKArP020PRsibNB/a1B3MTtv6nj6DDJJbg4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vFIOjCYumU4k12JuoHfMmL9H8pl85rfIsEQLTaqsf6rLKVCj4hZqECG6JdxyIf3RUQ6/VRoyxDPC6RdImPDEYdQBiGGHjwK7oQ/vwKv1WcNJOsGq+iVVhIB6jnKfPe7ZBTOVx7xgMwTJPm2UDlnC7ZCR98LIjGnqGyyhbRtrKmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.helo=mgamail.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TKo1scMc; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.helo=mgamail.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TKo1scMc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718359164; x=1749895164; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vMAUzycpMKArP020PRsibNB/a1B3MTtv6nj6DDJJbg4=; b=TKo1scMcC9dCQ5aLaTpcw1tFYO+D2KIQwJVD+o6VPohTylCgCNKiK2+U JcKycP1FXPH2/MMqgiDVrsjSNMRN97eF+29fcgsJO1qKp6YnrS5/v7sda zBbHcyfBd2+X//JtAI7vAIq1/YQkB/8mhWEWLLIk/W/ETtvMlOqEAPgLe xAEK73tJEzDFfYsPjnixeisQyaIRtXZZXJLf3n6mB2cnybNVDggBKjbgv Tv6feY9kL5T0O7Dx29inv1KnmqccbW4P7Y2VRzr775cAMB5v3Kna2jia/ uZMwRaOF1Czms6IkcUmXTu5tv1lrgLMgt6WwDaO6YlH94VxETqDK4c6Ln Q==; X-CSE-ConnectionGUID: 1PAp0eKgQfmk3F4bCCsiog== X-CSE-MsgGUID: Zb6TuuBlQlmIfbcVjZJCWg== X-IronPort-AV: E=McAfee;i="6700,10204,11102"; a="12072383" X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="12072383" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2024 02:59:23 -0700 X-CSE-ConnectionGUID: yg2GzZ0nR0mCYXIueUV0tQ== X-CSE-MsgGUID: CghLlVdVThaOPXPOp4nOSw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="44995849" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa004.fm.intel.com with ESMTP; 14 Jun 2024 02:59:17 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id EBD162A3B; Fri, 14 Jun 2024 12:59:08 +0300 (EEST) From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org Cc: "Rafael J. Wysocki" <rafael@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Adrian Hunter <adrian.hunter@intel.com>, Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>, Elena Reshetova <elena.reshetova@intel.com>, Jun Nakajima <jun.nakajima@intel.com>, Rick Edgecombe <rick.p.edgecombe@intel.com>, Tom Lendacky <thomas.lendacky@amd.com>, "Kalra, Ashish" <ashish.kalra@amd.com>, Sean Christopherson <seanjc@google.com>, "Huang, Kai" <kai.huang@intel.com>, Ard Biesheuvel <ardb@kernel.org>, Baoquan He <bhe@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, "K. Y. Srinivasan" <kys@microsoft.com>, Haiyang Zhang <haiyangz@microsoft.com>, kexec@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-acpi@vger.kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Tao Liu <ltao@redhat.com> Subject: [PATCHv12 09/19] x86/tdx: Account shared memory Date: Fri, 14 Jun 2024 12:58:54 +0300 Message-ID: <20240614095904.1345461-10-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240614095904.1345461-1-kirill.shutemov@linux.intel.com> References: <20240614095904.1345461-1-kirill.shutemov@linux.intel.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: <linux-acpi.vger.kernel.org> List-Subscribe: <mailto:linux-acpi+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-acpi+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit |
Series |
x86/tdx: Add kexec support
|
expand
|
diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c index 26fa47db5782..979891e97d83 100644 --- a/arch/x86/coco/tdx/tdx.c +++ b/arch/x86/coco/tdx/tdx.c @@ -38,6 +38,8 @@ #define TDREPORT_SUBTYPE_0 0 +static atomic_long_t nr_shared; + /* Called from __tdx_hypercall() for unrecoverable failure */ noinstr void __noreturn __tdx_hypercall_failed(void) { @@ -821,6 +823,11 @@ static int tdx_enc_status_change_finish(unsigned long vaddr, int numpages, if (!enc && !tdx_enc_status_changed(vaddr, numpages, enc)) return -EIO; + if (enc) + atomic_long_sub(numpages, &nr_shared); + else + atomic_long_add(numpages, &nr_shared); + return 0; }