[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Redesign of QEMU startup & initial configuration
From: |
Paolo Bonzini |
Subject: |
Re: Redesign of QEMU startup & initial configuration |
Date: |
Fri, 10 Dec 2021 16:38:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 |
On 12/10/21 14:54, Markus Armbruster wrote:
I want an open path to a single binary. Taking years to get there is
fine.
The single binary is a distraction in my opinion. Imagine
instead of vl.c you have this in your second binary:
/*
* This copyright line means that at some point the below actually compiled
* in my tree (though it was only a stub); I am not fully making it up.
*
* Copyright (c) 2020 Red Hat, Inc.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "qemu/osdep.h"
#include "qemu/rcu.h"
#include "qemu-common.h"
#include "chardev/char.h"
#include "monitor/monitor.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-ui.h"
#include "qemu/systemd.h"
#include "sysemu/cpu-timers.h"
#include "sysemu/sysemu.h"
#include "ui/console.h"
#include "hw/qdev-core.h"
static void open_socket_and_monitor(void)
{
int nfds = check_socket_activation();
Chardev *chardev;
if (nfds > 1) {
error_report("QEMU only supports listening on one socket");
exit(1);
}
if (!nfds) {
ChardevBackend backend = {
.type = CHARDEV_BACKEND_KIND_STDIO,
.u.stdio.data = &(ChardevStdio) {
.has_signal = true,
.signal = false
}
};
chardev = qemu_chardev_new("#qmp0", TYPE_CHARDEV_STDIO, &backend, NULL,
&error_fatal);
} else {
ChardevBackend backend = {
.type = CHARDEV_BACKEND_KIND_SOCKET,
.u.socket.data = &(ChardevSocket) {
.addr = &(SocketAddressLegacy) {
.type = SOCKET_ADDRESS_LEGACY_KIND_FD,
.u.fd.data = &(String){
.str = (char *) stringify(FIRST_SOCKET_ACTIVATION_FD)
}
}
}
};
chardev = qemu_chardev_new("#qmp0", TYPE_CHARDEV_SOCKET, &backend, NULL,
&error_fatal);
}
monitor_init_qmp(chardev, true, &error_fatal);
}
void qemu_init(int argc, char **argv, char **envp)
{
error_init(argv[0]);
qemu_init_exec_dir(argv[0]);
qemu_init_subsystems();
/* Missing: parse -name, -sandbox, -trace, -L */
loc_set_none();
rcu_disable_atfork();
qemu_init_main_loop(&error_fatal);
cpu_timers_init();
open_socket_and_monitor();
init_displaystate();
os_setup_signal_handling();
}
This is the ultimate QEMU startup code. If we can get this code to
actually build a machine, you've reached the point where you don't care
about what is in the command line parser; and consequently you don't care
if there is one binary or two.
Paolo
- Re: Redesign of QEMU startup & initial configuration, (continued)
- Re: Redesign of QEMU startup & initial configuration, Daniel P . Berrangé, 2021/12/14
- Re: Redesign of QEMU startup & initial configuration, Mark Burton, 2021/12/14
- Re: Redesign of QEMU startup & initial configuration, Daniel P . Berrangé, 2021/12/14
- Re: Redesign of QEMU startup & initial configuration, Mark Burton, 2021/12/14
- Re: Redesign of QEMU startup & initial configuration, Daniel P . Berrangé, 2021/12/14
- Re: Redesign of QEMU startup & initial configuration, Mark Burton, 2021/12/14
- Re: Redesign of QEMU startup & initial configuration, Daniel P . Berrangé, 2021/12/14
- Re: Redesign of QEMU startup & initial configuration, Markus Armbruster, 2021/12/14
- Re: Redesign of QEMU startup & initial configuration, Mark Burton, 2021/12/14
Re: Redesign of QEMU startup & initial configuration, Markus Armbruster, 2021/12/10
- Re: Redesign of QEMU startup & initial configuration,
Paolo Bonzini <=
- Re: Redesign of QEMU startup & initial configuration, Markus Armbruster, 2021/12/13
- Re: Redesign of QEMU startup & initial configuration, Paolo Bonzini, 2021/12/13
- Re: Redesign of QEMU startup & initial configuration, Daniel P . Berrangé, 2021/12/13
- Re: Redesign of QEMU startup & initial configuration, Paolo Bonzini, 2021/12/13
- Re: Redesign of QEMU startup & initial configuration, Daniel P . Berrangé, 2021/12/13
- Meeting today?, Mark Burton, 2021/12/14
- Re: Meeting today?, Markus Armbruster, 2021/12/14
- Re: Meeting today?, Mark Burton, 2021/12/14
- Re: Meeting today?, Daniel P . Berrangé, 2021/12/14
- Re: Meeting today?, Markus Armbruster, 2021/12/14