Skip to content

Commit a9844a8

Browse files
committed
nvidia: add RmForceExternalGpu registry key
Thunderbolt 4/5 eGPU enclosures fail automatic external GPU detection because they are not in the approved TB3 bridge list and do not report the required slot capabilities (HotPlug+ and Surprise+). Add RmForceExternalGpu registry key to bypass bridge detection and unconditionally set PDB_PROP_GPU_IS_EXTERNAL_GPU, enabling proper eGPU handling throughout the driver. Usage: Global (all GPUs): NVreg_RegistryDwords="RmForceExternalGpu=1" Per-device (specific GPU only): NVreg_RegistryDwordsPerDevice="pci=DDDD:BB:DD.F;RmForceExternalGpu=1" The per-device option allows targeting specific GPUs in multi-GPU systems.
1 parent a5bfb10 commit a9844a8

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

src/nvidia/arch/nvalloc/unix/src/osinit.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,10 +1310,29 @@ RmInitNvDevice(
13101310
}
13111311

13121312
// Configure eGPU setting
1313-
if (RmCheckForExternalGpu(pGpu, pCl))
13141313
{
1315-
pGpu->setProperty(pGpu, PDB_PROP_GPU_IS_EXTERNAL_GPU, NV_TRUE);
1316-
nv->is_external_gpu = NV_TRUE;
1314+
NvU32 forceExternalGpu = 0;
1315+
NvBool isExternalGpu = NV_FALSE;
1316+
1317+
// Check if user has forced eGPU mode via RmForceExternalGpu registry key
1318+
if ((osReadRegistryDword(pGpu, NV_REG_STR_RM_FORCE_EXTERNAL_GPU, &forceExternalGpu) == NV_OK) &&
1319+
(forceExternalGpu != 0))
1320+
{
1321+
NV_PRINTF(LEVEL_NOTICE, "Forcing external GPU mode via RmForceExternalGpu registry key\n");
1322+
isExternalGpu = NV_TRUE;
1323+
}
1324+
else
1325+
{
1326+
// Otherwise, use automatic detection
1327+
isExternalGpu = RmCheckForExternalGpu(pGpu, pCl);
1328+
}
1329+
1330+
if (isExternalGpu)
1331+
{
1332+
NV_PRINTF(LEVEL_NOTICE, "GPU treated as external GPU (eGPU)\n");
1333+
pGpu->setProperty(pGpu, PDB_PROP_GPU_IS_EXTERNAL_GPU, NV_TRUE);
1334+
nv->is_external_gpu = NV_TRUE;
1335+
}
13171336
}
13181337
status->rmStatus = gpumgrStateInitGpu(pGpu);
13191338
if (status->rmStatus != NV_OK)

src/nvidia/interface/nvrm_registry.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,17 @@
10011001
// If set, this will cause RM mark GPU as lost when it detects 0xFF from register
10021002
// access.
10031003

1004+
//
1005+
// Type DWORD
1006+
// Force external GPU mode, bypassing automatic Thunderbolt bridge detection.
1007+
// Useful for Thunderbolt 4/5 enclosures not in the driver's approved bridge list.
1008+
//
1009+
// Encoding:
1010+
// 0 (default) - use automatic eGPU detection
1011+
// 1 - force GPU to be treated as external
1012+
//
1013+
#define NV_REG_STR_RM_FORCE_EXTERNAL_GPU "RmForceExternalGpu"
1014+
10041015
#define NV_REG_STR_RM_BLACKLIST_ADDRESSES "RmBlackListAddresses"
10051016
// Type BINARY:
10061017
// struct

0 commit comments

Comments
 (0)