From patchwork Fri Sep 22 14:06:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bryant G. Ly" X-Patchwork-Id: 9966237 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B76CF60381 for ; Fri, 22 Sep 2017 14:06:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5C5C298EE for ; Fri, 22 Sep 2017 14:06:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7595298F2; Fri, 22 Sep 2017 14:06:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E051298EE for ; Fri, 22 Sep 2017 14:06:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752210AbdIVOGz (ORCPT ); Fri, 22 Sep 2017 10:06:55 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41924 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751979AbdIVOGz (ORCPT ); Fri, 22 Sep 2017 10:06:55 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8ME6gKr108728 for ; Fri, 22 Sep 2017 10:06:54 -0400 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0a-001b2d01.pphosted.com with ESMTP id 2d51nhtt0v-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 22 Sep 2017 10:06:54 -0400 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Sep 2017 08:06:24 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Sep 2017 08:06:20 -0600 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8ME6JRj65405066; Fri, 22 Sep 2017 07:06:19 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C323FC603E; Fri, 22 Sep 2017 08:06:19 -0600 (MDT) Received: from bryants-mbp-3.rchland.ibm.com (unknown [9.10.79.180]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP id 5090AC6042; Fri, 22 Sep 2017 08:06:19 -0600 (MDT) From: "Bryant G. Ly" To: bhelgaas@google.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au Cc: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, "Bryant G. Ly" , "Juan J . Alvarez" Subject: [PATCH v2 2/2] pseries/eeh: Add Pseries pcibios_bus_add_device Date: Fri, 22 Sep 2017 09:06:08 -0500 X-Mailer: git-send-email 2.11.0 (Apple Git-81) In-Reply-To: <20170922140608.47665-1-bryantly@linux.vnet.ibm.com> References: <20170922140608.47665-1-bryantly@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17092214-0028-0000-0000-000008658797 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007777; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000231; SDB=6.00920736; UDB=6.00462682; IPR=6.00700958; BA=6.00005601; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017248; XFM=3.00000015; UTC=2017-09-22 14:06:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092214-0029-0000-0000-000037A7C05A Message-Id: <20170922140608.47665-3-bryantly@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-22_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709220196 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the machine dependent call for pcibios_bus_add_device, since the previous patch separated the calls out between the PowerNV and PowerVM. The difference here is that for the PowerVM environment we do not want match_driver set because in this environment we do not want the VF device drivers to load immediately, due to firmware loading the device node when VF device is assigned to the logical partition. This patch will depend on the patch linked below, which is under review. https://patchwork.kernel.org/patch/9882915/ Signed-off-by: Bryant G. Ly Signed-off-by: Juan J. Alvarez --- arch/powerpc/platforms/pseries/eeh_pseries.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c index 1eef46d9cf30..ac72011a045c 100644 --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -64,6 +64,27 @@ static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX]; static DEFINE_SPINLOCK(slot_errbuf_lock); static int eeh_error_buf_size; +void pseries_pcibios_bus_add_device(struct pci_dev *pdev) +{ + struct pci_dn *pdn = pci_get_pdn(pdev); + + if (!pdev->is_virtfn) + return; + + pdn->device_id = pdev->device; + pdn->vendor_id = pdev->vendor; + pdn->class_code = pdev->class; + + /* + * The following operations will fail if VF's sysfs files + * aren't created or its resources aren't finalized. + */ + eeh_add_device_early(pdn); + eeh_add_device_late(pdev); + eeh_sysfs_add_device(pdev); + pdev->match_driver = -1; +} + /** * pseries_eeh_init - EEH platform dependent initialization * @@ -120,6 +141,9 @@ static int pseries_eeh_init(void) /* Set EEH probe mode */ eeh_add_flag(EEH_PROBE_MODE_DEVTREE | EEH_ENABLE_IO_FOR_LOG); + /* Set EEH machine dependent code */ + ppc_md.pcibios_bus_add_device = pseries_pcibios_bus_add_device; + return 0; }