Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1602207ybc; Wed, 13 Nov 2019 01:10:15 -0800 (PST) X-Google-Smtp-Source: APXvYqzwMrY7Z9ttBiVbmhkAqKxwdIJCZFkuLP+IoVz3C9LfaraU6Fg5AGW0lH5MCQjSz15bdj2X X-Received: by 2002:a50:a2e5:: with SMTP id 92mr2367856edm.195.1573636215858; Wed, 13 Nov 2019 01:10:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573636215; cv=none; d=google.com; s=arc-20160816; b=wFVosCQnqu0ZKhNNNbmdhnb8BLJiVc3sZFjk+7++ydCXPz038AdaYtuAjCjc1ThS6/ Ndjkh5I5lYurBhBQy3+DtdvadHIW1B790U27YCoiSOXfmGLR4utmKNA/5P/fdz8I0Rwu 0Dw8suoVCRheJlUqppHHPXSCElLgg2J/y47632pAQ3E3SoySYWulsBUSy2EQNyEobzo3 QiUjAIzYzPt90Df6rWTmBN4O9Bx5HzoxjcgrfIGPyseoKFSfJ+Mv/23Am5GqLT2wSof1 gLZIN8Q51X4AEv8VYbCJZvHbIWMrPEM2ZAe+JH4UwSRYCv6SeJo7jzy+kyzKzbNY/b1/ 9vLg== 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=9U6u+odfldnbQptdUxvIfB0A/9BF5Luwy6niejQ8RZU=; b=Tn9fUZHXWF/HebGzir+Lq3ovawnDuORp7bSQzuB8umGfUbnyDEoL/rZNsMt7PIVmvu rgvOEdTU8G0topO5uiBpqD8ZDtrQGk1taNFrDTDwh40D7mFO6NApEzXgn61uGXkXkQwX axrf8ypnkYzRW+HVNa4XTbvRrFAlYtnGryCihvO/KTkmsHCcgY3jBNhIIMQb/St5E3+U Gjv8XmXmAbaI+mYkSrVrKOzLgF+G543Waj9uklt7VKPQJv8GAIxKjOxG9I/fr9wnTO9W bwxaK2Qoqm0+AF4z3wfrT8qQnOV1+edUEP0ZRuXdystv7xy2/1gvVjgiK4qx5YHqoCM8 3dIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=E5F+Gu5U; 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 q14si704928ejb.125.2019.11.13.01.09.51; Wed, 13 Nov 2019 01:10:15 -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=E5F+Gu5U; 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 S1727349AbfKMJJL (ORCPT + 99 others); Wed, 13 Nov 2019 04:09:11 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:2683 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbfKMJJK (ORCPT ); Wed, 13 Nov 2019 04:09:10 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Wed, 13 Nov 2019 01:09:09 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 13 Nov 2019 01:09:09 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 13 Nov 2019 01:09:09 -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; Wed, 13 Nov 2019 09:09:09 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 13 Nov 2019 09:09: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 ; Wed, 13 Nov 2019 01:09:08 -0800 From: Vidya Sagar To: , , , , , , CC: , , , , , , , Subject: [PATCH 2/4] PCI: endpoint: Add notification for core init completion Date: Wed, 13 Nov 2019 14:38:49 +0530 Message-ID: <20191113090851.26345-3-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191113090851.26345-1-vidyas@nvidia.com> References: <20191113090851.26345-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=1573636149; bh=9U6u+odfldnbQptdUxvIfB0A/9BF5Luwy6niejQ8RZU=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=E5F+Gu5UddwAPwEUAMkbFNBaMOtk4AlmXaEo7SJHwmMjyXkTQe9YTvDoxkT/bt+No 4ex2GD2tDuLnuzTwxiBS1rWQ3T6HXcdcNprStfEX0XGu4Zney1QoTapnYB0MwQcqiC szHRYzggZub3Dl9U7A/JCiNJnOYZbw+MXwlFp5vCILYR52PJUbK36yEz5AxAitpDfo nZKBfIb8k2xezfQK/FnypWbPF+Hrst0U3dk1bNZauryZTcXj2u9Iehtl3db9/K6jrO Jw6Lhlo+KbvULL8Jvpe7yrTpW/lACZTU86FklLP+f9iUrrQBn2DnhQGe6vx9LwKfcc TG+4r/gXS4U8Q== 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 --- 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 241e6a6f39fb..c670543e42f9 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