Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp780545rwp; Thu, 13 Jul 2023 00:24:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlHXH5U/zcM13cHSepB5IlQs3TjSGR53/kp5l1zY8hbSnD9vwuDGMFWUFCKjKAo8ppEI4YVK X-Received: by 2002:a17:906:5c:b0:94a:9f9a:b3c4 with SMTP id 28-20020a170906005c00b0094a9f9ab3c4mr746903ejg.49.1689233052204; Thu, 13 Jul 2023 00:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689233052; cv=none; d=google.com; s=arc-20160816; b=Pt9JMHolBJUJdBF08FJ5t5n0pwBmHwTG6+s/VTaHST3K4idJGU9H8P/LPbu/FVD+Wa zMb8aq1LscYO1ot6L2OekDkrkRcXRmXLz8VTMHYF+7aEKFeoMA4ZBNfP82xMjTWoUcEX rScdhR7KBrzFF57tmaaxPDaeckuwml6LGssPxLKiP418HsJQ/Ae2UPilYsGdL+OiFhmv BkBTz54QS2BTCtWzEIDE8TCGmU+1g0B3CofXk62aOfvfR4E9Qi2JhDGXbSEBws36KFBN PxlwBtaPlhjlDFKP/B4dU+N5F8LGU9FGw6la3nepK/E2USqitcM9ikCdbCrtJJAmeMYk bXDQ== 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=tpdKDEoaQ0kT9zIG5U80ilbe+cXM+o/eRRMFz9g9sH4=; fh=mo08ARgMWVLkOXQO+n9fXCAyH6rFBGHgOh2lu+mOKe8=; b=no/NRxFNs/qxNcY1309ScCL9GKD4fI0Ri3N6lFWy12dTLB9r2puOpRnBkJ+IR0pjds sbE744RBqqd8r7M+NmoPU8p9W8A0amIiCchT4HdvsK7/Ci/yc6Fvw3mKVW+16HmhW0mt Lc0JfPKpsHF6G4HZ6hVtunY7kM7hBYtd1iElh1QPPS62tCOWBKNHQsKIWJh8EJ/08lOM W7kj1XRz7CoGtKVL+hFDWlXkReBSgLydnT7PCOLniEXa4aeZqQJVPSj4wezaF4AQobXk EI1StXZvjNfYmJIXNU+Zs0jdPYkwbpI06KQzmLHg0Q9uYl40EFGb6DIoJoqhI1dVxjf+ NxnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=DCB6S+ho; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id li13-20020a170906f98d00b009927d850155si6159222ejb.892.2023.07.13.00.23.48; Thu, 13 Jul 2023 00:24:12 -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=DCB6S+ho; 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 S234263AbjGMHLE (ORCPT + 99 others); Thu, 13 Jul 2023 03:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234203AbjGMHKt (ORCPT ); Thu, 13 Jul 2023 03:10:49 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BCC62684; Thu, 13 Jul 2023 00:10:41 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36D4TVGe005937; Thu, 13 Jul 2023 07:10:33 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=tpdKDEoaQ0kT9zIG5U80ilbe+cXM+o/eRRMFz9g9sH4=; b=DCB6S+hoyHjbdqSn2q22vr3ciCTz+MTYw7vhXdSyY+5N0X7k+D7ep3uNOZNwbBfEVbM9 YMP3AgPAfpeE6MAt6eTef2+P+WoJNa3OQ+RFXo2B4/3eRTgSoMLnX8mHs2tpSmgptnH0 xoQNkwpU5oWkFZ2KdH/PTcibX++LWDjQuAEteN628j7tk4N71o8mhkKnG6IdjaW5jBoo 8HlDAn+hQl7JbRv9BSYvdeEpUYegnal2TwUZIZJLde9Xvzq8GbAR8jDhRiwuYhFneljl X0IC7XAt40LMPCBLaYMPNdfd9o8VSxOVV2sT1a0TqHe+UibD4EIatBLvGnwbvyjHptSQ ew== Received: from apblrppmta01.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rsgarb9mv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 07:10:33 +0000 Received: from pps.filterd (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 36D7ARW6030237; Thu, 13 Jul 2023 07:10:29 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 3rq0vkymjk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 13 Jul 2023 07:10:29 +0000 Received: from APBLRPPMTA01.qualcomm.com (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36D7AM9B030157; Thu, 13 Jul 2023 07:10:29 GMT Received: from hu-sgudaval-hyd.qualcomm.com (hu-krichai-hyd.qualcomm.com [10.213.110.112]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 36D7ASCn030265; Thu, 13 Jul 2023 07:10:29 +0000 Received: by hu-sgudaval-hyd.qualcomm.com (Postfix, from userid 4058933) id 6C44247AD; Thu, 13 Jul 2023 12:40:28 +0530 (+0530) From: Krishna chaitanya chundru 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 , Manivannan Sadhasivam , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Jeffrey Hugo , mhi@lists.linux.dev (open list:MHI BUS) Subject: [PATCH v4 8/9] PCI: epf-mhi: Add wakeup host op Date: Thu, 13 Jul 2023 12:40:17 +0530 Message-Id: <1689232218-28265-9-git-send-email-quic_krichai@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1689232218-28265-1-git-send-email-quic_krichai@quicinc.com> References: <1689232218-28265-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: C5PbraqfonTo5BDjU6-krxjR73IRsEz3 X-Proofpoint-ORIG-GUID: C5PbraqfonTo5BDjU6-krxjR73IRsEz3 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-07-13_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 mlxlogscore=791 spamscore=0 priorityscore=1501 impostorscore=0 phishscore=0 clxscore=1015 adultscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307130061 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 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 --- drivers/pci/endpoint/functions/pci-epf-mhi.c | 16 ++++++++++++++++ include/linux/mhi_ep.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c index ee91bfc..b608505 100644 --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c @@ -237,6 +237,21 @@ 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; + enum pci_epc_wakeup_host_type type; + struct pci_epc *epc = epf->epc; + + type = PCI_WAKEUP_SEND_PME; + if (mhi_cntrl->dstate == PCI_D3cold) + type = PCI_WAKEUP_TOGGLE_WAKE; + + return pci_epc_wakeup_host(epc, epf->func_no, epf->vfunc_no, type); + +} + static int pci_epf_mhi_core_init(struct pci_epf *epf) { struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf); @@ -293,6 +308,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