@@ -1450,50 +1450,35 @@ static int nv_start_device(nv_state_t *nv, nvidia_stack_t *sp)
14501450 {
14511451 rc = os_alloc_mutex (& nvl -> isr_bh_unlocked_mutex );
14521452 if (rc != 0 )
1453- goto failed ;
1453+ goto failed_release_irq ;
14541454 nv_kthread_q_item_init (& nvl -> bottom_half_q_item , nvidia_isr_bh_unlocked , (void * )nv );
14551455 rc = nv_kthread_q_init (& nvl -> bottom_half_q , nv_device_name );
14561456 if (rc != 0 )
1457- goto failed ;
1457+ goto failed_release_irq ;
14581458 kthread_init = NV_TRUE ;
14591459
14601460 rc = nv_kthread_q_init (& nvl -> queue .nvk , "nv_queue" );
14611461 if (rc )
1462- goto failed ;
1462+ goto failed_release_irq ;
14631463 nv -> queue = & nvl -> queue ;
14641464
14651465 if (nv_platform_use_auto_online (nvl ))
14661466 {
14671467 rc = nv_kthread_q_init (& nvl -> remove_numa_memory_q ,
14681468 "nv_remove_numa_memory" );
14691469 if (rc )
1470- goto failed ;
1470+ goto failed_release_irq ;
14711471 remove_numa_memory_kthread_init = NV_TRUE ;
14721472 }
14731473 }
14741474
14751475 if (!rm_init_adapter (sp , nv ))
14761476 {
1477- if (!(nv -> flags & NV_FLAG_USES_MSIX ) &&
1478- !(nv -> flags & NV_FLAG_SOC_DISPLAY ))
1479- {
1480- free_irq (nv -> interrupt_line , (void * ) nvl );
1481- }
1482- else if (nv -> flags & NV_FLAG_SOC_DISPLAY )
1483- {
1484- nv_soc_free_irqs (nv );
1485- }
1486- #if defined(NV_LINUX_PCIE_MSI_SUPPORTED )
1487- else
1488- {
1489- nv_free_msix_irq (nvl );
1490- }
1491- #endif
14921477 NV_DEV_PRINTF (NV_DBG_ERRORS , nv ,
14931478 "rm_init_adapter failed, device minor number %d\n" ,
14941479 nvl -> minor_num );
14951480 rc = - EIO ;
1496- goto failed ;
1481+ goto failed_release_irq ;
14971482 }
14981483
14991484 {
@@ -1527,6 +1512,26 @@ static int nv_start_device(nv_state_t *nv, nvidia_stack_t *sp)
15271512
15281513 return 0 ;
15291514
1515+ failed_release_irq :
1516+ if (!(nv -> flags & NV_FLAG_PERSISTENT_SW_STATE ))
1517+ {
1518+ if (!(nv -> flags & NV_FLAG_USES_MSIX ) &&
1519+ !(nv -> flags & NV_FLAG_SOC_DISPLAY ))
1520+ {
1521+ free_irq (nv -> interrupt_line , (void * ) nvl );
1522+ }
1523+ else if (nv -> flags & NV_FLAG_SOC_DISPLAY )
1524+ {
1525+ nv_soc_free_irqs (nv );
1526+ }
1527+ #if defined(NV_LINUX_PCIE_MSI_SUPPORTED )
1528+ else
1529+ {
1530+ nv_free_msix_irq (nvl );
1531+ }
1532+ #endif
1533+ }
1534+
15301535failed :
15311536#if defined(NV_LINUX_PCIE_MSI_SUPPORTED )
15321537 if (nv -> flags & NV_FLAG_USES_MSI )
@@ -2452,6 +2457,7 @@ nvidia_ioctl(
24522457 if (arg_cmd == NV_ESC_WAIT_OPEN_COMPLETE )
24532458 {
24542459 nv_ioctl_wait_open_complete_t * params = arg_copy ;
2460+
24552461 params -> rc = nvlfp -> open_rc ;
24562462 params -> adapterStatus = nvlfp -> adapter_status ;
24572463 goto done_early ;
@@ -6154,8 +6160,13 @@ void NV_API_CALL nv_get_screen_info(
61546160 if (!registered_fb [i ])
61556161 continue ;
61566162
6157- /* Make sure base address is mapped to GPU BAR */
6158- if (NV_IS_CONSOLE_MAPPED (nv , registered_fb [i ]-> fix .smem_start ))
6163+ /*
6164+ * Ensure that either this is a zero-FB SOC GPU with a console in
6165+ * the system carveout, or it’s a dGPU device with console mapped
6166+ * onto its BAR.
6167+ */
6168+ if (NV_HAS_CONSOLE_IN_SYSMEM_CARVEOUT (nv ) ||
6169+ NV_IS_CONSOLE_MAPPED (nv , registered_fb [i ]-> fix .smem_start ))
61596170 {
61606171 * pPhysicalAddress = registered_fb [i ]-> fix .smem_start ;
61616172 * pFbWidth = registered_fb [i ]-> var .xres ;
@@ -6203,9 +6214,13 @@ void NV_API_CALL nv_get_screen_info(
62036214 physAddr |= (NvU64 )screen_info .ext_lfb_base << 32 ;
62046215 }
62056216#endif
6206-
6207- /* Make sure base address is mapped to GPU BAR */
6208- if (NV_IS_CONSOLE_MAPPED (nv , physAddr ))
6217+ /*
6218+ * Ensure that either this is a zero-FB SOC GPU with a console in the
6219+ * system carveout, or it’s a dGPU device with console mapped onto its
6220+ * BAR.
6221+ */
6222+ if (NV_HAS_CONSOLE_IN_SYSMEM_CARVEOUT (nv ) ||
6223+ NV_IS_CONSOLE_MAPPED (nv , physAddr ))
62096224 {
62106225 * pPhysicalAddress = physAddr ;
62116226 * pFbWidth = screen_info .lfb_width ;
@@ -6222,7 +6237,7 @@ void NV_API_CALL nv_get_screen_info(
62226237 * If screen info can't be fetched with previous methods, then try
62236238 * to get the base address and size from the memory resource tree.
62246239 */
6225- if (pci_dev != NULL )
6240+ if (( pci_dev != NULL ) && ! NV_HAS_CONSOLE_IN_SYSMEM_CARVEOUT ( nv ) )
62266241 {
62276242 BUILD_BUG_ON (NV_GPU_BAR_INDEX_IMEM != NV_GPU_BAR_INDEX_FB + 1 );
62286243 for (i = NV_GPU_BAR_INDEX_FB ; i <= NV_GPU_BAR_INDEX_IMEM ; i ++ )
0 commit comments