drm/i915/gvt: remove the unused sreg

Submitted by Zhao, Yan Y on March 8, 2019, 7:12 a.m.

Details

Message ID 20190308071220.20202-1-yan.y.zhao@intel.com
State New
Headers show
Series "drm/i915/gvt: remove the unused sreg" ( rev: 1 ) in Intel GVT devel

Not browsing as part of any series.

Commit Message

Zhao, Yan Y March 8, 2019, 7:12 a.m.
code cleanup. sreg is not used now. remove it for code cleanness.

Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
---
 drivers/gpu/drm/i915/gvt/gvt.h      | 5 -----
 drivers/gpu/drm/i915/gvt/handlers.c | 5 +----
 drivers/gpu/drm/i915/gvt/mmio.c     | 6 +-----
 3 files changed, 2 insertions(+), 14 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
index ef710e259726..a4fd979b3dad 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.h
+++ b/drivers/gpu/drm/i915/gvt/gvt.h
@@ -94,7 +94,6 @@  struct intel_vgpu_fence {
 
 struct intel_vgpu_mmio {
 	void *vreg;
-	void *sreg;
 };
 
 #define INTEL_GVT_MAX_BAR_NUM 4
@@ -447,10 +446,6 @@  void intel_vgpu_write_fence(struct intel_vgpu *vgpu,
 	(*(u64 *)(vgpu->mmio.vreg + i915_mmio_reg_offset(reg)))
 #define vgpu_vreg64(vgpu, offset) \
 	(*(u64 *)(vgpu->mmio.vreg + (offset)))
-#define vgpu_sreg_t(vgpu, reg) \
-	(*(u32 *)(vgpu->mmio.sreg + i915_mmio_reg_offset(reg)))
-#define vgpu_sreg(vgpu, offset) \
-	(*(u32 *)(vgpu->mmio.sreg + (offset)))
 
 #define for_each_active_vgpu(gvt, vgpu, id) \
 	idr_for_each_entry((&(gvt)->vgpu_idr), (vgpu), (id)) \
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
index b5c0ac04925f..54bd0b033298 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -3489,12 +3489,11 @@  int intel_vgpu_mmio_reg_rw(struct intel_vgpu *vgpu, unsigned int offset,
 		return mmio_info->read(vgpu, offset, pdata, bytes);
 	else {
 		u64 ro_mask = mmio_info->ro_mask;
-		u32 old_vreg = 0, old_sreg = 0;
+		u32 old_vreg = 0;
 		u64 data = 0;
 
 		if (intel_gvt_mmio_has_mode_mask(gvt, mmio_info->offset)) {
 			old_vreg = vgpu_vreg(vgpu, offset);
-			old_sreg = vgpu_sreg(vgpu, offset);
 		}
 
 		if (likely(!ro_mask))
@@ -3516,8 +3515,6 @@  int intel_vgpu_mmio_reg_rw(struct intel_vgpu *vgpu, unsigned int offset,
 
 			vgpu_vreg(vgpu, offset) = (old_vreg & ~mask)
 					| (vgpu_vreg(vgpu, offset) & mask);
-			vgpu_sreg(vgpu, offset) = (old_sreg & ~mask)
-					| (vgpu_sreg(vgpu, offset) & mask);
 		}
 	}
 
diff --git a/drivers/gpu/drm/i915/gvt/mmio.c b/drivers/gpu/drm/i915/gvt/mmio.c
index ed4df2f6d60b..271accd68651 100644
--- a/drivers/gpu/drm/i915/gvt/mmio.c
+++ b/drivers/gpu/drm/i915/gvt/mmio.c
@@ -239,7 +239,6 @@  void intel_vgpu_reset_mmio(struct intel_vgpu *vgpu, bool dmlr)
 
 	if (dmlr) {
 		memcpy(vgpu->mmio.vreg, mmio, info->mmio_size);
-		memcpy(vgpu->mmio.sreg, mmio, info->mmio_size);
 
 		vgpu_vreg_t(vgpu, GEN6_GT_THREAD_STATUS_REG) = 0;
 
@@ -280,7 +279,6 @@  void intel_vgpu_reset_mmio(struct intel_vgpu *vgpu, bool dmlr)
 		 * touched
 		 */
 		memcpy(vgpu->mmio.vreg, mmio, GVT_GEN8_MMIO_RESET_OFFSET);
-		memcpy(vgpu->mmio.sreg, mmio, GVT_GEN8_MMIO_RESET_OFFSET);
 	}
 
 }
@@ -300,8 +298,6 @@  int intel_vgpu_init_mmio(struct intel_vgpu *vgpu)
 	if (!vgpu->mmio.vreg)
 		return -ENOMEM;
 
-	vgpu->mmio.sreg = vgpu->mmio.vreg + info->mmio_size;
-
 	intel_vgpu_reset_mmio(vgpu, true);
 
 	return 0;
@@ -315,5 +311,5 @@  int intel_vgpu_init_mmio(struct intel_vgpu *vgpu)
 void intel_vgpu_clean_mmio(struct intel_vgpu *vgpu)
 {
 	vfree(vgpu->mmio.vreg);
-	vgpu->mmio.vreg = vgpu->mmio.sreg = NULL;
+	vgpu->mmio.vreg = NULL;
 }

Comments

> -----Original Message-----

> From: intel-gvt-dev [mailto:intel-gvt-dev-bounces@lists.freedesktop.org] On

> Behalf Of Yan Zhao

> Sent: Friday, March 8, 2019 3:12 PM

> To: intel-gvt-dev@lists.freedesktop.org

> Cc: Zhao, Yan Y <yan.y.zhao@intel.com>

> Subject: [PATCH] drm/i915/gvt: remove the unused sreg

> 

> code cleanup. sreg is not used now. remove it for code cleanness.

> 

> Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>

> ---

>  drivers/gpu/drm/i915/gvt/gvt.h      | 5 -----

>  drivers/gpu/drm/i915/gvt/handlers.c | 5 +----

>  drivers/gpu/drm/i915/gvt/mmio.c     | 6 +-----

>  3 files changed, 2 insertions(+), 14 deletions(-)

> 

> diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h

> index ef710e259726..a4fd979b3dad 100644

> --- a/drivers/gpu/drm/i915/gvt/gvt.h

> +++ b/drivers/gpu/drm/i915/gvt/gvt.h

> @@ -94,7 +94,6 @@ struct intel_vgpu_fence {

> 

>  struct intel_vgpu_mmio {

>  	void *vreg;

> -	void *sreg;

>  };

> 

>  #define INTEL_GVT_MAX_BAR_NUM 4

> @@ -447,10 +446,6 @@ void intel_vgpu_write_fence(struct intel_vgpu

> *vgpu,

>  	(*(u64 *)(vgpu->mmio.vreg + i915_mmio_reg_offset(reg)))

>  #define vgpu_vreg64(vgpu, offset) \

>  	(*(u64 *)(vgpu->mmio.vreg + (offset)))

> -#define vgpu_sreg_t(vgpu, reg) \

> -	(*(u32 *)(vgpu->mmio.sreg + i915_mmio_reg_offset(reg)))

> -#define vgpu_sreg(vgpu, offset) \

> -	(*(u32 *)(vgpu->mmio.sreg + (offset)))

> 

>  #define for_each_active_vgpu(gvt, vgpu, id) \

>  	idr_for_each_entry((&(gvt)->vgpu_idr), (vgpu), (id)) \

> diff --git a/drivers/gpu/drm/i915/gvt/handlers.c

> b/drivers/gpu/drm/i915/gvt/handlers.c

> index b5c0ac04925f..54bd0b033298 100644

> --- a/drivers/gpu/drm/i915/gvt/handlers.c

> +++ b/drivers/gpu/drm/i915/gvt/handlers.c

> @@ -3489,12 +3489,11 @@ int intel_vgpu_mmio_reg_rw(struct intel_vgpu

> *vgpu, unsigned int offset,

>  		return mmio_info->read(vgpu, offset, pdata, bytes);

>  	else {

>  		u64 ro_mask = mmio_info->ro_mask;

> -		u32 old_vreg = 0, old_sreg = 0;

> +		u32 old_vreg = 0;

>  		u64 data = 0;

> 

>  		if (intel_gvt_mmio_has_mode_mask(gvt, mmio_info->offset))

> {

>  			old_vreg = vgpu_vreg(vgpu, offset);

> -			old_sreg = vgpu_sreg(vgpu, offset);

>  		}

> 

>  		if (likely(!ro_mask))

> @@ -3516,8 +3515,6 @@ int intel_vgpu_mmio_reg_rw(struct intel_vgpu

> *vgpu, unsigned int offset,

> 

>  			vgpu_vreg(vgpu, offset) = (old_vreg & ~mask)

>  					| (vgpu_vreg(vgpu, offset) & mask);

> -			vgpu_sreg(vgpu, offset) = (old_sreg & ~mask)

> -					| (vgpu_sreg(vgpu, offset) & mask);

>  		}

>  	}

> 

> diff --git a/drivers/gpu/drm/i915/gvt/mmio.c

> b/drivers/gpu/drm/i915/gvt/mmio.c

> index ed4df2f6d60b..271accd68651 100644

> --- a/drivers/gpu/drm/i915/gvt/mmio.c

> +++ b/drivers/gpu/drm/i915/gvt/mmio.c

> @@ -239,7 +239,6 @@ void intel_vgpu_reset_mmio(struct intel_vgpu *vgpu,

> bool dmlr)

> 

>  	if (dmlr) {

>  		memcpy(vgpu->mmio.vreg, mmio, info->mmio_size);

> -		memcpy(vgpu->mmio.sreg, mmio, info->mmio_size);

> 

>  		vgpu_vreg_t(vgpu, GEN6_GT_THREAD_STATUS_REG) = 0;

> 

> @@ -280,7 +279,6 @@ void intel_vgpu_reset_mmio(struct intel_vgpu *vgpu,

> bool dmlr)

>  		 * touched

>  		 */

>  		memcpy(vgpu->mmio.vreg, mmio,

> GVT_GEN8_MMIO_RESET_OFFSET);

> -		memcpy(vgpu->mmio.sreg, mmio,

> GVT_GEN8_MMIO_RESET_OFFSET);

>  	}

> 

>  }

> @@ -300,8 +298,6 @@ int intel_vgpu_init_mmio(struct intel_vgpu *vgpu)

vgpu->mmio.vreg = vzalloc(array_size(info->mmio_size, 2)); 
You can reduce the size of allocation here if sreg is removed.

>  	if (!vgpu->mmio.vreg)

>  		return -ENOMEM;

> 

> -	vgpu->mmio.sreg = vgpu->mmio.vreg + info->mmio_size;

> -

>  	intel_vgpu_reset_mmio(vgpu, true);

> 

>  	return 0;

> @@ -315,5 +311,5 @@ int intel_vgpu_init_mmio(struct intel_vgpu *vgpu)

>  void intel_vgpu_clean_mmio(struct intel_vgpu *vgpu)

>  {

>  	vfree(vgpu->mmio.vreg);

> -	vgpu->mmio.vreg = vgpu->mmio.sreg = NULL;

> +	vgpu->mmio.vreg = NULL;

>  }

> --

> 2.17.1

> 

> _______________________________________________

> intel-gvt-dev mailing list

> intel-gvt-dev@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
Right, just about to patch that :)
thanks

> -----Original Message-----

> From: He, Min

> Sent: Friday, March 8, 2019 3:23 PM

> To: Zhao, Yan Y <yan.y.zhao@intel.com>; intel-gvt-dev@lists.freedesktop.org

> Cc: Zhao, Yan Y <yan.y.zhao@intel.com>

> Subject: RE: [PATCH] drm/i915/gvt: remove the unused sreg

> 

> 

> 

> > -----Original Message-----

> > From: intel-gvt-dev

> > [mailto:intel-gvt-dev-bounces@lists.freedesktop.org] On Behalf Of Yan

> > Zhao

> > Sent: Friday, March 8, 2019 3:12 PM

> > To: intel-gvt-dev@lists.freedesktop.org

> > Cc: Zhao, Yan Y <yan.y.zhao@intel.com>

> > Subject: [PATCH] drm/i915/gvt: remove the unused sreg

> >

> > code cleanup. sreg is not used now. remove it for code cleanness.

> >

> > Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>

> > ---

> >  drivers/gpu/drm/i915/gvt/gvt.h      | 5 -----

> >  drivers/gpu/drm/i915/gvt/handlers.c | 5 +----

> >  drivers/gpu/drm/i915/gvt/mmio.c     | 6 +-----

> >  3 files changed, 2 insertions(+), 14 deletions(-)

> >

> > diff --git a/drivers/gpu/drm/i915/gvt/gvt.h

> > b/drivers/gpu/drm/i915/gvt/gvt.h index ef710e259726..a4fd979b3dad

> > 100644

> > --- a/drivers/gpu/drm/i915/gvt/gvt.h

> > +++ b/drivers/gpu/drm/i915/gvt/gvt.h

> > @@ -94,7 +94,6 @@ struct intel_vgpu_fence {

> >

> >  struct intel_vgpu_mmio {

> >  	void *vreg;

> > -	void *sreg;

> >  };

> >

> >  #define INTEL_GVT_MAX_BAR_NUM 4

> > @@ -447,10 +446,6 @@ void intel_vgpu_write_fence(struct intel_vgpu

> > *vgpu,

> >  	(*(u64 *)(vgpu->mmio.vreg + i915_mmio_reg_offset(reg)))  #define

> > vgpu_vreg64(vgpu, offset) \

> >  	(*(u64 *)(vgpu->mmio.vreg + (offset))) -#define vgpu_sreg_t(vgpu,

> > reg) \

> > -	(*(u32 *)(vgpu->mmio.sreg + i915_mmio_reg_offset(reg)))

> > -#define vgpu_sreg(vgpu, offset) \

> > -	(*(u32 *)(vgpu->mmio.sreg + (offset)))

> >

> >  #define for_each_active_vgpu(gvt, vgpu, id) \

> >  	idr_for_each_entry((&(gvt)->vgpu_idr), (vgpu), (id)) \ diff --git

> > a/drivers/gpu/drm/i915/gvt/handlers.c

> > b/drivers/gpu/drm/i915/gvt/handlers.c

> > index b5c0ac04925f..54bd0b033298 100644

> > --- a/drivers/gpu/drm/i915/gvt/handlers.c

> > +++ b/drivers/gpu/drm/i915/gvt/handlers.c

> > @@ -3489,12 +3489,11 @@ int intel_vgpu_mmio_reg_rw(struct intel_vgpu

> > *vgpu, unsigned int offset,

> >  		return mmio_info->read(vgpu, offset, pdata, bytes);

> >  	else {

> >  		u64 ro_mask = mmio_info->ro_mask;

> > -		u32 old_vreg = 0, old_sreg = 0;

> > +		u32 old_vreg = 0;

> >  		u64 data = 0;

> >

> >  		if (intel_gvt_mmio_has_mode_mask(gvt, mmio_info->offset)) {

> >  			old_vreg = vgpu_vreg(vgpu, offset);

> > -			old_sreg = vgpu_sreg(vgpu, offset);

> >  		}

> >

> >  		if (likely(!ro_mask))

> > @@ -3516,8 +3515,6 @@ int intel_vgpu_mmio_reg_rw(struct intel_vgpu

> > *vgpu, unsigned int offset,

> >

> >  			vgpu_vreg(vgpu, offset) = (old_vreg & ~mask)

> >  					| (vgpu_vreg(vgpu, offset) & mask);

> > -			vgpu_sreg(vgpu, offset) = (old_sreg & ~mask)

> > -					| (vgpu_sreg(vgpu, offset) & mask);

> >  		}

> >  	}

> >

> > diff --git a/drivers/gpu/drm/i915/gvt/mmio.c

> > b/drivers/gpu/drm/i915/gvt/mmio.c index ed4df2f6d60b..271accd68651

> > 100644

> > --- a/drivers/gpu/drm/i915/gvt/mmio.c

> > +++ b/drivers/gpu/drm/i915/gvt/mmio.c

> > @@ -239,7 +239,6 @@ void intel_vgpu_reset_mmio(struct intel_vgpu

> > *vgpu, bool dmlr)

> >

> >  	if (dmlr) {

> >  		memcpy(vgpu->mmio.vreg, mmio, info->mmio_size);

> > -		memcpy(vgpu->mmio.sreg, mmio, info->mmio_size);

> >

> >  		vgpu_vreg_t(vgpu, GEN6_GT_THREAD_STATUS_REG) = 0;

> >

> > @@ -280,7 +279,6 @@ void intel_vgpu_reset_mmio(struct intel_vgpu

> > *vgpu, bool dmlr)

> >  		 * touched

> >  		 */

> >  		memcpy(vgpu->mmio.vreg, mmio,

> > GVT_GEN8_MMIO_RESET_OFFSET);

> > -		memcpy(vgpu->mmio.sreg, mmio,

> > GVT_GEN8_MMIO_RESET_OFFSET);

> >  	}

> >

> >  }

> > @@ -300,8 +298,6 @@ int intel_vgpu_init_mmio(struct intel_vgpu *vgpu)

> vgpu->mmio.vreg = vzalloc(array_size(info->mmio_size, 2));

> You can reduce the size of allocation here if sreg is removed.

> 

> >  	if (!vgpu->mmio.vreg)

> >  		return -ENOMEM;

> >

> > -	vgpu->mmio.sreg = vgpu->mmio.vreg + info->mmio_size;

> > -

> >  	intel_vgpu_reset_mmio(vgpu, true);

> >

> >  	return 0;

> > @@ -315,5 +311,5 @@ int intel_vgpu_init_mmio(struct intel_vgpu *vgpu)

> >  void intel_vgpu_clean_mmio(struct intel_vgpu *vgpu)

> >  {

> >  	vfree(vgpu->mmio.vreg);

> > -	vgpu->mmio.vreg = vgpu->mmio.sreg = NULL;

> > +	vgpu->mmio.vreg = NULL;

> >  }

> > --

> > 2.17.1

> >

> > _______________________________________________

> > intel-gvt-dev mailing list

> > intel-gvt-dev@lists.freedesktop.org

> > https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev