Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2620585iog; Mon, 20 Jun 2022 00:35:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u13hy+2zi0AuUQGr3JyW8iO/kEzQo2F51fbnB3coFtvYEi5uoCAYwR2EeOQ1gJLqf3vm/n X-Received: by 2002:a63:7145:0:b0:40c:aac7:41de with SMTP id b5-20020a637145000000b0040caac741demr4692390pgn.490.1655710556443; Mon, 20 Jun 2022 00:35:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655710556; cv=pass; d=google.com; s=arc-20160816; b=ueLcyrMftXK1P9lpFQSt/ykk+WVVEdkN6QnXewko8nE92GS5raNE60gxEOaVNE6/dD 5nHmfsdlQ6ncrgZ66xVBim4Anq65ixQeJk/DmyQfHyhqF+IHrUryOsVOA4vl8DAuXfeo q2/ParsAqVinMwjnuKwDUsGO+qSvSdOQZk8z3hyqwI96G4Yqjc4LRqT3WKpnIRkk/JFo ytlxGMx42GMdmL291822hSjjm97+3SII7F0sKD0XvdRKoFK28HF3IVEo3C4raD9X8VIV RLC2RwDaE/HMrccIJwhO+rjv1e3P1C165x66uJwFzO8WdG5eRSUZwndv2OP4lsYSDsEs prnw== 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=k2bNy4D4ZGTYBpozLztCuEEp0erKvR2Z02I5t4sTO3s=; b=ZD/VvDCbKpqPRmFtX0z5kyNJe8rWn5vhp5nyivBHGEKlNKnKXBu3UL47JugBBdJ7V4 8Rf34NigyDh6WWcrZHkiNLo4pNUmRxQJ/iRjH8x+lBPKXgcwHZHnP+xm//yFPfLKUlyk nQTcjU5POKooQbcKVUXzinLTeliXtfCNBFhUuUMTa3Ui4VGibka1O/Z464eEftYvwATp 4NTxhQcPY660xbOBzmt94X92b2RoNL7Q2USw5jinYH22rsvjf+3ZDbMVJu2YZ1+YhHZ2 y4O4Cg7CcmES7CWDKzAgczMKbi0aWPQ/R+2xNN/xjg2f/7PBiYMMrMpjKtfGgNXNI1MO +OOA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=R8Y5kgRl; 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 j3-20020a170903028300b0015ce8cd5066si18176294plr.246.2022.06.20.00.35.41; Mon, 20 Jun 2022 00:35:56 -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=R8Y5kgRl; 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 S239199AbiFTHQ5 (ORCPT + 99 others); Mon, 20 Jun 2022 03:16:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239025AbiFTHQz (ORCPT ); Mon, 20 Jun 2022 03:16:55 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2138.outbound.protection.outlook.com [40.107.101.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07F88E0CB; Mon, 20 Jun 2022 00:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mH+B0hzBwh5ikW/IXOJqXcGUbs3wwiyNzEE/K/2RLCNDuoNHwk+bFJww1hinIIRjNwxiV7ObFYvQIgSG6zXnqSBPQt9TI9Kw+YyJ/rWgOkIt4ZChRI/2HLPzDuIsafNiGnr/44j1KBOGHa2BWZyszH7XesyWl9l7dgihdvFIZO9Ejfgdjj4kaXiW9e+LSY/w9xqmWZIvD1FrL7MUZa1EleFajp4h8u5MFqtZjCwlOYJ7WIXYpv0V/r1GAFV2WsIMLbxzHC06BDj0Ke43wbT5Q67UKk+3gzAkZS5c2aX9Di5ZY6b/ZpFgrxAOfxoZga23aVxQ5WBl98sKc+YFb9DoZA== 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=k2bNy4D4ZGTYBpozLztCuEEp0erKvR2Z02I5t4sTO3s=; b=k79mzlUN6u4nbbIM2bi8MfxCECKAlFjfjyncKoQnUXDQb3m6CLYe6+YZ9pPJZeg3rD5mCxk0mLbRd1LM1zvTRxJyoW7UEFq5QhelwFUvcFnT3fNa3IW5RRqmpFqr7ageYTiRWNvYcPICCJsVncy0gHsAia+VN4ftMSlFczmIgiVaxWep+9srtN0npLYIz0+b44iCs4GcQrktr1abGNVKpBjH67H0UPD8tYYuQw56GGzj0rVbgx4A6NhWU6qVYWR34uGH+mt2Rc7InmDKuluVpL1NgfGel+N6eeA0R8OclEfJQlkTn4Y8O5lOwUtzy/IPfJChvoUPbdx7BG08zlmbCg== 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=k2bNy4D4ZGTYBpozLztCuEEp0erKvR2Z02I5t4sTO3s=; b=R8Y5kgRlIiOWaLG+SPinBERNwKgmb90JopZ32GVFHEgavk1C8yuE3QC8qEJXfKSuUqCIbC3MTDC7oVTGjr3cp0b3CvvxP/NbAkJoJSfLsGD0JbxGkRnei5y6XwzQk0YwUwSm4i9eX+SSg0Uk7keGNvY3FSjHINe2lixHUnHuYmA= 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 CO6PR01MB7403.prod.exchangelabs.com (2603:10b6:303:136::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Mon, 20 Jun 2022 07:16:51 +0000 Received: from SJ0PR01MB7282.prod.exchangelabs.com ([fe80::7535:773:f979:893e]) by SJ0PR01MB7282.prod.exchangelabs.com ([fe80::7535:773:f979:893e%7]) with mapi id 15.20.5353.021; Mon, 20 Jun 2022 07:16:50 +0000 Message-ID: <997aa782-deb0-1d88-c144-8ea4537e55c2@os.amperecomputing.com> Date: Mon, 20 Jun 2022 14:16:36 +0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v8 1/3] ipmi: ssif_bmc: Add SSIF BMC driver Content-Language: en-US To: Christophe JAILLET Cc: andrew@aj.id.au, benh@kernel.crashing.org, brendanhiggins@google.com, devicetree@vger.kernel.org, joel@jms.id.au, krzysztof.kozlowski+dt@linaro.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, minyard@acm.org, openbmc@lists.ozlabs.org, openipmi-developer@lists.sourceforge.net, patches@amperecomputing.com, phong@os.amperecomputing.com, robh+dt@kernel.org, thang@os.amperecomputing.com, wsa@kernel.org References: <20220615090259.1121405-1-quan@os.amperecomputing.com> <20220615090259.1121405-2-quan@os.amperecomputing.com> <7b9923c0-50f0-556a-657c-9cf0ef9af5aa@wanadoo.fr> From: Quan Nguyen In-Reply-To: <7b9923c0-50f0-556a-657c-9cf0ef9af5aa@wanadoo.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SGAP274CA0001.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::13) To SJ0PR01MB7282.prod.exchangelabs.com (2603:10b6:a03:3f2::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0b3ce7e-b9b9-4d83-1595-08da528cd81d X-MS-TrafficTypeDiagnostic: CO6PR01MB7403: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: Se8+vhj+e9QL7sO64WAq7T3JbvmpZsicCRhFXAfLu33MUSwZilRcTFkUv8NWz4z/ZCx10RNS4ypuVOSEPZCkG9zYMPWhK4fcm16BnAbxgzba4eVyjmrf6cPSz0QWcxESkXJZMr5uk31jLaMLgBVr7lTy40uIHIX1pGUI+w89FaEkY/5pTHaQC12UGnhFvluvYi9E3VpqNzSncHrx2HuZMPNrSnGY8khJ8dgdNCUKFDa0wzfy99kOMB7NmGXcHc4lJnOVwTPPErkNwRzZMdFKCyhavNIvLjj7o8oBOZNvbB50V8u9ZHbK6NK+i+mIQN+TAeleo6SVbGflwEYhBaq8J3/y4Vi2AZbUuw9/vXl/z8qj5o6GvcagawaFing11NNHMifAir4461PseMbDvzVYhLs6CPZn/fmNPLLCVulOep+YWfse/7P6qoKbr5RRuKLRN96JpDOBFoHWQ2D3bquxIICofBj5d1wXikH+U/hx7B1iUhZ60ghP6wRxssMEmvnV8Q2lhdHSadLX3c9sdJQB5+f06LDkYbMea0UZ2vaTqGIBjGHA9J5ZTjrQ5yhVU/OcvnK/7Oncb4DaJeEDYos8GlN6E4jzhydR7i2qq3x/wBchzwLfBcvL9ex3xm7rUCwXPXXw54RHtGdxrWFU1Pig2KZCOA03t3LZXml+NnCiKGF9fn7jummoLPv2Cge8ihzYRa+31/RoVoDYx6pMNboR+oeQ0PY0XyQ4fdXX1EN5pxgJEV69XQ+WWIJkSg3RNjRTnt0uhmpOKYkEdn3Z+xRW64nBJ8lpyPqOczEZzGVtbJ2nFW0GnHH6OtpQddHsMmP4 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:(13230016)(4636009)(366004)(8936002)(6486002)(83380400001)(966005)(66476007)(66574015)(53546011)(2616005)(31686004)(7416002)(498600001)(186003)(5660300002)(66946007)(86362001)(6666004)(2906002)(38100700002)(6916009)(316002)(8676002)(66556008)(31696002)(6506007)(6512007)(26005)(52116002)(38350700002)(4326008)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R0d6d014QVlmTFB0Q21GbDI4RVhyVnMyRU4wOHBMZnNmOXJiSTI1MVBIUjA2?= =?utf-8?B?NEU5cW1PcERkVnV6eHJLOGhMSndtTElEeDRsT2xJaDU2ZkIwbkN0MFh5WGk1?= =?utf-8?B?eDVIYS94T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Xp3ODBXeVAwMGV0alZ2?= =?utf-8?B?V3JlRTErTmd4dEtzN0VTallpSEZsM3ZNbEZVb3B4TGl2MkFINFc3K0lTU3pD?= =?utf-8?B?UlFaTi9DU3pWSHhkZ1ZoaitTSktiNU1BaUkzb01xdVZtemxQbTUwY2gxYVZX?= =?utf-8?B?TkRWVEFGUllBUG5nYkZ1RExScm9LdU5OUWRQRFBsbkkvNGIzZk1vZFZSNmda?= =?utf-8?B?cXhRMkMvb0dEb055NkZOVy9pcm5aZXdtQWt6U1lCc0pDSEJlbFlqZ3RJVEw3?= =?utf-8?B?THpqZFFuMjFSNFlNS1JOcEhpYWFqaWVuNHEyb1U3SDFjNnNLNkpFRTlxaTh3?= =?utf-8?B?ZHVSOGtlWGQ1MUhkRVJINC91WXV5UUx2RE9YbEV0Qk9SRVpEQ0w1UWQ1VFVF?= =?utf-8?B?K0swYmNuQWNLK05qdmxPWVZzUGdJYmRUTXF1RWMvY2VRUVd2SGpUQWhBRXdX?= =?utf-8?Q?eq2IevJVvatIQdKE6CTATZVNegb+3wk/mZ8f3?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0b3ce7e-b9b9-4d83-1595-08da528cd81d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR01MB7282.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2022 07:16:50.6966 (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: UgZrz7GY/ztCVeXdwhEGpy9wXcNpWwiTOaO5vkW893Y56EOh3eF/93A8KwTvne/WCKist97SjKhrdt76qsAK/x/jMk+c2w8P9Xe/epybJL8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR01MB7403 X-Spam-Status: No, score=-2.0 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,T_SCC_BODY_TEXT_LINE 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 17/06/2022 03:47, Christophe JAILLET wrote: > Le 15/06/2022 à 11:02, Quan Nguyen a écrit : >> The SMBus system interface (SSIF) IPMI BMC driver can be used to perform >> in-band IPMI communication with their host in management (BMC) side. >> >> Thanks Dan for the copy_from_user() fix in the link below. >> >> Link: >> https://lore.kernel.org/linux-arm-kernel/20220310114119.13736-4-quan-shex6MNQR2J/SfDzf78azzKzEDxYleXD@public.gmane.org/ >> >> Signed-off-by: Quan Nguyen >> >> --- > > Hi, > > a few nitpick below > > [...] > >> diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c >> new file mode 100644 >> index 000000000000..0bfd4b9bbaf1 >> --- /dev/null >> +++ b/drivers/char/ipmi/ssif_bmc.c >> @@ -0,0 +1,880 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * The driver for BMC side of SSIF interface >> + * >> + * Copyright (c) 2022, Ampere Computing LLC >> + * >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#define DEVICE_NAME                             "ipmi-ssif-host" >> + >> +#define GET_8BIT_ADDR(addr_7bit)                (((addr_7bit) << 1) & >> 0xff) >> + >> +/* A standard SMBus Transaction is limited to 32 data bytes */ >> +#define MAX_PAYLOAD_PER_TRANSACTION             32 >> +/* Transaction includes the address, the command, the length and the >> PEC byte */ >> +#define MAX_TRANSACTION >> (MAX_PAYLOAD_PER_TRANSACTION + 4) >> + >> +#define MAX_IPMI_DATA_PER_START_TRANSACTION     30 >> +#define MAX_IPMI_DATA_PER_MIDDLE_TRANSACTION    31 >> + >> +#define SSIF_IPMI_SINGLEPART_WRITE              0x2 >> +#define SSIF_IPMI_SINGLEPART_READ               0x3 >> +#define SSIF_IPMI_MULTIPART_WRITE_START         0x6 >> +#define SSIF_IPMI_MULTIPART_WRITE_MIDDLE        0x7 >> +#define SSIF_IPMI_MULTIPART_WRITE_END           0x8 >> +#define SSIF_IPMI_MULTIPART_READ_START          0x3 >> +#define SSIF_IPMI_MULTIPART_READ_MIDDLE         0x9 >> + >> +/* >> + * IPMI 2.0 Spec, section 12.7 SSIF Timing, >> + * Request-to-Response Time is T6max(250ms) - T1max(20ms) - 3ms = 227ms >> + * Recover ssif_bmc from busy state if it takes up to 500ms >> + */ >> +#define RESPONSE_TIMEOUT                        500 /* ms */ >> + >> +struct ssif_part_buffer { >> +    u8 address; >> +    u8 smbus_cmd; >> +    u8 length; >> +    u8 payload[MAX_PAYLOAD_PER_TRANSACTION]; >> +    u8 pec; >> +    u8 index; >> +}; >> + >> +/* >> + * SSIF internal states: >> + *   SSIF_READY         0x00 : Ready state >> + *   SSIF_START         0x01 : Start smbus transaction >> + *   SSIF_SMBUS_CMD     0x02 : Received SMBus command >> + *   SSIF_REQ_RECVING   0x03 : Receiving request >> + *   SSIF_RES_SENDING   0x04 : Sending response >> + *   SSIF_BAD_SMBUS     0x05 : Bad SMbus transaction > > If these states are related to the enum just below, > s/SSIF_BAD_SMBUS/SSIF_ABORTING/ + description update? > Thank you for this catch. Will fix in new version. >> + */ >> +enum ssif_state { >> +    SSIF_READY, >> +    SSIF_START, >> +    SSIF_SMBUS_CMD, >> +    SSIF_REQ_RECVING, >> +    SSIF_RES_SENDING, >> +    SSIF_ABORTING, >> +    SSIF_STATE_MAX >> +}; >> + > > [...] > >> +static int ssif_bmc_probe(struct i2c_client *client, const struct >> i2c_device_id *id) >> +{ >> +    struct ssif_bmc_ctx *ssif_bmc; >> +    int ret; >> + >> +    ssif_bmc = devm_kzalloc(&client->dev, sizeof(*ssif_bmc), >> GFP_KERNEL); >> +    if (!ssif_bmc) >> +        return -ENOMEM; >> + >> +    spin_lock_init(&ssif_bmc->lock); >> + >> +    init_waitqueue_head(&ssif_bmc->wait_queue); >> +    ssif_bmc->request_available = false; >> +    ssif_bmc->response_in_progress = false; >> +    ssif_bmc->busy = false; >> +    ssif_bmc->response_timer_inited = false; >> + >> +    /* Register misc device interface */ >> +    ssif_bmc->miscdev.minor = MISC_DYNAMIC_MINOR; >> +    ssif_bmc->miscdev.name = DEVICE_NAME; >> +    ssif_bmc->miscdev.fops = &ssif_bmc_fops; >> +    ssif_bmc->miscdev.parent = &client->dev; >> +    ret = misc_register(&ssif_bmc->miscdev); >> +    if (ret) >> +        goto out; > > Could be "return ret;" > (see below) > Will change to "return ret;" in next version >> + >> +    ssif_bmc->client = client; >> +    ssif_bmc->client->flags |= I2C_CLIENT_SLAVE; >> + >> +    /* Register I2C slave */ >> +    i2c_set_clientdata(client, ssif_bmc); >> +    ret = i2c_slave_register(client, ssif_bmc_cb); >> +    if (ret) { >> +        misc_deregister(&ssif_bmc->miscdev); >> +        goto out; >> +    } >> + >> +    return 0; >> +out: >> +    devm_kfree(&client->dev, ssif_bmc); > > This looks useless to me. The whole error handling path could be > removed, or updated to only have the "misc_deregister()" above. > Will rewrite as: /* Register I2C slave */ i2c_set_clientdata(client, ssif_bmc); ret = i2c_slave_register(client, ssif_bmc_cb); if (ret) misc_deregister(&ssif_bmc->miscdev); return ret; Thanks for the review. - Quan