Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18430331ybl; Fri, 3 Jan 2020 02:09:14 -0800 (PST) X-Google-Smtp-Source: APXvYqxh+0cSo6zgwW/DE4kTT1aF+CHdW/dE9Pn4zcl6HkG/fnJ9BbgMfwzbBbU/aAPs/zX1qi9N X-Received: by 2002:a9d:7c8a:: with SMTP id q10mr91503651otn.124.1578046154787; Fri, 03 Jan 2020 02:09:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578046154; cv=none; d=google.com; s=arc-20160816; b=Tkr+q+ohAXmhBp3JGcOeNYdJQi3ke8JG4HUGWdlKVY6gfe2T72WVBkIGWgKktrT12H 0WG9fAMnEdXCzoI2/sVp0n+wKmQt3kLXuBiQEGnH6DEj5XeglspaotxGwlVzFdpaGU3m d92/q0pg/u94s1k64hyV9g5wsSUPv9hiX4KwtcTlSe0SPG9gqY0YjdTGVYT++sQG7rLE J2X0C8t6140H3UkWB65big2k/mJmsPQdMVGJyWo1jerZUja9nGxvQ+bhDUMACeKm91gL z2F0qRtU8yeF8Y/WH13ylFWDtc0DUTFYDenFGiLVa8vFhrUqwuGNfPszli6EixchEmHe 5k6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=Ha+bcuXGrM0L03R3lRVubmjiE0J+PZcOB0XAy0EUE5c=; b=e94M7mgxqVGh7MrQCmsBX96N1zGaLV3RRTgjQf7mp0DUd5IgMZdhzlu1GSx2TVw+kS uas4PuVtplLvyQ0Q3W6FQPbpq+QnFeOKBG+wzc5ZpAxaCPYznFmXZHojA+O/7awX8bkL 5pncOHn6T4YP11GSIq24rMccZNbAERbxqrGlEOzqqQZTA9+4CTIFL1nsoIVM7IOOHeiC Nmsm9776WCsKV07+3MiWd5EUcp94cHeKSmFuscAKBqQJuKRY/AIeHpr//WUEUblYqk6z 5luFNAYtyU17tEtRZUfT7t0PgKJCFut+KuYx+LXwd1axXY0m9AVLOFM4ifPjb9l1vi8p t28A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=XHumTBBO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z25si26209335oic.23.2020.01.03.02.09.02; Fri, 03 Jan 2020 02:09:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=XHumTBBO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727563AbgACKIE (ORCPT + 99 others); Fri, 3 Jan 2020 05:08:04 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:10125 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725972AbgACKID (ORCPT ); Fri, 3 Jan 2020 05:08:03 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 03 Jan 2020 02:07:47 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 03 Jan 2020 02:08:02 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 03 Jan 2020 02:08:02 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 3 Jan 2020 10:08:02 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 3 Jan 2020 10:08:02 +0000 Received: from vidyas-desktop.nvidia.com (Not Verified[10.24.37.48]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 03 Jan 2020 02:08:01 -0800 From: Vidya Sagar To: , , , , , , CC: , , , , , , , Subject: [PATCH V2 3/5] PCI: endpoint: Add notification for core init completion Date: Fri, 3 Jan 2020 15:37:34 +0530 Message-ID: <20200103100736.27627-4-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103100736.27627-1-vidyas@nvidia.com> References: <20200103100736.27627-1-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1578046067; bh=Ha+bcuXGrM0L03R3lRVubmjiE0J+PZcOB0XAy0EUE5c=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=XHumTBBOq4zk1kksPblE5ZUSUrzLSmEl8wbn906VZpik6Gzt+DFwwioE8PzD+qHVa LNKWGidyu34JtJAAyOU7EdmV38tiE2JDajYDQ+hYryyLI4tMObAGjxXYd48caSrbE+ gIDZSKuUXKAokHF+2804e8fniTT9AzfD4+F1EWSfNu9LW/LSHzja/s+opScSHn4ROW AA3ZrZ0tie/6Phd3lT9Y/uxG8dVhgG7kpSUH4E5fjoUqsV5f0tnBF4+ezRNCp1lymc HKPH8Gzo+JwdfKcxLG7b0/2eW84q2PIN59Ao4em/fuU8vYMXzdTOOVRCuFTQtOJCcD lwsLSqddEHtvw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to send notifications to EPF from EPC once the core registers initialization is complete. Signed-off-by: Vidya Sagar --- V2: * None drivers/pci/endpoint/pci-epc-core.c | 19 ++++++++++++++++++- include/linux/pci-epc.h | 1 + include/linux/pci-epf.h | 5 +++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index 2f6436599fcb..fcc3f7fb19c0 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -542,10 +542,27 @@ void pci_epc_linkup(struct pci_epc *epc) if (!epc || IS_ERR(epc)) return; - atomic_notifier_call_chain(&epc->notifier, 0, NULL); + atomic_notifier_call_chain(&epc->notifier, LINK_UP, NULL); } EXPORT_SYMBOL_GPL(pci_epc_linkup); +/** + * pci_epc_init_notify() - Notify the EPF device that EPC device's core + * initialization is completed. + * @epc: the EPC device whose core initialization is completeds + * + * Invoke to Notify the EPF device that the EPC device's initialization + * is completed. + */ +void pci_epc_init_notify(struct pci_epc *epc) +{ + if (!epc || IS_ERR(epc)) + return; + + atomic_notifier_call_chain(&epc->notifier, CORE_INIT, NULL); +} +EXPORT_SYMBOL_GPL(pci_epc_init_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 ec8d4d896564..31cdae7e2cdd 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -160,6 +160,7 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc); void pci_epc_destroy(struct pci_epc *epc); int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf); void pci_epc_linkup(struct pci_epc *epc); +void pci_epc_init_notify(struct pci_epc *epc); void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf); int pci_epc_write_header(struct pci_epc *epc, u8 func_no, struct pci_epf_header *hdr); diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index 4993f7f6439b..3cb65ac1648c 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -15,6 +15,11 @@ struct pci_epf; +enum pci_notify_event { + CORE_INIT, + LINK_UP, +}; + enum pci_barno { BAR_0, BAR_1, -- 2.17.1