Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
71ef18e1
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
71ef18e1
编写于
4月 28, 2011
作者:
A
Anthony Liguori
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'amitshah/for-anthony' into staging
上级
e77976a2
5c1c9bb2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
74 addition
and
15 deletion
+74
-15
hw/qdev-properties.c
hw/qdev-properties.c
+2
-2
hw/virtio-console.c
hw/virtio-console.c
+18
-0
hw/virtio-serial-bus.c
hw/virtio-serial-bus.c
+13
-10
qemu-char.c
qemu-char.c
+22
-2
qemu-char.h
qemu-char.h
+5
-1
spice-qemu-char.c
spice-qemu-char.c
+14
-0
未找到文件。
hw/qdev-properties.c
浏览文件 @
71ef18e1
...
...
@@ -354,10 +354,10 @@ static int parse_chr(DeviceState *dev, Property *prop, const char *str)
if
(
*
ptr
==
NULL
)
{
return
-
ENOENT
;
}
if
((
*
ptr
)
->
a
ssigned
)
{
if
((
*
ptr
)
->
a
vail_connections
<
1
)
{
return
-
EEXIST
;
}
(
*
ptr
)
->
assigned
=
1
;
--
(
*
ptr
)
->
avail_connections
;
return
0
;
}
...
...
hw/virtio-console.c
浏览文件 @
71ef18e1
...
...
@@ -28,6 +28,22 @@ static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
return
qemu_chr_write
(
vcon
->
chr
,
buf
,
len
);
}
/* Callback function that's called when the guest opens the port */
static
void
guest_open
(
VirtIOSerialPort
*
port
)
{
VirtConsole
*
vcon
=
DO_UPCAST
(
VirtConsole
,
port
,
port
);
qemu_chr_guest_open
(
vcon
->
chr
);
}
/* Callback function that's called when the guest closes the port */
static
void
guest_close
(
VirtIOSerialPort
*
port
)
{
VirtConsole
*
vcon
=
DO_UPCAST
(
VirtConsole
,
port
,
port
);
qemu_chr_guest_close
(
vcon
->
chr
);
}
/* Readiness of the guest to accept data on a port */
static
int
chr_can_read
(
void
*
opaque
)
{
...
...
@@ -64,6 +80,8 @@ static int generic_port_init(VirtConsole *vcon, VirtIOSerialPort *port)
qemu_chr_add_handlers
(
vcon
->
chr
,
chr_can_read
,
chr_read
,
chr_event
,
vcon
);
vcon
->
port
.
info
->
have_data
=
flush_buf
;
vcon
->
port
.
info
->
guest_open
=
guest_open
;
vcon
->
port
.
info
->
guest_close
=
guest_close
;
}
return
0
;
}
...
...
hw/virtio-serial-bus.c
浏览文件 @
71ef18e1
...
...
@@ -494,7 +494,7 @@ static void virtio_serial_save(QEMUFile *f, void *opaque)
VirtIOSerial
*
s
=
opaque
;
VirtIOSerialPort
*
port
;
uint32_t
nr_active_ports
;
unsigned
int
i
;
unsigned
int
i
,
max_nr_ports
;
/* The virtio device */
virtio_save
(
&
s
->
vdev
,
f
);
...
...
@@ -506,8 +506,8 @@ static void virtio_serial_save(QEMUFile *f, void *opaque)
qemu_put_be32s
(
f
,
&
s
->
config
.
max_nr_ports
);
/* The ports map */
for
(
i
=
0
;
i
<
(
s
->
config
.
max_nr_ports
+
31
)
/
32
;
i
++
)
{
max_nr_ports
=
tswap32
(
s
->
config
.
max_nr_ports
);
for
(
i
=
0
;
i
<
(
max_nr_ports
+
31
)
/
32
;
i
++
)
{
qemu_put_be32s
(
f
,
&
s
->
ports_map
[
i
]);
}
...
...
@@ -568,7 +568,8 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
qemu_get_be16s
(
f
,
&
s
->
config
.
rows
);
qemu_get_be32s
(
f
,
&
max_nr_ports
);
if
(
max_nr_ports
>
s
->
config
.
max_nr_ports
)
{
tswap32s
(
&
max_nr_ports
);
if
(
max_nr_ports
>
tswap32
(
s
->
config
.
max_nr_ports
))
{
/* Source could have had more ports than us. Fail migration. */
return
-
EINVAL
;
}
...
...
@@ -670,9 +671,10 @@ static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
/* This function is only used if a port id is not provided by the user */
static
uint32_t
find_free_port_id
(
VirtIOSerial
*
vser
)
{
unsigned
int
i
;
unsigned
int
i
,
max_nr_ports
;
for
(
i
=
0
;
i
<
(
vser
->
config
.
max_nr_ports
+
31
)
/
32
;
i
++
)
{
max_nr_ports
=
tswap32
(
vser
->
config
.
max_nr_ports
);
for
(
i
=
0
;
i
<
(
max_nr_ports
+
31
)
/
32
;
i
++
)
{
uint32_t
map
,
bit
;
map
=
vser
->
ports_map
[
i
];
...
...
@@ -720,7 +722,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
VirtIOSerialPort
*
port
=
DO_UPCAST
(
VirtIOSerialPort
,
dev
,
qdev
);
VirtIOSerialPortInfo
*
info
=
DO_UPCAST
(
VirtIOSerialPortInfo
,
qdev
,
base
);
VirtIOSerialBus
*
bus
=
DO_UPCAST
(
VirtIOSerialBus
,
qbus
,
qdev
->
parent_bus
);
int
ret
;
int
ret
,
max_nr_ports
;
bool
plugging_port0
;
port
->
vser
=
bus
->
vser
;
...
...
@@ -750,9 +752,10 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
}
}
if
(
port
->
id
>=
port
->
vser
->
config
.
max_nr_ports
)
{
max_nr_ports
=
tswap32
(
port
->
vser
->
config
.
max_nr_ports
);
if
(
port
->
id
>=
max_nr_ports
)
{
error_report
(
"virtio-serial-bus: Out-of-range port id specified, max. allowed: %u
\n
"
,
port
->
vser
->
config
.
max_nr_ports
-
1
);
max_nr_ports
-
1
);
return
-
1
;
}
...
...
@@ -863,7 +866,7 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *conf)
vser
->
ovqs
[
i
]
=
virtio_add_queue
(
vdev
,
128
,
handle_output
);
}
vser
->
config
.
max_nr_ports
=
conf
->
max_virtserial_ports
;
vser
->
config
.
max_nr_ports
=
tswap32
(
conf
->
max_virtserial_ports
)
;
vser
->
ports_map
=
qemu_mallocz
(((
conf
->
max_virtserial_ports
+
31
)
/
32
)
*
sizeof
(
vser
->
ports_map
[
0
]));
/*
...
...
qemu-char.c
浏览文件 @
71ef18e1
...
...
@@ -197,9 +197,9 @@ void qemu_chr_add_handlers(CharDriverState *s,
IOEventHandler
*
fd_event
,
void
*
opaque
)
{
if
(
!
opaque
)
{
if
(
!
opaque
&&
!
fd_can_read
&&
!
fd_read
&&
!
fd_event
)
{
/* chr driver being released. */
s
->
assigned
=
0
;
++
s
->
avail_connections
;
}
s
->
chr_can_read
=
fd_can_read
;
s
->
chr_read
=
fd_read
;
...
...
@@ -480,6 +480,9 @@ static CharDriverState *qemu_chr_open_mux(CharDriverState *drv)
chr
->
chr_write
=
mux_chr_write
;
chr
->
chr_update_read_handler
=
mux_chr_update_read_handler
;
chr
->
chr_accept_input
=
mux_chr_accept_input
;
/* Frontend guest-open / -close notification is not support with muxes */
chr
->
chr_guest_open
=
NULL
;
chr
->
chr_guest_close
=
NULL
;
/* Muxes are always open on creation */
qemu_chr_generic_open
(
chr
);
...
...
@@ -2544,7 +2547,10 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
snprintf
(
base
->
label
,
len
,
"%s-base"
,
qemu_opts_id
(
opts
));
chr
=
qemu_chr_open_mux
(
base
);
chr
->
filename
=
base
->
filename
;
chr
->
avail_connections
=
MAX_MUX
;
QTAILQ_INSERT_TAIL
(
&
chardevs
,
chr
,
next
);
}
else
{
chr
->
avail_connections
=
1
;
}
chr
->
label
=
qemu_strdup
(
qemu_opts_id
(
opts
));
return
chr
;
...
...
@@ -2579,6 +2585,20 @@ void qemu_chr_set_echo(struct CharDriverState *chr, bool echo)
}
}
void
qemu_chr_guest_open
(
struct
CharDriverState
*
chr
)
{
if
(
chr
->
chr_guest_open
)
{
chr
->
chr_guest_open
(
chr
);
}
}
void
qemu_chr_guest_close
(
struct
CharDriverState
*
chr
)
{
if
(
chr
->
chr_guest_close
)
{
chr
->
chr_guest_close
(
chr
);
}
}
void
qemu_chr_close
(
CharDriverState
*
chr
)
{
QTAILQ_REMOVE
(
&
chardevs
,
chr
,
next
);
...
...
qemu-char.h
浏览文件 @
71ef18e1
...
...
@@ -65,12 +65,14 @@ struct CharDriverState {
void
(
*
chr_close
)(
struct
CharDriverState
*
chr
);
void
(
*
chr_accept_input
)(
struct
CharDriverState
*
chr
);
void
(
*
chr_set_echo
)(
struct
CharDriverState
*
chr
,
bool
echo
);
void
(
*
chr_guest_open
)(
struct
CharDriverState
*
chr
);
void
(
*
chr_guest_close
)(
struct
CharDriverState
*
chr
);
void
*
opaque
;
QEMUBH
*
bh
;
char
*
label
;
char
*
filename
;
int
opened
;
int
a
ssigned
;
/* chardev assigned to a device */
int
a
vail_connections
;
QTAILQ_ENTRY
(
CharDriverState
)
next
;
};
...
...
@@ -79,6 +81,8 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
void
(
*
init
)(
struct
CharDriverState
*
s
));
CharDriverState
*
qemu_chr_open
(
const
char
*
label
,
const
char
*
filename
,
void
(
*
init
)(
struct
CharDriverState
*
s
));
void
qemu_chr_set_echo
(
struct
CharDriverState
*
chr
,
bool
echo
);
void
qemu_chr_guest_open
(
struct
CharDriverState
*
chr
);
void
qemu_chr_guest_close
(
struct
CharDriverState
*
chr
);
void
qemu_chr_close
(
CharDriverState
*
chr
);
void
qemu_chr_printf
(
CharDriverState
*
s
,
const
char
*
fmt
,
...)
GCC_FMT_ATTR
(
2
,
3
);
...
...
spice-qemu-char.c
浏览文件 @
71ef18e1
...
...
@@ -131,6 +131,18 @@ static void spice_chr_close(struct CharDriverState *chr)
qemu_free
(
s
);
}
static
void
spice_chr_guest_open
(
struct
CharDriverState
*
chr
)
{
SpiceCharDriver
*
s
=
chr
->
opaque
;
vmc_register_interface
(
s
);
}
static
void
spice_chr_guest_close
(
struct
CharDriverState
*
chr
)
{
SpiceCharDriver
*
s
=
chr
->
opaque
;
vmc_unregister_interface
(
s
);
}
static
void
print_allowed_subtypes
(
void
)
{
const
char
**
psubtype
;
...
...
@@ -183,6 +195,8 @@ CharDriverState *qemu_chr_open_spice(QemuOpts *opts)
chr
->
opaque
=
s
;
chr
->
chr_write
=
spice_chr_write
;
chr
->
chr_close
=
spice_chr_close
;
chr
->
chr_guest_open
=
spice_chr_guest_open
;
chr
->
chr_guest_close
=
spice_chr_guest_close
;
qemu_chr_generic_open
(
chr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录