Skip to content

Commit 831aaf2

Browse files
committed
Merge remote-tracking branch 'remotes/marcandre/tags/misc-pull-request' into staging
chardev & doc misc # gpg: Signature made Tue 14 Sep 2021 13:59:10 BST # gpg: using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5 # gpg: issuer "[email protected]" # gpg: Good signature from "Marc-André Lureau <[email protected]>" [full] # gpg: aka "Marc-André Lureau <[email protected]>" [full] # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * remotes/marcandre/tags/misc-pull-request: chardev: add some comments about the class methods chardev: remove needless class method chardev: Propagate error from logfile opening meson.build: fix comment typo docs: add supported host CPU architectures section Signed-off-by: Peter Maydell <[email protected]>
2 parents 4c9af1e + 78e3e1d commit 831aaf2

File tree

6 files changed

+73
-11
lines changed

6 files changed

+73
-11
lines changed

chardev/char-mux.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,9 @@ void suspend_mux_open(void)
386386
static int chardev_options_parsed_cb(Object *child, void *opaque)
387387
{
388388
Chardev *chr = (Chardev *)child;
389-
ChardevClass *class = CHARDEV_GET_CLASS(chr);
390389

391-
if (!chr->be_open && class->chr_options_parsed) {
392-
class->chr_options_parsed(chr);
390+
if (!chr->be_open && CHARDEV_IS_MUX(chr)) {
391+
open_muxes(chr);
393392
}
394393

395394
return 0;
@@ -412,7 +411,6 @@ static void char_mux_class_init(ObjectClass *oc, void *data)
412411
cc->chr_accept_input = mux_chr_accept_input;
413412
cc->chr_add_watch = mux_chr_add_watch;
414413
cc->chr_be_event = mux_chr_be_event;
415-
cc->chr_options_parsed = open_muxes;
416414
cc->chr_update_read_handler = mux_chr_update_read_handlers;
417415
}
418416

chardev/char.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,15 @@ static void qemu_char_open(Chardev *chr, ChardevBackend *backend,
241241
ChardevCommon *common = backend ? backend->u.null.data : NULL;
242242

243243
if (common && common->has_logfile) {
244-
int flags = O_WRONLY | O_CREAT;
244+
int flags = O_WRONLY;
245245
if (common->has_logappend &&
246246
common->logappend) {
247247
flags |= O_APPEND;
248248
} else {
249249
flags |= O_TRUNC;
250250
}
251-
chr->logfd = qemu_open_old(common->logfile, flags, 0666);
251+
chr->logfd = qemu_create(common->logfile, flags, 0666, errp);
252252
if (chr->logfd < 0) {
253-
error_setg_errno(errp, errno,
254-
"Unable to open logfile %s",
255-
common->logfile);
256253
return;
257254
}
258255
}

docs/about/build-platforms.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,39 @@ The `Repology`_ site is a useful resource to identify
2929
currently shipped versions of software in various operating systems,
3030
though it does not cover all distros listed below.
3131

32+
Supported host architectures
33+
----------------------------
34+
35+
Those hosts are officially supported, with various accelerators:
36+
37+
.. list-table::
38+
:header-rows: 1
39+
40+
* - CPU Architecture
41+
- Accelerators
42+
* - Arm
43+
- kvm (64 bit only), tcg, xen
44+
* - MIPS
45+
- kvm, tcg
46+
* - PPC
47+
- kvm, tcg
48+
* - RISC-V
49+
- tcg
50+
* - s390x
51+
- kvm, tcg
52+
* - SPARC
53+
- tcg
54+
* - x86
55+
- hax, hvf (64 bit only), kvm, nvmm, tcg, whpx (64 bit only), xen
56+
57+
Other host architectures are not supported. It is possible to build QEMU on an
58+
unsupported host architecture using the configure ``--enable-tcg-interpreter``
59+
option to enable the experimental TCI support, but note that this is very slow
60+
and is not recommended.
61+
62+
Non-supported architectures may be removed in the future following the
63+
:ref:`deprecation process<Deprecated features>`.
64+
3265
Linux OS, macOS, FreeBSD, NetBSD, OpenBSD
3366
-----------------------------------------
3467

docs/about/deprecated.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _Deprecated features:
2+
13
Deprecated features
24
===================
35

include/chardev/char.h

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,26 +254,58 @@ struct ChardevClass {
254254

255255
bool internal; /* TODO: eventually use TYPE_USER_CREATABLE */
256256
bool supports_yank;
257+
258+
/* parse command line options and populate QAPI @backend */
257259
void (*parse)(QemuOpts *opts, ChardevBackend *backend, Error **errp);
258260

261+
/* called after construction, open/starts the backend */
259262
void (*open)(Chardev *chr, ChardevBackend *backend,
260263
bool *be_opened, Error **errp);
261264

265+
/* write buf to the backend */
262266
int (*chr_write)(Chardev *s, const uint8_t *buf, int len);
267+
268+
/*
269+
* Read from the backend (blocking). A typical front-end will instead rely
270+
* on chr_can_read/chr_read being called when polling/looping.
271+
*/
263272
int (*chr_sync_read)(Chardev *s, const uint8_t *buf, int len);
273+
274+
/* create a watch on the backend */
264275
GSource *(*chr_add_watch)(Chardev *s, GIOCondition cond);
276+
277+
/* update the backend internal sources */
265278
void (*chr_update_read_handler)(Chardev *s);
279+
280+
/* send an ioctl to the backend */
266281
int (*chr_ioctl)(Chardev *s, int cmd, void *arg);
282+
283+
/* get ancillary-received fds during last read */
267284
int (*get_msgfds)(Chardev *s, int* fds, int num);
285+
286+
/* set ancillary fds to be sent with next write */
268287
int (*set_msgfds)(Chardev *s, int *fds, int num);
288+
289+
/* accept the given fd */
269290
int (*chr_add_client)(Chardev *chr, int fd);
291+
292+
/* wait for a connection */
270293
int (*chr_wait_connected)(Chardev *chr, Error **errp);
294+
295+
/* disconnect a connection */
271296
void (*chr_disconnect)(Chardev *chr);
297+
298+
/* called by frontend when it can read */
272299
void (*chr_accept_input)(Chardev *chr);
300+
301+
/* set terminal echo */
273302
void (*chr_set_echo)(Chardev *chr, bool echo);
303+
304+
/* notify the backend of frontend open state */
274305
void (*chr_set_fe_open)(Chardev *chr, int fe_open);
306+
307+
/* handle various events */
275308
void (*chr_be_event)(Chardev *s, QEMUChrEvent event);
276-
void (*chr_options_parsed)(Chardev *chr);
277309
};
278310

279311
Chardev *qemu_chardev_new(const char *id, const char *typename,

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ endif
7878

7979
accelerator_targets = { 'CONFIG_KVM': kvm_targets }
8080
if cpu in ['x86', 'x86_64', 'arm', 'aarch64']
81-
# i368 emulator provides xenpv machine type for multiple architectures
81+
# i386 emulator provides xenpv machine type for multiple architectures
8282
accelerator_targets += {
8383
'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'],
8484
}

0 commit comments

Comments
 (0)