From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:25597 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933259AbcGLMgB (ORCPT ); Tue, 12 Jul 2016 08:36:01 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6CCYWFd008013 for ; Tue, 12 Jul 2016 08:35:55 -0400 Received: from e24smtp05.br.ibm.com (e24smtp05.br.ibm.com [32.104.18.26]) by mx0b-001b2d01.pphosted.com with ESMTP id 243eddsn41-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 12 Jul 2016 08:35:55 -0400 Received: from localhost by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Jul 2016 09:35:53 -0300 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.13.184.26]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id 6FC0C3520076 for ; Tue, 12 Jul 2016 08:35:32 -0400 (EDT) Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay02.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u6CCZo5Q31392214 for ; Tue, 12 Jul 2016 09:35:50 -0300 Received: from d24av03.br.ibm.com (localhost [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u6CCZnJE025968 for ; Tue, 12 Jul 2016 09:35:50 -0300 Subject: Re: [patch added to 3.12-stable] powerpc/iommu: Remove the dependency on EEH struct in DDW mechanism To: Jiri Slaby , stable@vger.kernel.org References: <20160712094129.25202-1-jslaby@suse.cz> <20160712094129.25202-39-jslaby@suse.cz> Cc: Michael Ellerman , Gavin Shan From: "Guilherme G. Piccoli" Date: Tue, 12 Jul 2016 09:35:49 -0300 MIME-Version: 1.0 In-Reply-To: <20160712094129.25202-39-jslaby@suse.cz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Message-Id: <5784E425.8070706@linux.vnet.ibm.com> Sender: stable-owner@vger.kernel.org List-ID: On 07/12/2016 06:41 AM, Jiri Slaby wrote: > From: "Guilherme G. Piccoli" > > This patch has been added to the 3.12 stable tree. If you have any > objections, please let us know. > Jiri, thanks for letting me know. If you added this on 3.12, you need to add another commit (that has a fix to this one): 8a934efe9434 ("powerpc/pseries: Fix PCI config address for DDW") I'm not sure if you already added 8a934efe9434, but in any case I found useful to warn you. Cheers, Guilherme > =============== > > commit 8445a87f7092bc8336ea1305be9306f26b846d93 upstream. > > Commit 39baadbf36ce ("powerpc/eeh: Remove eeh information from pci_dn") > changed the pci_dn struct by removing its EEH-related members. > As part of this clean-up, DDW mechanism was modified to read the device > configuration address from eeh_dev struct. > > As a consequence, now if we disable EEH mechanism on kernel command-line > for example, the DDW mechanism will fail, generating a kernel oops by > dereferencing a NULL pointer (which turns to be the eeh_dev pointer). > > This patch just changes the configuration address calculation on DDW > functions to a manual calculation based on pci_dn members instead of > using eeh_dev-based address. > > No functional changes were made. This was tested on pSeries, both > in PHyp and qemu guest. > > Fixes: 39baadbf36ce ("powerpc/eeh: Remove eeh information from pci_dn") > Reviewed-by: Gavin Shan > Signed-off-by: Guilherme G. Piccoli > Signed-off-by: Michael Ellerman > Signed-off-by: Jiri Slaby > --- > arch/powerpc/platforms/pseries/iommu.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c > index 261c5095d5d3..88cbecbdbd6f 100644 > --- a/arch/powerpc/platforms/pseries/iommu.c > +++ b/arch/powerpc/platforms/pseries/iommu.c > @@ -861,7 +861,8 @@ machine_arch_initcall(pseries, find_existing_ddw_windows); > static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, > struct ddw_query_response *query) > { > - struct eeh_dev *edev; > + struct device_node *dn; > + struct pci_dn *pdn; > u32 cfg_addr; > u64 buid; > int ret; > @@ -872,11 +873,10 @@ static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, > * Retrieve them from the pci device, not the node with the > * dma-window property > */ > - edev = pci_dev_to_eeh_dev(dev); > - cfg_addr = edev->config_addr; > - if (edev->pe_config_addr) > - cfg_addr = edev->pe_config_addr; > - buid = edev->phb->buid; > + dn = pci_device_to_OF_node(dev); > + pdn = PCI_DN(dn); > + buid = pdn->phb->buid; > + cfg_addr = (pdn->busno << 8) | pdn->devfn; > > ret = rtas_call(ddw_avail[0], 3, 5, (u32 *)query, > cfg_addr, BUID_HI(buid), BUID_LO(buid)); > @@ -890,7 +890,8 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail, > struct ddw_create_response *create, int page_shift, > int window_shift) > { > - struct eeh_dev *edev; > + struct device_node *dn; > + struct pci_dn *pdn; > u32 cfg_addr; > u64 buid; > int ret; > @@ -901,11 +902,10 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail, > * Retrieve them from the pci device, not the node with the > * dma-window property > */ > - edev = pci_dev_to_eeh_dev(dev); > - cfg_addr = edev->config_addr; > - if (edev->pe_config_addr) > - cfg_addr = edev->pe_config_addr; > - buid = edev->phb->buid; > + dn = pci_device_to_OF_node(dev); > + pdn = PCI_DN(dn); > + buid = pdn->phb->buid; > + cfg_addr = (pdn->busno << 8) | pdn->devfn; > > do { > /* extra outputs are LIOBN and dma-addr (hi, lo) */ >