On Wed, Apr 22, 2020 at 09:13:45PM -0700, elena.ufimtseva@oracle.com wrote: > From: Jagannathan Raman > > Modify Makefile to support the building of the remote > device process. Implements main() function of remote > device process. > > Signed-off-by: John G Johnson > Signed-off-by: Jagannathan Raman > Signed-off-by: Elena Ufimtseva > --- > MAINTAINERS | 8 ++++++ > Makefile | 2 ++ > Makefile.objs | 27 ++++++++++++++++++ > Makefile.target | 61 ++++++++++++++++++++++++++++++++++++++++- > accel/Makefile.objs | 2 ++ > backends/Makefile.objs | 2 ++ > block/Makefile.objs | 2 ++ > hw/Makefile.objs | 7 +++++ > hw/block/Makefile.objs | 2 ++ > hw/core/Makefile.objs | 18 ++++++++++++ > hw/nvram/Makefile.objs | 2 ++ > hw/pci/Makefile.objs | 4 +++ > hw/scsi/Makefile.objs | 2 ++ > migration/Makefile.objs | 2 ++ > qom/Makefile.objs | 3 ++ > remote/Makefile.objs | 1 + > remote/remote-main.c | 23 ++++++++++++++++ > stubs/replay.c | 4 +++ > 18 files changed, 171 insertions(+), 1 deletion(-) > create mode 100644 remote/Makefile.objs > create mode 100644 remote/remote-main.c This approach is okay for now but will result in a lot of Makefile duplication in the long run. Each hw .o file should specify its dependencies so that qemu-system-* and the remote executable can link in the needed files. The Kconfig system can also help with this by enabling/disabling features. Then the Makefiles don't need to duplicate *-obj-y and remote-pci-*. > diff --git a/Makefile.objs b/Makefile.objs > index f29c60c59d..f6654633b4 100644 > --- a/Makefile.objs > +++ b/Makefile.objs > @@ -21,6 +21,33 @@ block-obj-$(CONFIG_REPLICATION) += replication.o > > block-obj-m = block/ > > +######################################################### > +# remote-pci-obj-y is common code used by remote devices > + > +remote-pci-obj-$(CONFIG_MPQEMU) += hw/ > +remote-pci-obj-$(CONFIG_MPQEMU) += qom/ > +remote-pci-obj-$(CONFIG_MPQEMU) += backends/ > +remote-pci-obj-$(CONFIG_MPQEMU) += block/ > +remote-pci-obj-$(CONFIG_MPQEMU) += migration/ In the future migration can be split into the QEMU and remote parts. The remote executable doesn't need all the live migration code. > +remote-pci-obj-$(CONFIG_MPQEMU) += remote/ > +remote-pci-obj-$(CONFIG_MPQEMU) += accel/ Devices do not execute guest code so they should not need accel/. kvm and tcg functions were stubbed out earlier in this patch series, so I'm surprised to see thing being built into the remote executable. > @@ -121,6 +131,20 @@ LIBS := $(libs_cpu) $(LIBS) > > obj-$(CONFIG_PLUGIN) += plugins/ > > +ifeq ($(TARGET_NAME)-$(CONFIG_MPQEMU)-$(CONFIG_USER_ONLY), x86_64-y-) > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += accel/stubs/kvm-stub.o > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += accel/stubs/tcg-stub.o > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += accel/stubs/hax-stub.o > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += accel/stubs/whpx-stub.o > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += stubs/vl-stub.o > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += stubs/net-stub.o > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += stubs/monitor.o > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += stubs/replay.o > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += stubs/xen-mapcache.o > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += stubs/audio.o > +remote-pci-tgt-obj-$(CONFIG_MPQEMU) += stubs/monitor.o > +endif Stubs don't need to be explicitly included, they should be linked in via libqemustub.a. > diff --git a/remote/remote-main.c b/remote/remote-main.c > new file mode 100644 > index 0000000000..7c0764ad01 > --- /dev/null > +++ b/remote/remote-main.c > @@ -0,0 +1,23 @@ > +/* > + * Remote device initialization > + * > + * Copyright © 2018, 2020 Oracle and/or its affiliates. > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or later. > + * See the COPYING file in the top-level directory. > + * > + */ > + > +#include "qemu/osdep.h" > +#include "qemu-common.h" > + > +#include This is already included by "qemu/osdep.h" > + > +#include "qemu/module.h" > + > +int main(int argc, char *argv[]) > +{ > + module_call_init(MODULE_INIT_QOM); > + > + return 0; > +} > diff --git a/stubs/replay.c b/stubs/replay.c > index 2e3feee6a9..9b53c0cb37 100644 > --- a/stubs/replay.c > +++ b/stubs/replay.c > @@ -102,3 +102,7 @@ int replay_get_instructions(void) > void replay_account_executed_instructions(void) > { > } > + > +void replay_add_blocker(Error *reason) > +{ > +} This can be moved to the stubs patch.