Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2355766rwb; Fri, 11 Nov 2022 08:12:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf4gg1HdrNRieF/+lobmng6BHxfNg76Z4uaatF3zjk7hd92STWUCQK25y/nP4HlpZegP4Rvl X-Received: by 2002:a17:90a:1b83:b0:200:6637:a9e3 with SMTP id w3-20020a17090a1b8300b002006637a9e3mr2543349pjc.176.1668183156069; Fri, 11 Nov 2022 08:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668183156; cv=none; d=google.com; s=arc-20160816; b=tgqKBAp2SUY7Jt5TA02I5Ba6V+AGCoH3XeOpMobAnxXKq//J1p4ST7ukU6RDgpRXD2 z5GCnYIVhFRsKwHhdlyd1WO20VFsi6DFIYa3OW6TbL02fS6ZQ3BfzzYSPfHi7+9Ian7j YhcoPpGopCKDEj6YNUXd9DB9MRlAPLShW1bOtYODo/680Ya2zo4pngFaG4Qbl3+Ly8P/ iSrs/pb1K2ypWH2JYr3W8OZxQWOrtQw6yyrknJaI2ysH/F/lVwG/hzGV9QThkQB8GIWx OXru35E2AmKhZES/DswkC72OLsPl/LOHuH25W82WyjEccC+KW9QgvCDyXv/Qd331UpZ0 k08g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=px/TxECf5FiB63wrzcqCM5ZJLVr9kxCn1XL6hGXeafo=; b=W9g8m2w6Qj8ZZojfmq2xZNF3BNb81Xmaf2/mywpWSsJYn4qdHrsfrTEfgvrk2WECfV 9HmHJw7Hgbe7bz6gPYGxNwO2xMXO6jK6o2nVOW+AODlqLBCremXq0OGWAiOVUp56oLtH mVc4IGm9VR0sSCmoe6rHHsqqdBHJbbPY/VyXH5iRdlS5ht6HA5I0MJHvVt6kX5LQJdQA uYPDAcZu21r4/vGf/H1onwWVj5WPhWi5xJRliOnrU5EOH6W2/3g+fVYIyfXMclYN36KH nty6RTT9ddAvp2zKAlE3RU9bWlIqV6GtIyAUciGIDfPgZvdpSVRUuB1wJDQpLmnjbVsP 2Smw== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d14-20020a056a00244e00b005698856bb2bsi2508791pfj.330.2022.11.11.08.12.22; Fri, 11 Nov 2022 08:12:36 -0800 (PST) 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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233938AbiKKO03 (ORCPT + 91 others); Fri, 11 Nov 2022 09:26:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234588AbiKKO0L (ORCPT ); Fri, 11 Nov 2022 09:26:11 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 202EF1AD; Fri, 11 Nov 2022 06:26:08 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D9AF51FB; Fri, 11 Nov 2022 06:26:14 -0800 (PST) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E55DD3F73D; Fri, 11 Nov 2022 06:26:06 -0800 (PST) Date: Fri, 11 Nov 2022 14:26:04 +0000 From: Sudeep Holla To: Huisong Li Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Sudeep Holla , rafael@kernel.org, rafael.j.wysocki@intel.com, wanghuiqiang@huawei.com, zhangzekun11@huawei.com, wangxiongfeng2@huawei.com, tanxiaofei@huawei.com, guohanjun@huawei.com, xiexiuqi@huawei.com, wangkefeng.wang@huawei.com, huangdaode@huawei.com Subject: Re: [PATCH V2 1/2] ACPI: PCC: add check for platform interrupt Message-ID: <20221111142604.qrk7bf2qf6ibfln3@bogus> References: <20221110015034.7943-1-lihuisong@huawei.com> <20221111024448.25012-1-lihuisong@huawei.com> <20221111024448.25012-2-lihuisong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221111024448.25012-2-lihuisong@huawei.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 Change $subject to: "ACPI: PCC: Setup PCC Opregion handler only if platform interrupt is available" On Fri, Nov 11, 2022 at 10:44:47AM +0800, Huisong Li wrote: > Currently, PCC Operation Region driver senses the completion of command by > interrupt way. If platform can not generate an interrupt when a command > complete, the caller never gets the desired result. So let's reject the > setup of the PCC address space on platform that do not support interrupt > mode. > Please reword something like below: "Currently, PCC OpRegion handler depends on the availability of platform interrupt to be functional currently. If it is not available, the OpRegion can't be executed successfully or the desired outcome won't be possible. So let's reject setting up the PCC OpRegion handler on the platform if it doesn't support or have platform interrupt available" > Signed-off-by: Huisong Li > --- > drivers/acpi/acpi_pcc.c | 47 +++++++++++++++++++++++++---------------- > 1 file changed, 29 insertions(+), 18 deletions(-) > > diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c > index 3e252be047b8..8efd08e469aa 100644 > --- a/drivers/acpi/acpi_pcc.c > +++ b/drivers/acpi/acpi_pcc.c > @@ -53,6 +53,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, > struct pcc_data *data; > struct acpi_pcc_info *ctx = handler_context; > struct pcc_mbox_chan *pcc_chan; > + static acpi_status ret; > > data = kzalloc(sizeof(*data), GFP_KERNEL); > if (!data) > @@ -69,23 +70,35 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, > if (IS_ERR(data->pcc_chan)) { > pr_err("Failed to find PCC channel for subspace %d\n", > ctx->subspace_id); > - kfree(data); > - return AE_NOT_FOUND; > + ret = AE_NOT_FOUND; > + goto request_channel_fail; The labels are confusing IMO. I would do 's/request_channel_fail/err_free_data/' to indicate what is exactly done there rather than just describing what failed. > } > > pcc_chan = data->pcc_chan; > + if (!pcc_chan->mchan->mbox->txdone_irq) { > + pr_err("This channel-%d does not support interrupt.\n", > + ctx->subspace_id); > + ret = AE_SUPPORT; > + goto request_channel_fail; This is wrong, you must goto "ioremap_fail" as you have been successful in opening the channel and now need to free the same. > + } > data->pcc_comm_addr = acpi_os_ioremap(pcc_chan->shmem_base_addr, > pcc_chan->shmem_size); > if (!data->pcc_comm_addr) { > pr_err("Failed to ioremap PCC comm region mem for %d\n", > ctx->subspace_id); > - pcc_mbox_free_channel(data->pcc_chan); > - kfree(data); > - return AE_NO_MEMORY; > + ret = AE_NO_MEMORY; > + goto ioremap_fail; Again I prefer 's/ioremap_fail/err_free_channel/' or something similar. With all the above comments incorporated, you can add: Reviewed-by: Sudeep Holla -- Regards, Sudeep