diff mbox series

[PULL,18/21] build: don't build hardware objects withlinux-user

Message ID 1557953433-19663-19-git-send-email-pbonzini@redhat.com
State New
Headers show
Series [PULL,01/21] hw/input: Add a CONFIG_PS2 switch for theps2.c file | expand

Commit Message

Paolo Bonzini May 15, 2019, 8:50 p.m. UTC
From: Laurent Vivier <lvivier@redhat.com>

Some objects are only needed for system emulation and tools.
We can ignore them for the user mode case

Update tests to run accordingly: conditionally build some tests
on CONFIG_BLOCK.

Some tests use components that are only built when softmmu or
block tools are enabled, not for linux-user. So, if these components
are not available, disable the tests.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190401141222.30034-6-lvivier@redhat.com>
---
 Makefile               |  4 +++
 Makefile.objs          | 14 +++++---
 tests/Makefile.include | 90 +++++++++++++++++++++++++-------------------------
 3 files changed, 58 insertions(+), 50 deletions(-)

Comments

Daniel P. Berrangé May 21, 2019, 11:52 a.m. UTC | #1
On Wed, May 15, 2019 at 10:50:30PM +0200, Paolo Bonzini wrote:
> From: Laurent Vivier <lvivier@redhat.com>
> 
> Some objects are only needed for system emulation and tools.
> We can ignore them for the user mode case
> 
> Update tests to run accordingly: conditionally build some tests
> on CONFIG_BLOCK.
> 
> Some tests use components that are only built when softmmu or
> block tools are enabled, not for linux-user. So, if these components
> are not available, disable the tests.
> 
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> Message-Id: <20190401141222.30034-6-lvivier@redhat.com>
> ---
>  Makefile               |  4 +++
>  Makefile.objs          | 14 +++++---
>  tests/Makefile.include | 90 +++++++++++++++++++++++++-------------------------
>  3 files changed, 58 insertions(+), 50 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 1851f8c..155f066 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -87,6 +87,10 @@ endif
>  
>  include $(SRC_PATH)/rules.mak
>  
> +# notempy and lor are defined in rules.mak
> +CONFIG_TOOLS := $(call notempty,$(TOOLS))
> +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))

IMHO calling this CONFIG_BLOCK is a really poor choice, as
the decision is completely unrelated to block modules. It
made really confused when trying to understand why all the
crypto or auth code had been made conditional on the block
drivers.  The block code is just one part of QEMU that
is used in tools & softmmu.

It would be better as CONFIG_SOFTMMU_TOOLS, or
CONFIG_NOT_USER, or something else.

> +trace-events-subdirs += crypto
> +ifeq ($(CONFIG_USER_ONLY),y)
> +trace-events-subdirs += linux-user
> +endif
> +ifeq ($(CONFIG_BLOCK),y)
>  trace-events-subdirs += authz
>  trace-events-subdirs += block
> -trace-events-subdirs += crypto
> +trace-events-subdirs += io
> +trace-events-subdirs += nbd
> +trace-events-subdirs += scsi
> +endif
>  ifeq ($(CONFIG_SOFTMMU),y)
>  trace-events-subdirs += chardev
>  trace-events-subdirs += audio
> @@ -178,12 +186,8 @@ trace-events-subdirs += net
>  trace-events-subdirs += ui
>  endif
>  trace-events-subdirs += hw/display
> -trace-events-subdirs += io
> -trace-events-subdirs += linux-user
> -trace-events-subdirs += nbd
>  trace-events-subdirs += qapi
>  trace-events-subdirs += qom
> -trace-events-subdirs += scsi
>  trace-events-subdirs += target/arm
>  trace-events-subdirs += target/hppa
>  trace-events-subdirs += target/i386
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index ad95a14..1865f6b 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -45,7 +45,7 @@ SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
>  
>  check-unit-y += tests/check-qdict$(EXESUF)
>  check-unit-y += tests/check-block-qdict$(EXESUF)
> -check-unit-y += tests/test-char$(EXESUF)
> +check-unit-$(CONFIG_SOFTMMU) += tests/test-char$(EXESUF)
>  check-unit-y += tests/check-qnum$(EXESUF)
>  check-unit-y += tests/check-qstring$(EXESUF)
>  check-unit-y += tests/check-qlist$(EXESUF)
> @@ -61,21 +61,21 @@ check-unit-y += tests/test-string-input-visitor$(EXESUF)
>  check-unit-y += tests/test-string-output-visitor$(EXESUF)
>  check-unit-y += tests/test-qmp-event$(EXESUF)
>  check-unit-y += tests/test-opts-visitor$(EXESUF)
> -check-unit-y += tests/test-coroutine$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-coroutine$(EXESUF)
>  check-unit-y += tests/test-visitor-serialization$(EXESUF)
>  check-unit-y += tests/test-iov$(EXESUF)
> -check-unit-y += tests/test-aio$(EXESUF)
> -check-unit-y += tests/test-aio-multithread$(EXESUF)
> -check-unit-y += tests/test-throttle$(EXESUF)
> -check-unit-y += tests/test-thread-pool$(EXESUF)
> -check-unit-y += tests/test-hbitmap$(EXESUF)
> -check-unit-y += tests/test-bdrv-drain$(EXESUF)
> -check-unit-y += tests/test-bdrv-graph-mod$(EXESUF)
> -check-unit-y += tests/test-blockjob$(EXESUF)
> -check-unit-y += tests/test-blockjob-txn$(EXESUF)
> -check-unit-y += tests/test-block-backend$(EXESUF)
> -check-unit-y += tests/test-block-iothread$(EXESUF)
> -check-unit-y += tests/test-image-locking$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-aio$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-aio-multithread$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-throttle$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-thread-pool$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-hbitmap$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-drain$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-graph-mod$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-blockjob$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-blockjob-txn$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-block-backend$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-block-iothread$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-image-locking$(EXESUF)
>  check-unit-y += tests/test-x86-cpuid$(EXESUF)
>  # all code tested by test-x86-cpuid is inside topology.h
>  ifeq ($(CONFIG_SOFTMMU),y)
> @@ -101,40 +101,40 @@ check-unit-y += tests/check-qom-interface$(EXESUF)
>  check-unit-y += tests/check-qom-proplist$(EXESUF)
>  check-unit-y += tests/test-qemu-opts$(EXESUF)
>  check-unit-y += tests/test-keyval$(EXESUF)
> -check-unit-y += tests/test-write-threshold$(EXESUF)
> -check-unit-y += tests/test-crypto-hash$(EXESUF)
> -check-speed-y += tests/benchmark-crypto-hash$(EXESUF)
> -check-unit-y += tests/test-crypto-hmac$(EXESUF)
> -check-speed-y += tests/benchmark-crypto-hmac$(EXESUF)
> -check-unit-y += tests/test-crypto-cipher$(EXESUF)
> -check-speed-y += tests/benchmark-crypto-cipher$(EXESUF)
> -check-unit-y += tests/test-crypto-secret$(EXESUF)
> -check-unit-$(CONFIG_GNUTLS) += tests/test-crypto-tlscredsx509$(EXESUF)
> -check-unit-$(CONFIG_GNUTLS) += tests/test-crypto-tlssession$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-write-threshold$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hash$(EXESUF)
> +check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hash$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hmac$(EXESUF)
> +check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hmac$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-cipher$(EXESUF)
> +check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-secret$(EXESUF)
> +check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlscredsx509$(EXESUF)
> +check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlssession$(EXESUF)
>  ifneq (,$(findstring qemu-ga,$(TOOLS)))
>  check-unit-$(call land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) += tests/test-qga$(EXESUF)
>  endif
>  check-unit-y += tests/test-timed-average$(EXESUF)
>  check-unit-$(CONFIG_INOTIFY1) += tests/test-util-filemonitor$(EXESUF)
>  check-unit-y += tests/test-util-sockets$(EXESUF)
> -check-unit-y += tests/test-authz-simple$(EXESUF)
> -check-unit-y += tests/test-authz-list$(EXESUF)
> -check-unit-y += tests/test-authz-listfile$(EXESUF)
> -check-unit-$(CONFIG_AUTH_PAM) += tests/test-authz-pam$(EXESUF)
> -check-unit-y += tests/test-io-task$(EXESUF)
> -check-unit-y += tests/test-io-channel-socket$(EXESUF)
> -check-unit-y += tests/test-io-channel-file$(EXESUF)
> -check-unit-$(CONFIG_GNUTLS) += tests/test-io-channel-tls$(EXESUF)
> -check-unit-y += tests/test-io-channel-command$(EXESUF)
> -check-unit-y += tests/test-io-channel-buffer$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-authz-simple$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-authz-list$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-authz-listfile$(EXESUF)
> +check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_AUTH_PAM)) += tests/test-authz-pam$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-io-task$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-socket$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-file$(EXESUF)
> +check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-io-channel-tls$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-command$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-buffer$(EXESUF)
>  check-unit-y += tests/test-base64$(EXESUF)
> -check-unit-$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT)) += tests/test-crypto-pbkdf$(EXESUF)
> -check-unit-y += tests/test-crypto-ivgen$(EXESUF)
> -check-unit-y += tests/test-crypto-afsplit$(EXESUF)
> -check-unit-y += tests/test-crypto-xts$(EXESUF)
> -check-unit-y += tests/test-crypto-block$(EXESUF)
> +check-unit-$(call land,$(CONFIG_BLOCK),$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT))) += tests/test-crypto-pbkdf$(EXESUF)
> +check-unit-$(CONFIG_BLOCK) += tests/test-crypto-ivgen$(EXESUF)
> +check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-afsplit$(EXESUF)
> +check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-xts$(EXESUF)
> +check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-block$(EXESUF)
>  check-unit-y += tests/test-logging$(EXESUF)
> -check-unit-$(CONFIG_REPLICATION) += tests/test-replication$(EXESUF)
> +check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_REPLICATION)) += tests/test-replication$(EXESUF)
>  check-unit-y += tests/test-bufferiszero$(EXESUF)
>  check-unit-y += tests/test-uuid$(EXESUF)
>  check-unit-y += tests/ptimer-test$(EXESUF)
> @@ -496,11 +496,11 @@ test-qapi-obj-y = tests/test-qapi-types.o \
>  	tests/test-qapi-visit-sub-sub-module.o \
>  	tests/test-qapi-introspect.o \
>  	$(test-qom-obj-y)
> -benchmark-crypto-obj-y = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
> -test-crypto-obj-y = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
> -test-io-obj-y = $(io-obj-y) $(test-crypto-obj-y)
> -test-authz-obj-y = $(test-qom-obj-y) $(authz-obj-y)
> -test-block-obj-y = $(block-obj-y) $(test-io-obj-y) tests/iothread.o
> +benchmark-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
> +test-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
> +test-io-obj-$(CONFIG_BLOCK) = $(io-obj-y) $(test-crypto-obj-y)
> +test-authz-obj-$(CONFIG_BLOCK) = $(test-qom-obj-y) $(authz-obj-y)
> +test-block-obj-$(CONFIG_BLOCK) = $(block-obj-y) $(test-io-obj-y) tests/iothread.o
>  
>  tests/check-qnum$(EXESUF): tests/check-qnum.o $(test-util-obj-y)
>  tests/check-qstring$(EXESUF): tests/check-qstring.o $(test-util-obj-y)
> -- 
> 1.8.3.1
> 
> 
> 

Regards,
Daniel
Laurent Vivier May 21, 2019, 12:52 p.m. UTC | #2
On 21/05/2019 13:52, Daniel P. Berrangé wrote:
> On Wed, May 15, 2019 at 10:50:30PM +0200, Paolo Bonzini wrote:
>> From: Laurent Vivier <lvivier@redhat.com>
>>
>> Some objects are only needed for system emulation and tools.
>> We can ignore them for the user mode case
>>
>> Update tests to run accordingly: conditionally build some tests
>> on CONFIG_BLOCK.
>>
>> Some tests use components that are only built when softmmu or
>> block tools are enabled, not for linux-user. So, if these components
>> are not available, disable the tests.
>>
>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>> Message-Id: <20190401141222.30034-6-lvivier@redhat.com>
>> ---
>>   Makefile               |  4 +++
>>   Makefile.objs          | 14 +++++---
>>   tests/Makefile.include | 90 +++++++++++++++++++++++++-------------------------
>>   3 files changed, 58 insertions(+), 50 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 1851f8c..155f066 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -87,6 +87,10 @@ endif
>>   
>>   include $(SRC_PATH)/rules.mak
>>   
>> +# notempy and lor are defined in rules.mak
>> +CONFIG_TOOLS := $(call notempty,$(TOOLS))
>> +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
> 
> IMHO calling this CONFIG_BLOCK is a really poor choice, as
> the decision is completely unrelated to block modules. It
> made really confused when trying to understand why all the
> crypto or auth code had been made conditional on the block
> drivers.  The block code is just one part of QEMU that
> is used in tools & softmmu.
> 
> It would be better as CONFIG_SOFTMMU_TOOLS, or
> CONFIG_NOT_USER, or something else.

Do you think it's worth a patch to change the name?

Thanks,
Laurent
Daniel P. Berrangé May 21, 2019, 12:54 p.m. UTC | #3
On Tue, May 21, 2019 at 02:52:42PM +0200, Laurent Vivier wrote:
> On 21/05/2019 13:52, Daniel P. Berrangé wrote:
> > On Wed, May 15, 2019 at 10:50:30PM +0200, Paolo Bonzini wrote:
> > > From: Laurent Vivier <lvivier@redhat.com>
> > > 
> > > Some objects are only needed for system emulation and tools.
> > > We can ignore them for the user mode case
> > > 
> > > Update tests to run accordingly: conditionally build some tests
> > > on CONFIG_BLOCK.
> > > 
> > > Some tests use components that are only built when softmmu or
> > > block tools are enabled, not for linux-user. So, if these components
> > > are not available, disable the tests.
> > > 
> > > Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> > > Message-Id: <20190401141222.30034-6-lvivier@redhat.com>
> > > ---
> > >   Makefile               |  4 +++
> > >   Makefile.objs          | 14 +++++---
> > >   tests/Makefile.include | 90 +++++++++++++++++++++++++-------------------------
> > >   3 files changed, 58 insertions(+), 50 deletions(-)
> > > 
> > > diff --git a/Makefile b/Makefile
> > > index 1851f8c..155f066 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -87,6 +87,10 @@ endif
> > >   include $(SRC_PATH)/rules.mak
> > > +# notempy and lor are defined in rules.mak
> > > +CONFIG_TOOLS := $(call notempty,$(TOOLS))
> > > +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
> > 
> > IMHO calling this CONFIG_BLOCK is a really poor choice, as
> > the decision is completely unrelated to block modules. It
> > made really confused when trying to understand why all the
> > crypto or auth code had been made conditional on the block
> > drivers.  The block code is just one part of QEMU that
> > is used in tools & softmmu.
> > 
> > It would be better as CONFIG_SOFTMMU_TOOLS, or
> > CONFIG_NOT_USER, or something else.
> 
> Do you think it's worth a patch to change the name?

Personally I'd like to see a patch to give it a better name.

Regards,
Daniel
Laurent Vivier May 21, 2019, 8:16 p.m. UTC | #4
On 21/05/2019 14:54, Daniel P. Berrangé wrote:
> On Tue, May 21, 2019 at 02:52:42PM +0200, Laurent Vivier wrote:
>> On 21/05/2019 13:52, Daniel P. Berrangé wrote:
>>> On Wed, May 15, 2019 at 10:50:30PM +0200, Paolo Bonzini wrote:
>>>> From: Laurent Vivier <lvivier@redhat.com>
>>>>
>>>> Some objects are only needed for system emulation and tools.
>>>> We can ignore them for the user mode case
>>>>
>>>> Update tests to run accordingly: conditionally build some tests
>>>> on CONFIG_BLOCK.
>>>>
>>>> Some tests use components that are only built when softmmu or
>>>> block tools are enabled, not for linux-user. So, if these components
>>>> are not available, disable the tests.
>>>>
>>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>>>> Message-Id: <20190401141222.30034-6-lvivier@redhat.com>
>>>> ---
>>>>    Makefile               |  4 +++
>>>>    Makefile.objs          | 14 +++++---
>>>>    tests/Makefile.include | 90 +++++++++++++++++++++++++-------------------------
>>>>    3 files changed, 58 insertions(+), 50 deletions(-)
>>>>
>>>> diff --git a/Makefile b/Makefile
>>>> index 1851f8c..155f066 100644
>>>> --- a/Makefile
>>>> +++ b/Makefile
>>>> @@ -87,6 +87,10 @@ endif
>>>>    include $(SRC_PATH)/rules.mak
>>>> +# notempy and lor are defined in rules.mak
>>>> +CONFIG_TOOLS := $(call notempty,$(TOOLS))
>>>> +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
>>>
>>> IMHO calling this CONFIG_BLOCK is a really poor choice, as
>>> the decision is completely unrelated to block modules. It
>>> made really confused when trying to understand why all the
>>> crypto or auth code had been made conditional on the block
>>> drivers.  The block code is just one part of QEMU that
>>> is used in tools & softmmu.
>>>
>>> It would be better as CONFIG_SOFTMMU_TOOLS, or
>>> CONFIG_NOT_USER, or something else.
>>
>> Do you think it's worth a patch to change the name?
> 
> Personally I'd like to see a patch to give it a better name.

I'm wondering which name to use.

CONFIG_NOT_USER is not correct because the flag can be 'y' with 
CONFIG_USER_ONLY set.
CONFIG_SOFTMMU_TOOLS is too fuzzy.

CONFIG_HW ?
CONFIG_IO ?
CONFIG_DEVICE ?

Thanks,
Laurent
Philippe Mathieu-Daudé July 4, 2019, 1:09 p.m. UTC | #5
On 5/21/19 10:16 PM, Laurent Vivier wrote:
> On 21/05/2019 14:54, Daniel P. Berrangé wrote:
>> On Tue, May 21, 2019 at 02:52:42PM +0200, Laurent Vivier wrote:
>>> On 21/05/2019 13:52, Daniel P. Berrangé wrote:
>>>> On Wed, May 15, 2019 at 10:50:30PM +0200, Paolo Bonzini wrote:
>>>>> From: Laurent Vivier <lvivier@redhat.com>
>>>>>
>>>>> Some objects are only needed for system emulation and tools.
>>>>> We can ignore them for the user mode case
>>>>>
>>>>> Update tests to run accordingly: conditionally build some tests
>>>>> on CONFIG_BLOCK.
>>>>>
>>>>> Some tests use components that are only built when softmmu or
>>>>> block tools are enabled, not for linux-user. So, if these components
>>>>> are not available, disable the tests.
>>>>>
>>>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>>>>> Message-Id: <20190401141222.30034-6-lvivier@redhat.com>
>>>>> ---
>>>>>    Makefile               |  4 +++
>>>>>    Makefile.objs          | 14 +++++---
>>>>>    tests/Makefile.include | 90
>>>>> +++++++++++++++++++++++++-------------------------
>>>>>    3 files changed, 58 insertions(+), 50 deletions(-)
>>>>>
>>>>> diff --git a/Makefile b/Makefile
>>>>> index 1851f8c..155f066 100644
>>>>> --- a/Makefile
>>>>> +++ b/Makefile
>>>>> @@ -87,6 +87,10 @@ endif
>>>>>    include $(SRC_PATH)/rules.mak
>>>>> +# notempy and lor are defined in rules.mak
>>>>> +CONFIG_TOOLS := $(call notempty,$(TOOLS))
>>>>> +CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
>>>>
>>>> IMHO calling this CONFIG_BLOCK is a really poor choice, as
>>>> the decision is completely unrelated to block modules. It
>>>> made really confused when trying to understand why all the
>>>> crypto or auth code had been made conditional on the block
>>>> drivers.  The block code is just one part of QEMU that
>>>> is used in tools & softmmu.
>>>>
>>>> It would be better as CONFIG_SOFTMMU_TOOLS, or
>>>> CONFIG_NOT_USER, or something else.
>>>
>>> Do you think it's worth a patch to change the name?
>>
>> Personally I'd like to see a patch to give it a better name.
> 
> I'm wondering which name to use.
> 
> CONFIG_NOT_USER is not correct because the flag can be 'y' with
> CONFIG_USER_ONLY set.
> CONFIG_SOFTMMU_TOOLS is too fuzzy.
> 
> CONFIG_HW ?
> CONFIG_IO ?
> CONFIG_DEVICE ?

CONFIG_MACHINE_HW?
CONFIG_MACHINE_IO_HELPERS?
CONFIG_AIO?

BTW looking at util/Makefile.objs there is various think you can skip
for linux-user IMO.

Regards,

Phil.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 1851f8c..155f066 100644
--- a/Makefile
+++ b/Makefile
@@ -87,6 +87,10 @@  endif
 
 include $(SRC_PATH)/rules.mak
 
+# notempy and lor are defined in rules.mak
+CONFIG_TOOLS := $(call notempty,$(TOOLS))
+CONFIG_BLOCK := $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS))
+
 # Create QEMU_PKGVERSION and FULL_VERSION strings
 # If PKGVERSION is set, use that; otherwise get version and -dirty status from git
 QEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \
diff --git a/Makefile.objs b/Makefile.objs
index 43c9e45..2b0793e 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -127,9 +127,17 @@  rdmacm-mux-obj-y = contrib/rdmacm-mux/
 trace-events-subdirs =
 trace-events-subdirs += accel/kvm
 trace-events-subdirs += accel/tcg
+trace-events-subdirs += crypto
+ifeq ($(CONFIG_USER_ONLY),y)
+trace-events-subdirs += linux-user
+endif
+ifeq ($(CONFIG_BLOCK),y)
 trace-events-subdirs += authz
 trace-events-subdirs += block
-trace-events-subdirs += crypto
+trace-events-subdirs += io
+trace-events-subdirs += nbd
+trace-events-subdirs += scsi
+endif
 ifeq ($(CONFIG_SOFTMMU),y)
 trace-events-subdirs += chardev
 trace-events-subdirs += audio
@@ -178,12 +186,8 @@  trace-events-subdirs += net
 trace-events-subdirs += ui
 endif
 trace-events-subdirs += hw/display
-trace-events-subdirs += io
-trace-events-subdirs += linux-user
-trace-events-subdirs += nbd
 trace-events-subdirs += qapi
 trace-events-subdirs += qom
-trace-events-subdirs += scsi
 trace-events-subdirs += target/arm
 trace-events-subdirs += target/hppa
 trace-events-subdirs += target/i386
diff --git a/tests/Makefile.include b/tests/Makefile.include
index ad95a14..1865f6b 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -45,7 +45,7 @@  SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
 
 check-unit-y += tests/check-qdict$(EXESUF)
 check-unit-y += tests/check-block-qdict$(EXESUF)
-check-unit-y += tests/test-char$(EXESUF)
+check-unit-$(CONFIG_SOFTMMU) += tests/test-char$(EXESUF)
 check-unit-y += tests/check-qnum$(EXESUF)
 check-unit-y += tests/check-qstring$(EXESUF)
 check-unit-y += tests/check-qlist$(EXESUF)
@@ -61,21 +61,21 @@  check-unit-y += tests/test-string-input-visitor$(EXESUF)
 check-unit-y += tests/test-string-output-visitor$(EXESUF)
 check-unit-y += tests/test-qmp-event$(EXESUF)
 check-unit-y += tests/test-opts-visitor$(EXESUF)
-check-unit-y += tests/test-coroutine$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-coroutine$(EXESUF)
 check-unit-y += tests/test-visitor-serialization$(EXESUF)
 check-unit-y += tests/test-iov$(EXESUF)
-check-unit-y += tests/test-aio$(EXESUF)
-check-unit-y += tests/test-aio-multithread$(EXESUF)
-check-unit-y += tests/test-throttle$(EXESUF)
-check-unit-y += tests/test-thread-pool$(EXESUF)
-check-unit-y += tests/test-hbitmap$(EXESUF)
-check-unit-y += tests/test-bdrv-drain$(EXESUF)
-check-unit-y += tests/test-bdrv-graph-mod$(EXESUF)
-check-unit-y += tests/test-blockjob$(EXESUF)
-check-unit-y += tests/test-blockjob-txn$(EXESUF)
-check-unit-y += tests/test-block-backend$(EXESUF)
-check-unit-y += tests/test-block-iothread$(EXESUF)
-check-unit-y += tests/test-image-locking$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-aio$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-aio-multithread$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-throttle$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-thread-pool$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-hbitmap$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-drain$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-bdrv-graph-mod$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-blockjob$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-blockjob-txn$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-block-backend$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-block-iothread$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-image-locking$(EXESUF)
 check-unit-y += tests/test-x86-cpuid$(EXESUF)
 # all code tested by test-x86-cpuid is inside topology.h
 ifeq ($(CONFIG_SOFTMMU),y)
@@ -101,40 +101,40 @@  check-unit-y += tests/check-qom-interface$(EXESUF)
 check-unit-y += tests/check-qom-proplist$(EXESUF)
 check-unit-y += tests/test-qemu-opts$(EXESUF)
 check-unit-y += tests/test-keyval$(EXESUF)
-check-unit-y += tests/test-write-threshold$(EXESUF)
-check-unit-y += tests/test-crypto-hash$(EXESUF)
-check-speed-y += tests/benchmark-crypto-hash$(EXESUF)
-check-unit-y += tests/test-crypto-hmac$(EXESUF)
-check-speed-y += tests/benchmark-crypto-hmac$(EXESUF)
-check-unit-y += tests/test-crypto-cipher$(EXESUF)
-check-speed-y += tests/benchmark-crypto-cipher$(EXESUF)
-check-unit-y += tests/test-crypto-secret$(EXESUF)
-check-unit-$(CONFIG_GNUTLS) += tests/test-crypto-tlscredsx509$(EXESUF)
-check-unit-$(CONFIG_GNUTLS) += tests/test-crypto-tlssession$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-write-threshold$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hash$(EXESUF)
+check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hash$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-crypto-hmac$(EXESUF)
+check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-hmac$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-crypto-cipher$(EXESUF)
+check-speed-$(CONFIG_BLOCK) += tests/benchmark-crypto-cipher$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-crypto-secret$(EXESUF)
+check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlscredsx509$(EXESUF)
+check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-crypto-tlssession$(EXESUF)
 ifneq (,$(findstring qemu-ga,$(TOOLS)))
 check-unit-$(call land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) += tests/test-qga$(EXESUF)
 endif
 check-unit-y += tests/test-timed-average$(EXESUF)
 check-unit-$(CONFIG_INOTIFY1) += tests/test-util-filemonitor$(EXESUF)
 check-unit-y += tests/test-util-sockets$(EXESUF)
-check-unit-y += tests/test-authz-simple$(EXESUF)
-check-unit-y += tests/test-authz-list$(EXESUF)
-check-unit-y += tests/test-authz-listfile$(EXESUF)
-check-unit-$(CONFIG_AUTH_PAM) += tests/test-authz-pam$(EXESUF)
-check-unit-y += tests/test-io-task$(EXESUF)
-check-unit-y += tests/test-io-channel-socket$(EXESUF)
-check-unit-y += tests/test-io-channel-file$(EXESUF)
-check-unit-$(CONFIG_GNUTLS) += tests/test-io-channel-tls$(EXESUF)
-check-unit-y += tests/test-io-channel-command$(EXESUF)
-check-unit-y += tests/test-io-channel-buffer$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-authz-simple$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-authz-list$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-authz-listfile$(EXESUF)
+check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_AUTH_PAM)) += tests/test-authz-pam$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-io-task$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-socket$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-file$(EXESUF)
+check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_GNUTLS)) += tests/test-io-channel-tls$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-command$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-io-channel-buffer$(EXESUF)
 check-unit-y += tests/test-base64$(EXESUF)
-check-unit-$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT)) += tests/test-crypto-pbkdf$(EXESUF)
-check-unit-y += tests/test-crypto-ivgen$(EXESUF)
-check-unit-y += tests/test-crypto-afsplit$(EXESUF)
-check-unit-y += tests/test-crypto-xts$(EXESUF)
-check-unit-y += tests/test-crypto-block$(EXESUF)
+check-unit-$(call land,$(CONFIG_BLOCK),$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT))) += tests/test-crypto-pbkdf$(EXESUF)
+check-unit-$(CONFIG_BLOCK) += tests/test-crypto-ivgen$(EXESUF)
+check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-afsplit$(EXESUF)
+check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-xts$(EXESUF)
+check-unit-$(CONFIG_BLOCK)  += tests/test-crypto-block$(EXESUF)
 check-unit-y += tests/test-logging$(EXESUF)
-check-unit-$(CONFIG_REPLICATION) += tests/test-replication$(EXESUF)
+check-unit-$(call land,$(CONFIG_BLOCK),$(CONFIG_REPLICATION)) += tests/test-replication$(EXESUF)
 check-unit-y += tests/test-bufferiszero$(EXESUF)
 check-unit-y += tests/test-uuid$(EXESUF)
 check-unit-y += tests/ptimer-test$(EXESUF)
@@ -496,11 +496,11 @@  test-qapi-obj-y = tests/test-qapi-types.o \
 	tests/test-qapi-visit-sub-sub-module.o \
 	tests/test-qapi-introspect.o \
 	$(test-qom-obj-y)
-benchmark-crypto-obj-y = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
-test-crypto-obj-y = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
-test-io-obj-y = $(io-obj-y) $(test-crypto-obj-y)
-test-authz-obj-y = $(test-qom-obj-y) $(authz-obj-y)
-test-block-obj-y = $(block-obj-y) $(test-io-obj-y) tests/iothread.o
+benchmark-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
+test-crypto-obj-$(CONFIG_BLOCK) = $(authz-obj-y) $(crypto-obj-y) $(test-qom-obj-y)
+test-io-obj-$(CONFIG_BLOCK) = $(io-obj-y) $(test-crypto-obj-y)
+test-authz-obj-$(CONFIG_BLOCK) = $(test-qom-obj-y) $(authz-obj-y)
+test-block-obj-$(CONFIG_BLOCK) = $(block-obj-y) $(test-io-obj-y) tests/iothread.o
 
 tests/check-qnum$(EXESUF): tests/check-qnum.o $(test-util-obj-y)
 tests/check-qstring$(EXESUF): tests/check-qstring.o $(test-util-obj-y)