qemu-e2k/qapi/meson.build
Andrew Melnychenko e88899fa90 qmp: Added new command to retrieve eBPF blob.
Now, the binary objects may be retrieved by id.
It would require for future qmp commands that may require specific
eBPF blob.

Added command "request-ebpf". This command returns
eBPF program encoded base64. The program taken from the
skeleton and essentially is an ELF object that can be
loaded in the future with libbpf.

The reason to use the command to provide the eBPF object
instead of a separate artifact was to avoid issues related
to finding the eBPF itself. eBPF object is an ELF binary
that contains the eBPF program and eBPF map description(BTF).
Overall, eBPF object should contain the program and enough
metadata to create/load eBPF with libbpf. As the eBPF
maps/program should correspond to QEMU, the eBPF can't
be used from different QEMU build.

The first solution was a helper that comes with QEMU
and loads appropriate eBPF objects. And the issue is
to find a proper helper if the system has several
different QEMUs installed and/or built from the source,
which helpers may not be compatible.

Another issue is QEMU updating while there is a running
QEMU instance. With an updated helper, it may not be
possible to hotplug virtio-net device to the already
running QEMU. Overall, requesting the eBPF object from
QEMU itself solves possible failures with acceptable effort.

Links:
[PATCH 3/5] qmp: Added the helper stamp check.
https://lore.kernel.org/all/20230219162100.174318-4-andrew@daynix.com/

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2024-03-12 19:31:47 +08:00

149 lines
3.3 KiB
Meson

util_ss.add(files(
'opts-visitor.c',
'qapi-clone-visitor.c',
'qapi-dealloc-visitor.c',
'qapi-forward-visitor.c',
'qapi-util.c',
'qapi-visit-core.c',
'qobject-input-visitor.c',
'qobject-output-visitor.c',
'string-input-visitor.c',
'string-output-visitor.c',
))
if have_system
util_ss.add(files('qapi-type-helpers.c'))
endif
if have_system or have_tools or have_ga
util_ss.add(files(
'qmp-dispatch.c',
'qmp-event.c',
'qmp-registry.c',
))
endif
qapi_all_modules = [
'authz',
'block',
'block-core',
'block-export',
'char',
'common',
'compat',
'control',
'crypto',
'cxl',
'dump',
'ebpf',
'error',
'introspect',
'job',
'machine-common',
'machine',
'machine-target',
'migration',
'misc',
'misc-target',
'net',
'pragma',
'qom',
'replay',
'run-state',
'sockets',
'stats',
'trace',
'transaction',
'virtio',
'yank',
]
if have_system
qapi_all_modules += [
'acpi',
'audio',
'cryptodev',
'qdev',
'pci',
'rdma',
'rocker',
'tpm',
]
endif
if have_system or have_tools
qapi_all_modules += [
'ui',
]
endif
qapi_nonmodule_outputs = [
'qapi-introspect.c', 'qapi-introspect.h',
'qapi-types.c', 'qapi-types.h',
'qapi-visit.h', 'qapi-visit.c',
'qapi-commands.h', 'qapi-commands.c',
'qapi-init-commands.h', 'qapi-init-commands.c',
'qapi-events.h', 'qapi-events.c',
'qapi-emit-events.c', 'qapi-emit-events.h',
]
# First build all sources
qapi_util_outputs = [
'qapi-builtin-types.c', 'qapi-builtin-visit.c',
'qapi-builtin-types.h', 'qapi-builtin-visit.h',
]
qapi_inputs = []
qapi_specific_outputs = []
foreach module : qapi_all_modules
qapi_inputs += [ files(module + '.json') ]
qapi_module_outputs = [
'qapi-types-@0@.c'.format(module),
'qapi-types-@0@.h'.format(module),
'qapi-visit-@0@.c'.format(module),
'qapi-visit-@0@.h'.format(module),
]
if have_system or have_tools
qapi_module_outputs += [
'qapi-events-@0@.c'.format(module),
'qapi-events-@0@.h'.format(module),
'qapi-commands-@0@.c'.format(module),
'qapi-commands-@0@.h'.format(module),
'qapi-commands-@0@.trace-events'.format(module),
]
endif
if module.endswith('-target')
qapi_specific_outputs += qapi_module_outputs
else
qapi_util_outputs += qapi_module_outputs
endif
endforeach
qapi_files = custom_target('shared QAPI source files',
output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outputs,
input: [ files('qapi-schema.json') ],
command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ],
depend_files: [ qapi_inputs, qapi_gen_depends ])
# Now go through all the outputs and add them to the right sourceset.
# These loops must be synchronized with the output of the above custom target.
i = 0
foreach output : qapi_util_outputs
if output.endswith('.h')
genh += qapi_files[i]
endif
if output.endswith('.trace-events')
qapi_trace_events += qapi_files[i]
endif
util_ss.add(qapi_files[i])
i = i + 1
endforeach
foreach output : qapi_specific_outputs + qapi_nonmodule_outputs
if output.endswith('.h')
genh += qapi_files[i]
endif
if output.endswith('.trace-events')
qapi_trace_events += qapi_files[i]
endif
specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: qapi_files[i])
i = i + 1
endforeach