Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp336589ybr; Fri, 22 May 2020 07:49:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuejekkZqtB6mX2yAoQiXZ02uZf7sJjBbMUQLMoVKPO4H2ufmJJDtGoYd5HKTV1q5TLk0o X-Received: by 2002:a17:906:1b4a:: with SMTP id p10mr7865249ejg.299.1590158970624; Fri, 22 May 2020 07:49:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590158970; cv=none; d=google.com; s=arc-20160816; b=LND04llQ6lsbgnUfmHoftFV/dme96Tsy8jpnjbQgttQON/simA4B81bmsnbiHWYt+8 Ec6vVSAxlspiRb9ITAVA83urUZvu0aj2ri8S53A+XwqY0f+kJkt8xtax30gFs/IoUHlR F3Wi3V9rUANuQXpRMKRzBx9phwmi5+3b+wuVWsVzlVVN7iBog5nmmJkD3SruVXTt2iFp 9iS8qyyp6kktIiOE7KU02UpffWRKSRYfT3fcOqQzbE0MY7inQUJ0sGpP1ENvjg/Xbjva PkeMJlJe/oPiz9KbggJql2NzRwlAPYOzyUqI2+8bGZaiixDIg3fkIEoAhG2/tVofjRYu OtIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=s+b3CM6rVpmT31L2exTSNJFAd1aP+MgV7Uz1FxH+iVg=; b=vwCq6J3iQuQVtvTNxrIO84gvS8pq1ry8x9WNm7H3r1+L08Bpm4OyKohK78UHrVNv26 +5V3BEpemqSpqnmaj+NUtzaAxs95ZV4CMOoc5MblEHe28kJgtWvg+giwh7TP5gp/gS9t Cfg0Or6c7NTGzJQEhGtuz4+PvnKT4hEHZ8upmwNZdUCohrB0BqcqzYKZEeWkrkYb3b3C VQDBtYr8jNhvJHv5Uk8PSpZKUT0ENCiHRUJVL0wCjZbi1wYcVY4c/GZFV9yJWvHGSIrg F6VOl+bdO/mSemfODJpxol+FpSgAJxOtY0QqiTbceWFVusxkf5Ekm2dKLUXjaNuMc4rG E7GQ== 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 t12si4576169edc.551.2020.05.22.07.49.08; Fri, 22 May 2020 07:49:30 -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 S1730535AbgEVOqk (ORCPT + 99 others); Fri, 22 May 2020 10:46:40 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:35851 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730105AbgEVOqd (ORCPT ); Fri, 22 May 2020 10:46:33 -0400 Received: from mail-qk1-f169.google.com ([209.85.222.169]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MplPh-1jGolW1bDB-00qBfc for ; Fri, 22 May 2020 16:46:31 +0200 Received: by mail-qk1-f169.google.com with SMTP id f13so10955775qkh.2 for ; Fri, 22 May 2020 07:46:31 -0700 (PDT) X-Gm-Message-State: AOAM533Xvy54bNuJ2f5pzevaee7ls6/C10KoORXZYTkEIP9dClJddvSc kmip8z+mgeumRHXhKz4qAFdMX0lCYcAPfNsi94Q= X-Received: by 2002:a37:434b:: with SMTP id q72mr16186729qka.352.1590158790247; Fri, 22 May 2020 07:46:30 -0700 (PDT) MIME-Version: 1.0 References: <20200522124951.35776-1-sudeep.holla@arm.com> <20200522124951.35776-3-sudeep.holla@arm.com> In-Reply-To: <20200522124951.35776-3-sudeep.holla@arm.com> From: Arnd Bergmann Date: Fri, 22 May 2020 16:46:12 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] firmware: smccc: Add ARCH_SOC_ID support To: Sudeep Holla Cc: Linux ARM , Will Deacon , Mark Rutland , Lorenzo Pieralisi , "linux-kernel@vger.kernel.org" , harb@amperecomputing.com, Greg Kroah-Hartman , Francois Ozog Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:eUgxqSzEZfnXE/1hGmbTVnvsKP2q4WegGufvE2inKA1u4Nkwrz2 Q0Qi4Jgx90YiqsEQP3fBIPunYbP1JsbKbz0QdIWmQy0tLxgThaWdqmtG0noQL7q4OSj2bvR XXouDtPCvz0g8wYVDBsl4obqFjLUGaHEUr0H+jJOYKNbE/kJCjKUE+om3RmmHj37ifWXHZD P0fwZagr4k/luCc5H09ow== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:R1yk67n4mYc=:91k32ihezTulJxhTAjnkam dkjanHvL/foC9H2C+JCdTX5HtDxyj1F7x1/fSPv7J1/PmYMQhX0nrW8grLg3bua7FM+EyX3mS j67ESIQbdxhAx0cLlqWDGSJit0Po1RWQ9LfepcSCy9hx68cDsVhuUwStylItkob7DD6RVrQ0K q/wIQrq/f49wAJTWbxoTQ8MrexDsMmySxarpdRthVmnOT9hvX0H7Ew2yRohqXiWX3lSZ3KUQe oVUzEpOq8+MsKV44Yc1qNiVaiMreiG51NNVsrTCN1ya6nbxpN3IVLkmmIdiJWKUU9b5IG5bQC 2HlnSBkDn11Nw0vE1FGlPcKGcVooRberJi3evUchdv+mNR7tqcOYEEHxsf5yLH1dvITIALFO6 2dsFIk1ofo54ZO8jUA3WnDunZLMHynLZJLDZvdZAKx1brQi4yRh3nDqUhdXqj7NrwqBsZTmYL 95aiKerJcvVK4s0UBi0I/zdnm5F1q5j4SRuBtCK/L4Zk8cbARt5fS/6uBIDlW0ZLQhS8RDcw8 JEU1IAzA+IbiVejzfU0VbdhnMMDHS7uEaTOkX4IeUCaKopejdzieyQAcqmXoD/II9WKN6OWZ/ pjndVZ1dideDikugWpTHhTtYdorn9BvXhie/VOdSE4vG+VAxyKsFfPPZJ7YM4EKbK8u6QjdxZ Z9zsTscHPb0+GgWNYfxOTJlO3MUVh7S34FlVhLk/zOhzTOHT0k4ziBffOv/s8VbCXPbhrkU9v C2FFC1b7qHSZg+Ef9z81E9jbqULaDozwOWhI88pKUiIG95MdvyDop6Ou+joi0lUEc6t2Jtx3j KT84NjWvRjBXcGNdwYjKlO/7lfHaLHj64R2pUuS2BYT+IJHTMY= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. - I think we should have something unique in "family" just because existing scripts can use that as the primary indentifier - It seems odd that there is no way to read the serial number through the same interface and publish it the usual way. 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. It can of course be added later when the next revision of the spec is there, it just seems like a surprising omission. How about making the contents: machine = "" /* could be a future addition, but board specific */ family = "jep106:1234" revision = "0x9abcdef0 serial_number = "0xfedcba987654321" /* to be implemented later */ soc_id = "jep106:1234:5678" /* duplicates family but makes it unique*/ That would work without any new properties, dropping the other patch, and be easier to use for identification from user space. Arnd