mbox series

[RFC,00/12] drm/msm: add support for regenerating shipped xml.h headers

Message ID 20240226-fd-xml-shipped-v1-0-86bb6c3346d2@linaro.org
Headers show
Series drm/msm: add support for regenerating shipped xml.h headers | expand

Message

Dmitry Baryshkov Feb. 26, 2024, 2:11 a.m. UTC
Currently display-related register headers are generated from XML files
shipped withing Mesa source tree. This is not fully optimal: it requires
multi-stage process of the changes first being landed to Mesa and only
then synced to the kernel tree.

Move original XML files to the kernel tree and generate header files if
required.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
Dmitry Baryshkov (12):
      kbuild: create destination directory for _shipped handling
      drm/msm/mdp5: add writeback block bases
      drm/msm/hdmi: drop qfprom.xml.h
      drm/msm/dsi: drop mmss_cc.xml.h
      drm/msm: use _shipped suffix for all xml.h files
      drm/msm/headergen: import source files from freedreno/envytools
      drm/msm/headergen: use asprintf instead of custom aprintf
      drm/msm/headergen: don't output full file paths
      drm/msm/headergen: generate _shipped files
      drm/msm: import XML registers database
      drm/msm: tie regeneration of shipped headers
      drm/msm: sync shipped headers database

 drivers/gpu/drm/msm/Makefile                       |   80 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.h           |   11 +
 drivers/gpu/drm/msm/disp/mdp_common.xml.h          |  111 --
 drivers/gpu/drm/msm/dsi/mmss_cc.xml.h              |  131 --
 drivers/gpu/drm/msm/dsi/sfpb.xml.h                 |   70 -
 drivers/gpu/drm/msm/hdmi/qfprom.xml.h              |   61 -
 drivers/gpu/drm/msm/headergen2/colors.c            |   61 +
 drivers/gpu/drm/msm/headergen2/colors.h            |   49 +
 drivers/gpu/drm/msm/headergen2/headergen2.c        |  514 ++++++++
 drivers/gpu/drm/msm/headergen2/path.c              |   64 +
 drivers/gpu/drm/msm/headergen2/rnn.c               | 1363 ++++++++++++++++++++
 drivers/gpu/drm/msm/headergen2/rnn.h               |  243 ++++
 drivers/gpu/drm/msm/headergen2/rnndec.c            |  550 ++++++++
 drivers/gpu/drm/msm/headergen2/rnndec.h            |   59 +
 drivers/gpu/drm/msm/headergen2/util.h              |  113 ++
 drivers/gpu/drm/msm/headergen2/util/u_debug.h      |   12 +
 drivers/gpu/drm/msm/registers/.gitignore           |    5 +
 .../{dsi/dsi.xml.h => registers/dsi.xml.h_shipped} |   38 +-
 .../dsi_phy_10nm.xml.h_shipped}                    |   37 +-
 .../dsi_phy_14nm.xml.h_shipped}                    |   37 +-
 .../dsi_phy_20nm.xml.h_shipped}                    |   37 +-
 .../dsi_phy_28nm.xml.h_shipped}                    |   37 +-
 .../dsi_phy_28nm_8960.xml.h_shipped}               |   37 +-
 .../dsi_phy_7nm.xml.h_shipped}                     |   37 +-
 .../hdmi.xml.h => registers/hdmi.xml.h_shipped}    |  111 +-
 .../mdp4.xml.h => registers/mdp4.xml.h_shipped}    |   37 +-
 .../mdp5.xml.h => registers/mdp5.xml.h_shipped}    |   39 +-
 .../gpu/drm/msm/registers/mdp_common.xml.h_shipped |  114 ++
 drivers/gpu/drm/msm/registers/sfpb.xml.h_shipped   |   67 +
 drivers/gpu/drm/msm/registers/xml/dsi.xml          |  390 ++++++
 drivers/gpu/drm/msm/registers/xml/dsi_phy_10nm.xml |  102 ++
 drivers/gpu/drm/msm/registers/xml/dsi_phy_14nm.xml |  135 ++
 drivers/gpu/drm/msm/registers/xml/dsi_phy_20nm.xml |  100 ++
 drivers/gpu/drm/msm/registers/xml/dsi_phy_28nm.xml |  180 +++
 .../drm/msm/registers/xml/dsi_phy_28nm_8960.xml    |  134 ++
 drivers/gpu/drm/msm/registers/xml/dsi_phy_7nm.xml  |  230 ++++
 drivers/gpu/drm/msm/registers/xml/edp.xml          |  239 ++++
 .../drm/msm/registers/xml/freedreno_copyright.xml  |   40 +
 drivers/gpu/drm/msm/registers/xml/hdmi.xml         | 1015 +++++++++++++++
 drivers/gpu/drm/msm/registers/xml/mdp4.xml         |  480 +++++++
 drivers/gpu/drm/msm/registers/xml/mdp5.xml         |  806 ++++++++++++
 drivers/gpu/drm/msm/registers/xml/mdp_common.xml   |   89 ++
 drivers/gpu/drm/msm/registers/xml/mmss_cc.xml      |   48 +
 drivers/gpu/drm/msm/registers/xml/msm.xml          |   32 +
 drivers/gpu/drm/msm/registers/xml/rules-ng.xsd     |  457 +++++++
 drivers/gpu/drm/msm/registers/xml/sfpb.xml         |   17 +
 scripts/Makefile.lib                               |    2 +-
 47 files changed, 8034 insertions(+), 587 deletions(-)
---
base-commit: ffa0c87f172bf7a0132aa960db412f8d63b2f533
change-id: 20240225-fd-xml-shipped-ba9a321cdedf

Best regards,

Comments

Masahiro Yamada Feb. 26, 2024, 6:24 a.m. UTC | #1
On Mon, Feb 26, 2024 at 11:11 AM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> Currently display-related register headers are generated from XML files
> shipped withing Mesa source tree. This is not fully optimal: it requires
> multi-stage process of the changes first being landed to Mesa and only
> then synced to the kernel tree.
>
> Move original XML files to the kernel tree and generate header files if
> required.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>



Linus Torvalds is negative about version-controlling
shipped copies.


https://lore.kernel.org/all/CAHk-=wgSEi_ZrHdqr=20xv+d6dr5G895CbOAi8ok+7-CQUN=fQ@mail.gmail.com/




We are decreasing *_shipped files.


This patch set will increase them.


[Before]

./arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped
./arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
./fs/unicode/utf8data.c_shipped
./drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped
./drivers/scsi/aic7xxx/aic79xx_seq.h_shipped
./drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
./drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
./drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped
./drivers/scsi/aic7xxx/aic7xxx_seq.h_shipped
./drivers/scsi/53c700_d.h_shipped
./drivers/net/wan/wanxlfw.inc_shipped
./drivers/tty/vt/defkeymap.c_shipped


[After]

./arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped
./arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
./fs/unicode/utf8data.c_shipped
./drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped
./drivers/scsi/aic7xxx/aic79xx_seq.h_shipped
./drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
./drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
./drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped
./drivers/scsi/aic7xxx/aic7xxx_seq.h_shipped
./drivers/scsi/53c700_d.h_shipped
./drivers/gpu/drm/msm/registers/dsi_phy_7nm.xml.h_shipped
./drivers/gpu/drm/msm/registers/dsi_phy_28nm_8960.xml.h_shipped
./drivers/gpu/drm/msm/registers/sfpb.xml.h_shipped
./drivers/gpu/drm/msm/registers/mdp_common.xml.h_shipped
./drivers/gpu/drm/msm/registers/dsi.xml.h_shipped
./drivers/gpu/drm/msm/registers/hdmi.xml.h_shipped
./drivers/gpu/drm/msm/registers/dsi_phy_14nm.xml.h_shipped
./drivers/gpu/drm/msm/registers/mdp5.xml.h_shipped
./drivers/gpu/drm/msm/registers/dsi_phy_10nm.xml.h_shipped
./drivers/gpu/drm/msm/registers/mdp4.xml.h_shipped
./drivers/gpu/drm/msm/registers/dsi_phy_28nm.xml.h_shipped
./drivers/gpu/drm/msm/registers/dsi_phy_20nm.xml.h_shipped
./drivers/net/wan/wanxlfw.inc_shipped
./drivers/tty/vt/defkeymap.c_shipped



Of course, this is because those generated headers were
version-controlled without _shipped, but now they
have been renamed to *_shipped



Since you are adding the original XML files,
how about generating those headers all the time?


For example see
7c0303ff7e67b637c47d8afee533ca9e2a02359b



If you hide the tool behind DRM_MSM_GENERATE_HEADERS,
nobody would notice the fact that
drivers/gpu/drm/msm/headergen2/ is low quality code
that sprinkle warnings.


I cannot compile this patch set in the first place
irrespective of DRM_MSM_GENERATE_HEADERS
(presumably for a different reason) though.






drivers/gpu/drm/msm/headergen2/rnndec.c: In function ‘rnndec_decodeval’:
drivers/gpu/drm/msm/headergen2/rnndec.c:187:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  187 |                                 asprintf (&res, "%s%s%s",
ctx->colors->eval, ctmp, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/adreno/a5xx_preempt.c:5:10: fatal error:
msm_gem.h: No such file or directory
    5 | #include "msm_gem.h"
      |          ^~~~~~~~~~~
compilation terminated.
drivers/gpu/drm/msm/headergen2/rnndec.c:216:57: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  216 |
asprintf (&res, "%s%s%s", color, bitfields[i]->name,
ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:218:57: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  218 |
asprintf (&tmp, "%s | %s%s%s", res, color, bitfields[i]->name,
ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:230:41: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  230 |                                         asprintf (&subval,
"%s%#"PRIx64"%s", ctx->colors->err, field_val, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:235:41: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  235 |                                         asprintf (&res,
"%s%s%s = %s", ctx->colors->rname, bitfields[i]->name,
ctx->colors->reset, subval);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:237:41: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  237 |                                         asprintf (&tmp, "%s |
%s%s%s = %s", res, ctx->colors->rname, bitfields[i]->name,
ctx->colors->reset, subval);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:245:41: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  245 |                                         asprintf (&res,
"%s%#"PRIx64"%s", ctx->colors->err, value & ~mask,
ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:247:41: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  247 |                                         asprintf (&tmp, "%s |
%s%#"PRIx64"%s", res, ctx->colors->err, value & ~mask,
ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:253:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  253 |                                 asprintf (&res, "%s0%s",
ctx->colors->num, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:254:25: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  254 |                         asprintf (&tmp, "{ %s }", res);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:260:25: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  260 |                         asprintf (&res, "%s%#"PRIx64"%s",
ctx->colors->num, value, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:264:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  264 |                                 asprintf (&res, "%s-%lf%s",
ctx->colors->num,
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  265 |
((double)((UINT64_C(1) << width) - value)) / ((double)(1 <<
ti->radix)),
      |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  266 |                                                 ctx->colors->reset);
      |                                                 ~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:271:25: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  271 |                         asprintf (&res, "%s%lf%s", ctx->colors->num,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  272 |                                         ((double)value) /
((double)(1LL << ti->radix)),
      |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  273 |                                         ctx->colors->reset);
      |                                         ~~~~~~~~~~~~~~~~~~~
  CC [M]  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.o
drivers/gpu/drm/msm/headergen2/rnndec.c:276:25: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  276 |                         asprintf (&res, "%sr%"PRIu64".%c%s",
ctx->colors->num, (value >> 2), "xyzw"[value & 0x3],
ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:279:25: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  279 |                         asprintf (&res, "%s%"PRIu64"%s",
ctx->colors->num, value, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:283:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  283 |                                 asprintf (&res,
"%s-%"PRIi64"%s", ctx->colors->num, (UINT64_C(1) << width) - value,
ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:285:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  285 |                                 asprintf (&res,
"%s%"PRIi64"%s", ctx->colors->num, value, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:289:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  289 |                                 asprintf (&res, "%sFALSE%s",
ctx->colors->eval, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:291:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  291 |                                 asprintf (&res, "%sTRUE%s",
ctx->colors->eval, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:298:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  298 |                                 asprintf(&res, "%s%f%s",
ctx->colors->num,
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  299 |                                         val.d, ctx->colors->reset);
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:301:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  301 |                                 asprintf(&res, "%s%f%s",
ctx->colors->num,
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  302 |                                         val.f, ctx->colors->reset);
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/adreno/a5xx_preempt.o] Error 1
make[6]: *** Waiting for unfinished jobs....
drivers/gpu/drm/msm/headergen2/rnndec.c:304:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  304 |                                 asprintf(&res, "%s%f%s",
ctx->colors->num,
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  305 |                                         float16(value),
ctx->colors->reset);
      |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:313:25: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  313 |                         asprintf (&res, "%s%#"PRIx64"%s",
ctx->colors->num, value, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:317:17: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  317 |                 asprintf (&tmp, "%s | %s%#"PRIx64"%s", res,
ctx->colors->err, value_orig & ~typeinfo_mask(ti),
ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/adreno/a6xx_gpu.c:5:10: fatal error: msm_gem.h: No
such file or directory
    5 | #include "msm_gem.h"
      |          ^~~~~~~~~~~
  CC [M]  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.o
compilation terminated.
drivers/gpu/drm/msm/headergen2/rnndec.c: In function ‘trymatch’:
drivers/gpu/drm/msm/headergen2/rnndec.c:394:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  394 |                                 asprintf (&res->name,
"%s%s%s", ctx->colors->rname, elems[i]->name, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:400:41: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  400 |                                         asprintf (&tmp,
"%s+%s%#"PRIx64"%s", res->name, ctx->colors->err, offset,
ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:424:41: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  424 |                                         asprintf (&name,
"%s%s%s", ctx->colors->rname, elems[i]->name, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:429:41: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  429 |                                         asprintf (&tmp,
"%s.%s", name, res->name);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:439:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  439 |                                 asprintf (&name, "%s%s%s",
ctx->colors->rname, elems[i]->name, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:445:41: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  445 |                                         asprintf (&tmp,
"%s.%s", name, res->name);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c:452:33: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  452 |                                 asprintf (&tmp,
"%s+%s%#"PRIx64"%s", name, ctx->colors->err, offset,
ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c: In function ‘appendidx’:
drivers/gpu/drm/msm/headergen2/rnndec.c:332:17: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  332 |                 asprintf (&res, "%s[%s%s%s]", name,
ctx->colors->eval, index_name, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/adreno/a6xx_gpu.o] Error 1
drivers/gpu/drm/msm/headergen2/rnndec.c:334:17: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  334 |                 asprintf (&res, "%s[%s%#"PRIx64"%s]", name,
ctx->colors->num, idx, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/rnndec.c: In function ‘rnndec_decodeaddr’:
drivers/gpu/drm/msm/headergen2/rnndec.c:477:9: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  477 |         asprintf (&res->name, "%s%#"PRIx64"%s",
ctx->colors->err, addr, ctx->colors->reset);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/headergen2.c: In function ‘printtypeinfo’:
drivers/gpu/drm/msm/headergen2/headergen2.c:159:25: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  159 |                         asprintf(&typename, "enum %s", ti->name);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/headergen2.c: In function ‘printdelem’:
drivers/gpu/drm/msm/headergen2/headergen2.c:245:17: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  245 |                 asprintf(&offsetfn, "__offset_%s", elem->name);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/headergen2/headergen2.c:254:17: warning: ignoring
return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  254 |                 asprintf(&regname, "REG_%s", elem->fullname);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/gpu/drm/msm/adreno/a4xx_gpu.h:7,
                 from drivers/gpu/drm/msm/adreno/a4xx_gpu.c:4:
drivers/gpu/drm/msm/adreno/adreno_gpu.h:15:10: fatal error: msm_gpu.h:
No such file or directory
   15 | #include "msm_gpu.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/adreno/a4xx_gpu.o] Error 1
In file included from drivers/gpu/drm/msm/adreno/adreno_device.c:9:
drivers/gpu/drm/msm/adreno/adreno_gpu.h:15:10: fatal error: msm_gpu.h:
No such file or directory
   15 | #include "msm_gpu.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/adreno/adreno_device.o] Error 1
drivers/gpu/drm/msm/adreno/a5xx_gpu.c:12:10: fatal error: msm_gem.h:
No such file or directory
   12 | #include "msm_gem.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/adreno/a5xx_gpu.o] Error 1
In file included from drivers/gpu/drm/msm/adreno/a3xx_gpu.h:10,
                 from drivers/gpu/drm/msm/adreno/a3xx_gpu.c:9:
drivers/gpu/drm/msm/adreno/adreno_gpu.h:15:10: fatal error: msm_gpu.h:
No such file or directory
   15 | #include "msm_gpu.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/adreno/a3xx_gpu.o] Error 1
In file included from drivers/gpu/drm/msm/adreno/a6xx_hfi.c:10:
drivers/gpu/drm/msm/adreno/a6xx_gmu.h:12:10: fatal error: msm_drv.h:
No such file or directory
   12 | #include "msm_drv.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/adreno/a6xx_hfi.o] Error 1
In file included from drivers/gpu/drm/msm/adreno/a2xx_gpu.h:7,
                 from drivers/gpu/drm/msm/adreno/a2xx_gpu.c:4:
drivers/gpu/drm/msm/adreno/adreno_gpu.h:15:10: fatal error: msm_gpu.h:
No such file or directory
   15 | #include "msm_gpu.h"
      |          ^~~~~~~~~~~
compilation terminated.
In file included from drivers/gpu/drm/msm/adreno/adreno_gpu.c:19:
drivers/gpu/drm/msm/adreno/adreno_gpu.h:15:10: fatal error: msm_gpu.h:
No such file or directory
   15 | #include "msm_gpu.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/adreno/a2xx_gpu.o] Error 1
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/adreno/adreno_gpu.o] Error 1
In file included from drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h:13,
                 from drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c:8:
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h:15:10: fatal error: msm_drv.h:
No such file or directory
   15 | #include "msm_drv.h"
      |          ^~~~~~~~~~~
compilation terminated.
In file included from drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c:26:
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h:15:10: fatal error: msm_drv.h:
No such file or directory
   15 | #include "msm_drv.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.o] Error 1
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.o] Error 1
In file included from drivers/gpu/drm/msm/adreno/a5xx_gpu.h:7,
                 from drivers/gpu/drm/msm/adreno/a5xx_power.c:6:
drivers/gpu/drm/msm/adreno/adreno_gpu.h:15:10: fatal error: msm_gpu.h:
No such file or directory
   15 | #include "msm_gpu.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/adreno/a5xx_power.o] Error 1
In file included from drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c:15:
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h:15:10: fatal error: msm_drv.h:
No such file or directory
   15 | #include "msm_drv.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.o] Error 1
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c:21:10: fatal error:
msm_drv.h: No such file or directory
   21 | #include "msm_drv.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.o] Error 1
In file included from drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h:13,
                 from drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c:6:
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h:15:10: fatal error: msm_drv.h:
No such file or directory
   15 | #include "msm_drv.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[6]: *** [scripts/Makefile.build:243:
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.o] Error 1
In file included from drivers/gpu/drm/msm/adreno/a6xx_gpu.h:8,
                 from drivers/gpu/drm/msm/adreno/a6xx_gmu.c:14:
drivers/gpu/drm/msm/adreno/adreno_gpu.h:15:10: fatal error: msm_gpu.h:
No such file or directory
   15 | #include "msm_gpu.h"
      |          ^~~~~~~~~~~
compilation terminated.




> ---
> Dmitry Baryshkov (12):
>       kbuild: create destination directory for _shipped handling
>       drm/msm/mdp5: add writeback block bases
>       drm/msm/hdmi: drop qfprom.xml.h
>       drm/msm/dsi: drop mmss_cc.xml.h
>       drm/msm: use _shipped suffix for all xml.h files
>       drm/msm/headergen: import source files from freedreno/envytools
>       drm/msm/headergen: use asprintf instead of custom aprintf
>       drm/msm/headergen: don't output full file paths
>       drm/msm/headergen: generate _shipped files
>       drm/msm: import XML registers database
>       drm/msm: tie regeneration of shipped headers
>       drm/msm: sync shipped headers database
>
>  drivers/gpu/drm/msm/Makefile                       |   80 +-
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.h           |   11 +
>  drivers/gpu/drm/msm/disp/mdp_common.xml.h          |  111 --
>  drivers/gpu/drm/msm/dsi/mmss_cc.xml.h              |  131 --
>  drivers/gpu/drm/msm/dsi/sfpb.xml.h                 |   70 -
>  drivers/gpu/drm/msm/hdmi/qfprom.xml.h              |   61 -
>  drivers/gpu/drm/msm/headergen2/colors.c            |   61 +
>  drivers/gpu/drm/msm/headergen2/colors.h            |   49 +
>  drivers/gpu/drm/msm/headergen2/headergen2.c        |  514 ++++++++
>  drivers/gpu/drm/msm/headergen2/path.c              |   64 +
>  drivers/gpu/drm/msm/headergen2/rnn.c               | 1363 ++++++++++++++++++++
>  drivers/gpu/drm/msm/headergen2/rnn.h               |  243 ++++
>  drivers/gpu/drm/msm/headergen2/rnndec.c            |  550 ++++++++
>  drivers/gpu/drm/msm/headergen2/rnndec.h            |   59 +
>  drivers/gpu/drm/msm/headergen2/util.h              |  113 ++
>  drivers/gpu/drm/msm/headergen2/util/u_debug.h      |   12 +
>  drivers/gpu/drm/msm/registers/.gitignore           |    5 +
>  .../{dsi/dsi.xml.h => registers/dsi.xml.h_shipped} |   38 +-
>  .../dsi_phy_10nm.xml.h_shipped}                    |   37 +-
>  .../dsi_phy_14nm.xml.h_shipped}                    |   37 +-
>  .../dsi_phy_20nm.xml.h_shipped}                    |   37 +-
>  .../dsi_phy_28nm.xml.h_shipped}                    |   37 +-
>  .../dsi_phy_28nm_8960.xml.h_shipped}               |   37 +-
>  .../dsi_phy_7nm.xml.h_shipped}                     |   37 +-
>  .../hdmi.xml.h => registers/hdmi.xml.h_shipped}    |  111 +-
>  .../mdp4.xml.h => registers/mdp4.xml.h_shipped}    |   37 +-
>  .../mdp5.xml.h => registers/mdp5.xml.h_shipped}    |   39 +-
>  .../gpu/drm/msm/registers/mdp_common.xml.h_shipped |  114 ++
>  drivers/gpu/drm/msm/registers/sfpb.xml.h_shipped   |   67 +
>  drivers/gpu/drm/msm/registers/xml/dsi.xml          |  390 ++++++
>  drivers/gpu/drm/msm/registers/xml/dsi_phy_10nm.xml |  102 ++
>  drivers/gpu/drm/msm/registers/xml/dsi_phy_14nm.xml |  135 ++
>  drivers/gpu/drm/msm/registers/xml/dsi_phy_20nm.xml |  100 ++
>  drivers/gpu/drm/msm/registers/xml/dsi_phy_28nm.xml |  180 +++
>  .../drm/msm/registers/xml/dsi_phy_28nm_8960.xml    |  134 ++
>  drivers/gpu/drm/msm/registers/xml/dsi_phy_7nm.xml  |  230 ++++
>  drivers/gpu/drm/msm/registers/xml/edp.xml          |  239 ++++
>  .../drm/msm/registers/xml/freedreno_copyright.xml  |   40 +
>  drivers/gpu/drm/msm/registers/xml/hdmi.xml         | 1015 +++++++++++++++
>  drivers/gpu/drm/msm/registers/xml/mdp4.xml         |  480 +++++++
>  drivers/gpu/drm/msm/registers/xml/mdp5.xml         |  806 ++++++++++++
>  drivers/gpu/drm/msm/registers/xml/mdp_common.xml   |   89 ++
>  drivers/gpu/drm/msm/registers/xml/mmss_cc.xml      |   48 +
>  drivers/gpu/drm/msm/registers/xml/msm.xml          |   32 +
>  drivers/gpu/drm/msm/registers/xml/rules-ng.xsd     |  457 +++++++
>  drivers/gpu/drm/msm/registers/xml/sfpb.xml         |   17 +
>  scripts/Makefile.lib                               |    2 +-
>  47 files changed, 8034 insertions(+), 587 deletions(-)
> ---
> base-commit: ffa0c87f172bf7a0132aa960db412f8d63b2f533
> change-id: 20240225-fd-xml-shipped-ba9a321cdedf
>
> Best regards,
> --
> Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>
Dmitry Baryshkov Feb. 26, 2024, 11:01 a.m. UTC | #2
On Mon, 26 Feb 2024 at 08:33, Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Mon, Feb 26, 2024 at 11:11 AM Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
> >
> > The driver might decide to put the _shipped files to the subdir.
>
>
>
> Please stop this sentence.
>
> This sounds like we are not learning.
>
> https://lore.kernel.org/all/CAHk-=wgSEi_ZrHdqr=20xv+d6dr5G895CbOAi8ok+7-CQUN=fQ@mail.gmail.com/
>
>
>
>
> > In such
> > case the cmd_copy might fail because the destination directory is not
> > present. Call mkdir -p to make sure that the destination directory is
> > present.
>
>
> There is no justification for this.
>
> If you need a single generated directory
> (drivers/gpu/drm/msm/registers/, divers/gpu/drm/msm/generated/ or whatever)
> that should be super simple.
>
> Why does scripts/Makefile.lib need the modification?

Could you please tell me how I should handle this?
I was looking for a way to generate
drivers/gpu/drm/msm/registers/foo.xml.h and then use it during
compilation.
In drivers/gpu/drm/msm/Makefile I added $(obj)/registers/foo.xml.h as
a dependency to the corresponding object files and then added
drivers/gpu/drm/msm/registers/foo.xml.h_shipped file.
This way Kbuild/make will attempt to call cmd_copy to generate target
file, which thanks to VPATH expansion boils down to `cat
$(srctree)/$(src)/registers/foo.xml.h_shopped >
$(obj)/registers/foo.xml.h`. However this breaks as there is no
$(obj)/registers.


> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> >  scripts/Makefile.lib | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index cd5b181060f1..94373eeac420 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -297,7 +297,7 @@ endef
> >  # the copy would be read-only as well, leading to an error when executing the
> >  # rule next time. Use 'cat' instead in order to generate a writable file.
> >  quiet_cmd_copy = COPY    $@
> > -      cmd_copy = cat $< > $@
> > +      cmd_copy = mkdir -p $(shell dirname $@) && cat $< > $@
> >
> >  $(obj)/%: $(src)/%_shipped
> >         $(call cmd,copy)
Masahiro Yamada Feb. 27, 2024, 3:29 a.m. UTC | #3
On Mon, Feb 26, 2024 at 7:49 PM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:

> Could you please specify how you tried to compile the code? I can see
> warnings from headrgen2, but I'm really puzzled by the errors from the
> MSM driver itself.



I applied this patch set onto v6.8-rc6.


masahiro@zoe:~/ref/linux(testing7)$ git log --oneline  -15
40eb59f162cc (HEAD -> testing7) drm/msm: sync shipped headers database
ae850f45f243 drm/msm: tie regeneration of shipped headers
45401d4034ef drm/msm: import XML registers database
491e4d41308e drm/msm/headergen: generate _shipped files
6766c628c097 drm/msm/headergen: don't output full file paths
e48e9a8eaf21 drm/msm/headergen: use asprintf instead of custom aprintf
b12d6fb5d2a0 drm/msm/headergen: import source files from freedreno/envytools
4699358f5c5b drm/msm: use _shipped suffix for all xml.h files
295fcf923852 drm/msm/dsi: drop mmss_cc.xml.h
a15c0faba637 drm/msm/hdmi: drop qfprom.xml.h
6811afe14414 drm/msm/mdp5: add writeback block bases
feee4929582e kbuild: create destination directory for _shipped handling
d206a76d7d27 (tag: v6.8-rc6, origin/master, origin/HEAD, master) Linux 6.8-rc6
e231dbd452a7 Merge tag 'bcachefs-2024-02-25' of
https://evilpiepirate.org/git/bcachefs
5197728f8182 bcachefs: fix bch2_save_backtrace()


I see the build errors with arm64 defconfig.

[build step]

  $ git clean -fdx
  $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
  $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-  -j$(nproc)






As I commented in 05/12, -I$(srctree)/$(src) is lost.


I was able to build it with the following fix-up.



--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 ccflags-y := -I $(srctree)/$(src)
-ccflags-y := -I $(obj)/registers
+ccflags-y += -I $(obj)/registers
 ccflags-y += -I $(srctree)/$(src)/disp/dpu1
 ccflags-$(CONFIG_DRM_MSM_DSI) += -I $(srctree)/$(src)/dsi
 ccflags-$(CONFIG_DRM_MSM_DP) += -I $(srctree)/$(src)/dp






Better fixes would be to use #include "" properly.
It should be relative to the source file.






diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
index 592b296aab22..cf878490abd0 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
@@ -9,7 +9,7 @@
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
 #include <linux/soc/qcom/qcom_aoss.h>
-#include "msm_drv.h"
+#include "../msm_drv.h"
 #include "a6xx_hfi.h"

 struct a6xx_gmu_bo {
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index c9c55e2ea584..3a109453db31 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -2,9 +2,9 @@
 /* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. */


-#include "msm_gem.h"
-#include "msm_mmu.h"
-#include "msm_gpu_trace.h"
+#include "../msm_gem.h"
+#include "../msm_mmu.h"
+#include "../msm_gpu_trace.h"
 #include "a6xx_gpu.h"
 #include "a6xx_gmu.xml.h"

diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h
b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
index bc14df96feb0..007788bf38ce 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
@@ -12,7 +12,7 @@
 #include <linux/firmware.h>
 #include <linux/iopoll.h>

-#include "msm_gpu.h"
+#include "../msm_gpu.h"

 #include "adreno_common.xml.h"
 #include "adreno_pm4.xml.h"
Masahiro Yamada Feb. 27, 2024, 2:52 p.m. UTC | #4
On Mon, Feb 26, 2024 at 8:01 PM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On Mon, 26 Feb 2024 at 08:33, Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > On Mon, Feb 26, 2024 at 11:11 AM Dmitry Baryshkov
> > <dmitry.baryshkov@linaro.org> wrote:
> > >
> > > The driver might decide to put the _shipped files to the subdir.
> >
> >
> >
> > Please stop this sentence.
> >
> > This sounds like we are not learning.
> >
> > https://lore.kernel.org/all/CAHk-=wgSEi_ZrHdqr=20xv+d6dr5G895CbOAi8ok+7-CQUN=fQ@mail.gmail.com/
> >
> >
> >
> >
> > > In such
> > > case the cmd_copy might fail because the destination directory is not
> > > present. Call mkdir -p to make sure that the destination directory is
> > > present.
> >
> >
> > There is no justification for this.
> >
> > If you need a single generated directory
> > (drivers/gpu/drm/msm/registers/, divers/gpu/drm/msm/generated/ or whatever)
> > that should be super simple.
> >
> > Why does scripts/Makefile.lib need the modification?
>
> Could you please tell me how I should handle this?
> I was looking for a way to generate
> drivers/gpu/drm/msm/registers/foo.xml.h and then use it during
> compilation.
> In drivers/gpu/drm/msm/Makefile I added $(obj)/registers/foo.xml.h as
> a dependency to the corresponding object files and then added
> drivers/gpu/drm/msm/registers/foo.xml.h_shipped file.
> This way Kbuild/make will attempt to call cmd_copy to generate target
> file, which thanks to VPATH expansion boils down to `cat
> $(srctree)/$(src)/registers/foo.xml.h_shopped >
> $(obj)/registers/foo.xml.h`. However this breaks as there is no
> $(obj)/registers.
>



One simple solution is to use $(shell mkdir -p ...)
to create the output directory.

scripts/Makefile.build does a similar thing.



You can add the following to drivers/gpu/drm/msm/Makefile.



# Create output directory when CONFIG_DRM_MSM is defined.
# This avoids creating the output directory during 'make clean'
ifdef CONFIG_DRM_MSM
$(shell mkdir -p $(obj)/registers)
endif