From patchwork Fri Feb 10 09:05:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 13135551 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FAE2C05027 for ; Fri, 10 Feb 2023 09:05:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB7246B0112; Fri, 10 Feb 2023 04:05:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D66CE6B011A; Fri, 10 Feb 2023 04:05:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2F286B011C; Fri, 10 Feb 2023 04:05:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9C7E66B0112 for ; Fri, 10 Feb 2023 04:05:51 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4A48916150C for ; Fri, 10 Feb 2023 09:05:51 +0000 (UTC) X-FDA: 80450799702.10.FBE7C41 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by imf16.hostedemail.com (Postfix) with ESMTP id EB3CA180018 for ; Fri, 10 Feb 2023 09:05:48 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=aiEEDLlS; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf16.hostedemail.com: domain of dan.j.williams@intel.com designates 134.134.136.24 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676019949; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0su2l4GKACBH+3TpTGM2GIGa+tzyjdoHTwfxlcXxQzk=; b=U8TGKj74/r7UJQMdfekE13t3iH48IXispEZNKAyd76tc6kBNnXYlS8rMkiCQ44wXFg5wID W/Qj2CNoK+Zu4lRSCRO9TJ0ThwadWZ6hBMM2I8iXWhcWY5Sl9WFyjQROyIGud7MMAxPTsG SPAODX/Wsy6G/DGGxXF/kg+wLxXBSNY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=aiEEDLlS; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf16.hostedemail.com: domain of dan.j.williams@intel.com designates 134.134.136.24 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676019949; a=rsa-sha256; cv=none; b=QOiyLRxiX5g677O0Zsu/QAEaOc29cgKiw7/xFShgW/NTGDH0WXrieJjuVK3yDcXLtpLbqz XcCh5GOHA5zQrOrbe2TsRdu/N/r3m8dWWl6b7Jp5Ij/wa4/a5gVC03wijCy35SX8D0WouM y/g8iCE1FshtYWU2qTLJCUAOAMDOCCc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676019949; x=1707555949; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8rEeQZ+8vrd28/mihuN4IYSQYwRcfCWFNTCZHITf2LM=; b=aiEEDLlSU9gpv+tfe7MUjllV3cHt0ej4WUjpqZWWReRVqT7spfJAU53r 6A1htXMWmN1/QgjtRENRa7m5Kd/C4MlvMxq2vPG/Z42r2FusqFZOtFsFS bewJFDoMQCZ8DaSDSSPiQX/XTbRVevSENtWUmQXTzjhxZ/p80pBT/in7w inF6wK9L/8K0u3cI+1YFG9+0RCerCHoWy/DkARjmtqCcEF3YjR1PAJGZa BEPCQSL/wpih7xLl0tSIFa+H/IAdVAoRp2SHdCm54akbsqTZiKX98qqoW e1XCWytGoQNLVPC0E/4O+VvTRPb1kunmlW+FGBytXGwUHEfs+Vt/1F958 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="331677061" X-IronPort-AV: E=Sophos;i="5.97,286,1669104000"; d="scan'208";a="331677061" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2023 01:05:46 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="698364566" X-IronPort-AV: E=Sophos;i="5.97,286,1669104000"; d="scan'208";a="698364566" Received: from hrchavan-mobl.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.46.42]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2023 01:05:45 -0800 Subject: [PATCH v2 04/20] cxl/region: Support empty uuids for non-pmem regions From: Dan Williams To: linux-cxl@vger.kernel.org Cc: Vishal Verma , Fan Ni , dave.hansen@linux.intel.com, linux-mm@kvack.org, linux-acpi@vger.kernel.org Date: Fri, 10 Feb 2023 01:05:45 -0800 Message-ID: <167601994558.1924368.12612811533724694444.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <167601992097.1924368.18291887895351917895.stgit@dwillia2-xfh.jf.intel.com> References: <167601992097.1924368.18291887895351917895.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: EB3CA180018 X-Stat-Signature: r61pasw8bsxxphpb4pkz5rbbr599mt7o X-HE-Tag: 1676019948-412488 X-HE-Meta: U2FsdGVkX19qckoILHIqIifMT8m5JgpAFQjPNruu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4e/VmaFX0RjQPqgZX0qedwlAl7/5F6Pjr3/c4u87TW9eqv5xjum4O70aSx1+EsS/DwfJ7B9HW550ewBjAK3fm7NsunbJa0HjWRJchXG30rZPteXf2R5J6nK5IdJApSVa6QTdesWbCmwCPKfp/bHDzWQvpPXOrgfKbiQqc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Shipping versions of the cxl-cli utility expect all regions to have a 'uuid' attribute. In preparation for 'ram' regions, update the 'uuid' attribute to return an empty string which satisfies the current expectations of 'cxl list -R'. Otherwise, 'cxl list -R' fails in the presence of regions with the 'uuid' attribute missing. Force the attribute to be read-only as there is no facility or expectation for a 'ram' region to recall its uuid from one boot to the next. Reviewed-by: Vishal Verma Tested-by: Fan Ni Link: https://lore.kernel.org/r/167564536587.847146.12703125206459604597.stgit@dwillia2-xfh.jf.intel.com Signed-off-by: Dan Williams Reviewed-by: Jonathan Cameron Reviewed-by: Ira Weiny --- Documentation/ABI/testing/sysfs-bus-cxl | 3 ++- drivers/cxl/core/region.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl index 058b0c45001f..4c4e1cbb1169 100644 --- a/Documentation/ABI/testing/sysfs-bus-cxl +++ b/Documentation/ABI/testing/sysfs-bus-cxl @@ -317,7 +317,8 @@ Contact: linux-cxl@vger.kernel.org Description: (RW) Write a unique identifier for the region. This field must be set for persistent regions and it must not conflict with the - UUID of another region. + UUID of another region. For volatile ram regions this + attribute is a read-only empty string. What: /sys/bus/cxl/devices/regionZ/interleave_granularity diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 17d2d0c12725..0fc80478ff6b 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -45,7 +45,10 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *attr, rc = down_read_interruptible(&cxl_region_rwsem); if (rc) return rc; - rc = sysfs_emit(buf, "%pUb\n", &p->uuid); + if (cxlr->mode != CXL_DECODER_PMEM) + rc = sysfs_emit(buf, "\n"); + else + rc = sysfs_emit(buf, "%pUb\n", &p->uuid); up_read(&cxl_region_rwsem); return rc; @@ -300,8 +303,12 @@ static umode_t cxl_region_visible(struct kobject *kobj, struct attribute *a, struct device *dev = kobj_to_dev(kobj); struct cxl_region *cxlr = to_cxl_region(dev); + /* + * Support tooling that expects to find a 'uuid' attribute for all + * regions regardless of mode. + */ if (a == &dev_attr_uuid.attr && cxlr->mode != CXL_DECODER_PMEM) - return 0; + return 0444; return a->mode; }