Re: [PATCH v2] drm/i915: Add stub mmio read/write routines to mock device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 12, 2017 at 10:21:43AM +0100, Chris Wilson wrote:
> Provide dummy function pointers for the mock device in case we do hit
> mmio during testing.
> 
> v2: Use ASSIGN_READ/WRITE_MMIO_FUNCS macros
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> #v1
> ---
>  drivers/gpu/drm/i915/intel_uncore.c              | 47 ++++++++++++------------
>  drivers/gpu/drm/i915/selftests/mock_gem_device.c |  2 +
>  drivers/gpu/drm/i915/selftests/mock_uncore.c     | 46 +++++++++++++++++++++++
>  drivers/gpu/drm/i915/selftests/mock_uncore.h     | 30 +++++++++++++++
>  4 files changed, 101 insertions(+), 24 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/selftests/mock_uncore.c
>  create mode 100644 drivers/gpu/drm/i915/selftests/mock_uncore.h
> 
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index fb38c7692fc2..0cd56bf00650 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -1108,19 +1108,19 @@ __gen6_write(32)
>  #undef GEN6_WRITE_FOOTER
>  #undef GEN6_WRITE_HEADER
>  
> -#define ASSIGN_WRITE_MMIO_VFUNCS(x) \
> +#define ASSIGN_WRITE_MMIO_VFUNCS(i915, x) \

Hmm, this seems to be little inconsistent with other macros:
we either use implicit "dev_priv" (like in I915_READ) or
use "dev_priv" as explicit param (like in IS_GEN).


>  do { \
> -	dev_priv->uncore.funcs.mmio_writeb = x##_write8; \
> -	dev_priv->uncore.funcs.mmio_writew = x##_write16; \
> -	dev_priv->uncore.funcs.mmio_writel = x##_write32; \
> +	(i915)->uncore.funcs.mmio_writeb = x##_write8; \
> +	(i915)->uncore.funcs.mmio_writew = x##_write16; \
> +	(i915)->uncore.funcs.mmio_writel = x##_write32; \
>  } while (0)
>  

<snip>

> +void mock_uncore_init(struct drm_i915_private *i915)
> +{
> +	ASSIGN_WRITE_MMIO_VFUNCS(i915, nop);
> +	ASSIGN_READ_MMIO_VFUNCS(i915, nop);
> +}

If you use "dev_priv" as name for the function param then
you can reuse existing ASSIGN_xxx_MMIO_VFUNC without any
change in their signature...

-Michal

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux