drm/nv50-nvc0/vm: take client reference on shared channel vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
@@ -48,6 +48,7 @@
|
|||||||
struct nouveau_fpriv {
|
struct nouveau_fpriv {
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
struct list_head channels;
|
struct list_head channels;
|
||||||
|
struct nouveau_vm *vm;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct nouveau_fpriv *
|
static inline struct nouveau_fpriv *
|
||||||
|
|||||||
@@ -767,6 +767,7 @@ static void nouveau_card_takedown(struct drm_device *dev)
|
|||||||
int
|
int
|
||||||
nouveau_open(struct drm_device *dev, struct drm_file *file_priv)
|
nouveau_open(struct drm_device *dev, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
|
struct drm_nouveau_private *dev_priv = dev->dev_private;
|
||||||
struct nouveau_fpriv *fpriv;
|
struct nouveau_fpriv *fpriv;
|
||||||
|
|
||||||
fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
|
fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
|
||||||
@@ -776,6 +777,9 @@ nouveau_open(struct drm_device *dev, struct drm_file *file_priv)
|
|||||||
spin_lock_init(&fpriv->lock);
|
spin_lock_init(&fpriv->lock);
|
||||||
INIT_LIST_HEAD(&fpriv->channels);
|
INIT_LIST_HEAD(&fpriv->channels);
|
||||||
|
|
||||||
|
if (dev_priv->card_type >= NV_50)
|
||||||
|
nouveau_vm_ref(dev_priv->chan_vm, &fpriv->vm, NULL);
|
||||||
|
|
||||||
file_priv->driver_priv = fpriv;
|
file_priv->driver_priv = fpriv;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -791,6 +795,7 @@ void
|
|||||||
nouveau_postclose(struct drm_device *dev, struct drm_file *file_priv)
|
nouveau_postclose(struct drm_device *dev, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
struct nouveau_fpriv *fpriv = nouveau_fpriv(file_priv);
|
struct nouveau_fpriv *fpriv = nouveau_fpriv(file_priv);
|
||||||
|
nouveau_vm_ref(NULL, &fpriv->vm, NULL);
|
||||||
kfree(fpriv);
|
kfree(fpriv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user