Re: [PATCH 3/5] add sg segment limitation info to device structure

James Bottomley
2007-10-02T14:45:19Z

On Mon, 2007-10-01 at 21:22 -0700, Greg KH wrote:
> On Mon, Oct 01, 2007 at 07:39:02PM -0600, Matthew Wilcox wrote:
> > On Mon, Oct 01, 2007 at 07:36:10PM -0400, James Bottomley wrote:
> > > One possibility we could do is to add a
> > >
> > > struct dma_device {
> > > struct device dev;
> > > u64 dma_mask;
> > > u64 coherent_dma_mask;
> > > unsigned int max_segment_size;
> > > /* plus any other DMA parameters */
> > > };
> > >
> > > but then every bus that can do DMA would need to include a struct
> > > dma_device instead of the struct device they do now. Then the IOMMU
> > > would know it could cast out from struct device to struct dma_device,
> > > but this would be a lot of work to thread through the current
> > > infrastructure.
>
> Why not just hang these fields off of a struct device, that way if the
> device doesn't/can't do dma, it only has the "loss" of a single pointer,
> not all of these fields?

Well, that's just a bit ugly ... I assume you're thinking of adding a
struct device_dma_parameters, and then defining the platform device as

struct pci_dev {
...
struct device dev;
struct device_dma_parameters dma_parms;
...
};

and then setting up the pointer?

James