diff options
Diffstat (limited to 'drivers/gpu/nvgpu/pci.c')
-rw-r--r-- | drivers/gpu/nvgpu/pci.c | 74 |
1 files changed, 13 insertions, 61 deletions
diff --git a/drivers/gpu/nvgpu/pci.c b/drivers/gpu/nvgpu/pci.c index cbf444ad..a67bbd54 100644 --- a/drivers/gpu/nvgpu/pci.c +++ b/drivers/gpu/nvgpu/pci.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
20 | #include "pci.h" | 20 | #include "pci.h" |
21 | #include "nvgpu_common.h" | ||
21 | #include "gk20a/gk20a.h" | 22 | #include "gk20a/gk20a.h" |
22 | #include "gk20a/platform_gk20a.h" | 23 | #include "gk20a/platform_gk20a.h" |
23 | 24 | ||
@@ -58,6 +59,8 @@ static struct gk20a_platform nvgpu_pci_device = { | |||
58 | .ch_wdt_timeout_ms = 7000, | 59 | .ch_wdt_timeout_ms = 7000, |
59 | 60 | ||
60 | .has_ce = true, | 61 | .has_ce = true, |
62 | |||
63 | .vidmem_is_vidmem = true, | ||
61 | }; | 64 | }; |
62 | 65 | ||
63 | static struct pci_device_id nvgpu_pci_table[] = { | 66 | static struct pci_device_id nvgpu_pci_table[] = { |
@@ -113,19 +116,9 @@ static int nvgpu_pci_init_support(struct pci_dev *pdev) | |||
113 | goto fail; | 116 | goto fail; |
114 | } | 117 | } |
115 | 118 | ||
116 | g->regs_saved = g->regs; | ||
117 | g->bar1_saved = g->bar1; | ||
118 | |||
119 | mutex_init(&g->dbg_sessions_lock); | ||
120 | mutex_init(&g->client_lock); | ||
121 | mutex_init(&g->ch_wdt_lock); | ||
122 | mutex_init(&g->poweroff_lock); | ||
123 | |||
124 | g->remove_support = gk20a_remove_support; | ||
125 | return 0; | 119 | return 0; |
126 | 120 | ||
127 | fail: | 121 | fail: |
128 | gk20a_remove_support(&pdev->dev); | ||
129 | return err; | 122 | return err; |
130 | } | 123 | } |
131 | 124 | ||
@@ -200,9 +193,6 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
200 | return -ENOMEM; | 193 | return -ENOMEM; |
201 | } | 194 | } |
202 | 195 | ||
203 | init_waitqueue_head(&g->sw_irq_stall_last_handled_wq); | ||
204 | init_waitqueue_head(&g->sw_irq_nonstall_last_handled_wq); | ||
205 | |||
206 | platform->g = g; | 196 | platform->g = g; |
207 | g->dev = &pdev->dev; | 197 | g->dev = &pdev->dev; |
208 | 198 | ||
@@ -215,6 +205,7 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
215 | g->irq_nonstall = pdev->irq; | 205 | g->irq_nonstall = pdev->irq; |
216 | if (g->irq_stall < 0) | 206 | if (g->irq_stall < 0) |
217 | return -ENXIO; | 207 | return -ENXIO; |
208 | |||
218 | err = devm_request_threaded_irq(&pdev->dev, | 209 | err = devm_request_threaded_irq(&pdev->dev, |
219 | g->irq_stall, | 210 | g->irq_stall, |
220 | nvgpu_pci_isr, | 211 | nvgpu_pci_isr, |
@@ -227,6 +218,10 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
227 | } | 218 | } |
228 | disable_irq(g->irq_stall); | 219 | disable_irq(g->irq_stall); |
229 | 220 | ||
221 | err = nvgpu_pci_init_support(pdev); | ||
222 | if (err) | ||
223 | return err; | ||
224 | |||
230 | if (strchr(dev_name(&pdev->dev), '%')) { | 225 | if (strchr(dev_name(&pdev->dev), '%')) { |
231 | gk20a_err(&pdev->dev, "illegal character in device name"); | 226 | gk20a_err(&pdev->dev, "illegal character in device name"); |
232 | return -EINVAL; | 227 | return -EINVAL; |
@@ -236,57 +231,12 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
236 | if (!nodefmt) | 231 | if (!nodefmt) |
237 | return -ENOMEM; | 232 | return -ENOMEM; |
238 | 233 | ||
239 | err = gk20a_user_init(&pdev->dev, nodefmt, &nvgpu_pci_class); | 234 | err = nvgpu_probe(g, "gpu_pci", nodefmt, &nvgpu_pci_class); |
240 | kfree(nodefmt); | ||
241 | nodefmt = NULL; | ||
242 | if (err) | ||
243 | return err; | ||
244 | |||
245 | err = nvgpu_pci_init_support(pdev); | ||
246 | if (err) | 235 | if (err) |
247 | return err; | 236 | return err; |
248 | 237 | ||
249 | init_rwsem(&g->busy_lock); | 238 | kfree(nodefmt); |
250 | mutex_init(&platform->railgate_lock); | 239 | nodefmt = NULL; |
251 | |||
252 | spin_lock_init(&g->mc_enable_lock); | ||
253 | |||
254 | gk20a_debug_init(&pdev->dev); | ||
255 | |||
256 | /* Initialize the platform interface. */ | ||
257 | err = platform->probe(&pdev->dev); | ||
258 | if (err) { | ||
259 | gk20a_err(&pdev->dev, "platform probe failed"); | ||
260 | return err; | ||
261 | } | ||
262 | |||
263 | /* Set DMA parameters to allow larger sgt lists */ | ||
264 | pdev->dev.dma_parms = &g->dma_parms; | ||
265 | dma_set_max_seg_size(&pdev->dev, UINT_MAX); | ||
266 | |||
267 | g->gr_idle_timeout_default = | ||
268 | CONFIG_GK20A_DEFAULT_TIMEOUT; | ||
269 | if (tegra_platform_is_silicon()) | ||
270 | g->timeouts_enabled = true; | ||
271 | |||
272 | g->runlist_interleave = true; | ||
273 | |||
274 | g->timeslice_low_priority_us = 1300; | ||
275 | g->timeslice_medium_priority_us = 2600; | ||
276 | g->timeslice_high_priority_us = 5200; | ||
277 | |||
278 | gk20a_create_sysfs(&pdev->dev); | ||
279 | |||
280 | g->mm.has_physical_mode = false; | ||
281 | g->mm.vidmem_is_vidmem = true; | ||
282 | #ifdef CONFIG_DEBUG_FS | ||
283 | g->mm.ltc_enabled = true; | ||
284 | g->mm.ltc_enabled_debug = true; | ||
285 | #endif | ||
286 | g->mm.bypass_smmu = platform->bypass_smmu; | ||
287 | g->mm.disable_bigpage = platform->disable_bigpage; | ||
288 | |||
289 | gk20a_init_gr(g); | ||
290 | 240 | ||
291 | err = nvgpu_pci_pm_init(&pdev->dev); | 241 | err = nvgpu_pci_pm_init(&pdev->dev); |
292 | if (err) { | 242 | if (err) { |
@@ -294,6 +244,8 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, | |||
294 | return err; | 244 | return err; |
295 | } | 245 | } |
296 | 246 | ||
247 | g->mm.has_physical_mode = false; | ||
248 | |||
297 | return 0; | 249 | return 0; |
298 | } | 250 | } |
299 | 251 | ||