From patchwork Tue Nov 8 17:26:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 13036625 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 18688C433FE for ; Tue, 8 Nov 2022 17:28:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233789AbiKHR2D (ORCPT ); Tue, 8 Nov 2022 12:28:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234476AbiKHR1m (ORCPT ); Tue, 8 Nov 2022 12:27:42 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28EAF60EA0 for ; Tue, 8 Nov 2022 09:27:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667928442; x=1699464442; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n0/pcbE4ZjVgwMg1SOoK/dovZj1TG14tnk/8bsTdTDI=; b=GpgF8hHieYOVhC+L/93oZb6vCRpOQJNl4NVptQFfIZ5bXtbayv98p0ob 6WGvKCuBxNjOHUkriMkav2tB5agfSG3E9oQJ+5j+/xR+pDI2VdEHC768H HecR4mu6bZMvmhkB8ezvOzSBLdqHe7Ym1g2Wh1MAU7u96Q5HIxwTdqh/p WWhbnx5zyXgc9FaWImRRQ+cPQtD44pkaYC8c0U0/zYzSQs2x96aSyscMl hU08WRvCY2pLvaUDuq+adk5Ig4Gdm58FhKbcorY/MuXiShFgnuiWWnU1V eGQumRCTNKARz6wKIMptAJvmsmAka7YDRRMwObZfLtNDsm+3Z08bn9T2l A==; X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="311913993" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="311913993" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 09:26:55 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="705378666" X-IronPort-AV: E=Sophos;i="5.96,148,1665471600"; d="scan'208";a="705378666" Received: from djiang5-desk3.ch.intel.com ([143.182.136.137]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 09:26:54 -0800 Subject: [PATCH v3 16/18] cxl/pmem: add provider name to cxl pmem dimm attribute group From: Dave Jiang To: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev Cc: dan.j.williams@intel.com, ira.weiny@intel.com, vishal.l.verma@intel.com, alison.schofield@intel.com, Jonathan.Cameron@huawei.com, dave@stgolabs.net Date: Tue, 08 Nov 2022 10:26:54 -0700 Message-ID: <166792841412.3767969.837651453603473607.stgit@djiang5-desk3.ch.intel.com> In-Reply-To: <166792815961.3767969.2621677491424623673.stgit@djiang5-desk3.ch.intel.com> References: <166792815961.3767969.2621677491424623673.stgit@djiang5-desk3.ch.intel.com> User-Agent: StGit/1.4 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Add provider name in order to associate cxl test dimm from cxl_test to the cxl pmem device when going through sysfs for security testing. Signed-off-by: Dave Jiang Reviewed-by: Jonathan Cameron --- Documentation/ABI/testing/sysfs-bus-nvdimm | 6 ++++++ drivers/cxl/pmem.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-nvdimm b/Documentation/ABI/testing/sysfs-bus-nvdimm index 91945211e53b..d78e4553d9af 100644 --- a/Documentation/ABI/testing/sysfs-bus-nvdimm +++ b/Documentation/ABI/testing/sysfs-bus-nvdimm @@ -47,3 +47,9 @@ Date: November 2022 KernelVersion: 6.2 Contact: Dave Jiang Description: (RO) Show the id (serial) of the device. + +What: /sys/bus/nd/devices/nmemX/provider +Date: November 2022 +KernelVersion: 6.2 +Contact: Dave Jiang +Description: (RO) Shows the provider for the device. (i.e. ACPI.NFIT, ACPI.CXL) diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c index 9209c7dd72d0..322f834cc27d 100644 --- a/drivers/cxl/pmem.c +++ b/drivers/cxl/pmem.c @@ -48,6 +48,15 @@ static void unregister_nvdimm(void *nvdimm) cxl_nvd->bridge = NULL; } +static ssize_t provider_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct nvdimm *nvdimm = to_nvdimm(dev); + struct cxl_nvdimm *cxl_nvd = nvdimm_provider_data(nvdimm); + + return sysfs_emit(buf, "%s\n", dev_name(&cxl_nvd->dev)); +} +static DEVICE_ATTR_RO(provider); + static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf) { struct nvdimm *nvdimm = to_nvdimm(dev); @@ -60,6 +69,7 @@ static DEVICE_ATTR_RO(id); static struct attribute *cxl_dimm_attributes[] = { &dev_attr_id.attr, + &dev_attr_provider.attr, NULL };