Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9197f90 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents e2aed8df 6bb697b6
Loading
Loading
Loading
Loading
+14 −44
Original line number Diff line number Diff line
@@ -36,8 +36,7 @@ cost.
      Note: to use this function you should already have a valid rproc
      handle. There are several ways to achieve that cleanly (devres, pdata,
      the way remoteproc_rpmsg.c does this, or, if this becomes prevalent, we
      might also consider using dev_archdata for this). See also
      rproc_get_by_name() below.
      might also consider using dev_archdata for this).

  void rproc_shutdown(struct rproc *rproc)
    - Power off a remote processor (previously booted with rproc_boot()).
@@ -51,30 +50,6 @@ cost.
        which means that the @rproc handle stays valid even after
        rproc_shutdown() returns, and users can still use it with a subsequent
        rproc_boot(), if needed.
      - don't call rproc_shutdown() to unroll rproc_get_by_name(), exactly
        because rproc_shutdown() _does not_ decrement the refcount of @rproc.
        To decrement the refcount of @rproc, use rproc_put() (but _only_ if
        you acquired @rproc using rproc_get_by_name()).

  struct rproc *rproc_get_by_name(const char *name)
    - Find an rproc handle using the remote processor's name, and then
      boot it. If it's already powered on, then just immediately return
      (successfully). Returns the rproc handle on success, and NULL on failure.
      This function increments the remote processor's refcount, so always
      use rproc_put() to decrement it back once rproc isn't needed anymore.
      Note: currently rproc_get_by_name() and rproc_put() are not used anymore
      by the rpmsg bus and its drivers. We need to scrutinize the use cases
      that still need them, and see if we can migrate them to use the non
      name-based boot/shutdown interface.

  void rproc_put(struct rproc *rproc)
    - Decrement @rproc's power refcount and shut it down if it reaches zero
      (essentially by just calling rproc_shutdown), and then decrement @rproc's
      validity refcount too.
      After this function returns, @rproc may _not_ be used anymore, and its
      handle should be considered invalid.
      This function should be called _iff_ the @rproc handle was grabbed by
      calling rproc_get_by_name().

3. Typical usage

@@ -115,21 +90,21 @@ int dummy_rproc_example(struct rproc *my_rproc)
      This function should be used by rproc implementations during
      initialization of the remote processor.
      After creating an rproc handle using this function, and when ready,
      implementations should then call rproc_register() to complete
      implementations should then call rproc_add() to complete
      the registration of the remote processor.
      On success, the new rproc is returned, and on failure, NULL.

      Note: _never_ directly deallocate @rproc, even if it was not registered
      yet. Instead, if you just need to unroll rproc_alloc(), use rproc_free().
      yet. Instead, when you need to unroll rproc_alloc(), use rproc_put().

  void rproc_free(struct rproc *rproc)
  void rproc_put(struct rproc *rproc)
    - Free an rproc handle that was allocated by rproc_alloc.
      This function should _only_ be used if @rproc was only allocated,
      but not registered yet.
      If @rproc was already successfully registered (by calling
      rproc_register()), then use rproc_unregister() instead.
      This function essentially unrolls rproc_alloc(), by decrementing the
      rproc's refcount. It doesn't directly free rproc; that would happen
      only if there are no other references to rproc and its refcount now
      dropped to zero.

  int rproc_register(struct rproc *rproc)
  int rproc_add(struct rproc *rproc)
    - Register @rproc with the remoteproc framework, after it has been
      allocated with rproc_alloc().
      This is called by the platform-specific rproc implementation, whenever
@@ -142,20 +117,15 @@ int dummy_rproc_example(struct rproc *my_rproc)
      of registering this remote processor, additional virtio drivers might get
      probed.

  int rproc_unregister(struct rproc *rproc)
    - Unregister a remote processor, and decrement its refcount.
      If its refcount drops to zero, then @rproc will be freed. If not,
      it will be freed later once the last reference is dropped.

  int rproc_del(struct rproc *rproc)
    - Unroll rproc_add().
      This function should be called when the platform specific rproc
      implementation decides to remove the rproc device. it should
      _only_ be called if a previous invocation of rproc_register()
      _only_ be called if a previous invocation of rproc_add()
      has completed successfully.

      After rproc_unregister() returns, @rproc is _not_ valid anymore and
      it shouldn't be used. More specifically, don't call rproc_free()
      or try to directly free @rproc after rproc_unregister() returns;
      none of these are needed, and calling them is a bug.
      After rproc_del() returns, @rproc is still valid, and its
      last refcount should be decremented by calling rproc_put().

      Returns 0 on success and -EINVAL if @rproc isn't valid.

+1 −0
Original line number Diff line number Diff line
@@ -5725,6 +5725,7 @@ F: include/linux/regmap.h

REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM
M:	Ohad Ben-Cohen <ohad@wizery.com>
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc.git
S:	Maintained
F:	drivers/remoteproc/
F:	Documentation/remoteproc.txt
+1 −0
Original line number Diff line number Diff line
@@ -6,4 +6,5 @@ obj-$(CONFIG_REMOTEPROC) += remoteproc.o
remoteproc-y				:= remoteproc_core.o
remoteproc-y				+= remoteproc_debugfs.o
remoteproc-y				+= remoteproc_virtio.o
remoteproc-y				+= remoteproc_elf_loader.o
obj-$(CONFIG_OMAP_REMOTEPROC)		+= omap_remoteproc.o
+16 −10
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ static int omap_rproc_mbox_callback(struct notifier_block *this,
{
	mbox_msg_t msg = (mbox_msg_t) data;
	struct omap_rproc *oproc = container_of(this, struct omap_rproc, nb);
	struct device *dev = oproc->rproc->dev;
	struct device *dev = oproc->rproc->dev.parent;
	const char *name = oproc->rproc->name;

	dev_dbg(dev, "mbox msg: 0x%x\n", msg);
@@ -92,12 +92,13 @@ static int omap_rproc_mbox_callback(struct notifier_block *this,
static void omap_rproc_kick(struct rproc *rproc, int vqid)
{
	struct omap_rproc *oproc = rproc->priv;
	struct device *dev = rproc->dev.parent;
	int ret;

	/* send the index of the triggered virtqueue in the mailbox payload */
	ret = omap_mbox_msg_send(oproc->mbox, vqid);
	if (ret)
		dev_err(rproc->dev, "omap_mbox_msg_send failed: %d\n", ret);
		dev_err(dev, "omap_mbox_msg_send failed: %d\n", ret);
}

/*
@@ -110,7 +111,8 @@ static void omap_rproc_kick(struct rproc *rproc, int vqid)
static int omap_rproc_start(struct rproc *rproc)
{
	struct omap_rproc *oproc = rproc->priv;
	struct platform_device *pdev = to_platform_device(rproc->dev);
	struct device *dev = rproc->dev.parent;
	struct platform_device *pdev = to_platform_device(dev);
	struct omap_rproc_pdata *pdata = pdev->dev.platform_data;
	int ret;

@@ -120,7 +122,7 @@ static int omap_rproc_start(struct rproc *rproc)
	oproc->mbox = omap_mbox_get(pdata->mbox_name, &oproc->nb);
	if (IS_ERR(oproc->mbox)) {
		ret = PTR_ERR(oproc->mbox);
		dev_err(rproc->dev, "omap_mbox_get failed: %d\n", ret);
		dev_err(dev, "omap_mbox_get failed: %d\n", ret);
		return ret;
	}

@@ -133,13 +135,13 @@ static int omap_rproc_start(struct rproc *rproc)
	 */
	ret = omap_mbox_msg_send(oproc->mbox, RP_MBOX_ECHO_REQUEST);
	if (ret) {
		dev_err(rproc->dev, "omap_mbox_get failed: %d\n", ret);
		dev_err(dev, "omap_mbox_get failed: %d\n", ret);
		goto put_mbox;
	}

	ret = pdata->device_enable(pdev);
	if (ret) {
		dev_err(rproc->dev, "omap_device_enable failed: %d\n", ret);
		dev_err(dev, "omap_device_enable failed: %d\n", ret);
		goto put_mbox;
	}

@@ -153,7 +155,8 @@ static int omap_rproc_start(struct rproc *rproc)
/* power off the remote processor */
static int omap_rproc_stop(struct rproc *rproc)
{
	struct platform_device *pdev = to_platform_device(rproc->dev);
	struct device *dev = rproc->dev.parent;
	struct platform_device *pdev = to_platform_device(dev);
	struct omap_rproc_pdata *pdata = pdev->dev.platform_data;
	struct omap_rproc *oproc = rproc->priv;
	int ret;
@@ -196,14 +199,14 @@ static int __devinit omap_rproc_probe(struct platform_device *pdev)

	platform_set_drvdata(pdev, rproc);

	ret = rproc_register(rproc);
	ret = rproc_add(rproc);
	if (ret)
		goto free_rproc;

	return 0;

free_rproc:
	rproc_free(rproc);
	rproc_put(rproc);
	return ret;
}

@@ -211,7 +214,10 @@ static int __devexit omap_rproc_remove(struct platform_device *pdev)
{
	struct rproc *rproc = platform_get_drvdata(pdev);

	return rproc_unregister(rproc);
	rproc_del(rproc);
	rproc_put(rproc);

	return 0;
}

static struct platform_driver omap_rproc_driver = {
+189 −537

File changed.

Preview size limit exceeded, changes collapsed.

Loading