Message ID | 20180328012451.31479-1-emil.l.velikov@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Mar 28, 2018 at 02:24:48AM +0100, Emil Velikov wrote: > From: Deepak Sharma <deepak.sharma@amd.com> > > Modify vgem_init to take platform dev as parent in drm_dev_init. > This will make drm device available at "/sys/devices/platform/vgem" > in x86 chromebook. > > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Signed-off-by: Deepak Sharma <deepak.sharma@amd.com> > Reviewed-by: Sean Paul <seanpaul@chromium.org> > Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > --- > drivers/gpu/drm/vgem/vgem_drv.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c > index 2524ff116f00..636ce32fa945 100644 > --- a/drivers/gpu/drm/vgem/vgem_drv.c > +++ b/drivers/gpu/drm/vgem/vgem_drv.c > @@ -472,31 +472,30 @@ static int __init vgem_init(void) > if (!vgem_device) > return -ENOMEM; > > - ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL); > - if (ret) > - goto out_free; > - > vgem_device->platform = > platform_device_register_simple("vgem", -1, NULL, 0); > if (IS_ERR(vgem_device->platform)) { > ret = PTR_ERR(vgem_device->platform); > - goto out_fini; > + goto out_free; > } > > dma_coerce_mask_and_coherent(&vgem_device->platform->dev, > DMA_BIT_MASK(64)); > + ret = drm_dev_init(&vgem_device->drm, &vgem_driver, &vgem_device->platform->dev); > + if (ret) > + goto out_unregister; > > /* Final step: expose the device/driver to userspace */ > ret = drm_dev_register(&vgem_device->drm, 0); > if (ret) > - goto out_unregister; > + goto out_fini; > > return 0; > > -out_unregister: > - platform_device_unregister(vgem_device->platform); > out_fini: > drm_dev_fini(&vgem_device->drm); > +out_unregister: > + platform_device_unregister(vgem_device->platform); > out_free: > kfree(vgem_device); > return ret; > -- > 2.16.0 >
On 28 March 2018 at 08:16, Daniel Vetter <daniel@ffwll.ch> wrote: > On Wed, Mar 28, 2018 at 02:24:48AM +0100, Emil Velikov wrote: >> From: Deepak Sharma <deepak.sharma@amd.com> >> >> Modify vgem_init to take platform dev as parent in drm_dev_init. >> This will make drm device available at "/sys/devices/platform/vgem" >> in x86 chromebook. >> >> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> >> Signed-off-by: Deepak Sharma <deepak.sharma@amd.com> >> Reviewed-by: Sean Paul <seanpaul@chromium.org> >> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > Thanks Daniel. Who will merge the patches? I don't have drm-misc commit access Guessing I could apply for one(?) and while I learn the ropes, the virtio team can send a confirmation on 3/4. -Emil
Quoting Emil Velikov (2018-03-28 02:24:48) > From: Deepak Sharma <deepak.sharma@amd.com> > > Modify vgem_init to take platform dev as parent in drm_dev_init. > This will make drm device available at "/sys/devices/platform/vgem" > in x86 chromebook. > > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Signed-off-by: Deepak Sharma <deepak.sharma@amd.com> > Reviewed-by: Sean Paul <seanpaul@chromium.org> > Signed-off-by: Emil Velikov <emil.velikov@collabora.com> > --- > drivers/gpu/drm/vgem/vgem_drv.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c > index 2524ff116f00..636ce32fa945 100644 > --- a/drivers/gpu/drm/vgem/vgem_drv.c > +++ b/drivers/gpu/drm/vgem/vgem_drv.c > @@ -472,31 +472,30 @@ static int __init vgem_init(void) > if (!vgem_device) > return -ENOMEM; > > - ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL); > - if (ret) > - goto out_free; A shame to lose the test coverage this gave us. Care to replace that with a selftest? -Chris
On 28 March 2018 at 15:49, Chris Wilson <chris@chris-wilson.co.uk> wrote: > Quoting Emil Velikov (2018-03-28 02:24:48) >> From: Deepak Sharma <deepak.sharma@amd.com> >> >> Modify vgem_init to take platform dev as parent in drm_dev_init. >> This will make drm device available at "/sys/devices/platform/vgem" >> in x86 chromebook. >> >> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> >> Signed-off-by: Deepak Sharma <deepak.sharma@amd.com> >> Reviewed-by: Sean Paul <seanpaul@chromium.org> >> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> >> --- >> drivers/gpu/drm/vgem/vgem_drv.c | 15 +++++++-------- >> 1 file changed, 7 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c >> index 2524ff116f00..636ce32fa945 100644 >> --- a/drivers/gpu/drm/vgem/vgem_drv.c >> +++ b/drivers/gpu/drm/vgem/vgem_drv.c >> @@ -472,31 +472,30 @@ static int __init vgem_init(void) >> if (!vgem_device) >> return -ENOMEM; >> >> - ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL); >> - if (ret) >> - goto out_free; > > A shame to lose the test coverage this gave us. Care to replace that > with a selftest? Hi Chris, can you be more specific: - What test coverage is lost - some IGT tests/other? - Can you provide a rough outline of the test you have in mind? Thanks Emil
On Wed, Mar 28, 2018 at 04:11:39PM +0100, Emil Velikov wrote: > On 28 March 2018 at 15:49, Chris Wilson <chris@chris-wilson.co.uk> wrote: > > Quoting Emil Velikov (2018-03-28 02:24:48) > >> From: Deepak Sharma <deepak.sharma@amd.com> > >> > >> Modify vgem_init to take platform dev as parent in drm_dev_init. > >> This will make drm device available at "/sys/devices/platform/vgem" > >> in x86 chromebook. > >> > >> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > >> Signed-off-by: Deepak Sharma <deepak.sharma@amd.com> > >> Reviewed-by: Sean Paul <seanpaul@chromium.org> > >> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> > >> --- > >> drivers/gpu/drm/vgem/vgem_drv.c | 15 +++++++-------- > >> 1 file changed, 7 insertions(+), 8 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c > >> index 2524ff116f00..636ce32fa945 100644 > >> --- a/drivers/gpu/drm/vgem/vgem_drv.c > >> +++ b/drivers/gpu/drm/vgem/vgem_drv.c > >> @@ -472,31 +472,30 @@ static int __init vgem_init(void) > >> if (!vgem_device) > >> return -ENOMEM; > >> > >> - ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL); > >> - if (ret) > >> - goto out_free; > > > > A shame to lose the test coverage this gave us. Care to replace that > > with a selftest? > > Hi Chris, can you be more specific: > - What test coverage is lost - some IGT tests/other? > - Can you provide a rough outline of the test you have in mind? I think Chris meant the NULL case for drm_dev_init (which was broken once). But since this series also disallows that with a subsequent patch I think we're just fine. -Daniel
On 29 March 2018 at 08:17, Daniel Vetter <daniel@ffwll.ch> wrote: > On Wed, Mar 28, 2018 at 04:11:39PM +0100, Emil Velikov wrote: >> On 28 March 2018 at 15:49, Chris Wilson <chris@chris-wilson.co.uk> wrote: >> > Quoting Emil Velikov (2018-03-28 02:24:48) >> >> From: Deepak Sharma <deepak.sharma@amd.com> >> >> >> >> Modify vgem_init to take platform dev as parent in drm_dev_init. >> >> This will make drm device available at "/sys/devices/platform/vgem" >> >> in x86 chromebook. >> >> >> >> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> >> >> Signed-off-by: Deepak Sharma <deepak.sharma@amd.com> >> >> Reviewed-by: Sean Paul <seanpaul@chromium.org> >> >> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> >> >> --- >> >> drivers/gpu/drm/vgem/vgem_drv.c | 15 +++++++-------- >> >> 1 file changed, 7 insertions(+), 8 deletions(-) >> >> >> >> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c >> >> index 2524ff116f00..636ce32fa945 100644 >> >> --- a/drivers/gpu/drm/vgem/vgem_drv.c >> >> +++ b/drivers/gpu/drm/vgem/vgem_drv.c >> >> @@ -472,31 +472,30 @@ static int __init vgem_init(void) >> >> if (!vgem_device) >> >> return -ENOMEM; >> >> >> >> - ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL); >> >> - if (ret) >> >> - goto out_free; >> > >> > A shame to lose the test coverage this gave us. Care to replace that >> > with a selftest? >> >> Hi Chris, can you be more specific: >> - What test coverage is lost - some IGT tests/other? >> - Can you provide a rough outline of the test you have in mind? > > I think Chris meant the NULL case for drm_dev_init (which was broken > once). But since this series also disallows that with a subsequent patch I > think we're just fine. Ack. How are we going to merge the first two patches? Note: 3/4 and 4/4 are _not_ safe - will need to finish some pre-requisite work first. Thanks Emil
On Wed, Apr 04, 2018 at 11:46:30AM +0100, Emil Velikov wrote: > On 29 March 2018 at 08:17, Daniel Vetter <daniel@ffwll.ch> wrote: > > On Wed, Mar 28, 2018 at 04:11:39PM +0100, Emil Velikov wrote: > >> On 28 March 2018 at 15:49, Chris Wilson <chris@chris-wilson.co.uk> wrote: > >> > Quoting Emil Velikov (2018-03-28 02:24:48) > >> >> From: Deepak Sharma <deepak.sharma@amd.com> > >> >> > >> >> Modify vgem_init to take platform dev as parent in drm_dev_init. > >> >> This will make drm device available at "/sys/devices/platform/vgem" > >> >> in x86 chromebook. > >> >> > >> >> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > >> >> Signed-off-by: Deepak Sharma <deepak.sharma@amd.com> > >> >> Reviewed-by: Sean Paul <seanpaul@chromium.org> > >> >> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> > >> >> --- > >> >> drivers/gpu/drm/vgem/vgem_drv.c | 15 +++++++-------- > >> >> 1 file changed, 7 insertions(+), 8 deletions(-) > >> >> > >> >> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c > >> >> index 2524ff116f00..636ce32fa945 100644 > >> >> --- a/drivers/gpu/drm/vgem/vgem_drv.c > >> >> +++ b/drivers/gpu/drm/vgem/vgem_drv.c > >> >> @@ -472,31 +472,30 @@ static int __init vgem_init(void) > >> >> if (!vgem_device) > >> >> return -ENOMEM; > >> >> > >> >> - ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL); > >> >> - if (ret) > >> >> - goto out_free; > >> > > >> > A shame to lose the test coverage this gave us. Care to replace that > >> > with a selftest? > >> > >> Hi Chris, can you be more specific: > >> - What test coverage is lost - some IGT tests/other? > >> - Can you provide a rough outline of the test you have in mind? > > > > I think Chris meant the NULL case for drm_dev_init (which was broken > > once). But since this series also disallows that with a subsequent patch I > > think we're just fine. > Ack. How are we going to merge the first two patches? > > Note: 3/4 and 4/4 are _not_ safe - will need to finish some > pre-requisite work first. Oh, why are 3&4 not safe? I thought they are, that's why I smashed an r-b onto them. Wrt merging, stuff them all into drm-misc imo. -Daniel
diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 2524ff116f00..636ce32fa945 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -472,31 +472,30 @@ static int __init vgem_init(void) if (!vgem_device) return -ENOMEM; - ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL); - if (ret) - goto out_free; - vgem_device->platform = platform_device_register_simple("vgem", -1, NULL, 0); if (IS_ERR(vgem_device->platform)) { ret = PTR_ERR(vgem_device->platform); - goto out_fini; + goto out_free; } dma_coerce_mask_and_coherent(&vgem_device->platform->dev, DMA_BIT_MASK(64)); + ret = drm_dev_init(&vgem_device->drm, &vgem_driver, &vgem_device->platform->dev); + if (ret) + goto out_unregister; /* Final step: expose the device/driver to userspace */ ret = drm_dev_register(&vgem_device->drm, 0); if (ret) - goto out_unregister; + goto out_fini; return 0; -out_unregister: - platform_device_unregister(vgem_device->platform); out_fini: drm_dev_fini(&vgem_device->drm); +out_unregister: + platform_device_unregister(vgem_device->platform); out_free: kfree(vgem_device); return ret;