1
0
Fork 0
Commit Graph

81 Commits (c0d631570ad54a8561f5fc7023e96b5316c7fdb9)

Author SHA1 Message Date
Sjur Brændeland c0d631570a remoteproc: set vring addresses in resource table
Set the vring addresses in the resource table so that
the remote device can read the actual addresses used.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[rebase]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-07 14:06:17 +03:00
Sjur Brændeland 92b38f8514 remoteproc: support virtio config space.
Support virtio configuration space and device status. The virtio
device can now access the resource table in shared memory.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[rebase and style changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-07 14:06:17 +03:00
Ohad Ben-Cohen a2b950ac7b remoteproc: perserve resource table data
Copy resource table from first to second firmware loading.
After firmware is loaded to memory, update the vdevs resource
pointer to the resource table kept in device memory.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[rebase, terminology and style changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-07 14:06:07 +03:00
Sjur Brændeland ba7290e016 remoteproc: calculate max_notifyid by counting vrings
Simplify handling of max_notifyid by simply counting the
number of vrings.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[small terminology changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-07 14:04:25 +03:00
Sjur Brændeland 232fcdbb45 remoteproc: code cleanup of resource parsing
Combine the almost identical functions rproc_handle_virtio_rsc
and rproc_handle_boot_rsc.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[small terminology and style changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-05 08:50:07 +03:00
Sjur Brændeland e4b5141481 remoteproc: parse STE-firmware and find resource table address
Parse the STE firmware and scan the TOC-table to find the address
of the loaded resource table.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
[rebase patch; update terminology]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-05 08:50:00 +03:00
Sjur Brændeland 95f9578163 remoteproc: add find_loaded_rsc_table firmware ops
Add function find_loaded_rsc_table to firmware ops. This function
returns the location of the resource table in shared memory
after loading.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[align function name with existing terminology, update commit log]
[document new function, rebase patch, small cleanups]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-05 08:49:52 +03:00
Sjur Brændeland f665b2cd3f remoteproc: refactor rproc_elf_find_rsc_table()
Refactor rproc_elf_find_rsc_table() and split out the scanning
for the section header named resource table. This is done to
prepare for loading firmware once.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Ido Yariv <ido@wizery.com>
[small function name change to make the code easier to read]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-04-05 08:49:44 +03:00
Tejun Heo 15fc61106a remoteproc: convert to idr_alloc()
Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 19:10:18 -08:00
Tejun Heo 045dc40d9e remoteproc: don't use idr_remove_all()
idr_destroy() can destroy idr by itself and idr_remove_all() is being
deprecated.  Drop its usage.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 19:10:13 -08:00
Linus Torvalds 3c834b6f41 All trivial, thanks to the stuff which didn't quite make it time.
Cheers,
 Rusty.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJRLEkHAAoJENkgDmzRrbjx6K0P/3o9/iW5hkOPYpu+KV2nr0wG
 6RG0uu0DCOb/tckigYwnn5PkS7UEcJu6kDypnEgXfhcNhYiBjoGIAUEQ2jBYyzQm
 IYc4oZhxDdqigJL/FHi2zL50mkWacTdBK83udxim3eRkgW9ysBRoBFwqMruVyhZv
 474KGS4PNT8pHDOCAlrRS1I9oW2pYTuUidN+SnfVJ8gFSkH0tuHEGoJeGrtDa010
 XkiWqiTJq6pDHTM5f4Wwp/WNQ21UNDBlvRahg0nqTZXicQsvujV0Tdb+EnAfXwa+
 bssqvO4X2WqlraVK1TJteufhcdhUgt/I1+45p9eLZvOXizk7EBKxFWynE7C878GV
 dhpz8i4mc+u6aJlGoHzwvKah0zhwDtqWdbDS+LNQjRmjMK9v45ttoisU+iR1GjLt
 JpDVg73K315aWJ9RLsYu7mvZ8JY+qRFkwXqX3lZd+GdohY0DSmGMxMqJG93sLBYi
 42vyHMaBd1JY0rDVqpfzlmjnSxX+k05uB0GYB3fO0CXbPxmfXtRKz7/5wpSz0Up+
 nTCs6Xa7t5jtG9qpC4cKxyEDEwB9M6SSxi+lhrIBkeDqlFwXAv1Fean4jqqhtFwr
 HO6i1mYgy0xCVY7EmequVyWlH6/B5GVB2xTMQuAz3f8pKm+XUr6C/twROYkgoXbV
 AOVyRWtnbISDVjtVFn9c
 =KcDx
 -----END PGP SIGNATURE-----

Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull virtio updates from Rusty Russell:
 "All trivial, thanks to the stuff which didn't quite make it time"

* tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  virtio_console: Initialize guest_connected=true for rproc_serial
  virtio: use module_virtio_driver.
  virtio: Add module driver macro for virtio drivers.
  virtio_console: Use virtio device index to generate port name
  virtio: make pci_device_id const
  virtio: make config_ops const
  virtio-mmio: fix wrong comment about register offset
  virtio_console: Let unconnected rproc device receive data.
2013-02-26 14:49:12 -08:00
Linus Torvalds 3298a3511f arm-soc: multiplatform support
Converting more ARM platforms to multiplatform support. This time, OMAP
 gets converted, which is a major step since this is by far the largest
 platform in terms of code size. The same thing happens to the vt8500
 platform.
 
 Conflicts include:
 * Two mach/uncompress.h files are removed, the changes made to them
   elsewhere can be discarded now.
 * Moving the OMAP4 irq_match array has context clashes with turning
   omap4_sar_ram_init into an omap_early_initcall()
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIVAwUAUSUyOmCrR//JCVInAQI2zRAAnDUA3ufvANykRxNIII67D0u8XAgokzx6
 hwq0ywwcQknd2aetN1khs2rY3sQ+T73CcsFzOR448YHjbWg1RCZlCzL89uUH6SdR
 Bir/NC2jYkB1vSVB7krWhZzpeHNsFfWW1bCzwJzJfNmAZp64js3sOR1kRKjMpA2z
 RGLktrFQ1JRKF/az+xnIsrleSnS2cQguPKIs5hYxPztzN/HdvbD7ZST0ttW7wqzg
 C2AA5dnWs+C++pNXyfKlN+nL1CnyLWGXbuZUejUvAxYxgtyd/gC4/aTfNi8S9RNh
 eiFTmVwl8lsWqPWx7yzyHk+p19x7ypfBgydLU/z4yC3asUJoN5jyCF6GSqzetHJB
 jpDqTp3lQzIlJPgLryq07Xe38vUeVIKvV4e8ySOsSBlKr6aRl5684HJSCAZR9SFa
 qzHavusA5JZJKf+94UbDCPNzSqzMQYnILA039M8ekvrMZhFG89St0+NLDaxVQfO/
 OrTEnwth/TJBKvOUPIuamjZzHH/RiGkumWiKrEGKOlpwHPGtdglQeziJFo8pNkwR
 hjtnwn4RPPK8FIl59fERFI1hRvhUlwuhYcA2R/WTjcZw2d+jwZPzhhun37dLMVlw
 fk5lhz0GBaRUmua4xFqJTkpOwHf2l/9wbzhEpmL4c/ZSrtjYwfeL/tY6aT9e8MZK
 INaMr7X2QTw=
 =nl4h
 -----END PGP SIGNATURE-----

Merge tag 'multiplatform' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC multiplatform support from Arnd Bergmann:
 "Converting more ARM platforms to multiplatform support.  This time,
  OMAP gets converted, which is a major step since this is by far the
  largest platform in terms of code size.  The same thing happens to the
  vt8500 platform."

* tag 'multiplatform' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
  net: cwdavinci_cpdma: export symbols for cpsw
  remoteproc: omap: depend on OMAP_MBOX_FWK
  [media] davinci: do not include mach/hardware.h
  ARM: OMAP2+: Make sure files with omap initcalls include soc.h
  ARM: OMAP2+: Include soc.h to drm.c to fix compiling
  ARM: OMAP2+: Fix warning for hwspinlock omap_postcore_initcall
  ARM: multi_v7_defconfig: add ARCH_ZYNQ
  ARM: multi_v7_defconfig: remove unnecessary CONFIG_GPIOLIB
  arm: vt8500: Remove remaining mach includes
  arm: vt8500: Convert debug-macro.S to be multiplatform friendly
  arm: vt8500: Remove single platform Kconfig options
  ARM: OMAP2+: Remove now obsolete uncompress.h and debug-macro.S
  ARM: OMAP2+: Add minimal support for booting vexpress
  ARM: OMAP2+: Enable ARCH_MULTIPLATFORM support
  ARM: OMAP2+: Disable code that currently does not work with multiplaform
  ARM: OMAP2+: Add multiplatform debug_ll support
  ARM: OMAP: Fix dmaengine init for multiplatform
  ARM: OMAP: Fix i2c cmdline initcall for multiplatform
  ARM: OMAP2+: Use omap initcalls
  ARM: OMAP2+: Limit omap initcalls to omap only on multiplatform kernels
2013-02-21 15:20:41 -08:00
Arnd Bergmann 0bef6c933f remoteproc: omap: depend on OMAP_MBOX_FWK
Patch a62a6e98 "ARM: OMAP2+: Disable code that currently does not work
with multiplaform" makes the OMAP_MBOX_FWK option depend on !MULTIPLATFORM,
which means we cannot simply select that symbol from OMAP_REMOTEPROC.

Turning the 'select' into 'depends on' ensures that all dependencies
are correct until OMAP_MBOX_FWK loses its dependency.

Without this patch, building allmodconfig results in:

drivers/remoteproc/omap_remoteproc.c:31:26: fatal error: plat/mailbox.h: No such file or directory

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-02-15 13:16:11 +01:00
Stephen Hemminger 9350393239 virtio: make config_ops const
It is just a table of function pointers, make it const for cleanliness and security
reasons.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-02-11 15:32:17 +10:30
Kees Cook eb367cb620 drivers/remoteproc: remove depends on CONFIG_EXPERIMENTAL
The CONFIG_EXPERIMENTAL config item has not carried much meaning for a
while now and is almost always enabled by default. As agreed during the
Linux kernel summit, remove it from any "depends on" lines in Kconfigs.

CC: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-21 14:52:44 -08:00
Greg Kroah-Hartman 0fe763c570 Drivers: misc: remove __dev* attributes.
CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-03 15:57:16 -08:00
Linus Torvalds a2013a13e6 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial branch from Jiri Kosina:
 "Usual stuff -- comment/printk typo fixes, documentation updates, dead
  code elimination."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
  HOWTO: fix double words typo
  x86 mtrr: fix comment typo in mtrr_bp_init
  propagate name change to comments in kernel source
  doc: Update the name of profiling based on sysfs
  treewide: Fix typos in various drivers
  treewide: Fix typos in various Kconfig
  wireless: mwifiex: Fix typo in wireless/mwifiex driver
  messages: i2o: Fix typo in messages/i2o
  scripts/kernel-doc: check that non-void fcts describe their return value
  Kernel-doc: Convention: Use a "Return" section to describe return values
  radeon: Fix typo and copy/paste error in comments
  doc: Remove unnecessary declarations from Documentation/accounting/getdelays.c
  various: Fix spelling of "asynchronous" in comments.
  Fix misspellings of "whether" in comments.
  eisa: Fix spelling of "asynchronous".
  various: Fix spelling of "registered" in comments.
  doc: fix quite a few typos within Documentation
  target: iscsi: fix comment typos in target/iscsi drivers
  treewide: fix typo of "suport" in various comments and Kconfig
  treewide: fix typo of "suppport" in various comments
  ...
2012-12-13 12:00:02 -08:00
Masanari Iida 9c7682075e treewide: Fix typos in various drivers
Fix typos in printk within various drivers.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-12-03 11:05:04 +01:00
Ohad Ben-Cohen dab55bbafd remoteproc: fix error path of ->find_vqs
Eliminate an erroneous invocation of rproc_shutdown inside
the error path of rproc_virtio_find_vqs.

Reported-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-11-29 10:05:09 +02:00
Linus Torvalds dc92b1f9ab Merge branch 'virtio-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull virtio changes from Rusty Russell:
 "New workflow: same git trees pulled by linux-next get sent straight to
  Linus.  Git is awkward at shuffling patches compared with quilt or mq,
  but that doesn't happen often once things get into my -next branch."

* 'virtio-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (24 commits)
  lguest: fix occasional crash in example launcher.
  virtio-blk: Disable callback in virtblk_done()
  virtio_mmio: Don't attempt to create empty virtqueues
  virtio_mmio: fix off by one error allocating queue
  drivers/virtio/virtio_pci.c: fix error return code
  virtio: don't crash when device is buggy
  virtio: remove CONFIG_VIRTIO_RING
  virtio: add help to CONFIG_VIRTIO option.
  virtio: support reserved vqs
  virtio: introduce an API to set affinity for a virtqueue
  virtio-ring: move queue_index to vring_virtqueue
  virtio_balloon: not EXPERIMENTAL any more.
  virtio-balloon: dependency fix
  virtio-blk: fix NULL checking in virtblk_alloc_req()
  virtio-blk: Add REQ_FLUSH and REQ_FUA support to bio path
  virtio-blk: Add bio-based IO path for virtio-blk
  virtio: console: fix error handling in init() function
  tools: Fix pthread flag for Makefile of trace-agent used by virtio-trace
  tools: Add guest trace agent as a user tool
  virtio/console: Allocate scatterlist according to the current pipe size
  ...
2012-10-07 21:04:56 +09:00
Linus Torvalds 4d6d367232 - Remoteproc Recovery - by Fernando Guzman Lugo - when a remote processor
crash is detected, this mechanism will remove all virtio children
   devices, wait until their drivers let go, hard reset the remote
   processor and reload the firmware (resulting in the relevant virtio
   children devices re-added). Essentially the entire software stack
   is reset, together with the relevant hardware, so users don't have
   to reset the entire phone.
 - STE Modem driver is added - by Sjur Brændeland
 - OMAP DSP boot address support is added - by Juan Gutierrez
 - A handful of fixes/cleanups - Sjur Brændeland, Dan Carpenter, Emil Goode
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJQbU3JAAoJELLolMlTRIoMJn4QANjLHhYw/BdfMF9E2DRQe0ew
 HFD/siXpQKXMwJ+xDCP9RfGm88tHdn8l/q6NFCOL/hr6TywnY3RrYfijL7O8qQOQ
 coIMaigOwWr9b55YBGD17ahNDsPGFdfAblWVyJBPfFf/kgVYb2NBNgTCMbGisqrK
 g83t85ULZeGXeWHZxCOxGEQ1cai4HXpsPOGRxDQFeZKU7qM2fVbY+3zeQIymdZ7v
 dByifhkwexjqD3n4n2TYRKQo1nC6dSBIaoF5rhRfdKk7L4rmf5J5oII66iRYIuDD
 vCPblfnrLjd6nwOp/fKqEQlno8uDV8Ryjx90YyWp+IpLJO9RbQko3TDwojgjN6e/
 Edg+08nmck1mfE3qKNROCmwK3Dr3j/MOkqwKfS3l7U6VMsBebwdk5me4RBTexSiH
 QZzFK3Q2q5K9U+GPOgb3uBI8dHfW4/Q2rkIcM9fGEuSRUzRBPO7OwCU85KTEQxxy
 PxhAYvXWzJM4lk8dUqCq0+z0Wj35RolEK/TsrwSKL/D8NxgFEgRSkAVR0TlFihEy
 VOqtuGQ30OqAHByggfbtJyYVC67BIeFJPMACxKL5682cJRiZ4wCRXwMmtged/K0p
 2BI3Gmz7j22mrTV2ziixNIX7fT6FoTO5KSmbJGJwbHWgctDHHFcWqSmcia6MxWzY
 GxJkH+jEd3qos08kcWaZ
 =cpBc
 -----END PGP SIGNATURE-----

Merge tag 'remoteproc-for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc

Pull remoteproc update from Ohad Ben-Cohen:

 - Remoteproc Recovery - by Fernando Guzman Lugo

   When a remote processor crash is detected, this mechanism will remove
   all virtio children devices, wait until their drivers let go, hard
   reset the remote processor and reload the firmware (resulting in the
   relevant virtio children devices re-added).  Essentially the entire
   software stack is reset, together with the relevant hardware, so
   users don't have to reset the entire phone.

 - STE Modem driver is added - by Sjur Brændeland

 - OMAP DSP boot address support is added - by Juan Gutierrez

 - A handful of fixes/cleanups - Sjur Brændeland, Dan Carpenter, Emil
   Goode

* tag 'remoteproc-for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc:
  remoteproc: Fix use of format specifyer
  remoteproc: fix a potential NULL-dereference on cleanup
  remoteproc: select VIRTIO to avoid build breakage
  remoteproc: return -EFAULT on copy_from_user failure
  remoteproc: snprintf() can return more than was printed
  remoteproc: Add STE modem driver
  remtoteproc: maintain max notifyid
  remoteproc: create a 'recovery' debugfs entry
  remoteproc: add actual recovery implementation
  remoteproc: add rproc_report_crash function to notify rproc crashes
  remoteproc: Add dependency to HAS_DMA
  remoteproc/omap: set bootaddr support
2012-10-04 09:11:57 -07:00
Emil Goode d09f53a735 remoteproc: Fix use of format specifyer
The dma_addr_t type can be either u32 or u64 depending on
the configuration. We should use a format specifyer for the
larger type and explicitly cast to it.

Sparse warnings:
drivers/remoteproc/remoteproc_core.c:234:2: warning:
	format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 6 has type ‘dma_addr_t’ [-Wformat]

drivers/remoteproc/remoteproc_core.c:596:2: warning:
	format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 5 has type ‘dma_addr_t’ [-Wformat]

drivers/remoteproc/remoteproc_core.c:634:3:
	warning: format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 5 has type ‘dma_addr_t’ [-Wformat]

Signed-off-by: Emil Goode <emilgoode@gmail.com>
[fix commit log typos]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-10-02 10:14:43 +02:00
Dan Carpenter 7168d914a7 remoteproc: fix a potential NULL-dereference on cleanup
We only need to allocate mapping if there is an IOMMU domain.

Otherwise, when the mappings are released, the assumption that
an IOMMU domain is there will crash and burn.

CC: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
[ohad: revise commit log]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-10-02 09:57:28 +02:00
Ohad Ben-Cohen 2ed6d29c72 remoteproc: select VIRTIO to avoid build breakage
drivers/built-in.o: In function `rproc_virtio_finalize_features':
remoteproc_virtio.c:(.text+0x2f9a02): undefined reference to `vring_transport_features'
drivers/built-in.o: In function `rproc_virtio_del_vqs':
remoteproc_virtio.c:(.text+0x2f9a74): undefined reference to `vring_del_virtqueue'
drivers/built-in.o: In function `rproc_virtio_find_vqs':
remoteproc_virtio.c:(.text+0x2f9c44): undefined reference to `vring_new_virtqueue'
drivers/built-in.o: In function `rproc_add_virtio_dev':
(.text+0x2f9e2c): undefined reference to `register_virtio_device'
drivers/built-in.o: In function `rproc_vq_interrupt':
(.text+0x2f9db7): undefined reference to `vring_interrupt'
drivers/built-in.o: In function `rproc_remove_virtio_dev':
(.text+0x2f9e9f): undefined reference to `unregister_virtio_device'

Cc: stable@vger.kernel.org
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-10-02 09:57:14 +02:00
Dan Carpenter bec109a430 remoteproc: return -EFAULT on copy_from_user failure
copy_from_user() returns the number of bytes remaining to be copied, but
we want to return an error code here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-30 11:44:53 +02:00
Dan Carpenter ae768d5fac remoteproc: snprintf() can return more than was printed
snprintf() returns the number of characters which would have been
printed if there were enough space.  For example, on the first print if
we fill up the 28 character string then it would return a number more
than 30.  Use scnprintf() instead because that returns the actual number
of characters printed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-30 11:41:48 +02:00
Michael S. Tsirkin 6457f126c8 virtio: support reserved vqs
virtio network device multiqueue support reserves
vq 3 for future use (useful both for future extensions and to make it
pretty - this way receive vqs have even and transmit - odd numbers).
Make it possible to skip initialization for
specific vq numbers by specifying NULL for name.
Document this usage as well as (existing) NULL callback.

Drivers using this not coded up yet, so I simply tested
with virtio-pci and verified that this patch does
not break existing drivers.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-09-28 15:05:15 +09:30
Jason Wang 17bb6d4088 virtio-ring: move queue_index to vring_virtqueue
Instead of storing the queue index in transport-specific virtio structs,
this patch moves them to vring_virtqueue and introduces an helper to get
the value.  This lets drivers simplify their management and tracing of
virtqueues.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-09-28 15:05:15 +09:30
Sjur Brændeland ec4d02d918 remoteproc: Add STE modem driver
Add support for the STE modem shared memory driver.
This driver hooks into the remoteproc framework
in order to manage configuration and the virtio
devices.

This driver adds custom firmware handlers, because
STE modem uses a custom firmware layout.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
cc: Linus Walleij <linus.walleij@linaro.org>
cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
[ohad: validate mdev->ops, move setup() to probe/remove, trivial style changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-22 16:35:13 +03:00
Arnd Bergmann 2203747c97 ARM: omap: move platform_data definitions
Platform data for device drivers should be defined in
include/linux/platform_data/*.h, not in the architecture
and platform specific directories.

This moves such data out of the omap include directories

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Cc: Kevin Hilman <khilman@ti.com>
Cc: "Benoît Cousson" <b-cousson@ti.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Omar Ramirez Luna <omar.ramirez@ti.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Jarkko Nikula <jarkko.nikula@bitmer.com>
Cc: Liam Girdwood <lrg@ti.com>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: Jean Pihet <j-pihet@ti.com>
Cc: J Keerthy <j-keerthy@ti.com>
Cc: linux-omap@vger.kernel.org
2012-09-19 17:39:52 +02:00
Sjur Brændeland 099a3f33c8 remtoteproc: maintain max notifyid
Some of the rproc drivers (STE modem specifically) needs to know
the range of the notification IDs used for notifying the device.

Maintain a variable in struct rproc holding the largest allocated
notification id, so low-level rproc drivers could access it.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
[ohad: rebase, slightly edit commit log]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-18 21:55:52 +03:00
Fernando Guzman Lugo 2e37abb89a remoteproc: create a 'recovery' debugfs entry
Add a 'recovery' debugfs entry to dynamically disable/enable recovery
at runtime. This is useful when one is trying to debug an rproc crash;
without it, a recovery will immediately take place, making it harder
to debug the crash.

Contributions from Subramaniam Chanderashekarapuram.

Examples:

- disabling recovery:
$ echo disabled > <debugfs>/remoteproc/remoteproc0/recovery

- in case you want to recover a crash, but keep recovery disabled
  (useful in debugging sessions when you expect additional crashes
   you want to debug):
$ echo recover > <debugfs>/remoteproc/remoteproc0/recovery

- enabling recovery:
$ echo enabled > <debugfs>/remoteproc/remoteproc0/recovery

Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
[ohad: some white space, commentary and commit log changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-18 12:53:41 +03:00
Fernando Guzman Lugo 70b85ef83c remoteproc: add actual recovery implementation
Add rproc_trigger_recovery() which takes care of the recovery itself,
by removing, and re-adding, all of the remoteproc's virtio devices.

This resets all virtio users of the remote processor, during which
the remote processor is powered off and on again.

Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
[ohad: introduce rproc_add_virtio_devices to avoid 1.copying code 2.anomaly]
[ohad: some white space, naming and commit log changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-18 12:53:33 +03:00
Fernando Guzman Lugo 8afd519c34 remoteproc: add rproc_report_crash function to notify rproc crashes
Allow low-level remoteproc drivers to report rproc crashes by exporting
a new rproc_report_crash() function (invoking this from non-rproc drivers
is probably wrong, and should be carefully scrutinized if ever needed).

rproc_report_crash() can be called from any context; it offloads the
tasks of handling the crash to a separate thread.

Handling the crash from a separate thread is helpful because:
- Ability to call invoke rproc_report_crash() from atomic context, due to
  the fact that many crashes trigger an interrupt, so this function can be
  called directly from ISR context.
- Avoiding deadlocks which could happen if rproc_report_crash() is called
  from a function which indirectly holds the rproc lock.

Handling the crash might involve:
- Remoteproc register dump
- Remoteproc stack dump
- Remoteproc core dump
- Saving Remoteproc traces so they can be read after the crash
- Reseting the remoteproc in order to make it functional again (hard recovery)

Right now, we only print the crash type which was detected, and only the
mmufault type is supported. Remoteproc low-level drivers can add more types
when needed.

Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
[ohad: some commentary, white space and commit log changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-18 12:53:22 +03:00
Sjur Brændeland a1a7e0a33a remoteproc: Add dependency to HAS_DMA
Remoteproc relies on HAS_DMA, add this dependency in Kconfig.

Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-18 07:05:06 +03:00
Juan Gutierrez 4980f465d2 remoteproc/omap: set bootaddr support
Some remote processors (like OMAP4's DSP) require we explicitly
set a boot address from which they'd start executing code when
taken out of reset.

Support for this is now being added to the omap-specific remoteproc
driver through a set_bootaddr function in the platform data which,
if needed, must be set according to the backend remote processor.

For OMAP4's dsp we can use the following control function:

  .set_bootaddr  = omap_ctrl_write_dsp_boot_addr

Signed-off-by: Juan Gutierrez <jgutierrez@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
[ohad: slight changes to the commit log]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-09-11 15:24:14 +03:00
Linus Torvalds a9197f903f A batch of remoteproc patches for 3.6:
- custom binary format support from Sjur Brændeland
 - groundwork for recovery and runtime pm support
 - some cleanups and API simplifications
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJQD75aAAoJELLolMlTRIoMM84P/RfnGhFl/mzKmDssFtwkajIb
 HRrZ1/YWjAjnSOvD5FF+LrS4TtxPgx9747I1Xh49Uk7DHb6siNTDUNbFJNifWo7g
 TbKo3LgLllfNXnwbunIfiGqOW2HzaCVo6vhk59fL3QAsdtCDlROegt1NbOrV8T2S
 +XZlgYhhUSlIQQCgsRBVJWbwP4k5PtAYmwL1VN7ONgj2ILJDP7MhAasDMl+KeGSG
 128g+aCoIkfc9vC+ghDNAfE6DsHHeVyXAWPoWHoyjiteZ1NDkGxUBdTbsrtMYM2K
 ZguEISfVNcMSk10HhoYWtqYZfZUTEM18kOt/182CEwpRVRE34Z7fhcQCiCGX6u6v
 E+7tNj/0qow+dcj2OtS3NEePIHKcuvjBQ09b6GED+qsmC8lENo2Ly364T6JfriNl
 tv1PShvmodrBlLFusAikJKuzYFI9xgQawpL3oV0pMrEiujHqgNhuqrCQJkIWnA8d
 9At2RZAMdFBFa7gd90lPicVqPR9HcGipVk7bKRyFAoqmpPLI85Nm1r9l4TPqEXpC
 Otb373gX30yqWNRD9Hmmxx/+40S2odELEDN4wrPRF+cCAbmWtFey415gdoaqBESn
 BiTRrHxNy2+dKsCgSUQMyn59rF552qrCb31REYAyMMImpftAaWP35OREFNn6oqj2
 vzxsc4wcWZaLflrqQGj6
 =vBgg
 -----END PGP SIGNATURE-----

Merge tag 'remoteproc-for-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc

Pull remoteproc update from Ohad Ben-Cohen:
 - custom binary format support from Sjur Brændeland
 - groundwork for recovery and runtime pm support
 - some cleanups and API simplifications

Fix up conflicts in drivers/remoteproc/remoteproc_core.c due to clashes
with earlier cleanups by Sjur Brændeland (with part of the cleanups
moved into the new remoteproc_elf_loader.c file).

* tag 'remoteproc-for-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc:
  MAINTAINERS: add remoteproc's git
  remoteproc: Support custom firmware handlers
  remoteproc: Move Elf related functions to separate file
  remoteproc: Add function rproc_get_boot_addr
  remoteproc: Pass struct fw to load_segments and find_rsc_table.
  remoteproc: adopt the driver core's alloc/add/del/put naming
  remoteproc: remove the get_by_name/put API
  remoteproc: support non-iommu carveout assignment
  remoteproc: simplify unregister/free interfaces
  remoteproc: remove the now-redundant kref
  remoteproc: maintain a generic child device for each rproc
  remoteproc: allocate vrings on demand, free when not needed
2012-07-26 16:19:08 -07:00
Sjur Brændeland 4afc89d66c remoteproc: Support custom firmware handlers
Firmware handling is made customizable.
This is done by creating a separate ops structure for the
firmware functions that depends on a particular firmware
format (such as ELF). The ELF functions are default used
unless the HW driver explicitly injects another firmware
handler by updating rproc->fw_ops.
The function rproc_da_to_va() is exported, as custom
firmware handlers may need to use this function.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
[ohad: namespace fixes, whitespace fixes, style fixes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-15 11:39:01 +03:00
Sjur Brændeland 72854fb042 remoteproc: Move Elf related functions to separate file
Prepare for introduction of custom firmware loaders by
moving all ELF related handling into a separate file.

The functions: rproc_find_rsc_table(), rproc_fw_sanity_check(),
rproc_find_rsc_table() and rproc_get_boot_addr() are moved
to the new file remoteproc_elf_loader.c. The function
rproc_da_to_va() is made non-static and is declared in
remoteproc_internal.h

No functional changes are introduced in this patch.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
[ohad: rebase, fix kerneldoc, put prototypes in remoteproc_internal.h]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-15 11:25:27 +03:00
Sjur Brændeland 3e5f9eb5d9 remoteproc: Add function rproc_get_boot_addr
Prepare for introduction of custom firmware loaders by
moving the function operating on ELF data-structures into
separate functions. Move lookup of the boot_addr in the
ELF binary to the function rproc_get_boot_addr().

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
[rproc_get_boot_addr's kerneldoc: add missing @rproc line]
[rproc_get_boot_addr's kerneldoc: minor style changes]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-15 11:14:45 +03:00
Sjur Brændeland bd48498487 remoteproc: Pass struct fw to load_segments and find_rsc_table.
Prepare for introduction of custom firmware loaders by changing
the functions rproc_find_rcs_table() and rproc_load_segments()
to use struct firmware as parameter.

When the custom loader framework is introduced all calls into
the firmware specific function must use struct firmware as
parameter.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-15 11:14:26 +03:00
Ohad Ben-Cohen 160e7c840f remoteproc: adopt the driver core's alloc/add/del/put naming
To make remoteproc's API more intuitive for developers, we adopt
the driver core's naming, i.e. alloc -> add -> del -> put. We'll also
add register/unregister when their first user shows up.

Otherwise - there's no functional change here.

Suggested by Russell King <linux@arm.linux.org.uk>.

Cc: Russell King <linux@arm.linux.org.uk>
Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Cc: Sjur Brændeland <sjur.brandeland@stericsson.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:27 +03:00
Ohad Ben-Cohen 40e575b1d0 remoteproc: remove the get_by_name/put API
Remove rproc_get_by_name() and rproc_put(), and the associated
remoteproc infrastructure that supports it (i.e. klist and friends),
because:

1. No one uses them
2. Using them is highly discouraged, and any potential user
   will be deeply scrutinized and encouraged to move.

If a user, that absolutely can't live with the direct boot/shutdown
model, does show up one day, then bringing this functionality back
is going to be trivial.

At this point though, keeping this functionality around is way too
much of a maintenance burden.

Cc: Sjur Brændeland <sjur.brandeland@stericsson.com>
Cc: Loic Pallardy <loic.pallardy@stericsson.com>
Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Cc: Mark Grosen <mgrosen@ti.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:27 +03:00
Ohad Ben-Cohen 0e49b72c8c remoteproc: support non-iommu carveout assignment
Publish carveout addresses on non-iommu setups too.

Reported-and-acked-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:26 +03:00
Ohad Ben-Cohen c6b5a27628 remoteproc: simplify unregister/free interfaces
Simplify the unregister/free interfaces, and make them easier
to understand and use, by moving to a symmetric and consistent
alloc() -> register() -> unregister() -> free() flow.

To create and register an rproc instance, one needed to invoke
rproc_alloc() followed by rproc_register().

To unregister and free an rproc instance, one now needs to invoke
rproc_unregister() followed by rproc_free().

Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:25 +03:00
Ohad Ben-Cohen 7183a2a799 remoteproc: remove the now-redundant kref
Now that every rproc instance contains a device, we don't need a
kref anymore to maintain the refcount of the rproc instances:
that's what device are good with!

This patch removes the now-redundant kref, and switches to
{get, put}_device instead of kref_{get, put}.

We also don't need the kref's release function anymore, and instead,
we just utilize the class's release handler (which is now responsible
for all memory de-allocations).

Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:25 +03:00
Ohad Ben-Cohen b5ab5e24e9 remoteproc: maintain a generic child device for each rproc
For each registered rproc, maintain a generic remoteproc device whose
parent is the low level platform-specific device (commonly a pdev, but
it may certainly be any other type of device too).

With this in hand, the resulting device hierarchy might then look like:

omap-rproc.0
 |
 - remoteproc0  <---- new !
    |
    - virtio0
    |
    - virtio1
       |
       - rpmsg0
       |
       - rpmsg1
       |
       - rpmsg2

Where:
- omap-rproc.0 is the low level device that's bound to the
  driver which invokes rproc_register()
- remoteproc0 is the result of this patch, and will be added by the
  remoteproc framework when rproc_register() is invoked
- virtio0 and virtio1 are vdevs that are registered by remoteproc
  when it realizes that they are supported by the firmware
  of the physical remote processor represented by omap-rproc.0
- rpmsg0, rpmsg1 and rpmsg2 are rpmsg devices that represent rpmsg
  channels, and are registerd by the rpmsg bus when it gets notified
  about their existence

Technically, this patch:
- changes 'struct rproc' to contain this generic remoteproc.x device
- creates a new "remoteproc" type, to which this new generic remoteproc.x
  device belong to.
- adds a super simple enumeration method for the indices of the
  remoteproc.x devices
- updates all dev_* messaging to use the generic remoteproc.x device
  instead of the low level platform-specific device
- updates all dma_* allocations to use the parent of remoteproc.x (where
  the platform-specific memory pools, most commonly CMA, are to be found)

Adding this generic device has several merits:
- we can now add remoteproc runtime PM support simply by hooking onto the
  new "remoteproc" type
- all remoteproc log messages will now carry a common name prefix
  instead of having a platform-specific one
- having a device as part of the rproc struct makes it possible to simplify
  refcounting (see subsequent patch)

Thanks to Stephen Boyd <sboyd@codeaurora.org> for suggesting and
discussing these ideas in one of the remoteproc review threads and
to Fernando Guzman Lugo <fernando.lugo@ti.com> for trying them out
with the (upcoming) runtime PM support for remoteproc.

Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-06 00:53:03 +03:00
Ohad Ben-Cohen 6db20ea8d8 remoteproc: allocate vrings on demand, free when not needed
Dynamically allocate the vrings' DMA when the remote processor
is about to be powered on (i.e. when ->find_vqs() is invoked),
and release them as soon as it is powered off (i.e. when ->del_vqs()
is invoked).

The obvious and immediate benefit is better memory utilization, since
memory for the vrings is now only allocated when the relevant remote
processor is used.

Additionally, this approach also makes recovery of a (crashing)
remote processor easier: one just needs to remove the relevant
vdevs, and the entire vrings cleanup takes place automagically.

Tested-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-04 13:27:04 +03:00
Ohad Ben-Cohen e121aefa7d remoteproc: fix missing CONFIG_FW_LOADER configurations
Remoteproc requires user space firmware loading support, so
let's select FW_LOADER explicitly to avoid painful misconfigurations
(which only show up in runtime).

Cc: stable <stable@vger.kernel.org>
Reported-by: Mark Grosen <mgrosen@ti.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-04 11:01:12 +03:00
Ohad Ben-Cohen d50394266b remoteproc/omap: fix randconfig unmet direct dependencies
OMAP_REMOTEPROC selects REMOTEPROC and RPMSG, both of which depend
on EXPERIMENTAL, so let's have OMAP_REMOTEPROC depend on EXPERIMENTAL
too, in order to avoid the below randconfig warnings.

warning: (OMAP_REMOTEPROC) selects REMOTEPROC which has unmet direct dependencies (EXPERIMENTAL)
warning: (OMAP_REMOTEPROC) selects RPMSG which has unmet direct dependencies (EXPERIMENTAL)

Cc: stable <stable@vger.kernel.org>
Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2012-07-04 10:51:10 +03:00