[PATCH 2/2] drm/xe: set last driver commit sha
Farah Kassabri
fkassabri at habana.ai
Wed May 8 12:09:41 UTC 2024
On 4/29/2024 14:15, Jani Nikula wrote:
> On Wed, 24 Apr 2024, Farah Kassabri <fkassabri at habana.ai> wrote:
>> This patch will set the last driver commit sha into the drm driver
>> info data structure, which will be used in the log message which
>> prints the device info at the end of the driver initialization.
>>
>> Signed-off-by: Farah Kassabri <fkassabri at habana.ai>
>> ---
>> drivers/gpu/drm/xe/Makefile | 4 ++++
>> drivers/gpu/drm/xe/xe_device.c | 1 +
>> 2 files changed, 5 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
>> index 8321ec4f9b46..acccb517b7bb 100644
>> --- a/drivers/gpu/drm/xe/Makefile
>> +++ b/drivers/gpu/drm/xe/Makefile
>> @@ -309,6 +309,10 @@ ifeq ($(CONFIG_DEBUG_FS),y)
>> i915-display/intel_pipe_crc.o
>> endif
>>
>> +GIT_SHA ?= $(shell cd $(srctree) && git rev-parse --short HEAD)
>
> There are no guarantees that the kernel is being built from a git
> checkout. Or if it is, that there are no uncommitted changes. Etc. See
> scripts/setlocalversion.
>
> IMO it's just not so simple that we could reasonably add this into a
> local Makefile.
>
This script looks good, but to my understanding it compels having a
$kERNELVERSION set (which is also not always the case), and we need to
change it to serve my purpose as well in order to have the sha in the dmesg.
if you think its better to change that script, and call it from the our
Makefile to set env variable instead i'll consider that.
BR,
Farah
> BR,
> Jani.
>
>> +DRV_CFLAGS_MODULE="-DXE_DRIVER_GIT_SHA=-$(GIT_SHA)"
>> +CFLAGS_MODULE += ${DRV_CFLAGS_MODULE}
>> +
>> obj-$(CONFIG_DRM_XE) += xe.o
>> obj-$(CONFIG_DRM_XE_KUNIT_TEST) += tests/
>>
>> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
>> index 55bbc8b8df15..2e74aa18e953 100644
>> --- a/drivers/gpu/drm/xe/xe_device.c
>> +++ b/drivers/gpu/drm/xe/xe_device.c
>> @@ -215,6 +215,7 @@ static struct drm_driver driver = {
>> .major = DRIVER_MAJOR,
>> .minor = DRIVER_MINOR,
>> .patchlevel = DRIVER_PATCHLEVEL,
>> + .git_sha = __stringify(XE_DRIVER_GIT_SHA),
>> };
>>
>> static void xe_device_destroy(struct drm_device *dev, void *dummy)
>
More information about the Intel-xe
mailing list