Message ID | 20230920064703.23543-3-lihuisong@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3925905vqi; Tue, 19 Sep 2023 23:54:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEq5y/CcXeOW7aKX41o/acATLmRA9nYNPwUYd9NC24DEr2c9VGH7beJy9hDDel3lRtIGb2M X-Received: by 2002:a05:6a00:b86:b0:68a:3b25:50cc with SMTP id g6-20020a056a000b8600b0068a3b2550ccmr1859853pfj.30.1695192842006; Tue, 19 Sep 2023 23:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695192841; cv=none; d=google.com; s=arc-20160816; b=GxV8snnDTUCl7lX/rh3rEbwjUUs0mgRTcf9+yVoKi1avHT1Wji1MIlNFPIsrgGyKLt U45HtMoPuyAVpM1jjwi6hDe936XbCoP2C7rXCvbhTJNW31mh18IbEBVI51YH/RnxtWN/ zmXzTjlc7PvwfR+4HFVYjAhpoS4L19eUJhvqTYSqXN5Yi86Xzn0AgmzgK7cNh10u78xO ZWkszwxtGM4+e8Hl2AnNYe0xFqfV/TzbHNrCLuL9o75Qk3U9sgqISe98mq+eJ8zf11XL SdiIngjWuhKuVULnDQWz3iTym+/wfKpvrHTHJIjqzO4SQYKogJGNVpbtFDQFkUPRXLGS benQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QJoStjTjge22psXPu7rHy4T8NnoCDQ3Py50x+PSdtLY=; fh=XKFVTLIwICKThvlqcUloCSp7yuwfaTWy6C5L6kfiAF8=; b=G9LhY61eBEakfVN2FgEHIoKYzWfY5/cKuOBs+iQaxgpcdFcwovXHQ0AYoIiLAg6JMl d9nIuGIO5MG7XddGWkELz+VCoF4OD7OYtvJuKAT0AgOVEhu061IRG1FidQa1n0H/AHrH rVVUjbqIzsLQXT6VdcxuyhRkuht3XEqcCgcn5VehyMrkB10SpYd9V9Tz4HIbnrdk+5oE Vpunx9uQbIzvWe4Z5ZxBzz9dV2xee3130yFWjn2Z0rKZVHcJoZLYQPWHAux484gxPN/z nq9m/0KObDjItxTIxG3AOusFLRQWeoirBItLk59uma9vBIZrqSN5Exs+sNjVAK+aCENQ LbZQ== 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:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id d9-20020a056a0010c900b0068255c2b8a8si11171703pfu.151.2023.09.19.23.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 23:54:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id B746A82ED27C; Tue, 19 Sep 2023 23:50:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233376AbjITGuh (ORCPT <rfc822;toshivichauhan@gmail.com> + 26 others); Wed, 20 Sep 2023 02:50:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233321AbjITGua (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 20 Sep 2023 02:50:30 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7D58AD; Tue, 19 Sep 2023 23:50:23 -0700 (PDT) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rr8Fz1Yb8zMlgF; Wed, 20 Sep 2023 14:46:47 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) 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.31; Wed, 20 Sep 2023 14:50:21 +0800 From: Huisong Li <lihuisong@huawei.com> To: <rafael@kernel.org>, <rafael.j.wysocki@intel.com>, <sudeep.holla@arm.com>, <xuwei5@hisilicon.com> CC: <linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <soc@kernel.org>, <linux-arm-kernel@lists.infradead.org>, <liuyonglong@huawei.com>, <lihuisong@huawei.com> Subject: [PATCH v2 2/2] soc: kunpeng_hccs: add the check for PCC subspace type Date: Wed, 20 Sep 2023 14:47:03 +0800 Message-ID: <20230920064703.23543-3-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230920064703.23543-1-lihuisong@huawei.com> References: <20230914115753.9064-1-lihuisong@huawei.com> <20230920064703.23543-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 19 Sep 2023 23:50:44 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777538529658682352 X-GMAIL-MSGID: 1777538529658682352 |
Series |
mailbox: pcc: export the PCC subspace type
|
|
Commit Message
Huisong Li
Sept. 20, 2023, 6:47 a.m. UTC
Currently, HCCS driver directly uses Generic Communications Channel Shared
Memory Region which is used in type0/1/2 to communicate with platform,
but actually doesn't support type3/4/5.
So this patch adds the check for PCC subspace type.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
Comments
On Wed, Sep 20, 2023 at 02:47:03PM +0800, Huisong Li wrote: > Currently, HCCS driver directly uses Generic Communications Channel Shared > Memory Region which is used in type0/1/2 to communicate with platform, > but actually doesn't support type3/4/5. > So this patch adds the check for PCC subspace type. > > Signed-off-by: Huisong Li <lihuisong@huawei.com> > --- > drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c > index f3810d9d1caa..4ba3bfd45a01 100644 > --- a/drivers/soc/hisilicon/kunpeng_hccs.c > +++ b/drivers/soc/hisilicon/kunpeng_hccs.c > @@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev) > return rc; > } > > +static int hccs_check_pcc_info(struct hccs_dev *hdev) > +{ > + struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan; > + > + if (pcc_chan->type >= ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE) { > + dev_err(hdev->dev, "unsupport for subspace type%u.\n", > + pcc_chan->type); > + return -EOPNOTSUPP; > + } Is this the only use of the PCC type information you have or do you plan to use it for something other than the validation. Just for sake of argument, I can say all users of PCC must then do the similar validation. I don't know where to draw the line here. Ideally I would expect the driver to make this transparent and give error during transmit if not supported. The driver must be able to work with different PCC type to support variety of platforms TBH. What is the issue exactly here ? Is this to prevent the use of Type 4 ? I think we must do something better but I don't know what that is yet.
在 2023/9/20 22:11, Sudeep Holla 写道: > On Wed, Sep 20, 2023 at 02:47:03PM +0800, Huisong Li wrote: >> Currently, HCCS driver directly uses Generic Communications Channel Shared >> Memory Region which is used in type0/1/2 to communicate with platform, >> but actually doesn't support type3/4/5. >> So this patch adds the check for PCC subspace type. >> >> Signed-off-by: Huisong Li <lihuisong@huawei.com> >> --- >> drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c >> index f3810d9d1caa..4ba3bfd45a01 100644 >> --- a/drivers/soc/hisilicon/kunpeng_hccs.c >> +++ b/drivers/soc/hisilicon/kunpeng_hccs.c >> @@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev) >> return rc; >> } >> >> +static int hccs_check_pcc_info(struct hccs_dev *hdev) >> +{ >> + struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan; >> + >> + if (pcc_chan->type >= ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE) { >> + dev_err(hdev->dev, "unsupport for subspace type%u.\n", >> + pcc_chan->type); >> + return -EOPNOTSUPP; >> + } > > Is this the only use of the PCC type information you have or do you plan to > use it for something other than the validation. Yeah, it is just validation now. we want to plan this driver can support more types. > > Just for sake of argument, I can say all users of PCC must then do the > similar validation. I don't know where to draw the line here. If export PCC type, it is good for the user of PCC to be more universal and more compatible. > > Ideally I would expect the driver to make this transparent and give error > during transmit if not supported. I understand you. I just check this type only once during the initializing phase. Otherwise, every once need to verify it when send PCC command. > > The driver must be able to work with different PCC type to support variety > of platforms TBH. What is the issue exactly here ? Is this to prevent the Agree more with you. IMO, the user of PCC has the ability to support variety of platforms if they can get PCC type. In this case, to prevent type 4 is necessary if driver cannot act as a slave. on the other hand, If one driver acts as a slave, platform must supply slave subspace for them. > use of Type 4 ? I think we must do something better but I don't know what > that is yet. Yes, we can try to do it better. I have a concern, like below. You know that the use of PCC can use polling mode and interrupt mode to communicate with platform. I'm not sure if the obtaining of the polling mode and interrupt mode is an issue to prevent driver to be more universal. But this driver can know if they support interrupt mode based on struct mbox_chan::struct mbox_controller::txdone_irq after requesting PCC channel. Because I'm not sure it's a better way. You know that drivers used interrupt mode need to fill the rx_callback function into mbx_client when register PCC channel. And drivers used polling mode don't do it. If we use this way, drivers that both support the two mode have to modify the rx_callback pointer after requesting PCC channel. >
Hi Sudeep, 在 2023/9/21 10:27, lihuisong (C) 写道: > > 在 2023/9/20 22:11, Sudeep Holla 写道: >> On Wed, Sep 20, 2023 at 02:47:03PM +0800, Huisong Li wrote: >>> Currently, HCCS driver directly uses Generic Communications Channel >>> Shared >>> Memory Region which is used in type0/1/2 to communicate with platform, >>> but actually doesn't support type3/4/5. >>> So this patch adds the check for PCC subspace type. >>> >>> Signed-off-by: Huisong Li <lihuisong@huawei.com> >>> --- >>> drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ >>> 1 file changed, 17 insertions(+) >>> >>> diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c >>> b/drivers/soc/hisilicon/kunpeng_hccs.c >>> index f3810d9d1caa..4ba3bfd45a01 100644 >>> --- a/drivers/soc/hisilicon/kunpeng_hccs.c >>> +++ b/drivers/soc/hisilicon/kunpeng_hccs.c >>> @@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct >>> hccs_dev *hdev) >>> return rc; >>> } >>> +static int hccs_check_pcc_info(struct hccs_dev *hdev) >>> +{ >>> + struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan; >>> + >>> + if (pcc_chan->type >= ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE) { >>> + dev_err(hdev->dev, "unsupport for subspace type%u.\n", >>> + pcc_chan->type); >>> + return -EOPNOTSUPP; >>> + } >> Is this the only use of the PCC type information you have or do you >> plan to >> use it for something other than the validation. > Yeah, it is just validation now. we want to plan this driver can > support more types. >> >> Just for sake of argument, I can say all users of PCC must then do the >> similar validation. I don't know where to draw the line here. > > If export PCC type, it is good for the user of PCC to be more > universal and more compatible. > >> >> Ideally I would expect the driver to make this transparent and give >> error >> during transmit if not supported. > I understand you. > I just check this type only once during the initializing phase. > Otherwise, every once need to verify it when send PCC command. >> >> The driver must be able to work with different PCC type to support >> variety >> of platforms TBH. What is the issue exactly here ? Is this to prevent >> the > Agree more with you. > IMO, the user of PCC has the ability to support variety of platforms > if they can get PCC type. > In this case, to prevent type 4 is necessary if driver cannot act as a > slave. > on the other hand, If one driver acts as a slave, platform must supply > slave subspace for them. >> use of Type 4 ? I think we must do something better but I don't know >> what >> that is yet. > > Yes, we can try to do it better. I have a concern, like below. > > You know that the use of PCC can use polling mode and interrupt mode > to communicate with platform. > I'm not sure if the obtaining of the polling mode and interrupt mode > is an issue to prevent driver to be more universal. > But this driver can know if they support interrupt mode based on > struct mbox_chan::struct mbox_controller::txdone_irq after requesting > PCC channel. > Because I'm not sure it's a better way. > You know that drivers used interrupt mode need to fill the rx_callback > function into mbx_client when register PCC channel. > And drivers used polling mode don't do it. > If we use this way, drivers that both support the two mode have to > modify the rx_callback pointer after requesting PCC channel. What do you feeling about the comments montioned above? Maybe we still need to export the information whether the platform support interrupt before requesting PCC channel. Looking forward your reply. >> > .
On Thu, Sep 21, 2023 at 10:27:36AM +0800, lihuisong (C) wrote: > > 在 2023/9/20 22:11, Sudeep Holla 写道: > > On Wed, Sep 20, 2023 at 02:47:03PM +0800, Huisong Li wrote: > > > Currently, HCCS driver directly uses Generic Communications Channel Shared > > > Memory Region which is used in type0/1/2 to communicate with platform, > > > but actually doesn't support type3/4/5. > > > So this patch adds the check for PCC subspace type. > > > > > > Signed-off-by: Huisong Li <lihuisong@huawei.com> > > > --- > > > drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ > > > 1 file changed, 17 insertions(+) > > > > > > diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c > > > index f3810d9d1caa..4ba3bfd45a01 100644 > > > --- a/drivers/soc/hisilicon/kunpeng_hccs.c > > > +++ b/drivers/soc/hisilicon/kunpeng_hccs.c > > > @@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev) > > > return rc; > > > } > > > +static int hccs_check_pcc_info(struct hccs_dev *hdev) > > > +{ > > > + struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan; > > > + > > > + if (pcc_chan->type >= ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE) { > > > + dev_err(hdev->dev, "unsupport for subspace type%u.\n", > > > + pcc_chan->type); > > > + return -EOPNOTSUPP; > > > + } > > Is this the only use of the PCC type information you have or do you plan to > > use it for something other than the validation. > Yeah, it is just validation now. we want to plan this driver can support > more types. OK > > > > Just for sake of argument, I can say all users of PCC must then do the > > similar validation. I don't know where to draw the line here. > > If export PCC type, it is good for the user of PCC to be more universal and > more compatible. > I don't think it is a good idea to just export raw ACPI PCC type to the client drivers. What if the driver in the future needs to work on a DT platform as well and need to work with non-PCC mailbox channel ? Also pushing the client PCC drivers to have more ACPI knowledge to understand what each type means is also something I prefer to avoid. The real information you want is whether this is an initiator(previously known master) channel or responder(previously known as slave) channel. It boils down to unidirectional vs bidirectional and what direction in bidirectional channels. It would be good if mbox framework can be taught that, or atleast make an attempt to see what people think about it. Just patching it the way you are proposing is just going to hide real issue here. > > > > Ideally I would expect the driver to make this transparent and give error > > during transmit if not supported. > I understand you. > I just check this type only once during the initializing phase. > Otherwise, every once need to verify it when send PCC command. Agreed, but refer above for my concern on the solution proposed. > > > > The driver must be able to work with different PCC type to support variety > > of platforms TBH. What is the issue exactly here ? Is this to prevent the > Agree more with you. > IMO, the user of PCC has the ability to support variety of platforms if they > can get PCC type. > In this case, to prevent type 4 is necessary if driver cannot act as a > slave. > on the other hand, If one driver acts as a slave, platform must supply slave > subspace for them. > > use of Type 4 ? I think we must do something better but I don't know what > > that is yet. > > Yes, we can try to do it better. I have a concern, like below. > Thanks for agreeing. > You know that the use of PCC can use polling mode and interrupt mode to > communicate with platform. > I'm not sure if the obtaining of the polling mode and interrupt mode is an > issue to prevent driver to be more universal. Again this must be addressed at mailbox API level. > But this driver can know if they support interrupt mode based on struct > mbox_chan::struct mbox_controller::txdone_irq after requesting PCC channel. Agreed, I was about to ask the same. > Because I'm not sure it's a better way. Again agreed. > You know that drivers used interrupt mode need to fill the rx_callback > function into mbx_client when register PCC channel. > And drivers used polling mode don't do it. > If we use this way, drivers that both support the two mode have to modify > the rx_callback pointer after requesting PCC channel. I am not sure if I followed all the details here. May be a rough hack helps to understand what you are proposing ? Ofcourse not for merging, just to understand the issue better. -- Regards, Sudeep
在 2023/9/29 19:27, Sudeep Holla 写道: > On Thu, Sep 21, 2023 at 10:27:36AM +0800, lihuisong (C) wrote: >> 在 2023/9/20 22:11, Sudeep Holla 写道: >>> On Wed, Sep 20, 2023 at 02:47:03PM +0800, Huisong Li wrote: >>>> Currently, HCCS driver directly uses Generic Communications Channel Shared >>>> Memory Region which is used in type0/1/2 to communicate with platform, >>>> but actually doesn't support type3/4/5. >>>> So this patch adds the check for PCC subspace type. >>>> >>>> Signed-off-by: Huisong Li <lihuisong@huawei.com> >>>> --- >>>> drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ >>>> 1 file changed, 17 insertions(+) >>>> >>>> diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c >>>> index f3810d9d1caa..4ba3bfd45a01 100644 >>>> --- a/drivers/soc/hisilicon/kunpeng_hccs.c >>>> +++ b/drivers/soc/hisilicon/kunpeng_hccs.c >>>> @@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev) >>>> return rc; >>>> } >>>> +static int hccs_check_pcc_info(struct hccs_dev *hdev) >>>> +{ >>>> + struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan; >>>> + >>>> + if (pcc_chan->type >= ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE) { >>>> + dev_err(hdev->dev, "unsupport for subspace type%u.\n", >>>> + pcc_chan->type); >>>> + return -EOPNOTSUPP; >>>> + } >>> Is this the only use of the PCC type information you have or do you plan to >>> use it for something other than the validation. >> Yeah, it is just validation now. we want to plan this driver can support >> more types. > OK > >>> Just for sake of argument, I can say all users of PCC must then do the >>> similar validation. I don't know where to draw the line here. >> If export PCC type, it is good for the user of PCC to be more universal and >> more compatible. >> > I don't think it is a good idea to just export raw ACPI PCC type to the I understand you. But the format and size of type0-2, type3/4 and type5 are different. And all PCC client drivers need to know which PCC type they used and how to fill the shared memory region header. Please notice that the type used by the client driver is fixed and agreed with the platform in advance. > client drivers. What if the driver in the future needs to work on a DT > platform as well and need to work with non-PCC mailbox channel ? It's also an alternative path. > > Also pushing the client PCC drivers to have more ACPI knowledge to understand > what each type means is also something I prefer to avoid. The real information Yeah, it is great that the PCC client drivers don't need to know which PCC type is used. But it is inevitable according to above mentioned. > you want is whether this is an initiator(previously known master) channel or > responder(previously known as slave) channel. It boils down to unidirectional > vs bidirectional and what direction in bidirectional channels. not just for this. > > It would be good if mbox framework can be taught that, or atleast make an > attempt to see what people think about it. Just patching it the way you are > proposing is just going to hide real issue here. > >>> Ideally I would expect the driver to make this transparent and give error >>> during transmit if not supported. >> I understand you. >> I just check this type only once during the initializing phase. >> Otherwise, every once need to verify it when send PCC command. > Agreed, but refer above for my concern on the solution proposed. > >>> The driver must be able to work with different PCC type to support variety >>> of platforms TBH. What is the issue exactly here ? Is this to prevent the >> Agree more with you. >> IMO, the user of PCC has the ability to support variety of platforms if they >> can get PCC type. >> In this case, to prevent type 4 is necessary if driver cannot act as a >> slave. >> on the other hand, If one driver acts as a slave, platform must supply slave >> subspace for them. >>> use of Type 4 ? I think we must do something better but I don't know what >>> that is yet. >> Yes, we can try to do it better. I have a concern, like below. >> > Thanks for agreeing. > >> You know that the use of PCC can use polling mode and interrupt mode to >> communicate with platform. >> I'm not sure if the obtaining of the polling mode and interrupt mode is an >> issue to prevent driver to be more universal. > Again this must be addressed at mailbox API level. Maybe it is ok. The harder thing to deal with is that the client driver needs to decide if set rx_callback for the polling or interrupt mode before requesting PCC channel. because driver doesn't know whether platform supports interrupt. If we fully put PCC type and interrupt mode we discussed to mailbox API or PCC driver, there are possibly many works should be done. I have no good idea to do it yet. > >> But this driver can know if they support interrupt mode based on struct >> mbox_chan::struct mbox_controller::txdone_irq after requesting PCC channel. > Agreed, I was about to ask the same. > >> Because I'm not sure it's a better way. > Again agreed. > >> You know that drivers used interrupt mode need to fill the rx_callback >> function into mbx_client when register PCC channel. >> And drivers used polling mode don't do it. >> If we use this way, drivers that both support the two mode have to modify >> the rx_callback pointer after requesting PCC channel. > I am not sure if I followed all the details here. May be a rough hack helps > to understand what you are proposing ? Ofcourse not for merging, just to > understand the issue better. please see the above reply😁 > > -- > Regards, > Sudeep > > .
diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c index f3810d9d1caa..4ba3bfd45a01 100644 --- a/drivers/soc/hisilicon/kunpeng_hccs.c +++ b/drivers/soc/hisilicon/kunpeng_hccs.c @@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev) return rc; } +static int hccs_check_pcc_info(struct hccs_dev *hdev) +{ + struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan; + + if (pcc_chan->type >= ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE) { + dev_err(hdev->dev, "unsupport for subspace type%u.\n", + pcc_chan->type); + return -EOPNOTSUPP; + } + + return 0; +} + static int hccs_check_chan_cmd_complete(struct hccs_dev *hdev) { struct hccs_mbox_client_info *cl_info = &hdev->cl_info; @@ -1224,6 +1237,10 @@ static int hccs_probe(struct platform_device *pdev) if (rc) return rc; + rc = hccs_check_pcc_info(hdev); + if (rc) + goto unregister_pcc_chan; + rc = hccs_get_dev_caps(hdev); if (rc) goto unregister_pcc_chan;