Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4724307ybv; Mon, 17 Feb 2020 04:46:05 -0800 (PST) X-Google-Smtp-Source: APXvYqyTBUfXwaMu5Gi97oFPqLFQB0GhLYSENZhcZTbfn6lfJpg1ptyn2tofZTTuhjHysMZ7lAOM X-Received: by 2002:a05:6808:9ba:: with SMTP id e26mr9891532oig.81.1581943565103; Mon, 17 Feb 2020 04:46:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581943565; cv=none; d=google.com; s=arc-20160816; b=m07Vrh+aK3gvHrchh5QDI/hq7oVDGy2ok1n2JTByMvAoN00GtMrSSyFyQ4NZXcCsnx V4pwD6+9bPbl+HOz9qdrWCAQMZcIVlvzr+5tE+IgUgY9vsAmlPlOBWbJtZwKI8qzh5S7 0bYaasGctl+YI/55Kxp3mhDD1vp5wlKHHEwg0jL5H1nV58N3IXsK3Qp3jFaptDk00UcS NK6dlGl7D5seUIuXPJtI1WkJnKI7ays5uIkBLO5QpvCZNa8wBrxFIdFl5EpXLn/5x9vV +mPBD3OIbJmdD7vFryfrHbRqlC26suue5+8v6AosxoP62AOCHm/SCSzkUaR77gSw2ZH0 dw2w== 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=6Iopf0Q6A3DDLlHopVYOdLyoIpX4hHn9y3CGW1XIkKU=; b=xAxQbS/aTko0rV4zcAiphYKeWGL5YWg3f1wyoYyhacV1QzTXyJDWg4TRFCvVQs4Bh+ ZW3uAu7uxywxPBiW499wbbtfd8PjT1kWy15yhg2kUGVx2OhjTz/OIQkISW8jAW1QAqF8 aGg47+1UrPPMCtrf7RNmYaIiMNNaBgtByQU7pLM4BknHE7B+ya+osb23N4uOYauH9dDu 1/rccRokAoZa0KGoMEPfJzZmSSMYuf1IJ1TggFE4e6KwgZO/fx0LbFqtCSQHWTnhlhUu gkeRirLdlICLFDwIhMvEiWKFYwho/B+hky5eY5YTk6e2+qMIMDATS4X9IN5RR0y5U122 /+BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=DJT52cbX; 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 w18si157343otp.48.2020.02.17.04.45.52; Mon, 17 Feb 2020 04:46:05 -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=DJT52cbX; 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 S1729665AbgBQMLM (ORCPT + 99 others); Mon, 17 Feb 2020 07:11:12 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:2716 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729656AbgBQMLK (ORCPT ); Mon, 17 Feb 2020 07:11:10 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 17 Feb 2020 04:10:56 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 17 Feb 2020 04:11:09 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 17 Feb 2020 04:11:09 -0800 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 17 Feb 2020 12:11:09 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 17 Feb 2020 12:11:09 +0000 Received: from vidyas-desktop.nvidia.com (Not Verified[10.24.37.38]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 17 Feb 2020 04:11:09 -0800 From: Vidya Sagar To: , , , , , , CC: , , , , , , , Subject: [PATCH V3 3/5] PCI: endpoint: Add notification for core init completion Date: Mon, 17 Feb 2020 17:40:34 +0530 Message-ID: <20200217121036.3057-4-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200217121036.3057-1-vidyas@nvidia.com> References: <20200217121036.3057-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=1581941456; bh=6Iopf0Q6A3DDLlHopVYOdLyoIpX4hHn9y3CGW1XIkKU=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=DJT52cbXjSQEPGFh2grgktj414HkaetbwuoCPvvvtaU/N84NiGNKoH/rshjN3Qoxm 9KhIEGc6E9Gjj2hzOD469ayLzx5e1ARJDulAsCVFvI9GK5loWHqKsAKFtbHfGBYnvD QAn7GQeCeWH3zKGgoV3qFEpEfnd6ICWm7igQ0pA2DG38D+lvQ8hllAP/8tOeomxHM2 wMcmmxwgqzGD6+EaiI1wqcmQs5wNH6ANf1LFEa/m9Z62b8zNAeWYJm/Vl7V2T4Sk4J xBIk8ACRIHSvHMs60P5G9/olkX76a36HPmjGh/CK53szDR2/cKe53Q1WUJcYxAXqUg wsyPjZZs6AGdg== 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 Acked-by: Kishon Vijay Abraham I --- V3: * Added Acked-by: Kishon Vijay Abraham I 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 dc1c673534e0..0d22a377a0cf 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -540,10 +540,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 9ffe6bd081ae..0d7e91bad91e 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -165,6 +165,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 bcdf4f07bde7..0c628e30c582 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