Message ID | 1688122331-25478-8-git-send-email-quic_krichai@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10278834vqr; Fri, 30 Jun 2023 04:19:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFfos7ibuK5QO/F6hCb4mJKELcv1cIDtokcKpPqJ9o7cZh0BbGHIQKG43EhNMtjZHFBP28 X-Received: by 2002:a05:6a00:1742:b0:673:6cb4:7b0c with SMTP id j2-20020a056a00174200b006736cb47b0cmr3542574pfc.2.1688123988878; Fri, 30 Jun 2023 04:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688123988; cv=none; d=google.com; s=arc-20160816; b=PdtXHTStztp1uC2NJ6u6qsLatZpmS+tY8BLGciw3wS28m1AzF45+5bOmmDU/xy+X71 ffj4SxyMz7+6AgVrENMVShwUmxcbDDoQRlxvjEpGKIMd02eCUmPJBCA6oXuaR0gqAC1X h+6eGbrkOO9UOXVm1zdEYAxAgi5e+FAA9/2VKTl8NCj2s5+++L6kVgAtQi0H55PjzTmn FnM8FjMghEiQPm3pGGuf86Yrp0+Dq4eTOb8wL1DmLXc5xjvmRFcfLt2FmHj9Oo80zQBB P6nAzn6len83FAQq99S42W2ybbsh+/vhBrudKdIPAdIzcSAHE1ujJVUSxu37uCx9ksEg ptug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=/9TEn6p7438Y8uzn2noHx4X1roGv865uNAKBLZNOBbA=; fh=4i/B3x3le/AfVlLWsD1+Ff1S96/Wq0aAZ83+KG3/gJI=; b=fCDEUBFDPPUP8LjbwTPohOiwqZ6ZmXElU/H+vMfyz66q5++ImpliDd8/qNs4CBVL7+ p4RBOnFM1DHjV7ukw/gd99O3aPl0YA1nKbpJNlG3bscJc8OSt+5A/a4Oft3jkImaYL/g JCfCPa2ZFA1WHNL8kHmRVp5nuyy5rL3lQJOazMTbL8QdH3cavMY759ClzgLN+Inx2cRO 5skGjBYiBfAzBCRiFYEbQux6tSI+Aiy/dkUl7HpY9tcu0O4RiVXkLgyjGSgWMb+AFZuw Vs4PJ8HjdYf4811EPtRG7kbjFoKMNjWpLsxoIAGW5NEbgxpGj9pbovMjcv5EplsBrmFM KmTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="SvuwT/jG"; 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=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fd35-20020a056a002ea300b006687406605asi12991458pfb.211.2023.06.30.04.19.35; Fri, 30 Jun 2023 04:19:48 -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=@quicinc.com header.s=qcppdkim1 header.b="SvuwT/jG"; 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=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232651AbjF3KxI (ORCPT <rfc822;nicolai.engesland@gmail.com> + 99 others); Fri, 30 Jun 2023 06:53:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232470AbjF3Kw7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 30 Jun 2023 06:52:59 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B9E9359E; Fri, 30 Jun 2023 03:52:58 -0700 (PDT) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35U8dK3t011808; Fri, 30 Jun 2023 10:52:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=qcppdkim1; bh=/9TEn6p7438Y8uzn2noHx4X1roGv865uNAKBLZNOBbA=; b=SvuwT/jGYlf3i5sbKBdH/lqOzM8VFkwa7HkV55JZQpZ7zqKntZZEBLVOdxdJbstgKsQ/ 7D+i6GlG0Q6oaracJA5IyX+bAXsVFb0GOhEqnV7Mgr4v1E5fDIU66HLtBrJ5y+4ML8Qt 2K3KkgcIpwqv6ur5x/Yf9pRIIFVgAivXWv2lI8kFKizTXjlql6NYgr9ZDv7HTCviuR0h 1uLt2eh71TjWcfevvpEdGql4kx9/kNOGhtti+QHoCzw3OmZhdfd62JuH+EGLn5y7FKTK IB3uHBBoJ2JgRFM1zOvQs7qIHgcARVIkBKRt3cNx1PRNzD21dwHpBqtN+ow3OhTWRoKg cQ== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rhgpgsft0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jun 2023 10:52:48 +0000 Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 35UAqK41004775; Fri, 30 Jun 2023 10:52:20 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3rdsjkpf2v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 30 Jun 2023 10:52:20 +0000 Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35UAqKhY004770; Fri, 30 Jun 2023 10:52:20 GMT Received: from hu-sgudaval-hyd.qualcomm.com (hu-krichai-hyd.qualcomm.com [10.213.110.112]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 35UAqKql004767; Fri, 30 Jun 2023 10:52:20 +0000 Received: by hu-sgudaval-hyd.qualcomm.com (Postfix, from userid 4058933) id 719554ABD; Fri, 30 Jun 2023 16:22:19 +0530 (+0530) From: Krishna chaitanya chundru <quic_krichai@quicinc.com> To: manivannan.sadhasivam@linaro.org Cc: helgaas@kernel.org, linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_vbadigan@quicinc.com, quic_nitegupt@quicinc.com, quic_skananth@quicinc.com, quic_ramkri@quicinc.com, krzysztof.kozlowski@linaro.org, Krishna chaitanya chundru <quic_krichai@quicinc.com>, Manivannan Sadhasivam <mani@kernel.org>, Lorenzo Pieralisi <lpieralisi@kernel.org>, =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= <kw@linux.com>, Kishon Vijay Abraham I <kishon@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>, Jeffrey Hugo <quic_jhugo@quicinc.com>, mhi@lists.linux.dev (open list:MHI BUS) Subject: [PATCH v2 7/8] PCI: epf-mhi: Add wakeup host op Date: Fri, 30 Jun 2023 16:22:10 +0530 Message-Id: <1688122331-25478-8-git-send-email-quic_krichai@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1688122331-25478-1-git-send-email-quic_krichai@quicinc.com> References: <1688122331-25478-1-git-send-email-quic_krichai@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Bo6ds8KNAH1kV3213hJH76zuCtj7L1hK X-Proofpoint-ORIG-GUID: Bo6ds8KNAH1kV3213hJH76zuCtj7L1hK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-30_05,2023-06-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=778 adultscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306300092 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770126299850340306?= X-GMAIL-MSGID: =?utf-8?q?1770126299850340306?= |
Series |
PCCI: EPC: Add support to wake up host from D3 states
|
|
Commit Message
Krishna chaitanya chundru
June 30, 2023, 10:52 a.m. UTC
Add wakeup host op for MHI EPF.
If the D-state is in D3cold toggle wake signal, otherwise send PME.
Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
drivers/pci/endpoint/functions/pci-epf-mhi.c | 19 +++++++++++++++++++
include/linux/mhi_ep.h | 1 +
2 files changed, 20 insertions(+)
Comments
On Fri, Jun 30, 2023 at 04:22:10PM +0530, Krishna chaitanya chundru wrote: > Add wakeup host op for MHI EPF. > If the D-state is in D3cold toggle wake signal, otherwise send PME. > > Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> > --- > drivers/pci/endpoint/functions/pci-epf-mhi.c | 19 +++++++++++++++++++ > include/linux/mhi_ep.h | 1 + > 2 files changed, 20 insertions(+) > > diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c > index 64ff37d..deb742c 100644 > --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c > +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c > @@ -237,6 +237,24 @@ static int pci_epf_mhi_write_to_host(struct mhi_ep_cntrl *mhi_cntrl, > return 0; > } > > +static int pci_epf_mhi_wakeup_host(struct mhi_ep_cntrl *mhi_cntrl) > +{ > + struct pci_epf_mhi *epf_mhi = to_epf_mhi(mhi_cntrl); > + struct pci_epf *epf = epf_mhi->epf; > + struct pci_epc *epc = epf->epc; > + int ret; > + > + if (mhi_cntrl->dstate == PCI_D3cold) > + ret = pci_epc_wakeup_host(epc, epf->func_no, > + epf->vfunc_no, PCI_WAKEUP_TOGGLE_WAKE); > + else > + ret = pci_epc_wakeup_host(epc, epf->func_no, > + epf->vfunc_no, PCI_WAKEUP_SEND_PME); > + If the wakeup argument is of type bool (ie. bool use_pme), then wakeup = (mhi_cntrl->dstate == PCI_D3cold) ? false : true; return pci_epc_wakeup_host(epc, epf->func_no, epf->vfunc_no, state); - Mani > + return ret; > + > +} > + > static int pci_epf_mhi_core_init(struct pci_epf *epf) > { > struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf); > @@ -293,6 +311,7 @@ static int pci_epf_mhi_link_up(struct pci_epf *epf) > mhi_cntrl->unmap_free = pci_epf_mhi_unmap_free; > mhi_cntrl->read_from_host = pci_epf_mhi_read_from_host; > mhi_cntrl->write_to_host = pci_epf_mhi_write_to_host; > + mhi_cntrl->wakeup_host = pci_epf_mhi_wakeup_host; > > /* Register the MHI EP controller */ > ret = mhi_ep_register_controller(mhi_cntrl, info->config); > diff --git a/include/linux/mhi_ep.h b/include/linux/mhi_ep.h > index c3a0685..e353c429 100644 > --- a/include/linux/mhi_ep.h > +++ b/include/linux/mhi_ep.h > @@ -137,6 +137,7 @@ struct mhi_ep_cntrl { > void __iomem *virt, size_t size); > int (*read_from_host)(struct mhi_ep_cntrl *mhi_cntrl, u64 from, void *to, size_t size); > int (*write_to_host)(struct mhi_ep_cntrl *mhi_cntrl, void *from, u64 to, size_t size); > + int (*wakeup_host)(struct mhi_ep_cntrl *mhi_cntrl); > > enum mhi_state mhi_state; > > -- > 2.7.4 >
On 7/7/2023 11:44 AM, Manivannan Sadhasivam wrote: > On Fri, Jun 30, 2023 at 04:22:10PM +0530, Krishna chaitanya chundru wrote: >> Add wakeup host op for MHI EPF. >> If the D-state is in D3cold toggle wake signal, otherwise send PME. >> >> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> >> --- >> drivers/pci/endpoint/functions/pci-epf-mhi.c | 19 +++++++++++++++++++ >> include/linux/mhi_ep.h | 1 + >> 2 files changed, 20 insertions(+) >> >> diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c >> index 64ff37d..deb742c 100644 >> --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c >> +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c >> @@ -237,6 +237,24 @@ static int pci_epf_mhi_write_to_host(struct mhi_ep_cntrl *mhi_cntrl, >> return 0; >> } >> >> +static int pci_epf_mhi_wakeup_host(struct mhi_ep_cntrl *mhi_cntrl) >> +{ >> + struct pci_epf_mhi *epf_mhi = to_epf_mhi(mhi_cntrl); >> + struct pci_epf *epf = epf_mhi->epf; >> + struct pci_epc *epc = epf->epc; >> + int ret; >> + >> + if (mhi_cntrl->dstate == PCI_D3cold) >> + ret = pci_epc_wakeup_host(epc, epf->func_no, >> + epf->vfunc_no, PCI_WAKEUP_TOGGLE_WAKE); >> + else >> + ret = pci_epc_wakeup_host(epc, epf->func_no, >> + epf->vfunc_no, PCI_WAKEUP_SEND_PME); >> + > If the wakeup argument is of type bool (ie. bool use_pme), then > > wakeup = (mhi_cntrl->dstate == PCI_D3cold) ? false : true; > > return pci_epc_wakeup_host(epc, epf->func_no, epf->vfunc_no, state); > > - Mani better to use type as it as it has more readability but I have taken your inputs here and will change the code as suggetsed. - KC >> + return ret; >> + >> +} >> + >> static int pci_epf_mhi_core_init(struct pci_epf *epf) >> { >> struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf); >> @@ -293,6 +311,7 @@ static int pci_epf_mhi_link_up(struct pci_epf *epf) >> mhi_cntrl->unmap_free = pci_epf_mhi_unmap_free; >> mhi_cntrl->read_from_host = pci_epf_mhi_read_from_host; >> mhi_cntrl->write_to_host = pci_epf_mhi_write_to_host; >> + mhi_cntrl->wakeup_host = pci_epf_mhi_wakeup_host; >> >> /* Register the MHI EP controller */ >> ret = mhi_ep_register_controller(mhi_cntrl, info->config); >> diff --git a/include/linux/mhi_ep.h b/include/linux/mhi_ep.h >> index c3a0685..e353c429 100644 >> --- a/include/linux/mhi_ep.h >> +++ b/include/linux/mhi_ep.h >> @@ -137,6 +137,7 @@ struct mhi_ep_cntrl { >> void __iomem *virt, size_t size); >> int (*read_from_host)(struct mhi_ep_cntrl *mhi_cntrl, u64 from, void *to, size_t size); >> int (*write_to_host)(struct mhi_ep_cntrl *mhi_cntrl, void *from, u64 to, size_t size); >> + int (*wakeup_host)(struct mhi_ep_cntrl *mhi_cntrl); >> >> enum mhi_state mhi_state; >> >> -- >> 2.7.4 >>
diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c index 64ff37d..deb742c 100644 --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c @@ -237,6 +237,24 @@ static int pci_epf_mhi_write_to_host(struct mhi_ep_cntrl *mhi_cntrl, return 0; } +static int pci_epf_mhi_wakeup_host(struct mhi_ep_cntrl *mhi_cntrl) +{ + struct pci_epf_mhi *epf_mhi = to_epf_mhi(mhi_cntrl); + struct pci_epf *epf = epf_mhi->epf; + struct pci_epc *epc = epf->epc; + int ret; + + if (mhi_cntrl->dstate == PCI_D3cold) + ret = pci_epc_wakeup_host(epc, epf->func_no, + epf->vfunc_no, PCI_WAKEUP_TOGGLE_WAKE); + else + ret = pci_epc_wakeup_host(epc, epf->func_no, + epf->vfunc_no, PCI_WAKEUP_SEND_PME); + + return ret; + +} + static int pci_epf_mhi_core_init(struct pci_epf *epf) { struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf); @@ -293,6 +311,7 @@ static int pci_epf_mhi_link_up(struct pci_epf *epf) mhi_cntrl->unmap_free = pci_epf_mhi_unmap_free; mhi_cntrl->read_from_host = pci_epf_mhi_read_from_host; mhi_cntrl->write_to_host = pci_epf_mhi_write_to_host; + mhi_cntrl->wakeup_host = pci_epf_mhi_wakeup_host; /* Register the MHI EP controller */ ret = mhi_ep_register_controller(mhi_cntrl, info->config); diff --git a/include/linux/mhi_ep.h b/include/linux/mhi_ep.h index c3a0685..e353c429 100644 --- a/include/linux/mhi_ep.h +++ b/include/linux/mhi_ep.h @@ -137,6 +137,7 @@ struct mhi_ep_cntrl { void __iomem *virt, size_t size); int (*read_from_host)(struct mhi_ep_cntrl *mhi_cntrl, u64 from, void *to, size_t size); int (*write_to_host)(struct mhi_ep_cntrl *mhi_cntrl, void *from, u64 to, size_t size); + int (*wakeup_host)(struct mhi_ep_cntrl *mhi_cntrl); enum mhi_state mhi_state;