Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751838AbdCGFKR (ORCPT ); Tue, 7 Mar 2017 00:10:17 -0500 Received: from mail-eopbgr40088.outbound.protection.outlook.com ([40.107.4.88]:4731 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750718AbdCGFJ6 (ORCPT ); Tue, 7 Mar 2017 00:09:58 -0500 From: Parav Pandit To: Greg Kroah-Hartman , Bart Van Assche CC: Doug Ledford , Sebastian Ott , "linux-rdma@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Bjorn Helgaas , "Benjamin Herrenschmidt" , David Woodhouse , "H . Peter Anvin" , Ingo Molnar , Russell King Subject: RE: [PATCH 1/2] device: Stop requiring that struct device is embedded in struct pci_dev Thread-Topic: [PATCH 1/2] device: Stop requiring that struct device is embedded in struct pci_dev Thread-Index: AQHSltr7A9hsfT8RwUyV7gxEsYQ73qGIz5EAgAAC0hA= Date: Tue, 7 Mar 2017 05:08:58 +0000 Message-ID: References: <20170307003549.3872-1-bart.vanassche@sandisk.com> <20170307003549.3872-2-bart.vanassche@sandisk.com> <20170307045236.GC3913@kroah.com> In-Reply-To: <20170307045236.GC3913@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [68.203.16.89] x-ms-office365-filtering-correlation-id: b936cea4-bee7-420a-34f0-08d465181037 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081);SRVR:VI1PR0502MB3006; x-microsoft-exchange-diagnostics: 1;VI1PR0502MB3006;7:r9mFTBb3ocnwunatGKO3vx+X1l1JrhA90uIE+GG5dVsrr4jTpCGLMURod5Amy9e3/o6oj74/bkJ/CdIz44Ou4s/UpbxtQUhddFhpUfkQUOJXitc38UiBD+7XWRaFx3XET/TJV3mE9wi5It6Ub9mZqd+CGaFFEW4FGJjT1fOovl0IIfHohP97hqMYsR6USclUBXFR3lWOx8vQQOUPqJHKS7ja7M3K5rhrRWV2BvjnC4kg+YpvnIG5ccJn8EKRwICBdbzDr/9An+RT3Ii31FEaV8lPdS7Jg/FgyGQnRB+RFwyXYv9F2QGLOBxt/ASmBcNehZtKEwsrfcFV9megt3In6g== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(211936372134217)(104084551191319)(42932892334569); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123558025)(20161123562025)(20161123555025)(20161123560025)(6072148);SRVR:VI1PR0502MB3006;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0502MB3006; x-forefront-prvs: 0239D46DB6 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(39410400002)(39850400002)(39450400003)(39860400002)(39840400002)(377454003)(24454002)(13464003)(33656002)(2950100002)(8656002)(7416002)(7696004)(5660300001)(86362001)(25786008)(6436002)(81166006)(8676002)(6116002)(3846002)(102836003)(8936002)(9686003)(54906002)(55016002)(99286003)(92566002)(77096006)(74316002)(305945005)(2906002)(66066001)(6506006)(229853002)(7736002)(4326008)(50986999)(106116001)(54356999)(76176999)(3280700002)(3660700001)(53546006)(2900100001)(6246003)(122556002)(189998001)(38730400002)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0502MB3006;H:VI1PR0502MB3008.eurprd05.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Mar 2017 05:08:59.0045 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3006 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v275ANY1002316 Content-Length: 1723 Lines: 33 Hi Greg, > -----Original Message----- > From: Greg Kroah-Hartman [mailto:gregkh@linuxfoundation.org] > Sent: Monday, March 6, 2017 10:53 PM > To: Bart Van Assche > Cc: Doug Ledford ; Sebastian Ott > ; Parav Pandit ; linux- > rdma@vger.kernel.org; linux-kernel@vger.kernel.org; Bjorn Helgaas > ; Benjamin Herrenschmidt > ; David Woodhouse ; > H . Peter Anvin ; Ingo Molnar ; > Russell King > Subject: Re: [PATCH 1/2] device: Stop requiring that struct device is > embedded in struct pci_dev > > On Mon, Mar 06, 2017 at 04:35:48PM -0800, Bart Van Assche wrote: > > The dma mapping operations of several architectures and also of > > several I/O MMU implementations need to translate a struct device > > pointer into a struct pci_dev pointer. This translation is performed > > by to_pci_dev(). That macro assumes that struct device is embedded in > > struct pci_dev. However, that is not the case for the device structure > > in struct ib_device. > > Then don't blindly cast it backwards! Fix that up, an ib device should have > access to the dma structures that the PCI device it depends on has. > If not, you need to set that up properly in the IB core, don't mess with the > driver core for this at all. > I replied with pseudo code in previous reply to Bart to bring back dma_device member in the ib_device. dma_device member was already present in near past of few weeks. It should be able to work using it without performance impact and without touching driver core layer like in this patch.