From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2] ST SPEAr: PCIE gadget suppport
Date: Fri, 7 Jan 2011 23:32:16 +0100 [thread overview]
Message-ID: <201101072332.16985.arnd@arndb.de> (raw)
In-Reply-To: <137dfad4a093ea0ac80396f5eb7fbf0c382be698.1294314772.git.viresh.kumar@st.com>
On Thursday 06 January 2011, Viresh Kumar wrote:
> From: Pratyush Anand <pratyush.anand@st.com>
>
> This is a configurable gadget. can be configured by sysfs interface. Any
> IP available at PCIE bus can be programmed to be used by host
> controller.It supoorts both INTX and MSI.
> By default, gadget is configured for INTX and SYSRAM1 is mapped to BAR0
> with size 0x1000
The code looks reasonably clean, but I don't yet understand how you would
use this device for the interesting case of communicating with the host
side. I've put a lot of thought into similar hardware designs before, but
never got an implementation done myself.
Forwarding devices that don't need interrupts with your driver seems to
be the only case that will easily work, but that is also rather limited
in what you can use it for.
One concept that people have played with before is to export a virtio
channel through PCI that you can use with e.g. virtio-net or virtfs.
This is very powerful and has a lot of possible applications because
we have support for virtio drivers across a number of operating systems
and platforms already.
> Documentation/misc-devices/spear-pcie-gadget.txt | 125 ++++
> drivers/misc/Kconfig | 10 +
> drivers/misc/Makefile | 1 +
> drivers/misc/spear13xx_pcie_gadget.c | 856 ++++++++++++++++++++++
Why would you put this under drivers/misc?
I think drivers/pci/gadget/ would be a better place. I would also
recommend splitting the user interface from the hardware dependent
parts, so someone else can easily do another gadget driver for
different hardware.
> +/*wait till link is up*/
> +# cat sys/devices/platform/pcie-gadget-spear.0/link
> +wait till it returns UP.
A blocking sysfs read is not a nice interface. This is probably where
the sysfs abstraction for your hardware stops making sense.
> +To assert INTA
> +# echo 1 >> sys/devices/platform/pcie-gadget-spear.0/inta
> +
> +To de-assert INTA
> +# echo 0 >> sys/devices/platform/pcie-gadget-spear.0/inta
And this looks somewhat impractical and slow.
> +to send msi vector 2
> +# echo 2 >> sys/devices/platform/pcie-gadget-spear.0/send_msi
Using a sysfs file only for its side-effect is not very nice either.
The user interface for the interrupts looks to me like it should really
be based around a character device and either read/write/poll or
ioctl and poll. Using an eventfd might be cool here, because then you
can combine this with other devices by passing the event file to
an interface that operates on eventfd. This would e.g. make it possible
to combine a UIO device generating interrupts with a PCIe gadget
sending the interrupts somewhere else, without leaving kernel
space.
For setting up the basic parameters, sysfs (or configfs, as Greg suggested)
is a reasonable choice, so there is no need to change that.
I don't know what the rules for configfs are though, i.e. if eventfd
files or ioctls are ok or not.
Arnd
next prev parent reply other threads:[~2011-01-07 22:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-06 11:59 [PATCH V2] ST SPEAr: PCIE gadget suppport Viresh Kumar
2011-01-06 18:48 ` Greg KH
2011-01-07 8:57 ` pratyush
2011-01-07 18:32 ` Greg KH
2011-01-06 20:18 ` Andrew Morton
2011-01-07 8:54 ` pratyush
2011-01-07 22:32 ` Arnd Bergmann [this message]
2011-01-10 11:20 ` pratyush
2011-01-18 14:51 ` Arnd Bergmann
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=201101072332.16985.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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