From patchwork Tue Apr 30 19:50:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haitao Huang X-Patchwork-Id: 13649929 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 804121A0AE0; Tue, 30 Apr 2024 19:51:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714506675; cv=none; b=KmNnOHR4N5GWcKctfIBMX9H5K1ui6ixewG4eVo22/SKf+5mHyfMJEydaceij5fvzMZV/ayjKxxhAwT2mP6ooashrYgU6M9TmDKHBDiSXCuDpW8mdnkztq/LljR1uVX69SVY1XtkFftmOkAMPIe1Ra/AAlMK915kPnCKVgrAlpZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714506675; c=relaxed/simple; bh=sJFW0ltM0O1BHkI+u582PzoUZyLLTIZYbeD8rl/i1fI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n4N1jZM5P+NhSTb4kRWZND58SY16IUN5hv+246JWOxYfRyPJh1QAKm6gxb2ofEOdNqUD7eDc39wRsXMd4mwmjdqCRMrWSBWGhfpRUj1DlXQzaGBiBKKVRgEDfKnti+ODuKFIE7zMzpQ+13ZYtS5wt6G+3/6AfI4NF0CgEsUONeI= 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=Dg4vw4Us; arc=none smtp.client-ip=198.175.65.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.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Dg4vw4Us" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714506674; x=1746042674; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sJFW0ltM0O1BHkI+u582PzoUZyLLTIZYbeD8rl/i1fI=; b=Dg4vw4UsAQpXScTpGBfLrl4UwMSOroo+yiHjBW/oohyKgknVAOJLvL63 wYU6NMjJE8yV/WlhtcQ9HDedRthHdZgK3sJkCJzONMPU+g5pUBoGBucwu PEcRBvuY0ZsijdHN05ZGMn+BtznuxSLUEVg5Fvuf3Fld5mD+jj1/p1tqM NUV5lMEG9jT9P5vRSkY3gyeR/Uq2dGnLZHDPDSuqP+Y/+la6vLUU8wjHt kv72cV0/gXL1/YJpzJ4JOd9XpRST6LsKKHMyE/v2xTuF+wUg01T1GwKVr rv3CmWGz0yHvEngfEvXC3QhwI6n8hPS2/sQUIn6JJzv2DCwMJxNF7eGu2 w==; X-CSE-ConnectionGUID: EXfjhI7SRzyQxVfPqrqzWg== X-CSE-MsgGUID: JIvjvmxpQc+5wldY0RNKfQ== X-IronPort-AV: E=McAfee;i="6600,9927,11060"; a="10355588" X-IronPort-AV: E=Sophos;i="6.07,243,1708416000"; d="scan'208";a="10355588" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2024 12:51:10 -0700 X-CSE-ConnectionGUID: bJ/wsL4tQaevpbYxy7+Nwg== X-CSE-MsgGUID: qCjyJEOFQbGK+BPsQXrJZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,243,1708416000"; d="scan'208";a="31280306" Received: from b4969161e530.jf.intel.com ([10.165.56.46]) by orviesa003.jf.intel.com with ESMTP; 30 Apr 2024 12:51:09 -0700 From: Haitao Huang To: jarkko@kernel.org, dave.hansen@linux.intel.com, kai.huang@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 v13 04/14] cgroup/misc: Add SGX EPC resource type Date: Tue, 30 Apr 2024 12:50:58 -0700 Message-Id: <20240430195108.5676-5-haitao.huang@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240430195108.5676-1-haitao.huang@linux.intel.com> References: <20240430195108.5676-1-haitao.huang@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sgx@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Reviewed-by: Kai Huang Tested-by: Jarkko Sakkinen --- V12: - Remove CONFIG_CGROUP_SGX_EPC (Jarkko) 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..440ed2bb8053 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_X86_SGX + /* 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 7d852139121a..863f9147602b 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_X86_SGX + /* Intel SGX EPC memory bytes */ + "sgx_epc", +#endif }; /* Root misc cgroup */