From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 6/6] driver core: initialize a default DMA mask for platform device Date: Thu, 15 Aug 2019 15:38:12 +0200 Message-ID: <20190815133812.GF12036@lst.de> References: <20190811080520.21712-1-hch@lst.de> <20190811080520.21712-7-hch@lst.de> <20190815130325.GB17065@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190815130325.GB17065@kroah.com> Sender: linux-kernel-owner@vger.kernel.org To: Greg Kroah-Hartman Cc: Christoph Hellwig , Maxime Chevallier , Gavin Li , Laurentiu Tudor , Minas Harutyunyan , Alan Stern , Geoff Levand , Michal Simek , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Olav Kongas , Tony Prisk , Mathias Nyman , Bin Liu , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, iommu@lists.lin List-Id: linux-arch.vger.kernel.org On Thu, Aug 15, 2019 at 03:03:25PM +0200, Greg Kroah-Hartman wrote: > > --- a/include/linux/platform_device.h > > +++ b/include/linux/platform_device.h > > @@ -24,6 +24,7 @@ struct platform_device { > > int id; > > bool id_auto; > > struct device dev; > > + u64 dma_mask; > > Why is the dma_mask in 'struct device' which is part of this structure, > not sufficient here? Shouldn't the "platform" be setting that up > correctly already in the "archdata" type callback? Becaus the dma_mask in struct device is a pointer that needs to point to something, and this is the best space we can allocate for 'something'. m68k and powerpc currently do something roughly equivalent at the moment, while everyone else just has horrible, horrible hacks. As mentioned in the changelog the intent of this patch is that we treat platform devices like any other bus, where the bus allocates the space for the dma_mask. The long term plan is to eventually kill that weird pointer indirection that doesn't help anyone, but for that we need to sort out the basics first. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from verein.lst.de ([213.95.11.211]:46797 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732324AbfHONiR (ORCPT ); Thu, 15 Aug 2019 09:38:17 -0400 Date: Thu, 15 Aug 2019 15:38:12 +0200 From: Christoph Hellwig Subject: Re: [PATCH 6/6] driver core: initialize a default DMA mask for platform device Message-ID: <20190815133812.GF12036@lst.de> References: <20190811080520.21712-1-hch@lst.de> <20190811080520.21712-7-hch@lst.de> <20190815130325.GB17065@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190815130325.GB17065@kroah.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Greg Kroah-Hartman Cc: Christoph Hellwig , Maxime Chevallier , Gavin Li , Laurentiu Tudor , Minas Harutyunyan , Alan Stern , Geoff Levand , Michal Simek , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Olav Kongas , Tony Prisk , Mathias Nyman , Bin Liu , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <20190815133812.3Mba2F9oiOSAYDnNivqIEgrK56PV4eF63TqtIYVXUno@z> On Thu, Aug 15, 2019 at 03:03:25PM +0200, Greg Kroah-Hartman wrote: > > --- a/include/linux/platform_device.h > > +++ b/include/linux/platform_device.h > > @@ -24,6 +24,7 @@ struct platform_device { > > int id; > > bool id_auto; > > struct device dev; > > + u64 dma_mask; > > Why is the dma_mask in 'struct device' which is part of this structure, > not sufficient here? Shouldn't the "platform" be setting that up > correctly already in the "archdata" type callback? Becaus the dma_mask in struct device is a pointer that needs to point to something, and this is the best space we can allocate for 'something'. m68k and powerpc currently do something roughly equivalent at the moment, while everyone else just has horrible, horrible hacks. As mentioned in the changelog the intent of this patch is that we treat platform devices like any other bus, where the bus allocates the space for the dma_mask. The long term plan is to eventually kill that weird pointer indirection that doesn't help anyone, but for that we need to sort out the basics first.