Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp672936rwb; Thu, 27 Jul 2023 20:23:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlEzJTuE7T6HfbwXRsAaSrq52vOCYyTpA2uBI07ujG5CrSOd0TtC7Eu3LlpFsyRa8BDj0P5q X-Received: by 2002:a17:903:11d0:b0:1b6:bced:1dd6 with SMTP id q16-20020a17090311d000b001b6bced1dd6mr477115plh.35.1690514601794; Thu, 27 Jul 2023 20:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690514601; cv=none; d=google.com; s=arc-20160816; b=S1bz3UrRHIQ4zOosSfdfKDi6ZBRQhb/hqZSk5rhzxTAv78Zm9Tjykwu9DWCaE0v49F Ev5QcPXPZbWhxfl8zrCzcDAWMM3mT+4/ZEF4Ddg7yS7v1LdTiHzYxzfRNQ6jywHJ7zNb 9Q1h82rdJCDeYk+NrYkI/ronqYz2XIO/d4pIlx5I4IMvbbzoOPcY3Jt83ApoJS2TiLwY wMX1iOgpSq3K9VIVQimDeRoijxGNqr0lJKSfm5plWeHPKVS0Sx7yYeR3DnKWzqg0h7Zx /Cq4rXWzVkHg/CCQQT/7X/TQUSCzg6aWAWnUQcg3QC81N6quKaV4icjUyrxzfGn+EcDx x/kQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=V8qcyXhsNvgzKjliTm6pyHhybIiyr9fqvxvJX1sBUVU=; fh=VZs9m8eodwcrjfq01+9vht2gSMEnqFTQTgLQ/f/Alzc=; b=AQBcxXfFTJAjSlxkWsAATXESmzeLBE+KIjXJ7cFxeLt1yzURPdCYRmG/6epkbUnOJx IVoabIY6BWo8QS0Hk1Iz+RAsMCZhQY6ABUInnzK307q9dXy+bTeGq6+3bQsbbCDo/r7c kO8frmYt0laMCJ0MHAnT5zn+zvoN/DLFG/KieYH7vT0uIdhAu/Mi+Pe9wSrSp6ny9G5l U5U0ZVLgG0Q3h38yG3upwaWIPyKVem4cWPZ68C5gtTkfV2LydHFCmVqUM/WRSpm+yjo6 RGxRenqisy3gbPszK4xyRDzjDoFKNFYlzN+dxTxJ0DDuodfrNP6mJ5hGYi+n/ATJniSu A+8w== 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kx14-20020a170902f94e00b001b8ae9058d3si2208541plb.516.2023.07.27.20.23.08; Thu, 27 Jul 2023 20:23:21 -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; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232813AbjG1DC2 (ORCPT + 99 others); Thu, 27 Jul 2023 23:02:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232851AbjG1DCO (ORCPT ); Thu, 27 Jul 2023 23:02:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA83426A8; Thu, 27 Jul 2023 20:02:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 486A061FB7; Fri, 28 Jul 2023 03:02:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36F35C433C7; Fri, 28 Jul 2023 03:02:00 +0000 (UTC) Date: Fri, 28 Jul 2023 08:31:55 +0530 From: Manivannan Sadhasivam To: Krishna chaitanya chundru 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, Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Manivannan Sadhasivam , Kishon Vijay Abraham I , Bjorn Helgaas , Jonathan Corbet , "open list:DOCUMENTATION" Subject: Re: [PATCH v4 1/9] PCI: endpoint: Add D-state change notifier support Message-ID: <20230728030155.GD4433@thinkpad> References: <1689232218-28265-1-git-send-email-quic_krichai@quicinc.com> <1689232218-28265-2-git-send-email-quic_krichai@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1689232218-28265-2-git-send-email-quic_krichai@quicinc.com> X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, 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 On Thu, Jul 13, 2023 at 12:40:10PM +0530, Krishna chaitanya chundru wrote: > 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 | 5 +++++ > drivers/pci/endpoint/pci-epc-core.c | 27 +++++++++++++++++++++++++++ > include/linux/pci-epc.h | 1 + > include/linux/pci-epf.h | 1 + > 4 files changed, 34 insertions(+) > > diff --git a/Documentation/PCI/endpoint/pci-endpoint.rst b/Documentation/PCI/endpoint/pci-endpoint.rst > index 4f5622a..3a54713 100644 > --- a/Documentation/PCI/endpoint/pci-endpoint.rst > +++ b/Documentation/PCI/endpoint/pci-endpoint.rst > @@ -78,6 +78,11 @@ by the PCI controller driver. > Cleanup the pci_epc_mem structure allocated during pci_epc_mem_init(). > > > +* pci_epc_dstate_notity() > + > + In order to notify all the function devices that the EPC device has > + changed its D-state. 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 6c54fa5..ea76baf 100644 > --- a/drivers/pci/endpoint/pci-epc-core.c > +++ b/drivers/pci/endpoint/pci-epc-core.c > @@ -785,6 +785,33 @@ void pci_epc_bme_notify(struct pci_epc *epc) > EXPORT_SYMBOL_GPL(pci_epc_bme_notify); > > /** > + * pci_epc_dstate_notity() - Notify the EPF device that EPC device D-state EPF driver - Mani > + * 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 has D-state has > + * changed. > + */ > +void pci_epc_dstate_notity(struct pci_epc *epc, pci_power_t state) > +{ > + struct pci_epf *epf; > + > + if (!epc || IS_ERR(epc)) > + return; > + > + 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_notity); > + > +/** > * 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 5cb6940..26a1108 100644 > --- a/include/linux/pci-epc.h > +++ b/include/linux/pci-epc.h > @@ -251,4 +251,5 @@ void __iomem *pci_epc_mem_alloc_addr(struct pci_epc *epc, > phys_addr_t *phys_addr, size_t size); > 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_change(struct pci_epc *epc, pci_power_t state); > #endif /* __LINUX_PCI_EPC_H */ > diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h > index 3f44b6a..529075b 100644 > --- a/include/linux/pci-epf.h > +++ b/include/linux/pci-epf.h > @@ -79,6 +79,7 @@ struct pci_epc_event_ops { > int (*link_up)(struct pci_epf *epf); > int (*link_down)(struct pci_epf *epf); > int (*bme)(struct pci_epf *epf); > + int (*dstate_notify)(struct pci_epf *epf, pci_power_t state); > }; > > /** > -- > 2.7.4 > -- மணிவண்ணன் சதாசிவம்