From patchwork Mon Mar 27 21:46:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 667933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E05FFC77B6C for ; Mon, 27 Mar 2023 21:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232153AbjC0Vqe (ORCPT ); Mon, 27 Mar 2023 17:46:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232479AbjC0VqS (ORCPT ); Mon, 27 Mar 2023 17:46:18 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 131AA2D51; Mon, 27 Mar 2023 14:46:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679953578; x=1711489578; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qMzu4nCtJ++Zi0nLNXxEMdOYChBih0KqyaTouorlZiU=; b=WSdtDeuF/f6eXksYRMQJTDHfr7KdS6077czsaJqcCy2pNLRiwn8rQpM8 KtWPTcOABmWGeQplqchM/DMs1Fpr41JSlkaoQDY/TLF1kOUSDSo6llRAu RgfABcqZiMUILtbWuxWRPlhpeLHLVhwfea0Ur2PWZhBBEd9U9f7aL3xcz IjzhdDaiRvbXsTuLmBZ0nnb8buRHw12TBxxW0NMqJUnG/1GrbfFso1OXF sBCq3VzUKYTc1aaSTNPakkEk88HfRG0vLD6jn3Y82St+hCSM1LQHF74EW ANoeRurcp8Zjd38qHFYIn51Hr82kzdCBno8kcq+KygkHV95BXz2u1w9dc A==; X-IronPort-AV: E=McAfee;i="6600,9927,10662"; a="337900415" X-IronPort-AV: E=Sophos;i="5.98,295,1673942400"; d="scan'208";a="337900415" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2023 14:46:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10662"; a="686114814" X-IronPort-AV: E=Sophos;i="5.98,295,1673942400"; d="scan'208";a="686114814" Received: from djiang5-mobl3.amr.corp.intel.com (HELO [192.168.1.177]) ([10.212.91.66]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2023 14:46:12 -0700 Subject: [PATCH v2 21/21] cxl/mem: Add debugfs output for QTG related data From: Dave Jiang To: linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Dan Williams , dan.j.williams@intel.com, ira.weiny@intel.com, vishal.l.verma@intel.com, alison.schofield@intel.com, rafael@kernel.org, lukas@wunner.de Date: Mon, 27 Mar 2023 14:46:11 -0700 Message-ID: <167995357195.2857312.5279274659737251140.stgit@djiang5-mobl3> In-Reply-To: <167995336797.2857312.539473939839316778.stgit@djiang5-mobl3> References: <167995336797.2857312.539473939839316778.stgit@djiang5-mobl3> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Add debugfs output to /sys/kernel/debug/cxl/memX/qtgmap The debugfs attribute will dump out all the DSMAS ranges and the associated QTG ID exported by the CXL device CDAT. Suggested-by: Dan Williams Signed-off-by: Dave Jiang --- drivers/cxl/mem.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c index 39c4b54f0715..bf2cb5a54a7f 100644 --- a/drivers/cxl/mem.c +++ b/drivers/cxl/mem.c @@ -45,6 +45,21 @@ static int cxl_mem_dpa_show(struct seq_file *file, void *data) return 0; } +static int cxl_mem_qtg_show(struct seq_file *file, void *data) +{ + struct device *dev = file->private; + struct cxl_memdev *cxlmd = to_cxl_memdev(dev); + struct qos_prop_entry *qos; + + list_for_each_entry(qos, &cxlmd->qos_list, list) { + seq_printf(file, "%08llx-%08llx : QTG ID %u\n", + qos->dpa_range.start, qos->dpa_range.end, + qos->qtg_id); + } + + return 0; +} + static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, struct cxl_dport *parent_dport) { @@ -117,6 +132,7 @@ static int cxl_mem_probe(struct device *dev) dentry = cxl_debugfs_create_dir(dev_name(dev)); debugfs_create_devm_seqfile(dev, "dpamem", dentry, cxl_mem_dpa_show); + debugfs_create_devm_seqfile(dev, "qtgmap", dentry, cxl_mem_qtg_show); rc = devm_add_action_or_reset(dev, remove_debugfs, dentry); if (rc) return rc;