diff mbox series

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

Message ID 20210718134650.1191-2-reinoud@NetBSD.org (mailing list archive)
State New, archived
Headers show
Series Update NVMM support to recent changes | expand

Commit Message

Reinoud Zandijk July 18, 2021, 1:46 p.m. UTC
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(-)

Comments

Philippe Mathieu-Daudé Sept. 7, 2021, 4:20 p.m. UTC | #1
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 */
>
Reinoud Zandijk Sept. 8, 2021, 9:46 a.m. UTC | #2
On Tue, Sep 07, 2021 at 06:20:33PM +0200, Philippe Mathieu-Daudé wrote:
> 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?

Since its on NetBSD, I guess its bsd-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"?

[5560/6718] Compiling C object libcommon.fa.p/hw_core_cpu-common.c.o
FAILED: libcommon.fa.p/hw_core_cpu-common.c.o 
gcc -Ilibcommon.fa.p -I../slirp -I../slirp/src -I../dtc/libfdt
-I../capstone/include/capstone -I. -Iqapi -Itrace -Iui -Iui/shader
-I/usr/pkg/include -I/usr/pkg/include/glib-2.0 -I/usr/pkg/lib/glib-2.0/include
-I/usr/pkg/include/gio-unix-2.0 -I/usr/X11R7/include
-I/usr/pkg/include/spice-1 -I/usr/pkg/include/spice-server
-I/usr/X11R7/include/pixman-1 -I/usr/pkg/include/libpng16
-I/usr/pkg/include/SDL2 -I/usr/pkg/include/ncursesw
-I/usr/X11R7/include/libdrm -I/usr/include -I/usr/pkg/include/ncurses
-I/usr/pkg/include/python3.8 -I/usr/include/krb5 -fdiagnostics-color=auto
-pipe -Wall -Winvalid-pch -std=gnu11 -O2 -iquote . -iquote
/tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b
-iquote
/tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b/include
-iquote
/tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b/disas/libvixl
-iquote
/tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b/tcg/i386
-pthread -U_FORTIFY_SOURCE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef
-Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv
-Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security
-Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs
-Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2
-Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi
-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -D_XOPEN_SOURCE_EXTENDED=1
-fPIC -D_NETBSD_SOURCE -D_XOPEN_SOURCE=600 -DNCURSES_WIDECHAR -D_REENTRANT
-D_THREAD_SAFE -Wno-undef -MD -MQ libcommon.fa.p/hw_core_cpu-common.c.o -MF
libcommon.fa.p/hw_core_cpu-common.c.o.d -o
libcommon.fa.p/hw_core_cpu-common.c.o -c ../hw/core/cpu-common.c
In file included from
/tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b/include/sysemu/hw_accel.h:19:0,
                 from ../hw/core/cpu-common.c:24:
/tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b/include/sysemu/nvmm.h:16:8:
error: attempt to use poisoned "CONFIG_NVMM"
 #ifdef CONFIG_NVMM
        ^
[5589/6718] Compiling C object libcommon.fa.p/hw_net_e1000e_core.c.o
ninja: build stopped: subcommand failed.

With the patch it works fine.

With regards,
Reinoud


> > 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 */
> >
Philippe Mathieu-Daudé Sept. 8, 2021, 10:30 a.m. UTC | #3
+Thomas

On 9/8/21 11:46 AM, Reinoud Zandijk wrote:
> On Tue, Sep 07, 2021 at 06:20:33PM +0200, Philippe Mathieu-Daudé wrote:
>> 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?
> 
> Since its on NetBSD, I guess its bsd-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"?
> 
> [5560/6718] Compiling C object libcommon.fa.p/hw_core_cpu-common.c.o
> FAILED: libcommon.fa.p/hw_core_cpu-common.c.o 
> gcc -Ilibcommon.fa.p -I../slirp -I../slirp/src -I../dtc/libfdt
> -I../capstone/include/capstone -I. -Iqapi -Itrace -Iui -Iui/shader
> -I/usr/pkg/include -I/usr/pkg/include/glib-2.0 -I/usr/pkg/lib/glib-2.0/include
> -I/usr/pkg/include/gio-unix-2.0 -I/usr/X11R7/include
> -I/usr/pkg/include/spice-1 -I/usr/pkg/include/spice-server
> -I/usr/X11R7/include/pixman-1 -I/usr/pkg/include/libpng16
> -I/usr/pkg/include/SDL2 -I/usr/pkg/include/ncursesw
> -I/usr/X11R7/include/libdrm -I/usr/include -I/usr/pkg/include/ncurses
> -I/usr/pkg/include/python3.8 -I/usr/include/krb5 -fdiagnostics-color=auto
> -pipe -Wall -Winvalid-pch -std=gnu11 -O2 -iquote . -iquote
> /tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b
> -iquote
> /tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b/include
> -iquote
> /tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b/disas/libvixl
> -iquote
> /tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b/tcg/i386
> -pthread -U_FORTIFY_SOURCE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
> -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef
> -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv
> -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security
> -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs
> -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2
> -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi
> -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -D_XOPEN_SOURCE_EXTENDED=1
> -fPIC -D_NETBSD_SOURCE -D_XOPEN_SOURCE=600 -DNCURSES_WIDECHAR -D_REENTRANT
> -D_THREAD_SAFE -Wno-undef -MD -MQ libcommon.fa.p/hw_core_cpu-common.c.o -MF
> libcommon.fa.p/hw_core_cpu-common.c.o.d -o
> libcommon.fa.p/hw_core_cpu-common.c.o -c ../hw/core/cpu-common.c
> In file included from
> /tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b/include/sysemu/hw_accel.h:19:0,
>                  from ../hw/core/cpu-common.c:24:
> /tmp/pkgsrc-gorilla/emulators/qemu-walking/work/qemu-9ad4c7c9b63f89c308fd988d509bed1389953c8b/include/sysemu/nvmm.h:16:8:
> error: attempt to use poisoned "CONFIG_NVMM"
>  #ifdef CONFIG_NVMM
>         ^
> [5589/6718] Compiling C object libcommon.fa.p/hw_net_e1000e_core.c.o
> ninja: build stopped: subcommand failed.
> 
> With the patch it works fine.
> 
> With regards,
> Reinoud
> 
> 
>>> 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 */
>>>
>
diff mbox series

Patch

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 */