diff options
author | Thomas Fleury <tfleury@nvidia.com> | 2018-02-20 23:39:22 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-05-07 19:03:45 -0400 |
commit | a5f3fe9506dcf87910eba24c80a4b30c03dcced1 (patch) | |
tree | 322374f40e46286ac0b98abe6e3dbce293943943 /drivers/gpu/nvgpu/common/linux | |
parent | 15ec5722be8f483f6d9c1cd0bfd61a7e2bcbfca2 (diff) |
gpu: nvgpu: gv100: enable syncpt shim for nvlink
Get host1x node reference from c1_rp device tree node, and
enable syncpoints shim in case of nvlink.
JIRA EVLR-2441
JIRA EVLR-2585
Change-Id: Idbf1edf656557f2ed2d3bd27393c2f4d5d1ad75a
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1663360
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-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 |
3 files changed, 52 insertions, 29 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) |