aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2014-05-02 05:32:34 -0400
committerBen Skeggs <bskeggs@redhat.com>2014-06-10 02:05:49 -0400
commit53d206bb4aadba255d20b70893ed5ba1d89f41e1 (patch)
tree444b591c66d865081906076161bbdbd268417557
parent4c0dae57873edb1560b738c6519361c5ecd443ae (diff)
drm/nouveau/bar: only ioremap BAR3 if it exists
Some chips that use system memory exclusively (e.g. GK20A) do not expose 2 BAR regions. For them only BAR1 exists, and it should be used for USERD mapping. Do not map BAR3 if its resource does not exist. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bar/base.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/base.c b/drivers/gpu/drm/nouveau/core/subdev/bar/base.c
index bdf594116f3f..73b1ed20c8d5 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bar/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bar/base.c
@@ -118,8 +118,10 @@ nouveau_bar_create_(struct nouveau_object *parent,
118 if (ret) 118 if (ret)
119 return ret; 119 return ret;
120 120
121 bar->iomem = ioremap(nv_device_resource_start(device, 3), 121 if (nv_device_resource_len(device, 3) != 0)
122 nv_device_resource_len(device, 3)); 122 bar->iomem = ioremap(nv_device_resource_start(device, 3),
123 nv_device_resource_len(device, 3));
124
123 return 0; 125 return 0;
124} 126}
125 127