On Wed, Apr 10, 2024 at 11:16:11AM -0700, Nathan Chancellor wrote:
A recent change added a use of xe_wa_oob.h without adding the file that
uses it to uses_generated_oob, which means xe_wa_oob.h does not get
properly generated before attempting to build the object file:

   LINK     resolve_btfids
   CC [M]  drivers/gpu/drm/xe/xe_guc_ads.o
 drivers/gpu/drm/xe/xe_guc_ads.c:10:10: fatal error: generated/xe_wa_oob.h: No 
such file or directory
    10 | #include <generated/xe_wa_oob.h>
       |          ^~~~~~~~~~~~~~~~~~~~~~~

After adding '$(obj)/xe_guc_ads.o' to uses_generated_oob, xe_wa_oob.h is
always generated before building the file, resulting in no errors:

   LINK     resolve_btfids
   HOSTCC  drivers/gpu/drm/xe/xe_gen_wa_oob
   GEN     xe_wa_oob.c xe_wa_oob.h
   CC [M]  drivers/gpu/drm/xe/xe_guc_ads.o

Fixes: c151ff5c9053 ("drm/xe/lnl: Enable GuC Wa_14019882105")
Signed-off-by: Nathan Chancellor <nat...@kernel.org>


Reviewed-by: Lucas De Marchi <lucas.demar...@intel.com>

and pushed to drm-xe-next.

We probably need to find a way to make sure we generate it before
anything else. Maybe it'd be simpler to just do this:

        diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
        index 60c90dc918b2..f34a12e3f47d 100644
        --- a/drivers/gpu/drm/xe/Makefile
        +++ b/drivers/gpu/drm/xe/Makefile
        @@ -46,18 +46,6 @@ $(obj)/generated/%_wa_oob.c 
$(obj)/generated/%_wa_oob.h: $(obj)/xe_gen_wa_oob \
                         $(srctree)/$(src)/xe_wa_oob.rules
                $(call cmd,wa_oob)
-uses_generated_oob := \
        -       $(obj)/xe_gsc.o \
        -       $(obj)/xe_guc.o \
        -       $(obj)/xe_guc_ads.o \
        -       $(obj)/xe_migrate.o \
        -       $(obj)/xe_ring_ops.o \
        -       $(obj)/xe_vm.o \
        -       $(obj)/xe_wa.o \
        -       $(obj)/xe_ttm_stolen_mgr.o
        -
        -$(uses_generated_oob): $(generated_oob)
        -
         # Please keep these build lists sorted!
# core driver code
        @@ -322,3 +310,6 @@ quiet_cmd_hdrtest = HDRTEST $(patsubst 
%.hdrtest,%.h,$@)
$(obj)/%.hdrtest: $(src)/%.h FORCE
                $(call if_changed_dep,hdrtest)
        +
        +uses_generated_oob := $(xe-y)
        +$(uses_generated_oob): $(generated_oob)

Apparently works for me:

$ touch drivers/gpu/drm/xe/xe_wa_oob.rules
$ make O=build64 -j$(nproc)
make[1]: Entering directory '/home/lucas/p/linux-dim/drm-xe-next/build64'
  GEN     Makefile
mkdir -p /home/lucas/p/linux-dim/drm-xe-next/build64/tools/objtool && make 
O=/home/lucas/p/linux-dim/drm-xe-next/build64 subdir=tools/objtool --no-print-directory 
-C objtool
  INSTALL libsubcmd_headers
  CALL    ../scripts/checksyscalls.sh
  HOSTCC  drivers/gpu/drm/xe/xe_gen_wa_oob
  GEN     xe_wa_oob.c xe_wa_oob.h
  CC [M]  drivers/gpu/drm/xe/xe_gsc.o
  CC [M]  drivers/gpu/drm/xe/xe_guc.o
  CC [M]  drivers/gpu/drm/xe/xe_guc_ads.o
  CC [M]  drivers/gpu/drm/xe/xe_migrate.o
  CC [M]  drivers/gpu/drm/xe/xe_ring_ops.o
  CC [M]  drivers/gpu/drm/xe/xe_ttm_stolen_mgr.o
  CC [M]  drivers/gpu/drm/xe/xe_vm.o
  CC [M]  drivers/gpu/drm/xe/xe_wa.o
  LD [M]  drivers/gpu/drm/xe/xe.o
  MODPOST Module.symvers
Kernel: arch/x86/boot/bzImage is ready  (#1)
  LD [M]  drivers/gpu/drm/xe/xe.ko
make[1]: Leaving directory '/home/lucas/p/linux-dim/drm-xe-next/build64'


thanks
Lucas De Marchi

Reply via email to