public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martyn Welch <martyn.welch@gefanuc.com>
To: "Emilio G. Cota" <cota@braap.org>
Cc: Greg K-H <gregkh@suse.de>,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	Sebastien Dugue <sebastien.dugue@bull.net>
Subject: Re: [patch 4/5] Staging: vme: add Tundra TSI148 VME-PCI Bridgedriver
Date: Tue, 11 Aug 2009 15:59:34 +0100	[thread overview]
Message-ID: <4A818756.3070406@gefanuc.com> (raw)
In-Reply-To: <20090809000925.GB29303@braap.org>

Hi Emilio,

Sorry for not replying to this mail sooner - got caught in my junk 
folder for some reason.

Emilio G. Cota wrote:
>
> Greg, Martyn,
>
> please have a look at our tsi148 driver, available at:
> http://repo.or.cz/w/tsi148vmebridge.git
> Whenever you encounter a reference to 'CES', ignore it,
> it's a CERN thing for easing our lives porting drivers from
> LynxOS.
>

I've had a brief look - it seem's to provide roughtly what I am 
attempting to provide with the tsi-148 driver as part of the VME stuff 
in staging.
>
>
> I could post the driver to LKML for review if you want; I would
> remove that CES crap before posting. I put this off because
> I knew it would never get merged before there was some generic
> vme glue supporting it. However now we're getting there so
> it's probably a good time to get cracking with this task.
>
> Martyn, a few comments about your driver, haven't had much
> time to dig very deep.
>
> - again, use mutexes instead of semaphores
>

Yes - I have a patch on the way.

> - The DMA code looks rather messy; I mean stuff like this:
>

That's because it's incomplete - hence why it's in the staging tree.
>
> > +#if 0
> > +     /* XXX Still todo */
> > +     for (x = 0; x < 8; x++) {       /* vme block size */
> > +             if ((32 << x) >= vmeDma->maxVmeBlockSize) {
> > +                     break;
> > +             }
> > +     }
> > +     if (x == 8)
> > +             x = 7;
> > +     dctlreg |= (x << 12);
> > +
> > +     for (x = 0; x < 8; x++) {       /* pci block size */
> > +             if ((32 << x) >= vmeDma->maxPciBlockSize) {
> > +                     break;
> > +             }
> > +     }
> > +     if (x == 8)
> > +             x = 7;
> > +     dctlreg |= (x << 4);
> > +
> > +     if (vmeDma->vmeBackOffTimer) {
> and the ifdefs 0..
>
> - correct me if I'm wrong, but does the slave need to know the
>   window number he wants for his device? See:
> > +int tsi148_slave_get(struct vme_slave_resource *image, int *enabled,
> > +     unsigned long long *vme_base, unsigned long long *size,
> > +     dma_addr_t *pci_base, vme_address_t *aspace, vme_cycle_t *cycle)
> > +{
> > +     unsigned int i, granularity = 0, ctl = 0;
> > +     unsigned int vme_base_low, vme_base_high;
> > +     unsigned int vme_bound_low, vme_bound_high;
> > +     unsigned int pci_offset_low, pci_offset_high;
> > +     unsigned long long vme_bound, pci_offset;
> > +
> > +
> > +     i = image->number;
>
> If that's the case, this is totally broken; in fact, even if you
> kept a list somewhere up on the generic vme layer keeping track
> of the already used windows (images?) to avoid any clashes,
>
Yes - the core layer keeps track of what is in use.

> in practice you'd very soon run out of windows: 8 modules, 8
> mappings, 8 windows. And you're dead.
>

Depends how the drivers use them.

>
> In a crate we have up to 20 modules, each of them with at least
> one address space to be mapped. To make this work we do the
> following:
>
> * The tsi148 has 1GB of address space available for mapping,
>   which is further divided into 8 windows, with a unique address
>   modifier per window.
> * Say you have 15 modules that need to map 1MB each, all of them
>   with the same address modifier (AM).
> Then what the slave driver requests is *not* a window, is what we
> call a 'vme mapping', which means "do whatever you want but give
> me a kernel address that points at this VME address, mapping with
> this size and AM".
>

With the API I have presented you could still map all 15 modules with 
one window in your driver if that makes sense.

>
> Our tsi148 driver notices then that there's already a window for
> that AM, so it just appends the mapping to the existing window.
> So at the end of the day only one window is used for all those
> mappings, which are nicely piled together.
>

If you want this kind of control, I think it would work well as a layer 
above the basic resource management built into the API I have. The two 
could live fairly happily side-by-side.

>
> Please clarify me how this is handled in your driver. The
> bottom line is to ensure that
> a) Many different modules can peacefully co-exist on a crate
>

Drivers request resources, if the resources are available, they get 
them. Resources are requested with respect to the attributes required.

> b) Drivers should know nothing about what else is on your crate
>

I agree.

Martyn
>
>
> E.
>
-- 

Martyn Welch MEng MPhil MIET (Principal Software Engineer)   T:+44(0)1327322748
GE Fanuc Intelligent Platforms Ltd,        |Registered in England and Wales
Tove Valley Business Park, Towcester,      |(3828642) at 100 Barbirolli Square,
Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB  VAT:GB 927559189

  reply	other threads:[~2009-08-11 14:58 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090803205657.964064732@mini.kroah.org>
2009-08-03 21:00 ` [patch 0/5] [ANNOUNCE] VME Bus drivers and framework for Linux Greg K-H
2009-08-03 21:01   ` [patch 1/5] Staging: VME Framework for the Linux Kernel Greg K-H
2009-08-08 23:01     ` Emilio G. Cota
2009-08-10 12:44       ` Martyn Welch
2009-08-10 14:14         ` Emilio G. Cota
2009-08-10 15:31           ` Emilio G. Cota
2009-08-10 16:40             ` Martyn Welch
2009-08-10 19:50               ` Emilio G. Cota
2009-08-11  8:02                 ` Martyn Welch
2009-08-11  8:43                   ` Emilio G. Cota
2009-08-10 15:53           ` Martyn Welch
2009-08-10 16:26             ` Shawn Bohrer
2009-08-10 19:38             ` Emilio G. Cota
2009-08-11  8:29               ` Martyn Welch
2009-08-11 14:49                 ` Emilio G. Cota
2009-08-11 15:10                   ` Martyn Welch
2009-08-11 15:36                     ` Emilio G. Cota
2009-08-11 15:41                       ` Martyn Welch
2009-08-11 15:42                         ` Emilio G. Cota
2009-08-11 16:38                           ` Martyn Welch
2009-08-11 20:48                             ` Emilio G. Cota
2009-08-12  9:54                             ` Emilio G. Cota
2009-08-12  9:59                               ` Martyn Welch
2009-08-12 10:09                                 ` Emilio G. Cota
2009-08-12 10:19                                   ` Martyn Welch
2009-08-11  4:54         ` Mike Frysinger
2009-08-11  7:48           ` Martyn Welch
2009-08-10 16:30       ` Greg KH
2009-08-10 14:52     ` [PATCH] Staging: vme: fix {master,slave}_get check bug Emilio G. Cota
2009-08-10 16:50       ` Martyn Welch
2009-08-03 21:01   ` [patch 2/5] Staging: vme: add VME userspace driver Greg K-H
2009-08-08 23:22     ` Emilio G. Cota
2009-08-09 12:17       ` Emilio G. Cota
2009-08-10 13:13         ` Martyn Welch
2009-08-10 15:26           ` Emilio G. Cota
2009-08-10 16:29             ` Greg KH
2009-08-10 16:30             ` Martyn Welch
2009-08-10 20:36               ` Emilio G. Cota
2009-08-11  9:03                 ` Martyn Welch
2009-08-11  9:40                   ` Emilio G. Cota
2009-08-11 12:46                     ` Martyn Welch
2009-08-11 21:01                       ` Emilio G. Cota
2009-08-12  8:17                         ` Martyn Welch
2009-08-12  9:39                           ` Emilio G. Cota
2009-08-12  9:57                             ` Martyn Welch
2009-08-12 11:20                               ` Emilio G. Cota
2009-08-12 12:19                                 ` Martyn Welch
2009-08-10 16:28         ` Greg KH
2009-08-10 20:05           ` Emilio G. Cota
2009-08-10 21:09             ` Greg KH
2009-08-11  7:04               ` Emilio G. Cota
2009-08-03 21:01   ` [patch 3/5] Staging: vme: add Universe I/II bridge driver Greg K-H
2009-08-03 23:00     ` Jiri Slaby
2009-08-03 21:01   ` [patch 4/5] Staging: vme: add Tundra TSI148 VME-PCI Bridge driver Greg K-H
2009-08-03 22:50     ` Jiri Slaby
2009-08-03 22:55       ` Jiri Slaby
2009-08-05 16:33       ` [PATCH] Staging: Correct tsi-148 VME interrupt free routine Martyn Welch
2009-08-05 16:38         ` [PATCH v2] " Martyn Welch
2009-08-05 21:53           ` Jiri Slaby
2009-08-06  7:20             ` Martyn Welch
2009-08-09  0:09     ` [patch 4/5] Staging: vme: add Tundra TSI148 VME-PCI Bridge driver Emilio G. Cota
2009-08-11 14:59       ` Martyn Welch [this message]
2009-08-03 21:01   ` [patch 5/5] Staging: vme: add TODO file Greg K-H
2009-08-04  7:56   ` [patch 0/5] [ANNOUNCE] VME Bus drivers and framework for Linux Martyn Welch
2009-08-08 22:25   ` Emilio G. Cota

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A818756.3070406@gefanuc.com \
    --to=martyn.welch@gefanuc.com \
    --cc=cota@braap.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sebastien.dugue@bull.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox