Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1818743lqp; Mon, 15 Apr 2024 20:20:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXlVI8riYFldZmqxr4vKKUP/umK7AdpSR8gGBQPZsF48ekv5xpj1bYIAUyaPjkoXcLAzK5xVN5exzdNw5yNyjNbQmCW9INqoAAr3TTu/w== X-Google-Smtp-Source: AGHT+IGbYDfJ0+UOIb7+sBfMdSHr5hV9mpM3+YNosrFBIPK0nNxFv4CM4kk80YY3e7Meyz5ZX+9i X-Received: by 2002:a50:d758:0:b0:56c:5990:813e with SMTP id i24-20020a50d758000000b0056c5990813emr7041775edj.13.1713237654165; Mon, 15 Apr 2024 20:20:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713237654; cv=pass; d=google.com; s=arc-20160816; b=tpEah9vJ7JqG/+r38FAHAS7Pa6yUa4H1DA5VIV1y0DdBcuFxBc0YURr4mFZk+Xytc4 /9ovOVSj6t0fJtGAFUPzITbQtpsKalvNVVgepCRnNuMIDm+ZbNp+0VtyP/Je9wj4ersd zEzE5DcO6Tj47DTRAOnq2amojhjvXFvvteXYUEJ+85ERdmFWxxO0HNvQbEBtBfQUi/Kf AxAxojZ6wXIeVZCGqkwNDnv3Yj0SqxCPai3gCIocqY1nwHK1HzjsVv+f6uu708U9ueW6 8hp9uvL4lAY6mjW1UJRjiGyWFcENGt2d1wG0o43uv5wDP4/jdHhm9n2z8MxWMkbYwONc wVwg== 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=lU6B5iNgiUAHTPExjOSvSrH3ydjxVVKt1TuSRMHR1F4=; fh=G1r0sJ0F/0v82zumykPUwC7a5Du5vVkWNEWao5ifD3o=; b=k30APK6AQujuo9CcyQOhmWYqF3DGAI5GX2yJZLa3Du/NRaxYCIrt4CH8X+pAYc+44z uomo2pQgNkXej4lvSllfr90eJYKmHBhsEK39H7D4K0rSLCs3lvYqIsH8IRAawrxmOOOK OE0BIkCVS6icsrjnFLWCACQ1wohGVgBPANNR0X2SAFIJnTWTrZpHuhAup1sLC1oF5OmJ fEgumcc5Q0WJ3G+G+uGz9JMbmn0ppSkMuJzth/QO9pj1+kf0jk3J6ta8AO+V9v19fA2Z VOb6eQin8rxchVvTbV83KYE8n36mH1YJBc9Y2IuCHkudCd/mRSEGHWYPCce5e1rurvNa jcZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aBcol3Xj; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-146160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146160-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t30-20020a50d71e000000b0056e6b4ea654si5223326edi.110.2024.04.15.20.20.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 20:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aBcol3Xj; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-146160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146160-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id CB1761F22589 for ; Tue, 16 Apr 2024 03:20:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC83E381BA; Tue, 16 Apr 2024 03:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aBcol3Xj" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 96579199BC; Tue, 16 Apr 2024 03:20:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713237617; cv=none; b=htuqPApBxOhFh2NoxUn3rHMF4LIszBTb1WhPt+Ls/9fVMS+USWof+hsxNhcjjg+XygolAPrb6nx6CpKCGFbWv0VKQPS7UQIJ3MxcPqChXWmFofq5dNfrxOAowATMliRbOmBs8TMNTsn2BOhmsBoyqkLJhbkEmxkobg/5rubVkSs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713237617; c=relaxed/simple; bh=sJFW0ltM0O1BHkI+u582PzoUZyLLTIZYbeD8rl/i1fI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PDOyoiVswpiDiMaVDqbTlAgljGy556qA3yjBU0PQCyXw+aszRHUc9cEbfsdVaZbUig8iN9uLHO5Jm2AsfmUX6hHpaMLZm0KwpokF0y1NFWV44l5JHeip/0o5jo7+W9xiB/IlxG+zyad1KMhtlUA+3UrInir50Q3FbJyUi9V5lhU= 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=aBcol3Xj; arc=none smtp.client-ip=192.198.163.7 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=1713237616; x=1744773616; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sJFW0ltM0O1BHkI+u582PzoUZyLLTIZYbeD8rl/i1fI=; b=aBcol3XjGzHMi1X07Jv90PWUz8ljH3eNr1086cPfH5YzR9C9y7Rx0euJ kcxoiJZrXHopByDX2V1dSO8FM6VFeskZvK9vMRlJnYGX/FmPMh0Rn5kaP VJphWP+DCNHsCmkk5x3b/1JQsPcWadQupWAaMfbxWBIGWZ0F5HrnGdXFs DigKLhBT1VQ8/Ofp18ZlaVK8dSPQ6veOFDa7GH7ryKiuf6Y1RZeuYtxR2 Z5H7rk8mIojsUW37+U/S/YeOwwZ+JtjfRvAYj5vlZP88/egjovGu8yRil aKv6Aht5eJuCkIVU9AsOIcXrAKETebNYqryiheNwsCpvucobluhD/dvEP g==; X-CSE-ConnectionGUID: HOxi1cIIRpawlSLxsy9Vrg== X-CSE-MsgGUID: WpXh5EZ/QgKZhpR9Mu8S9A== X-IronPort-AV: E=McAfee;i="6600,9927,11045"; a="34043347" X-IronPort-AV: E=Sophos;i="6.07,204,1708416000"; d="scan'208";a="34043347" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2024 20:20:15 -0700 X-CSE-ConnectionGUID: F5LHHcV9RwqC3dChWwSpPg== X-CSE-MsgGUID: lh30yp3NQ6OvKyIFuzqoGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,204,1708416000"; d="scan'208";a="22193584" Received: from b4969161e530.jf.intel.com ([10.165.56.46]) by fmviesa008.fm.intel.com with ESMTP; 15 Apr 2024 20:20:14 -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 v12 04/14] cgroup/misc: Add SGX EPC resource type Date: Mon, 15 Apr 2024 20:20:01 -0700 Message-Id: <20240416032011.58578-5-haitao.huang@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240416032011.58578-1-haitao.huang@linux.intel.com> References: <20240416032011.58578-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 Content-Transfer-Encoding: 8bit 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 */ -- 2.25.1