[PATCH v1 1/2] Only check CONFIG_NVMM when NEED_CPU_H is defined

Reinoud Zandijk posted 2 patches 4 years, 6 months ago
Maintainers: Reinoud Zandijk <reinoud@netbsd.org>, Kamil Rytarowski <kamil@netbsd.org>
[PATCH v1 1/2] Only check CONFIG_NVMM when NEED_CPU_H is defined
Posted by Reinoud Zandijk 4 years, 6 months ago
Userland targers will otherwise use a poisoned CONFIG_NVMM

Signed-off-by: Reinoud Zandijk <Reinoud@NetBSD.org>
---
 include/sysemu/nvmm.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/sysemu/nvmm.h b/include/sysemu/nvmm.h
index 6d216599b0..833670fccb 100644
--- a/include/sysemu/nvmm.h
+++ b/include/sysemu/nvmm.h
@@ -10,8 +10,7 @@
 #ifndef QEMU_NVMM_H
 #define QEMU_NVMM_H
 
-#include "config-host.h"
-#include "qemu-common.h"
+#ifdef NEED_CPU_H
 
 #ifdef CONFIG_NVMM
 
@@ -23,4 +22,6 @@ int nvmm_enabled(void);
 
 #endif /* CONFIG_NVMM */
 
-#endif /* CONFIG_NVMM */
+#endif /* NEED_CPU_H */
+
+#endif /* QEMU_NVMM_H */
-- 
2.31.1


Re: [PATCH v1 1/2] Only check CONFIG_NVMM when NEED_CPU_H is defined
Posted by Philippe Mathieu-Daudé 4 years, 5 months ago
On 7/18/21 3:46 PM, Reinoud Zandijk wrote:
> Userland targers will otherwise use a poisoned CONFIG_NVMM

Typo "targets", but do you mean bsd-user or linux-user?

But what is the error you get here?

cpu_report_tpr_access() is protected for !CONFIG_USER_ONLY,
target/i386/nvmm/ is only build on system emulation.

So when can this happen? Last candidate is "sysemu/hw_accel.h";
does it really need to include "sysemu/nvmm.h"?

> Signed-off-by: Reinoud Zandijk <Reinoud@NetBSD.org>
> ---
>  include/sysemu/nvmm.h | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/include/sysemu/nvmm.h b/include/sysemu/nvmm.h
> index 6d216599b0..833670fccb 100644
> --- a/include/sysemu/nvmm.h
> +++ b/include/sysemu/nvmm.h
> @@ -10,8 +10,7 @@
>  #ifndef QEMU_NVMM_H
>  #define QEMU_NVMM_H
>  
> -#include "config-host.h"
> -#include "qemu-common.h"
> +#ifdef NEED_CPU_H
>  
>  #ifdef CONFIG_NVMM
>  
> @@ -23,4 +22,6 @@ int nvmm_enabled(void);
>  
>  #endif /* CONFIG_NVMM */
>  
> -#endif /* CONFIG_NVMM */
> +#endif /* NEED_CPU_H */
> +
> +#endif /* QEMU_NVMM_H */
>