From patchwork Wed Jul 10 11:08:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13729189 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF5C718FA34; Wed, 10 Jul 2024 11:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720609727; cv=none; b=YFntxnOAs8nH574n6UJPYYXXvAmG4i8JQBiRejll5cPTweipVgUDo2JeN46oGMAVksc8SCTLMnYYwTHvEVt+B5S8FUotauUup9H2zWEttvsPSqWgm63o6z9T4B2MYH3m5KE8paijxZXhjjd9Y4H7iRlOLVTjKZDnxV3L8xx0vzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720609727; c=relaxed/simple; bh=SvjP1T+EEQd7I8bwYjYD3cq6rvIqSMYXru+9AZEaQiU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=rAssmk4ZHh/fyUejJ0mIae22f4hjP9NuKnFvefOb8SsgXfUBWUyLQB/H92NSAIJXHAelQ3x/niG0Xhw90b7fvWOzamH7mQzGwH4YbRAnqri2b+BCBotnJIqk2pd382XnnE0hv9Gm8UGS24+nYzPF8N82DiT0vYZn6MydQdhwkUs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=nUeeJrZF; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="nUeeJrZF" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46A9hHp9029428; Wed, 10 Jul 2024 11:08:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= zciwMdZ6NZHjy0VGYyE8FFd257osghz8T+oYjLhMYec=; b=nUeeJrZFYkKlyPTB GIE3Do5vbdEimiJs3m96zLQmt2N3G6H1PwCxdJSZO0ETALeBAKvYY3twHtWYnEZw lDocXv9SKbM7H+PXYKfwPQHN/GTpUey58YUBaUpnhjljpE3sevDmkEUqIoEmZ4Do Osk+P7twIu0lQ95c11++8ccPTs8rqZpxhhuzLnV5xEwYfwKwmfZYEzpQqg0dc1NZ EmVZihRsdPilB4yNkXQQOcJrOI0SYgyHRjarpRVRm45lkvaScCLGdaDVeFtY/ser iv6tmzR4gxLFMmkz4kl6nu8C7GwLL0cla+AJZgQ+wtNVTJ1MSGcK/5QZ2kNqD6J1 B0Fy5g== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 406xa691wa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 11:08:31 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 46AB8TZg004636 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 11:08:29 GMT Received: from hu-krichai-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 10 Jul 2024 04:08:24 -0700 From: Krishna chaitanya chundru Date: Wed, 10 Jul 2024 16:38:14 +0530 Subject: [PATCH v7 1/4] PCI: endpoint: Add D-state change notifier support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240710-dstate_notifier-v7-1-8d45d87b2b24@quicinc.com> References: <20240710-dstate_notifier-v7-0-8d45d87b2b24@quicinc.com> In-Reply-To: <20240710-dstate_notifier-v7-0-8d45d87b2b24@quicinc.com> To: Manivannan Sadhasivam , =?utf-8?q?Krzy?= =?utf-8?q?sztof_Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Jonathan Corbet , Lorenzo Pieralisi , Rob Herring CC: , , , , , , , , , , "Krishna chaitanya chundru" X-Mailer: b4 0.13-dev-83828 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720609699; l=3524; i=quic_krichai@quicinc.com; s=20230907; h=from:subject:message-id; bh=SvjP1T+EEQd7I8bwYjYD3cq6rvIqSMYXru+9AZEaQiU=; b=WMao6p06eazJVryGf6h1KPbZ9mqkl+5VGfhnRG9m8Mn7ADBuqpkxI/OL3u27fFNcMLvImhrEl h6usjDmFWSlAObz1RJlAQp1soSZf0zAQTICdXcCX7njca4PmsM+9MZ3 X-Developer-Key: i=quic_krichai@quicinc.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ZLwqFKSr_e5CpOv0rXHaFA78kS3T_DSp X-Proofpoint-ORIG-GUID: ZLwqFKSr_e5CpOv0rXHaFA78kS3T_DSp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-10_06,2024-07-10_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=810 suspectscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 spamscore=0 clxscore=1015 adultscore=0 malwarescore=0 mlxscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407100076 Add support to notify the EPF device about the D-state change event from the EPC device. Signed-off-by: Krishna chaitanya chundru --- Documentation/PCI/endpoint/pci-endpoint.rst | 3 +++ drivers/pci/endpoint/pci-epc-core.c | 24 ++++++++++++++++++++++++ include/linux/pci-epc.h | 2 ++ include/linux/pci-epf.h | 2 ++ 4 files changed, 31 insertions(+) diff --git a/Documentation/PCI/endpoint/pci-endpoint.rst b/Documentation/PCI/endpoint/pci-endpoint.rst index 21507e3cc238..3eb5648ca7ec 100644 --- a/Documentation/PCI/endpoint/pci-endpoint.rst +++ b/Documentation/PCI/endpoint/pci-endpoint.rst @@ -77,6 +77,9 @@ by the PCI controller driver. Cleanup the pci_epc_mem structure allocated during pci_epc_mem_init(). +* pci_epc_dstate_notify() + + Notify all the function drivers that the EPC device has changed its D-state. EPC APIs for the PCI Endpoint Function Driver ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index 84309dfe0c68..e2b9c458f2c4 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -828,6 +828,30 @@ void pci_epc_bus_master_enable_notify(struct pci_epc *epc) } EXPORT_SYMBOL_GPL(pci_epc_bus_master_enable_notify); +/** + * pci_epc_dstate_notify() - Notify the EPF driver that EPC device D-state + * has changed + * @epc: the EPC device which has change in D-state + * @state: the changed D-state + * + * Invoke to Notify the EPF device that the EPC device D-state has + * changed. + */ +void pci_epc_dstate_notify(struct pci_epc *epc, pci_power_t state) +{ + struct pci_epf *epf; + + mutex_lock(&epc->list_lock); + list_for_each_entry(epf, &epc->pci_epf, list) { + mutex_lock(&epf->lock); + if (epf->event_ops && epf->event_ops->dstate_notify) + epf->event_ops->dstate_notify(epf, state); + mutex_unlock(&epf->lock); + } + mutex_unlock(&epc->list_lock); +} +EXPORT_SYMBOL_GPL(pci_epc_dstate_notify); + /** * pci_epc_destroy() - destroy the EPC device * @epc: the EPC device that has to be destroyed diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h index 85bdf2adb760..e473d1780928 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -276,6 +276,8 @@ void __iomem *pci_epc_mem_alloc_addr(struct pci_epc *epc, void pci_epc_mem_free_addr(struct pci_epc *epc, phys_addr_t phys_addr, void __iomem *virt_addr, size_t size); +void pci_epc_dstate_notify(struct pci_epc *epc, pci_power_t state); + #else static inline void pci_epc_init_notify(struct pci_epc *epc) { diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index 18a3aeb62ae4..d88063cdb067 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -75,6 +75,7 @@ struct pci_epf_ops { * @link_up: Callback for the EPC link up event * @link_down: Callback for the EPC link down event * @bus_master_enable: Callback for the EPC Bus Master Enable event + * @dstate_notify: Callback for the EPC D-state change event */ struct pci_epc_event_ops { int (*epc_init)(struct pci_epf *epf); @@ -82,6 +83,7 @@ struct pci_epc_event_ops { int (*link_up)(struct pci_epf *epf); int (*link_down)(struct pci_epf *epf); int (*bus_master_enable)(struct pci_epf *epf); + int (*dstate_notify)(struct pci_epf *epf, pci_power_t state); }; /** From patchwork Wed Jul 10 11:08:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13729190 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA26C18FC93; Wed, 10 Jul 2024 11:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720609729; cv=none; b=qHEK3ehOTo81xSdTbFKkxHEjHxvL6nYM13t/8RIlKIYV0Sy6J9g/UNoXv+mf9MoLWdjkv30tDYs2GRStupi1tCfra/VLUOHQrBpqkBqQw3fgJs6h6jPi6VmbxTfjFvRlJoKN+Zjs2LzE1ez81BJkIaTF3g+KW4EXiPKD3W9B7zA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720609729; c=relaxed/simple; bh=XOduevt12KJoM7kk2G+iH0+X8pg3PXAFyEyZo4rarLQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=soE2se2LhQAU9kFK1j+H22lU7QYQLzh28JH+6MYKOucuk7QsUuAdy1R1ztpYPv9KffBy0xUJ0OADxK8sOEwWNAJjxJn+MwqCQYeicF3k3j8jxeat4iM+pxoP5dZZLqogb8Cs9QJ/2l4KZWH1ITzZIEq358ITZGLzOOBwqb+jqrs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=nhCfGdwW; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="nhCfGdwW" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46A1r67I023826; Wed, 10 Jul 2024 11:08:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Wd8RUShlifszI5a0jnf64KZlAVHX2xPTDOgscwTojIo=; b=nhCfGdwWI7N3NEss BlL5GgLh9GeJ+TpXp+R0tVGwh/quWUYtcaLMXXLqAVD0/VFL+VvgsPIAp8iN8ovz f+iUVft7sHzkxnk96TdH22GW6ZtpEXs7iSqLR0jh54Ij2AZgecKV0tkbwSt5X6sN Tpdqh9QRzECYN+/yVH51mw2VhfDqTtk121/LFUK660ZEuLVmZA2G2/KgjvsVgGiV d4Me+uVXfLVMuLoyQN1U1cxJnQIUXdKqOF50NAxvxp7JVTlSpFWWqg4GU9K0Kyjn 29s/d+SwIYYDL0XbMVvzoYaiYOVoQH06896z+btIwvJWUCvb5TREv+keVki2/yER J03CBg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 406wgws4ue-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 11:08:37 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 46AB8ZrK019132 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 11:08:35 GMT Received: from hu-krichai-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 10 Jul 2024 04:08:30 -0700 From: Krishna chaitanya chundru Date: Wed, 10 Jul 2024 16:38:15 +0530 Subject: [PATCH v7 2/4] PCI: qcom-ep: Add support for D-state change notification Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240710-dstate_notifier-v7-2-8d45d87b2b24@quicinc.com> References: <20240710-dstate_notifier-v7-0-8d45d87b2b24@quicinc.com> In-Reply-To: <20240710-dstate_notifier-v7-0-8d45d87b2b24@quicinc.com> To: Manivannan Sadhasivam , =?utf-8?q?Krzy?= =?utf-8?q?sztof_Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Jonathan Corbet , Lorenzo Pieralisi , Rob Herring CC: , , , , , , , , , , "Krishna chaitanya chundru" , Manivannan Sadhasivam X-Mailer: b4 0.13-dev-83828 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720609699; l=1753; i=quic_krichai@quicinc.com; s=20230907; h=from:subject:message-id; bh=XOduevt12KJoM7kk2G+iH0+X8pg3PXAFyEyZo4rarLQ=; b=wWADPoXYJKHEu6BYwolVaoxg1v3AEgMxQj23Sp1uJDpkuA93xi3CyxJ5fCwgZKj/vnMB4CXP+ luLRziCEAaoCu3RUf1NpPEhJhGCRDN0EjzsDU0oSyW7Dguwhkx/r8xF X-Developer-Key: i=quic_krichai@quicinc.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: f1RTkZDtVzx4dkzRIHuT_uUgAWqkmOPm X-Proofpoint-ORIG-GUID: f1RTkZDtVzx4dkzRIHuT_uUgAWqkmOPm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-10_06,2024-07-10_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 adultscore=0 malwarescore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407100076 Add support to pass D-state change notification to Endpoint function driver. Read perst value to determine if the link is in D3Cold/D3hot. Reviewed-by: Manivannan Sadhasivam Signed-off-by: Krishna chaitanya chundru --- drivers/pci/controller/dwc/pcie-qcom-ep.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c index 236229f66c80..817fad805c51 100644 --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c @@ -648,6 +648,7 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data) struct device *dev = pci->dev; u32 status = readl_relaxed(pcie_ep->parf + PARF_INT_ALL_STATUS); u32 mask = readl_relaxed(pcie_ep->parf + PARF_INT_ALL_MASK); + pci_power_t state; u32 dstate, val; writel_relaxed(status, pcie_ep->parf + PARF_INT_ALL_CLEAR); @@ -671,11 +672,16 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data) dstate = dw_pcie_readl_dbi(pci, DBI_CON_STATUS) & DBI_CON_STATUS_POWER_STATE_MASK; dev_dbg(dev, "Received D%d state event\n", dstate); - if (dstate == 3) { + state = dstate; + if (dstate == PCI_D3hot) { val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL); val |= PARF_PM_CTRL_REQ_EXIT_L1; writel_relaxed(val, pcie_ep->parf + PARF_PM_CTRL); + + if (gpiod_get_value(pcie_ep->reset)) + state = PCI_D3cold; } + pci_epc_dstate_notify(pci->ep.epc, state); } else if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) { dev_dbg(dev, "Received Linkup event. Enumeration complete!\n"); dw_pcie_ep_linkup(&pci->ep); From patchwork Wed Jul 10 11:08:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13729191 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3B2C191464; Wed, 10 Jul 2024 11:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720609733; cv=none; b=pxZOYddGSuK447yPGUN0jWE5762Ppo+mMhAh9zS6Qn32uiT65WDRva1dqBo/7ySoNvnC1JKrdIO0xODdjIHqLZNbJK05afltD7od/0dimvRfztyYH2v7WsCUWCkwgaOP99BV/fktZIuKYtPgqJ2yJF6WsdtVWaty0T/ZxUj+x+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720609733; c=relaxed/simple; bh=w9gnQmyl5A12feNUHfhRuEpH+/zjXWf3KW3p4lBJy2Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=PqEA4Ghz3p4DXilXADASPVOlCago/0WcVaR668Z8RhKmzfXKWZFCbmnVbBAn2c8TEryKcV6QYpZqK3/nrXmdFDQHfeow0x0Wl76Jdf2gHlg9bgeuNRuT03IuLUs4hQU2ck56TNFDZO6tc6FrZzHj1FiC24GyL3uwulSnHuwjIdg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=RFHEYJUB; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="RFHEYJUB" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46A3F78V003892; Wed, 10 Jul 2024 11:08:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= /9iAwqi9erBXHpKZzSP0R0d36nSwNngqXaL2NVc/U9s=; b=RFHEYJUBiNGSXmbK z+gPZEh8QgYAOQ2XxNKvc3ZnQ+Jyaraz+ZY6+4sC0jNoLK3GTjRIniZqDCWk3xLz mgRWAlIolnBRqj3VoD5mp2Fo5qwgxNTQukEWcKXvrPLpeuNIQB9XEAW21VUqFypq KA/uyRqdG4LpJkuGhV8lMKdLT6WancJe5+TvbFgTTL27xCfq2E066VMiU5/GavJp 9eq4Oy9/G0bYSIl8Icdp0RshLWddyhxArmHH1LaNhaJ0dPbZTXNvKZ/pP0+0oazB XNAGnMfit89LK6RK8ro7bI6bLQGceQRFStHdfB5dsWG7eRwaF9WvlYTMDG3ccdov sszQYA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 408w0rbyf1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 11:08:41 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 46AB8eeG026021 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 11:08:40 GMT Received: from hu-krichai-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 10 Jul 2024 04:08:35 -0700 From: Krishna chaitanya chundru Date: Wed, 10 Jul 2024 16:38:16 +0530 Subject: [PATCH v7 3/4] PCI: qcom-ep: Print D-state name to distinguish D3hot/D3cold Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240710-dstate_notifier-v7-3-8d45d87b2b24@quicinc.com> References: <20240710-dstate_notifier-v7-0-8d45d87b2b24@quicinc.com> In-Reply-To: <20240710-dstate_notifier-v7-0-8d45d87b2b24@quicinc.com> To: Manivannan Sadhasivam , =?utf-8?q?Krzy?= =?utf-8?q?sztof_Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Jonathan Corbet , Lorenzo Pieralisi , Rob Herring CC: , , , , , , , , , , "Krishna chaitanya chundru" X-Mailer: b4 0.13-dev-83828 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720609699; l=1363; i=quic_krichai@quicinc.com; s=20230907; h=from:subject:message-id; bh=w9gnQmyl5A12feNUHfhRuEpH+/zjXWf3KW3p4lBJy2Y=; b=a2yZBqb6puFfVY0WmOsaDIg3b0XtRtmrSj3LKau8qBU1WId1IyDmHrSmCxYnEuG0sHVGo3gWy 2wd82/JlcvaDxTwxaXW6EiGs/aBZJVJtLjpfhWVrU6nT8f/2ohkt53Z X-Developer-Key: i=quic_krichai@quicinc.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: NQU-whWjXRBSU-8Fez3ZiI-akkRy1QzD X-Proofpoint-GUID: NQU-whWjXRBSU-8Fez3ZiI-akkRy1QzD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-10_06,2024-07-10_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=812 phishscore=0 spamscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407100076 Now that the state event is stored as pci_power_t, use the PCI helper pci_power_name() to print the state event. Signed-off-by: Krishna chaitanya chundru --- drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c index 817fad805c51..627a33a1c5ca 100644 --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c @@ -671,7 +671,6 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data) } else if (FIELD_GET(PARF_INT_ALL_DSTATE_CHANGE, status)) { dstate = dw_pcie_readl_dbi(pci, DBI_CON_STATUS) & DBI_CON_STATUS_POWER_STATE_MASK; - dev_dbg(dev, "Received D%d state event\n", dstate); state = dstate; if (dstate == PCI_D3hot) { val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL); @@ -681,6 +680,7 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data) if (gpiod_get_value(pcie_ep->reset)) state = PCI_D3cold; } + dev_dbg(dev, "Received %s event\n", pci_power_name(state)); pci_epc_dstate_notify(pci->ep.epc, state); } else if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) { dev_dbg(dev, "Received Linkup event. Enumeration complete!\n"); From patchwork Wed Jul 10 11:08:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13729192 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E338318FDDE; Wed, 10 Jul 2024 11:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720609739; cv=none; b=K1mjvV8mi8wFmnLCBpNO7G1xDNKS9PQo1gMqyQEHw2nN1OGPJHPLh6/McmxazLeaI1x0wabxvGKI7sNdrkzHLUIwTbV1Mi6ASFiCMRyS/eP50UuGeGZsstr1o38zvgzECDqPY2/SmjC4isBoLMoH1RsOy+vNSblXwZCQkRZpySs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720609739; c=relaxed/simple; bh=sNSmlaFT8GMQD/kiM+wV8aqxn2SQiVisO8vrATvj/Z8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=BWlRFy2k8lwOqHwvWOR/80IlWWK0BQna8fdhvchn9R4vR3VAWJssBKGhdLRYZFIF0zkRjUq6JPoRRcVRdGCjv7p1qUe+cjHtK+9n0GpW83fICb+sB/i8X4a798WL2kxnqlX+RLzcVsQxZMop//umOBhHVqjfLLjD7ALZa1gLTfc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=Fn4UcLnB; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Fn4UcLnB" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46A4NXn4030713; Wed, 10 Jul 2024 11:08:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= lkltbZ8Rj0N7ZQ2MS8y2Uf/sIKt4S6/RYtcBe+ypCe0=; b=Fn4UcLnBX4CdYvFq U3QduBVHkuEBCUKUSN2rW3OQNl/UJG5vl/0Fn5YtUyIllgV7gm3xVMDg0liRoVMc IvmuvgzWEtpp0dfBx/10hrQnwvckEouoFllFj/cEmvxK+kK34veq2jBvfUBZqF6s DOyDzDy4R1uNr8NChJ3zdffm6/Rgi03Xx2oWRW3PLuVoSs/SvmdJ/Hdy4aECmz8N MOJeJnQkxesmTy6Vje9u8Iw/S7TOe1R7qnj4ZA+7kA2Ja/Rmd2jj6aCDYL6oraYP zrwa5ni8TfRq5lMextxg8rIAbv1wX1MOdRXdpt30tJFRlF+AISVlPL5eeA1F+wQJ itaAGQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 406we90yhj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 11:08:47 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 46AB8k5d025122 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jul 2024 11:08:46 GMT Received: from hu-krichai-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 10 Jul 2024 04:08:40 -0700 From: Krishna chaitanya chundru Date: Wed, 10 Jul 2024 16:38:17 +0530 Subject: [PATCH v7 4/4] PCI: epf-mhi: Add support for handling D-state notify from EPC Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240710-dstate_notifier-v7-4-8d45d87b2b24@quicinc.com> References: <20240710-dstate_notifier-v7-0-8d45d87b2b24@quicinc.com> In-Reply-To: <20240710-dstate_notifier-v7-0-8d45d87b2b24@quicinc.com> To: Manivannan Sadhasivam , =?utf-8?q?Krzy?= =?utf-8?q?sztof_Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Jonathan Corbet , Lorenzo Pieralisi , Rob Herring CC: , , , , , , , , , , "Krishna chaitanya chundru" X-Mailer: b4 0.13-dev-83828 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720609699; l=1803; i=quic_krichai@quicinc.com; s=20230907; h=from:subject:message-id; bh=sNSmlaFT8GMQD/kiM+wV8aqxn2SQiVisO8vrATvj/Z8=; b=RnCkMXimzqjTSLGhyAjfHzalAWF1i1gsJB+BgYE+0lj42Pd/YI4QVZ5LLGb53yqONRm5h7Itq FqoX50NO2rzA2aJvwrZjD01RCABdAREvaxfA4/Sh9n/7gyRs7zjDJjh X-Developer-Key: i=quic_krichai@quicinc.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: EhlpC7mepEndcM4bfwMkL-ZxePXrOYyU X-Proofpoint-GUID: EhlpC7mepEndcM4bfwMkL-ZxePXrOYyU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-10_06,2024-07-10_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 bulkscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 mlxlogscore=859 malwarescore=0 mlxscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407100076 Add support for handling D-state notify for MHI EPF. Signed-off-by: Krishna chaitanya chundru --- drivers/pci/endpoint/functions/pci-epf-mhi.c | 11 +++++++++++ include/linux/mhi_ep.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c index 7d070b1def11..6de9014e6e53 100644 --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c @@ -863,6 +863,16 @@ static int pci_epf_mhi_bus_master_enable(struct pci_epf *epf) return 0; } +static int pci_epf_mhi_dstate_notify(struct pci_epf *epf, pci_power_t state) +{ + struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf); + struct mhi_ep_cntrl *mhi_cntrl = &epf_mhi->mhi_cntrl; + + mhi_cntrl->dstate = state; + + return 0; +} + static int pci_epf_mhi_bind(struct pci_epf *epf) { struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf); @@ -921,6 +931,7 @@ static const struct pci_epc_event_ops pci_epf_mhi_event_ops = { .link_up = pci_epf_mhi_link_up, .link_down = pci_epf_mhi_link_down, .bus_master_enable = pci_epf_mhi_bus_master_enable, + .dstate_notify = pci_epf_mhi_dstate_notify, }; static int pci_epf_mhi_probe(struct pci_epf *epf, diff --git a/include/linux/mhi_ep.h b/include/linux/mhi_ep.h index 7b40fc8cbe77..7c9e5895ea2c 100644 --- a/include/linux/mhi_ep.h +++ b/include/linux/mhi_ep.h @@ -8,6 +8,7 @@ #include #include +#include #define MHI_EP_DEFAULT_MTU 0x8000 @@ -167,6 +168,8 @@ struct mhi_ep_cntrl { enum mhi_state mhi_state; + pci_power_t dstate; + u32 max_chan; u32 mru; u32 event_rings;