Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 9BF9615990C for ; Fri, 30 May 2025 20:34:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748637273; cv=none; b=KTxK9eod6Qpn00Fg3J6Sb/8Ufalbh2w4wS1uCXnW3u5/JVcWmGDqXBDL04NIfRRP7OyvYU48j/eLNoBENcE3tuax8CzsrAOdAtSf7J5KqhxNW9yEOLSIyzGnWzgS8nAHpvJlvfScLpVvCv1BUkD8sKNMvOOhHa4ZEmFeGCK4scQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748637273; c=relaxed/simple; bh=V0cRuTqCcDsiblitVsaOLoYDNL8Po7arWi43KEasI2M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LnkUJfrGCwMQqEMjdzWuypvUSpuhqQwIT8qtIwp6sPoP++okyDPOUUT3pnKB2ThQdy3DZE60Tv6fvcApydmo2oVdAim7Wt2Vm2b0+SZFnI6BwgEZeFc5Xh94AUYLnvIWioTqoNBs7t34CJzWsEIVlqmmkYg3xMhuI3jUydFVhPE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=F+2XVRiv; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="F+2XVRiv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1748637271; x=1780173271; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V0cRuTqCcDsiblitVsaOLoYDNL8Po7arWi43KEasI2M=; b=F+2XVRiv3wDQBRlqsAAC3hfaMNpKcrCRs2mB1zeLZkD9dML7VNH7lxSO /HswVA/no9RqDpxMJw+k7najF1Cj6VkpcDhmszcS0WV18/BgYdh9RzJGE xwA/ojLXGGvQtHd6YqI0QN5hCLmtLybdlX3xeHgP5551V+tuksoliZou0 NDU0raER8pbj9bDbvxrWB+vUCnGXiILiYJcfWw10lqIEOHjWKVvzmo/Ct Rn9KCFrVpnsLdWVVlmBABkg20DTFBIYhKZBrmBjZtobLjTCR/cG3B+agr IyRfPJn3kkRUaOrs0lBs+Ky+GN2/rmDf1qulDxicg377CXj4JHxTswV5K g==; X-CSE-ConnectionGUID: 7K455DCvQmigSVPxlHnW3Q== X-CSE-MsgGUID: LJqaVkmES1+a1AnxAPFUsw== X-IronPort-AV: E=McAfee;i="6700,10204,11449"; a="54405784" X-IronPort-AV: E=Sophos;i="6.16,196,1744095600"; d="scan'208";a="54405784" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2025 13:34:31 -0700 X-CSE-ConnectionGUID: er+8+lccT+uJy9c1E0ToJg== X-CSE-MsgGUID: pfh3CkirRLebyKRdqChZ1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,196,1744095600"; d="scan'208";a="149246680" Received: from mjruhl-desk.amr.corp.intel.com (HELO mjruhl-desk.intel.com) ([10.124.223.23]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2025 13:34:30 -0700 From: "Michael J. Ruhl" To: platform-driver-x86@vger.kernel.org, intel-xe@lists.freedesktop.org, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, lucas.demarchi@intel.com, rodrigo.vivi@intel.com Cc: "Michael J. Ruhl" Subject: [PATCH 06/10] platform/x86/intel/pmt: decouple sysfs and namespace Date: Fri, 30 May 2025 16:33:43 -0400 Message-ID: <20250530203356.190234-6-michael.j.ruhl@intel.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250530203356.190234-1-michael.j.ruhl@intel.com> References: <20250530203356.190234-1-michael.j.ruhl@intel.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PMT namespace includes the crashlog sysfs attribute information. Other crashlog version/types may need different sysfs attributes. Coupling the attributes with the namespace blocks this usage. Decouple sysfs attributes from the name space and add them to the specific entry. Reviewed-by: Ilpo Järvinen Signed-off-by: Michael J. Ruhl --- drivers/platform/x86/intel/pmt/class.c | 12 ++++++------ drivers/platform/x86/intel/pmt/class.h | 2 +- drivers/platform/x86/intel/pmt/crashlog.c | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c index bba552131bc2..880baf02a985 100644 --- a/drivers/platform/x86/intel/pmt/class.c +++ b/drivers/platform/x86/intel/pmt/class.c @@ -329,8 +329,8 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry, entry->kobj = &dev->kobj; - if (ns->attr_grp) { - ret = sysfs_create_group(entry->kobj, ns->attr_grp); + if (entry->attr_grp) { + ret = sysfs_create_group(entry->kobj, entry->attr_grp); if (ret) goto fail_sysfs_create_group; } @@ -371,8 +371,8 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry, fail_add_endpoint: sysfs_remove_bin_file(entry->kobj, &entry->pmt_bin_attr); fail_ioremap: - if (ns->attr_grp) - sysfs_remove_group(entry->kobj, ns->attr_grp); + if (entry->attr_grp) + sysfs_remove_group(entry->kobj, entry->attr_grp); fail_sysfs_create_group: device_unregister(dev); fail_dev_create: @@ -414,8 +414,8 @@ void intel_pmt_dev_destroy(struct intel_pmt_entry *entry, if (entry->size) sysfs_remove_bin_file(entry->kobj, &entry->pmt_bin_attr); - if (ns->attr_grp) - sysfs_remove_group(entry->kobj, ns->attr_grp); + if (entry->attr_grp) + sysfs_remove_group(entry->kobj, entry->attr_grp); device_unregister(dev); xa_erase(ns->xa, entry->devid); diff --git a/drivers/platform/x86/intel/pmt/class.h b/drivers/platform/x86/intel/pmt/class.h index d2d8f9e31c9d..a44571c09253 100644 --- a/drivers/platform/x86/intel/pmt/class.h +++ b/drivers/platform/x86/intel/pmt/class.h @@ -47,6 +47,7 @@ struct intel_pmt_entry { struct class_endpoint *ep; struct intel_pmt_header header; struct bin_attribute pmt_bin_attr; + const struct attribute_group *attr_grp; struct kobject *kobj; void __iomem *disc_table; void __iomem *base; @@ -60,7 +61,6 @@ struct intel_pmt_entry { struct intel_pmt_namespace { const char *name; struct xarray *xa; - const struct attribute_group *attr_grp; int (*pmt_header_decode)(struct intel_pmt_entry *entry, struct device *dev); int (*pmt_add_endpoint)(struct intel_vsec_device *ivdev, diff --git a/drivers/platform/x86/intel/pmt/crashlog.c b/drivers/platform/x86/intel/pmt/crashlog.c index 94858bfb52f8..09cd0a1346f3 100644 --- a/drivers/platform/x86/intel/pmt/crashlog.c +++ b/drivers/platform/x86/intel/pmt/crashlog.c @@ -241,6 +241,8 @@ static int pmt_crashlog_header_decode(struct intel_pmt_entry *entry, /* Size is measured in DWORDS, but accessor returns bytes */ header->size = GET_SIZE(readl(disc_table + SIZE_OFFSET)); + entry->attr_grp = &pmt_crashlog_group; + return 0; } @@ -248,7 +250,6 @@ static DEFINE_XARRAY_ALLOC(crashlog_array); static struct intel_pmt_namespace pmt_crashlog_ns = { .name = "crashlog", .xa = &crashlog_array, - .attr_grp = &pmt_crashlog_group, .pmt_header_decode = pmt_crashlog_header_decode, .pmt_add_endpoint = intel_pmt_add_endpoint, }; -- 2.49.0