Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1056575rdb; Fri, 9 Feb 2024 09:01:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUjMyn5ou14c17bePLUX9TBmvjd3N8SDjmnI6lB4eKM5m8plaC51+y4RtAmmSJIfWTLQvoJRk/W7I80OTrGSpjf/fyJ5h9vEuZJpFHmrA== X-Google-Smtp-Source: AGHT+IF9AY/28+mlIDabeC0hwIXYRa4OJwRmpNIg3xz5lZ/vkS8Ff5q53lkxnrXo+2hk6BxQIf55 X-Received: by 2002:a05:6870:2012:b0:219:2865:24cd with SMTP id o18-20020a056870201200b00219286524cdmr2275275oab.24.1707498116211; Fri, 09 Feb 2024 09:01:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707498116; cv=pass; d=google.com; s=arc-20160816; b=ADG932t+9wHTbGAXY1XZAp1PcL7i8R0XHq5F3Z4B2La7iuusPhT1WXMGYLhHP1nugh l463NQIoH/rixyPGBUSRM09HelK0YRYov9vzB14hm8xiOkEBNtjhTeLRb8xOhhUp/SLE /XsqIPqoOUGYihkcBetZxyxXMpO0O+Lz/t7IUKaBTugeoq4hVyivdEp7MHwDx/ovHcW9 tuMuQlfjEkKC5NNC20zXOIm0TE5CDW7i9CxKvd83zjA37xsSGiwdfqUWwwiK8kCAnH+N zX3YT1zpjaiWI3Z9x3agWoAC+dw1W1T7Q8TsfHfQjsbdlX2IfXf05Rv7gtpoAlQwP/3e gM4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=iv56PqPnsvTXTwarveHsnRnFq5SGF+BFGaQ7j/GRxRk=; fh=FVciXTFuBZrSExpWp29plbyqLkExvd8IUrVgMyVxWt8=; b=Qgm269awBJzWVRBPXlCMvmHOSVaTCB/i56VYuYeQ5StEsEvgAsPWqk1XANZHXuAVLd fCT2mk/xO7T+KlcRBekTGwHC3VTdQDYByUZP2R4Z44yk+T7Z7+2fmCIw0c85ZjA086PS P3w8cXKMwj7nI+0YcOkAvJPwQqQ8Y2lrkYOEjSplA9MlFNOQaefD3yB8RmomdI0jcVmK uBY34pASp8QrG2pycWv7arcGiSTKLdinsE/l44x+kZV5w9+aFQLYm4YWRNSLUVdhw2S7 eF204zi1zdZUnGD6Vy5T2OpHS39MSZmAHuu+XiLPTT5tYqhsvsufNQcJNtVGsmHFL+iA 0Zug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=huopN3AH; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-59671-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59671-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCV7AQkBUmAWYsxwUKIrS0KoO2kzTdzXqILVLni6egMXJR92D7YJfecgPD1kVzbGWLM8/bJkGwTeUJo0AF7N2ak5JAUIQMUw6bSn3TGfEw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ti11-20020a056871890b00b0021a067d3ea0si828700oab.163.2024.02.09.09.01.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 09:01:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59671-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=huopN3AH; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-59671-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59671-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5120528583F for ; Fri, 9 Feb 2024 16:54:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2856A7BAF6; Fri, 9 Feb 2024 16:50:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="huopN3AH" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 59D1876415 for ; Fri, 9 Feb 2024 16:50:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707497404; cv=none; b=oGylf/0KzJJdXesgUyOi8xM/iNCBOVBIv0RqlRw0Vqd8kZB20W5ulPHqLjNVEee6ovMbc9f0WX7n+3ckfCR0k83x+wY0O67rghbri/pFQFphLbDjiokx6L7yjPtNUJ43ONbsSth85y/JrjAaBYXo7M67cbgVWC43NFjq0oEgjfs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707497404; c=relaxed/simple; bh=lcEncMjWx1cHj3mi+d6/pRmr14bUoDw+wvvYprditqk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TbePpbj74JH+aVyARILMQNyQwS7YOmH1jc5++8HhujdW3eSJ6EDBZXgCMSxljmWloNXB/IvtjsRUvsuyCs8mv4W3cLefSjs6kXLx4JIC4oYxE2psW7aRN+Ku1qJVpZV74PnmAhYFt7cMH5ZHROA9QoNstYKFgPIKPsCMyL+rTTY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=huopN3AH; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707497401; h=from:from: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; bh=iv56PqPnsvTXTwarveHsnRnFq5SGF+BFGaQ7j/GRxRk=; b=huopN3AH0CGe1fN7lpVFAmoVawQTr7MEbV04Lf27vCCKXwQIQcrBaDFcPSWMO9Rp7FqpLQ mnasFEyw152eadu4cpPt/ZR5w/Rp0+VSAtDsmtU2S7YRursqWuWhIGE8+RCibY4sJhbchX zc3ExaVju5i57fTodTM1/W4elUhLxRg= Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-663--pvn5MnoMbm5fuS_HsDE7w-1; Fri, 09 Feb 2024 11:49:59 -0500 X-MC-Unique: -pvn5MnoMbm5fuS_HsDE7w-1 Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-5cec090b2bdso1039341a12.0 for ; Fri, 09 Feb 2024 08:49:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707497399; x=1708102199; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iv56PqPnsvTXTwarveHsnRnFq5SGF+BFGaQ7j/GRxRk=; b=fv4CpdRmfvOxRwObVlQUI4FRePSd1vrIu0yCTHF6sA5QEhtYwm2KicocWAbFPF3B37 8Ug90FnsWZBSeGcW0wlbg09eNWfyL5+jm9noW/SSjMHY9tYQd3emVZfvgX4OYKr0ea3b WzMU7aaEhLurlejf8uBa5xJC+h865w29hcC48b3K4sdhTibUC+6eeAut/GbuafhVyEMr htdUYhCKUr4y3BtUfcyRYsOhNMUo+a3D5mKHTse+McAC73lgvgLmEhDDTg+aKEMC+9tz UDmfT/4urH2VKn7IviQ+5RisM3gtcq126vYUseVzFLgzEvNfHXm2BJRrfTlLO/Fhz+8/ 9EvQ== X-Forwarded-Encrypted: i=1; AJvYcCWNEU39WhLZDhtim+kXJeCxrDxwEuP417p+wpqM0SqiU3zRVfGSwse3ta3fEU7H79EmLsGElwp6wLMGnZkp1obj1YIbVCyc54rsJoWb X-Gm-Message-State: AOJu0Yz4KkB5Til2/sJIWQb6Vx5SZjW7lWbzwcJw1IR3pM/LoN60NjRa aiDwkoDlhzoxXtnapVHF3qb2A+gtl1jHpmUg750rqAX5OL25EM7+WbBXuEAqROEUPr6CAwH2fzl cWTxkmuq2o4ststNVJs68YDvebpZMwZLIxMWBKH+tODXQEUCsDJPmpE9fcOuXkw4gzpDePUzdjs 4yKXbefq7MDudqkM7elk+s+iQDTdYVlSsIecCB X-Received: by 2002:a17:90b:4014:b0:295:fe86:ad25 with SMTP id ie20-20020a17090b401400b00295fe86ad25mr2139894pjb.36.1707497398794; Fri, 09 Feb 2024 08:49:58 -0800 (PST) X-Received: by 2002:a17:90b:4014:b0:295:fe86:ad25 with SMTP id ie20-20020a17090b401400b00295fe86ad25mr2139878pjb.36.1707497398427; Fri, 09 Feb 2024 08:49:58 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240209163454.98051-1-srinivas.kandagatla@linaro.org> In-Reply-To: <20240209163454.98051-1-srinivas.kandagatla@linaro.org> From: Eric Curtin Date: Fri, 9 Feb 2024 16:49:22 +0000 Message-ID: Subject: Re: [PATCH] nvmem: include bit index in cell sysfs file name To: srinivas.kandagatla@linaro.org Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, Arnd Bergmann , regressions@lists.linux.dev, Miquel Raynal , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Chen-Yu Tsai , asahi@lists.linux.dev, Sven Peter Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 9 Feb 2024 at 16:43, wrote: > > From: Arnd Bergmann > > Creating sysfs files for all Cells caused a boot failure for linux-6.8-rc= 1 on > Apple M1, which (in downstream dts files) has multiple nvmem cells that u= se the > same byte address. This causes the device probe to fail with > > [ 0.605336] sysfs: cannot create duplicate filename '/devices/platform= /soc@200000000/2922bc000.efuse/apple_efuses_nvmem0/cells/efuse@a10' > [ 0.605347] CPU: 7 PID: 1 Comm: swapper/0 Tainted: G S = 6.8.0-rc1-arnd-5+ #133 > [ 0.605355] Hardware name: Apple Mac Studio (M1 Ultra, 2022) (DT) > [ 0.605362] Call trace: > [ 0.605365] show_stack+0x18/0x2c > [ 0.605374] dump_stack_lvl+0x60/0x80 > [ 0.605383] dump_stack+0x18/0x24 > [ 0.605388] sysfs_warn_dup+0x64/0x80 > [ 0.605395] sysfs_add_bin_file_mode_ns+0xb0/0xd4 > [ 0.605402] internal_create_group+0x268/0x404 > [ 0.605409] sysfs_create_groups+0x38/0x94 > [ 0.605415] devm_device_add_groups+0x50/0x94 > [ 0.605572] nvmem_populate_sysfs_cells+0x180/0x1b0 > [ 0.605682] nvmem_register+0x38c/0x470 > [ 0.605789] devm_nvmem_register+0x1c/0x6c > [ 0.605895] apple_efuses_probe+0xe4/0x120 > [ 0.606000] platform_probe+0xa8/0xd0 > > As far as I can tell, this is a problem for any device with multiple cell= s on > different bits of the same address. Avoid the issue by changing the file = name > to include the first bit number. > > Fixes: 0331c611949f ("nvmem: core: Expose cells through sysfs") > Link: https://github.com/AsahiLinux/linux/blob/bd0a1a7d4/arch/arm64/boot/= dts/apple/t600x-dieX.dtsi#L156 > Cc: regressions@lists.linux.dev > Cc: Miquel Raynal > Cc: Rafa=C5=82 Mi=C5=82ecki > Cc: Chen-Yu Tsai > Cc: Srinivas Kandagatla > Cc: Greg Kroah-Hartman > Cc: asahi@lists.linux.dev > Cc: Sven Peter > Signed-off-by: Arnd Bergmann > Signed-off-by: Srinivas Kandagatla Seems reasonable to me. Reviewed-by: Eric Curtin Is mise le meas/Regards, Eric Curtin > --- > Hi Greg, > > Here is a fix in nvmem for 6.8, could you queue these for next possible r= c. > > Did not cc Stable as this is only targeted for 6.8 and no backporting is > required. > > Thanks, > Srini > > Documentation/ABI/testing/sysfs-nvmem-cells | 16 ++++++++-------- > drivers/nvmem/core.c | 5 +++-- > 2 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-nvmem-cells b/Documentation/= ABI/testing/sysfs-nvmem-cells > index 7af70adf3690..c7c9444f92a8 100644 > --- a/Documentation/ABI/testing/sysfs-nvmem-cells > +++ b/Documentation/ABI/testing/sysfs-nvmem-cells > @@ -4,18 +4,18 @@ KernelVersion: 6.5 > Contact: Miquel Raynal > Description: > The "cells" folder contains one file per cell exposed by = the > - NVMEM device. The name of the file is: @, wi= th > - being the cell name and its location in th= e NVMEM > - device, in hexadecimal (without the '0x' prefix, to mimic= device > - tree node names). The length of the file is the size of t= he cell > - (when known). The content of the file is the binary conte= nt of > - the cell (may sometimes be ASCII, likely without trailing > - character). > + NVMEM device. The name of the file is: "@,", > + with being the cell name and its location = in > + the NVMEM device, in hexadecimal bytes and bits (without = the > + '0x' prefix, to mimic device tree node names). The length= of > + the file is the size of the cell (when known). The conten= t of > + the file is the binary content of the cell (may sometimes= be > + ASCII, likely without trailing character). > Note: This file is only present if CONFIG_NVMEM_SYSFS > is enabled. > > Example:: > > - hexdump -C /sys/bus/nvmem/devices/1-00563/cells/product= -name@d > + hexdump -C /sys/bus/nvmem/devices/1-00563/cells/product= -name@d,0 > 00000000 54 4e 34 38 4d 2d 50 2d 44 4e |TN48M= -P-DN| > 0000000a > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > index 980123fb4dde..eb357ac2e54a 100644 > --- a/drivers/nvmem/core.c > +++ b/drivers/nvmem/core.c > @@ -460,8 +460,9 @@ static int nvmem_populate_sysfs_cells(struct nvmem_de= vice *nvmem) > list_for_each_entry(entry, &nvmem->cells, node) { > sysfs_bin_attr_init(&attrs[i]); > attrs[i].attr.name =3D devm_kasprintf(&nvmem->dev, GFP_KE= RNEL, > - "%s@%x", entry->name, > - entry->offset); > + "%s@%x,%x", entry->na= me, > + entry->offset, > + entry->bit_offset); > attrs[i].attr.mode =3D 0444; > attrs[i].size =3D entry->bytes; > attrs[i].read =3D &nvmem_cell_attr_read; > -- > 2.25.1 > >