Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp755845rdb; Thu, 30 Nov 2023 18:46:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSsq28+kt23m/RMEd8/BsGtVg/b1EfCmueRAyzK2o1AzjASFonVr49+8fG3vQkLG8N7Iwr X-Received: by 2002:a05:6a20:5615:b0:18b:cdd4:1cb6 with SMTP id ir21-20020a056a20561500b0018bcdd41cb6mr21363487pzc.29.1701398799063; Thu, 30 Nov 2023 18:46:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701398799; cv=none; d=google.com; s=arc-20160816; b=nezVWczOLlubzwYCI6opbDyEG2y/82y+KSMRahWbCcBCGLYnAbaK9abLo02h1xpcBi yMqsA8lZUG5s0/0Nf+ni+dV/JbY4v6ciXwuGe30c1WEZwTG7n4tly4Eh2vc9QnJ8jxty 4eTsr9KhdLtLQ8RBPAb+7BPMf47nuJa1UB7PNKsxMXE0aN2Q3SVANr282Hx2TG5UEF1Y VQtJWe8SnFxa6bpx2ochWXzBhlFrHwV6PUG/bBxSkGrv/uM17w/URsmsiMY0Mzv7tfAm UzhGkQkp82pqGMAitvXS0TJNeUrBR/HRBfPU2weAMeJW9O3xawvsWWkPbJhpmeTIwkoy OUTQ== 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=w/4UKzLglJJXRLFcQyu9ugtlejmhUNknHzzU6v3T6ZY=; fh=p6N9tYw93mTr1txSOJiTQ6d5K1lbZPHYdC7AkYqYqA0=; b=yhAPbRmiHGtsb/bVb8GvU6ikMCorU7jEn3lSXD0zoVMg4uxVqljPa/9lRgA6+wPkNz xPXQ39fhxdYD5Ih5eaHbS+MS4xXSt8Tz+uwg0REgMz0V9yTQ4K6itI2nqNDoOoDCNM2o +MYcruemy8nCCGKSJurnt7DQvDXSyAzNz2TEVZaiZWCRx4WvahuyCU9QBxSnO9TgThZ6 dU5v+uovVMy2VOjQlXI6FRWYR0t5NxI02uaE7EqnSaDjRXRs4VUvhnX6g9M5ZPuhrlOR BFfb0ktsBLUv22QPGpNRr1eEEGVKWbHB4w/U7LWeTkv8cMl/iEcIvj2s5FXiEoS3NT5L g9vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s3-20020a056a00194300b006cb63c86cc2si2469354pfk.100.2023.11.30.18.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 18:46:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 17035807F4B8; Thu, 30 Nov 2023 18:45:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376685AbjLACpV (ORCPT + 99 others); Thu, 30 Nov 2023 21:45:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbjLACpU (ORCPT ); Thu, 30 Nov 2023 21:45:20 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C97DA8 for ; Thu, 30 Nov 2023 18:45:26 -0800 (PST) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4ShHTb0CvWzvQw8; Fri, 1 Dec 2023 10:44:51 +0800 (CST) Received: from [10.67.121.59] (10.67.121.59) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 1 Dec 2023 10:45:23 +0800 Message-ID: Date: Fri, 1 Dec 2023 10:45:23 +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 v2 4/4] soc: hisilicon: kunpeng_hccs: Support the platform with PCC type3 and interrupt ack To: Jonathan Cameron CC: , , , , , , , References: <20231109054526.27270-1-lihuisong@huawei.com> <20231130134550.33398-1-lihuisong@huawei.com> <20231130134550.33398-5-lihuisong@huawei.com> <20231130144911.00005faf@Huawei.com> From: "lihuisong (C)" In-Reply-To: <20231130144911.00005faf@Huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.121.59] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.9 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 30 Nov 2023 18:45:37 -0800 (PST) 在 2023/11/30 22:49, Jonathan Cameron 写道: > On Thu, 30 Nov 2023 21:45:50 +0800 > Huisong Li wrote: > >> Support the platform with PCC type3 and interrupt ack. And a version >> specific structure is introduced to handle the difference between the >> device in the code. >> >> Signed-off-by: Huisong Li > Hi. > > A few trivial things inline but now looks good to me! > > Reviewed-by: Jonathan Cameron > >> --- >> drivers/soc/hisilicon/kunpeng_hccs.c | 136 ++++++++++++++++++++++----- >> drivers/soc/hisilicon/kunpeng_hccs.h | 15 +++ >> 2 files changed, 126 insertions(+), 25 deletions(-) >> >> diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c >> index 15125f1e0f3e..d2302ff8c0e9 100644 >> --- a/drivers/soc/hisilicon/kunpeng_hccs.c >> +++ b/drivers/soc/hisilicon/kunpeng_hccs.c > ... > >> >> -static int hccs_check_chan_cmd_complete(struct hccs_dev *hdev) >> +static inline int hccs_wait_cmd_complete_by_poll(struct hccs_dev *hdev) > Why inline? Do we have numbers to support this hint to the compiler being > useful? No testing for this, but here might not be really useful. So will remove this inline. >> { >> struct hccs_mbox_client_info *cl_info = &hdev->cl_info; >> struct acpi_pcct_shared_memory __iomem *comm_base = >> @@ -194,30 +211,75 @@ static int hccs_check_chan_cmd_complete(struct hccs_dev *hdev) >> return ret; >> } >> >> +static inline int hccs_wait_cmd_complete_by_irq(struct hccs_dev *hdev) >> +{ >> + struct hccs_mbox_client_info *cl_info = &hdev->cl_info; >> + int ret = 0; > Drop ret... Ack > >> + >> + if (!wait_for_completion_timeout(&cl_info->done, >> + usecs_to_jiffies(cl_info->deadline_us))) { >> + dev_err(hdev->dev, "PCC command executed timeout!\n"); >> + ret = -ETIMEDOUT; > return -TIMEDOUT; > ... >> + } >> + >> + return ret; > return 0; Ack >> +} >> +static const struct hccs_verspecific_data hisi04b1_verspec_data = { >> + .rx_callback = NULL, > It's harmless but no need to set callback to NULL. Maybe it acts as documentation? Just to explicitly assign value and show the difference between the devices. > It's common practice to just let C spec guarantees initialize any not implemented callbacks > to 0 without them needing to be done explicitly. Correct, but It's harmless. > >> + .wait_cmd_complete = hccs_wait_cmd_complete_by_poll, >> + .fill_pcc_shared_mem = hccs_fill_pcc_shared_mem_region, >> + .shared_mem_size = sizeof(struct acpi_pcct_shared_memory), >> + .has_txdone_irq = false, >> +}; >> + >> +static const struct hccs_verspecific_data hisi04b2_verspec_data = { >> + .rx_callback = hccs_pcc_rx_callback, >> + .wait_cmd_complete = hccs_wait_cmd_complete_by_irq, >> + .fill_pcc_shared_mem = hccs_fill_ext_pcc_shared_mem_region, >> + .shared_mem_size = sizeof(struct acpi_pcct_ext_pcc_shared_memory), >> + .has_txdone_irq = true, >> +}; > .