[PATCH 01/27] util: Introduce host-specific cpuinfo.h

Richard Henderson posted 27 patches 2 years, 8 months ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Riku Voipio <riku.voipio@iki.fi>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>, Leonardo Bras <leobras@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>
There is a newer version of this series
[PATCH 01/27] util: Introduce host-specific cpuinfo.h
Posted by Richard Henderson 2 years, 8 months ago
The entire contents of the header is host-specific, but the
existence of such a header is not, which could prevent some
host specific ifdefs at the top of the file for the include.

Add host/include/{arch,generic} to the project arguments.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 host/include/generic/host/cpuinfo.h | 4 ++++
 meson.build                         | 8 ++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 host/include/generic/host/cpuinfo.h

diff --git a/host/include/generic/host/cpuinfo.h b/host/include/generic/host/cpuinfo.h
new file mode 100644
index 0000000000..eca672064a
--- /dev/null
+++ b/host/include/generic/host/cpuinfo.h
@@ -0,0 +1,4 @@
+/*
+ * No host specific cpu indentification.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
diff --git a/meson.build b/meson.build
index 0a5cdefd4d..4ffc0d3e59 100644
--- a/meson.build
+++ b/meson.build
@@ -512,6 +512,14 @@ add_project_arguments('-iquote', '.',
                       '-iquote', meson.current_source_dir() / 'include',
                       language: all_languages)
 
+host_include = meson.current_source_dir() / 'host/include/'
+if fs.is_dir(host_include / host_arch)
+  add_project_arguments('-iquote', host_include / host_arch,
+                        language: all_languages)
+endif
+add_project_arguments('-iquote', host_include / 'generic',
+                      language: all_languages)
+
 sparse = find_program('cgcc', required: get_option('sparse'))
 if sparse.found()
   run_target('sparse',
-- 
2.34.1
Re: [PATCH 01/27] util: Introduce host-specific cpuinfo.h
Posted by Alex Bennée 2 years, 8 months ago
Richard Henderson <richard.henderson@linaro.org> writes:

> The entire contents of the header is host-specific, but the
> existence of such a header is not, which could prevent some
> host specific ifdefs at the top of the file for the include.
>
> Add host/include/{arch,generic} to the project arguments.
>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH 01/27] util: Introduce host-specific cpuinfo.h
Posted by Philippe Mathieu-Daudé 2 years, 8 months ago
On 20/5/23 18:26, Richard Henderson wrote:
> The entire contents of the header is host-specific, but the
> existence of such a header is not, which could prevent some
> host specific ifdefs at the top of the file for the include.
> 
> Add host/include/{arch,generic} to the project arguments.
> 
> Reviewed-by: Juan Quintela <quintela@redhat.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   host/include/generic/host/cpuinfo.h | 4 ++++
>   meson.build                         | 8 ++++++++
>   2 files changed, 12 insertions(+)
>   create mode 100644 host/include/generic/host/cpuinfo.h
> 
> diff --git a/host/include/generic/host/cpuinfo.h b/host/include/generic/host/cpuinfo.h
> new file mode 100644
> index 0000000000..eca672064a
> --- /dev/null
> +++ b/host/include/generic/host/cpuinfo.h
> @@ -0,0 +1,4 @@
> +/*
> + * No host specific cpu indentification.
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> diff --git a/meson.build b/meson.build
> index 0a5cdefd4d..4ffc0d3e59 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -512,6 +512,14 @@ add_project_arguments('-iquote', '.',
>                         '-iquote', meson.current_source_dir() / 'include',
>                         language: all_languages)
>   
> +host_include = meson.current_source_dir() / 'host/include/'
> +if fs.is_dir(host_include / host_arch)
> +  add_project_arguments('-iquote', host_include / host_arch,
> +                        language: all_languages)
> +endif

Maybe add a comment "generic include path must come last, after
host specific include path".

> +add_project_arguments('-iquote', host_include / 'generic',
> +                      language: all_languages)
> +
>   sparse = find_program('cgcc', required: get_option('sparse'))
>   if sparse.found()
>     run_target('sparse',

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>