From patchwork Mon Feb 5 21:06:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haitao Huang X-Patchwork-Id: 197133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1252159dyb; Mon, 5 Feb 2024 17:15:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsH1BkTCBvNjga1fooTW6etArbhKT6yPyIkGfvDkhIO2GStZAxyaL7KweQjrXFVi5+94O6 X-Received: by 2002:a17:902:f68d:b0:1d9:ce46:6eb8 with SMTP id l13-20020a170902f68d00b001d9ce466eb8mr388991plg.4.1707182113696; Mon, 05 Feb 2024 17:15:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707182113; cv=pass; d=google.com; s=arc-20160816; b=c6ZxA9jXxuzo1bTeQQRpCMynZuRzmTUNu/I2gjAg6rOi3R4HYS+UhX6cQLhJDaNiuI OM83JXBwSUA0zrMQUzD6fLfFd2W1SVfxB9AudfTywpJhyF6oM1hemNmLWFH9fk1xzsCH 7n4TZDF+XwE8qingvHVzWvIcb+d96FkrcZ33KLcGNIJlwq99jy4qz3Kx8KaG6GqTt6l+ T6hhQlJv4pfegaErA4KmcjKz3a/GPpExA5DbB1tqmhr72/rHL49pMkx21axG5q/VbTae 8zZ52TS/jkTLGTX61Wu9O154lW+oLf9S5XlpE++lBuExDv60FZku5fp+xQEM9e/99zex UI4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AqWWI/Gh7z2z8mZ5OI3FsyusrHgJwzTCkVq/3hcyohU=; fh=bMD2abvVN530gLO0BHCm17f0eLEbS6gOAqQmcDKliNM=; b=t51TyP3UZIV6xbAL2JCVQFKm5PWwDmtbY3P8IX4jHQ5fIt4nHO+ySNJVeucjsZTFuk gfb26cz1vTkHM9isakbK6LcQoduCiRde8Vaj0VA9XVNz7QMQarQpBv1k43hNLlMjutCw 2z8Jz0YMI2QMmasHWSO8chdol4knFYEe3rUQcugHlzbkuUmwdrTSdBelg06e2feLNuCW nmx9ZqNmryb5jRNAphenn8MyDsdkAoSARK1TDueDfAKfE1dBapCsbqPptV1BqW6EA2KZ CwsU8CVg6VmmkZnYnr38CWOTKdn1ac45e2H61qafaBRzVarW9xvd9WmH05W1DdMBeuie PbIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MNC68eIB; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-53944-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53944-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCVVUe/Y3hEs2uahfsYc95LlPo0WXGzQg/6Bd39Qd9Z2/tmeAfQNIuX5S1aEOmvnoSJRgk1kaolM2JBCxnQUQMyHje31gA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 6-20020a170902ee4600b001d8a923f0ccsi714159plo.250.2024.02.05.17.15.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 17:15:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53944-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MNC68eIB; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-53944-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53944-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 24F94B27B8F for ; Mon, 5 Feb 2024 22:00:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DE70145339; Mon, 5 Feb 2024 21:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MNC68eIB" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 A7C9D141990; Mon, 5 Feb 2024 21:06:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707167204; cv=none; b=WO33mp9Fi4KZzDcHCgAEPHZNHyGEYkQQRoZT3avM8MTXZCFfAwiQDL97XPFXxSXv8bN2WQguPMQQBRE0ZPPJH9h1Kr2z1g5jyGSRbcBqmKZSyMgzP7osSUqRfmyA41SyaB/XhlUkXyKtcPTnCKkT7/GAeMQW4JLXmcjPznzHzNc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707167204; c=relaxed/simple; bh=YDWZ+/RuZjq5pI5dUr4mOk8isI80rU+KIyGmgA2cvBo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pmPqtzsetHHO2IYxIL6Ioa3fJ+QFqNb7P+wuxqdMjCzIkcT4vuEAOWfruI/UIOSwKTIUKzxNMzH8EOOi0INijCgMQ7mOVE98cjWvtp67FwbC8euzr0Jg7Mz7iy77EzoocRnPNBDGAbIP1AFCwSE50J+9HSJNggI9/VMFY+EObmk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MNC68eIB; arc=none smtp.client-ip=198.175.65.12 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.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707167203; x=1738703203; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YDWZ+/RuZjq5pI5dUr4mOk8isI80rU+KIyGmgA2cvBo=; b=MNC68eIBNj2Q/gvBZTVemLJHZ8SNi+seZh+m/hVsbiZfWy2bGPNrXAgw yEPJiI4OegEHNBgw1xnm02j9XYb6GZszLz88m+CcqA9Jv2tpYWb7xNUcW vmM+0M6aTwxru9Rs4SHiwP/77RPrCh4ClVH3Rp/HWW8I+w/duo0mLikHt 2WuXKrFsvazlrUnkgUUoK1T7dnnKyTfU4Gsz8xAwBeHO6hheQPEjYPxN/ T04o7XS4YwMWKZnYRN+EZ/bRsMJcr0qCawVqJMJ84lyY33stUp46TMYaY led2qlcRnkpk35anGWfJzVHbR4T9f5S4GaI5esyHF6xL0ReTPlsdSJw8s Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10975"; a="11960358" X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="11960358" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2024 13:06:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="38245614" Received: from b4969161e530.jf.intel.com ([10.165.56.46]) by orviesa001.jf.intel.com with ESMTP; 05 Feb 2024 13:06:40 -0800 From: Haitao Huang To: jarkko@kernel.org, dave.hansen@linux.intel.com, tj@kernel.org, mkoutny@suse.com, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, x86@kernel.org, cgroups@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, sohil.mehta@intel.com, tim.c.chen@linux.intel.com Cc: zhiquan1.li@intel.com, kristen@linux.intel.com, seanjc@google.com, zhanb@microsoft.com, anakrish@microsoft.com, mikko.ylinen@linux.intel.com, yangjie@microsoft.com, chrisyan@microsoft.com Subject: [PATCH v9 03/15] cgroup/misc: Add SGX EPC resource type Date: Mon, 5 Feb 2024 13:06:26 -0800 Message-Id: <20240205210638.157741-4-haitao.huang@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240205210638.157741-1-haitao.huang@linux.intel.com> References: <20240205210638.157741-1-haitao.huang@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790110191765876747 X-GMAIL-MSGID: 1790110191765876747 From: Kristen Carlson Accardi Add SGX EPC memory, MISC_CG_RES_SGX_EPC, to be a valid resource type for the misc controller. Signed-off-by: Kristen Carlson Accardi Co-developed-by: Haitao Huang Signed-off-by: Haitao Huang Reviewed-by: Jarkko Sakkinen --- V6: - Split the original patch into this and the preceding one (Kai) --- include/linux/misc_cgroup.h | 4 ++++ kernel/cgroup/misc.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/linux/misc_cgroup.h b/include/linux/misc_cgroup.h index 541a5611c597..2f6cc3a0ad23 100644 --- a/include/linux/misc_cgroup.h +++ b/include/linux/misc_cgroup.h @@ -17,6 +17,10 @@ enum misc_res_type { MISC_CG_RES_SEV, /* AMD SEV-ES ASIDs resource */ MISC_CG_RES_SEV_ES, +#endif +#ifdef CONFIG_CGROUP_SGX_EPC + /* SGX EPC memory resource */ + MISC_CG_RES_SGX_EPC, #endif MISC_CG_RES_TYPES }; diff --git a/kernel/cgroup/misc.c b/kernel/cgroup/misc.c index 1f0d8e05b36c..e51d6a45007f 100644 --- a/kernel/cgroup/misc.c +++ b/kernel/cgroup/misc.c @@ -24,6 +24,10 @@ static const char *const misc_res_name[] = { /* AMD SEV-ES ASIDs resource */ "sev_es", #endif +#ifdef CONFIG_CGROUP_SGX_EPC + /* Intel SGX EPC memory bytes */ + "sgx_epc", +#endif }; /* Root misc cgroup */