Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1641924rdb; Wed, 31 Jan 2024 05:06:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1X0N+iTwI+rct5Y0eVGwarL6lJTQ1v6p2PcMlFDonlQvnXy9XMtfTvxHtc3xOcFYe7i61 X-Received: by 2002:a37:ef1a:0:b0:783:3cef:c885 with SMTP id j26-20020a37ef1a000000b007833cefc885mr4268607qkk.57.1706706392700; Wed, 31 Jan 2024 05:06:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706706392; cv=pass; d=google.com; s=arc-20160816; b=twOD6gEf+2+PMOZMyyNrS9WRTMvye53kwhU9SSz5zLTEkjzCgnLCn3lfLkIv+kkO/P 3QAsxW77LraCVB7e/l3p2QYUdkpgFP/9tDdVibyZJhM/9eDJxz4AIP8orQ/octP9G38Y ny1LAwSM4CWS/0n1GwttZCQCJL6tA8jlMybt5jD5IHEX7vzvafmDRySnYQ1AKPEpwrm3 /9d7LNvHWBvL/OOQl8IaAomaLcZhCaFoy/oVp+Ni/CozYR5sQmO2vHpcEtNb6xEDoV32 iZfe5LcqSZPdpN4FepadEp/X8AH6R7yt/waLY+I+KvaK0F8kTZ04dPL3hkGUhLqnVRxl Nuig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Eo2d3XIhJHR0ZGRCONem0K146DvMKXlOziPxo379KZU=; fh=U5fjvlsfEafnKBJLtmPKa0mANeuI7qYPzOuP7oVDuGc=; b=vnceoNBSDUsxCco2DTDZHeTmeNLKV1doc7PAtYQztB8ibWhCIMmx8PcHIMSc92Zixf EW/SnkuHgWP9lnG3HtrUmAJjGtEAFoAPFUuU3dKJsv+I9c8wPcxHPoWW6tiVJ0fDW7B2 Km7DvEPSOxnfKxT4iK1TC2PDUa6t9g2Si6/gQm1YX1FP3DgVTj67v1+9OlhfVnAeaad+ ZEJbwqiVIbjvqotl0niW2F7afRRJJGtpoxPKaif4fsUQquoF2V+TMQ0QNP0OZ1PMFwaX R1L3bheIediL1p1QUI8KksSHTOFBmr2CDnnKjCU+5EBM8uAq9FCRW07z/2CiOAoCDMMv EmBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=N9QLdKmY; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46459-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46459-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCVM6/iHYGKZTjHI6q/F/VX16IfeoPYe8VhVlG89VLqi1BvZAJZh8Z2eYJgm6nrfRkkGNM1vKSO4/EOQhHs0wRymhwvOXdzub7GbRCPd5w== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h6-20020a05620a13e600b00783ddf60e2fsi10831458qkl.208.2024.01.31.05.06.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 05:06:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46459-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=N9QLdKmY; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46459-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46459-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5DE6D1C218B4 for ; Wed, 31 Jan 2024 13:06:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9EA107A716; Wed, 31 Jan 2024 13:06:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="N9QLdKmY" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) (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 E6AB15A7A1 for ; Wed, 31 Jan 2024 13:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.115 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706706385; cv=none; b=iGL/fKYuAEuYCxs1PzjEazMp6KQzcB10XBbFvz0M4cenaR0YP3tZ5FUUmQ1mUJvLJ1PSNY6o/045I7quFIvwSfbU0UB4GzzuINc6tQpxIOEWFsJptB3wU1XxqzLM8TsjqHHSCoU14l0XNdOti3YDBsjwKZNGd8oHYax1Q3UPjis= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706706385; c=relaxed/simple; bh=GEGBOsy/KDcNncxgnTgbSSkW226Obrv2mcjzoIzZO1s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=W/ClD+muc0P5YFjx94ikovyZVaOg0YElN3CbQ/tUad9FaO466R2xD+UdbgM2JBrIKq8WxAVj+9t9PuOPcDCe689mpIozu3xsy2Y0FMd6qLHFtuSPyh40NCnKkpkkNoaGCCUJZQ/bpIVNV7Zg+SewHE1ZppNXMclB/TSSI7zmyx0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=N9QLdKmY; arc=none smtp.client-ip=192.55.52.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706706384; x=1738242384; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=GEGBOsy/KDcNncxgnTgbSSkW226Obrv2mcjzoIzZO1s=; b=N9QLdKmYuB2tvowGR0q10LWUom0mkMzTmII+qVaYpRb81Q8IJYru7XZK 4pLfTNuHhQRz1gq/02BqGlhW7zbjUcDefyPMHvb2vjiELf2tKUYZqe+ng EYYZLJmNAcJA6f/Wn3brHj44MMeLuvC+d51jRE1PSmfDUKRxozTPP2GP5 m24PP16CIkuX0IhAe5+V163AGU/7QNr9mALRuXnxQDDovi7mwvmaRWryL AWat4pNersXMasl7QcCrZ8JDwaChEN4AW1Gq9S7Q0ETsHxBXG6G7A7bF6 T+b970zq/lOrE/SJm+poeF6Lu78hwzHHAt0gnkyGnbIjbb5L01nA9j0JW Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="403216493" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="403216493" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 05:05:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="931835998" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="931835998" Received: from hmer-mobl.ger.corp.intel.com (HELO [10.251.217.183]) ([10.251.217.183]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 05:05:28 -0800 Message-ID: Date: Wed, 31 Jan 2024 14:05:04 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/6] sysfs: Introduce a mechanism to hide static attribute_groups To: Greg Kroah-Hartman , alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Dan Williams , Vinod Koul , Bard Liao , Sanyog Kale References: <2024013025-spoiling-exact-ad20@gregkh> <2024013028-deflator-flaring-ec62@gregkh> Content-Language: en-US From: Pierre-Louis Bossart In-Reply-To: <2024013028-deflator-flaring-ec62@gregkh> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/30/24 19:46, Greg Kroah-Hartman wrote: > From: Dan Williams > > Add a mechanism for named attribute_groups to hide their directory at > sysfs_update_group() time, or otherwise skip emitting the group > directory when the group is first registered. It piggybacks on > is_visible() in a similar manner as SYSFS_PREALLOC, i.e. special flags > in the upper bits of the returned mode. To use it, specify a symbol > prefix to DEFINE_SYSFS_GROUP_VISIBLE(), and then pass that same prefix > to SYSFS_GROUP_VISIBLE() when assigning the @is_visible() callback: > > DEFINE_SYSFS_GROUP_VISIBLE($prefix) > > struct attribute_group $prefix_group = { > .name = $name, > .is_visible = SYSFS_GROUP_VISIBLE($prefix), > }; > > SYSFS_GROUP_VISIBLE() expects a definition of $prefix_group_visible() > and $prefix_attr_visible(), where $prefix_group_visible() just returns > true / false and $prefix_attr_visible() behaves as normal. > > The motivation for this capability is to centralize PCI device > authentication in the PCI core with a named sysfs group while keeping > that group hidden for devices and platforms that do not meet the > requirements. In a PCI topology, most devices will not support > authentication, a small subset will support just PCI CMA (Component > Measurement and Authentication), a smaller subset will support PCI CMA + > PCIe IDE (Link Integrity and Encryption), and only next generation > server hosts will start to include a platform TSM (TEE Security > Manager). > > Without this capability the alternatives are: > > * Check if all attributes are invisible and if so, hide the directory. > Beyond trouble getting this to work [1], this is an ABI change for > scenarios if userspace happens to depend on group visibility absent any > attributes. I.e. this new capability avoids regression since it does > not retroactively apply to existing cases. > > * Publish an empty /sys/bus/pci/devices/$pdev/tsm/ directory for all PCI > devices (i.e. for the case when TSM platform support is present, but > device support is absent). Unfortunate that this will be a vestigial > empty directory in the vast majority of cases. > > * Reintroduce usage of runtime calls to sysfs_{create,remove}_group() > in the PCI core. Bjorn has already indicated that he does not want to > see any growth of pci_sysfs_init() [2]. > > * Drop the named group and simulate a directory by prefixing all > TSM-related attributes with "tsm_". Unfortunate to not use the naming > capability of a sysfs group as intended. > > In comparison, there is a small potential for regression if for some > reason an @is_visible() callback had dependencies on how many times it > was called. Additionally, it is no longer an error to update a group > that does not have its directory already present, and it is no longer a > WARN() to remove a group that was never visible. > > Link: https://lore.kernel.org/all/2024012321-envious-procedure-4a58@gregkh/ [1] > Link: https://lore.kernel.org/linux-pci/20231019200110.GA1410324@bhelgaas/ [2] > Signed-off-by: Dan Williams > Signed-off-by: Greg Kroah-Hartman This patch seems to introduce a regression on our Lunar Lake test devices, where we can't boot to an ssh shell. No issues on older devices [1]. Bard Liao and I reproduced the same results on different boards. We'll need to find someone with direct device access to provide more information on the problem, remote testing without ssh is a self-negating proposition. Is there a dependency on other patches? Our tests are still based on 6.7.0-rc3 due to other upstream issues we're currently working through. [1] https://github.com/thesofproject/linux/pull/4799