[PATCH 2/2] drm/i915/gvt: Expose opregion in vgpu open

Zhenyu Wang zhenyuw at linux.intel.com
Thu Feb 1 02:33:10 UTC 2018


On 2018.02.01 00:21:05 +0000, Zhang, Tina wrote:
> > On 2018.01.31 14:42:45 +0800, Tina Zhang wrote:
> > > Opregion, fully virtualized by device model, is needed by hypervisors
> > > for display. That's why the emulated opregion is created and destroyed
> > > in MPT interface. For different hypervisors, this piece of memory
> > > might be wrapped into different interfaces. E.g. for KVM/VFIO, it is
> > > wrapped into a VFIO region during vGPU opening.
> > >
> > > This patch puts the opregion registration in vgpu_open for KVM/VFIO.
> > >
> > > Signed-off-by: Tina Zhang <tina.zhang at intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/gvt/hypercall.h |  1 -
> > >  drivers/gpu/drm/i915/gvt/kvmgt.c     |  3 ++-
> > >  drivers/gpu/drm/i915/gvt/mpt.h       | 15 ---------------
> > >  drivers/gpu/drm/i915/gvt/vgpu.c      |  4 ----
> > >  4 files changed, 2 insertions(+), 21 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/gvt/hypercall.h
> > > b/drivers/gpu/drm/i915/gvt/hypercall.h
> > > index f8e77e1..5544b27 100644
> > > --- a/drivers/gpu/drm/i915/gvt/hypercall.h
> > > +++ b/drivers/gpu/drm/i915/gvt/hypercall.h
> > > @@ -55,7 +55,6 @@ struct intel_gvt_mpt {
> > >  			      unsigned long mfn, unsigned int nr, bool map);
> > >  	int (*set_trap_area)(unsigned long handle, u64 start, u64 end,
> > >  			     bool map);
> > > -	int (*set_opregion)(void *vgpu);
> > >  	int (*get_vfio_device)(void *vgpu);
> > >  	void (*put_vfio_device)(void *vgpu);
> > >  	bool (*is_valid_gfn)(unsigned long handle, unsigned long gfn); diff
> > > --git a/drivers/gpu/drm/i915/gvt/kvmgt.c
> > > b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > > index 70f03e9..df1d44f 100644
> > > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> > > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > > @@ -550,6 +550,8 @@ static int intel_vgpu_open(struct mdev_device
> > *mdev)
> > >  	if (ret)
> > >  		goto undo_group;
> > >
> > > +	kvmgt_set_opregion(vgpu);
> > > +
> > 
> > Require error return check and fail back.
> I thought about it when writing this patch. "kvmgt_set_opregion" could return "ENOMEM" when system has few available memory.
> But it is only critical to dma-buf usage. Other usage can totally ignore this error.
> So, how about printing some error message here?
> 

You need really good reason to still allow vgpu open success for
opregion fail, as user won't be notified if enabling opregion in qemu
but found out it doesn't work, that's bad. So just fail back
gracefully like previous did.

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20180201/29830bbd/attachment.sig>


More information about the intel-gvt-dev mailing list