aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2019-05-09 02:48:50 -0400
committerBen Skeggs <bskeggs@redhat.com>2019-05-14 02:58:06 -0400
commita2ac09a03d2a0306eb584192b2a5d6c2aeb265ad (patch)
treec89dfd693fa8e447d4a928ce2835eb54fc90d450
parenta0b694d0af21c9993d1a39a75fd814bd48bf7eb4 (diff)
drm/nouveau/core: allow detected chipset to be overridden
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/device/base.c24
2 files changed, 24 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 22cd45845e07..7c2fcaba42d6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -631,7 +631,8 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
631 /* We need to check that the chipset is supported before booting 631 /* We need to check that the chipset is supported before booting
632 * fbdev off the hardware, as there's no way to put it back. 632 * fbdev off the hardware, as there's no way to put it back.
633 */ 633 */
634 ret = nvkm_device_pci_new(pdev, NULL, "error", true, false, 0, &device); 634 ret = nvkm_device_pci_new(pdev, nouveau_config, "error",
635 true, false, 0, &device);
635 if (ret) 636 if (ret)
636 return ret; 637 return ret;
637 638
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
index 7971096b6767..159a9f83c05e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
@@ -2824,8 +2824,8 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
2824 u64 mmio_base, mmio_size; 2824 u64 mmio_base, mmio_size;
2825 u32 boot0, strap; 2825 u32 boot0, strap;
2826 void __iomem *map; 2826 void __iomem *map;
2827 int ret = -EEXIST; 2827 int ret = -EEXIST, i;
2828 int i; 2828 unsigned chipset;
2829 2829
2830 mutex_lock(&nv_devices_mutex); 2830 mutex_lock(&nv_devices_mutex);
2831 if (nvkm_device_find_locked(handle)) 2831 if (nvkm_device_find_locked(handle))
@@ -2870,6 +2870,26 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
2870 strap = ioread32_native(map + 0x101000); 2870 strap = ioread32_native(map + 0x101000);
2871 iounmap(map); 2871 iounmap(map);
2872 2872
2873 /* chipset can be overridden for devel/testing purposes */
2874 chipset = nvkm_longopt(device->cfgopt, "NvChipset", 0);
2875 if (chipset) {
2876 u32 override_boot0;
2877
2878 if (chipset >= 0x10) {
2879 override_boot0 = ((chipset & 0x1ff) << 20);
2880 override_boot0 |= 0x000000a1;
2881 } else {
2882 if (chipset != 0x04)
2883 override_boot0 = 0x20104000;
2884 else
2885 override_boot0 = 0x20004000;
2886 }
2887
2888 nvdev_warn(device, "CHIPSET OVERRIDE: %08x -> %08x\n",
2889 boot0, override_boot0);
2890 boot0 = override_boot0;
2891 }
2892
2873 /* determine chipset and derive architecture from it */ 2893 /* determine chipset and derive architecture from it */
2874 if ((boot0 & 0x1f000000) > 0) { 2894 if ((boot0 & 0x1f000000) > 0) {
2875 device->chipset = (boot0 & 0x1ff00000) >> 20; 2895 device->chipset = (boot0 & 0x1ff00000) >> 20;