Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp429232ybr; Fri, 22 May 2020 09:56:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsjblKx0zJFuWKcALBVQVXlwW7bJTtnYJgEXc7u4FXfAplvetGVws6upA1WLrOf49/6EhJ X-Received: by 2002:a50:b586:: with SMTP id a6mr3647905ede.292.1590166587156; Fri, 22 May 2020 09:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590166587; cv=none; d=google.com; s=arc-20160816; b=fR9T0L1030lSz/QzijqsuAb1sNkUszpeEZEVM2VMD/ATCxpPSwL9hSAD6Pm5wLrn1k tKY6mcHWYe/DG5Pswn8tBZzhOrlobtc5F4t/5DLzKCiMyO76Trrwu/HuzG1Vn7dO8QUZ S/kWnyNeZxVS8HtmU9w6QUexDgWZ5BJsfXHuGKql0EpPqeYei4Khwo3BRAvzfHpkjljd ifFPyJE0I9G4Tjz/u1sYRz9INMelKVlT7EGg9STLtdbxRInFEAN12JOEJUU3/ffqkKoF dSO+smlRP8sVrLXC4N1EhMp/xtlFEK0Op3TmmNzkPRJ/7mbPLUYGaF3EhTdTtsmy2eYC GmeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=kNa9voFfSUUlxYYOIcCV4QnfgOmHUQzdAVPHbdSuyew=; b=0b85VE4zQhwoaA0jovMkLFnWo3ssd+fSj6PTK/d+gk42XuNKrWx8SNEgLOkMYFBVY3 1qzelRYXOqWIbYxIGSSfom83lNYiVkbTBNGnW8UdDBnLpfmAS3m3xFa9109g95JvI1K7 1hvgTziSopu6s2ZfTOcfsgnpqy6W1d58DE3Sn/8p99LnQ3Ol3Vgrsnl5bcNlZ8xCOWo3 KIt3O71Hx3zvrQ2Bsb06emjLfkKdqgJ7t8PPqQzJXCUMbXMbB5D00duNhn4br+z3Zr+p MSxZl7t/4P4v5/fR6+lD5cmTKwG1mP4Nu5cZ9ofa+q1O9/1vK9x1BY0+fSGhPs7Dfep6 m2zA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c95si4937362edf.206.2020.05.22.09.56.04; Fri, 22 May 2020 09:56:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730685AbgEVQy3 (ORCPT + 99 others); Fri, 22 May 2020 12:54:29 -0400 Received: from foss.arm.com ([217.140.110.172]:39422 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730306AbgEVQy2 (ORCPT ); Fri, 22 May 2020 12:54:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B3C3D55D; Fri, 22 May 2020 09:54:27 -0700 (PDT) Received: from bogus (unknown [10.37.12.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EB58D3F305; Fri, 22 May 2020 09:54:24 -0700 (PDT) Date: Fri, 22 May 2020 17:54:22 +0100 From: Sudeep Holla To: Arnd Bergmann Cc: Linux ARM , Will Deacon , Mark Rutland , Lorenzo Pieralisi , "linux-kernel@vger.kernel.org" , harb@amperecomputing.com, Jose.Marinho@arm.com, Greg Kroah-Hartman , Sudeep Holla , Francois Ozog Subject: Re: [PATCH 2/2] firmware: smccc: Add ARCH_SOC_ID support Message-ID: <20200522165422.GA18810@bogus> References: <20200522124951.35776-1-sudeep.holla@arm.com> <20200522124951.35776-3-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (+ Jose (SMCCC Spec author)) On Fri, May 22, 2020 at 04:46:12PM +0200, Arnd Bergmann wrote: > On Fri, May 22, 2020 at 2:50 PM Sudeep Holla wrote: > > + > > + soc_id_rev = res.a0; > > + > > + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); > > + if (!soc_dev_attr) > > + return -ENOMEM; > > + > > + sprintf(soc_id_str, "0x%04x", IMP_DEF_SOC_ID(soc_id_version)); > > + sprintf(soc_id_rev_str, "0x%08x", soc_id_rev); > > + sprintf(soc_id_jep106_id_str, "0x%02x%02x", > > + JEP106_BANK_CONT_CODE(soc_id_version), > > + JEP106_ID_CODE(soc_id_version)); > > + > > + soc_dev_attr->soc_id = soc_id_str; > > + soc_dev_attr->revision = soc_id_rev_str; > > + soc_dev_attr->jep106_id = soc_id_jep106_id_str; > > Ok, let me try to understand how this maps the 64-bit ID into the > six strings in user space: > > For a chip that identifies as > > JEP106_BANK_CONT_CODE = 12 > JEP106_ID_CODE = 34 > IMP_DEF_SOC_ID = 5678 > soc_id_rev = 9abcdef0 > > the normal sysfs attributes contain these strings: > > machine = "" > family = "" > revision = "0x9abcdef0 > serial_number = "" > soc_id = "0x5678" > > and the new attribute is > > jep106_identification_code = "0x1234" > > This still looks like a rather poorly designed interface to me, with a > number of downsides: > > - Nothing in those strings identifies the numbers as using jep106 > numbers rather than some something else that might use strings > with hexadecimal numbers. > Not sure if I understand your concerns completely here. Anyways I wanted to clarify that the jep106 encoding is applicable only for manufacturer's id and not for SoC ID or revision. Not sure if that changes anything about your concerns. > - I think we should have something unique in "family" just because > existing scripts can use that as the primary indentifier > I agree with your idea of combining attributes, not sure exactly which ones yet. > - It seems odd that there is no way to read the serial number through > the same interface and publish it the usual way. Valid concern and I will pass this to interface authors. > Francois Ozog > recently asked for a generic way to find out a serial number for > inventory management, and this would be the obvious place to have it. Agreed, but not sure what author(s) have to say. I have cc-ed one of them. > It can of course be added later when the next revision of the spec > is there, it just seems like a surprising omission. > Yes, definitely. Good to get feedback. > How about making the contents: > > machine = "" /* could be a future addition, but board specific */ > family = "jep106:1234" But this just indicates manufacturer id and nothing related to SoC family. If it is jep106:043b, all it indicates is Arm Ltd and assigning it to family doesn't sound right to me. I had requests for both of the above during the design of interface but I was told vendors were happy with the interface. I will let the authors speak about that. > revision = "0x9abcdef0 > serial_number = "0xfedcba987654321" /* to be implemented later */ Sure. > soc_id = "jep106:1234:5678" /* duplicates family but makes it unique*/ Not sure again. > > That would work without any new properties, dropping the other patch, > and be easier to use for identification from user space. > OK, I agree on ease part. But for me, we don't have any property in the list to indicate the vendor/manufacturer's name. I don't see issue adding one, name can be fixed as jep106_identification_code is too specific. How about manufacturer with the value in the format "jep106:1234" if it is not normal string but jep106 encoding. -- Regards, Sudeep