Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp576233rwb; Thu, 6 Oct 2022 01:09:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7k5JIqgkkOM6jQkuvvZMVvkA3nT2EknlVlFuXjXPa8TVuRF9fK3ITxEwtK8SgF8R6P62Ne X-Received: by 2002:a17:902:f545:b0:178:b4c3:eab6 with SMTP id h5-20020a170902f54500b00178b4c3eab6mr3452219plf.148.1665043767224; Thu, 06 Oct 2022 01:09:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1665043767; cv=pass; d=google.com; s=arc-20160816; b=lsGdt+ZjHK/n0od8O2toTYR/8jsWSONqdhRtiap+X5I6BxWO/xc0yMRsAA4btRX4Xi wm+TG42OGBULSC6HzQlFTbPtk0W2y3A1B4aOHr7SUTAsU7khvavcJ+bu1irNqwSEFMXz /wPdXjqVr3C74cZdQmg0AvXuaI7SmgeOaGDAF3TkhA1TKbClYPplHhUgINbEYD3MI28T 4ehtYVjFELRdvQL5lz42w+1D2JJLmqhSdkmKGohX4/VDzHoDd6UnYoIiIHLvRSO53V1r IyJNm9oNNlhY3A/uPAqLB2hQ+B0oUVF7H8+6fGP4oCfBOjWrgIdoJm5IwduUSgWXZx52 Hlpg== 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=HwNsFZOXci+Es9ZOLxhf1boDNIUHF1TUhyUPTZaT7T0=; b=l2miEK2bJcBKzfEiNdLD83Sw3yVggkp8xL+FVLK+zN5hsUZBgL66UB15jGnWiKmcQp hWHTSZ9YqdKssNN2CqxvePTumnDrSLfnYflNASqILVGUcUl7hBjfUx6VN6NcoW2dV1qx omIaT4NFpdss5WU7yQC/32FrWOv1mX41HJKu2SMZqHzRGUwWVM02zEMR4a5twkkHVngs iSPXyHPI61LLeMlbdu58l5MWSufijwXM0J/Sw5ErPGlwQApcsDACqvPRKgC4BshnyKTu Gc8/c7gSPfpFXb3CWTYYnrgpJYtIZMqOxpkxvDtCo+felzU3H7ZtaUA8Ez+I5HUOFvCf y9mA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=uDq6+oLH; 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7-20020a63e607000000b004403a3d2987si18537682pgh.106.2022.10.06.01.09.15; Thu, 06 Oct 2022 01:09:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=uDq6+oLH; 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:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230429AbiJFHpb (ORCPT + 99 others); Thu, 6 Oct 2022 03:45:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbiJFHpV (ORCPT ); Thu, 6 Oct 2022 03:45:21 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2124.outbound.protection.outlook.com [40.107.223.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAE098B2E2; Thu, 6 Oct 2022 00:45:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z0DQQKoThXlg+oIXneiicKnurShDpLXUwhVQDwhUxgu/IkBqDo0RFiuhUH6vJjJhrRn1DUlKsrkZtt15zvzBO76yIFvDhWhgKRMqS7TIuPkoiQa7pUT8AfPjrjub/7oyFGPozXfGVcLlLHQljXBXbx8H3eukkWAPHAw8IKY2XYvab6G75qR/PTV+8Qv2AOQDHd6+b7RUnR1ghv4Hcvg9IjCUGH9X06wM7R3w2pIvpLa/QMq1tWnaCj7GdvoM563IRrW6/0PWXx62d8xx16THJo06kPJ+EV5xefJllz90M77M0/vAVTJReW0C3kyoaHeUIRSKTLhEMeex0ORE239v1w== 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=HwNsFZOXci+Es9ZOLxhf1boDNIUHF1TUhyUPTZaT7T0=; b=LzhrbdY+moBdtHynTCtlTC+S29QtdFgM04wBlNcY5SERaDviq6C5r2lmHtP2wfRTwTt5si+qPe/w4h5NUF0H7naCBBXpIafrBoytMvB/pEkBDd8VOSRImGVx/HxwgTof0ZORww332c+vGs/I4ND2b/hg2/1RTbcDlB47ce8X+dfRWWm0n+M+g5VN4L0dn25vqZgcozB9HdsMB3gZ8GTjluXwylRoTaplbSo/itky4AHDCo0ONFOvXR1bNAAfyViZaGxWkwQA2soEI/0UibpYFaKYFqxGWGEfWrlvQssV05Zlf5iTLt5NsiJ5CcVwr2Br1Z1yr/t08iPbpDlM59tUsw== 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=HwNsFZOXci+Es9ZOLxhf1boDNIUHF1TUhyUPTZaT7T0=; b=uDq6+oLH5Sie0VStcvGJQsdRD9uCZO0W5NhBbH2ymEy/rVYy+hIPB0yjrmQTjUSNRNUJcvsGsAwuWJxiIX3l+uMZYeERIadJEMPlCQ2ULIS9MqaFu2q6U/Qk80arB12BuN3GIE8e0GR6p0P2KVuJdjVTj06KUZWkgfSFOL6nBpg= 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 DM8PR01MB7190.prod.exchangelabs.com (2603:10b6:8:9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.20; Thu, 6 Oct 2022 07:45:16 +0000 Received: from SJ0PR01MB7282.prod.exchangelabs.com ([fe80::7d50:e907:8e2e:1ff0]) by SJ0PR01MB7282.prod.exchangelabs.com ([fe80::7d50:e907:8e2e:1ff0%3]) with mapi id 15.20.5676.032; Thu, 6 Oct 2022 07:45:15 +0000 Message-ID: Date: Thu, 6 Oct 2022 14:45:03 +0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH v9 5/9] misc: smpro-misc: Add Ampere's Altra SMpro misc driver Content-Language: en-CA To: Greg Kroah-Hartman Cc: macro@orcam.me.uk, Lee Jones , Bagas Sanjaya , Rob Herring , Krzysztof Kozlowski , Jean Delvare , Guenter Roeck , Jonathan Corbet , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Thu Nguyen , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, OpenBMC Maillist , Open Source Submission , Phong Vo , thang@os.amperecomputing.com References: <20220929094321.770125-1-quan@os.amperecomputing.com> <20220929094321.770125-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: SI1PR02CA0048.apcprd02.prod.outlook.com (2603:1096:4:1f5::11) To SJ0PR01MB7282.prod.exchangelabs.com (2603:10b6:a03:3f2::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR01MB7282:EE_|DM8PR01MB7190:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bba1fd7-2ba9-468b-faf3-08daa76eb525 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lfgVGuZ3FFcbUnLrgCQ95Y5boVVncN/Ljvg07U3cS3BnB41kE/AB+QuhDrhUczWZxeUbJLNQFj8vGrKPuAZwUmCG4jK2rXLoizLi2hmUV0mG4t6rK8IShCF+FlwERiD57/KI1GqX1Vi0FAeWLIq7emsvrjDifQ5eHBvlMXtlLqjzrGcLvrKJjZpAiGRaeLKksmChmcJYJlhPAtsPoLM4cs7rUsYGPsEhLU6ctR/qPhoGV2rX5NTJWc/xme7dII7g3iw5unEHplLn+3MKNeQoW5FLqx7LJMXLUuogqs7TQE4/PnEO0iRXXgRRv6UzbgX+4VzdaI4qEXQ43NZzSTvxtfXUPs7Kt0DLMqhf4ayBbZ4CVOsh4/NgzFZulD0TxN4Q3nwEekom/jTZdRTxNKN6HeOvAAcaiQJBZaqrjkbWf3R8QDIKPOrL5yMvls53ObToVPc8Zeo3zvTmgLyQy+Bdj8MWfQNx5S7bBJiBcEcPbzBhICQYzc91Jzga0D2LzhNQh6wOJKF5V9gMOzAHtofoHRU/nIcWO8vJX7V3pluiklfy7u91x5ntLEyNkydVFs9EeTME80o1Mk3UiBXnjEThveyumqQDggUBGWd32WogZZEqa5JWHJYyHcK/5XsieSBxRFZlWEWtqa8+yYP4bUQpA2j/C6T+phd9gWzj07bQ5ahSwoFCsuUt9upvRUKg3JBxIhvitWFq0NqHWI9AVmclII5MypoZpAKNJrTkPBJN8I2wpnVRji5dOnnJ9AYfb2YahKGU1cGZzP0MRfmCEPci7imyuqTQ6SYsV+wskK/j5pA= 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(346002)(39850400004)(451199015)(52116002)(53546011)(107886003)(478600001)(6512007)(6506007)(6666004)(26005)(83380400001)(186003)(2616005)(2906002)(7416002)(8936002)(54906003)(316002)(6916009)(6486002)(4326008)(8676002)(5660300002)(66476007)(66556008)(66946007)(41300700001)(86362001)(31696002)(38100700002)(38350700002)(31686004)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SjAydXlNeDZEK0tQeklWZ0JPWU50bHN2WGpLdTMxRW92b2FrdlFNMWlia3NJ?= =?utf-8?B?dXVnV21EVmU2K3ZmU1FNZ2MyOTdYNGxhQUtKMERETDdiQTBoQ3d3U1VWYjBV?= =?utf-8?B?ZWMyTldpTnF4bXZYUlJXeGwvNmtsU21ISWNzNC9lWmdpYzlFTE1EWjlNUEQz?= =?utf-8?B?eXByejlBUEZ5elFrcitwaXRiZC80SmgvSlpVbDlBU2NuZFpLOVU4Qnc1WnN1?= =?utf-8?B?WEZjQW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2S0oxcjNZUCtFcVRVNWtpSG1wWTJh?= =?utf-8?B?alpFeW1CQUVKd2xHWklZZUJTYzd5Y2pIa0Z3YWQ4NGZ3VElCTjRQVnlQeXIw?= =?utf-8?B?bnBHYk1PS29ZQkgzQWd3UFRnbHNZYTJmY3RheTJCaUlKQjk1ODE5bHh0cWw0?= =?utf-8?Q?8cfguZRHL1uuVc3oRC3oX7Y=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bba1fd7-2ba9-468b-faf3-08daa76eb525 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR01MB7282.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2022 07:45:15.7658 (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: CR4WeNyf8nLq1XSs+g54z3G49isKmWow0AQcgzgtPdM5U+IPENgssofOLoq0Y991e1ElCG0SaIaoQfQH9hcHEhMduH8MpVqzdimFT6uHnpI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR01MB7190 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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 29/09/2022 16:55, Greg Kroah-Hartman wrote: > On Thu, Sep 29, 2022 at 04:43:17PM +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 >> --- >> Changes in v9: >> + Update SPDX licence [Greg] >> + Use ATTRIBUTE_GROUPS() [Greg] >> + Use dev_groups instead of sysfs_create_group() to avoid >> racing issue with user space [Greg] >> + Refactor code to avoid clever encoding issue [Quan] >> >> Changes in v8: >> + Update wording for SMPRO_MISC in Kconfig file [Quan] >> + Switch to use sysfs_emit() [Quan] >> >> Changes in v7: >> + Fix wrong return type of *_show/store() >> functions [kernel robot test] >> + Adjust patch order to remove dependence with >> smpro-mfd [Lee Jones] >> >> Changes in v6: >> + First introduced in v6 [Quan] >> >> drivers/misc/Kconfig | 10 +++ >> drivers/misc/Makefile | 1 + >> drivers/misc/smpro-misc.c | 145 ++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 156 insertions(+) >> create mode 100644 drivers/misc/smpro-misc.c >> >> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig >> index b9ceee949dab..9947b7892bd5 100644 >> --- a/drivers/misc/Kconfig >> +++ b/drivers/misc/Kconfig >> @@ -188,6 +188,16 @@ config SMPRO_ERRMON >> To compile this driver as a module, say M here. The driver will be >> called smpro-errmon. >> >> +config SMPRO_MISC >> + tristate "Ampere Computing SMPro miscellaneous driver" >> + depends on MFD_SMPRO || COMPILE_TEST >> + help >> + Say Y here to get support for the SMpro error miscellalenous function >> + provided by Ampere Computing's Altra and Altra Max SoCs. >> + >> + To compile this driver as a module, say M here. The driver will be >> + called smpro-misc. >> + >> config CS5535_MFGPT >> tristate "CS5535/CS5536 Geode Multi-Function General Purpose Timer (MFGPT) support" >> depends on MFD_CS5535 >> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile >> index bbe24d4511a3..87b54a4a4422 100644 >> --- a/drivers/misc/Makefile >> +++ b/drivers/misc/Makefile >> @@ -24,6 +24,7 @@ obj-$(CONFIG_KGDB_TESTS) += kgdbts.o >> obj-$(CONFIG_SGI_XP) += sgi-xp/ >> obj-$(CONFIG_SGI_GRU) += sgi-gru/ >> obj-$(CONFIG_SMPRO_ERRMON) += smpro-errmon.o >> +obj-$(CONFIG_SMPRO_MISC) += smpro-misc.o >> obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o >> obj-$(CONFIG_GEHC_ACHC) += gehc-achc.o >> obj-$(CONFIG_HP_ILO) += hpilo.o >> diff --git a/drivers/misc/smpro-misc.c b/drivers/misc/smpro-misc.c >> new file mode 100644 >> index 000000000000..6c427141e51b >> --- /dev/null >> +++ b/drivers/misc/smpro-misc.c >> @@ -0,0 +1,145 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * Ampere Computing SoC's SMpro Misc Driver >> + * >> + * Copyright (c) 2022, Ampere Computing LLC >> + */ >> +#include >> +#include >> +#include >> +#include >> + >> +/* Boot Stage/Progress Registers */ >> +#define BOOTSTAGE 0xB0 >> +#define BOOTSTAGE_LO 0xB1 >> +#define CUR_BOOTSTAGE 0xB2 >> +#define BOOTSTAGE_HI 0xB3 >> + >> +/* SOC State Registers */ >> +#define SOC_POWER_LIMIT 0xE5 >> + >> +struct smpro_misc { >> + struct regmap *regmap; >> +}; >> + >> +static ssize_t boot_progress_show(struct device *dev, struct device_attribute *da, char *buf) >> +{ >> + struct smpro_misc *misc = dev_get_drvdata(dev); >> + u16 boot_progress[3] = { 0 }; >> + u32 bootstage; >> + u8 boot_stage; >> + u8 cur_stage; >> + u32 reg_lo; >> + u32 reg; >> + int ret; >> + >> + /* Read current boot stage */ >> + ret = regmap_read(misc->regmap, CUR_BOOTSTAGE, ®); >> + if (ret) >> + return ret; >> + >> + cur_stage = reg & 0xff; >> + >> + ret = regmap_read(misc->regmap, BOOTSTAGE, &bootstage); >> + if (ret) >> + return ret; >> + >> + boot_stage = (bootstage >> 8) & 0xff; >> + >> + if (boot_stage > cur_stage) >> + return -EINVAL; >> + >> + ret = regmap_read(misc->regmap, BOOTSTAGE_LO, ®_lo); >> + if (!ret) >> + ret = regmap_read(misc->regmap, BOOTSTAGE_HI, ®); >> + if (ret) >> + return ret; >> + >> + /* Firmware to report new boot stage next time */ >> + if (boot_stage < cur_stage) { >> + ret = regmap_write(misc->regmap, BOOTSTAGE, ((bootstage & 0xff00) | 0x1)); >> + if (ret) >> + return ret; >> + } >> + >> + boot_progress[0] = bootstage; >> + boot_progress[1] = swab16(reg); >> + boot_progress[2] = swab16(reg_lo); >> + >> + return sysfs_emit(buf, "%*phN\n", (int)sizeof(boot_progress), boot_progress); >> +} > > Again, please put the Documentation/ABI/ entries in this commit so that > we can verify they are all correct. Putting them at the end of the > series makes it pretty impossible to review. Would you want to have to > match them all up the way you sent them? > Will do in next version. Thanks, - Quan