All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: "Matt Roper" <matthew.d.roper@intel.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Michał Winiarski" <michal.winiarski@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH v4 19/22] drm/managed: Add drmm_release_action
Date: Wed, 29 Nov 2023 12:52:55 -0500	[thread overview]
Message-ID: <ZWd6d4qc4QsFun1z@intel.com> (raw)
In-Reply-To: <cefbc4f8-08c4-4c96-b042-a1e83d49d05c@intel.com>

On Wed, Nov 29, 2023 at 10:43:24AM +0100, Michal Wajdeczko wrote:
> 
> 
> On 29.11.2023 02:16, Michał Winiarski wrote:
> > Similar to devres equivalent, it allows to call the "release" action
> > directly and remove the resource from the managed resources list.
> > 
> > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> > ---
> >  drivers/gpu/drm/drm_managed.c | 28 ++++++++++++++++++++++++++++
> >  include/drm/drm_managed.h     |  4 ++++
> >  2 files changed, 32 insertions(+)
> 
> shouldn't this go to the dri-devel first ?

yes, please. Let's send there and try to get that quickly through drm-misc,
or the proper reviews and acks there before getting to drm-xe-next or this
might block our initial pull request.

> 
> > 
> > diff --git a/drivers/gpu/drm/drm_managed.c b/drivers/gpu/drm/drm_managed.c
> > index bcd111404b128..f819940b8a959 100644
> > --- a/drivers/gpu/drm/drm_managed.c
> > +++ b/drivers/gpu/drm/drm_managed.c
> > @@ -176,6 +176,34 @@ int __drmm_add_action_or_reset(struct drm_device *dev,
> >  }
> >  EXPORT_SYMBOL(__drmm_add_action_or_reset);
> >  
> > +void drmm_release_action(struct drm_device *dev,
> > +			 drmres_release_t action,
> > +			 void *data)
> > +{
> > +	struct drmres *dr_match = NULL, *dr;
> > +	unsigned long flags;
> > +
> > +	spin_lock_irqsave(&dev->managed.lock, flags);
> > +	list_for_each_entry_reverse(dr, &dev->managed.resources, node.entry) {
> > +		if (dr->node.release == action) {
> > +			if (!data || (data && *(void **)dr->data == data)) {
> > +				dr_match = dr;
> > +				del_dr(dev, dr_match);
> > +				break;
> > +			}
> > +		}
> > +	}
> > +	spin_unlock_irqrestore(&dev->managed.lock, flags);
> > +
> > +	if (WARN_ON(!dr_match))
> > +		return;
> > +
> > +	action(dev, data);
> > +
> > +	free_dr(dr_match);
> > +}
> > +EXPORT_SYMBOL(drmm_release_action);
> > +
> >  /**
> >   * drmm_kmalloc - &drm_device managed kmalloc()
> >   * @dev: DRM device
> > diff --git a/include/drm/drm_managed.h b/include/drm/drm_managed.h
> > index ad08f834af408..f547b09ca0239 100644
> > --- a/include/drm/drm_managed.h
> > +++ b/include/drm/drm_managed.h
> > @@ -45,6 +45,10 @@ int __must_check __drmm_add_action_or_reset(struct drm_device *dev,
> >  					    drmres_release_t action,
> >  					    void *data, const char *name);
> >  
> > +void drmm_release_action(struct drm_device *dev,
> > +			 drmres_release_t action,
> > +			 void *data);
> > +
> >  void *drmm_kmalloc(struct drm_device *dev, size_t size, gfp_t gfp) __malloc;
> >  
> >  /**

  reply	other threads:[~2023-11-29 17:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29  1:16 [Intel-xe] [PATCH v4 00/22] drm/xe: Probe tweaks and reordering Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 01/22] drm/xe: Skip calling drm_dev_put on probe error Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 02/22] drm/xe: Use managed pci_enable_device Michał Winiarski
2023-11-29 16:02   ` Matt Roper
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 03/22] drm/xe/irq: Don't call pci_free_irq_vectors Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 04/22] drm/xe: Move xe_set_dma_info outside of MMIO setup Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 05/22] drm/xe: Move xe_mmio_probe_tiles " Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 06/22] drm/xe: Split xe_info_init Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 07/22] drm/xe: Introduce xe_tile_init_early and use at earlier point in probe Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 08/22] drm/xe: Map the entire BAR0 and hold onto the initial mapping Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 09/22] drm/xe/device: Introduce xe_device_probe_early Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 10/22] drm/xe: Don't "peek" into GMD_ID Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 11/22] drm/xe: Move system memory management init to earlier point in probe Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 12/22] drm/xe: Move force_wake " Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 13/22] drm/xe: Reorder GGTT " Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 14/22] drm/xe: Add a helper for DRM device-lifetime BO create Michał Winiarski
2023-11-29  9:38   ` Michal Wajdeczko
2023-11-29 20:32     ` Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 15/22] drm/xe/uc: Split xe_uc_fw_init Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 16/22] drm/xe/uc: Store firmware binary in system-memory backed BO Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 17/22] drm/xe/uc: Extract xe_uc_sanitize_reset Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 18/22] drm/xe/guc: Split GuC params used for "hwconfig" and "post-hwconfig" Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 19/22] drm/managed: Add drmm_release_action Michał Winiarski
2023-11-29  9:43   ` Michal Wajdeczko
2023-11-29 17:52     ` Rodrigo Vivi [this message]
2023-11-29 22:17       ` Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 20/22] drm/xe/guc: Allocate GuC data structures in system memory for initial load Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 21/22] drm/xe/guc: Move GuC power control init to "post-hwconfig" Michał Winiarski
2023-11-29  1:16 ` [Intel-xe] [PATCH v4 22/22] drm/xe: Initialize GuC earlier during probe Michał Winiarski
2023-11-29 21:48   ` Welty, Brian
2023-11-29 22:20     ` Michał Winiarski
2023-11-29  4:48 ` [Intel-xe] ✗ CI.Patch_applied: failure for drm/xe: Probe tweaks and reordering (rev3) Patchwork

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=ZWd6d4qc4QsFun1z@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=michal.winiarski@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.