Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions src/asahi/lib/agx_chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,28 @@ agx_chip_driver_supported(enum agx_chip chip)
}
}

/* Measured J514M/T6034 G15C B1: four ten-slot clusters with 30 fused cores.
* Keep this separate from the existing T6031 contract. Every consumer uses
* the supplied masks; a different revision or topology needs its own evidence.
*/
static bool
agx_params_t6034_supported(const struct drm_asahi_params_global *params)
{
if (params->chip_id != 0x6034 || params->gpu_revision != 0x11 ||
params->num_cores_per_cluster != 10)
return false;

unsigned enabled = 0;
for (unsigned i = 0; i < 4; ++i) {
uint64_t mask = params->core_masks[i];
if (!mask || (mask & ~UINT64_C(0x3ff)))
return false;
for (; mask; mask &= mask - 1)
++enabled;
}
return enabled == 30;
}

bool
agx_params_driver_supported(const struct drm_asahi_params_global *params)
{
Expand Down Expand Up @@ -316,10 +338,11 @@ agx_params_driver_supported(const struct drm_asahi_params_global *params)
params->usc_generation == AGX_ISA_AGX3 &&
params->gpu_hal_generation == DRM_ASAHI_GPU_HAL_LEGACY;
case AGX_CHIP_G15C:
/* T6031/M3 Max: the same generation as T6030 with four clusters.
* Binned parts differ only in their core masks, which every consumer
* reads from the parameters, so the masks are not part of the check. */
return params->chip_id == 0x6031 && params->num_dies == 1 &&
/* T6031 and the measured 30-core T6034 use the four-cluster G15C
* contract. T6034 additionally requires its measured revision and
* fused topology; the existing T6031 admission is unchanged. */
return (params->chip_id == 0x6031 || agx_params_t6034_supported(params)) &&
params->num_dies == 1 &&
params->num_clusters_total == 4 &&
params->usc_generation == AGX_ISA_AGX3 &&
params->gpu_hal_generation == DRM_ASAHI_GPU_HAL_LEGACY;
Expand Down
2 changes: 1 addition & 1 deletion src/asahi/lib/agx_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ agx_open_device(void *memctx, struct agx_device *dev)
fprintf(stderr,
"Apple G15C kernel parameters do not match this driver "
"(chip %#x, %u dies, %u clusters, USC %u, HAL %u; expected "
"chip 0x6031, 1 die, 4 clusters, USC 3, HAL 0)\n",
"chip 0x6031 or 30-core T6034 B1, 1 die, 4 clusters, USC 3, HAL 0)\n",
dev->params.chip_id, dev->params.num_dies,
dev->params.num_clusters_total, dev->params.usc_generation,
dev->params.gpu_hal_generation);
Expand Down
33 changes: 33 additions & 0 deletions src/asahi/lib/tests/test-chip-admission.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,39 @@ main(void)
bad.num_clusters_total = 4;
assert(!agx_params_driver_supported(&bad));

/* Fresh J514M/T6034 identity: four physical clusters, 30 enabled cores. */
struct drm_asahi_params_global t6034 = g15_params('C', 0x6034, 4);
t6034.gpu_revision = 0x11;
t6034.core_masks[0] = t6034.core_masks[1] = 0x1fd;
t6034.core_masks[2] = t6034.core_masks[3] = 0x1ed;
assert(agx_params_driver_supported(&t6034));
bad = t6034; bad.chip_id = 0x6032;
assert(!agx_params_driver_supported(&bad));
bad = t6034; bad.gpu_revision = 0x12;
assert(!agx_params_driver_supported(&bad));
bad = t6034; bad.num_cores_per_cluster = 8;
assert(!agx_params_driver_supported(&bad));
bad = t6034; bad.num_clusters_total = 3;
assert(!agx_params_driver_supported(&bad));
bad = t6034; bad.num_dies = 2;
assert(!agx_params_driver_supported(&bad));
bad = t6034; bad.usc_generation = 2;
assert(!agx_params_driver_supported(&bad));
bad = t6034; bad.gpu_hal_generation = DRM_ASAHI_GPU_HAL_200;
assert(!agx_params_driver_supported(&bad));
bad = t6034; bad.core_masks[0] |= UINT64_C(1) << 10;
assert(!agx_params_driver_supported(&bad));
bad = t6034; bad.core_masks[0] = 0;
assert(!agx_params_driver_supported(&bad));
bad = t6034; bad.core_masks[0] ^= 1;
assert(!agx_params_driver_supported(&bad));
bad = t6034; bad.core_masks[0] |= 2;
assert(!agx_params_driver_supported(&bad));
assert(!agx_params_native_kernel_abi_supported(&t6034));
t6034.features = DRM_ASAHI_FEATURE_PER_COMMAND_INPUT_SYNCS |
DRM_ASAHI_FEATURE_EXACT_PRIOR_BARRIERS;
assert(agx_params_native_kernel_abi_supported(&t6034));

/* The same GPU identity must not admit the incompatible legacy payloads. */
assert(!agx_params_native_kernel_abi_supported(NULL));
assert(!agx_params_native_kernel_abi_supported(&g15s));
Expand Down
Loading