[PATCH 1/2] drm/i915/gvt: Add mmio iterator intel_gvt_for_each_tracked_mmio()

Du, Changbin changbin.du at intel.com
Fri Oct 20 09:15:14 UTC 2017


On Fri, Oct 20, 2017 at 05:06:43PM +0800, Zhenyu Wang wrote:
> On 2017.10.17 10:00:40 +0800, changbin.du at intel.com wrote:
> > From: Changbin Du <changbin.du at intel.com>
> > 
> > This patch add a function intel_gvt_for_each_tracked_mmio() to
> > iterate each tracked mmio. The caller don't be aware of how the
> > tracked mmios are presented internally.
> > 
> > Signed-off-by: Changbin Du <changbin.du at intel.com>
> > ---
> >  drivers/gpu/drm/i915/gvt/firmware.c | 30 +++++++++++++++---------------
> >  drivers/gpu/drm/i915/gvt/handlers.c | 34 ++++++++++++++++++++++++++++++++++
> >  drivers/gpu/drm/i915/gvt/mmio.h     |  4 ++++
> >  3 files changed, 53 insertions(+), 15 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gvt/firmware.c b/drivers/gpu/drm/i915/gvt/firmware.c
> > index a26c170..c1e84f5 100644
> > --- a/drivers/gpu/drm/i915/gvt/firmware.c
> > +++ b/drivers/gpu/drm/i915/gvt/firmware.c
> > @@ -66,20 +66,28 @@ static struct bin_attribute firmware_attr = {
> >  	.mmap = NULL,
> >  };
> >  
> > -static int expose_firmware_sysfs(struct intel_gvt *gvt)
> > +static int mmio_snapshot_handler(struct intel_gvt *gvt, u32 offset, void *data)
> >  {
> >  	struct drm_i915_private *dev_priv = gvt->dev_priv;
> > +
> > +	*(u32 *)(data + offset) = I915_READ_NOTRACE(_MMIO(offset));
> > +	return 0;
> > +}
> > +
> > +static void snapshot_hw_mmio_registers(struct intel_gvt *gvt, void *buf)
> > +{
> > +	intel_gvt_for_each_tracked_mmio(gvt, mmio_snapshot_handler, buf);
> > +}
> 
> Might not need extra function but just use new helper below.
>
I was to make the code self-describable, but seems mmio_snapshot_handler also
help. Will update.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20171020/07b64446/attachment.sig>


More information about the intel-gvt-dev mailing list