[PATCH 2/2] drm/xe: set last driver commit sha
Jani Nikula
jani.nikula at linux.intel.com
Mon Apr 29 11:15:47 UTC 2024
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.
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)
--
Jani Nikula, Intel
More information about the Intel-xe
mailing list