Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2452904rwb; Sun, 6 Aug 2023 19:15:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdIqAlt7B+08VT4BvoiPONMlODQUeHkOaimCgcdlKgjmEgGUWbQ2mAkvqRfkLLHJMDLEJN X-Received: by 2002:a17:907:78cb:b0:994:5340:22f4 with SMTP id kv11-20020a17090778cb00b00994534022f4mr7489858ejc.6.1691374545562; Sun, 06 Aug 2023 19:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691374545; cv=none; d=google.com; s=arc-20160816; b=IDmc7lGmrbQow1TW/2qmWQJJQ2JSEmbvBDRWBw2mE5Xp0VwvzJQENfNoiilYikX23L rizURjY4UM0v0pxT4OZzCatX5Nr92nnM6EsDqaTg8U+hTrV3nRxRvuTFa02sFTloAJ1E /nEeY4pTagGk8jgpvROUmgXPn2UCQY/xIAeXfx6AXS6dzZySbdlKB/rhpGea1UgQlE6K 4k5TXol4bm6bgS4RAXYklwzIPOKkHBlCiv/9c0waIq1zSyZL201G5SZaLGY1JTcYEtXi qhfFYz2ZgXh7XhDoFjjWXQQR+QpfMemedOC9qkSOz6Npyfc57hLhKuIJTuDkjOam3ica 6/uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=dKy5Baz0bHsJEvkv9CXYHoQLLPza2irSkzC++9Tjgj8=; fh=U84DF1UimozIpKq1lZUxHGFRYlg0puJ1fbwR9D2BiTg=; b=esZh+Y78OwfRYxv2s+mRez65m9pC1tA+504/Iw/waZdsi5taPwSh+aUvQUSB33iPZ0 q+Jp5FXObl3NnavQAlNt0e5oH1VcCtCM+nVsqat9djVEntoLKAUi4yKq60RGSKIN0TYc uqeQ4VyJXYYU3vTM3H94q+KCYLgp6PR70cDQN/N3kyXCgUzbxUXtRiIL2xhlXV6MhHux X2zVHkflEj68c8qXwRw+yTB12Qt0YmTk+UJ4jOwtUH2P6JzsN0vYHYA3Emukj7jGlU/O L9cyzcledBQTRKkJzgB9iy2ZBp/oOCCJKU1hZPTkw4iXox1/Emdao3v5Dy99ec6HR6rV lAUA== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z12-20020a1709063a0c00b0099b921de2fasi5106152eje.964.2023.08.06.19.15.21; Sun, 06 Aug 2023 19:15:45 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229473AbjHGBlM (ORCPT + 99 others); Sun, 6 Aug 2023 21:41:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjHGBlL (ORCPT ); Sun, 6 Aug 2023 21:41:11 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AC801713 for ; Sun, 6 Aug 2023 18:41:10 -0700 (PDT) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RJzXH5b8Rz1KCJn; Mon, 7 Aug 2023 09:39:59 +0800 (CST) Received: from [10.67.103.231] (10.67.103.231) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 09:41:07 +0800 Message-ID: Date: Mon, 7 Aug 2023 09:41:06 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v6 1/2] soc: hisilicon: Support HCCS driver on Kunpeng SoC To: Zenghui Yu , , , , , CC: , , , , , , References: <20230424073020.4039-1-lihuisong@huawei.com> <20230801024119.37215-1-lihuisong@huawei.com> <20230801024119.37215-2-lihuisong@huawei.com> From: "lihuisong (C)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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 Hi Zenghui, Please ignore the previous email and take a look at this. 在 2023/8/6 23:09, Zenghui Yu 写道: > A few trivial comments inline. Many thanks for reviewing my patch carefully.???? > > On 2023/8/1 10:41, Huisong Li wrote: >> The Huawei Cache Coherence System (HCCS) is a multi-chip interconnection >> bus protocol. The performance of the application may be affected if some >> HCCS ports on platform are not in full lane status, have a large number >> of CRC errors and so on. >> >> This driver provides the query interface of the health status and >> port information of HCCS on Kunpeng SoC. >> >> Signed-off-by: Huisong Li > > [...] > >> +static int hccs_query_all_port_info_on_platform(struct hccs_dev *hdev) >> +{ >> + >> +    struct device *dev = hdev->dev; >> +    struct hccs_chip_info *chip; >> +    struct hccs_die_info *die; >> +    u8 i, j; >> +    int ret; >> + >> +    for (i = 0; i < hdev->chip_num; i++) { >> +        chip = &hdev->chips[i]; >> +        for (j = 0; j < chip->die_num; j++) { >> +            die = &chip->dies[j]; >> +            if (!die->port_num) >> +                continue; >> + >> +            die->ports = devm_kzalloc(dev, >> +                die->port_num * sizeof(struct hccs_port_info), >> +                GFP_KERNEL); >> +            if (!die->ports) { >> +                dev_err(dev, "allocate ports memory on chip%u/die%u >> failed.\n", >> +                    i, die->die_id); >> +                return -ENOMEM; >> +            } >> + >> +            ret = hccs_get_all_port_info_on_die(hdev, die); >> +            if (ret) { >> +                dev_err(dev, "get die(%u) info on chip%u failed, ret >> = %d.\n", > > "get *port* info failed"? Yes, this is more exact. Will be fixed to "get port info on chip%u/die%u failed". > >> +static int hccs_get_die_all_link_status(struct hccs_dev *hdev, >> +                    const struct hccs_die_info *die, >> +                    u8 *all_linked) >> +{ >> +    struct hccs_die_comm_req_param *req_param; >> +    struct hccs_desc desc; >> +    int ret; >> + >> +    if (die->port_num == 0) { >> +        *all_linked = 1; >> +        return 0; >> +    } >> + >> +    hccs_init_req_desc(&desc); >> +    req_param = (struct hccs_die_comm_req_param *)desc.req.data; >> +    req_param->chip_id = die->chip->chip_id; >> +    req_param->die_id = die->die_id; >> +    ret = hccs_pcc_cmd_send(hdev, HCCS_GET_DIE_PORTS_LANE_STA, &desc); > > Typo? Looks like we intend to send a HCCS_GET_DIE_PORTS_LINK_STA > command. Yes, you are right. It's my fault. Appreciate you so much for pointing it out. I will also check other commands again. > >> +/* >> + * This value cannot be 255, otherwise the loop of the multi-BD >> communication >> + * case cannot end. >> + */ >> +#define HCCS_DIE_MAX_PORT_ID    254 > > This looks weird. Isn't the "max port id" depends on your HW > implementation? The "max port id" normally depends on HW implementation. And there are no so many numbers of port on one die. But HW implementation specification is possiable to change in furture SoC. Driver should be compatible with it. So "max port id" here comes from the communication interface and way with firmware. > >> +#define hccs_get_field(origin, mask, shift) \ >> +    (((origin) & (mask)) >> (shift)) >> +#define hccs_get_bit(origin, shift) \ >> +    hccs_get_field((origin), (0x1UL << (shift)), (shift)) > > Unused macroes. This macroes were used in previous version. Later, the place where it is used was deleted, now it is unused indeed. will delete it. > > P.S., I'd personally prefer splitting this patch in 2 to ease other > reviewer's work: > > - deal with the HCCS HW (chip/die/port) probing > - focus on the sysfs/query things Ok, I will split this patch in next version. Thanks. > . /Huisong