diff mbox series

[v3,2/5] perf build: Generate arm64's sysreg-defs.h and add to include path

Message ID 20231011195740.3349631-3-oliver.upton@linux.dev (mailing list archive)
State New, archived
Headers show
Series KVM: selftests: Add ID reg test, update headers | expand

Commit Message

Oliver Upton Oct. 11, 2023, 7:57 p.m. UTC
Start generating sysreg-defs.h in anticipation of updating sysreg.h to a
version that needs the generated output.

Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
---
 tools/perf/Makefile.perf | 15 +++++++++++++--
 tools/perf/util/Build    |  2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)

Comments

Namhyung Kim Oct. 17, 2023, 10:23 p.m. UTC | #1
Hello,

On Wed, Oct 11, 2023 at 12:58 PM Oliver Upton <oliver.upton@linux.dev> wrote:
>
> Start generating sysreg-defs.h in anticipation of updating sysreg.h to a
> version that needs the generated output.
>
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>

It seems we also need this on non-ARM archs to process ARM SPE data.

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> ---
>  tools/perf/Makefile.perf | 15 +++++++++++++--
>  tools/perf/util/Build    |  2 +-
>  2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 37af6df7b978..14dedd11a1f5 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -443,6 +443,15 @@ drm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/drm_ioctl.sh
>  # Create output directory if not already present
>  _dummy := $(shell [ -d '$(beauty_ioctl_outdir)' ] || mkdir -p '$(beauty_ioctl_outdir)')
>
> +arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
> +
> +arm64-sysreg-defs: FORCE
> +       $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir)
> +
> +arm64-sysreg-defs-clean:
> +       $(call QUIET_CLEAN,arm64-sysreg-defs)
> +       $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) clean > /dev/null
> +
>  $(drm_ioctl_array): $(drm_hdr_dir)/drm.h $(drm_hdr_dir)/i915_drm.h $(drm_ioctl_tbl)
>         $(Q)$(SHELL) '$(drm_ioctl_tbl)' $(drm_hdr_dir) > $@
>
> @@ -716,7 +725,9 @@ endif
>  __build-dir = $(subst $(OUTPUT),,$(dir $@))
>  build-dir   = $(or $(__build-dir),.)
>
> -prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioctl_array) \
> +prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders \
> +       arm64-sysreg-defs \
> +       $(drm_ioctl_array) \
>         $(fadvise_advice_array) \
>         $(fsconfig_arrays) \
>         $(fsmount_arrays) \
> @@ -1125,7 +1136,7 @@ endif # BUILD_BPF_SKEL
>  bpf-skel-clean:
>         $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS)
>
> -clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean
> +clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean
>         $(call QUIET_CLEAN, core-objs)  $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-iostat $(LANG_BINDINGS)
>         $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
>         $(Q)$(RM) $(OUTPUT).config-detected
> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> index 6d657c9927f7..2f76230958ad 100644
> --- a/tools/perf/util/Build
> +++ b/tools/perf/util/Build
> @@ -345,7 +345,7 @@ CFLAGS_rbtree.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ET
>  CFLAGS_libstring.o     += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
>  CFLAGS_hweight.o       += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
>  CFLAGS_header.o        += -include $(OUTPUT)PERF-VERSION-FILE
> -CFLAGS_arm-spe.o       += -I$(srctree)/tools/arch/arm64/include/
> +CFLAGS_arm-spe.o       += -I$(srctree)/tools/arch/arm64/include/ -I$(srctree)/tools/arch/arm64/include/generated/
>
>  $(OUTPUT)util/argv_split.o: ../lib/argv_split.c FORCE
>         $(call rule_mkdir)
> --
> 2.42.0.609.gbb76f46606-goog
>
Arnaldo Carvalho de Melo Oct. 18, 2023, 2:12 p.m. UTC | #2
Em Tue, Oct 17, 2023 at 03:23:40PM -0700, Namhyung Kim escreveu:
> Hello,
> 
> On Wed, Oct 11, 2023 at 12:58 PM Oliver Upton <oliver.upton@linux.dev> wrote:
> >
> > Start generating sysreg-defs.h in anticipation of updating sysreg.h to a
> > version that needs the generated output.
> >
> > Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> 
> It seems we also need this on non-ARM archs to process ARM SPE data.
> 
> Acked-by: Namhyung Kim <namhyung@kernel.org>

When building with CORESIGHT=1, yes.

I have it in my tests and:

⬢[acme@toolbox perf-tools-next]$ ls -la /tmp/build/perf-tools-next/util/arm-spe.o
-rw-r--r--. 1 acme acme 135432 Oct 17 16:49 /tmp/build/perf-tools-next/util/arm-spe.o
⬢[acme@toolbox perf-tools-next]$ ldd /tmp/build/perf-tools-next/perf | grep csd
	libopencsd_c_api.so.1 => /lib64/libopencsd_c_api.so.1 (0x00007f36bfca5000)
	libopencsd.so.1 => /lib64/libopencsd.so.1 (0x00007f36be2e0000)
⬢[acme@toolbox perf-tools-next]$ rpm -qf /lib64/libopencsd.so.1
opencsd-1.3.3-1.fc38.x86_64
⬢[acme@toolbox perf-tools-next]$ rpm -q --qf "%{summary}\n" opencsd
An open source CoreSight(tm) Trace Decode library
⬢[acme@toolbox perf-tools-next]$

Well, double checked and arm-spe.o is built by default, only way to
disable it is using NO_AUXTRACE=1 in the make command line, but then
IIRC one needs linking with opencsd to decode all those traces, right?

Anyway:

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

- Arnaldo
 
> Thanks,
> Namhyung
> 
> 
> > ---
> >  tools/perf/Makefile.perf | 15 +++++++++++++--
> >  tools/perf/util/Build    |  2 +-
> >  2 files changed, 14 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > index 37af6df7b978..14dedd11a1f5 100644
> > --- a/tools/perf/Makefile.perf
> > +++ b/tools/perf/Makefile.perf
> > @@ -443,6 +443,15 @@ drm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/drm_ioctl.sh
> >  # Create output directory if not already present
> >  _dummy := $(shell [ -d '$(beauty_ioctl_outdir)' ] || mkdir -p '$(beauty_ioctl_outdir)')
> >
> > +arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
> > +
> > +arm64-sysreg-defs: FORCE
> > +       $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir)
> > +
> > +arm64-sysreg-defs-clean:
> > +       $(call QUIET_CLEAN,arm64-sysreg-defs)
> > +       $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) clean > /dev/null
> > +
> >  $(drm_ioctl_array): $(drm_hdr_dir)/drm.h $(drm_hdr_dir)/i915_drm.h $(drm_ioctl_tbl)
> >         $(Q)$(SHELL) '$(drm_ioctl_tbl)' $(drm_hdr_dir) > $@
> >
> > @@ -716,7 +725,9 @@ endif
> >  __build-dir = $(subst $(OUTPUT),,$(dir $@))
> >  build-dir   = $(or $(__build-dir),.)
> >
> > -prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioctl_array) \
> > +prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders \
> > +       arm64-sysreg-defs \
> > +       $(drm_ioctl_array) \
> >         $(fadvise_advice_array) \
> >         $(fsconfig_arrays) \
> >         $(fsmount_arrays) \
> > @@ -1125,7 +1136,7 @@ endif # BUILD_BPF_SKEL
> >  bpf-skel-clean:
> >         $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS)
> >
> > -clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean
> > +clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean
> >         $(call QUIET_CLEAN, core-objs)  $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-iostat $(LANG_BINDINGS)
> >         $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
> >         $(Q)$(RM) $(OUTPUT).config-detected
> > diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> > index 6d657c9927f7..2f76230958ad 100644
> > --- a/tools/perf/util/Build
> > +++ b/tools/perf/util/Build
> > @@ -345,7 +345,7 @@ CFLAGS_rbtree.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ET
> >  CFLAGS_libstring.o     += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
> >  CFLAGS_hweight.o       += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
> >  CFLAGS_header.o        += -include $(OUTPUT)PERF-VERSION-FILE
> > -CFLAGS_arm-spe.o       += -I$(srctree)/tools/arch/arm64/include/
> > +CFLAGS_arm-spe.o       += -I$(srctree)/tools/arch/arm64/include/ -I$(srctree)/tools/arch/arm64/include/generated/
> >
> >  $(OUTPUT)util/argv_split.o: ../lib/argv_split.c FORCE
> >         $(call rule_mkdir)
> > --
> > 2.42.0.609.gbb76f46606-goog
> >
Ian Rogers Nov. 7, 2023, 6:10 a.m. UTC | #3
On Wed, Oct 18, 2023 at 7:12 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Tue, Oct 17, 2023 at 03:23:40PM -0700, Namhyung Kim escreveu:
> > Hello,
> >
> > On Wed, Oct 11, 2023 at 12:58 PM Oliver Upton <oliver.upton@linux.dev> wrote:
> > >
> > > Start generating sysreg-defs.h in anticipation of updating sysreg.h to a
> > > version that needs the generated output.
> > >
> > > Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> >
> > It seems we also need this on non-ARM archs to process ARM SPE data.
> >
> > Acked-by: Namhyung Kim <namhyung@kernel.org>
>
> When building with CORESIGHT=1, yes.
>
> I have it in my tests and:
>
> ⬢[acme@toolbox perf-tools-next]$ ls -la /tmp/build/perf-tools-next/util/arm-spe.o
> -rw-r--r--. 1 acme acme 135432 Oct 17 16:49 /tmp/build/perf-tools-next/util/arm-spe.o
> ⬢[acme@toolbox perf-tools-next]$ ldd /tmp/build/perf-tools-next/perf | grep csd
>         libopencsd_c_api.so.1 => /lib64/libopencsd_c_api.so.1 (0x00007f36bfca5000)
>         libopencsd.so.1 => /lib64/libopencsd.so.1 (0x00007f36be2e0000)
> ⬢[acme@toolbox perf-tools-next]$ rpm -qf /lib64/libopencsd.so.1
> opencsd-1.3.3-1.fc38.x86_64
> ⬢[acme@toolbox perf-tools-next]$ rpm -q --qf "%{summary}\n" opencsd
> An open source CoreSight(tm) Trace Decode library
> ⬢[acme@toolbox perf-tools-next]$
>
> Well, double checked and arm-spe.o is built by default, only way to
> disable it is using NO_AUXTRACE=1 in the make command line, but then
> IIRC one needs linking with opencsd to decode all those traces, right?
>
> Anyway:
>
> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> - Arnaldo
>
> > Thanks,
> > Namhyung
> >
> >
> > > ---
> > >  tools/perf/Makefile.perf | 15 +++++++++++++--
> > >  tools/perf/util/Build    |  2 +-
> > >  2 files changed, 14 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > > index 37af6df7b978..14dedd11a1f5 100644
> > > --- a/tools/perf/Makefile.perf
> > > +++ b/tools/perf/Makefile.perf
> > > @@ -443,6 +443,15 @@ drm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/drm_ioctl.sh
> > >  # Create output directory if not already present
> > >  _dummy := $(shell [ -d '$(beauty_ioctl_outdir)' ] || mkdir -p '$(beauty_ioctl_outdir)')
> > >
> > > +arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
> > > +
> > > +arm64-sysreg-defs: FORCE
> > > +       $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir)

Should this not build an install_headers target? The generated code is
going into the source tree as is, ignoring O= options to make.

Thanks,
Ian

> > > +
> > > +arm64-sysreg-defs-clean:
> > > +       $(call QUIET_CLEAN,arm64-sysreg-defs)
> > > +       $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) clean > /dev/null
> > > +
> > >  $(drm_ioctl_array): $(drm_hdr_dir)/drm.h $(drm_hdr_dir)/i915_drm.h $(drm_ioctl_tbl)
> > >         $(Q)$(SHELL) '$(drm_ioctl_tbl)' $(drm_hdr_dir) > $@
> > >
> > > @@ -716,7 +725,9 @@ endif
> > >  __build-dir = $(subst $(OUTPUT),,$(dir $@))
> > >  build-dir   = $(or $(__build-dir),.)
> > >
> > > -prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioctl_array) \
> > > +prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders \
> > > +       arm64-sysreg-defs \
> > > +       $(drm_ioctl_array) \
> > >         $(fadvise_advice_array) \
> > >         $(fsconfig_arrays) \
> > >         $(fsmount_arrays) \
> > > @@ -1125,7 +1136,7 @@ endif # BUILD_BPF_SKEL
> > >  bpf-skel-clean:
> > >         $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS)
> > >
> > > -clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean
> > > +clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean
> > >         $(call QUIET_CLEAN, core-objs)  $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-iostat $(LANG_BINDINGS)
> > >         $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
> > >         $(Q)$(RM) $(OUTPUT).config-detected
> > > diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> > > index 6d657c9927f7..2f76230958ad 100644
> > > --- a/tools/perf/util/Build
> > > +++ b/tools/perf/util/Build
> > > @@ -345,7 +345,7 @@ CFLAGS_rbtree.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ET
> > >  CFLAGS_libstring.o     += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
> > >  CFLAGS_hweight.o       += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
> > >  CFLAGS_header.o        += -include $(OUTPUT)PERF-VERSION-FILE
> > > -CFLAGS_arm-spe.o       += -I$(srctree)/tools/arch/arm64/include/
> > > +CFLAGS_arm-spe.o       += -I$(srctree)/tools/arch/arm64/include/ -I$(srctree)/tools/arch/arm64/include/generated/
> > >
> > >  $(OUTPUT)util/argv_split.o: ../lib/argv_split.c FORCE
> > >         $(call rule_mkdir)
> > > --
> > > 2.42.0.609.gbb76f46606-goog
> > >
>
> --
>
> - Arnaldo
Ian Rogers Nov. 17, 2023, 9:42 p.m. UTC | #4
On Mon, Nov 6, 2023 at 10:10 PM Ian Rogers <irogers@google.com> wrote:
>
> On Wed, Oct 18, 2023 at 7:12 AM Arnaldo Carvalho de Melo
> <acme@kernel.org> wrote:
> >
> > Em Tue, Oct 17, 2023 at 03:23:40PM -0700, Namhyung Kim escreveu:
> > > Hello,
> > >
> > > On Wed, Oct 11, 2023 at 12:58 PM Oliver Upton <oliver.upton@linux.dev> wrote:
> > > >
> > > > Start generating sysreg-defs.h in anticipation of updating sysreg.h to a
> > > > version that needs the generated output.
> > > >
> > > > Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> > >
> > > It seems we also need this on non-ARM archs to process ARM SPE data.
> > >
> > > Acked-by: Namhyung Kim <namhyung@kernel.org>
> >
> > When building with CORESIGHT=1, yes.
> >
> > I have it in my tests and:
> >
> > ⬢[acme@toolbox perf-tools-next]$ ls -la /tmp/build/perf-tools-next/util/arm-spe.o
> > -rw-r--r--. 1 acme acme 135432 Oct 17 16:49 /tmp/build/perf-tools-next/util/arm-spe.o
> > ⬢[acme@toolbox perf-tools-next]$ ldd /tmp/build/perf-tools-next/perf | grep csd
> >         libopencsd_c_api.so.1 => /lib64/libopencsd_c_api.so.1 (0x00007f36bfca5000)
> >         libopencsd.so.1 => /lib64/libopencsd.so.1 (0x00007f36be2e0000)
> > ⬢[acme@toolbox perf-tools-next]$ rpm -qf /lib64/libopencsd.so.1
> > opencsd-1.3.3-1.fc38.x86_64
> > ⬢[acme@toolbox perf-tools-next]$ rpm -q --qf "%{summary}\n" opencsd
> > An open source CoreSight(tm) Trace Decode library
> > ⬢[acme@toolbox perf-tools-next]$
> >
> > Well, double checked and arm-spe.o is built by default, only way to
> > disable it is using NO_AUXTRACE=1 in the make command line, but then
> > IIRC one needs linking with opencsd to decode all those traces, right?
> >
> > Anyway:
> >
> > Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> >
> > - Arnaldo
> >
> > > Thanks,
> > > Namhyung
> > >
> > >
> > > > ---
> > > >  tools/perf/Makefile.perf | 15 +++++++++++++--
> > > >  tools/perf/util/Build    |  2 +-
> > > >  2 files changed, 14 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > > > index 37af6df7b978..14dedd11a1f5 100644
> > > > --- a/tools/perf/Makefile.perf
> > > > +++ b/tools/perf/Makefile.perf
> > > > @@ -443,6 +443,15 @@ drm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/drm_ioctl.sh
> > > >  # Create output directory if not already present
> > > >  _dummy := $(shell [ -d '$(beauty_ioctl_outdir)' ] || mkdir -p '$(beauty_ioctl_outdir)')
> > > >
> > > > +arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
> > > > +
> > > > +arm64-sysreg-defs: FORCE
> > > > +       $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir)
>
> Should this not build an install_headers target? The generated code is
> going into the source tree as is, ignoring O= options to make.

I think on top of this, tools/perf/MANIFEST needs to have:
arch/arm64/tools/gen-sysreg.awk
arch/arm64/tools/sysreg
This will add these files to the release tar balls, it already
contains things like scripts/bpf_doc.py.
tools/arch/arm64/tools/Makefile is picked up by tools/arch being in
the MANIFEST.

Thanks,
Ian
diff mbox series

Patch

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 37af6df7b978..14dedd11a1f5 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -443,6 +443,15 @@  drm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/drm_ioctl.sh
 # Create output directory if not already present
 _dummy := $(shell [ -d '$(beauty_ioctl_outdir)' ] || mkdir -p '$(beauty_ioctl_outdir)')
 
+arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
+
+arm64-sysreg-defs: FORCE
+	$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir)
+
+arm64-sysreg-defs-clean:
+	$(call QUIET_CLEAN,arm64-sysreg-defs)
+	$(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) clean > /dev/null
+
 $(drm_ioctl_array): $(drm_hdr_dir)/drm.h $(drm_hdr_dir)/i915_drm.h $(drm_ioctl_tbl)
 	$(Q)$(SHELL) '$(drm_ioctl_tbl)' $(drm_hdr_dir) > $@
 
@@ -716,7 +725,9 @@  endif
 __build-dir = $(subst $(OUTPUT),,$(dir $@))
 build-dir   = $(or $(__build-dir),.)
 
-prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioctl_array) \
+prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders \
+	arm64-sysreg-defs \
+	$(drm_ioctl_array) \
 	$(fadvise_advice_array) \
 	$(fsconfig_arrays) \
 	$(fsmount_arrays) \
@@ -1125,7 +1136,7 @@  endif # BUILD_BPF_SKEL
 bpf-skel-clean:
 	$(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS)
 
-clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean
+clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-iostat $(LANG_BINDINGS)
 	$(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
 	$(Q)$(RM) $(OUTPUT).config-detected
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 6d657c9927f7..2f76230958ad 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -345,7 +345,7 @@  CFLAGS_rbtree.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ET
 CFLAGS_libstring.o     += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
 CFLAGS_hweight.o       += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
 CFLAGS_header.o        += -include $(OUTPUT)PERF-VERSION-FILE
-CFLAGS_arm-spe.o       += -I$(srctree)/tools/arch/arm64/include/
+CFLAGS_arm-spe.o       += -I$(srctree)/tools/arch/arm64/include/ -I$(srctree)/tools/arch/arm64/include/generated/
 
 $(OUTPUT)util/argv_split.o: ../lib/argv_split.c FORCE
 	$(call rule_mkdir)