diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/nvhost.c | 33 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/pci.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c | 34 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv100/hal_gv100.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv100/nvlink_gv100.c | 13 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/nvhost.h | 13 |
7 files changed, 82 insertions, 43 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/nvhost.c b/drivers/gpu/nvgpu/common/linux/nvhost.c index fa169cf0..6ab60248 100644 --- a/drivers/gpu/nvgpu/common/linux/nvhost.c +++ b/drivers/gpu/nvgpu/common/linux/nvhost.c | |||
@@ -258,4 +258,37 @@ u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(u32 syncpt_id) | |||
258 | { | 258 | { |
259 | return nvhost_syncpt_unit_interface_get_byte_offset(syncpt_id); | 259 | return nvhost_syncpt_unit_interface_get_byte_offset(syncpt_id); |
260 | } | 260 | } |
261 | |||
262 | int nvgpu_nvhost_syncpt_init(struct gk20a *g) | ||
263 | { | ||
264 | int err = 0; | ||
265 | |||
266 | if (!g->has_syncpoints) | ||
267 | return -ENOSYS; | ||
268 | |||
269 | err = nvgpu_get_nvhost_dev(g); | ||
270 | if (err) { | ||
271 | nvgpu_err(g, "host1x device not available"); | ||
272 | g->has_syncpoints = false; | ||
273 | return -ENOSYS; | ||
274 | } | ||
275 | |||
276 | err = nvgpu_nvhost_syncpt_unit_interface_get_aperture( | ||
277 | g->nvhost_dev, | ||
278 | &g->syncpt_unit_base, | ||
279 | &g->syncpt_unit_size); | ||
280 | if (err) { | ||
281 | nvgpu_err(g, "Failed to get syncpt interface"); | ||
282 | g->has_syncpoints = false; | ||
283 | return -ENOSYS; | ||
284 | } | ||
285 | |||
286 | g->syncpt_size = | ||
287 | nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(1); | ||
288 | nvgpu_info(g, "syncpt_unit_base %llx syncpt_unit_size %zx size %x\n", | ||
289 | g->syncpt_unit_base, g->syncpt_unit_size, | ||
290 | g->syncpt_size); | ||
291 | |||
292 | return 0; | ||
293 | } | ||
261 | #endif | 294 | #endif |
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c index bb44efbc..3c7de4ff 100644 --- a/drivers/gpu/nvgpu/common/linux/pci.c +++ b/drivers/gpu/nvgpu/common/linux/pci.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/of_platform.h> | 20 | #include <linux/of_platform.h> |
21 | #include <linux/of_address.h> | 21 | #include <linux/of_address.h> |
22 | 22 | ||
23 | #include <nvgpu/nvhost.h> | ||
23 | #include <nvgpu/nvgpu_common.h> | 24 | #include <nvgpu/nvgpu_common.h> |
24 | #include <nvgpu/kmem.h> | 25 | #include <nvgpu/kmem.h> |
25 | #include <nvgpu/enabled.h> | 26 | #include <nvgpu/enabled.h> |
@@ -316,6 +317,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { | |||
316 | .vbios_min_version = 0x88000126, | 317 | .vbios_min_version = 0x88000126, |
317 | .hardcode_sw_threshold = false, | 318 | .hardcode_sw_threshold = false, |
318 | .run_preos = true, | 319 | .run_preos = true, |
320 | .has_syncpoints = true, | ||
319 | }, | 321 | }, |
320 | { /* SKU250 */ | 322 | { /* SKU250 */ |
321 | /* ptimer src frequency in hz */ | 323 | /* ptimer src frequency in hz */ |
@@ -350,6 +352,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { | |||
350 | .vbios_min_version = 0x1, | 352 | .vbios_min_version = 0x1, |
351 | .hardcode_sw_threshold = false, | 353 | .hardcode_sw_threshold = false, |
352 | .run_preos = true, | 354 | .run_preos = true, |
355 | .has_syncpoints = true, | ||
353 | }, | 356 | }, |
354 | { /* SKU 0x1e3f */ | 357 | { /* SKU 0x1e3f */ |
355 | /* ptimer src frequency in hz */ | 358 | /* ptimer src frequency in hz */ |
@@ -700,6 +703,17 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
700 | nvgpu_err(g, "fatal error probing nvlink, bailing out"); | 703 | nvgpu_err(g, "fatal error probing nvlink, bailing out"); |
701 | goto err_free_irq; | 704 | goto err_free_irq; |
702 | } | 705 | } |
706 | /* Enable Semaphore SHIM on nvlink only for now. */ | ||
707 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_NVLINK, false); | ||
708 | g->has_syncpoints = false; | ||
709 | } else { | ||
710 | err = nvgpu_nvhost_syncpt_init(g); | ||
711 | if (err) { | ||
712 | if (err != -ENOSYS) { | ||
713 | nvgpu_err(g, "syncpt init failed"); | ||
714 | goto err_free_irq; | ||
715 | } | ||
716 | } | ||
703 | } | 717 | } |
704 | 718 | ||
705 | g->mm.has_physical_mode = false; | 719 | g->mm.has_physical_mode = false; |
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c index 0e8e173f..f8ff57b9 100644 --- a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c +++ b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c | |||
@@ -49,37 +49,13 @@ static void gr_gv11b_remove_sysfs(struct device *dev); | |||
49 | static int gv11b_tegra_probe(struct device *dev) | 49 | static int gv11b_tegra_probe(struct device *dev) |
50 | { | 50 | { |
51 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 51 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
52 | #ifdef CONFIG_TEGRA_GK20A_NVHOST | 52 | int err; |
53 | struct gk20a *g = platform->g; | ||
54 | int err = 0; | ||
55 | |||
56 | if (g->has_syncpoints) { | ||
57 | err = nvgpu_get_nvhost_dev(g); | ||
58 | if (err) { | ||
59 | dev_err(dev, "host1x device not available"); | ||
60 | return err; | ||
61 | } | ||
62 | } | ||
63 | 53 | ||
64 | if (g->has_syncpoints) { | 54 | err = nvgpu_nvhost_syncpt_init(platform->g); |
65 | err = nvgpu_nvhost_syncpt_unit_interface_get_aperture( | 55 | if (err) { |
66 | g->nvhost_dev, | 56 | if (err != -ENOSYS) |
67 | &g->syncpt_unit_base, | 57 | return err; |
68 | &g->syncpt_unit_size); | ||
69 | if (err) { | ||
70 | dev_err(dev, "Failed to get syncpt interface"); | ||
71 | return -ENOSYS; | ||
72 | } | ||
73 | g->syncpt_size = | ||
74 | nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(1); | ||
75 | nvgpu_info(g, "syncpt_unit_base %llx " | ||
76 | "syncpt_unit_size %zx size %x\n", | ||
77 | g->syncpt_unit_base, g->syncpt_unit_size, | ||
78 | g->syncpt_size); | ||
79 | } | 58 | } |
80 | #else | ||
81 | g->has_syncpoints = false; | ||
82 | #endif | ||
83 | 59 | ||
84 | err = gk20a_tegra_init_secure_alloc(platform); | 60 | err = gk20a_tegra_init_secure_alloc(platform); |
85 | if (err) | 61 | if (err) |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 8c81b5b6..e8008937 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -182,15 +182,11 @@ int gk20a_finalize_poweron(struct gk20a *g) | |||
182 | } | 182 | } |
183 | 183 | ||
184 | if (nvgpu_is_enabled(g, NVGPU_SUPPORT_NVLINK)) { | 184 | if (nvgpu_is_enabled(g, NVGPU_SUPPORT_NVLINK)) { |
185 | if (g->ops.nvlink.init) { | 185 | err = g->ops.nvlink.init(g); |
186 | err = g->ops.nvlink.init(g); | 186 | if (err) { |
187 | if (err) { | 187 | nvgpu_err(g, "failed to init nvlink"); |
188 | nvgpu_err(g, "failed to init nvlink"); | 188 | goto done; |
189 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_NVLINK, | 189 | } |
190 | false); | ||
191 | } | ||
192 | } else | ||
193 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_NVLINK, false); | ||
194 | } | 190 | } |
195 | 191 | ||
196 | if (g->ops.fb.mem_unlock) { | 192 | if (g->ops.fb.mem_unlock) { |
diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c index 40f16ed1..99cd8731 100644 --- a/drivers/gpu/nvgpu/gv100/hal_gv100.c +++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c | |||
@@ -248,6 +248,10 @@ int gv100_init_gpu_characteristics(struct gk20a *g) | |||
248 | 248 | ||
249 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_TSG_SUBCONTEXTS, true); | 249 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_TSG_SUBCONTEXTS, true); |
250 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_GET_TEMPERATURE, true); | 250 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_GET_TEMPERATURE, true); |
251 | if (g->has_syncpoints) { | ||
252 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_SYNCPOINT_ADDRESS, true); | ||
253 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_USER_SYNCPOINT, true); | ||
254 | } | ||
251 | 255 | ||
252 | return 0; | 256 | return 0; |
253 | } | 257 | } |
diff --git a/drivers/gpu/nvgpu/gv100/nvlink_gv100.c b/drivers/gpu/nvgpu/gv100/nvlink_gv100.c index b3e25c21..776d1d66 100644 --- a/drivers/gpu/nvgpu/gv100/nvlink_gv100.c +++ b/drivers/gpu/nvgpu/gv100/nvlink_gv100.c | |||
@@ -1636,8 +1636,10 @@ int gv100_nvlink_init(struct gk20a *g) | |||
1636 | return -ENODEV; | 1636 | return -ENODEV; |
1637 | 1637 | ||
1638 | err = nvgpu_nvlink_enumerate(g); | 1638 | err = nvgpu_nvlink_enumerate(g); |
1639 | if (err) | 1639 | if (err) { |
1640 | return err; | 1640 | nvgpu_err(g, "failed to enumerate nvlink"); |
1641 | goto fail; | ||
1642 | } | ||
1641 | 1643 | ||
1642 | /* Set HSHUB and SG_PHY */ | 1644 | /* Set HSHUB and SG_PHY */ |
1643 | __nvgpu_set_enabled(g, NVGPU_MM_USE_PHYSICAL_SG, true); | 1645 | __nvgpu_set_enabled(g, NVGPU_MM_USE_PHYSICAL_SG, true); |
@@ -1645,10 +1647,15 @@ int gv100_nvlink_init(struct gk20a *g) | |||
1645 | err = g->ops.fb.enable_nvlink(g); | 1647 | err = g->ops.fb.enable_nvlink(g); |
1646 | if (err) { | 1648 | if (err) { |
1647 | nvgpu_err(g, "failed switch to nvlink sysmem"); | 1649 | nvgpu_err(g, "failed switch to nvlink sysmem"); |
1648 | return err; | 1650 | goto fail; |
1649 | } | 1651 | } |
1650 | 1652 | ||
1651 | return err; | 1653 | return err; |
1654 | |||
1655 | fail: | ||
1656 | __nvgpu_set_enabled(g, NVGPU_MM_USE_PHYSICAL_SG, false); | ||
1657 | __nvgpu_set_enabled(g, NVGPU_SUPPORT_NVLINK, false); | ||
1658 | return err; | ||
1652 | } | 1659 | } |
1653 | 1660 | ||
1654 | /* | 1661 | /* |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvhost.h b/drivers/gpu/nvgpu/include/nvgpu/nvhost.h index 13de012a..ba6012ec 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/nvhost.h +++ b/drivers/gpu/nvgpu/include/nvgpu/nvhost.h | |||
@@ -89,11 +89,20 @@ int nvgpu_nvhost_syncpt_unit_interface_get_aperture( | |||
89 | struct nvgpu_nvhost_dev *nvhost_dev, | 89 | struct nvgpu_nvhost_dev *nvhost_dev, |
90 | u64 *base, size_t *size); | 90 | u64 *base, size_t *size); |
91 | u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(u32 syncpt_id); | 91 | u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(u32 syncpt_id); |
92 | int nvgpu_nvhost_syncpt_init(struct gk20a *g); | ||
92 | #else | 93 | #else |
93 | static inline int nvgpu_nvhost_syncpt_unit_interface_get_aperture( | 94 | static inline int nvgpu_nvhost_syncpt_unit_interface_get_aperture( |
94 | struct nvgpu_nvhost_dev *nvhost_dev, | 95 | struct nvgpu_nvhost_dev *nvhost_dev, |
95 | u64 *base, size_t *size) { return -EINVAL; } | 96 | u64 *base, size_t *size) |
96 | static inline u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(u32 syncpt_id) { | 97 | { |
98 | return -EINVAL; | ||
99 | } | ||
100 | static inline u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(u32 syncpt_id) | ||
101 | { | ||
102 | return 0; | ||
103 | } | ||
104 | static inline int nvgpu_nvhost_syncpt_init(struct gk20a *g) | ||
105 | { | ||
97 | return 0; | 106 | return 0; |
98 | } | 107 | } |
99 | #endif | 108 | #endif |