diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index 6a9716af6801..9545cd2c06be 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -1299,6 +1299,26 @@ static const char *adreno_get_gpu_model(struct kgsl_device *device) return gpu_model; } +static u32 adreno_get_vk_device_id(struct kgsl_device *device) +{ + struct device_node *node; + static u32 device_id; + + if (device_id) + return device_id; + + node = adreno_get_gpu_model_node(device->pdev); + if (!node) + node = of_node_get(device->pdev->dev.of_node); + + if (of_property_read_u32(node, "qcom,vk-device-id", &device_id)) + device_id = ADRENO_DEVICE(device)->chipid; + + of_node_put(node); + + return device_id; +} + #if IS_ENABLED(CONFIG_QCOM_LLCC) static int adreno_probe_llcc(struct adreno_device *adreno_dev, struct platform_device *pdev) @@ -2470,6 +2490,8 @@ static int adreno_prop_u32(struct kgsl_device *device, val = adreno_support_64bit(adreno_dev) ? 48 : 32; else if (param->type == KGSL_PROP_SPEED_BIN) val = device->speed_bin; + else if (param->type == KGSL_PROP_VK_DEVICE_ID) + val = adreno_get_vk_device_id(device); return copy_prop(param, &val, sizeof(val)); } @@ -2494,6 +2516,7 @@ static const struct { { KGSL_PROP_SPEED_BIN, adreno_prop_u32 }, { KGSL_PROP_GAMING_BIN, adreno_prop_gaming_bin }, { KGSL_PROP_GPU_MODEL, adreno_prop_gpu_model}, + { KGSL_PROP_VK_DEVICE_ID, adreno_prop_u32}, }; static int adreno_getproperty(struct kgsl_device *device, diff --git a/include/uapi/linux/msm_kgsl.h b/include/uapi/linux/msm_kgsl.h index 671d789b983f..88de6b324991 100644 --- a/include/uapi/linux/msm_kgsl.h +++ b/include/uapi/linux/msm_kgsl.h @@ -342,6 +342,7 @@ enum kgsl_timestamp_type { #define KGSL_PROP_QUERY_CAPABILITIES 0x27 #define KGSL_PROP_CONTEXT_PROPERTY 0x28 #define KGSL_PROP_GPU_MODEL 0x29 +#define KGSL_PROP_VK_DEVICE_ID 0x2A /* * kgsl_capabilities_properties returns a list of supported properties.