Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2301289pxp; Mon, 21 Mar 2022 16:18:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/YW6zViI5j9nM3j0hrurDXwaPx709UCHsvfDbGpJCKEQ7SDfFZdqn9zBolbzrxLyvhzur X-Received: by 2002:a17:90b:3d03:b0:1c6:74bf:418a with SMTP id pt3-20020a17090b3d0300b001c674bf418amr1607169pjb.33.1647904738559; Mon, 21 Mar 2022 16:18:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1647904738; cv=pass; d=google.com; s=arc-20160816; b=QWXZGOROHu8Y8EVqVqeH8gHkIh6s8SzQx7snbwHwVWEgaEXC8sMFleQ4Z0SOt8RBvZ asE8KAaa6L9jdlc/FyHV5zD0lX2VIUe68tztamNxb9so5q07lgx1VLBvB+ce4pPh6hLA FQ8bXuGJDEQ/4ypr7gv1MseUXbpQKl1w6FK+K6Lmwpt3HHa6AmFP29E/QO3gwYMEETqV /RVh/3LjHkLbYocstnKt5+j2Ob4FeJzrSeV2d8j7dkWEzVw1F3+kizAXIe5wQPZhKyOd uWA/CSa1qPkryCzirH08hs8CFNQj/Fhg8KZzNAvAgOyTfRA7q98ZeYGaq6a1v/m3hvnn Lr+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=93k+vMv2/R9D4efwwsZ2UxZY85KpkdTpLptJPuN/01E=; b=UMhBBy5EmReFfSrCi1UZMkjvEewsoVlZo1LLQlHnNs1IaeDzxZBWQKtoE06aMegEya VDDXYDonEdouN/G49qngABsUFP+3rmJz/6kkK7AfzglgeuS7hcU391lHDGKkOE8Xq6xq ZJmKMFKx7Tf9OLU/zrS7U2JyZ3kXeLhcn265CeLeUtXsf4tOB0QetOMu6ZZXwlL6/vI/ kZzzw28QtXcMF1FDEnHITQtfspYjJWH+wM3TO1bsbOKF5TPbhA0S3pkCYgkD+nv9go5B g+wznhAXNYjobBxiCuBfF6h3yc+jLyBPMVrWB/vJ+uQW2uTbvrKUU3UXEmuMRn/akcNv gjHQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=q67YkiSb; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i19-20020a056a00225300b004fa98040016si5294210pfu.142.2022.03.21.16.18.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:18:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=q67YkiSb; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2969845B905; Mon, 21 Mar 2022 15:17:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243422AbiCUJsd (ORCPT + 99 others); Mon, 21 Mar 2022 05:48:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235734AbiCUJs3 (ORCPT ); Mon, 21 Mar 2022 05:48:29 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2132.outbound.protection.outlook.com [40.107.96.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 886FE13509D; Mon, 21 Mar 2022 02:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NgcOFfJFWGxIU+FszOxJNEvA96yJM4a+n6FJ01cNcqDiKY54RbvABJ0mo4oizSD2XDwwv+S+LwHEv+9bSUT9KrQz3vvmVRjz0KbUWSEJiFAi3zQSp4FqsbhlCVzZSPyFfs2de4Yea7XlwOW8B3DXziAPW+hFzm2qAMZAmf8rnlqHd7asaVoubZGVYct5IIUm5XD//0ToW8CR83lu+TwO+TAo2TTEV/pzpzg9i2sO5fabGOf63ZWJ95F2zUbuLQqVt3i0LdxLnP3Vbnzw2ZhB9KI5Ma+2EGwMe1HGJcPgZAoEvlEl4rzRFBsilM39wAdIt9Z2MyhnBAj1lWe1UPQ14Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=93k+vMv2/R9D4efwwsZ2UxZY85KpkdTpLptJPuN/01E=; b=Z1kTmvle+MeJppVh86AOCHmPSce6L8Utqtewm/bReiefNJuJiDZE26xoHiR53Ff/gTXZL02jSPPz2JacytbWlXeqJFtSPSQ1IprKx7TI0ybkgr+PbHzTFHoPs33k29VdcdLuPsull7HV5lViOtFmKFLBApDHkoRx1w0IR3XRbtvj2gTZM4DGt1pQF2LlL2+r1J24xseSaTITkamiTPwc/bCaG3TnqMv+umi12F8LvVAZYbU3YiZjt5ucaQoF8vXUZUzZSeT7aDRzVxkBSd8qbxJf1b1Iabh0DHMXvBivDLTpP9AePlkAjwFOucJRyXEUxDMwG6CNYTYb5tI3Awsv4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=93k+vMv2/R9D4efwwsZ2UxZY85KpkdTpLptJPuN/01E=; b=q67YkiSb5hca+w6PxR0ajoivbdoQRvZzdtlJK3JNxipmAztM3zaNZm7M8AaYjcmqGchwmnJKdMLgqoLOHXqoBSmZi0JMK6K1RdD2QioYEQBm07jlINoIQvs+ldHqqaig9aW2SbsVJMV5zyZop1coWjH4F3xevJKyhOA5kAAWS1c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SJ0PR01MB7282.prod.exchangelabs.com (2603:10b6:a03:3f2::24) by MWHPR0101MB3008.prod.exchangelabs.com (2603:10b6:301:30::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.17; Mon, 21 Mar 2022 09:47:00 +0000 Received: from SJ0PR01MB7282.prod.exchangelabs.com ([fe80::cd24:39ed:7042:46d6]) by SJ0PR01MB7282.prod.exchangelabs.com ([fe80::cd24:39ed:7042:46d6%8]) with mapi id 15.20.5081.022; Mon, 21 Mar 2022 09:47:00 +0000 Message-ID: Date: Mon, 21 Mar 2022 16:46:50 +0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH v7 5/9] misc: smpro-misc: Add Ampere's Altra SMpro misc driver Content-Language: en-US To: Greg Kroah-Hartman Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Jean Delvare , Guenter Roeck , Jonathan Corbet , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Thu Nguyen , Gustavo Pimentel , open list , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:HARDWARE MONITORING" , "open list:DOCUMENTATION" , OpenBMC Maillist , Open Source Submission , Phong Vo , "Thang Q . Nguyen" References: <20220321081355.6802-1-quan@os.amperecomputing.com> <20220321081355.6802-6-quan@os.amperecomputing.com> From: Quan Nguyen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: HK2PR06CA0010.apcprd06.prod.outlook.com (2603:1096:202:2e::22) To SJ0PR01MB7282.prod.exchangelabs.com (2603:10b6:a03:3f2::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eb234d37-d8a5-4afd-0d62-08da0b1fbee3 X-MS-TrafficTypeDiagnostic: MWHPR0101MB3008:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wKlBIOFGt22KkPRmDGASmmFtZ4PukVRbkkhgAbOTgZgfOYeQ2KRGrmve404uB3L14asavzpVt39iv2XtN85m177Qo8FcXnmDE4ETqkZ53DdMk38z2V49IAuWj+2OXfeYc2JmseqzJlV9wqJRmwmfefgH4Xe/in1A7NYhWoEC9en+Vft3e7xCDhjtp2sXXi3ux7Thn8N9IiiElJ5OLZeq3Hd/diiRZUbGwz1I8ogrgdXJUCyBUjwLbOKHcVb7Ecss3o+IN3zxSNd+J98FOpNJ3JS+HVpIYkPeZICNqDcLbjer8D1ouMhUbYQwaFlDXErSicyJBMd6yC85Ab6H2YbvLCpbJn1uUxBlNijDD8UnMUi0V8WLDBZfXmxKEqKELWZLAIQOuyTfbiNYBfD+rH8SV9xBJBXDMJ9SvNI0+d6yWkY7fCL9TiGKQHokM8mJpmQ+PP0tomQIWjYMrR3zqtvNWfCi4I8nKhl9B1TFy/JSffmFqHQy/HPZDwBsMZzFRsfo2YI95Xc+JNtemaNfRsbHqm/OlCl9/O2Vv5b6BxF0sqvLqmF+u1mByOJanVrM8IwSqtSwOPlHqtXxpC8WgsF9Yg+ojSNNYLS0KXBQYrnXWj8zQkTd6ahTiji8Z4K3GJYnUWreG2wED0mvamAeEoIDCwHzmA8plLVsZE2I2oHIBcDE/XcdGdorZgMiDw8h/FN1x3Pwep/Ox0sNAjYfBMnJECtwkJ4JgkM3jaKgtRzcPRc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR01MB7282.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(7416002)(26005)(186003)(38100700002)(2906002)(8936002)(53546011)(52116002)(2616005)(38350700002)(31686004)(5660300002)(107886003)(6916009)(316002)(54906003)(66476007)(66556008)(8676002)(4326008)(66946007)(86362001)(83380400001)(6512007)(31696002)(6506007)(6666004)(6486002)(508600001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UDRDUitxcEVIWHBPZlRYVk8xTFQ4VmcydHhJS3MzbC9ERTNwOEdsdHNNRU1Z?= =?utf-8?B?aWhiNStDM2RHVnRmS0RrWFBuazZuMzhEZVdRNEZVNWE4TFB3VDQzMFQxUFVS?= =?utf-8?B?bkt1c1UvRzg1aHdqU0NVSG5TRmo3MTJCN3NNODhxY2JHM1ZxWi94SGZ4c2VP?= =?utf-8?B?VkNKbk92RW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FKQXJiaUlX?= =?utf-8?Q?LLkXQMcVAeGSScmA5jPcjd2PmT6yyc=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb234d37-d8a5-4afd-0d62-08da0b1fbee3 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR01MB7282.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2022 09:47:00.4394 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5tPl4YB7N5rXSTcMXzH5eMYEecy5t6e3L7KznfCAtvwoTTXHOhoTJ6Uy38lFkxDWBGll2A5ZsjeCk3ELytW32Suuo1sUrn0dhOoYr6tqkDA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0101MB3008 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/03/2022 15:21, Greg Kroah-Hartman wrote: > On Mon, Mar 21, 2022 at 03:13:51PM +0700, Quan Nguyen wrote: >> This commit adds driver support for accessing various information >> reported by Ampere's SMpro co-processor such as Boot Progress and >> other miscellaneous data. >> >> Signed-off-by: Quan Nguyen > > No Documentation/ABI/ entries for your sysfs file? > Thank you, Greg, for a very quick review. I have put this file in other patch. >> +static ssize_t boot_progress_show(struct device *dev, struct device_attribute *da, char *buf) >> +{ >> + struct smpro_misc *misc = dev_get_drvdata(dev); >> + u32 boot_progress; >> + u8 current_stage; >> + u8 boot_status; >> + u8 boot_stage; >> + u32 select; >> + u32 reg_lo; >> + u32 reg; >> + int ret; >> + >> + /* Read current boot stage */ >> + ret = regmap_read(misc->regmap, BOOTSTAGE_CUR_STAGE, ®); >> + if (ret) >> + return ret; >> + >> + current_stage = reg & 0xff; >> + >> + /* Read the boot progress */ >> + ret = regmap_read(misc->regmap, BOOTSTAGE_SELECT, &select); >> + if (ret) >> + return ret; >> + >> + boot_stage = (select >> 8) & 0xff; >> + boot_status = select & 0xff; >> + >> + if (boot_stage > current_stage) >> + return -EINVAL; >> + >> + ret = regmap_read(misc->regmap, BOOTSTAGE_STATUS_LO, ®_lo); >> + if (!ret) >> + ret = regmap_read(misc->regmap, BOOTSTAGE_STATUS_HI, ®); >> + if (ret) >> + return ret; >> + >> + boot_progress = swab16(reg) << 16 | swab16(reg_lo); >> + >> + /* Tell firmware to provide next boot stage next time */ >> + if (boot_stage < current_stage) { >> + ret = regmap_write(misc->regmap, BOOTSTAGE_SELECT, ((select & 0xff00) | 0x1)); >> + if (ret) >> + return ret; >> + } >> + >> + return snprintf(buf, PAGE_SIZE, "0x%02x 0x%02x 0x%08x\n", >> + boot_stage, boot_status, boot_progress); > > sysfs_emit() please. > Thanks, Greg. Will switch to sysfs_emit() in my next version. > Also, this is 3 different things, put all of these in different sysfs > files. > > thanks, > > greg k-h Actually, no. It is single value of boot stage. Let me explain: The boot progress consists of three things together: boot_stage, boot_status and boot_progress and they have no meaning if reported them as three separate values: + boot_stage is to indicate the boot stage + boot_status is to report the result of that boot_stage: started, complete or error. + boot_progress is to report more extra information for the stage other than the boot_stage/boot_status. There is more information in the Documentation/ABI/testing sysfs patch. - Quan