From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 CCEEE3D97; Wed, 13 Apr 2022 18:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649875098; x=1681411098; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x8b/LibVqBx1G9rOTQThgsQbECDv7IbBtNdHI9yYHsw=; b=X+CM8J9Vqot2rvwhB3DUnZXtTupHUmj6MqyhY7lvrCBISnIE+a5V9qup DrSuKR7t3zvF/wxQN1LjLe3dQknxTJy0dRqO6SwIk1XqPdlatgAZL7Pjs wXymvc0o/4oTUu7HLkfNpX+Lmavt7rEyU4b2EpLLe4ctsFsd7gbUVSZz0 q7Pr5SeRhTgNwLS17HCGxb34exOCfHWfSwqM1wUHNTrn2+r9fp6BeAIgV Xk5ZZrPRcYxLJWnGwsOEY5EqZzS9U4Z1qSTsrxCUhbFS+t+/nLAUVMccV 0G8OfXqDRRVuIHniMokVSEqSG4aQE9O2/K5AHjR8gXeIZhEZa3e7EmnIN A==; X-IronPort-AV: E=McAfee;i="6400,9594,10316"; a="244631861" X-IronPort-AV: E=Sophos;i="5.90,257,1643702400"; d="scan'208";a="244631861" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 11:37:51 -0700 X-IronPort-AV: E=Sophos;i="5.90,257,1643702400"; d="scan'208";a="725013632" Received: from sushobhi-mobl.amr.corp.intel.com (HELO localhost.localdomain) ([10.252.131.238]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 11:37:51 -0700 From: Ben Widawsky To: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev Cc: patches@lists.linux.dev, Ben Widawsky , Alison Schofield , Dan Williams , Ira Weiny , Jonathan Cameron , Vishal Verma Subject: [RFC PATCH 13/15] cxl/core/port: Add attrs for root ways & granularity Date: Wed, 13 Apr 2022 11:37:18 -0700 Message-Id: <20220413183720.2444089-14-ben.widawsky@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220413183720.2444089-1-ben.widawsky@intel.com> References: <20220413183720.2444089-1-ben.widawsky@intel.com> Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Region programming requires knowledge of root decoder attributes. For example, if the root decoder supports only 256b granularity then a region with > 256b granularity cannot work. Add sysfs attributes in order to provide this information to userspace. The CXL driver controls programming of switch and endpoint decoders, but the attributes are also exported for informational purposes. Signed-off-by: Ben Widawsky --- drivers/cxl/core/port.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 5ef8a6e1ea23..19cf1fd16118 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -318,10 +318,31 @@ static ssize_t target_list_show(struct device *dev, } static DEVICE_ATTR_RO(target_list); +static ssize_t interleave_granularity_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct cxl_decoder *cxld = to_cxl_decoder(dev); + + return sysfs_emit(buf, "%d\n", cxld->interleave_granularity); +} +static DEVICE_ATTR_RO(interleave_granularity); + +static ssize_t interleave_ways_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct cxl_decoder *cxld = to_cxl_decoder(dev); + + return sysfs_emit(buf, "%d\n", cxld->interleave_ways); +} +static DEVICE_ATTR_RO(interleave_ways); + static struct attribute *cxl_decoder_base_attrs[] = { &dev_attr_start.attr, &dev_attr_size.attr, &dev_attr_locked.attr, + &dev_attr_interleave_granularity.attr, + &dev_attr_interleave_ways.attr, NULL, }; -- 2.35.1