diff mbox

drm: hibmc: Initialize the hibmc_bo_driver.io_mem_pfn

Message ID 20171129113324.20041-1-msrb@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michal Srb Nov. 29, 2017, 11:33 a.m. UTC
From: Michal Srb <msrb@suse.com>

The io_mem_pfn field was added in ea642c3216cb2a60d1c0e760ae47ee85c9c16447 and
is used unconditionally. Most drivers were updated to set it to the default
implementation ttm_bo_default_io_mem_pfn, but hibmc was not.

This fixes crash in ttm_bo_vm_fault when hibmc driver is used.

Signed-off-by: Michal Srb <msrb@suse.com>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Sean Paul Nov. 29, 2017, 2:47 p.m. UTC | #1
On Wed, Nov 29, 2017 at 12:33:24PM +0100, msrb@suse.com wrote:
> From: Michal Srb <msrb@suse.com>
> 
> The io_mem_pfn field was added in ea642c3216cb2a60d1c0e760ae47ee85c9c16447 and
> is used unconditionally. Most drivers were updated to set it to the default
> implementation ttm_bo_default_io_mem_pfn, but hibmc was not.
> 
> This fixes crash in ttm_bo_vm_fault when hibmc driver is used.

Instead of just doing the same cargo cult in this driver, lets just call the
default function when io_mem_pfn is NULL. Looks like 9 other drivers are
affected as well.

Sean

> 
> Signed-off-by: Michal Srb <msrb@suse.com>
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> index 3518167a7dc4..0b165ce4ee00 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> @@ -243,6 +243,7 @@ struct ttm_bo_driver hibmc_bo_driver = {
>  	.verify_access		= hibmc_bo_verify_access,
>  	.io_mem_reserve		= &hibmc_ttm_io_mem_reserve,
>  	.io_mem_free		= NULL,
> +	.io_mem_pfn		= ttm_bo_default_io_mem_pfn,
>  };
>  
>  int hibmc_mm_init(struct hibmc_drm_private *hibmc)
> -- 
> 2.13.6
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Michal Srb Nov. 29, 2017, 2:54 p.m. UTC | #2
On středa 29. listopadu 2017 15:47:30 CET Sean Paul wrote:
> On Wed, Nov 29, 2017 at 12:33:24PM +0100, msrb@suse.com wrote:
> > From: Michal Srb <msrb@suse.com>
> > 
> > The io_mem_pfn field was added in ea642c3216cb2a60d1c0e760ae47ee85c9c16447
> > and is used unconditionally. Most drivers were updated to set it to the
> > default implementation ttm_bo_default_io_mem_pfn, but hibmc was not.
> > 
> > This fixes crash in ttm_bo_vm_fault when hibmc driver is used.
> 
> Instead of just doing the same cargo cult in this driver, lets just call the
> default function when io_mem_pfn is NULL. Looks like 9 other drivers are
> affected as well.

Ok, that makes sense.

Michal
diff mbox

Patch

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
index 3518167a7dc4..0b165ce4ee00 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
@@ -243,6 +243,7 @@  struct ttm_bo_driver hibmc_bo_driver = {
 	.verify_access		= hibmc_bo_verify_access,
 	.io_mem_reserve		= &hibmc_ttm_io_mem_reserve,
 	.io_mem_free		= NULL,
+	.io_mem_pfn		= ttm_bo_default_io_mem_pfn,
 };
 
 int hibmc_mm_init(struct hibmc_drm_private *hibmc)