Compare commits
285 Commits
pull-vnc-1
...
pull-gtk-3
Author | SHA1 | Date | |
---|---|---|---|
|
2bda66028b | ||
|
298526fe92 | ||
|
881249c792 | ||
|
f4b11eee2f | ||
|
6fffa26244 | ||
|
e638308097 | ||
|
9c749e4dbe | ||
|
379e21c258 | ||
|
a00f66ab9b | ||
|
69df1c3c9d | ||
|
6d4adef48d | ||
|
3b163b0165 | ||
|
f214530f56 | ||
|
9d5614d582 | ||
|
39d16d29c8 | ||
|
cc13eead53 | ||
|
86c3b20a5f | ||
|
6d585ca559 | ||
|
dfb3804d47 | ||
|
4191d0eb41 | ||
|
03d51428e2 | ||
|
582ab779c5 | ||
|
8678b71ce6 | ||
|
1fcc9ddfb3 | ||
|
c6e929e784 | ||
|
b3c56df769 | ||
|
ed7a0aa8bc | ||
|
04ce397b33 | ||
|
14b155ddc4 | ||
|
e029f29385 | ||
|
90f1cd9138 | ||
|
7d11fc7c2b | ||
|
096c46c0ff | ||
|
df9351e372 | ||
|
50573c66eb | ||
|
46dea4160d | ||
|
dc668ded10 | ||
|
1e8ece0db3 | ||
|
4a41a2d68a | ||
|
62e466e845 | ||
|
c3adb58fe0 | ||
|
aa7a6a399f | ||
|
2e323f03bf | ||
|
22956a3755 | ||
|
5d92c74f8a | ||
|
b19fc63cad | ||
|
90c5d39cb8 | ||
|
01c22f2cdd | ||
|
cb201b4872 | ||
|
f33f991185 | ||
|
be21c33616 | ||
|
8bf0975902 | ||
|
7effdaa321 | ||
|
d44229c54f | ||
|
d0b2542574 | ||
|
4c1410d59c | ||
|
bbbd67f0cc | ||
|
2ef1f68d4f | ||
|
0c591eb0a9 | ||
|
00c8cb0a36 | ||
|
31b030d4ab | ||
|
0063ebd6ac | ||
|
0dd106c5f0 | ||
|
a47dddd734 | ||
|
d7f0a59ff0 | ||
|
bb0e627a84 | ||
|
baea4fae7b | ||
|
0ea8cb8895 | ||
|
b3310ab338 | ||
|
75a34036d4 | ||
|
d0e39c5d70 | ||
|
611d4f996f | ||
|
648f034c6c | ||
|
90b40a696a | ||
|
239c51a54f | ||
|
74f10515d1 | ||
|
3f38f309b2 | ||
|
5638d180d6 | ||
|
d5a11fefef | ||
|
f0c3c505a8 | ||
|
ff4700b05c | ||
|
0429a97195 | ||
|
27103424c4 | ||
|
6f03bef0ff | ||
|
8cd70437f3 | ||
|
28ecfd7a62 | ||
|
efee734004 | ||
|
99df7dce8a | ||
|
93afeade09 | ||
|
7510454e3e | ||
|
7372c2b926 | ||
|
9262685b81 | ||
|
1590bbcb02 | ||
|
247bf011f6 | ||
|
433ac7a968 | ||
|
db5d39f786 | ||
|
94a444b295 | ||
|
d940ee9b78 | ||
|
500050d1e0 | ||
|
ef02ef5f45 | ||
|
8fb4f821e9 | ||
|
5fcca9ff3b | ||
|
74f54bc4ba | ||
|
9576de7573 | ||
|
285f025d2c | ||
|
c080e30ec8 | ||
|
8c2e1b0093 | ||
|
1cf5ccbca8 | ||
|
62864712b3 | ||
|
2fad1112db | ||
|
2efc6be2ea | ||
|
33276f1b9c | ||
|
19d6ca16d9 | ||
|
70d74660e7 | ||
|
d2810ffd34 | ||
|
9d111183d5 | ||
|
4a9a1f49c5 | ||
|
57fac92c2d | ||
|
41975b269c | ||
|
57ed25b1b0 | ||
|
cc28c6aa46 | ||
|
18fa1c42a3 | ||
|
d3f4984583 | ||
|
7af803d4f8 | ||
|
f988388025 | ||
|
9562f69cfd | ||
|
27eb6c097c | ||
|
d475e5acd2 | ||
|
dc3dd0d2be | ||
|
88eb7c29e4 | ||
|
48ff269272 | ||
|
6e4a876b43 | ||
|
7d1de46448 | ||
|
be8d853766 | ||
|
98563fc3ec | ||
|
2da61b671e | ||
|
11f590b1a2 | ||
|
b5042a3622 | ||
|
98d39e34fe | ||
|
938789ea92 | ||
|
dba2855572 | ||
|
3456a8d185 | ||
|
26d49c4675 | ||
|
be86c53c05 | ||
|
c8d146aecc | ||
|
0100f42550 | ||
|
ac1b84dd1e | ||
|
295d51aa6a | ||
|
c6ba42f6bc | ||
|
fb0e843a11 | ||
|
8f3babb74d | ||
|
7a1a4dac94 | ||
|
602a3921ff | ||
|
f8762027a3 | ||
|
d2f69df746 | ||
|
5c21ce77d7 | ||
|
02e7f85dac | ||
|
04e9a20b49 | ||
|
2ef66625f3 | ||
|
0399a3819b | ||
|
6e8114a065 | ||
|
aa97405e32 | ||
|
26c9a015ef | ||
|
b6f46f02f4 | ||
|
02063aaa65 | ||
|
c7a59bed62 | ||
|
83bb0b2ffd | ||
|
dc06cbd286 | ||
|
0056ae24bc | ||
|
261747f176 | ||
|
36d20cb2b3 | ||
|
49649f23db | ||
|
a3d7cbc139 | ||
|
1b8601b0ea | ||
|
cdccf7d7e7 | ||
|
1f760d5f2b | ||
|
7c77b654c5 | ||
|
5ef4a1c304 | ||
|
d43269dddc | ||
|
1a7d9ee6dd | ||
|
a01aedc8d3 | ||
|
7b0309490c | ||
|
267a3264cd | ||
|
2b81b35f8f | ||
|
750036a848 | ||
|
2f23e9ae2c | ||
|
21143b615a | ||
|
fd3ece2533 | ||
|
a822837d12 | ||
|
01ac27ce7f | ||
|
84f3fe1b07 | ||
|
2c3445bb85 | ||
|
7602e3e4a3 | ||
|
613c12ec28 | ||
|
d58b912271 | ||
|
7f5e07d9b3 | ||
|
dc9528fdf9 | ||
|
68e5ec6400 | ||
|
5c1e1890bf | ||
|
c2804ee6c0 | ||
|
16c358e96e | ||
|
be813ef02d | ||
|
2396187076 | ||
|
01207d0b78 | ||
|
0ca540dbae | ||
|
2a7a1a56d1 | ||
|
5d371f41b4 | ||
|
5223070c47 | ||
|
59ca664ef8 | ||
|
bceae7697f | ||
|
b0b58195e4 | ||
|
6299659f54 | ||
|
b86b05ed60 | ||
|
515b943a91 | ||
|
4b35991a3b | ||
|
dad1fcab91 | ||
|
ed9b103d3e | ||
|
c57ec3249e | ||
|
13f65b2e10 | ||
|
b4e5a4bffd | ||
|
263cf4367f | ||
|
dc65540465 | ||
|
ac41881b48 | ||
|
fe6c53b4bb | ||
|
b0f15a5d56 | ||
|
118760dfc9 | ||
|
b304bf0021 | ||
|
3f1506704e | ||
|
0c126db27c | ||
|
72c1d3af6e | ||
|
2b194951c5 | ||
|
c8f8f9fb2b | ||
|
d2f41a1169 | ||
|
43a32ed68f | ||
|
b29c8f115d | ||
|
0624976f61 | ||
|
7c2cb42b50 | ||
|
af5199347a | ||
|
c9dd4074df | ||
|
9b74d0d598 | ||
|
4b87dc4c97 | ||
|
dbb2a1326a | ||
|
c3aa84b68f | ||
|
e9d818b8b1 | ||
|
cbc14e6f28 | ||
|
16513b1b45 | ||
|
5264917bcf | ||
|
98bc3ab0f2 | ||
|
220c8ed536 | ||
|
f1b7e0e498 | ||
|
175f099b30 | ||
|
15d914b18d | ||
|
262f6f5140 | ||
|
4a4fcdf6df | ||
|
4900116e6f | ||
|
8f480de0c9 | ||
|
5d12f961c6 | ||
|
6e1f0a55a1 | ||
|
8e46bbf362 | ||
|
ddfa83ea06 | ||
|
6cb46e1e90 | ||
|
8dcf525abc | ||
|
f8e2484389 | ||
|
523fdc08cc | ||
|
017a86f7ad | ||
|
2e796c7621 | ||
|
8d8db193f2 | ||
|
a51a6b6ad5 | ||
|
f029341494 | ||
|
7763ffa017 | ||
|
3353d0dcc3 | ||
|
82295d8a2d | ||
|
464400f6a5 | ||
|
4fed9421e9 | ||
|
ac4df4e608 | ||
|
fd8cec932c | ||
|
b51910baf2 | ||
|
974a196d7f | ||
|
f19e00d776 | ||
|
76ca310a19 | ||
cd98d390ae | |||
|
8a3ae9109e | ||
|
4cf2348026 | ||
|
f9a49dfa02 | ||
|
9ba3cf540f |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -21,6 +21,7 @@
|
|||||||
libdis*
|
libdis*
|
||||||
libuser
|
libuser
|
||||||
/linux-headers/asm
|
/linux-headers/asm
|
||||||
|
/qga/qapi-generated
|
||||||
/qapi-generated
|
/qapi-generated
|
||||||
/qapi-types.[ch]
|
/qapi-types.[ch]
|
||||||
/qapi-visit.[ch]
|
/qapi-visit.[ch]
|
||||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -13,6 +13,9 @@
|
|||||||
[submodule "roms/openbios"]
|
[submodule "roms/openbios"]
|
||||||
path = roms/openbios
|
path = roms/openbios
|
||||||
url = git://git.qemu-project.org/openbios.git
|
url = git://git.qemu-project.org/openbios.git
|
||||||
|
[submodule "roms/openhackware"]
|
||||||
|
path = roms/openhackware
|
||||||
|
url = git://git.qemu-project.org/openhackware.git
|
||||||
[submodule "roms/qemu-palcode"]
|
[submodule "roms/qemu-palcode"]
|
||||||
path = roms/qemu-palcode
|
path = roms/qemu-palcode
|
||||||
url = git://github.com/rth7680/qemu-palcode.git
|
url = git://github.com/rth7680/qemu-palcode.git
|
||||||
|
19
.travis.yml
19
.travis.yml
@@ -4,6 +4,12 @@ python:
|
|||||||
compiler:
|
compiler:
|
||||||
- gcc
|
- gcc
|
||||||
- clang
|
- clang
|
||||||
|
notifications:
|
||||||
|
irc:
|
||||||
|
channels:
|
||||||
|
- "irc.oftc.net#qemu"
|
||||||
|
on_success: change
|
||||||
|
on_failure: always
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- TEST_CMD="make check"
|
- TEST_CMD="make check"
|
||||||
@@ -46,6 +52,10 @@ matrix:
|
|||||||
- env: TARGETS=i386-softmmu,x86_64-softmmu
|
- env: TARGETS=i386-softmmu,x86_64-softmmu
|
||||||
EXTRA_CONFIG="--enable-debug --enable-tcg-interpreter"
|
EXTRA_CONFIG="--enable-debug --enable-tcg-interpreter"
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
|
# All the extra -dev packages
|
||||||
|
- env: TARGETS=i386-softmmu,x86_64-softmmu
|
||||||
|
EXTRA_PKGS="libaio-dev libcap-ng-dev libattr1-dev libbrlapi-dev uuid-dev libusb-1.0.0-dev"
|
||||||
|
compiler: gcc
|
||||||
# Currently configure doesn't force --disable-pie
|
# Currently configure doesn't force --disable-pie
|
||||||
- env: TARGETS=i386-softmmu,x86_64-softmmu
|
- env: TARGETS=i386-softmmu,x86_64-softmmu
|
||||||
EXTRA_CONFIG="--enable-gprof --enable-gcov --disable-pie"
|
EXTRA_CONFIG="--enable-gprof --enable-gcov --disable-pie"
|
||||||
@@ -65,8 +75,7 @@ matrix:
|
|||||||
EXTRA_CONFIG="--enable-trace-backend=ftrace"
|
EXTRA_CONFIG="--enable-trace-backend=ftrace"
|
||||||
TEST_CMD=""
|
TEST_CMD=""
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
# This disabled make check for the ftrace backend which needs more setting up
|
- env: TARGETS=i386-softmmu,x86_64-softmmu
|
||||||
# Currently broken on 12.04 due to mis-packaged liburcu and changed API, will be pulled.
|
EXTRA_PKGS="liblttng-ust-dev liburcu-dev"
|
||||||
#- env: TARGETS=i386-softmmu,x86_64-softmmu
|
EXTRA_CONFIG="--enable-trace-backend=ust"
|
||||||
# EXTRA_PKGS="liblttng-ust-dev liburcu-dev"
|
compiler: gcc
|
||||||
# EXTRA_CONFIG="--enable-trace-backend=ust"
|
|
||||||
|
@@ -158,7 +158,6 @@ Guest CPU Cores (KVM):
|
|||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
Overall
|
Overall
|
||||||
M: Gleb Natapov <gleb@redhat.com>
|
|
||||||
M: Paolo Bonzini <pbonzini@redhat.com>
|
M: Paolo Bonzini <pbonzini@redhat.com>
|
||||||
L: kvm@vger.kernel.org
|
L: kvm@vger.kernel.org
|
||||||
S: Supported
|
S: Supported
|
||||||
@@ -176,12 +175,14 @@ S: Maintained
|
|||||||
F: target-ppc/kvm.c
|
F: target-ppc/kvm.c
|
||||||
|
|
||||||
S390
|
S390
|
||||||
|
M: Christian Borntraeger <borntraeger@de.ibm.com>
|
||||||
|
M: Cornelia Huck <cornelia.huck@de.ibm.com>
|
||||||
M: Alexander Graf <agraf@suse.de>
|
M: Alexander Graf <agraf@suse.de>
|
||||||
S: Maintained
|
S: Maintained
|
||||||
F: target-s390x/kvm.c
|
F: target-s390x/kvm.c
|
||||||
|
F: hw/intc/s390_flic.[hc]
|
||||||
|
|
||||||
X86
|
X86
|
||||||
M: Gleb Natapov <gleb@redhat.com>
|
|
||||||
M: Marcelo Tosatti <mtosatti@redhat.com>
|
M: Marcelo Tosatti <mtosatti@redhat.com>
|
||||||
L: kvm@vger.kernel.org
|
L: kvm@vger.kernel.org
|
||||||
S: Supported
|
S: Supported
|
||||||
@@ -495,10 +496,13 @@ F: hw/s390x/s390-*.c
|
|||||||
|
|
||||||
S390 Virtio-ccw
|
S390 Virtio-ccw
|
||||||
M: Cornelia Huck <cornelia.huck@de.ibm.com>
|
M: Cornelia Huck <cornelia.huck@de.ibm.com>
|
||||||
|
M: Christian Borntraeger <borntraeger@de.ibm.com>
|
||||||
M: Alexander Graf <agraf@suse.de>
|
M: Alexander Graf <agraf@suse.de>
|
||||||
S: Supported
|
S: Supported
|
||||||
F: hw/s390x/s390-virtio-ccw.c
|
F: hw/s390x/s390-virtio-ccw.c
|
||||||
F: hw/s390x/css.[hc]
|
F: hw/s390x/css.[hc]
|
||||||
|
F: hw/s390x/sclp*.[hc]
|
||||||
|
F: hw/s390x/ipl*.[hc]
|
||||||
T: git git://github.com/cohuck/qemu virtio-ccw-upstr
|
T: git git://github.com/cohuck/qemu virtio-ccw-upstr
|
||||||
|
|
||||||
UniCore32 Machines
|
UniCore32 Machines
|
||||||
@@ -629,6 +633,7 @@ F: hw/block/virtio-blk.c
|
|||||||
|
|
||||||
virtio-ccw
|
virtio-ccw
|
||||||
M: Cornelia Huck <cornelia.huck@de.ibm.com>
|
M: Cornelia Huck <cornelia.huck@de.ibm.com>
|
||||||
|
M: Christian Borntraeger <borntraeger@de.ibm.com>
|
||||||
S: Supported
|
S: Supported
|
||||||
F: hw/s390x/virtio-ccw.[hc]
|
F: hw/s390x/virtio-ccw.[hc]
|
||||||
T: git git://github.com/cohuck/qemu virtio-ccw-upstr
|
T: git git://github.com/cohuck/qemu virtio-ccw-upstr
|
||||||
|
5
Makefile
5
Makefile
@@ -265,10 +265,7 @@ clean:
|
|||||||
# avoid old build problems by removing potentially incorrect old files
|
# avoid old build problems by removing potentially incorrect old files
|
||||||
rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
|
rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
|
||||||
rm -f qemu-options.def
|
rm -f qemu-options.def
|
||||||
find . -name '*.[oda]' -type f -exec rm -f {} +
|
find . \( -name '*.l[oa]' -o -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
|
||||||
find . -name '*.l[oa]' -type f -exec rm -f {} +
|
|
||||||
find . -name '*$(DSOSUF)' -type f -exec rm -f {} +
|
|
||||||
find . -name '*.mo' -type f -exec rm -f {} +
|
|
||||||
rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
|
rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
|
||||||
rm -f fsdev/*.pod
|
rm -f fsdev/*.pod
|
||||||
rm -rf .libs */.libs
|
rm -rf .libs */.libs
|
||||||
|
@@ -39,6 +39,7 @@ libcacard-y += libcacard/vcardt.o
|
|||||||
|
|
||||||
ifeq ($(CONFIG_SOFTMMU),y)
|
ifeq ($(CONFIG_SOFTMMU),y)
|
||||||
common-obj-y = blockdev.o blockdev-nbd.o block/
|
common-obj-y = blockdev.o blockdev-nbd.o block/
|
||||||
|
common-obj-y += iothread.o
|
||||||
common-obj-y += net/
|
common-obj-y += net/
|
||||||
common-obj-y += qdev-monitor.o device-hotplug.o
|
common-obj-y += qdev-monitor.o device-hotplug.o
|
||||||
common-obj-$(CONFIG_WIN32) += os-win32.o
|
common-obj-$(CONFIG_WIN32) += os-win32.o
|
||||||
|
52
arch_init.c
52
arch_init.c
@@ -164,8 +164,9 @@ static struct {
|
|||||||
uint8_t *encoded_buf;
|
uint8_t *encoded_buf;
|
||||||
/* buffer for storing page content */
|
/* buffer for storing page content */
|
||||||
uint8_t *current_buf;
|
uint8_t *current_buf;
|
||||||
/* Cache for XBZRLE */
|
/* Cache for XBZRLE, Protected by lock. */
|
||||||
PageCache *cache;
|
PageCache *cache;
|
||||||
|
QemuMutex lock;
|
||||||
} XBZRLE = {
|
} XBZRLE = {
|
||||||
.encoded_buf = NULL,
|
.encoded_buf = NULL,
|
||||||
.current_buf = NULL,
|
.current_buf = NULL,
|
||||||
@@ -174,16 +175,52 @@ static struct {
|
|||||||
/* buffer used for XBZRLE decoding */
|
/* buffer used for XBZRLE decoding */
|
||||||
static uint8_t *xbzrle_decoded_buf;
|
static uint8_t *xbzrle_decoded_buf;
|
||||||
|
|
||||||
|
static void XBZRLE_cache_lock(void)
|
||||||
|
{
|
||||||
|
if (migrate_use_xbzrle())
|
||||||
|
qemu_mutex_lock(&XBZRLE.lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void XBZRLE_cache_unlock(void)
|
||||||
|
{
|
||||||
|
if (migrate_use_xbzrle())
|
||||||
|
qemu_mutex_unlock(&XBZRLE.lock);
|
||||||
|
}
|
||||||
|
|
||||||
int64_t xbzrle_cache_resize(int64_t new_size)
|
int64_t xbzrle_cache_resize(int64_t new_size)
|
||||||
{
|
{
|
||||||
|
PageCache *new_cache, *cache_to_free;
|
||||||
|
|
||||||
if (new_size < TARGET_PAGE_SIZE) {
|
if (new_size < TARGET_PAGE_SIZE) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* no need to lock, the current thread holds qemu big lock */
|
||||||
if (XBZRLE.cache != NULL) {
|
if (XBZRLE.cache != NULL) {
|
||||||
return cache_resize(XBZRLE.cache, new_size / TARGET_PAGE_SIZE) *
|
/* check XBZRLE.cache again later */
|
||||||
TARGET_PAGE_SIZE;
|
if (pow2floor(new_size) == migrate_xbzrle_cache_size()) {
|
||||||
|
return pow2floor(new_size);
|
||||||
}
|
}
|
||||||
|
new_cache = cache_init(new_size / TARGET_PAGE_SIZE,
|
||||||
|
TARGET_PAGE_SIZE);
|
||||||
|
if (!new_cache) {
|
||||||
|
DPRINTF("Error creating cache\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
XBZRLE_cache_lock();
|
||||||
|
/* the XBZRLE.cache may have be destroyed, check it again */
|
||||||
|
if (XBZRLE.cache != NULL) {
|
||||||
|
cache_to_free = XBZRLE.cache;
|
||||||
|
XBZRLE.cache = new_cache;
|
||||||
|
} else {
|
||||||
|
cache_to_free = new_cache;
|
||||||
|
}
|
||||||
|
XBZRLE_cache_unlock();
|
||||||
|
|
||||||
|
cache_fini(cache_to_free);
|
||||||
|
}
|
||||||
|
|
||||||
return pow2floor(new_size);
|
return pow2floor(new_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,6 +576,8 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
|
|||||||
ret = ram_control_save_page(f, block->offset,
|
ret = ram_control_save_page(f, block->offset,
|
||||||
offset, TARGET_PAGE_SIZE, &bytes_sent);
|
offset, TARGET_PAGE_SIZE, &bytes_sent);
|
||||||
|
|
||||||
|
XBZRLE_cache_lock();
|
||||||
|
|
||||||
current_addr = block->offset + offset;
|
current_addr = block->offset + offset;
|
||||||
if (ret != RAM_SAVE_CONTROL_NOT_SUPP) {
|
if (ret != RAM_SAVE_CONTROL_NOT_SUPP) {
|
||||||
if (ret != RAM_SAVE_CONTROL_DELAYED) {
|
if (ret != RAM_SAVE_CONTROL_DELAYED) {
|
||||||
@@ -587,6 +626,7 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
|
|||||||
acct_info.norm_pages++;
|
acct_info.norm_pages++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XBZRLE_cache_unlock();
|
||||||
/* if page is unmodified, continue to the next */
|
/* if page is unmodified, continue to the next */
|
||||||
if (bytes_sent > 0) {
|
if (bytes_sent > 0) {
|
||||||
last_sent_block = block;
|
last_sent_block = block;
|
||||||
@@ -654,6 +694,7 @@ static void migration_end(void)
|
|||||||
migration_bitmap = NULL;
|
migration_bitmap = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XBZRLE_cache_lock();
|
||||||
if (XBZRLE.cache) {
|
if (XBZRLE.cache) {
|
||||||
cache_fini(XBZRLE.cache);
|
cache_fini(XBZRLE.cache);
|
||||||
g_free(XBZRLE.cache);
|
g_free(XBZRLE.cache);
|
||||||
@@ -663,6 +704,7 @@ static void migration_end(void)
|
|||||||
XBZRLE.encoded_buf = NULL;
|
XBZRLE.encoded_buf = NULL;
|
||||||
XBZRLE.current_buf = NULL;
|
XBZRLE.current_buf = NULL;
|
||||||
}
|
}
|
||||||
|
XBZRLE_cache_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ram_migration_cancel(void *opaque)
|
static void ram_migration_cancel(void *opaque)
|
||||||
@@ -693,13 +735,17 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
|
|||||||
dirty_rate_high_cnt = 0;
|
dirty_rate_high_cnt = 0;
|
||||||
|
|
||||||
if (migrate_use_xbzrle()) {
|
if (migrate_use_xbzrle()) {
|
||||||
|
qemu_mutex_lock_iothread();
|
||||||
XBZRLE.cache = cache_init(migrate_xbzrle_cache_size() /
|
XBZRLE.cache = cache_init(migrate_xbzrle_cache_size() /
|
||||||
TARGET_PAGE_SIZE,
|
TARGET_PAGE_SIZE,
|
||||||
TARGET_PAGE_SIZE);
|
TARGET_PAGE_SIZE);
|
||||||
if (!XBZRLE.cache) {
|
if (!XBZRLE.cache) {
|
||||||
|
qemu_mutex_unlock_iothread();
|
||||||
DPRINTF("Error creating cache\n");
|
DPRINTF("Error creating cache\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
qemu_mutex_init(&XBZRLE.lock);
|
||||||
|
qemu_mutex_unlock_iothread();
|
||||||
|
|
||||||
/* We prefer not to abort if there is no memory */
|
/* We prefer not to abort if there is no memory */
|
||||||
XBZRLE.encoded_buf = g_try_malloc0(TARGET_PAGE_SIZE);
|
XBZRLE.encoded_buf = g_try_malloc0(TARGET_PAGE_SIZE);
|
||||||
|
18
async.c
18
async.c
@@ -214,6 +214,7 @@ aio_ctx_finalize(GSource *source)
|
|||||||
thread_pool_free(ctx->thread_pool);
|
thread_pool_free(ctx->thread_pool);
|
||||||
aio_set_event_notifier(ctx, &ctx->notifier, NULL);
|
aio_set_event_notifier(ctx, &ctx->notifier, NULL);
|
||||||
event_notifier_cleanup(&ctx->notifier);
|
event_notifier_cleanup(&ctx->notifier);
|
||||||
|
rfifolock_destroy(&ctx->lock);
|
||||||
qemu_mutex_destroy(&ctx->bh_lock);
|
qemu_mutex_destroy(&ctx->bh_lock);
|
||||||
g_array_free(ctx->pollfds, TRUE);
|
g_array_free(ctx->pollfds, TRUE);
|
||||||
timerlistgroup_deinit(&ctx->tlg);
|
timerlistgroup_deinit(&ctx->tlg);
|
||||||
@@ -250,6 +251,12 @@ static void aio_timerlist_notify(void *opaque)
|
|||||||
aio_notify(opaque);
|
aio_notify(opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void aio_rfifolock_cb(void *opaque)
|
||||||
|
{
|
||||||
|
/* Kick owner thread in case they are blocked in aio_poll() */
|
||||||
|
aio_notify(opaque);
|
||||||
|
}
|
||||||
|
|
||||||
AioContext *aio_context_new(void)
|
AioContext *aio_context_new(void)
|
||||||
{
|
{
|
||||||
AioContext *ctx;
|
AioContext *ctx;
|
||||||
@@ -257,6 +264,7 @@ AioContext *aio_context_new(void)
|
|||||||
ctx->pollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD));
|
ctx->pollfds = g_array_new(FALSE, FALSE, sizeof(GPollFD));
|
||||||
ctx->thread_pool = NULL;
|
ctx->thread_pool = NULL;
|
||||||
qemu_mutex_init(&ctx->bh_lock);
|
qemu_mutex_init(&ctx->bh_lock);
|
||||||
|
rfifolock_init(&ctx->lock, aio_rfifolock_cb, ctx);
|
||||||
event_notifier_init(&ctx->notifier, false);
|
event_notifier_init(&ctx->notifier, false);
|
||||||
aio_set_event_notifier(ctx, &ctx->notifier,
|
aio_set_event_notifier(ctx, &ctx->notifier,
|
||||||
(EventNotifierHandler *)
|
(EventNotifierHandler *)
|
||||||
@@ -275,3 +283,13 @@ void aio_context_unref(AioContext *ctx)
|
|||||||
{
|
{
|
||||||
g_source_unref(&ctx->source);
|
g_source_unref(&ctx->source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void aio_context_acquire(AioContext *ctx)
|
||||||
|
{
|
||||||
|
rfifolock_lock(&ctx->lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void aio_context_release(AioContext *ctx)
|
||||||
|
{
|
||||||
|
rfifolock_unlock(&ctx->lock);
|
||||||
|
}
|
||||||
|
80
block.c
80
block.c
@@ -1321,7 +1321,7 @@ int bdrv_open(BlockDriverState **pbs, const char *filename,
|
|||||||
bdrv_open_flags(bs, flags | BDRV_O_UNMAP) |
|
bdrv_open_flags(bs, flags | BDRV_O_UNMAP) |
|
||||||
BDRV_O_PROTOCOL, true, &local_err);
|
BDRV_O_PROTOCOL, true, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto fail;
|
goto unlink_and_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the right image format driver */
|
/* Find the right image format driver */
|
||||||
@@ -1388,12 +1388,19 @@ done:
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto close_and_fail;
|
goto close_and_fail;
|
||||||
}
|
}
|
||||||
QDECREF(options);
|
|
||||||
|
|
||||||
if (!bdrv_key_required(bs)) {
|
if (!bdrv_key_required(bs)) {
|
||||||
bdrv_dev_change_media_cb(bs, true);
|
bdrv_dev_change_media_cb(bs, true);
|
||||||
|
} else if (!runstate_check(RUN_STATE_PRELAUNCH)
|
||||||
|
&& !runstate_check(RUN_STATE_INMIGRATE)
|
||||||
|
&& !runstate_check(RUN_STATE_PAUSED)) { /* HACK */
|
||||||
|
error_setg(errp,
|
||||||
|
"Guest must be stopped for opening of encrypted image");
|
||||||
|
ret = -EBUSY;
|
||||||
|
goto close_and_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDECREF(options);
|
||||||
*pbs = bs;
|
*pbs = bs;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -4055,7 +4062,7 @@ int bdrv_debug_remove_breakpoint(BlockDriverState *bs, const char *tag)
|
|||||||
|
|
||||||
int bdrv_debug_resume(BlockDriverState *bs, const char *tag)
|
int bdrv_debug_resume(BlockDriverState *bs, const char *tag)
|
||||||
{
|
{
|
||||||
while (bs && bs->drv && !bs->drv->bdrv_debug_resume) {
|
while (bs && (!bs->drv || !bs->drv->bdrv_debug_resume)) {
|
||||||
bs = bs->file;
|
bs = bs->file;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4776,9 +4783,17 @@ flush_parent:
|
|||||||
|
|
||||||
void bdrv_invalidate_cache(BlockDriverState *bs)
|
void bdrv_invalidate_cache(BlockDriverState *bs)
|
||||||
{
|
{
|
||||||
if (bs->drv && bs->drv->bdrv_invalidate_cache) {
|
if (!bs->drv) {
|
||||||
bs->drv->bdrv_invalidate_cache(bs);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bs->drv->bdrv_invalidate_cache) {
|
||||||
|
bs->drv->bdrv_invalidate_cache(bs);
|
||||||
|
} else if (bs->file) {
|
||||||
|
bdrv_invalidate_cache(bs->file);
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh_total_sectors(bs, bs->total_sectors);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bdrv_invalidate_cache_all(void)
|
void bdrv_invalidate_cache_all(void)
|
||||||
@@ -5390,43 +5405,37 @@ int bdrv_amend_options(BlockDriverState *bs, QEMUOptionParameter *options)
|
|||||||
return bs->drv->bdrv_amend_options(bs, options);
|
return bs->drv->bdrv_amend_options(bs, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used to recurse on single child block filters.
|
/* This function will be called by the bdrv_recurse_is_first_non_filter method
|
||||||
* Single child block filter will store their child in bs->file.
|
* of block filter and by bdrv_is_first_non_filter.
|
||||||
|
* It is used to test if the given bs is the candidate or recurse more in the
|
||||||
|
* node graph.
|
||||||
*/
|
*/
|
||||||
bool bdrv_generic_is_first_non_filter(BlockDriverState *bs,
|
|
||||||
BlockDriverState *candidate)
|
|
||||||
{
|
|
||||||
if (!bs->drv) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bs->drv->authorizations[BS_IS_A_FILTER]) {
|
|
||||||
if (bs == candidate) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bs->drv->authorizations[BS_FILTER_PASS_DOWN]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bs->file) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bdrv_recurse_is_first_non_filter(bs->file, candidate);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool bdrv_recurse_is_first_non_filter(BlockDriverState *bs,
|
bool bdrv_recurse_is_first_non_filter(BlockDriverState *bs,
|
||||||
BlockDriverState *candidate)
|
BlockDriverState *candidate)
|
||||||
{
|
{
|
||||||
if (bs->drv && bs->drv->bdrv_recurse_is_first_non_filter) {
|
/* return false if basic checks fails */
|
||||||
|
if (!bs || !bs->drv) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the code reached a non block filter driver -> check if the bs is
|
||||||
|
* the same as the candidate. It's the recursion termination condition.
|
||||||
|
*/
|
||||||
|
if (!bs->drv->is_filter) {
|
||||||
|
return bs == candidate;
|
||||||
|
}
|
||||||
|
/* Down this path the driver is a block filter driver */
|
||||||
|
|
||||||
|
/* If the block filter recursion method is defined use it to recurse down
|
||||||
|
* the node graph.
|
||||||
|
*/
|
||||||
|
if (bs->drv->bdrv_recurse_is_first_non_filter) {
|
||||||
return bs->drv->bdrv_recurse_is_first_non_filter(bs, candidate);
|
return bs->drv->bdrv_recurse_is_first_non_filter(bs, candidate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bdrv_generic_is_first_non_filter(bs, candidate);
|
/* the driver is a block filter but don't allow to recurse -> return false
|
||||||
|
*/
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function checks if the candidate is the first non filter bs down it's
|
/* This function checks if the candidate is the first non filter bs down it's
|
||||||
@@ -5441,6 +5450,7 @@ bool bdrv_is_first_non_filter(BlockDriverState *candidate)
|
|||||||
QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
|
QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
|
||||||
bool perm;
|
bool perm;
|
||||||
|
|
||||||
|
/* try to recurse in this top level bs */
|
||||||
perm = bdrv_recurse_is_first_non_filter(bs, candidate);
|
perm = bdrv_recurse_is_first_non_filter(bs, candidate);
|
||||||
|
|
||||||
/* candidate is the first non filter */
|
/* candidate is the first non filter */
|
||||||
|
@@ -288,6 +288,20 @@ static BlockDriverAIOCB *blkverify_aio_flush(BlockDriverState *bs,
|
|||||||
return bdrv_aio_flush(s->test_file, cb, opaque);
|
return bdrv_aio_flush(s->test_file, cb, opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool blkverify_recurse_is_first_non_filter(BlockDriverState *bs,
|
||||||
|
BlockDriverState *candidate)
|
||||||
|
{
|
||||||
|
BDRVBlkverifyState *s = bs->opaque;
|
||||||
|
|
||||||
|
bool perm = bdrv_recurse_is_first_non_filter(bs->file, candidate);
|
||||||
|
|
||||||
|
if (perm) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bdrv_recurse_is_first_non_filter(s->test_file, candidate);
|
||||||
|
}
|
||||||
|
|
||||||
static BlockDriver bdrv_blkverify = {
|
static BlockDriver bdrv_blkverify = {
|
||||||
.format_name = "blkverify",
|
.format_name = "blkverify",
|
||||||
.protocol_name = "blkverify",
|
.protocol_name = "blkverify",
|
||||||
@@ -302,7 +316,8 @@ static BlockDriver bdrv_blkverify = {
|
|||||||
.bdrv_aio_writev = blkverify_aio_writev,
|
.bdrv_aio_writev = blkverify_aio_writev,
|
||||||
.bdrv_aio_flush = blkverify_aio_flush,
|
.bdrv_aio_flush = blkverify_aio_flush,
|
||||||
|
|
||||||
.authorizations = { true, false },
|
.is_filter = true,
|
||||||
|
.bdrv_recurse_is_first_non_filter = blkverify_recurse_is_first_non_filter,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void bdrv_blkverify_init(void)
|
static void bdrv_blkverify_init(void)
|
||||||
|
@@ -43,6 +43,17 @@ static void nbd_recv_coroutines_enter_all(NbdClientSession *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nbd_teardown_connection(NbdClientSession *client)
|
||||||
|
{
|
||||||
|
/* finish any pending coroutines */
|
||||||
|
shutdown(client->sock, 2);
|
||||||
|
nbd_recv_coroutines_enter_all(client);
|
||||||
|
|
||||||
|
qemu_aio_set_fd_handler(client->sock, NULL, NULL, NULL);
|
||||||
|
closesocket(client->sock);
|
||||||
|
client->sock = -1;
|
||||||
|
}
|
||||||
|
|
||||||
static void nbd_reply_ready(void *opaque)
|
static void nbd_reply_ready(void *opaque)
|
||||||
{
|
{
|
||||||
NbdClientSession *s = opaque;
|
NbdClientSession *s = opaque;
|
||||||
@@ -78,7 +89,7 @@ static void nbd_reply_ready(void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
nbd_recv_coroutines_enter_all(s);
|
nbd_teardown_connection(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nbd_restart_write(void *opaque)
|
static void nbd_restart_write(void *opaque)
|
||||||
@@ -324,7 +335,7 @@ int nbd_client_session_co_discard(NbdClientSession *client, int64_t sector_num,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nbd_teardown_connection(NbdClientSession *client)
|
void nbd_client_session_close(NbdClientSession *client)
|
||||||
{
|
{
|
||||||
struct nbd_request request = {
|
struct nbd_request request = {
|
||||||
.type = NBD_CMD_DISC,
|
.type = NBD_CMD_DISC,
|
||||||
@@ -332,22 +343,14 @@ static void nbd_teardown_connection(NbdClientSession *client)
|
|||||||
.len = 0
|
.len = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
nbd_send_request(client->sock, &request);
|
|
||||||
|
|
||||||
/* finish any pending coroutines */
|
|
||||||
shutdown(client->sock, 2);
|
|
||||||
nbd_recv_coroutines_enter_all(client);
|
|
||||||
|
|
||||||
qemu_aio_set_fd_handler(client->sock, NULL, NULL, NULL);
|
|
||||||
closesocket(client->sock);
|
|
||||||
client->sock = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nbd_client_session_close(NbdClientSession *client)
|
|
||||||
{
|
|
||||||
if (!client->bs) {
|
if (!client->bs) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (client->sock == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
nbd_send_request(client->sock, &request);
|
||||||
|
|
||||||
nbd_teardown_connection(client);
|
nbd_teardown_connection(client);
|
||||||
client->bs = NULL;
|
client->bs = NULL;
|
||||||
|
@@ -380,6 +380,10 @@ static int coroutine_fn copy_sectors(BlockDriverState *bs,
|
|||||||
|
|
||||||
BLKDBG_EVENT(bs->file, BLKDBG_COW_READ);
|
BLKDBG_EVENT(bs->file, BLKDBG_COW_READ);
|
||||||
|
|
||||||
|
if (!bs->drv) {
|
||||||
|
return -ENOMEDIUM;
|
||||||
|
}
|
||||||
|
|
||||||
/* Call .bdrv_co_readv() directly instead of using the public block-layer
|
/* Call .bdrv_co_readv() directly instead of using the public block-layer
|
||||||
* interface. This avoids double I/O throttling and request tracking,
|
* interface. This avoids double I/O throttling and request tracking,
|
||||||
* which can lead to deadlock when block layer copy-on-read is enabled.
|
* which can lead to deadlock when block layer copy-on-read is enabled.
|
||||||
|
@@ -96,7 +96,8 @@ static int get_refcount(BlockDriverState *bs, int64_t cluster_index)
|
|||||||
refcount_table_index = cluster_index >> (s->cluster_bits - REFCOUNT_SHIFT);
|
refcount_table_index = cluster_index >> (s->cluster_bits - REFCOUNT_SHIFT);
|
||||||
if (refcount_table_index >= s->refcount_table_size)
|
if (refcount_table_index >= s->refcount_table_size)
|
||||||
return 0;
|
return 0;
|
||||||
refcount_block_offset = s->refcount_table[refcount_table_index];
|
refcount_block_offset =
|
||||||
|
s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK;
|
||||||
if (!refcount_block_offset)
|
if (!refcount_block_offset)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@@ -644,7 +644,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Clear unknown autoclear feature bits */
|
/* Clear unknown autoclear feature bits */
|
||||||
if (!bs->read_only && s->autoclear_features != 0) {
|
if (!bs->read_only && !(flags & BDRV_O_INCOMING) && s->autoclear_features) {
|
||||||
s->autoclear_features = 0;
|
s->autoclear_features = 0;
|
||||||
ret = qcow2_update_header(bs);
|
ret = qcow2_update_header(bs);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -657,7 +657,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
|
|||||||
qemu_co_mutex_init(&s->lock);
|
qemu_co_mutex_init(&s->lock);
|
||||||
|
|
||||||
/* Repair image if dirty */
|
/* Repair image if dirty */
|
||||||
if (!(flags & BDRV_O_CHECK) && !bs->read_only &&
|
if (!(flags & (BDRV_O_CHECK | BDRV_O_INCOMING)) && !bs->read_only &&
|
||||||
(s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {
|
(s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) {
|
||||||
BdrvCheckResult result = {0};
|
BdrvCheckResult result = {0};
|
||||||
|
|
||||||
@@ -1137,10 +1137,12 @@ static void qcow2_close(BlockDriverState *bs)
|
|||||||
/* else pre-write overlap checks in cache_destroy may crash */
|
/* else pre-write overlap checks in cache_destroy may crash */
|
||||||
s->l1_table = NULL;
|
s->l1_table = NULL;
|
||||||
|
|
||||||
|
if (!(bs->open_flags & BDRV_O_INCOMING)) {
|
||||||
qcow2_cache_flush(bs, s->l2_table_cache);
|
qcow2_cache_flush(bs, s->l2_table_cache);
|
||||||
qcow2_cache_flush(bs, s->refcount_block_cache);
|
qcow2_cache_flush(bs, s->refcount_block_cache);
|
||||||
|
|
||||||
qcow2_mark_clean(bs);
|
qcow2_mark_clean(bs);
|
||||||
|
}
|
||||||
|
|
||||||
qcow2_cache_destroy(bs, s->l2_table_cache);
|
qcow2_cache_destroy(bs, s->l2_table_cache);
|
||||||
qcow2_cache_destroy(bs, s->refcount_block_cache);
|
qcow2_cache_destroy(bs, s->refcount_block_cache);
|
||||||
@@ -1176,11 +1178,10 @@ static void qcow2_invalidate_cache(BlockDriverState *bs)
|
|||||||
|
|
||||||
qcow2_close(bs);
|
qcow2_close(bs);
|
||||||
|
|
||||||
options = qdict_new();
|
bdrv_invalidate_cache(bs->file);
|
||||||
qdict_put(options, QCOW2_OPT_LAZY_REFCOUNTS,
|
|
||||||
qbool_from_int(s->use_lazy_refcounts));
|
|
||||||
|
|
||||||
memset(s, 0, sizeof(BDRVQcowState));
|
memset(s, 0, sizeof(BDRVQcowState));
|
||||||
|
options = qdict_clone_shallow(bs->options);
|
||||||
qcow2_open(bs, options, flags, NULL);
|
qcow2_open(bs, options, flags, NULL);
|
||||||
|
|
||||||
QDECREF(options);
|
QDECREF(options);
|
||||||
|
@@ -1563,6 +1563,9 @@ static void bdrv_qed_invalidate_cache(BlockDriverState *bs)
|
|||||||
BDRVQEDState *s = bs->opaque;
|
BDRVQEDState *s = bs->opaque;
|
||||||
|
|
||||||
bdrv_qed_close(bs);
|
bdrv_qed_close(bs);
|
||||||
|
|
||||||
|
bdrv_invalidate_cache(bs->file);
|
||||||
|
|
||||||
memset(s, 0, sizeof(BDRVQEDState));
|
memset(s, 0, sizeof(BDRVQEDState));
|
||||||
bdrv_qed_open(bs, NULL, bs->open_flags, NULL);
|
bdrv_qed_open(bs, NULL, bs->open_flags, NULL);
|
||||||
}
|
}
|
||||||
|
@@ -852,8 +852,6 @@ static BlockDriver bdrv_quorum = {
|
|||||||
.bdrv_file_open = quorum_open,
|
.bdrv_file_open = quorum_open,
|
||||||
.bdrv_close = quorum_close,
|
.bdrv_close = quorum_close,
|
||||||
|
|
||||||
.authorizations = { true, true },
|
|
||||||
|
|
||||||
.bdrv_co_flush_to_disk = quorum_co_flush,
|
.bdrv_co_flush_to_disk = quorum_co_flush,
|
||||||
|
|
||||||
.bdrv_getlength = quorum_getlength,
|
.bdrv_getlength = quorum_getlength,
|
||||||
@@ -862,6 +860,7 @@ static BlockDriver bdrv_quorum = {
|
|||||||
.bdrv_aio_writev = quorum_aio_writev,
|
.bdrv_aio_writev = quorum_aio_writev,
|
||||||
.bdrv_invalidate_cache = quorum_invalidate_cache,
|
.bdrv_invalidate_cache = quorum_invalidate_cache,
|
||||||
|
|
||||||
|
.is_filter = true,
|
||||||
.bdrv_recurse_is_first_non_filter = quorum_recurse_is_first_non_filter,
|
.bdrv_recurse_is_first_non_filter = quorum_recurse_is_first_non_filter,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1561,6 +1561,15 @@ static int check_hdev_writable(BDRVRawState *s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hdev_parse_filename(const char *filename, QDict *options,
|
||||||
|
Error **errp)
|
||||||
|
{
|
||||||
|
/* The prefix is optional, just as for "file". */
|
||||||
|
strstart(filename, "host_device:", &filename);
|
||||||
|
|
||||||
|
qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
|
||||||
|
}
|
||||||
|
|
||||||
static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
@@ -1767,6 +1776,18 @@ static int hdev_create(const char *filename, QEMUOptionParameter *options,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
int64_t total_size = 0;
|
int64_t total_size = 0;
|
||||||
|
bool has_prefix;
|
||||||
|
|
||||||
|
/* This function is used by all three protocol block drivers and therefore
|
||||||
|
* any of these three prefixes may be given.
|
||||||
|
* The return value has to be stored somewhere, otherwise this is an error
|
||||||
|
* due to -Werror=unused-value. */
|
||||||
|
has_prefix =
|
||||||
|
strstart(filename, "host_device:", &filename) ||
|
||||||
|
strstart(filename, "host_cdrom:" , &filename) ||
|
||||||
|
strstart(filename, "host_floppy:", &filename);
|
||||||
|
|
||||||
|
(void)has_prefix;
|
||||||
|
|
||||||
/* Read out options */
|
/* Read out options */
|
||||||
while (options && options->name) {
|
while (options && options->name) {
|
||||||
@@ -1805,6 +1826,7 @@ static BlockDriver bdrv_host_device = {
|
|||||||
.instance_size = sizeof(BDRVRawState),
|
.instance_size = sizeof(BDRVRawState),
|
||||||
.bdrv_needs_filename = true,
|
.bdrv_needs_filename = true,
|
||||||
.bdrv_probe_device = hdev_probe_device,
|
.bdrv_probe_device = hdev_probe_device,
|
||||||
|
.bdrv_parse_filename = hdev_parse_filename,
|
||||||
.bdrv_file_open = hdev_open,
|
.bdrv_file_open = hdev_open,
|
||||||
.bdrv_close = raw_close,
|
.bdrv_close = raw_close,
|
||||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||||
@@ -1834,6 +1856,15 @@ static BlockDriver bdrv_host_device = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
static void floppy_parse_filename(const char *filename, QDict *options,
|
||||||
|
Error **errp)
|
||||||
|
{
|
||||||
|
/* The prefix is optional, just as for "file". */
|
||||||
|
strstart(filename, "host_floppy:", &filename);
|
||||||
|
|
||||||
|
qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
|
||||||
|
}
|
||||||
|
|
||||||
static int floppy_open(BlockDriverState *bs, QDict *options, int flags,
|
static int floppy_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
@@ -1939,6 +1970,7 @@ static BlockDriver bdrv_host_floppy = {
|
|||||||
.instance_size = sizeof(BDRVRawState),
|
.instance_size = sizeof(BDRVRawState),
|
||||||
.bdrv_needs_filename = true,
|
.bdrv_needs_filename = true,
|
||||||
.bdrv_probe_device = floppy_probe_device,
|
.bdrv_probe_device = floppy_probe_device,
|
||||||
|
.bdrv_parse_filename = floppy_parse_filename,
|
||||||
.bdrv_file_open = floppy_open,
|
.bdrv_file_open = floppy_open,
|
||||||
.bdrv_close = raw_close,
|
.bdrv_close = raw_close,
|
||||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||||
@@ -1963,7 +1995,20 @@ static BlockDriver bdrv_host_floppy = {
|
|||||||
.bdrv_media_changed = floppy_media_changed,
|
.bdrv_media_changed = floppy_media_changed,
|
||||||
.bdrv_eject = floppy_eject,
|
.bdrv_eject = floppy_eject,
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||||
|
static void cdrom_parse_filename(const char *filename, QDict *options,
|
||||||
|
Error **errp)
|
||||||
|
{
|
||||||
|
/* The prefix is optional, just as for "file". */
|
||||||
|
strstart(filename, "host_cdrom:", &filename);
|
||||||
|
|
||||||
|
qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
static int cdrom_open(BlockDriverState *bs, QDict *options, int flags,
|
static int cdrom_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
@@ -2050,6 +2095,7 @@ static BlockDriver bdrv_host_cdrom = {
|
|||||||
.instance_size = sizeof(BDRVRawState),
|
.instance_size = sizeof(BDRVRawState),
|
||||||
.bdrv_needs_filename = true,
|
.bdrv_needs_filename = true,
|
||||||
.bdrv_probe_device = cdrom_probe_device,
|
.bdrv_probe_device = cdrom_probe_device,
|
||||||
|
.bdrv_parse_filename = cdrom_parse_filename,
|
||||||
.bdrv_file_open = cdrom_open,
|
.bdrv_file_open = cdrom_open,
|
||||||
.bdrv_close = raw_close,
|
.bdrv_close = raw_close,
|
||||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||||
@@ -2180,6 +2226,7 @@ static BlockDriver bdrv_host_cdrom = {
|
|||||||
.instance_size = sizeof(BDRVRawState),
|
.instance_size = sizeof(BDRVRawState),
|
||||||
.bdrv_needs_filename = true,
|
.bdrv_needs_filename = true,
|
||||||
.bdrv_probe_device = cdrom_probe_device,
|
.bdrv_probe_device = cdrom_probe_device,
|
||||||
|
.bdrv_parse_filename = cdrom_parse_filename,
|
||||||
.bdrv_file_open = cdrom_open,
|
.bdrv_file_open = cdrom_open,
|
||||||
.bdrv_close = raw_close,
|
.bdrv_close = raw_close,
|
||||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||||
|
@@ -593,6 +593,15 @@ static int hdev_probe_device(const char *filename)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hdev_parse_filename(const char *filename, QDict *options,
|
||||||
|
Error **errp)
|
||||||
|
{
|
||||||
|
/* The prefix is optional, just as for "file". */
|
||||||
|
strstart(filename, "host_device:", &filename);
|
||||||
|
|
||||||
|
qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
|
||||||
|
}
|
||||||
|
|
||||||
static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
@@ -663,6 +672,7 @@ static BlockDriver bdrv_host_device = {
|
|||||||
.protocol_name = "host_device",
|
.protocol_name = "host_device",
|
||||||
.instance_size = sizeof(BDRVRawState),
|
.instance_size = sizeof(BDRVRawState),
|
||||||
.bdrv_needs_filename = true,
|
.bdrv_needs_filename = true,
|
||||||
|
.bdrv_parse_filename = hdev_parse_filename,
|
||||||
.bdrv_probe_device = hdev_probe_device,
|
.bdrv_probe_device = hdev_probe_device,
|
||||||
.bdrv_file_open = hdev_open,
|
.bdrv_file_open = hdev_open,
|
||||||
.bdrv_close = raw_close,
|
.bdrv_close = raw_close,
|
||||||
|
@@ -61,7 +61,7 @@
|
|||||||
/* These structures are ones that are defined in the VHDX specification
|
/* These structures are ones that are defined in the VHDX specification
|
||||||
* document */
|
* document */
|
||||||
|
|
||||||
#define VHDX_FILE_SIGNATURE 0x656C696678646876 /* "vhdxfile" in ASCII */
|
#define VHDX_FILE_SIGNATURE 0x656C696678646876ULL /* "vhdxfile" in ASCII */
|
||||||
typedef struct VHDXFileIdentifier {
|
typedef struct VHDXFileIdentifier {
|
||||||
uint64_t signature; /* "vhdxfile" in ASCII */
|
uint64_t signature; /* "vhdxfile" in ASCII */
|
||||||
uint16_t creator[256]; /* optional; utf-16 string to identify
|
uint16_t creator[256]; /* optional; utf-16 string to identify
|
||||||
@@ -238,7 +238,7 @@ typedef struct QEMU_PACKED VHDXLogDataSector {
|
|||||||
/* upper 44 bits are the file offset in 1MB units lower 3 bits are the state
|
/* upper 44 bits are the file offset in 1MB units lower 3 bits are the state
|
||||||
other bits are reserved */
|
other bits are reserved */
|
||||||
#define VHDX_BAT_STATE_BIT_MASK 0x07
|
#define VHDX_BAT_STATE_BIT_MASK 0x07
|
||||||
#define VHDX_BAT_FILE_OFF_MASK 0xFFFFFFFFFFF00000 /* upper 44 bits */
|
#define VHDX_BAT_FILE_OFF_MASK 0xFFFFFFFFFFF00000ULL /* upper 44 bits */
|
||||||
typedef uint64_t VHDXBatEntry;
|
typedef uint64_t VHDXBatEntry;
|
||||||
|
|
||||||
/* ---- METADATA REGION STRUCTURES ---- */
|
/* ---- METADATA REGION STRUCTURES ---- */
|
||||||
@@ -247,7 +247,7 @@ typedef uint64_t VHDXBatEntry;
|
|||||||
#define VHDX_METADATA_MAX_ENTRIES 2047 /* not including the header */
|
#define VHDX_METADATA_MAX_ENTRIES 2047 /* not including the header */
|
||||||
#define VHDX_METADATA_TABLE_MAX_SIZE \
|
#define VHDX_METADATA_TABLE_MAX_SIZE \
|
||||||
(VHDX_METADATA_ENTRY_SIZE * (VHDX_METADATA_MAX_ENTRIES+1))
|
(VHDX_METADATA_ENTRY_SIZE * (VHDX_METADATA_MAX_ENTRIES+1))
|
||||||
#define VHDX_METADATA_SIGNATURE 0x617461646174656D /* "metadata" in ASCII */
|
#define VHDX_METADATA_SIGNATURE 0x617461646174656DULL /* "metadata" in ASCII */
|
||||||
typedef struct QEMU_PACKED VHDXMetadataTableHeader {
|
typedef struct QEMU_PACKED VHDXMetadataTableHeader {
|
||||||
uint64_t signature; /* "metadata" in ASCII */
|
uint64_t signature; /* "metadata" in ASCII */
|
||||||
uint16_t reserved;
|
uint16_t reserved;
|
||||||
|
@@ -1000,7 +1000,7 @@ int main(int argc, char **argv)
|
|||||||
memset(ts, 0, sizeof(TaskState));
|
memset(ts, 0, sizeof(TaskState));
|
||||||
init_task_state(ts);
|
init_task_state(ts);
|
||||||
ts->info = info;
|
ts->info = info;
|
||||||
env->opaque = ts;
|
cpu->opaque = ts;
|
||||||
|
|
||||||
#if defined(TARGET_I386)
|
#if defined(TARGET_I386)
|
||||||
cpu_x86_set_cpl(env, 3);
|
cpu_x86_set_cpl(env, 3);
|
||||||
|
42
configure
vendored
42
configure
vendored
@@ -31,19 +31,6 @@ printf " '%s'" "$0" "$@" >> config.log
|
|||||||
echo >> config.log
|
echo >> config.log
|
||||||
echo "#" >> config.log
|
echo "#" >> config.log
|
||||||
|
|
||||||
# Save the configure command line for later reuse.
|
|
||||||
cat <<EOD >config.status
|
|
||||||
#!/bin/sh
|
|
||||||
# Generated by configure.
|
|
||||||
# Run this file to recreate the current configuration.
|
|
||||||
# Compiler output produced by configure, useful for debugging
|
|
||||||
# configure, is in config.log if it exists.
|
|
||||||
EOD
|
|
||||||
printf "exec" >>config.status
|
|
||||||
printf " '%s'" "$0" "$@" >>config.status
|
|
||||||
echo >>config.status
|
|
||||||
chmod +x config.status
|
|
||||||
|
|
||||||
error_exit() {
|
error_exit() {
|
||||||
echo
|
echo
|
||||||
echo "ERROR: $1"
|
echo "ERROR: $1"
|
||||||
@@ -3835,6 +3822,11 @@ fi
|
|||||||
|
|
||||||
int128=no
|
int128=no
|
||||||
cat > $TMPC << EOF
|
cat > $TMPC << EOF
|
||||||
|
#if defined(__clang_major__) && defined(__clang_minor__)
|
||||||
|
# if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
|
||||||
|
# error __int128_t does not work in CLANG before 3.2
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
__int128_t a;
|
__int128_t a;
|
||||||
__uint128_t b;
|
__uint128_t b;
|
||||||
int main (void) {
|
int main (void) {
|
||||||
@@ -4107,7 +4099,11 @@ echo "vhost-net support $vhost_net"
|
|||||||
echo "vhost-scsi support $vhost_scsi"
|
echo "vhost-scsi support $vhost_scsi"
|
||||||
echo "Trace backend $trace_backend"
|
echo "Trace backend $trace_backend"
|
||||||
echo "Trace output file $trace_file-<pid>"
|
echo "Trace output file $trace_file-<pid>"
|
||||||
|
if test "$spice" = "yes"; then
|
||||||
echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
|
echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
|
||||||
|
else
|
||||||
|
echo "spice support $spice"
|
||||||
|
fi
|
||||||
echo "rbd support $rbd"
|
echo "rbd support $rbd"
|
||||||
echo "xfsctl support $xfs"
|
echo "xfsctl support $xfs"
|
||||||
echo "nss used $smartcard_nss"
|
echo "nss used $smartcard_nss"
|
||||||
@@ -4968,6 +4964,12 @@ for i in $ARCH $TARGET_BASE_ARCH ; do
|
|||||||
echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
|
echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
|
||||||
echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
|
echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
|
||||||
;;
|
;;
|
||||||
|
aarch64)
|
||||||
|
if test -n "${cxx}"; then
|
||||||
|
echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
|
||||||
|
echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
|
||||||
|
fi
|
||||||
|
;;
|
||||||
arm)
|
arm)
|
||||||
echo "CONFIG_ARM_DIS=y" >> $config_target_mak
|
echo "CONFIG_ARM_DIS=y" >> $config_target_mak
|
||||||
echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
|
echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
|
||||||
@@ -5136,3 +5138,17 @@ done
|
|||||||
if test "$docs" = "yes" ; then
|
if test "$docs" = "yes" ; then
|
||||||
mkdir -p QMP
|
mkdir -p QMP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Save the configure command line for later reuse.
|
||||||
|
cat <<EOD >config.status
|
||||||
|
#!/bin/sh
|
||||||
|
# Generated by configure.
|
||||||
|
# Run this file to recreate the current configuration.
|
||||||
|
# Compiler output produced by configure, useful for debugging
|
||||||
|
# configure, is in config.log if it exists.
|
||||||
|
EOD
|
||||||
|
printf "exec" >>config.status
|
||||||
|
printf " '%s'" "$0" "$@" >>config.status
|
||||||
|
echo >>config.status
|
||||||
|
chmod +x config.status
|
||||||
|
|
||||||
|
106
cpu-exec.c
106
cpu-exec.c
@@ -23,29 +23,22 @@
|
|||||||
#include "qemu/atomic.h"
|
#include "qemu/atomic.h"
|
||||||
#include "sysemu/qtest.h"
|
#include "sysemu/qtest.h"
|
||||||
|
|
||||||
bool qemu_cpu_has_work(CPUState *cpu)
|
void cpu_loop_exit(CPUState *cpu)
|
||||||
{
|
{
|
||||||
return cpu_has_work(cpu);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cpu_loop_exit(CPUArchState *env)
|
|
||||||
{
|
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
|
||||||
|
|
||||||
cpu->current_tb = NULL;
|
cpu->current_tb = NULL;
|
||||||
siglongjmp(env->jmp_env, 1);
|
siglongjmp(cpu->jmp_env, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* exit the current TB from a signal handler. The host registers are
|
/* exit the current TB from a signal handler. The host registers are
|
||||||
restored in a state compatible with the CPU emulator
|
restored in a state compatible with the CPU emulator
|
||||||
*/
|
*/
|
||||||
#if defined(CONFIG_SOFTMMU)
|
#if defined(CONFIG_SOFTMMU)
|
||||||
void cpu_resume_from_signal(CPUArchState *env, void *puc)
|
void cpu_resume_from_signal(CPUState *cpu, void *puc)
|
||||||
{
|
{
|
||||||
/* XXX: restore cpu registers saved in host registers */
|
/* XXX: restore cpu registers saved in host registers */
|
||||||
|
|
||||||
env->exception_index = -1;
|
cpu->exception_index = -1;
|
||||||
siglongjmp(env->jmp_env, 1);
|
siglongjmp(cpu->jmp_env, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -108,7 +101,7 @@ static void cpu_exec_nocache(CPUArchState *env, int max_cycles,
|
|||||||
if (max_cycles > CF_COUNT_MASK)
|
if (max_cycles > CF_COUNT_MASK)
|
||||||
max_cycles = CF_COUNT_MASK;
|
max_cycles = CF_COUNT_MASK;
|
||||||
|
|
||||||
tb = tb_gen_code(env, orig_tb->pc, orig_tb->cs_base, orig_tb->flags,
|
tb = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, orig_tb->flags,
|
||||||
max_cycles);
|
max_cycles);
|
||||||
cpu->current_tb = tb;
|
cpu->current_tb = tb;
|
||||||
/* execute the generated code */
|
/* execute the generated code */
|
||||||
@@ -123,6 +116,7 @@ static TranslationBlock *tb_find_slow(CPUArchState *env,
|
|||||||
target_ulong cs_base,
|
target_ulong cs_base,
|
||||||
uint64_t flags)
|
uint64_t flags)
|
||||||
{
|
{
|
||||||
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
TranslationBlock *tb, **ptb1;
|
TranslationBlock *tb, **ptb1;
|
||||||
unsigned int h;
|
unsigned int h;
|
||||||
tb_page_addr_t phys_pc, phys_page1;
|
tb_page_addr_t phys_pc, phys_page1;
|
||||||
@@ -160,7 +154,7 @@ static TranslationBlock *tb_find_slow(CPUArchState *env,
|
|||||||
}
|
}
|
||||||
not_found:
|
not_found:
|
||||||
/* if no translated code available, then translate it now */
|
/* if no translated code available, then translate it now */
|
||||||
tb = tb_gen_code(env, pc, cs_base, flags, 0);
|
tb = tb_gen_code(cpu, pc, cs_base, flags, 0);
|
||||||
|
|
||||||
found:
|
found:
|
||||||
/* Move the last found TB to the head of the list */
|
/* Move the last found TB to the head of the list */
|
||||||
@@ -170,12 +164,13 @@ static TranslationBlock *tb_find_slow(CPUArchState *env,
|
|||||||
tcg_ctx.tb_ctx.tb_phys_hash[h] = tb;
|
tcg_ctx.tb_ctx.tb_phys_hash[h] = tb;
|
||||||
}
|
}
|
||||||
/* we add the TB in the virtual pc hash table */
|
/* we add the TB in the virtual pc hash table */
|
||||||
env->tb_jmp_cache[tb_jmp_cache_hash_func(pc)] = tb;
|
cpu->tb_jmp_cache[tb_jmp_cache_hash_func(pc)] = tb;
|
||||||
return tb;
|
return tb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline TranslationBlock *tb_find_fast(CPUArchState *env)
|
static inline TranslationBlock *tb_find_fast(CPUArchState *env)
|
||||||
{
|
{
|
||||||
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
TranslationBlock *tb;
|
TranslationBlock *tb;
|
||||||
target_ulong cs_base, pc;
|
target_ulong cs_base, pc;
|
||||||
int flags;
|
int flags;
|
||||||
@@ -184,7 +179,7 @@ static inline TranslationBlock *tb_find_fast(CPUArchState *env)
|
|||||||
always be the same before a given translated block
|
always be the same before a given translated block
|
||||||
is executed. */
|
is executed. */
|
||||||
cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
|
cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
|
||||||
tb = env->tb_jmp_cache[tb_jmp_cache_hash_func(pc)];
|
tb = cpu->tb_jmp_cache[tb_jmp_cache_hash_func(pc)];
|
||||||
if (unlikely(!tb || tb->pc != pc || tb->cs_base != cs_base ||
|
if (unlikely(!tb || tb->pc != pc || tb->cs_base != cs_base ||
|
||||||
tb->flags != flags)) {
|
tb->flags != flags)) {
|
||||||
tb = tb_find_slow(env, pc, cs_base, flags);
|
tb = tb_find_slow(env, pc, cs_base, flags);
|
||||||
@@ -201,10 +196,11 @@ void cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
|
|||||||
|
|
||||||
static void cpu_handle_debug_exception(CPUArchState *env)
|
static void cpu_handle_debug_exception(CPUArchState *env)
|
||||||
{
|
{
|
||||||
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
CPUWatchpoint *wp;
|
CPUWatchpoint *wp;
|
||||||
|
|
||||||
if (!env->watchpoint_hit) {
|
if (!cpu->watchpoint_hit) {
|
||||||
QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
|
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
|
||||||
wp->flags &= ~BP_WATCHPOINT_HIT;
|
wp->flags &= ~BP_WATCHPOINT_HIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,16 +279,16 @@ int cpu_exec(CPUArchState *env)
|
|||||||
#else
|
#else
|
||||||
#error unsupported target CPU
|
#error unsupported target CPU
|
||||||
#endif
|
#endif
|
||||||
env->exception_index = -1;
|
cpu->exception_index = -1;
|
||||||
|
|
||||||
/* prepare setjmp context for exception handling */
|
/* prepare setjmp context for exception handling */
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if (sigsetjmp(env->jmp_env, 0) == 0) {
|
if (sigsetjmp(cpu->jmp_env, 0) == 0) {
|
||||||
/* if an exception is pending, we execute it here */
|
/* if an exception is pending, we execute it here */
|
||||||
if (env->exception_index >= 0) {
|
if (cpu->exception_index >= 0) {
|
||||||
if (env->exception_index >= EXCP_INTERRUPT) {
|
if (cpu->exception_index >= EXCP_INTERRUPT) {
|
||||||
/* exit request from the cpu execution loop */
|
/* exit request from the cpu execution loop */
|
||||||
ret = env->exception_index;
|
ret = cpu->exception_index;
|
||||||
if (ret == EXCP_DEBUG) {
|
if (ret == EXCP_DEBUG) {
|
||||||
cpu_handle_debug_exception(env);
|
cpu_handle_debug_exception(env);
|
||||||
}
|
}
|
||||||
@@ -305,11 +301,11 @@ int cpu_exec(CPUArchState *env)
|
|||||||
#if defined(TARGET_I386)
|
#if defined(TARGET_I386)
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
#endif
|
#endif
|
||||||
ret = env->exception_index;
|
ret = cpu->exception_index;
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
env->exception_index = -1;
|
cpu->exception_index = -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,8 +320,8 @@ int cpu_exec(CPUArchState *env)
|
|||||||
}
|
}
|
||||||
if (interrupt_request & CPU_INTERRUPT_DEBUG) {
|
if (interrupt_request & CPU_INTERRUPT_DEBUG) {
|
||||||
cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG;
|
cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG;
|
||||||
env->exception_index = EXCP_DEBUG;
|
cpu->exception_index = EXCP_DEBUG;
|
||||||
cpu_loop_exit(env);
|
cpu_loop_exit(cpu);
|
||||||
}
|
}
|
||||||
#if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_MIPS) || \
|
#if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_MIPS) || \
|
||||||
defined(TARGET_PPC) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || \
|
defined(TARGET_PPC) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || \
|
||||||
@@ -333,8 +329,8 @@ int cpu_exec(CPUArchState *env)
|
|||||||
if (interrupt_request & CPU_INTERRUPT_HALT) {
|
if (interrupt_request & CPU_INTERRUPT_HALT) {
|
||||||
cpu->interrupt_request &= ~CPU_INTERRUPT_HALT;
|
cpu->interrupt_request &= ~CPU_INTERRUPT_HALT;
|
||||||
cpu->halted = 1;
|
cpu->halted = 1;
|
||||||
env->exception_index = EXCP_HLT;
|
cpu->exception_index = EXCP_HLT;
|
||||||
cpu_loop_exit(env);
|
cpu_loop_exit(cpu);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(TARGET_I386)
|
#if defined(TARGET_I386)
|
||||||
@@ -348,8 +344,8 @@ int cpu_exec(CPUArchState *env)
|
|||||||
cpu_svm_check_intercept_param(env, SVM_EXIT_INIT,
|
cpu_svm_check_intercept_param(env, SVM_EXIT_INIT,
|
||||||
0);
|
0);
|
||||||
do_cpu_init(x86_cpu);
|
do_cpu_init(x86_cpu);
|
||||||
env->exception_index = EXCP_HALTED;
|
cpu->exception_index = EXCP_HALTED;
|
||||||
cpu_loop_exit(env);
|
cpu_loop_exit(cpu);
|
||||||
} else if (interrupt_request & CPU_INTERRUPT_SIPI) {
|
} else if (interrupt_request & CPU_INTERRUPT_SIPI) {
|
||||||
do_cpu_sipi(x86_cpu);
|
do_cpu_sipi(x86_cpu);
|
||||||
} else if (env->hflags2 & HF2_GIF_MASK) {
|
} else if (env->hflags2 & HF2_GIF_MASK) {
|
||||||
@@ -420,7 +416,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
#elif defined(TARGET_LM32)
|
#elif defined(TARGET_LM32)
|
||||||
if ((interrupt_request & CPU_INTERRUPT_HARD)
|
if ((interrupt_request & CPU_INTERRUPT_HARD)
|
||||||
&& (env->ie & IE_IE)) {
|
&& (env->ie & IE_IE)) {
|
||||||
env->exception_index = EXCP_IRQ;
|
cpu->exception_index = EXCP_IRQ;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
@@ -429,7 +425,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
&& (env->sregs[SR_MSR] & MSR_IE)
|
&& (env->sregs[SR_MSR] & MSR_IE)
|
||||||
&& !(env->sregs[SR_MSR] & (MSR_EIP | MSR_BIP))
|
&& !(env->sregs[SR_MSR] & (MSR_EIP | MSR_BIP))
|
||||||
&& !(env->iflags & (D_FLAG | IMM_FLAG))) {
|
&& !(env->iflags & (D_FLAG | IMM_FLAG))) {
|
||||||
env->exception_index = EXCP_IRQ;
|
cpu->exception_index = EXCP_IRQ;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
@@ -437,7 +433,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
if ((interrupt_request & CPU_INTERRUPT_HARD) &&
|
if ((interrupt_request & CPU_INTERRUPT_HARD) &&
|
||||||
cpu_mips_hw_interrupts_pending(env)) {
|
cpu_mips_hw_interrupts_pending(env)) {
|
||||||
/* Raise it */
|
/* Raise it */
|
||||||
env->exception_index = EXCP_EXT_INTERRUPT;
|
cpu->exception_index = EXCP_EXT_INTERRUPT;
|
||||||
env->error_code = 0;
|
env->error_code = 0;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
@@ -454,7 +450,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
idx = EXCP_TICK;
|
idx = EXCP_TICK;
|
||||||
}
|
}
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
env->exception_index = idx;
|
cpu->exception_index = idx;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
@@ -469,7 +465,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
if (((type == TT_EXTINT) &&
|
if (((type == TT_EXTINT) &&
|
||||||
cpu_pil_allowed(env, pil)) ||
|
cpu_pil_allowed(env, pil)) ||
|
||||||
type != TT_EXTINT) {
|
type != TT_EXTINT) {
|
||||||
env->exception_index = env->interrupt_index;
|
cpu->exception_index = env->interrupt_index;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
@@ -478,7 +474,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
#elif defined(TARGET_ARM)
|
#elif defined(TARGET_ARM)
|
||||||
if (interrupt_request & CPU_INTERRUPT_FIQ
|
if (interrupt_request & CPU_INTERRUPT_FIQ
|
||||||
&& !(env->daif & PSTATE_F)) {
|
&& !(env->daif & PSTATE_F)) {
|
||||||
env->exception_index = EXCP_FIQ;
|
cpu->exception_index = EXCP_FIQ;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
@@ -494,14 +490,14 @@ int cpu_exec(CPUArchState *env)
|
|||||||
if (interrupt_request & CPU_INTERRUPT_HARD
|
if (interrupt_request & CPU_INTERRUPT_HARD
|
||||||
&& ((IS_M(env) && env->regs[15] < 0xfffffff0)
|
&& ((IS_M(env) && env->regs[15] < 0xfffffff0)
|
||||||
|| !(env->daif & PSTATE_I))) {
|
|| !(env->daif & PSTATE_I))) {
|
||||||
env->exception_index = EXCP_IRQ;
|
cpu->exception_index = EXCP_IRQ;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
#elif defined(TARGET_UNICORE32)
|
#elif defined(TARGET_UNICORE32)
|
||||||
if (interrupt_request & CPU_INTERRUPT_HARD
|
if (interrupt_request & CPU_INTERRUPT_HARD
|
||||||
&& !(env->uncached_asr & ASR_I)) {
|
&& !(env->uncached_asr & ASR_I)) {
|
||||||
env->exception_index = UC32_EXCP_INTR;
|
cpu->exception_index = UC32_EXCP_INTR;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
@@ -536,7 +532,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
env->exception_index = idx;
|
cpu->exception_index = idx;
|
||||||
env->error_code = 0;
|
env->error_code = 0;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
@@ -546,7 +542,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
if (interrupt_request & CPU_INTERRUPT_HARD
|
if (interrupt_request & CPU_INTERRUPT_HARD
|
||||||
&& (env->pregs[PR_CCS] & I_FLAG)
|
&& (env->pregs[PR_CCS] & I_FLAG)
|
||||||
&& !env->locked_irq) {
|
&& !env->locked_irq) {
|
||||||
env->exception_index = EXCP_IRQ;
|
cpu->exception_index = EXCP_IRQ;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
@@ -558,7 +554,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
m_flag_archval = M_FLAG_V32;
|
m_flag_archval = M_FLAG_V32;
|
||||||
}
|
}
|
||||||
if ((env->pregs[PR_CCS] & m_flag_archval)) {
|
if ((env->pregs[PR_CCS] & m_flag_archval)) {
|
||||||
env->exception_index = EXCP_NMI;
|
cpu->exception_index = EXCP_NMI;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
@@ -572,7 +568,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
hardware doesn't rely on this, so we
|
hardware doesn't rely on this, so we
|
||||||
provide/save the vector when the interrupt is
|
provide/save the vector when the interrupt is
|
||||||
first signalled. */
|
first signalled. */
|
||||||
env->exception_index = env->pending_vector;
|
cpu->exception_index = env->pending_vector;
|
||||||
do_interrupt_m68k_hardirq(env);
|
do_interrupt_m68k_hardirq(env);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
@@ -584,7 +580,7 @@ int cpu_exec(CPUArchState *env)
|
|||||||
}
|
}
|
||||||
#elif defined(TARGET_XTENSA)
|
#elif defined(TARGET_XTENSA)
|
||||||
if (interrupt_request & CPU_INTERRUPT_HARD) {
|
if (interrupt_request & CPU_INTERRUPT_HARD) {
|
||||||
env->exception_index = EXC_IRQ;
|
cpu->exception_index = EXC_IRQ;
|
||||||
cc->do_interrupt(cpu);
|
cc->do_interrupt(cpu);
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
}
|
}
|
||||||
@@ -600,8 +596,8 @@ int cpu_exec(CPUArchState *env)
|
|||||||
}
|
}
|
||||||
if (unlikely(cpu->exit_request)) {
|
if (unlikely(cpu->exit_request)) {
|
||||||
cpu->exit_request = 0;
|
cpu->exit_request = 0;
|
||||||
env->exception_index = EXCP_INTERRUPT;
|
cpu->exception_index = EXCP_INTERRUPT;
|
||||||
cpu_loop_exit(env);
|
cpu_loop_exit(cpu);
|
||||||
}
|
}
|
||||||
spin_lock(&tcg_ctx.tb_ctx.tb_lock);
|
spin_lock(&tcg_ctx.tb_ctx.tb_lock);
|
||||||
tb = tb_find_fast(env);
|
tb = tb_find_fast(env);
|
||||||
@@ -654,25 +650,25 @@ int cpu_exec(CPUArchState *env)
|
|||||||
/* Instruction counter expired. */
|
/* Instruction counter expired. */
|
||||||
int insns_left;
|
int insns_left;
|
||||||
tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK);
|
tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK);
|
||||||
insns_left = env->icount_decr.u32;
|
insns_left = cpu->icount_decr.u32;
|
||||||
if (env->icount_extra && insns_left >= 0) {
|
if (cpu->icount_extra && insns_left >= 0) {
|
||||||
/* Refill decrementer and continue execution. */
|
/* Refill decrementer and continue execution. */
|
||||||
env->icount_extra += insns_left;
|
cpu->icount_extra += insns_left;
|
||||||
if (env->icount_extra > 0xffff) {
|
if (cpu->icount_extra > 0xffff) {
|
||||||
insns_left = 0xffff;
|
insns_left = 0xffff;
|
||||||
} else {
|
} else {
|
||||||
insns_left = env->icount_extra;
|
insns_left = cpu->icount_extra;
|
||||||
}
|
}
|
||||||
env->icount_extra -= insns_left;
|
cpu->icount_extra -= insns_left;
|
||||||
env->icount_decr.u16.low = insns_left;
|
cpu->icount_decr.u16.low = insns_left;
|
||||||
} else {
|
} else {
|
||||||
if (insns_left > 0) {
|
if (insns_left > 0) {
|
||||||
/* Execute remaining instructions. */
|
/* Execute remaining instructions. */
|
||||||
cpu_exec_nocache(env, insns_left, tb);
|
cpu_exec_nocache(env, insns_left, tb);
|
||||||
}
|
}
|
||||||
env->exception_index = EXCP_INTERRUPT;
|
cpu->exception_index = EXCP_INTERRUPT;
|
||||||
next_tb = 0;
|
next_tb = 0;
|
||||||
cpu_loop_exit(env);
|
cpu_loop_exit(cpu);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
50
cpus.c
50
cpus.c
@@ -76,7 +76,7 @@ static bool cpu_thread_is_idle(CPUState *cpu)
|
|||||||
if (cpu_is_stopped(cpu)) {
|
if (cpu_is_stopped(cpu)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!cpu->halted || qemu_cpu_has_work(cpu) ||
|
if (!cpu->halted || cpu_has_work(cpu) ||
|
||||||
kvm_halt_in_kernel()) {
|
kvm_halt_in_kernel()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -139,11 +139,10 @@ static int64_t cpu_get_icount_locked(void)
|
|||||||
|
|
||||||
icount = qemu_icount;
|
icount = qemu_icount;
|
||||||
if (cpu) {
|
if (cpu) {
|
||||||
CPUArchState *env = cpu->env_ptr;
|
if (!cpu_can_do_io(cpu)) {
|
||||||
if (!can_do_io(env)) {
|
|
||||||
fprintf(stderr, "Bad clock read\n");
|
fprintf(stderr, "Bad clock read\n");
|
||||||
}
|
}
|
||||||
icount -= (env->icount_decr.u16.low + env->icount_extra);
|
icount -= (cpu->icount_decr.u16.low + cpu->icount_extra);
|
||||||
}
|
}
|
||||||
return qemu_icount_bias + (icount << icount_time_shift);
|
return qemu_icount_bias + (icount << icount_time_shift);
|
||||||
}
|
}
|
||||||
@@ -1117,8 +1116,13 @@ void resume_all_vcpus(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For temporary buffers for forming a name */
|
||||||
|
#define VCPU_THREAD_NAME_SIZE 16
|
||||||
|
|
||||||
static void qemu_tcg_init_vcpu(CPUState *cpu)
|
static void qemu_tcg_init_vcpu(CPUState *cpu)
|
||||||
{
|
{
|
||||||
|
char thread_name[VCPU_THREAD_NAME_SIZE];
|
||||||
|
|
||||||
tcg_cpu_address_space_init(cpu, cpu->as);
|
tcg_cpu_address_space_init(cpu, cpu->as);
|
||||||
|
|
||||||
/* share a single thread for all cpus with TCG */
|
/* share a single thread for all cpus with TCG */
|
||||||
@@ -1127,8 +1131,10 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
|
|||||||
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
||||||
qemu_cond_init(cpu->halt_cond);
|
qemu_cond_init(cpu->halt_cond);
|
||||||
tcg_halt_cond = cpu->halt_cond;
|
tcg_halt_cond = cpu->halt_cond;
|
||||||
qemu_thread_create(cpu->thread, qemu_tcg_cpu_thread_fn, cpu,
|
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/TCG",
|
||||||
QEMU_THREAD_JOINABLE);
|
cpu->cpu_index);
|
||||||
|
qemu_thread_create(cpu->thread, thread_name, qemu_tcg_cpu_thread_fn,
|
||||||
|
cpu, QEMU_THREAD_JOINABLE);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
cpu->hThread = qemu_thread_get_handle(cpu->thread);
|
cpu->hThread = qemu_thread_get_handle(cpu->thread);
|
||||||
#endif
|
#endif
|
||||||
@@ -1144,11 +1150,15 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
|
|||||||
|
|
||||||
static void qemu_kvm_start_vcpu(CPUState *cpu)
|
static void qemu_kvm_start_vcpu(CPUState *cpu)
|
||||||
{
|
{
|
||||||
|
char thread_name[VCPU_THREAD_NAME_SIZE];
|
||||||
|
|
||||||
cpu->thread = g_malloc0(sizeof(QemuThread));
|
cpu->thread = g_malloc0(sizeof(QemuThread));
|
||||||
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
||||||
qemu_cond_init(cpu->halt_cond);
|
qemu_cond_init(cpu->halt_cond);
|
||||||
qemu_thread_create(cpu->thread, qemu_kvm_cpu_thread_fn, cpu,
|
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/KVM",
|
||||||
QEMU_THREAD_JOINABLE);
|
cpu->cpu_index);
|
||||||
|
qemu_thread_create(cpu->thread, thread_name, qemu_kvm_cpu_thread_fn,
|
||||||
|
cpu, QEMU_THREAD_JOINABLE);
|
||||||
while (!cpu->created) {
|
while (!cpu->created) {
|
||||||
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
|
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
|
||||||
}
|
}
|
||||||
@@ -1156,10 +1166,14 @@ static void qemu_kvm_start_vcpu(CPUState *cpu)
|
|||||||
|
|
||||||
static void qemu_dummy_start_vcpu(CPUState *cpu)
|
static void qemu_dummy_start_vcpu(CPUState *cpu)
|
||||||
{
|
{
|
||||||
|
char thread_name[VCPU_THREAD_NAME_SIZE];
|
||||||
|
|
||||||
cpu->thread = g_malloc0(sizeof(QemuThread));
|
cpu->thread = g_malloc0(sizeof(QemuThread));
|
||||||
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
||||||
qemu_cond_init(cpu->halt_cond);
|
qemu_cond_init(cpu->halt_cond);
|
||||||
qemu_thread_create(cpu->thread, qemu_dummy_cpu_thread_fn, cpu,
|
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/DUMMY",
|
||||||
|
cpu->cpu_index);
|
||||||
|
qemu_thread_create(cpu->thread, thread_name, qemu_dummy_cpu_thread_fn, cpu,
|
||||||
QEMU_THREAD_JOINABLE);
|
QEMU_THREAD_JOINABLE);
|
||||||
while (!cpu->created) {
|
while (!cpu->created) {
|
||||||
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
|
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
|
||||||
@@ -1221,6 +1235,7 @@ int vm_stop_force_state(RunState state)
|
|||||||
|
|
||||||
static int tcg_cpu_exec(CPUArchState *env)
|
static int tcg_cpu_exec(CPUArchState *env)
|
||||||
{
|
{
|
||||||
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
int ret;
|
int ret;
|
||||||
#ifdef CONFIG_PROFILER
|
#ifdef CONFIG_PROFILER
|
||||||
int64_t ti;
|
int64_t ti;
|
||||||
@@ -1233,9 +1248,9 @@ static int tcg_cpu_exec(CPUArchState *env)
|
|||||||
int64_t count;
|
int64_t count;
|
||||||
int64_t deadline;
|
int64_t deadline;
|
||||||
int decr;
|
int decr;
|
||||||
qemu_icount -= (env->icount_decr.u16.low + env->icount_extra);
|
qemu_icount -= (cpu->icount_decr.u16.low + cpu->icount_extra);
|
||||||
env->icount_decr.u16.low = 0;
|
cpu->icount_decr.u16.low = 0;
|
||||||
env->icount_extra = 0;
|
cpu->icount_extra = 0;
|
||||||
deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
|
deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
|
||||||
|
|
||||||
/* Maintain prior (possibly buggy) behaviour where if no deadline
|
/* Maintain prior (possibly buggy) behaviour where if no deadline
|
||||||
@@ -1251,8 +1266,8 @@ static int tcg_cpu_exec(CPUArchState *env)
|
|||||||
qemu_icount += count;
|
qemu_icount += count;
|
||||||
decr = (count > 0xffff) ? 0xffff : count;
|
decr = (count > 0xffff) ? 0xffff : count;
|
||||||
count -= decr;
|
count -= decr;
|
||||||
env->icount_decr.u16.low = decr;
|
cpu->icount_decr.u16.low = decr;
|
||||||
env->icount_extra = count;
|
cpu->icount_extra = count;
|
||||||
}
|
}
|
||||||
ret = cpu_exec(env);
|
ret = cpu_exec(env);
|
||||||
#ifdef CONFIG_PROFILER
|
#ifdef CONFIG_PROFILER
|
||||||
@@ -1261,10 +1276,9 @@ static int tcg_cpu_exec(CPUArchState *env)
|
|||||||
if (use_icount) {
|
if (use_icount) {
|
||||||
/* Fold pending instructions back into the
|
/* Fold pending instructions back into the
|
||||||
instruction counter, and clear the interrupt flag. */
|
instruction counter, and clear the interrupt flag. */
|
||||||
qemu_icount -= (env->icount_decr.u16.low
|
qemu_icount -= (cpu->icount_decr.u16.low + cpu->icount_extra);
|
||||||
+ env->icount_extra);
|
cpu->icount_decr.u32 = 0;
|
||||||
env->icount_decr.u32 = 0;
|
cpu->icount_extra = 0;
|
||||||
env->icount_extra = 0;
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
24
cputlb.c
24
cputlb.c
@@ -46,9 +46,9 @@ int tlb_flush_count;
|
|||||||
* entries from the TLB at any time, so flushing more entries than
|
* entries from the TLB at any time, so flushing more entries than
|
||||||
* required is only an efficiency issue, not a correctness issue.
|
* required is only an efficiency issue, not a correctness issue.
|
||||||
*/
|
*/
|
||||||
void tlb_flush(CPUArchState *env, int flush_global)
|
void tlb_flush(CPUState *cpu, int flush_global)
|
||||||
{
|
{
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
CPUArchState *env = cpu->env_ptr;
|
||||||
|
|
||||||
#if defined(DEBUG_TLB)
|
#if defined(DEBUG_TLB)
|
||||||
printf("tlb_flush:\n");
|
printf("tlb_flush:\n");
|
||||||
@@ -58,7 +58,7 @@ void tlb_flush(CPUArchState *env, int flush_global)
|
|||||||
cpu->current_tb = NULL;
|
cpu->current_tb = NULL;
|
||||||
|
|
||||||
memset(env->tlb_table, -1, sizeof(env->tlb_table));
|
memset(env->tlb_table, -1, sizeof(env->tlb_table));
|
||||||
memset(env->tb_jmp_cache, 0, sizeof(env->tb_jmp_cache));
|
memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache));
|
||||||
|
|
||||||
env->tlb_flush_addr = -1;
|
env->tlb_flush_addr = -1;
|
||||||
env->tlb_flush_mask = 0;
|
env->tlb_flush_mask = 0;
|
||||||
@@ -77,9 +77,9 @@ static inline void tlb_flush_entry(CPUTLBEntry *tlb_entry, target_ulong addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_flush_page(CPUArchState *env, target_ulong addr)
|
void tlb_flush_page(CPUState *cpu, target_ulong addr)
|
||||||
{
|
{
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
CPUArchState *env = cpu->env_ptr;
|
||||||
int i;
|
int i;
|
||||||
int mmu_idx;
|
int mmu_idx;
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ void tlb_flush_page(CPUArchState *env, target_ulong addr)
|
|||||||
TARGET_FMT_lx "/" TARGET_FMT_lx ")\n",
|
TARGET_FMT_lx "/" TARGET_FMT_lx ")\n",
|
||||||
env->tlb_flush_addr, env->tlb_flush_mask);
|
env->tlb_flush_addr, env->tlb_flush_mask);
|
||||||
#endif
|
#endif
|
||||||
tlb_flush(env, 1);
|
tlb_flush(cpu, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* must reset current TB so that interrupts cannot modify the
|
/* must reset current TB so that interrupts cannot modify the
|
||||||
@@ -106,7 +106,7 @@ void tlb_flush_page(CPUArchState *env, target_ulong addr)
|
|||||||
tlb_flush_entry(&env->tlb_table[mmu_idx][i], addr);
|
tlb_flush_entry(&env->tlb_table[mmu_idx][i], addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
tb_flush_jmp_cache(env, addr);
|
tb_flush_jmp_cache(cpu, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update the TLBs so that writes to code in the virtual page 'addr'
|
/* update the TLBs so that writes to code in the virtual page 'addr'
|
||||||
@@ -119,7 +119,7 @@ void tlb_protect_code(ram_addr_t ram_addr)
|
|||||||
|
|
||||||
/* update the TLB so that writes in physical page 'phys_addr' are no longer
|
/* update the TLB so that writes in physical page 'phys_addr' are no longer
|
||||||
tested for self modifying code */
|
tested for self modifying code */
|
||||||
void tlb_unprotect_code_phys(CPUArchState *env, ram_addr_t ram_addr,
|
void tlb_unprotect_code_phys(CPUState *cpu, ram_addr_t ram_addr,
|
||||||
target_ulong vaddr)
|
target_ulong vaddr)
|
||||||
{
|
{
|
||||||
cpu_physical_memory_set_dirty_flag(ram_addr, DIRTY_MEMORY_CODE);
|
cpu_physical_memory_set_dirty_flag(ram_addr, DIRTY_MEMORY_CODE);
|
||||||
@@ -221,10 +221,11 @@ static void tlb_add_large_page(CPUArchState *env, target_ulong vaddr,
|
|||||||
/* Add a new TLB entry. At most one entry for a given virtual address
|
/* Add a new TLB entry. At most one entry for a given virtual address
|
||||||
is permitted. Only a single TARGET_PAGE_SIZE region is mapped, the
|
is permitted. Only a single TARGET_PAGE_SIZE region is mapped, the
|
||||||
supplied size is only used by tlb_flush_page. */
|
supplied size is only used by tlb_flush_page. */
|
||||||
void tlb_set_page(CPUArchState *env, target_ulong vaddr,
|
void tlb_set_page(CPUState *cpu, target_ulong vaddr,
|
||||||
hwaddr paddr, int prot,
|
hwaddr paddr, int prot,
|
||||||
int mmu_idx, target_ulong size)
|
int mmu_idx, target_ulong size)
|
||||||
{
|
{
|
||||||
|
CPUArchState *env = cpu->env_ptr;
|
||||||
MemoryRegionSection *section;
|
MemoryRegionSection *section;
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
target_ulong address;
|
target_ulong address;
|
||||||
@@ -232,7 +233,6 @@ void tlb_set_page(CPUArchState *env, target_ulong vaddr,
|
|||||||
uintptr_t addend;
|
uintptr_t addend;
|
||||||
CPUTLBEntry *te;
|
CPUTLBEntry *te;
|
||||||
hwaddr iotlb, xlat, sz;
|
hwaddr iotlb, xlat, sz;
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
|
||||||
|
|
||||||
assert(size >= TARGET_PAGE_SIZE);
|
assert(size >= TARGET_PAGE_SIZE);
|
||||||
if (size != TARGET_PAGE_SIZE) {
|
if (size != TARGET_PAGE_SIZE) {
|
||||||
@@ -261,7 +261,7 @@ void tlb_set_page(CPUArchState *env, target_ulong vaddr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
code_address = address;
|
code_address = address;
|
||||||
iotlb = memory_region_section_get_iotlb(env, section, vaddr, paddr, xlat,
|
iotlb = memory_region_section_get_iotlb(cpu, section, vaddr, paddr, xlat,
|
||||||
prot, &address);
|
prot, &address);
|
||||||
|
|
||||||
index = (vaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
|
index = (vaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
|
||||||
@@ -322,7 +322,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr)
|
|||||||
if (cc->do_unassigned_access) {
|
if (cc->do_unassigned_access) {
|
||||||
cc->do_unassigned_access(cpu, addr, false, true, 0, 4);
|
cc->do_unassigned_access(cpu, addr, false, true, 0, 4);
|
||||||
} else {
|
} else {
|
||||||
cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x"
|
cpu_abort(cpu, "Trying to execute code outside RAM or ROM at 0x"
|
||||||
TARGET_FMT_lx "\n", addr);
|
TARGET_FMT_lx "\n", addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,12 +33,14 @@ DriveInfo *add_init_drive(const char *optstr)
|
|||||||
{
|
{
|
||||||
DriveInfo *dinfo;
|
DriveInfo *dinfo;
|
||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
|
MachineClass *mc;
|
||||||
|
|
||||||
opts = drive_def(optstr);
|
opts = drive_def(optstr);
|
||||||
if (!opts)
|
if (!opts)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dinfo = drive_init(opts, current_machine->block_default_type);
|
mc = MACHINE_GET_CLASS(current_machine);
|
||||||
|
dinfo = drive_init(opts, mc->qemu_machine->block_default_type);
|
||||||
if (!dinfo) {
|
if (!dinfo) {
|
||||||
qemu_opts_del(opts);
|
qemu_opts_del(opts);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -1342,7 +1342,7 @@ int Disassembler::SubstituteImmediateField(Instruction* instr,
|
|||||||
ASSERT(format[5] == 'L');
|
ASSERT(format[5] == 'L');
|
||||||
AppendToOutput("#0x%" PRIx64, instr->ImmMoveWide());
|
AppendToOutput("#0x%" PRIx64, instr->ImmMoveWide());
|
||||||
if (instr->ShiftMoveWide() > 0) {
|
if (instr->ShiftMoveWide() > 0) {
|
||||||
AppendToOutput(", lsl #%d", 16 * instr->ShiftMoveWide());
|
AppendToOutput(", lsl #%" PRId64, 16 * instr->ShiftMoveWide());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 8;
|
return 8;
|
||||||
@@ -1391,7 +1391,7 @@ int Disassembler::SubstituteImmediateField(Instruction* instr,
|
|||||||
}
|
}
|
||||||
case 'F': { // IFPSingle, IFPDouble or IFPFBits.
|
case 'F': { // IFPSingle, IFPDouble or IFPFBits.
|
||||||
if (format[3] == 'F') { // IFPFbits.
|
if (format[3] == 'F') { // IFPFbits.
|
||||||
AppendToOutput("#%d", 64 - instr->FPScale());
|
AppendToOutput("#%" PRId64, 64 - instr->FPScale());
|
||||||
return 8;
|
return 8;
|
||||||
} else {
|
} else {
|
||||||
AppendToOutput("#0x%" PRIx64 " (%.4f)", instr->ImmFP(),
|
AppendToOutput("#0x%" PRIx64 " (%.4f)", instr->ImmFP(),
|
||||||
@@ -1412,23 +1412,23 @@ int Disassembler::SubstituteImmediateField(Instruction* instr,
|
|||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
case 'P': { // IP - Conditional compare.
|
case 'P': { // IP - Conditional compare.
|
||||||
AppendToOutput("#%d", instr->ImmCondCmp());
|
AppendToOutput("#%" PRId64, instr->ImmCondCmp());
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
case 'B': { // Bitfields.
|
case 'B': { // Bitfields.
|
||||||
return SubstituteBitfieldImmediateField(instr, format);
|
return SubstituteBitfieldImmediateField(instr, format);
|
||||||
}
|
}
|
||||||
case 'E': { // IExtract.
|
case 'E': { // IExtract.
|
||||||
AppendToOutput("#%d", instr->ImmS());
|
AppendToOutput("#%" PRId64, instr->ImmS());
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
case 'S': { // IS - Test and branch bit.
|
case 'S': { // IS - Test and branch bit.
|
||||||
AppendToOutput("#%d", (instr->ImmTestBranchBit5() << 5) |
|
AppendToOutput("#%" PRId64, (instr->ImmTestBranchBit5() << 5) |
|
||||||
instr->ImmTestBranchBit40());
|
instr->ImmTestBranchBit40());
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
case 'D': { // IDebug - HLT and BRK instructions.
|
case 'D': { // IDebug - HLT and BRK instructions.
|
||||||
AppendToOutput("#0x%x", instr->ImmException());
|
AppendToOutput("#0x%" PRIx64, instr->ImmException());
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@@ -1598,12 +1598,12 @@ int Disassembler::SubstituteExtendField(Instruction* instr,
|
|||||||
(((instr->ExtendMode() == UXTW) && (instr->SixtyFourBits() == 0)) ||
|
(((instr->ExtendMode() == UXTW) && (instr->SixtyFourBits() == 0)) ||
|
||||||
(instr->ExtendMode() == UXTX))) {
|
(instr->ExtendMode() == UXTX))) {
|
||||||
if (instr->ImmExtendShift() > 0) {
|
if (instr->ImmExtendShift() > 0) {
|
||||||
AppendToOutput(", lsl #%d", instr->ImmExtendShift());
|
AppendToOutput(", lsl #%" PRId64, instr->ImmExtendShift());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AppendToOutput(", %s", extend_mode[instr->ExtendMode()]);
|
AppendToOutput(", %s", extend_mode[instr->ExtendMode()]);
|
||||||
if (instr->ImmExtendShift() > 0) {
|
if (instr->ImmExtendShift() > 0) {
|
||||||
AppendToOutput(" #%d", instr->ImmExtendShift());
|
AppendToOutput(" #%" PRId64, instr->ImmExtendShift());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 3;
|
return 3;
|
||||||
@@ -1632,7 +1632,7 @@ int Disassembler::SubstituteLSRegOffsetField(Instruction* instr,
|
|||||||
if (!((ext == UXTX) && (shift == 0))) {
|
if (!((ext == UXTX) && (shift == 0))) {
|
||||||
AppendToOutput(", %s", extend_mode[ext]);
|
AppendToOutput(", %s", extend_mode[ext]);
|
||||||
if (shift != 0) {
|
if (shift != 0) {
|
||||||
AppendToOutput(" #%d", instr->SizeLS());
|
AppendToOutput(" #%" PRId64, instr->SizeLS());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 9;
|
return 9;
|
||||||
|
@@ -123,11 +123,12 @@ And it looks like this on the wire:
|
|||||||
|
|
||||||
Flat union types avoid the nesting on the wire. They are used whenever a
|
Flat union types avoid the nesting on the wire. They are used whenever a
|
||||||
specific field of the base type is declared as the discriminator ('type' is
|
specific field of the base type is declared as the discriminator ('type' is
|
||||||
then no longer generated). The discriminator must always be a string field.
|
then no longer generated). The discriminator must be of enumeration type.
|
||||||
The above example can then be modified as follows:
|
The above example can then be modified as follows:
|
||||||
|
|
||||||
|
{ 'enum': 'BlockdevDriver', 'data': [ 'raw', 'qcow2' ] }
|
||||||
{ 'type': 'BlockdevCommonOptions',
|
{ 'type': 'BlockdevCommonOptions',
|
||||||
'data': { 'driver': 'str', 'readonly': 'bool' } }
|
'data': { 'driver': 'BlockdevDriver', 'readonly': 'bool' } }
|
||||||
{ 'union': 'BlockdevOptions',
|
{ 'union': 'BlockdevOptions',
|
||||||
'base': 'BlockdevCommonOptions',
|
'base': 'BlockdevCommonOptions',
|
||||||
'discriminator': 'driver',
|
'discriminator': 'driver',
|
||||||
|
@@ -11,99 +11,92 @@
|
|||||||
; (Com+Lpt)" from the list. Click "Have a disk". Select this file.
|
; (Com+Lpt)" from the list. Click "Have a disk". Select this file.
|
||||||
; Procedure may vary a bit depending on the windows version.
|
; Procedure may vary a bit depending on the windows version.
|
||||||
|
|
||||||
; FIXME: This file covers the single port version only.
|
; This file covers all options: pci-serial, pci-serial-2x, pci-serial-4x
|
||||||
|
; for both 32 and 64 bit platforms.
|
||||||
|
|
||||||
[Version]
|
[Version]
|
||||||
Signature="$CHICAGO$"
|
Signature="$Windows NT$"
|
||||||
Class=Ports
|
Class=MultiFunction
|
||||||
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
|
ClassGUID={4d36e971-e325-11ce-bfc1-08002be10318}
|
||||||
Provider=%QEMU%
|
Provider=%QEMU%
|
||||||
DriverVer=09/24/2012,1.3.0
|
DriverVer=12/29/2013,1.3.0
|
||||||
|
[ControlFlags]
|
||||||
[SourceDisksNames]
|
ExcludeFromSelect=*
|
||||||
3426=windows cd
|
|
||||||
|
|
||||||
[SourceDisksFiles]
|
|
||||||
serial.sys = 3426
|
|
||||||
serenum.sys = 3426
|
|
||||||
|
|
||||||
[DestinationDirs]
|
|
||||||
DefaultDestDir = 11 ;LDID_SYS
|
|
||||||
ComPort.NT.Copy = 12 ;DIRID_DRIVERS
|
|
||||||
SerialEnumerator.NT.Copy=12 ;DIRID_DRIVERS
|
|
||||||
|
|
||||||
; Drivers
|
|
||||||
;----------------------------------------------------------
|
|
||||||
[Manufacturer]
|
[Manufacturer]
|
||||||
%QEMU%=QEMU,NTx86
|
%QEMU%=QEMU,NTx86,NTAMD64
|
||||||
|
|
||||||
[QEMU.NTx86]
|
[QEMU.NTx86]
|
||||||
%QEMU-PCI_SERIAL.DeviceDesc% = ComPort, "PCI\VEN_1b36&DEV_0002&CC_0700"
|
%QEMU-PCI_SERIAL_1_PORT%=ComPort_inst1, PCI\VEN_1B36&DEV_0002
|
||||||
|
%QEMU-PCI_SERIAL_2_PORT%=ComPort_inst2, PCI\VEN_1B36&DEV_0003
|
||||||
|
%QEMU-PCI_SERIAL_4_PORT%=ComPort_inst4, PCI\VEN_1B36&DEV_0004
|
||||||
|
|
||||||
; COM sections
|
[QEMU.NTAMD64]
|
||||||
;----------------------------------------------------------
|
%QEMU-PCI_SERIAL_1_PORT%=ComPort_inst1, PCI\VEN_1B36&DEV_0002
|
||||||
[ComPort.AddReg]
|
%QEMU-PCI_SERIAL_2_PORT%=ComPort_inst2, PCI\VEN_1B36&DEV_0003
|
||||||
HKR,,PortSubClass,1,01
|
%QEMU-PCI_SERIAL_4_PORT%=ComPort_inst4, PCI\VEN_1B36&DEV_0004
|
||||||
|
|
||||||
[ComPort.NT]
|
[ComPort_inst1]
|
||||||
AddReg=ComPort.AddReg, ComPort.NT.AddReg
|
Include=mf.inf
|
||||||
LogConfig=caa
|
Needs=MFINSTALL.mf
|
||||||
SyssetupPnPFlags = 1
|
|
||||||
|
|
||||||
[ComPort.NT.HW]
|
[ComPort_inst2]
|
||||||
AddReg=ComPort.NT.HW.AddReg
|
Include=mf.inf
|
||||||
|
Needs=MFINSTALL.mf
|
||||||
|
|
||||||
[ComPort.NT.AddReg]
|
[ComPort_inst4]
|
||||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
Include=mf.inf
|
||||||
|
Needs=MFINSTALL.mf
|
||||||
|
|
||||||
[ComPort.NT.HW.AddReg]
|
[ComPort_inst1.HW]
|
||||||
HKR,,"UpperFilters",0x00010000,"serenum"
|
AddReg=ComPort_inst1.RegHW
|
||||||
|
|
||||||
;-------------- Service installation
|
[ComPort_inst2.HW]
|
||||||
; Port Driver (function driver for this device)
|
AddReg=ComPort_inst2.RegHW
|
||||||
[ComPort.NT.Services]
|
|
||||||
AddService = Serial, 0x00000002, Serial_Service_Inst, Serial_EventLog_Inst
|
|
||||||
AddService = Serenum,,Serenum_Service_Inst
|
|
||||||
|
|
||||||
; -------------- Serial Port Driver install sections
|
[ComPort_inst4.HW]
|
||||||
[Serial_Service_Inst]
|
AddReg=ComPort_inst4.RegHW
|
||||||
DisplayName = %Serial.SVCDESC%
|
|
||||||
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
|
|
||||||
StartType = 1 ; SERVICE_SYSTEM_START (this driver may do detection)
|
|
||||||
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
|
|
||||||
ServiceBinary = %12%\serial.sys
|
|
||||||
LoadOrderGroup = Extended base
|
|
||||||
|
|
||||||
; -------------- Serenum Driver install section
|
[ComPort_inst1.Services]
|
||||||
[Serenum_Service_Inst]
|
Include=mf.inf
|
||||||
DisplayName = %Serenum.SVCDESC%
|
Needs=MFINSTALL.mf.Services
|
||||||
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
|
|
||||||
StartType = 3 ; SERVICE_DEMAND_START
|
|
||||||
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
|
|
||||||
ServiceBinary = %12%\serenum.sys
|
|
||||||
LoadOrderGroup = PNP Filter
|
|
||||||
|
|
||||||
[Serial_EventLog_Inst]
|
[ComPort_inst2.Services]
|
||||||
AddReg = Serial_EventLog_AddReg
|
Include=mf.inf
|
||||||
|
Needs=MFINSTALL.mf.Services
|
||||||
|
|
||||||
[Serial_EventLog_AddReg]
|
[ComPort_inst4.Services]
|
||||||
HKR,,EventMessageFile,0x00020000,"%%SystemRoot%%\System32\IoLogMsg.dll;%%SystemRoot%%\System32\drivers\serial.sys"
|
Include=mf.inf
|
||||||
HKR,,TypesSupported,0x00010001,7
|
Needs=MFINSTALL.mf.Services
|
||||||
|
|
||||||
; The following sections are COM port resource configs.
|
[ComPort_inst1.RegHW]
|
||||||
; Section name format means:
|
HKR,Child0000,HardwareID,,*PNP0501
|
||||||
; Char 1 = c (COM port)
|
HKR,Child0000,VaryingResourceMap,1,00, 00,00,00,00, 08,00,00,00
|
||||||
; Char 2 = I/O config: 1 (3f8), 2 (2f8), 3 (3e8), 4 (2e8), a (any)
|
HKR,Child0000,ResourceMap,1,02
|
||||||
; Char 3 = IRQ config: #, a (any)
|
|
||||||
|
|
||||||
[caa] ; Any base, any IRQ
|
[ComPort_inst2.RegHW]
|
||||||
ConfigPriority=HARDRECONFIG
|
HKR,Child0000,HardwareID,,*PNP0501
|
||||||
IOConfig=8@100-ffff%fff8(3ff::)
|
HKR,Child0000,VaryingResourceMap,1,00, 00,00,00,00, 08,00,00,00
|
||||||
IRQConfig=S:3,4,5,7,9,10,11,12,14,15
|
HKR,Child0000,ResourceMap,1,02
|
||||||
|
HKR,Child0001,HardwareID,,*PNP0501
|
||||||
|
HKR,Child0001,VaryingResourceMap,1,00, 08,00,00,00, 08,00,00,00
|
||||||
|
HKR,Child0001,ResourceMap,1,02
|
||||||
|
|
||||||
|
[ComPort_inst4.RegHW]
|
||||||
|
HKR,Child0000,HardwareID,,*PNP0501
|
||||||
|
HKR,Child0000,VaryingResourceMap,1,00, 00,00,00,00, 08,00,00,00
|
||||||
|
HKR,Child0000,ResourceMap,1,02
|
||||||
|
HKR,Child0001,HardwareID,,*PNP0501
|
||||||
|
HKR,Child0001,VaryingResourceMap,1,00, 08,00,00,00, 08,00,00,00
|
||||||
|
HKR,Child0001,ResourceMap,1,02
|
||||||
|
HKR,Child0002,HardwareID,,*PNP0501
|
||||||
|
HKR,Child0002,VaryingResourceMap,1,00, 10,00,00,00, 08,00,00,00
|
||||||
|
HKR,Child0002,ResourceMap,1,02
|
||||||
|
HKR,Child0003,HardwareID,,*PNP0501
|
||||||
|
HKR,Child0003,VaryingResourceMap,1,00, 18,00,00,00, 08,00,00,00
|
||||||
|
HKR,Child0003,ResourceMap,1,02
|
||||||
|
|
||||||
[Strings]
|
[Strings]
|
||||||
QEMU="QEMU"
|
QEMU="QEMU"
|
||||||
QEMU-PCI_SERIAL.DeviceDesc="QEMU Serial PCI Card"
|
QEMU-PCI_SERIAL_1_PORT="1x QEMU PCI Serial Card"
|
||||||
|
QEMU-PCI_SERIAL_2_PORT="2x QEMU PCI Serial Card"
|
||||||
Serial.SVCDESC = "Serial port driver"
|
QEMU-PCI_SERIAL_4_PORT="4x QEMU PCI Serial Card"
|
||||||
Serenum.SVCDESC = "Serenum Filter Driver"
|
|
||||||
|
132
exec.c
132
exec.c
@@ -33,6 +33,7 @@
|
|||||||
#include "hw/xen/xen.h"
|
#include "hw/xen/xen.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "qemu/config-file.h"
|
#include "qemu/config-file.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
#include "exec/memory.h"
|
#include "exec/memory.h"
|
||||||
#include "sysemu/dma.h"
|
#include "sysemu/dma.h"
|
||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
@@ -484,8 +485,8 @@ void cpu_exec_init(CPUArchState *env)
|
|||||||
}
|
}
|
||||||
cpu->cpu_index = cpu_index;
|
cpu->cpu_index = cpu_index;
|
||||||
cpu->numa_node = 0;
|
cpu->numa_node = 0;
|
||||||
QTAILQ_INIT(&env->breakpoints);
|
QTAILQ_INIT(&cpu->breakpoints);
|
||||||
QTAILQ_INIT(&env->watchpoints);
|
QTAILQ_INIT(&cpu->watchpoints);
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
cpu->as = &address_space_memory;
|
cpu->as = &address_space_memory;
|
||||||
cpu->thread_id = qemu_get_thread_id();
|
cpu->thread_id = qemu_get_thread_id();
|
||||||
@@ -527,29 +528,29 @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
|
|||||||
#endif /* TARGET_HAS_ICE */
|
#endif /* TARGET_HAS_ICE */
|
||||||
|
|
||||||
#if defined(CONFIG_USER_ONLY)
|
#if defined(CONFIG_USER_ONLY)
|
||||||
void cpu_watchpoint_remove_all(CPUArchState *env, int mask)
|
void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
|
||||||
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int cpu_watchpoint_insert(CPUArchState *env, target_ulong addr, target_ulong len,
|
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
|
||||||
int flags, CPUWatchpoint **watchpoint)
|
int flags, CPUWatchpoint **watchpoint)
|
||||||
{
|
{
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* Add a watchpoint. */
|
/* Add a watchpoint. */
|
||||||
int cpu_watchpoint_insert(CPUArchState *env, target_ulong addr, target_ulong len,
|
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
|
||||||
int flags, CPUWatchpoint **watchpoint)
|
int flags, CPUWatchpoint **watchpoint)
|
||||||
{
|
{
|
||||||
target_ulong len_mask = ~(len - 1);
|
vaddr len_mask = ~(len - 1);
|
||||||
CPUWatchpoint *wp;
|
CPUWatchpoint *wp;
|
||||||
|
|
||||||
/* sanity checks: allow power-of-2 lengths, deny unaligned watchpoints */
|
/* sanity checks: allow power-of-2 lengths, deny unaligned watchpoints */
|
||||||
if ((len & (len - 1)) || (addr & ~len_mask) ||
|
if ((len & (len - 1)) || (addr & ~len_mask) ||
|
||||||
len == 0 || len > TARGET_PAGE_SIZE) {
|
len == 0 || len > TARGET_PAGE_SIZE) {
|
||||||
fprintf(stderr, "qemu: tried to set invalid watchpoint at "
|
error_report("tried to set invalid watchpoint at %"
|
||||||
TARGET_FMT_lx ", len=" TARGET_FMT_lu "\n", addr, len);
|
VADDR_PRIx ", len=%" VADDR_PRIu, addr, len);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
wp = g_malloc(sizeof(*wp));
|
wp = g_malloc(sizeof(*wp));
|
||||||
@@ -559,12 +560,13 @@ int cpu_watchpoint_insert(CPUArchState *env, target_ulong addr, target_ulong len
|
|||||||
wp->flags = flags;
|
wp->flags = flags;
|
||||||
|
|
||||||
/* keep all GDB-injected watchpoints in front */
|
/* keep all GDB-injected watchpoints in front */
|
||||||
if (flags & BP_GDB)
|
if (flags & BP_GDB) {
|
||||||
QTAILQ_INSERT_HEAD(&env->watchpoints, wp, entry);
|
QTAILQ_INSERT_HEAD(&cpu->watchpoints, wp, entry);
|
||||||
else
|
} else {
|
||||||
QTAILQ_INSERT_TAIL(&env->watchpoints, wp, entry);
|
QTAILQ_INSERT_TAIL(&cpu->watchpoints, wp, entry);
|
||||||
|
}
|
||||||
|
|
||||||
tlb_flush_page(env, addr);
|
tlb_flush_page(cpu, addr);
|
||||||
|
|
||||||
if (watchpoint)
|
if (watchpoint)
|
||||||
*watchpoint = wp;
|
*watchpoint = wp;
|
||||||
@@ -572,16 +574,16 @@ int cpu_watchpoint_insert(CPUArchState *env, target_ulong addr, target_ulong len
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Remove a specific watchpoint. */
|
/* Remove a specific watchpoint. */
|
||||||
int cpu_watchpoint_remove(CPUArchState *env, target_ulong addr, target_ulong len,
|
int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
target_ulong len_mask = ~(len - 1);
|
vaddr len_mask = ~(len - 1);
|
||||||
CPUWatchpoint *wp;
|
CPUWatchpoint *wp;
|
||||||
|
|
||||||
QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
|
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
|
||||||
if (addr == wp->vaddr && len_mask == wp->len_mask
|
if (addr == wp->vaddr && len_mask == wp->len_mask
|
||||||
&& flags == (wp->flags & ~BP_WATCHPOINT_HIT)) {
|
&& flags == (wp->flags & ~BP_WATCHPOINT_HIT)) {
|
||||||
cpu_watchpoint_remove_by_ref(env, wp);
|
cpu_watchpoint_remove_by_ref(cpu, wp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -589,29 +591,30 @@ int cpu_watchpoint_remove(CPUArchState *env, target_ulong addr, target_ulong len
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Remove a specific watchpoint by reference. */
|
/* Remove a specific watchpoint by reference. */
|
||||||
void cpu_watchpoint_remove_by_ref(CPUArchState *env, CPUWatchpoint *watchpoint)
|
void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint)
|
||||||
{
|
{
|
||||||
QTAILQ_REMOVE(&env->watchpoints, watchpoint, entry);
|
QTAILQ_REMOVE(&cpu->watchpoints, watchpoint, entry);
|
||||||
|
|
||||||
tlb_flush_page(env, watchpoint->vaddr);
|
tlb_flush_page(cpu, watchpoint->vaddr);
|
||||||
|
|
||||||
g_free(watchpoint);
|
g_free(watchpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove all matching watchpoints. */
|
/* Remove all matching watchpoints. */
|
||||||
void cpu_watchpoint_remove_all(CPUArchState *env, int mask)
|
void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
|
||||||
{
|
{
|
||||||
CPUWatchpoint *wp, *next;
|
CPUWatchpoint *wp, *next;
|
||||||
|
|
||||||
QTAILQ_FOREACH_SAFE(wp, &env->watchpoints, entry, next) {
|
QTAILQ_FOREACH_SAFE(wp, &cpu->watchpoints, entry, next) {
|
||||||
if (wp->flags & mask)
|
if (wp->flags & mask) {
|
||||||
cpu_watchpoint_remove_by_ref(env, wp);
|
cpu_watchpoint_remove_by_ref(cpu, wp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Add a breakpoint. */
|
/* Add a breakpoint. */
|
||||||
int cpu_breakpoint_insert(CPUArchState *env, target_ulong pc, int flags,
|
int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
|
||||||
CPUBreakpoint **breakpoint)
|
CPUBreakpoint **breakpoint)
|
||||||
{
|
{
|
||||||
#if defined(TARGET_HAS_ICE)
|
#if defined(TARGET_HAS_ICE)
|
||||||
@@ -624,12 +627,12 @@ int cpu_breakpoint_insert(CPUArchState *env, target_ulong pc, int flags,
|
|||||||
|
|
||||||
/* keep all GDB-injected breakpoints in front */
|
/* keep all GDB-injected breakpoints in front */
|
||||||
if (flags & BP_GDB) {
|
if (flags & BP_GDB) {
|
||||||
QTAILQ_INSERT_HEAD(&env->breakpoints, bp, entry);
|
QTAILQ_INSERT_HEAD(&cpu->breakpoints, bp, entry);
|
||||||
} else {
|
} else {
|
||||||
QTAILQ_INSERT_TAIL(&env->breakpoints, bp, entry);
|
QTAILQ_INSERT_TAIL(&cpu->breakpoints, bp, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
breakpoint_invalidate(ENV_GET_CPU(env), pc);
|
breakpoint_invalidate(cpu, pc);
|
||||||
|
|
||||||
if (breakpoint) {
|
if (breakpoint) {
|
||||||
*breakpoint = bp;
|
*breakpoint = bp;
|
||||||
@@ -641,14 +644,14 @@ int cpu_breakpoint_insert(CPUArchState *env, target_ulong pc, int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Remove a specific breakpoint. */
|
/* Remove a specific breakpoint. */
|
||||||
int cpu_breakpoint_remove(CPUArchState *env, target_ulong pc, int flags)
|
int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)
|
||||||
{
|
{
|
||||||
#if defined(TARGET_HAS_ICE)
|
#if defined(TARGET_HAS_ICE)
|
||||||
CPUBreakpoint *bp;
|
CPUBreakpoint *bp;
|
||||||
|
|
||||||
QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
|
QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
|
||||||
if (bp->pc == pc && bp->flags == flags) {
|
if (bp->pc == pc && bp->flags == flags) {
|
||||||
cpu_breakpoint_remove_by_ref(env, bp);
|
cpu_breakpoint_remove_by_ref(cpu, bp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -659,26 +662,27 @@ int cpu_breakpoint_remove(CPUArchState *env, target_ulong pc, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Remove a specific breakpoint by reference. */
|
/* Remove a specific breakpoint by reference. */
|
||||||
void cpu_breakpoint_remove_by_ref(CPUArchState *env, CPUBreakpoint *breakpoint)
|
void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint)
|
||||||
{
|
{
|
||||||
#if defined(TARGET_HAS_ICE)
|
#if defined(TARGET_HAS_ICE)
|
||||||
QTAILQ_REMOVE(&env->breakpoints, breakpoint, entry);
|
QTAILQ_REMOVE(&cpu->breakpoints, breakpoint, entry);
|
||||||
|
|
||||||
breakpoint_invalidate(ENV_GET_CPU(env), breakpoint->pc);
|
breakpoint_invalidate(cpu, breakpoint->pc);
|
||||||
|
|
||||||
g_free(breakpoint);
|
g_free(breakpoint);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove all matching breakpoints. */
|
/* Remove all matching breakpoints. */
|
||||||
void cpu_breakpoint_remove_all(CPUArchState *env, int mask)
|
void cpu_breakpoint_remove_all(CPUState *cpu, int mask)
|
||||||
{
|
{
|
||||||
#if defined(TARGET_HAS_ICE)
|
#if defined(TARGET_HAS_ICE)
|
||||||
CPUBreakpoint *bp, *next;
|
CPUBreakpoint *bp, *next;
|
||||||
|
|
||||||
QTAILQ_FOREACH_SAFE(bp, &env->breakpoints, entry, next) {
|
QTAILQ_FOREACH_SAFE(bp, &cpu->breakpoints, entry, next) {
|
||||||
if (bp->flags & mask)
|
if (bp->flags & mask) {
|
||||||
cpu_breakpoint_remove_by_ref(env, bp);
|
cpu_breakpoint_remove_by_ref(cpu, bp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -702,9 +706,8 @@ void cpu_single_step(CPUState *cpu, int enabled)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpu_abort(CPUArchState *env, const char *fmt, ...)
|
void cpu_abort(CPUState *cpu, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_list ap2;
|
va_list ap2;
|
||||||
|
|
||||||
@@ -792,7 +795,7 @@ static void cpu_physical_memory_set_dirty_tracking(bool enable)
|
|||||||
in_migration = enable;
|
in_migration = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
hwaddr memory_region_section_get_iotlb(CPUArchState *env,
|
hwaddr memory_region_section_get_iotlb(CPUState *cpu,
|
||||||
MemoryRegionSection *section,
|
MemoryRegionSection *section,
|
||||||
target_ulong vaddr,
|
target_ulong vaddr,
|
||||||
hwaddr paddr, hwaddr xlat,
|
hwaddr paddr, hwaddr xlat,
|
||||||
@@ -818,7 +821,7 @@ hwaddr memory_region_section_get_iotlb(CPUArchState *env,
|
|||||||
|
|
||||||
/* Make accesses to pages with watchpoints go via the
|
/* Make accesses to pages with watchpoints go via the
|
||||||
watchpoint trap routines. */
|
watchpoint trap routines. */
|
||||||
QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
|
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
|
||||||
if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) {
|
if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) {
|
||||||
/* Avoid trapping reads of pages with a write breakpoint. */
|
/* Avoid trapping reads of pages with a write breakpoint. */
|
||||||
if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) {
|
if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) {
|
||||||
@@ -1029,7 +1032,7 @@ static void *file_ram_alloc(RAMBlock *block,
|
|||||||
|
|
||||||
hpagesize = gethugepagesize(path);
|
hpagesize = gethugepagesize(path);
|
||||||
if (!hpagesize) {
|
if (!hpagesize) {
|
||||||
return NULL;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memory < hpagesize) {
|
if (memory < hpagesize) {
|
||||||
@@ -1038,7 +1041,7 @@ static void *file_ram_alloc(RAMBlock *block,
|
|||||||
|
|
||||||
if (kvm_enabled() && !kvm_has_sync_mmu()) {
|
if (kvm_enabled() && !kvm_has_sync_mmu()) {
|
||||||
fprintf(stderr, "host lacks kvm mmu notifiers, -mem-path unsupported\n");
|
fprintf(stderr, "host lacks kvm mmu notifiers, -mem-path unsupported\n");
|
||||||
return NULL;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make name safe to use with mkstemp by replacing '/' with '_'. */
|
/* Make name safe to use with mkstemp by replacing '/' with '_'. */
|
||||||
@@ -1056,7 +1059,7 @@ static void *file_ram_alloc(RAMBlock *block,
|
|||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
perror("unable to create backing store for hugepages");
|
perror("unable to create backing store for hugepages");
|
||||||
g_free(filename);
|
g_free(filename);
|
||||||
return NULL;
|
goto error;
|
||||||
}
|
}
|
||||||
unlink(filename);
|
unlink(filename);
|
||||||
g_free(filename);
|
g_free(filename);
|
||||||
@@ -1076,7 +1079,7 @@ static void *file_ram_alloc(RAMBlock *block,
|
|||||||
if (area == MAP_FAILED) {
|
if (area == MAP_FAILED) {
|
||||||
perror("file_ram_alloc: can't mmap RAM pages");
|
perror("file_ram_alloc: can't mmap RAM pages");
|
||||||
close(fd);
|
close(fd);
|
||||||
return (NULL);
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mem_prealloc) {
|
if (mem_prealloc) {
|
||||||
@@ -1120,6 +1123,12 @@ static void *file_ram_alloc(RAMBlock *block,
|
|||||||
|
|
||||||
block->fd = fd;
|
block->fd = fd;
|
||||||
return area;
|
return area;
|
||||||
|
|
||||||
|
error:
|
||||||
|
if (mem_prealloc) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static void *file_ram_alloc(RAMBlock *block,
|
static void *file_ram_alloc(RAMBlock *block,
|
||||||
@@ -1547,7 +1556,7 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
|
|||||||
flushed */
|
flushed */
|
||||||
if (!cpu_physical_memory_is_clean(ram_addr)) {
|
if (!cpu_physical_memory_is_clean(ram_addr)) {
|
||||||
CPUArchState *env = current_cpu->env_ptr;
|
CPUArchState *env = current_cpu->env_ptr;
|
||||||
tlb_set_dirty(env, env->mem_io_vaddr);
|
tlb_set_dirty(env, current_cpu->mem_io_vaddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1566,34 +1575,35 @@ static const MemoryRegionOps notdirty_mem_ops = {
|
|||||||
/* Generate a debug exception if a watchpoint has been hit. */
|
/* Generate a debug exception if a watchpoint has been hit. */
|
||||||
static void check_watchpoint(int offset, int len_mask, int flags)
|
static void check_watchpoint(int offset, int len_mask, int flags)
|
||||||
{
|
{
|
||||||
CPUArchState *env = current_cpu->env_ptr;
|
CPUState *cpu = current_cpu;
|
||||||
|
CPUArchState *env = cpu->env_ptr;
|
||||||
target_ulong pc, cs_base;
|
target_ulong pc, cs_base;
|
||||||
target_ulong vaddr;
|
target_ulong vaddr;
|
||||||
CPUWatchpoint *wp;
|
CPUWatchpoint *wp;
|
||||||
int cpu_flags;
|
int cpu_flags;
|
||||||
|
|
||||||
if (env->watchpoint_hit) {
|
if (cpu->watchpoint_hit) {
|
||||||
/* We re-entered the check after replacing the TB. Now raise
|
/* We re-entered the check after replacing the TB. Now raise
|
||||||
* the debug interrupt so that is will trigger after the
|
* the debug interrupt so that is will trigger after the
|
||||||
* current instruction. */
|
* current instruction. */
|
||||||
cpu_interrupt(ENV_GET_CPU(env), CPU_INTERRUPT_DEBUG);
|
cpu_interrupt(cpu, CPU_INTERRUPT_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vaddr = (env->mem_io_vaddr & TARGET_PAGE_MASK) + offset;
|
vaddr = (cpu->mem_io_vaddr & TARGET_PAGE_MASK) + offset;
|
||||||
QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
|
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
|
||||||
if ((vaddr == (wp->vaddr & len_mask) ||
|
if ((vaddr == (wp->vaddr & len_mask) ||
|
||||||
(vaddr & wp->len_mask) == wp->vaddr) && (wp->flags & flags)) {
|
(vaddr & wp->len_mask) == wp->vaddr) && (wp->flags & flags)) {
|
||||||
wp->flags |= BP_WATCHPOINT_HIT;
|
wp->flags |= BP_WATCHPOINT_HIT;
|
||||||
if (!env->watchpoint_hit) {
|
if (!cpu->watchpoint_hit) {
|
||||||
env->watchpoint_hit = wp;
|
cpu->watchpoint_hit = wp;
|
||||||
tb_check_watchpoint(env);
|
tb_check_watchpoint(cpu);
|
||||||
if (wp->flags & BP_STOP_BEFORE_ACCESS) {
|
if (wp->flags & BP_STOP_BEFORE_ACCESS) {
|
||||||
env->exception_index = EXCP_DEBUG;
|
cpu->exception_index = EXCP_DEBUG;
|
||||||
cpu_loop_exit(env);
|
cpu_loop_exit(cpu);
|
||||||
} else {
|
} else {
|
||||||
cpu_get_tb_cpu_state(env, &pc, &cs_base, &cpu_flags);
|
cpu_get_tb_cpu_state(env, &pc, &cs_base, &cpu_flags);
|
||||||
tb_gen_code(env, pc, cs_base, cpu_flags, 1);
|
tb_gen_code(cpu, pc, cs_base, cpu_flags, 1);
|
||||||
cpu_resume_from_signal(env, NULL);
|
cpu_resume_from_signal(cpu, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1824,14 +1834,12 @@ static void tcg_commit(MemoryListener *listener)
|
|||||||
reset the modified entries */
|
reset the modified entries */
|
||||||
/* XXX: slow ! */
|
/* XXX: slow ! */
|
||||||
CPU_FOREACH(cpu) {
|
CPU_FOREACH(cpu) {
|
||||||
CPUArchState *env = cpu->env_ptr;
|
|
||||||
|
|
||||||
/* FIXME: Disentangle the cpu.h circular files deps so we can
|
/* FIXME: Disentangle the cpu.h circular files deps so we can
|
||||||
directly get the right CPU from listener. */
|
directly get the right CPU from listener. */
|
||||||
if (cpu->tcg_as_listener != listener) {
|
if (cpu->tcg_as_listener != listener) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tlb_flush(env, 1);
|
tlb_flush(cpu, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
46
gdbstub.c
46
gdbstub.c
@@ -635,7 +635,6 @@ static const int xlat_gdb_type[] = {
|
|||||||
static int gdb_breakpoint_insert(target_ulong addr, target_ulong len, int type)
|
static int gdb_breakpoint_insert(target_ulong addr, target_ulong len, int type)
|
||||||
{
|
{
|
||||||
CPUState *cpu;
|
CPUState *cpu;
|
||||||
CPUArchState *env;
|
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (kvm_enabled()) {
|
if (kvm_enabled()) {
|
||||||
@@ -646,19 +645,18 @@ static int gdb_breakpoint_insert(target_ulong addr, target_ulong len, int type)
|
|||||||
case GDB_BREAKPOINT_SW:
|
case GDB_BREAKPOINT_SW:
|
||||||
case GDB_BREAKPOINT_HW:
|
case GDB_BREAKPOINT_HW:
|
||||||
CPU_FOREACH(cpu) {
|
CPU_FOREACH(cpu) {
|
||||||
env = cpu->env_ptr;
|
err = cpu_breakpoint_insert(cpu, addr, BP_GDB, NULL);
|
||||||
err = cpu_breakpoint_insert(env, addr, BP_GDB, NULL);
|
if (err) {
|
||||||
if (err)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
case GDB_WATCHPOINT_WRITE:
|
case GDB_WATCHPOINT_WRITE:
|
||||||
case GDB_WATCHPOINT_READ:
|
case GDB_WATCHPOINT_READ:
|
||||||
case GDB_WATCHPOINT_ACCESS:
|
case GDB_WATCHPOINT_ACCESS:
|
||||||
CPU_FOREACH(cpu) {
|
CPU_FOREACH(cpu) {
|
||||||
env = cpu->env_ptr;
|
err = cpu_watchpoint_insert(cpu, addr, len, xlat_gdb_type[type],
|
||||||
err = cpu_watchpoint_insert(env, addr, len, xlat_gdb_type[type],
|
|
||||||
NULL);
|
NULL);
|
||||||
if (err)
|
if (err)
|
||||||
break;
|
break;
|
||||||
@@ -673,7 +671,6 @@ static int gdb_breakpoint_insert(target_ulong addr, target_ulong len, int type)
|
|||||||
static int gdb_breakpoint_remove(target_ulong addr, target_ulong len, int type)
|
static int gdb_breakpoint_remove(target_ulong addr, target_ulong len, int type)
|
||||||
{
|
{
|
||||||
CPUState *cpu;
|
CPUState *cpu;
|
||||||
CPUArchState *env;
|
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (kvm_enabled()) {
|
if (kvm_enabled()) {
|
||||||
@@ -684,19 +681,18 @@ static int gdb_breakpoint_remove(target_ulong addr, target_ulong len, int type)
|
|||||||
case GDB_BREAKPOINT_SW:
|
case GDB_BREAKPOINT_SW:
|
||||||
case GDB_BREAKPOINT_HW:
|
case GDB_BREAKPOINT_HW:
|
||||||
CPU_FOREACH(cpu) {
|
CPU_FOREACH(cpu) {
|
||||||
env = cpu->env_ptr;
|
err = cpu_breakpoint_remove(cpu, addr, BP_GDB);
|
||||||
err = cpu_breakpoint_remove(env, addr, BP_GDB);
|
if (err) {
|
||||||
if (err)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
case GDB_WATCHPOINT_WRITE:
|
case GDB_WATCHPOINT_WRITE:
|
||||||
case GDB_WATCHPOINT_READ:
|
case GDB_WATCHPOINT_READ:
|
||||||
case GDB_WATCHPOINT_ACCESS:
|
case GDB_WATCHPOINT_ACCESS:
|
||||||
CPU_FOREACH(cpu) {
|
CPU_FOREACH(cpu) {
|
||||||
env = cpu->env_ptr;
|
err = cpu_watchpoint_remove(cpu, addr, len, xlat_gdb_type[type]);
|
||||||
err = cpu_watchpoint_remove(env, addr, len, xlat_gdb_type[type]);
|
|
||||||
if (err)
|
if (err)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -710,7 +706,6 @@ static int gdb_breakpoint_remove(target_ulong addr, target_ulong len, int type)
|
|||||||
static void gdb_breakpoint_remove_all(void)
|
static void gdb_breakpoint_remove_all(void)
|
||||||
{
|
{
|
||||||
CPUState *cpu;
|
CPUState *cpu;
|
||||||
CPUArchState *env;
|
|
||||||
|
|
||||||
if (kvm_enabled()) {
|
if (kvm_enabled()) {
|
||||||
kvm_remove_all_breakpoints(gdbserver_state->c_cpu);
|
kvm_remove_all_breakpoints(gdbserver_state->c_cpu);
|
||||||
@@ -718,10 +713,9 @@ static void gdb_breakpoint_remove_all(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CPU_FOREACH(cpu) {
|
CPU_FOREACH(cpu) {
|
||||||
env = cpu->env_ptr;
|
cpu_breakpoint_remove_all(cpu, BP_GDB);
|
||||||
cpu_breakpoint_remove_all(env, BP_GDB);
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
cpu_watchpoint_remove_all(env, BP_GDB);
|
cpu_watchpoint_remove_all(cpu, BP_GDB);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1086,8 +1080,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
|
|||||||
}
|
}
|
||||||
#ifdef CONFIG_USER_ONLY
|
#ifdef CONFIG_USER_ONLY
|
||||||
else if (strncmp(p, "Offsets", 7) == 0) {
|
else if (strncmp(p, "Offsets", 7) == 0) {
|
||||||
CPUArchState *env = s->c_cpu->env_ptr;
|
TaskState *ts = s->c_cpu->opaque;
|
||||||
TaskState *ts = env->opaque;
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"Text=" TARGET_ABI_FMT_lx ";Data=" TARGET_ABI_FMT_lx
|
"Text=" TARGET_ABI_FMT_lx ";Data=" TARGET_ABI_FMT_lx
|
||||||
@@ -1205,8 +1198,8 @@ static void gdb_vm_state_change(void *opaque, int running, RunState state)
|
|||||||
}
|
}
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case RUN_STATE_DEBUG:
|
case RUN_STATE_DEBUG:
|
||||||
if (env->watchpoint_hit) {
|
if (cpu->watchpoint_hit) {
|
||||||
switch (env->watchpoint_hit->flags & BP_MEM_ACCESS) {
|
switch (cpu->watchpoint_hit->flags & BP_MEM_ACCESS) {
|
||||||
case BP_MEM_READ:
|
case BP_MEM_READ:
|
||||||
type = "r";
|
type = "r";
|
||||||
break;
|
break;
|
||||||
@@ -1220,8 +1213,8 @@ static void gdb_vm_state_change(void *opaque, int running, RunState state)
|
|||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"T%02xthread:%02x;%swatch:" TARGET_FMT_lx ";",
|
"T%02xthread:%02x;%swatch:" TARGET_FMT_lx ";",
|
||||||
GDB_SIGNAL_TRAP, cpu_index(cpu), type,
|
GDB_SIGNAL_TRAP, cpu_index(cpu), type,
|
||||||
env->watchpoint_hit->vaddr);
|
(target_ulong)cpu->watchpoint_hit->vaddr);
|
||||||
env->watchpoint_hit = NULL;
|
cpu->watchpoint_hit = NULL;
|
||||||
goto send_packet;
|
goto send_packet;
|
||||||
}
|
}
|
||||||
tb_flush(env);
|
tb_flush(env);
|
||||||
@@ -1594,13 +1587,16 @@ int gdbserver_start(int port)
|
|||||||
/* Disable gdb stub for child processes. */
|
/* Disable gdb stub for child processes. */
|
||||||
void gdbserver_fork(CPUArchState *env)
|
void gdbserver_fork(CPUArchState *env)
|
||||||
{
|
{
|
||||||
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
GDBState *s = gdbserver_state;
|
GDBState *s = gdbserver_state;
|
||||||
if (gdbserver_fd < 0 || s->fd < 0)
|
|
||||||
|
if (gdbserver_fd < 0 || s->fd < 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
close(s->fd);
|
close(s->fd);
|
||||||
s->fd = -1;
|
s->fd = -1;
|
||||||
cpu_breakpoint_remove_all(env, BP_GDB);
|
cpu_breakpoint_remove_all(cpu, BP_GDB);
|
||||||
cpu_watchpoint_remove_all(env, BP_GDB);
|
cpu_watchpoint_remove_all(cpu, BP_GDB);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static int gdb_chr_can_receive(void *opaque)
|
static int gdb_chr_can_receive(void *opaque)
|
||||||
|
@@ -110,10 +110,10 @@
|
|||||||
#define MP_PHY_88E3015 0x01410E20
|
#define MP_PHY_88E3015 0x01410E20
|
||||||
|
|
||||||
/* TX descriptor status */
|
/* TX descriptor status */
|
||||||
#define MP_ETH_TX_OWN (1 << 31)
|
#define MP_ETH_TX_OWN (1U << 31)
|
||||||
|
|
||||||
/* RX descriptor status */
|
/* RX descriptor status */
|
||||||
#define MP_ETH_RX_OWN (1 << 31)
|
#define MP_ETH_RX_OWN (1U << 31)
|
||||||
|
|
||||||
/* Interrupt cause/mask bits */
|
/* Interrupt cause/mask bits */
|
||||||
#define MP_ETH_IRQ_RX_BIT 0
|
#define MP_ETH_IRQ_RX_BIT 0
|
||||||
|
@@ -809,22 +809,26 @@ static inline void omap_pin_funcmux1_update(struct omap_mpu_state_s *s,
|
|||||||
uint32_t diff, uint32_t value)
|
uint32_t diff, uint32_t value)
|
||||||
{
|
{
|
||||||
if (s->compat1509) {
|
if (s->compat1509) {
|
||||||
if (diff & (1 << 31)) /* MCBSP3_CLK_HIZ_DI */
|
if (diff & (1U << 31)) {
|
||||||
omap_clk_onoff(omap_findclk(s, "mcbsp3.clkx"),
|
/* MCBSP3_CLK_HIZ_DI */
|
||||||
(value >> 31) & 1);
|
omap_clk_onoff(omap_findclk(s, "mcbsp3.clkx"), (value >> 31) & 1);
|
||||||
if (diff & (1 << 1)) /* CLK32K */
|
}
|
||||||
omap_clk_onoff(omap_findclk(s, "clk32k_out"),
|
if (diff & (1 << 1)) {
|
||||||
(~value >> 1) & 1);
|
/* CLK32K */
|
||||||
|
omap_clk_onoff(omap_findclk(s, "clk32k_out"), (~value >> 1) & 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void omap_pin_modconf1_update(struct omap_mpu_state_s *s,
|
static inline void omap_pin_modconf1_update(struct omap_mpu_state_s *s,
|
||||||
uint32_t diff, uint32_t value)
|
uint32_t diff, uint32_t value)
|
||||||
{
|
{
|
||||||
if (diff & (1 << 31)) /* CONF_MOD_UART3_CLK_MODE_R */
|
if (diff & (1U << 31)) {
|
||||||
|
/* CONF_MOD_UART3_CLK_MODE_R */
|
||||||
omap_clk_reparent(omap_findclk(s, "uart3_ck"),
|
omap_clk_reparent(omap_findclk(s, "uart3_ck"),
|
||||||
omap_findclk(s, ((value >> 31) & 1) ?
|
omap_findclk(s, ((value >> 31) & 1) ?
|
||||||
"ck_48m" : "armper_ck"));
|
"ck_48m" : "armper_ck"));
|
||||||
|
}
|
||||||
if (diff & (1 << 30)) /* CONF_MOD_UART2_CLK_MODE_R */
|
if (diff & (1 << 30)) /* CONF_MOD_UART2_CLK_MODE_R */
|
||||||
omap_clk_reparent(omap_findclk(s, "uart2_ck"),
|
omap_clk_reparent(omap_findclk(s, "uart2_ck"),
|
||||||
omap_findclk(s, ((value >> 30) & 1) ?
|
omap_findclk(s, ((value >> 30) & 1) ?
|
||||||
|
@@ -259,7 +259,7 @@ static void pxa2xx_pwrmode_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
|||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
/* Idle */
|
/* Idle */
|
||||||
if (!(s->cm_regs[CCCR >> 2] & (1 << 31))) { /* CPDIS */
|
if (!(s->cm_regs[CCCR >> 2] & (1U << 31))) { /* CPDIS */
|
||||||
cpu_interrupt(CPU(s->cpu), CPU_INTERRUPT_HALT);
|
cpu_interrupt(CPU(s->cpu), CPU_INTERRUPT_HALT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -496,7 +496,7 @@ typedef struct {
|
|||||||
#define SSCR0_SSE (1 << 7)
|
#define SSCR0_SSE (1 << 7)
|
||||||
#define SSCR0_RIM (1 << 22)
|
#define SSCR0_RIM (1 << 22)
|
||||||
#define SSCR0_TIM (1 << 23)
|
#define SSCR0_TIM (1 << 23)
|
||||||
#define SSCR0_MOD (1 << 31)
|
#define SSCR0_MOD (1U << 31)
|
||||||
#define SSCR0_DSS(x) (((((x) >> 16) & 0x10) | ((x) & 0xf)) + 1)
|
#define SSCR0_DSS(x) (((((x) >> 16) & 0x10) | ((x) & 0xf)) + 1)
|
||||||
#define SSCR1_RIE (1 << 0)
|
#define SSCR1_RIE (1 << 0)
|
||||||
#define SSCR1_TIE (1 << 1)
|
#define SSCR1_TIE (1 << 1)
|
||||||
@@ -1006,7 +1006,7 @@ static void pxa2xx_rtc_write(void *opaque, hwaddr addr,
|
|||||||
|
|
||||||
switch (addr) {
|
switch (addr) {
|
||||||
case RTTR:
|
case RTTR:
|
||||||
if (!(s->rttr & (1 << 31))) {
|
if (!(s->rttr & (1U << 31))) {
|
||||||
pxa2xx_rtc_hzupdate(s);
|
pxa2xx_rtc_hzupdate(s);
|
||||||
s->rttr = value;
|
s->rttr = value;
|
||||||
pxa2xx_rtc_alarm_update(s, s->rtsr);
|
pxa2xx_rtc_alarm_update(s, s->rtsr);
|
||||||
|
@@ -110,7 +110,7 @@ static void pxa2xx_gpio_set(void *opaque, int line, int level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bank = line >> 5;
|
bank = line >> 5;
|
||||||
mask = 1 << (line & 31);
|
mask = 1U << (line & 31);
|
||||||
|
|
||||||
if (level) {
|
if (level) {
|
||||||
s->status[bank] |= s->rising[bank] & mask &
|
s->status[bank] |= s->rising[bank] & mask &
|
||||||
|
@@ -105,7 +105,7 @@ static inline uint32_t pxa2xx_pic_highest(PXA2xxPICState *s) {
|
|||||||
|
|
||||||
for (i = PXA2XX_PIC_SRCS - 1; i >= 0; i --) {
|
for (i = PXA2XX_PIC_SRCS - 1; i >= 0; i --) {
|
||||||
irq = s->priority[i] & 0x3f;
|
irq = s->priority[i] & 0x3f;
|
||||||
if ((s->priority[i] & (1 << 31)) && irq < PXA2XX_PIC_SRCS) {
|
if ((s->priority[i] & (1U << 31)) && irq < PXA2XX_PIC_SRCS) {
|
||||||
/* Source peripheral ID is valid. */
|
/* Source peripheral ID is valid. */
|
||||||
bit = 1 << (irq & 31);
|
bit = 1 << (irq & 31);
|
||||||
int_set = (irq >= 32);
|
int_set = (irq >= 32);
|
||||||
@@ -119,7 +119,7 @@ static inline uint32_t pxa2xx_pic_highest(PXA2xxPICState *s) {
|
|||||||
if (mask[int_set] & bit & ~s->is_fiq[int_set]) {
|
if (mask[int_set] & bit & ~s->is_fiq[int_set]) {
|
||||||
/* IRQ asserted */
|
/* IRQ asserted */
|
||||||
ichp &= 0x0000ffff;
|
ichp &= 0x0000ffff;
|
||||||
ichp |= (1 << 31) | (irq << 16);
|
ichp |= (1U << 31) | (irq << 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -658,14 +658,15 @@ static void spitz_adc_temp_on(void *opaque, int line, int level)
|
|||||||
max111x_set_input(max1111, MAX1111_BATT_TEMP, 0);
|
max111x_set_input(max1111, MAX1111_BATT_TEMP, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int corgi_ssp_init(SSISlave *dev)
|
static int corgi_ssp_init(SSISlave *d)
|
||||||
{
|
{
|
||||||
CorgiSSPState *s = FROM_SSI_SLAVE(CorgiSSPState, dev);
|
DeviceState *dev = DEVICE(d);
|
||||||
|
CorgiSSPState *s = FROM_SSI_SLAVE(CorgiSSPState, d);
|
||||||
|
|
||||||
qdev_init_gpio_in(&dev->qdev, corgi_ssp_gpio_cs, 3);
|
qdev_init_gpio_in(dev, corgi_ssp_gpio_cs, 3);
|
||||||
s->bus[0] = ssi_create_bus(&dev->qdev, "ssi0");
|
s->bus[0] = ssi_create_bus(dev, "ssi0");
|
||||||
s->bus[1] = ssi_create_bus(&dev->qdev, "ssi1");
|
s->bus[1] = ssi_create_bus(dev, "ssi1");
|
||||||
s->bus[2] = ssi_create_bus(&dev->qdev, "ssi2");
|
s->bus[2] = ssi_create_bus(dev, "ssi2");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -223,13 +223,13 @@ static void *cur_chip = NULL; /* current chip point */
|
|||||||
/* static OPLSAMPLE *bufL,*bufR; */
|
/* static OPLSAMPLE *bufL,*bufR; */
|
||||||
static OPL_CH *S_CH;
|
static OPL_CH *S_CH;
|
||||||
static OPL_CH *E_CH;
|
static OPL_CH *E_CH;
|
||||||
OPL_SLOT *SLOT7_1,*SLOT7_2,*SLOT8_1,*SLOT8_2;
|
static OPL_SLOT *SLOT7_1, *SLOT7_2, *SLOT8_1, *SLOT8_2;
|
||||||
|
|
||||||
static INT32 outd[1];
|
static INT32 outd[1];
|
||||||
static INT32 ams;
|
static INT32 ams;
|
||||||
static INT32 vib;
|
static INT32 vib;
|
||||||
INT32 *ams_table;
|
static INT32 *ams_table;
|
||||||
INT32 *vib_table;
|
static INT32 *vib_table;
|
||||||
static INT32 amsIncr;
|
static INT32 amsIncr;
|
||||||
static INT32 vibIncr;
|
static INT32 vibIncr;
|
||||||
static INT32 feedback2; /* connect for SLOT 2 */
|
static INT32 feedback2; /* connect for SLOT 2 */
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#include "virtio-blk.h"
|
#include "virtio-blk.h"
|
||||||
#include "block/aio.h"
|
#include "block/aio.h"
|
||||||
#include "hw/virtio/virtio-bus.h"
|
#include "hw/virtio/virtio-bus.h"
|
||||||
|
#include "monitor/monitor.h" /* for object_add() */
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SEG_MAX = 126, /* maximum number of I/O segments */
|
SEG_MAX = 126, /* maximum number of I/O segments */
|
||||||
@@ -44,8 +45,6 @@ struct VirtIOBlockDataPlane {
|
|||||||
bool started;
|
bool started;
|
||||||
bool starting;
|
bool starting;
|
||||||
bool stopping;
|
bool stopping;
|
||||||
QEMUBH *start_bh;
|
|
||||||
QemuThread thread;
|
|
||||||
|
|
||||||
VirtIOBlkConf *blk;
|
VirtIOBlkConf *blk;
|
||||||
int fd; /* image file descriptor */
|
int fd; /* image file descriptor */
|
||||||
@@ -59,12 +58,14 @@ struct VirtIOBlockDataPlane {
|
|||||||
* (because you don't own the file descriptor or handle; you just
|
* (because you don't own the file descriptor or handle; you just
|
||||||
* use it).
|
* use it).
|
||||||
*/
|
*/
|
||||||
|
IOThread *iothread;
|
||||||
|
bool internal_iothread;
|
||||||
AioContext *ctx;
|
AioContext *ctx;
|
||||||
EventNotifier io_notifier; /* Linux AIO completion */
|
EventNotifier io_notifier; /* Linux AIO completion */
|
||||||
EventNotifier host_notifier; /* doorbell */
|
EventNotifier host_notifier; /* doorbell */
|
||||||
|
|
||||||
IOQueue ioqueue; /* Linux AIO queue (should really be per
|
IOQueue ioqueue; /* Linux AIO queue (should really be per
|
||||||
dataplane thread) */
|
IOThread) */
|
||||||
VirtIOBlockRequest requests[REQ_MAX]; /* pool of requests, managed by the
|
VirtIOBlockRequest requests[REQ_MAX]; /* pool of requests, managed by the
|
||||||
queue */
|
queue */
|
||||||
|
|
||||||
@@ -342,26 +343,7 @@ static void handle_io(EventNotifier *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *data_plane_thread(void *opaque)
|
/* Context: QEMU global mutex held */
|
||||||
{
|
|
||||||
VirtIOBlockDataPlane *s = opaque;
|
|
||||||
|
|
||||||
while (!s->stopping || s->num_reqs > 0) {
|
|
||||||
aio_poll(s->ctx, true);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void start_data_plane_bh(void *opaque)
|
|
||||||
{
|
|
||||||
VirtIOBlockDataPlane *s = opaque;
|
|
||||||
|
|
||||||
qemu_bh_delete(s->start_bh);
|
|
||||||
s->start_bh = NULL;
|
|
||||||
qemu_thread_create(&s->thread, data_plane_thread,
|
|
||||||
s, QEMU_THREAD_JOINABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
|
void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
|
||||||
VirtIOBlockDataPlane **dataplane,
|
VirtIOBlockDataPlane **dataplane,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
@@ -408,12 +390,33 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
|
|||||||
s->fd = fd;
|
s->fd = fd;
|
||||||
s->blk = blk;
|
s->blk = blk;
|
||||||
|
|
||||||
|
if (blk->iothread) {
|
||||||
|
s->internal_iothread = false;
|
||||||
|
s->iothread = blk->iothread;
|
||||||
|
object_ref(OBJECT(s->iothread));
|
||||||
|
} else {
|
||||||
|
/* Create per-device IOThread if none specified */
|
||||||
|
Error *local_err = NULL;
|
||||||
|
|
||||||
|
s->internal_iothread = true;
|
||||||
|
object_add(TYPE_IOTHREAD, vdev->name, NULL, NULL, &local_err);
|
||||||
|
if (error_is_set(&local_err)) {
|
||||||
|
error_propagate(errp, local_err);
|
||||||
|
g_free(s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
s->iothread = iothread_find(vdev->name);
|
||||||
|
assert(s->iothread);
|
||||||
|
}
|
||||||
|
s->ctx = iothread_get_aio_context(s->iothread);
|
||||||
|
|
||||||
/* Prevent block operations that conflict with data plane thread */
|
/* Prevent block operations that conflict with data plane thread */
|
||||||
bdrv_set_in_use(blk->conf.bs, 1);
|
bdrv_set_in_use(blk->conf.bs, 1);
|
||||||
|
|
||||||
*dataplane = s;
|
*dataplane = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Context: QEMU global mutex held */
|
||||||
void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s)
|
void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s)
|
||||||
{
|
{
|
||||||
if (!s) {
|
if (!s) {
|
||||||
@@ -422,9 +425,14 @@ void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s)
|
|||||||
|
|
||||||
virtio_blk_data_plane_stop(s);
|
virtio_blk_data_plane_stop(s);
|
||||||
bdrv_set_in_use(s->blk->conf.bs, 0);
|
bdrv_set_in_use(s->blk->conf.bs, 0);
|
||||||
|
object_unref(OBJECT(s->iothread));
|
||||||
|
if (s->internal_iothread) {
|
||||||
|
object_unparent(OBJECT(s->iothread));
|
||||||
|
}
|
||||||
g_free(s);
|
g_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Context: QEMU global mutex held */
|
||||||
void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
|
void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
|
||||||
{
|
{
|
||||||
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev)));
|
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev)));
|
||||||
@@ -448,8 +456,6 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->ctx = aio_context_new();
|
|
||||||
|
|
||||||
/* Set up guest notifier (irq) */
|
/* Set up guest notifier (irq) */
|
||||||
if (k->set_guest_notifiers(qbus->parent, 1, true) != 0) {
|
if (k->set_guest_notifiers(qbus->parent, 1, true) != 0) {
|
||||||
fprintf(stderr, "virtio-blk failed to set guest notifier, "
|
fprintf(stderr, "virtio-blk failed to set guest notifier, "
|
||||||
@@ -464,7 +470,6 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
s->host_notifier = *virtio_queue_get_host_notifier(vq);
|
s->host_notifier = *virtio_queue_get_host_notifier(vq);
|
||||||
aio_set_event_notifier(s->ctx, &s->host_notifier, handle_notify);
|
|
||||||
|
|
||||||
/* Set up ioqueue */
|
/* Set up ioqueue */
|
||||||
ioq_init(&s->ioqueue, s->fd, REQ_MAX);
|
ioq_init(&s->ioqueue, s->fd, REQ_MAX);
|
||||||
@@ -472,7 +477,6 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
|
|||||||
ioq_put_iocb(&s->ioqueue, &s->requests[i].iocb);
|
ioq_put_iocb(&s->ioqueue, &s->requests[i].iocb);
|
||||||
}
|
}
|
||||||
s->io_notifier = *ioq_get_notifier(&s->ioqueue);
|
s->io_notifier = *ioq_get_notifier(&s->ioqueue);
|
||||||
aio_set_event_notifier(s->ctx, &s->io_notifier, handle_io);
|
|
||||||
|
|
||||||
s->starting = false;
|
s->starting = false;
|
||||||
s->started = true;
|
s->started = true;
|
||||||
@@ -481,11 +485,14 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
|
|||||||
/* Kick right away to begin processing requests already in vring */
|
/* Kick right away to begin processing requests already in vring */
|
||||||
event_notifier_set(virtio_queue_get_host_notifier(vq));
|
event_notifier_set(virtio_queue_get_host_notifier(vq));
|
||||||
|
|
||||||
/* Spawn thread in BH so it inherits iothread cpusets */
|
/* Get this show started by hooking up our callbacks */
|
||||||
s->start_bh = qemu_bh_new(start_data_plane_bh, s);
|
aio_context_acquire(s->ctx);
|
||||||
qemu_bh_schedule(s->start_bh);
|
aio_set_event_notifier(s->ctx, &s->host_notifier, handle_notify);
|
||||||
|
aio_set_event_notifier(s->ctx, &s->io_notifier, handle_io);
|
||||||
|
aio_context_release(s->ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Context: QEMU global mutex held */
|
||||||
void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)
|
void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)
|
||||||
{
|
{
|
||||||
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev)));
|
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev)));
|
||||||
@@ -496,27 +503,32 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)
|
|||||||
s->stopping = true;
|
s->stopping = true;
|
||||||
trace_virtio_blk_data_plane_stop(s);
|
trace_virtio_blk_data_plane_stop(s);
|
||||||
|
|
||||||
/* Stop thread or cancel pending thread creation BH */
|
aio_context_acquire(s->ctx);
|
||||||
if (s->start_bh) {
|
|
||||||
qemu_bh_delete(s->start_bh);
|
/* Stop notifications for new requests from guest */
|
||||||
s->start_bh = NULL;
|
aio_set_event_notifier(s->ctx, &s->host_notifier, NULL);
|
||||||
} else {
|
|
||||||
aio_notify(s->ctx);
|
/* Complete pending requests */
|
||||||
qemu_thread_join(&s->thread);
|
while (s->num_reqs > 0) {
|
||||||
|
aio_poll(s->ctx, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Stop ioq callbacks (there are no pending requests left) */
|
||||||
aio_set_event_notifier(s->ctx, &s->io_notifier, NULL);
|
aio_set_event_notifier(s->ctx, &s->io_notifier, NULL);
|
||||||
|
|
||||||
|
aio_context_release(s->ctx);
|
||||||
|
|
||||||
|
/* Sync vring state back to virtqueue so that non-dataplane request
|
||||||
|
* processing can continue when we disable the host notifier below.
|
||||||
|
*/
|
||||||
|
vring_teardown(&s->vring, s->vdev, 0);
|
||||||
|
|
||||||
ioq_cleanup(&s->ioqueue);
|
ioq_cleanup(&s->ioqueue);
|
||||||
|
|
||||||
aio_set_event_notifier(s->ctx, &s->host_notifier, NULL);
|
|
||||||
k->set_host_notifier(qbus->parent, 0, false);
|
k->set_host_notifier(qbus->parent, 0, false);
|
||||||
|
|
||||||
aio_context_unref(s->ctx);
|
|
||||||
|
|
||||||
/* Clean up guest notifier (irq) */
|
/* Clean up guest notifier (irq) */
|
||||||
k->set_guest_notifiers(qbus->parent, 1, false);
|
k->set_guest_notifiers(qbus->parent, 1, false);
|
||||||
|
|
||||||
vring_teardown(&s->vring, s->vdev, 0);
|
|
||||||
s->started = false;
|
s->started = false;
|
||||||
s->stopping = false;
|
s->stopping = false;
|
||||||
}
|
}
|
||||||
|
@@ -241,7 +241,8 @@ typedef enum {
|
|||||||
} CMDState;
|
} CMDState;
|
||||||
|
|
||||||
typedef struct Flash {
|
typedef struct Flash {
|
||||||
SSISlave ssidev;
|
SSISlave parent_obj;
|
||||||
|
|
||||||
uint32_t r;
|
uint32_t r;
|
||||||
|
|
||||||
BlockDriverState *bdrv;
|
BlockDriverState *bdrv;
|
||||||
@@ -545,7 +546,7 @@ static void decode_new_cmd(Flash *s, uint32_t value)
|
|||||||
|
|
||||||
static int m25p80_cs(SSISlave *ss, bool select)
|
static int m25p80_cs(SSISlave *ss, bool select)
|
||||||
{
|
{
|
||||||
Flash *s = FROM_SSI_SLAVE(Flash, ss);
|
Flash *s = M25P80(ss);
|
||||||
|
|
||||||
if (select) {
|
if (select) {
|
||||||
s->len = 0;
|
s->len = 0;
|
||||||
@@ -561,7 +562,7 @@ static int m25p80_cs(SSISlave *ss, bool select)
|
|||||||
|
|
||||||
static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx)
|
static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx)
|
||||||
{
|
{
|
||||||
Flash *s = FROM_SSI_SLAVE(Flash, ss);
|
Flash *s = M25P80(ss);
|
||||||
uint32_t r = 0;
|
uint32_t r = 0;
|
||||||
|
|
||||||
switch (s->state) {
|
switch (s->state) {
|
||||||
@@ -610,7 +611,7 @@ static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx)
|
|||||||
static int m25p80_init(SSISlave *ss)
|
static int m25p80_init(SSISlave *ss)
|
||||||
{
|
{
|
||||||
DriveInfo *dinfo;
|
DriveInfo *dinfo;
|
||||||
Flash *s = FROM_SSI_SLAVE(Flash, ss);
|
Flash *s = M25P80(ss);
|
||||||
M25P80Class *mc = M25P80_GET_CLASS(s);
|
M25P80Class *mc = M25P80_GET_CLASS(s);
|
||||||
|
|
||||||
s->pi = mc->pi;
|
s->pi = mc->pi;
|
||||||
|
@@ -15,8 +15,13 @@
|
|||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "hw/virtio/virtio-serial.h"
|
#include "hw/virtio/virtio-serial.h"
|
||||||
|
|
||||||
|
#define TYPE_VIRTIO_CONSOLE_SERIAL_PORT "virtserialport"
|
||||||
|
#define VIRTIO_CONSOLE(obj) \
|
||||||
|
OBJECT_CHECK(VirtConsole, (obj), TYPE_VIRTIO_CONSOLE_SERIAL_PORT)
|
||||||
|
|
||||||
typedef struct VirtConsole {
|
typedef struct VirtConsole {
|
||||||
VirtIOSerialPort port;
|
VirtIOSerialPort parent_obj;
|
||||||
|
|
||||||
CharDriverState *chr;
|
CharDriverState *chr;
|
||||||
guint watch;
|
guint watch;
|
||||||
} VirtConsole;
|
} VirtConsole;
|
||||||
@@ -31,7 +36,7 @@ static gboolean chr_write_unblocked(GIOChannel *chan, GIOCondition cond,
|
|||||||
VirtConsole *vcon = opaque;
|
VirtConsole *vcon = opaque;
|
||||||
|
|
||||||
vcon->watch = 0;
|
vcon->watch = 0;
|
||||||
virtio_serial_throttle_port(&vcon->port, false);
|
virtio_serial_throttle_port(VIRTIO_SERIAL_PORT(vcon), false);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +44,7 @@ static gboolean chr_write_unblocked(GIOChannel *chan, GIOCondition cond,
|
|||||||
static ssize_t flush_buf(VirtIOSerialPort *port,
|
static ssize_t flush_buf(VirtIOSerialPort *port,
|
||||||
const uint8_t *buf, ssize_t len)
|
const uint8_t *buf, ssize_t len)
|
||||||
{
|
{
|
||||||
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
|
VirtConsole *vcon = VIRTIO_CONSOLE(port);
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
if (!vcon->chr) {
|
if (!vcon->chr) {
|
||||||
@@ -75,7 +80,7 @@ static ssize_t flush_buf(VirtIOSerialPort *port,
|
|||||||
/* Callback function that's called when the guest opens/closes the port */
|
/* Callback function that's called when the guest opens/closes the port */
|
||||||
static void set_guest_connected(VirtIOSerialPort *port, int guest_connected)
|
static void set_guest_connected(VirtIOSerialPort *port, int guest_connected)
|
||||||
{
|
{
|
||||||
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
|
VirtConsole *vcon = VIRTIO_CONSOLE(port);
|
||||||
|
|
||||||
if (!vcon->chr) {
|
if (!vcon->chr) {
|
||||||
return;
|
return;
|
||||||
@@ -88,45 +93,49 @@ static int chr_can_read(void *opaque)
|
|||||||
{
|
{
|
||||||
VirtConsole *vcon = opaque;
|
VirtConsole *vcon = opaque;
|
||||||
|
|
||||||
return virtio_serial_guest_ready(&vcon->port);
|
return virtio_serial_guest_ready(VIRTIO_SERIAL_PORT(vcon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send data from a char device over to the guest */
|
/* Send data from a char device over to the guest */
|
||||||
static void chr_read(void *opaque, const uint8_t *buf, int size)
|
static void chr_read(void *opaque, const uint8_t *buf, int size)
|
||||||
{
|
{
|
||||||
VirtConsole *vcon = opaque;
|
VirtConsole *vcon = opaque;
|
||||||
|
VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(vcon);
|
||||||
|
|
||||||
trace_virtio_console_chr_read(vcon->port.id, size);
|
trace_virtio_console_chr_read(port->id, size);
|
||||||
virtio_serial_write(&vcon->port, buf, size);
|
virtio_serial_write(port, buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chr_event(void *opaque, int event)
|
static void chr_event(void *opaque, int event)
|
||||||
{
|
{
|
||||||
VirtConsole *vcon = opaque;
|
VirtConsole *vcon = opaque;
|
||||||
|
VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(vcon);
|
||||||
|
|
||||||
trace_virtio_console_chr_event(vcon->port.id, event);
|
trace_virtio_console_chr_event(port->id, event);
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case CHR_EVENT_OPENED:
|
case CHR_EVENT_OPENED:
|
||||||
virtio_serial_open(&vcon->port);
|
virtio_serial_open(port);
|
||||||
break;
|
break;
|
||||||
case CHR_EVENT_CLOSED:
|
case CHR_EVENT_CLOSED:
|
||||||
if (vcon->watch) {
|
if (vcon->watch) {
|
||||||
g_source_remove(vcon->watch);
|
g_source_remove(vcon->watch);
|
||||||
vcon->watch = 0;
|
vcon->watch = 0;
|
||||||
}
|
}
|
||||||
virtio_serial_close(&vcon->port);
|
virtio_serial_close(port);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtconsole_initfn(VirtIOSerialPort *port)
|
static void virtconsole_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
|
VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(dev);
|
||||||
VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_GET_CLASS(port);
|
VirtConsole *vcon = VIRTIO_CONSOLE(dev);
|
||||||
|
VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_GET_CLASS(dev);
|
||||||
|
|
||||||
if (port->id == 0 && !k->is_console) {
|
if (port->id == 0 && !k->is_console) {
|
||||||
error_report("Port number 0 on virtio-serial devices reserved for virtconsole devices for backward compatibility.");
|
error_setg(errp, "Port number 0 on virtio-serial devices reserved "
|
||||||
return -1;
|
"for virtconsole devices for backward compatibility.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vcon->chr) {
|
if (vcon->chr) {
|
||||||
@@ -134,43 +143,27 @@ static int virtconsole_initfn(VirtIOSerialPort *port)
|
|||||||
qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
|
qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
|
||||||
vcon);
|
vcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtconsole_exitfn(VirtIOSerialPort *port)
|
static void virtconsole_unrealize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
|
VirtConsole *vcon = VIRTIO_CONSOLE(dev);
|
||||||
|
|
||||||
if (vcon->watch) {
|
if (vcon->watch) {
|
||||||
g_source_remove(vcon->watch);
|
g_source_remove(vcon->watch);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Property virtconsole_properties[] = {
|
|
||||||
DEFINE_PROP_CHR("chardev", VirtConsole, chr),
|
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
|
||||||
};
|
|
||||||
|
|
||||||
static void virtconsole_class_init(ObjectClass *klass, void *data)
|
static void virtconsole_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
||||||
VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_CLASS(klass);
|
VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_CLASS(klass);
|
||||||
|
|
||||||
k->is_console = true;
|
k->is_console = true;
|
||||||
k->init = virtconsole_initfn;
|
|
||||||
k->exit = virtconsole_exitfn;
|
|
||||||
k->have_data = flush_buf;
|
|
||||||
k->set_guest_connected = set_guest_connected;
|
|
||||||
dc->props = virtconsole_properties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo virtconsole_info = {
|
static const TypeInfo virtconsole_info = {
|
||||||
.name = "virtconsole",
|
.name = "virtconsole",
|
||||||
.parent = TYPE_VIRTIO_SERIAL_PORT,
|
.parent = TYPE_VIRTIO_CONSOLE_SERIAL_PORT,
|
||||||
.instance_size = sizeof(VirtConsole),
|
|
||||||
.class_init = virtconsole_class_init,
|
.class_init = virtconsole_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -184,15 +177,15 @@ static void virtserialport_class_init(ObjectClass *klass, void *data)
|
|||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_CLASS(klass);
|
VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_CLASS(klass);
|
||||||
|
|
||||||
k->init = virtconsole_initfn;
|
k->realize = virtconsole_realize;
|
||||||
k->exit = virtconsole_exitfn;
|
k->unrealize = virtconsole_unrealize;
|
||||||
k->have_data = flush_buf;
|
k->have_data = flush_buf;
|
||||||
k->set_guest_connected = set_guest_connected;
|
k->set_guest_connected = set_guest_connected;
|
||||||
dc->props = virtserialport_properties;
|
dc->props = virtserialport_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo virtserialport_info = {
|
static const TypeInfo virtserialport_info = {
|
||||||
.name = "virtserialport",
|
.name = TYPE_VIRTIO_CONSOLE_SERIAL_PORT,
|
||||||
.parent = TYPE_VIRTIO_SERIAL_PORT,
|
.parent = TYPE_VIRTIO_SERIAL_PORT,
|
||||||
.instance_size = sizeof(VirtConsole),
|
.instance_size = sizeof(VirtConsole),
|
||||||
.class_init = virtserialport_class_init,
|
.class_init = virtserialport_class_init,
|
||||||
@@ -200,8 +193,8 @@ static const TypeInfo virtserialport_info = {
|
|||||||
|
|
||||||
static void virtconsole_register_types(void)
|
static void virtconsole_register_types(void)
|
||||||
{
|
{
|
||||||
type_register_static(&virtconsole_info);
|
|
||||||
type_register_static(&virtserialport_info);
|
type_register_static(&virtserialport_info);
|
||||||
|
type_register_static(&virtconsole_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
type_init(virtconsole_register_types)
|
type_init(virtconsole_register_types)
|
||||||
|
@@ -808,13 +808,14 @@ static void remove_port(VirtIOSerial *vser, uint32_t port_id)
|
|||||||
send_control_event(vser, port->id, VIRTIO_CONSOLE_PORT_REMOVE, 1);
|
send_control_event(vser, port->id, VIRTIO_CONSOLE_PORT_REMOVE, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtser_port_qdev_init(DeviceState *qdev)
|
static void virtser_port_device_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev);
|
VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(dev);
|
||||||
VirtIOSerialPortClass *vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
|
VirtIOSerialPortClass *vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
|
||||||
VirtIOSerialBus *bus = DO_UPCAST(VirtIOSerialBus, qbus, qdev->parent_bus);
|
VirtIOSerialBus *bus = VIRTIO_SERIAL_BUS(qdev_get_parent_bus(dev));
|
||||||
int ret, max_nr_ports;
|
int max_nr_ports;
|
||||||
bool plugging_port0;
|
bool plugging_port0;
|
||||||
|
Error *err = NULL;
|
||||||
|
|
||||||
port->vser = bus->vser;
|
port->vser = bus->vser;
|
||||||
port->bh = qemu_bh_new(flush_queued_data_bh, port);
|
port->bh = qemu_bh_new(flush_queued_data_bh, port);
|
||||||
@@ -829,9 +830,9 @@ static int virtser_port_qdev_init(DeviceState *qdev)
|
|||||||
plugging_port0 = vsc->is_console && !find_port_by_id(port->vser, 0);
|
plugging_port0 = vsc->is_console && !find_port_by_id(port->vser, 0);
|
||||||
|
|
||||||
if (find_port_by_id(port->vser, port->id)) {
|
if (find_port_by_id(port->vser, port->id)) {
|
||||||
error_report("virtio-serial-bus: A port already exists at id %u",
|
error_setg(errp, "virtio-serial-bus: A port already exists at id %u",
|
||||||
port->id);
|
port->id);
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port->id == VIRTIO_CONSOLE_BAD_ID) {
|
if (port->id == VIRTIO_CONSOLE_BAD_ID) {
|
||||||
@@ -840,22 +841,24 @@ static int virtser_port_qdev_init(DeviceState *qdev)
|
|||||||
} else {
|
} else {
|
||||||
port->id = find_free_port_id(port->vser);
|
port->id = find_free_port_id(port->vser);
|
||||||
if (port->id == VIRTIO_CONSOLE_BAD_ID) {
|
if (port->id == VIRTIO_CONSOLE_BAD_ID) {
|
||||||
error_report("virtio-serial-bus: Maximum port limit for this device reached");
|
error_setg(errp, "virtio-serial-bus: Maximum port limit for "
|
||||||
return -1;
|
"this device reached");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
max_nr_ports = tswap32(port->vser->config.max_nr_ports);
|
max_nr_ports = tswap32(port->vser->config.max_nr_ports);
|
||||||
if (port->id >= max_nr_ports) {
|
if (port->id >= max_nr_ports) {
|
||||||
error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u",
|
error_setg(errp, "virtio-serial-bus: Out-of-range port id specified, "
|
||||||
max_nr_ports - 1);
|
"max. allowed: %u", max_nr_ports - 1);
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = vsc->init(port);
|
vsc->realize(dev, &err);
|
||||||
if (ret) {
|
if (err != NULL) {
|
||||||
return ret;
|
error_propagate(errp, err);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
port->elem.out_num = 0;
|
port->elem.out_num = 0;
|
||||||
@@ -868,14 +871,12 @@ static int virtser_port_qdev_init(DeviceState *qdev)
|
|||||||
|
|
||||||
/* Send an update to the guest about this new port added */
|
/* Send an update to the guest about this new port added */
|
||||||
virtio_notify_config(VIRTIO_DEVICE(port->vser));
|
virtio_notify_config(VIRTIO_DEVICE(port->vser));
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtser_port_qdev_exit(DeviceState *qdev)
|
static void virtser_port_device_unrealize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev);
|
VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(dev);
|
||||||
VirtIOSerialPortClass *vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);
|
VirtIOSerialPortClass *vsc = VIRTIO_SERIAL_PORT_GET_CLASS(dev);
|
||||||
VirtIOSerial *vser = port->vser;
|
VirtIOSerial *vser = port->vser;
|
||||||
|
|
||||||
qemu_bh_delete(port->bh);
|
qemu_bh_delete(port->bh);
|
||||||
@@ -883,10 +884,9 @@ static int virtser_port_qdev_exit(DeviceState *qdev)
|
|||||||
|
|
||||||
QTAILQ_REMOVE(&vser->ports, port, next);
|
QTAILQ_REMOVE(&vser->ports, port, next);
|
||||||
|
|
||||||
if (vsc->exit) {
|
if (vsc->unrealize) {
|
||||||
vsc->exit(port);
|
vsc->unrealize(dev, errp);
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtio_serial_device_realize(DeviceState *dev, Error **errp)
|
static void virtio_serial_device_realize(DeviceState *dev, Error **errp)
|
||||||
@@ -971,10 +971,11 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp)
|
|||||||
static void virtio_serial_port_class_init(ObjectClass *klass, void *data)
|
static void virtio_serial_port_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *k = DEVICE_CLASS(klass);
|
DeviceClass *k = DEVICE_CLASS(klass);
|
||||||
k->init = virtser_port_qdev_init;
|
|
||||||
set_bit(DEVICE_CATEGORY_INPUT, k->categories);
|
set_bit(DEVICE_CATEGORY_INPUT, k->categories);
|
||||||
k->bus_type = TYPE_VIRTIO_SERIAL_BUS;
|
k->bus_type = TYPE_VIRTIO_SERIAL_BUS;
|
||||||
k->exit = virtser_port_qdev_exit;
|
k->realize = virtser_port_device_realize;
|
||||||
|
k->unrealize = virtser_port_device_unrealize;
|
||||||
k->unplug = qdev_simple_unplug_cb;
|
k->unplug = qdev_simple_unplug_cb;
|
||||||
k->props = virtser_props;
|
k->props = virtser_props;
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@ common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
|
|||||||
common-obj-$(CONFIG_XILINX_AXI) += stream.o
|
common-obj-$(CONFIG_XILINX_AXI) += stream.o
|
||||||
common-obj-$(CONFIG_PTIMER) += ptimer.o
|
common-obj-$(CONFIG_PTIMER) += ptimer.o
|
||||||
common-obj-$(CONFIG_SOFTMMU) += sysbus.o
|
common-obj-$(CONFIG_SOFTMMU) += sysbus.o
|
||||||
|
common-obj-$(CONFIG_SOFTMMU) += machine.o
|
||||||
common-obj-$(CONFIG_SOFTMMU) += null-machine.o
|
common-obj-$(CONFIG_SOFTMMU) += null-machine.o
|
||||||
common-obj-$(CONFIG_SOFTMMU) += loader.o
|
common-obj-$(CONFIG_SOFTMMU) += loader.o
|
||||||
common-obj-$(CONFIG_SOFTMMU) += qdev-properties-system.o
|
common-obj-$(CONFIG_SOFTMMU) += qdev-properties-system.o
|
||||||
|
|
||||||
|
@@ -54,7 +54,8 @@
|
|||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
bool rom_file_in_ram = true;
|
bool option_rom_has_mr = false;
|
||||||
|
bool rom_file_has_mr = true;
|
||||||
|
|
||||||
static int roms_loaded;
|
static int roms_loaded;
|
||||||
|
|
||||||
@@ -642,7 +643,8 @@ static void *rom_set_mr(Rom *rom, Object *owner, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int rom_add_file(const char *file, const char *fw_dir,
|
int rom_add_file(const char *file, const char *fw_dir,
|
||||||
hwaddr addr, int32_t bootindex)
|
hwaddr addr, int32_t bootindex,
|
||||||
|
bool option_rom)
|
||||||
{
|
{
|
||||||
Rom *rom;
|
Rom *rom;
|
||||||
int rc, fd = -1;
|
int rc, fd = -1;
|
||||||
@@ -694,7 +696,7 @@ int rom_add_file(const char *file, const char *fw_dir,
|
|||||||
basename);
|
basename);
|
||||||
snprintf(devpath, sizeof(devpath), "/rom@%s", fw_file_name);
|
snprintf(devpath, sizeof(devpath), "/rom@%s", fw_file_name);
|
||||||
|
|
||||||
if (rom_file_in_ram) {
|
if ((!option_rom || option_rom_has_mr) && rom_file_has_mr) {
|
||||||
data = rom_set_mr(rom, OBJECT(fw_cfg), devpath);
|
data = rom_set_mr(rom, OBJECT(fw_cfg), devpath);
|
||||||
} else {
|
} else {
|
||||||
data = rom->data;
|
data = rom->data;
|
||||||
@@ -738,7 +740,7 @@ void *rom_add_blob(const char *name, const void *blob, size_t len,
|
|||||||
|
|
||||||
snprintf(devpath, sizeof(devpath), "/rom@%s", fw_file_name);
|
snprintf(devpath, sizeof(devpath), "/rom@%s", fw_file_name);
|
||||||
|
|
||||||
if (rom_file_in_ram) {
|
if (rom_file_has_mr) {
|
||||||
data = rom_set_mr(rom, OBJECT(fw_cfg), devpath);
|
data = rom_set_mr(rom, OBJECT(fw_cfg), devpath);
|
||||||
} else {
|
} else {
|
||||||
data = rom->data;
|
data = rom->data;
|
||||||
@@ -773,12 +775,12 @@ int rom_add_elf_program(const char *name, void *data, size_t datasize,
|
|||||||
|
|
||||||
int rom_add_vga(const char *file)
|
int rom_add_vga(const char *file)
|
||||||
{
|
{
|
||||||
return rom_add_file(file, "vgaroms", 0, -1);
|
return rom_add_file(file, "vgaroms", 0, -1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rom_add_option(const char *file, int32_t bootindex)
|
int rom_add_option(const char *file, int32_t bootindex)
|
||||||
{
|
{
|
||||||
return rom_add_file(file, "genroms", 0, bootindex);
|
return rom_add_file(file, "genroms", 0, bootindex, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rom_reset(void *unused)
|
static void rom_reset(void *unused)
|
||||||
|
28
hw/core/machine.c
Normal file
28
hw/core/machine.c
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* QEMU Machine
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Red Hat Inc
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Marcel Apfelbaum <marcel.a@redhat.com>
|
||||||
|
*
|
||||||
|
* 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 "hw/boards.h"
|
||||||
|
|
||||||
|
static const TypeInfo machine_info = {
|
||||||
|
.name = TYPE_MACHINE,
|
||||||
|
.parent = TYPE_OBJECT,
|
||||||
|
.abstract = true,
|
||||||
|
.class_size = sizeof(MachineClass),
|
||||||
|
.instance_size = sizeof(MachineState),
|
||||||
|
};
|
||||||
|
|
||||||
|
static void machine_register_types(void)
|
||||||
|
{
|
||||||
|
type_register_static(&machine_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
type_init(machine_register_types)
|
@@ -18,17 +18,19 @@
|
|||||||
#include "net/hub.h"
|
#include "net/hub.h"
|
||||||
#include "qapi/visitor.h"
|
#include "qapi/visitor.h"
|
||||||
#include "sysemu/char.h"
|
#include "sysemu/char.h"
|
||||||
|
#include "sysemu/iothread.h"
|
||||||
|
|
||||||
static void get_pointer(Object *obj, Visitor *v, Property *prop,
|
static void get_pointer(Object *obj, Visitor *v, Property *prop,
|
||||||
const char *(*print)(void *ptr),
|
char *(*print)(void *ptr),
|
||||||
const char *name, Error **errp)
|
const char *name, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
DeviceState *dev = DEVICE(obj);
|
||||||
void **ptr = qdev_get_prop_ptr(dev, prop);
|
void **ptr = qdev_get_prop_ptr(dev, prop);
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
p = (char *) (*ptr ? print(*ptr) : "");
|
p = *ptr ? print(*ptr) : g_strdup("");
|
||||||
visit_type_str(v, &p, name, errp);
|
visit_type_str(v, &p, name, errp);
|
||||||
|
g_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_pointer(Object *obj, Visitor *v, Property *prop,
|
static void set_pointer(Object *obj, Visitor *v, Property *prop,
|
||||||
@@ -91,9 +93,9 @@ static void release_drive(Object *obj, const char *name, void *opaque)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *print_drive(void *ptr)
|
static char *print_drive(void *ptr)
|
||||||
{
|
{
|
||||||
return bdrv_get_device_name(ptr);
|
return g_strdup(bdrv_get_device_name(ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_drive(Object *obj, Visitor *v, void *opaque,
|
static void get_drive(Object *obj, Visitor *v, void *opaque,
|
||||||
@@ -145,11 +147,12 @@ static void release_chr(Object *obj, const char *name, void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char *print_chr(void *ptr)
|
static char *print_chr(void *ptr)
|
||||||
{
|
{
|
||||||
CharDriverState *chr = ptr;
|
CharDriverState *chr = ptr;
|
||||||
|
const char *val = chr->label ? chr->label : "";
|
||||||
|
|
||||||
return chr->label ? chr->label : "";
|
return g_strdup(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_chr(Object *obj, Visitor *v, void *opaque,
|
static void get_chr(Object *obj, Visitor *v, void *opaque,
|
||||||
@@ -224,11 +227,12 @@ err:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *print_netdev(void *ptr)
|
static char *print_netdev(void *ptr)
|
||||||
{
|
{
|
||||||
NetClientState *netdev = ptr;
|
NetClientState *netdev = ptr;
|
||||||
|
const char *val = netdev->name ? netdev->name : "";
|
||||||
|
|
||||||
return netdev->name ? netdev->name : "";
|
return g_strdup(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_netdev(Object *obj, Visitor *v, void *opaque,
|
static void get_netdev(Object *obj, Visitor *v, void *opaque,
|
||||||
@@ -382,6 +386,56 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
|
|||||||
nd->instantiated = 1;
|
nd->instantiated = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- iothread --- */
|
||||||
|
|
||||||
|
static char *print_iothread(void *ptr)
|
||||||
|
{
|
||||||
|
return iothread_get_id(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int parse_iothread(DeviceState *dev, const char *str, void **ptr)
|
||||||
|
{
|
||||||
|
IOThread *iothread;
|
||||||
|
|
||||||
|
iothread = iothread_find(str);
|
||||||
|
if (!iothread) {
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
object_ref(OBJECT(iothread));
|
||||||
|
*ptr = iothread;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void get_iothread(Object *obj, struct Visitor *v, void *opaque,
|
||||||
|
const char *name, Error **errp)
|
||||||
|
{
|
||||||
|
get_pointer(obj, v, opaque, print_iothread, name, errp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_iothread(Object *obj, struct Visitor *v, void *opaque,
|
||||||
|
const char *name, Error **errp)
|
||||||
|
{
|
||||||
|
set_pointer(obj, v, opaque, parse_iothread, name, errp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void release_iothread(Object *obj, const char *name, void *opaque)
|
||||||
|
{
|
||||||
|
DeviceState *dev = DEVICE(obj);
|
||||||
|
Property *prop = opaque;
|
||||||
|
IOThread **ptr = qdev_get_prop_ptr(dev, prop);
|
||||||
|
|
||||||
|
if (*ptr) {
|
||||||
|
object_unref(OBJECT(*ptr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyInfo qdev_prop_iothread = {
|
||||||
|
.name = "iothread",
|
||||||
|
.get = get_iothread,
|
||||||
|
.set = set_iothread,
|
||||||
|
.release = release_iothread,
|
||||||
|
};
|
||||||
|
|
||||||
static int qdev_add_one_global(QemuOpts *opts, void *opaque)
|
static int qdev_add_one_global(QemuOpts *opts, void *opaque)
|
||||||
{
|
{
|
||||||
GlobalProperty *g;
|
GlobalProperty *g;
|
||||||
|
@@ -501,6 +501,45 @@ static void bus_unparent(Object *obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool bus_get_realized(Object *obj, Error **err)
|
||||||
|
{
|
||||||
|
BusState *bus = BUS(obj);
|
||||||
|
|
||||||
|
return bus->realized;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bus_set_realized(Object *obj, bool value, Error **err)
|
||||||
|
{
|
||||||
|
BusState *bus = BUS(obj);
|
||||||
|
BusClass *bc = BUS_GET_CLASS(bus);
|
||||||
|
Error *local_err = NULL;
|
||||||
|
|
||||||
|
if (value && !bus->realized) {
|
||||||
|
if (bc->realize) {
|
||||||
|
bc->realize(bus, &local_err);
|
||||||
|
|
||||||
|
if (local_err != NULL) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (!value && bus->realized) {
|
||||||
|
if (bc->unrealize) {
|
||||||
|
bc->unrealize(bus, &local_err);
|
||||||
|
|
||||||
|
if (local_err != NULL) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bus->realized = value;
|
||||||
|
return;
|
||||||
|
|
||||||
|
error:
|
||||||
|
error_propagate(err, local_err);
|
||||||
|
}
|
||||||
|
|
||||||
void qbus_create_inplace(void *bus, size_t size, const char *typename,
|
void qbus_create_inplace(void *bus, size_t size, const char *typename,
|
||||||
DeviceState *parent, const char *name)
|
DeviceState *parent, const char *name)
|
||||||
{
|
{
|
||||||
@@ -677,6 +716,7 @@ static void device_set_realized(Object *obj, bool value, Error **err)
|
|||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
DeviceState *dev = DEVICE(obj);
|
||||||
DeviceClass *dc = DEVICE_GET_CLASS(dev);
|
DeviceClass *dc = DEVICE_GET_CLASS(dev);
|
||||||
|
BusState *bus;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
if (dev->hotplugged && !dc->hotpluggable) {
|
if (dev->hotplugged && !dc->hotpluggable) {
|
||||||
@@ -710,14 +750,30 @@ static void device_set_realized(Object *obj, bool value, Error **err)
|
|||||||
dev->instance_id_alias,
|
dev->instance_id_alias,
|
||||||
dev->alias_required_for_version);
|
dev->alias_required_for_version);
|
||||||
}
|
}
|
||||||
|
if (local_err == NULL) {
|
||||||
|
QLIST_FOREACH(bus, &dev->child_bus, sibling) {
|
||||||
|
object_property_set_bool(OBJECT(bus), true, "realized",
|
||||||
|
&local_err);
|
||||||
|
if (local_err != NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (dev->hotplugged && local_err == NULL) {
|
if (dev->hotplugged && local_err == NULL) {
|
||||||
device_reset(dev);
|
device_reset(dev);
|
||||||
}
|
}
|
||||||
} else if (!value && dev->realized) {
|
} else if (!value && dev->realized) {
|
||||||
if (qdev_get_vmsd(dev)) {
|
QLIST_FOREACH(bus, &dev->child_bus, sibling) {
|
||||||
|
object_property_set_bool(OBJECT(bus), false, "realized",
|
||||||
|
&local_err);
|
||||||
|
if (local_err != NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (qdev_get_vmsd(dev) && local_err == NULL) {
|
||||||
vmstate_unregister(dev, qdev_get_vmsd(dev), dev);
|
vmstate_unregister(dev, qdev_get_vmsd(dev), dev);
|
||||||
}
|
}
|
||||||
if (dc->unrealize) {
|
if (dc->unrealize && local_err == NULL) {
|
||||||
dc->unrealize(dev, &local_err);
|
dc->unrealize(dev, &local_err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -735,7 +791,8 @@ static bool device_get_hotpluggable(Object *obj, Error **err)
|
|||||||
DeviceClass *dc = DEVICE_GET_CLASS(obj);
|
DeviceClass *dc = DEVICE_GET_CLASS(obj);
|
||||||
DeviceState *dev = DEVICE(obj);
|
DeviceState *dev = DEVICE(obj);
|
||||||
|
|
||||||
return dc->hotpluggable && dev->parent_bus->allow_hotplug;
|
return dc->hotpluggable && (dev->parent_bus == NULL ||
|
||||||
|
dev->parent_bus->allow_hotplug);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void device_initfn(Object *obj)
|
static void device_initfn(Object *obj)
|
||||||
@@ -792,14 +849,6 @@ static void device_class_base_init(ObjectClass *class, void *data)
|
|||||||
* so do not propagate them to the subclasses.
|
* so do not propagate them to the subclasses.
|
||||||
*/
|
*/
|
||||||
klass->props = NULL;
|
klass->props = NULL;
|
||||||
|
|
||||||
/* by default all devices were considered as hotpluggable,
|
|
||||||
* so with intent to check it in generic qdev_unplug() /
|
|
||||||
* device_set_realized() functions make every device
|
|
||||||
* hotpluggable. Devices that shouldn't be hotpluggable,
|
|
||||||
* should override it in their class_init()
|
|
||||||
*/
|
|
||||||
klass->hotpluggable = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void device_unparent(Object *obj)
|
static void device_unparent(Object *obj)
|
||||||
@@ -809,13 +858,13 @@ static void device_unparent(Object *obj)
|
|||||||
QObject *event_data;
|
QObject *event_data;
|
||||||
bool have_realized = dev->realized;
|
bool have_realized = dev->realized;
|
||||||
|
|
||||||
|
if (dev->realized) {
|
||||||
|
object_property_set_bool(obj, false, "realized", NULL);
|
||||||
|
}
|
||||||
while (dev->num_child_bus) {
|
while (dev->num_child_bus) {
|
||||||
bus = QLIST_FIRST(&dev->child_bus);
|
bus = QLIST_FIRST(&dev->child_bus);
|
||||||
object_unparent(OBJECT(bus));
|
object_unparent(OBJECT(bus));
|
||||||
}
|
}
|
||||||
if (dev->realized) {
|
|
||||||
object_property_set_bool(obj, false, "realized", NULL);
|
|
||||||
}
|
|
||||||
if (dev->parent_bus) {
|
if (dev->parent_bus) {
|
||||||
bus_remove_child(dev->parent_bus, dev);
|
bus_remove_child(dev->parent_bus, dev);
|
||||||
object_unref(OBJECT(dev->parent_bus));
|
object_unref(OBJECT(dev->parent_bus));
|
||||||
@@ -845,6 +894,14 @@ static void device_class_init(ObjectClass *class, void *data)
|
|||||||
class->unparent = device_unparent;
|
class->unparent = device_unparent;
|
||||||
dc->realize = device_realize;
|
dc->realize = device_realize;
|
||||||
dc->unrealize = device_unrealize;
|
dc->unrealize = device_unrealize;
|
||||||
|
|
||||||
|
/* by default all devices were considered as hotpluggable,
|
||||||
|
* so with intent to check it in generic qdev_unplug() /
|
||||||
|
* device_set_realized() functions make every device
|
||||||
|
* hotpluggable. Devices that shouldn't be hotpluggable,
|
||||||
|
* should override it in their class_init()
|
||||||
|
*/
|
||||||
|
dc->hotpluggable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void device_reset(DeviceState *dev)
|
void device_reset(DeviceState *dev)
|
||||||
@@ -888,6 +945,8 @@ static void qbus_initfn(Object *obj)
|
|||||||
object_property_add_link(obj, QDEV_HOTPLUG_HANDLER_PROPERTY,
|
object_property_add_link(obj, QDEV_HOTPLUG_HANDLER_PROPERTY,
|
||||||
TYPE_HOTPLUG_HANDLER,
|
TYPE_HOTPLUG_HANDLER,
|
||||||
(Object **)&bus->hotplug_handler, NULL);
|
(Object **)&bus->hotplug_handler, NULL);
|
||||||
|
object_property_add_bool(obj, "realized",
|
||||||
|
bus_get_realized, bus_set_realized, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *default_bus_get_fw_dev_path(DeviceState *dev)
|
static char *default_bus_get_fw_dev_path(DeviceState *dev)
|
||||||
|
@@ -133,11 +133,12 @@ static const VMStateDescription vmstate_ads7846 = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ads7846_init(SSISlave *dev)
|
static int ads7846_init(SSISlave *d)
|
||||||
{
|
{
|
||||||
ADS7846State *s = FROM_SSI_SLAVE(ADS7846State, dev);
|
DeviceState *dev = DEVICE(d);
|
||||||
|
ADS7846State *s = FROM_SSI_SLAVE(ADS7846State, d);
|
||||||
|
|
||||||
qdev_init_gpio_out(&dev->qdev, &s->interrupt, 1);
|
qdev_init_gpio_out(dev, &s->interrupt, 1);
|
||||||
|
|
||||||
s->input[0] = ADS_TEMP0; /* TEMP0 */
|
s->input[0] = ADS_TEMP0; /* TEMP0 */
|
||||||
s->input[2] = ADS_VBAT; /* VBAT */
|
s->input[2] = ADS_VBAT; /* VBAT */
|
||||||
|
@@ -336,18 +336,19 @@ static const GraphicHwOps ssd0323_ops = {
|
|||||||
.gfx_update = ssd0323_update_display,
|
.gfx_update = ssd0323_update_display,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ssd0323_init(SSISlave *dev)
|
static int ssd0323_init(SSISlave *d)
|
||||||
{
|
{
|
||||||
ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, dev);
|
DeviceState *dev = DEVICE(d);
|
||||||
|
ssd0323_state *s = FROM_SSI_SLAVE(ssd0323_state, d);
|
||||||
|
|
||||||
s->col_end = 63;
|
s->col_end = 63;
|
||||||
s->row_end = 79;
|
s->row_end = 79;
|
||||||
s->con = graphic_console_init(DEVICE(dev), 0, &ssd0323_ops, s);
|
s->con = graphic_console_init(dev, 0, &ssd0323_ops, s);
|
||||||
qemu_console_resize(s->con, 128 * MAGNIFY, 64 * MAGNIFY);
|
qemu_console_resize(s->con, 128 * MAGNIFY, 64 * MAGNIFY);
|
||||||
|
|
||||||
qdev_init_gpio_in(&dev->qdev, ssd0323_cd, 1);
|
qdev_init_gpio_in(dev, ssd0323_cd, 1);
|
||||||
|
|
||||||
register_savevm(&dev->qdev, "ssd0323_oled", -1, 1,
|
register_savevm(dev, "ssd0323_oled", -1, 1,
|
||||||
ssd0323_save, ssd0323_load, s);
|
ssd0323_save, ssd0323_load, s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -466,9 +466,15 @@ static void acpi_align_size(GArray *blob, unsigned align)
|
|||||||
g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
|
g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get pointer within table in a safe manner */
|
/* Set a value within table in a safe manner */
|
||||||
#define ACPI_BUILD_PTR(table, size, off, type) \
|
#define ACPI_BUILD_SET_LE(table, size, off, bits, val) \
|
||||||
((type *)(acpi_data_get_ptr(table, size, off, sizeof(type))))
|
do { \
|
||||||
|
uint64_t ACPI_BUILD_SET_LE_val = cpu_to_le64(val); \
|
||||||
|
memcpy(acpi_data_get_ptr(table, size, off, \
|
||||||
|
(bits) / BITS_PER_BYTE), \
|
||||||
|
&ACPI_BUILD_SET_LE_val, \
|
||||||
|
(bits) / BITS_PER_BYTE); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
static inline void *acpi_data_get_ptr(uint8_t *table_data, unsigned table_size,
|
static inline void *acpi_data_get_ptr(uint8_t *table_data, unsigned table_size,
|
||||||
unsigned off, unsigned size)
|
unsigned off, unsigned size)
|
||||||
@@ -643,6 +649,21 @@ static inline char acpi_get_hex(uint32_t val)
|
|||||||
#define ACPI_PCIHP_SIZEOF (*ssdt_pcihp_end - *ssdt_pcihp_start)
|
#define ACPI_PCIHP_SIZEOF (*ssdt_pcihp_end - *ssdt_pcihp_start)
|
||||||
#define ACPI_PCIHP_AML (ssdp_pcihp_aml + *ssdt_pcihp_start)
|
#define ACPI_PCIHP_AML (ssdp_pcihp_aml + *ssdt_pcihp_start)
|
||||||
|
|
||||||
|
#define ACPI_PCINOHP_OFFSET_HEX (*ssdt_pcinohp_name - *ssdt_pcinohp_start + 1)
|
||||||
|
#define ACPI_PCINOHP_OFFSET_ADR (*ssdt_pcinohp_adr - *ssdt_pcinohp_start)
|
||||||
|
#define ACPI_PCINOHP_SIZEOF (*ssdt_pcinohp_end - *ssdt_pcinohp_start)
|
||||||
|
#define ACPI_PCINOHP_AML (ssdp_pcihp_aml + *ssdt_pcinohp_start)
|
||||||
|
|
||||||
|
#define ACPI_PCIVGA_OFFSET_HEX (*ssdt_pcivga_name - *ssdt_pcivga_start + 1)
|
||||||
|
#define ACPI_PCIVGA_OFFSET_ADR (*ssdt_pcivga_adr - *ssdt_pcivga_start)
|
||||||
|
#define ACPI_PCIVGA_SIZEOF (*ssdt_pcivga_end - *ssdt_pcivga_start)
|
||||||
|
#define ACPI_PCIVGA_AML (ssdp_pcihp_aml + *ssdt_pcivga_start)
|
||||||
|
|
||||||
|
#define ACPI_PCIQXL_OFFSET_HEX (*ssdt_pciqxl_name - *ssdt_pciqxl_start + 1)
|
||||||
|
#define ACPI_PCIQXL_OFFSET_ADR (*ssdt_pciqxl_adr - *ssdt_pciqxl_start)
|
||||||
|
#define ACPI_PCIQXL_SIZEOF (*ssdt_pciqxl_end - *ssdt_pciqxl_start)
|
||||||
|
#define ACPI_PCIQXL_AML (ssdp_pcihp_aml + *ssdt_pciqxl_start)
|
||||||
|
|
||||||
#define ACPI_SSDT_SIGNATURE 0x54445353 /* SSDT */
|
#define ACPI_SSDT_SIGNATURE 0x54445353 /* SSDT */
|
||||||
#define ACPI_SSDT_HEADER_LENGTH 36
|
#define ACPI_SSDT_HEADER_LENGTH 36
|
||||||
|
|
||||||
@@ -677,6 +698,33 @@ static void patch_pcihp(int slot, uint8_t *ssdt_ptr)
|
|||||||
ssdt_ptr[ACPI_PCIHP_OFFSET_ADR + 2] = slot;
|
ssdt_ptr[ACPI_PCIHP_OFFSET_ADR + 2] = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void patch_pcinohp(int slot, uint8_t *ssdt_ptr)
|
||||||
|
{
|
||||||
|
unsigned devfn = PCI_DEVFN(slot, 0);
|
||||||
|
|
||||||
|
ssdt_ptr[ACPI_PCINOHP_OFFSET_HEX] = acpi_get_hex(devfn >> 4);
|
||||||
|
ssdt_ptr[ACPI_PCINOHP_OFFSET_HEX + 1] = acpi_get_hex(devfn);
|
||||||
|
ssdt_ptr[ACPI_PCINOHP_OFFSET_ADR + 2] = slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void patch_pcivga(int slot, uint8_t *ssdt_ptr)
|
||||||
|
{
|
||||||
|
unsigned devfn = PCI_DEVFN(slot, 0);
|
||||||
|
|
||||||
|
ssdt_ptr[ACPI_PCIVGA_OFFSET_HEX] = acpi_get_hex(devfn >> 4);
|
||||||
|
ssdt_ptr[ACPI_PCIVGA_OFFSET_HEX + 1] = acpi_get_hex(devfn);
|
||||||
|
ssdt_ptr[ACPI_PCIVGA_OFFSET_ADR + 2] = slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void patch_pciqxl(int slot, uint8_t *ssdt_ptr)
|
||||||
|
{
|
||||||
|
unsigned devfn = PCI_DEVFN(slot, 0);
|
||||||
|
|
||||||
|
ssdt_ptr[ACPI_PCIQXL_OFFSET_HEX] = acpi_get_hex(devfn >> 4);
|
||||||
|
ssdt_ptr[ACPI_PCIQXL_OFFSET_HEX + 1] = acpi_get_hex(devfn);
|
||||||
|
ssdt_ptr[ACPI_PCIQXL_OFFSET_ADR + 2] = slot;
|
||||||
|
}
|
||||||
|
|
||||||
/* Assign BSEL property to all buses. In the future, this can be changed
|
/* Assign BSEL property to all buses. In the future, this can be changed
|
||||||
* to only assign to buses that support hotplug.
|
* to only assign to buses that support hotplug.
|
||||||
*/
|
*/
|
||||||
@@ -737,6 +785,10 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
|
|||||||
AcpiBuildPciBusHotplugState *parent = child->parent;
|
AcpiBuildPciBusHotplugState *parent = child->parent;
|
||||||
GArray *bus_table = build_alloc_array();
|
GArray *bus_table = build_alloc_array();
|
||||||
DECLARE_BITMAP(slot_hotplug_enable, PCI_SLOT_MAX);
|
DECLARE_BITMAP(slot_hotplug_enable, PCI_SLOT_MAX);
|
||||||
|
DECLARE_BITMAP(slot_device_present, PCI_SLOT_MAX);
|
||||||
|
DECLARE_BITMAP(slot_device_system, PCI_SLOT_MAX);
|
||||||
|
DECLARE_BITMAP(slot_device_vga, PCI_SLOT_MAX);
|
||||||
|
DECLARE_BITMAP(slot_device_qxl, PCI_SLOT_MAX);
|
||||||
uint8_t op;
|
uint8_t op;
|
||||||
int i;
|
int i;
|
||||||
QObject *bsel;
|
QObject *bsel;
|
||||||
@@ -764,40 +816,82 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
|
|||||||
build_append_byte(bus_table, 0x08); /* NameOp */
|
build_append_byte(bus_table, 0x08); /* NameOp */
|
||||||
build_append_nameseg(bus_table, "BSEL");
|
build_append_nameseg(bus_table, "BSEL");
|
||||||
build_append_int(bus_table, qint_get_int(qobject_to_qint(bsel)));
|
build_append_int(bus_table, qint_get_int(qobject_to_qint(bsel)));
|
||||||
|
|
||||||
memset(slot_hotplug_enable, 0xff, sizeof slot_hotplug_enable);
|
memset(slot_hotplug_enable, 0xff, sizeof slot_hotplug_enable);
|
||||||
|
} else {
|
||||||
|
/* No bsel - no slots are hot-pluggable */
|
||||||
|
memset(slot_hotplug_enable, 0x00, sizeof slot_hotplug_enable);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) {
|
memset(slot_device_present, 0x00, sizeof slot_device_present);
|
||||||
|
memset(slot_device_system, 0x00, sizeof slot_device_present);
|
||||||
|
memset(slot_device_vga, 0x00, sizeof slot_device_vga);
|
||||||
|
memset(slot_device_qxl, 0x00, sizeof slot_device_qxl);
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(bus->devices); i += PCI_FUNC_MAX) {
|
||||||
DeviceClass *dc;
|
DeviceClass *dc;
|
||||||
PCIDeviceClass *pc;
|
PCIDeviceClass *pc;
|
||||||
PCIDevice *pdev = bus->devices[i];
|
PCIDevice *pdev = bus->devices[i];
|
||||||
|
int slot = PCI_SLOT(i);
|
||||||
|
|
||||||
if (!pdev) {
|
if (!pdev) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_bit(slot, slot_device_present);
|
||||||
pc = PCI_DEVICE_GET_CLASS(pdev);
|
pc = PCI_DEVICE_GET_CLASS(pdev);
|
||||||
dc = DEVICE_GET_CLASS(pdev);
|
dc = DEVICE_GET_CLASS(pdev);
|
||||||
|
|
||||||
if (!dc->hotpluggable || pc->is_bridge) {
|
if (pc->class_id == PCI_CLASS_BRIDGE_ISA) {
|
||||||
int slot = PCI_SLOT(i);
|
set_bit(slot, slot_device_system);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pc->class_id == PCI_CLASS_DISPLAY_VGA) {
|
||||||
|
set_bit(slot, slot_device_vga);
|
||||||
|
|
||||||
|
if (object_dynamic_cast(OBJECT(pdev), "qxl-vga")) {
|
||||||
|
set_bit(slot, slot_device_qxl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dc->hotpluggable || pc->is_bridge) {
|
||||||
clear_bit(slot, slot_hotplug_enable);
|
clear_bit(slot, slot_hotplug_enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append Device object for each slot which supports eject */
|
/* Append Device object for each slot */
|
||||||
for (i = 0; i < PCI_SLOT_MAX; i++) {
|
for (i = 0; i < PCI_SLOT_MAX; i++) {
|
||||||
bool can_eject = test_bit(i, slot_hotplug_enable);
|
bool can_eject = test_bit(i, slot_hotplug_enable);
|
||||||
|
bool present = test_bit(i, slot_device_present);
|
||||||
|
bool vga = test_bit(i, slot_device_vga);
|
||||||
|
bool qxl = test_bit(i, slot_device_qxl);
|
||||||
|
bool system = test_bit(i, slot_device_system);
|
||||||
if (can_eject) {
|
if (can_eject) {
|
||||||
void *pcihp = acpi_data_push(bus_table,
|
void *pcihp = acpi_data_push(bus_table,
|
||||||
ACPI_PCIHP_SIZEOF);
|
ACPI_PCIHP_SIZEOF);
|
||||||
memcpy(pcihp, ACPI_PCIHP_AML, ACPI_PCIHP_SIZEOF);
|
memcpy(pcihp, ACPI_PCIHP_AML, ACPI_PCIHP_SIZEOF);
|
||||||
patch_pcihp(i, pcihp);
|
patch_pcihp(i, pcihp);
|
||||||
bus_hotplug_support = true;
|
bus_hotplug_support = true;
|
||||||
|
} else if (qxl) {
|
||||||
|
void *pcihp = acpi_data_push(bus_table,
|
||||||
|
ACPI_PCIQXL_SIZEOF);
|
||||||
|
memcpy(pcihp, ACPI_PCIQXL_AML, ACPI_PCIQXL_SIZEOF);
|
||||||
|
patch_pciqxl(i, pcihp);
|
||||||
|
} else if (vga) {
|
||||||
|
void *pcihp = acpi_data_push(bus_table,
|
||||||
|
ACPI_PCIVGA_SIZEOF);
|
||||||
|
memcpy(pcihp, ACPI_PCIVGA_AML, ACPI_PCIVGA_SIZEOF);
|
||||||
|
patch_pcivga(i, pcihp);
|
||||||
|
} else if (system) {
|
||||||
|
/* Nothing to do: system devices are in DSDT. */
|
||||||
|
} else if (present) {
|
||||||
|
void *pcihp = acpi_data_push(bus_table,
|
||||||
|
ACPI_PCINOHP_SIZEOF);
|
||||||
|
memcpy(pcihp, ACPI_PCINOHP_AML, ACPI_PCINOHP_SIZEOF);
|
||||||
|
patch_pcinohp(i, pcihp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bsel) {
|
||||||
method = build_alloc_method("DVNT", 2);
|
method = build_alloc_method("DVNT", 2);
|
||||||
|
|
||||||
for (i = 0; i < PCI_SLOT_MAX; i++) {
|
for (i = 0; i < PCI_SLOT_MAX; i++) {
|
||||||
@@ -886,22 +980,17 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
|
|||||||
|
|
||||||
static void patch_pci_windows(PcPciInfo *pci, uint8_t *start, unsigned size)
|
static void patch_pci_windows(PcPciInfo *pci, uint8_t *start, unsigned size)
|
||||||
{
|
{
|
||||||
*ACPI_BUILD_PTR(start, size, acpi_pci32_start[0], uint32_t) =
|
ACPI_BUILD_SET_LE(start, size, acpi_pci32_start[0], 32, pci->w32.begin);
|
||||||
cpu_to_le32(pci->w32.begin);
|
|
||||||
|
|
||||||
*ACPI_BUILD_PTR(start, size, acpi_pci32_end[0], uint32_t) =
|
ACPI_BUILD_SET_LE(start, size, acpi_pci32_end[0], 32, pci->w32.end - 1);
|
||||||
cpu_to_le32(pci->w32.end - 1);
|
|
||||||
|
|
||||||
if (pci->w64.end || pci->w64.begin) {
|
if (pci->w64.end || pci->w64.begin) {
|
||||||
*ACPI_BUILD_PTR(start, size, acpi_pci64_valid[0], uint8_t) = 1;
|
ACPI_BUILD_SET_LE(start, size, acpi_pci64_valid[0], 8, 1);
|
||||||
*ACPI_BUILD_PTR(start, size, acpi_pci64_start[0], uint64_t) =
|
ACPI_BUILD_SET_LE(start, size, acpi_pci64_start[0], 64, pci->w64.begin);
|
||||||
cpu_to_le64(pci->w64.begin);
|
ACPI_BUILD_SET_LE(start, size, acpi_pci64_end[0], 64, pci->w64.end - 1);
|
||||||
*ACPI_BUILD_PTR(start, size, acpi_pci64_end[0], uint64_t) =
|
ACPI_BUILD_SET_LE(start, size, acpi_pci64_length[0], 64, pci->w64.end - pci->w64.begin);
|
||||||
cpu_to_le64(pci->w64.end - 1);
|
|
||||||
*ACPI_BUILD_PTR(start, size, acpi_pci64_length[0], uint64_t) =
|
|
||||||
cpu_to_le64(pci->w64.end - pci->w64.begin);
|
|
||||||
} else {
|
} else {
|
||||||
*ACPI_BUILD_PTR(start, size, acpi_pci64_valid[0], uint8_t) = 0;
|
ACPI_BUILD_SET_LE(start, size, acpi_pci64_valid[0], 8, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -976,7 +1065,14 @@ build_ssdt(GArray *table_data, GArray *linker,
|
|||||||
|
|
||||||
{
|
{
|
||||||
AcpiBuildPciBusHotplugState hotplug_state;
|
AcpiBuildPciBusHotplugState hotplug_state;
|
||||||
PCIBus *bus = find_i440fx(); /* TODO: Q35 support */
|
Object *pci_host;
|
||||||
|
PCIBus *bus = NULL;
|
||||||
|
bool ambiguous;
|
||||||
|
|
||||||
|
pci_host = object_resolve_path_type("", TYPE_PCI_HOST_BRIDGE, &ambiguous);
|
||||||
|
if (!ambiguous && pci_host) {
|
||||||
|
bus = PCI_HOST_BRIDGE(pci_host)->bus;
|
||||||
|
}
|
||||||
|
|
||||||
build_pci_bus_state_init(&hotplug_state, NULL);
|
build_pci_bus_state_init(&hotplug_state, NULL);
|
||||||
|
|
||||||
|
@@ -80,6 +80,8 @@ DefinitionBlock (
|
|||||||
Name(_HID, EisaId("PNP0A03"))
|
Name(_HID, EisaId("PNP0A03"))
|
||||||
Name(_ADR, 0x00)
|
Name(_ADR, 0x00)
|
||||||
Name(_UID, 1)
|
Name(_UID, 1)
|
||||||
|
//#define PX13 S0B_
|
||||||
|
// External(PX13, DeviceObj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,34 +89,6 @@ DefinitionBlock (
|
|||||||
#include "acpi-dsdt-hpet.dsl"
|
#include "acpi-dsdt-hpet.dsl"
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************
|
|
||||||
* VGA
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
Scope(\_SB.PCI0) {
|
|
||||||
Device(VGA) {
|
|
||||||
Name(_ADR, 0x00020000)
|
|
||||||
OperationRegion(PCIC, PCI_Config, Zero, 0x4)
|
|
||||||
Field(PCIC, DWordAcc, NoLock, Preserve) {
|
|
||||||
VEND, 32
|
|
||||||
}
|
|
||||||
Method(_S1D, 0, NotSerialized) {
|
|
||||||
Return (0x00)
|
|
||||||
}
|
|
||||||
Method(_S2D, 0, NotSerialized) {
|
|
||||||
Return (0x00)
|
|
||||||
}
|
|
||||||
Method(_S3D, 0, NotSerialized) {
|
|
||||||
If (LEqual(VEND, 0x1001b36)) {
|
|
||||||
Return (0x03) // QXL
|
|
||||||
} Else {
|
|
||||||
Return (0x00)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* PIIX4 PM
|
* PIIX4 PM
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
@@ -132,6 +106,9 @@ DefinitionBlock (
|
|||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
Scope(\_SB.PCI0) {
|
Scope(\_SB.PCI0) {
|
||||||
|
|
||||||
|
External(ISA, DeviceObj)
|
||||||
|
|
||||||
Device(ISA) {
|
Device(ISA) {
|
||||||
Name(_ADR, 0x00010000)
|
Name(_ADR, 0x00010000)
|
||||||
|
|
||||||
|
@@ -3,12 +3,12 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x53,
|
0x53,
|
||||||
0x44,
|
0x44,
|
||||||
0x54,
|
0x54,
|
||||||
0x87,
|
0x85,
|
||||||
0x11,
|
0x11,
|
||||||
0x0,
|
0x0,
|
||||||
0x0,
|
0x0,
|
||||||
0x1,
|
0x1,
|
||||||
0xb8,
|
0x8b,
|
||||||
0x42,
|
0x42,
|
||||||
0x58,
|
0x58,
|
||||||
0x50,
|
0x50,
|
||||||
@@ -146,7 +146,7 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x1,
|
0x1,
|
||||||
0x10,
|
0x10,
|
||||||
0x4e,
|
0x4e,
|
||||||
0x15,
|
0x18,
|
||||||
0x2e,
|
0x2e,
|
||||||
0x5f,
|
0x5f,
|
||||||
0x53,
|
0x53,
|
||||||
@@ -163,9 +163,9 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x53,
|
0x53,
|
||||||
0x11,
|
0x11,
|
||||||
0x42,
|
0x42,
|
||||||
0x7,
|
|
||||||
0xa,
|
0xa,
|
||||||
0x6e,
|
0xa,
|
||||||
|
0x9e,
|
||||||
0x88,
|
0x88,
|
||||||
0xd,
|
0xd,
|
||||||
0x0,
|
0x0,
|
||||||
@@ -217,11 +217,59 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x0,
|
0x0,
|
||||||
0xd,
|
0xd,
|
||||||
0xff,
|
0xff,
|
||||||
|
0xad,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xa1,
|
||||||
|
0x88,
|
||||||
|
0xd,
|
||||||
|
0x0,
|
||||||
|
0x1,
|
||||||
|
0xc,
|
||||||
|
0x3,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xf,
|
||||||
|
0xae,
|
||||||
|
0xff,
|
||||||
|
0xae,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xf1,
|
||||||
|
0x0,
|
||||||
|
0x88,
|
||||||
|
0xd,
|
||||||
|
0x0,
|
||||||
|
0x1,
|
||||||
|
0xc,
|
||||||
|
0x3,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0x20,
|
||||||
|
0xaf,
|
||||||
|
0xdf,
|
||||||
|
0xaf,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xc0,
|
||||||
|
0x0,
|
||||||
|
0x88,
|
||||||
|
0xd,
|
||||||
|
0x0,
|
||||||
|
0x1,
|
||||||
|
0xc,
|
||||||
|
0x3,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xe4,
|
||||||
|
0xaf,
|
||||||
|
0xff,
|
||||||
0xff,
|
0xff,
|
||||||
0x0,
|
0x0,
|
||||||
0x0,
|
0x0,
|
||||||
0x0,
|
0x1c,
|
||||||
0xf3,
|
0x50,
|
||||||
0x87,
|
0x87,
|
||||||
0x17,
|
0x17,
|
||||||
0x0,
|
0x0,
|
||||||
@@ -347,7 +395,7 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x45,
|
0x45,
|
||||||
0x53,
|
0x53,
|
||||||
0xa,
|
0xa,
|
||||||
0x5c,
|
0x8c,
|
||||||
0x50,
|
0x50,
|
||||||
0x53,
|
0x53,
|
||||||
0x33,
|
0x33,
|
||||||
@@ -358,7 +406,7 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x45,
|
0x45,
|
||||||
0x53,
|
0x53,
|
||||||
0xa,
|
0xa,
|
||||||
0x60,
|
0x90,
|
||||||
0x50,
|
0x50,
|
||||||
0x45,
|
0x45,
|
||||||
0x33,
|
0x33,
|
||||||
@@ -369,7 +417,7 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x45,
|
0x45,
|
||||||
0x53,
|
0x53,
|
||||||
0xa,
|
0xa,
|
||||||
0x68,
|
0x98,
|
||||||
0x50,
|
0x50,
|
||||||
0x4c,
|
0x4c,
|
||||||
0x33,
|
0x33,
|
||||||
@@ -638,103 +686,6 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x79,
|
0x79,
|
||||||
0x0,
|
0x0,
|
||||||
0x10,
|
0x10,
|
||||||
0x40,
|
|
||||||
0x6,
|
|
||||||
0x2e,
|
|
||||||
0x5f,
|
|
||||||
0x53,
|
|
||||||
0x42,
|
|
||||||
0x5f,
|
|
||||||
0x50,
|
|
||||||
0x43,
|
|
||||||
0x49,
|
|
||||||
0x30,
|
|
||||||
0x5b,
|
|
||||||
0x82,
|
|
||||||
0x43,
|
|
||||||
0x5,
|
|
||||||
0x56,
|
|
||||||
0x47,
|
|
||||||
0x41,
|
|
||||||
0x5f,
|
|
||||||
0x8,
|
|
||||||
0x5f,
|
|
||||||
0x41,
|
|
||||||
0x44,
|
|
||||||
0x52,
|
|
||||||
0xc,
|
|
||||||
0x0,
|
|
||||||
0x0,
|
|
||||||
0x2,
|
|
||||||
0x0,
|
|
||||||
0x5b,
|
|
||||||
0x80,
|
|
||||||
0x50,
|
|
||||||
0x43,
|
|
||||||
0x49,
|
|
||||||
0x43,
|
|
||||||
0x2,
|
|
||||||
0x0,
|
|
||||||
0xa,
|
|
||||||
0x4,
|
|
||||||
0x5b,
|
|
||||||
0x81,
|
|
||||||
0xb,
|
|
||||||
0x50,
|
|
||||||
0x43,
|
|
||||||
0x49,
|
|
||||||
0x43,
|
|
||||||
0x3,
|
|
||||||
0x56,
|
|
||||||
0x45,
|
|
||||||
0x4e,
|
|
||||||
0x44,
|
|
||||||
0x20,
|
|
||||||
0x14,
|
|
||||||
0x8,
|
|
||||||
0x5f,
|
|
||||||
0x53,
|
|
||||||
0x31,
|
|
||||||
0x44,
|
|
||||||
0x0,
|
|
||||||
0xa4,
|
|
||||||
0x0,
|
|
||||||
0x14,
|
|
||||||
0x8,
|
|
||||||
0x5f,
|
|
||||||
0x53,
|
|
||||||
0x32,
|
|
||||||
0x44,
|
|
||||||
0x0,
|
|
||||||
0xa4,
|
|
||||||
0x0,
|
|
||||||
0x14,
|
|
||||||
0x19,
|
|
||||||
0x5f,
|
|
||||||
0x53,
|
|
||||||
0x33,
|
|
||||||
0x44,
|
|
||||||
0x0,
|
|
||||||
0xa0,
|
|
||||||
0xe,
|
|
||||||
0x93,
|
|
||||||
0x56,
|
|
||||||
0x45,
|
|
||||||
0x4e,
|
|
||||||
0x44,
|
|
||||||
0xc,
|
|
||||||
0x36,
|
|
||||||
0x1b,
|
|
||||||
0x0,
|
|
||||||
0x1,
|
|
||||||
0xa4,
|
|
||||||
0xa,
|
|
||||||
0x3,
|
|
||||||
0xa1,
|
|
||||||
0x3,
|
|
||||||
0xa4,
|
|
||||||
0x0,
|
|
||||||
0x10,
|
|
||||||
0x25,
|
0x25,
|
||||||
0x2e,
|
0x2e,
|
||||||
0x5f,
|
0x5f,
|
||||||
@@ -860,7 +811,7 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x4e,
|
0x4e,
|
||||||
0x1,
|
0x1,
|
||||||
0x10,
|
0x10,
|
||||||
0x4b,
|
0x4a,
|
||||||
0x1e,
|
0x1e,
|
||||||
0x2f,
|
0x2f,
|
||||||
0x3,
|
0x3,
|
||||||
@@ -878,7 +829,7 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x5f,
|
0x5f,
|
||||||
0x5b,
|
0x5b,
|
||||||
0x82,
|
0x82,
|
||||||
0x2d,
|
0x2c,
|
||||||
0x53,
|
0x53,
|
||||||
0x4d,
|
0x4d,
|
||||||
0x43,
|
0x43,
|
||||||
@@ -898,9 +849,8 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x53,
|
0x53,
|
||||||
0x54,
|
0x54,
|
||||||
0x41,
|
0x41,
|
||||||
0xb,
|
0xa,
|
||||||
0x0,
|
0xf0,
|
||||||
0xff,
|
|
||||||
0x8,
|
0x8,
|
||||||
0x5f,
|
0x5f,
|
||||||
0x43,
|
0x43,
|
||||||
@@ -4061,7 +4011,7 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x1,
|
0x1,
|
||||||
0x10,
|
0x10,
|
||||||
0x47,
|
0x47,
|
||||||
0xe,
|
0x11,
|
||||||
0x5f,
|
0x5f,
|
||||||
0x53,
|
0x53,
|
||||||
0x42,
|
0x42,
|
||||||
@@ -4291,6 +4241,54 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x3,
|
0x3,
|
||||||
0x75,
|
0x75,
|
||||||
0x60,
|
0x60,
|
||||||
|
0x5b,
|
||||||
|
0x82,
|
||||||
|
0x2e,
|
||||||
|
0x50,
|
||||||
|
0x52,
|
||||||
|
0x45,
|
||||||
|
0x53,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x48,
|
||||||
|
0x49,
|
||||||
|
0x44,
|
||||||
|
0xd,
|
||||||
|
0x41,
|
||||||
|
0x43,
|
||||||
|
0x50,
|
||||||
|
0x49,
|
||||||
|
0x30,
|
||||||
|
0x30,
|
||||||
|
0x30,
|
||||||
|
0x34,
|
||||||
|
0x0,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x43,
|
||||||
|
0x52,
|
||||||
|
0x53,
|
||||||
|
0x11,
|
||||||
|
0xd,
|
||||||
|
0xa,
|
||||||
|
0xa,
|
||||||
|
0x47,
|
||||||
|
0x1,
|
||||||
|
0x0,
|
||||||
|
0xaf,
|
||||||
|
0x0,
|
||||||
|
0xaf,
|
||||||
|
0x0,
|
||||||
|
0x20,
|
||||||
|
0x79,
|
||||||
|
0x0,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x53,
|
||||||
|
0x54,
|
||||||
|
0x41,
|
||||||
|
0xa,
|
||||||
|
0xb,
|
||||||
0x10,
|
0x10,
|
||||||
0x42,
|
0x42,
|
||||||
0xc,
|
0xc,
|
||||||
@@ -4488,5 +4486,5 @@ static unsigned char AcpiDsdtAmlCode[] = {
|
|||||||
0x0
|
0x0
|
||||||
};
|
};
|
||||||
static unsigned short piix_dsdt_applesmc_sta[] = {
|
static unsigned short piix_dsdt_applesmc_sta[] = {
|
||||||
0x384
|
0x353
|
||||||
};
|
};
|
||||||
|
@@ -406,7 +406,7 @@ static void patch_instruction(VAPICROMState *s, X86CPU *cpu, target_ulong ip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!kvm_enabled()) {
|
if (!kvm_enabled()) {
|
||||||
cpu_restore_state(env, env->mem_io_pc);
|
cpu_restore_state(cs, cs->mem_io_pc);
|
||||||
cpu_get_tb_cpu_state(env, ¤t_pc, ¤t_cs_base,
|
cpu_get_tb_cpu_state(env, ¤t_pc, ¤t_cs_base,
|
||||||
¤t_flags);
|
¤t_flags);
|
||||||
}
|
}
|
||||||
@@ -448,8 +448,8 @@ static void patch_instruction(VAPICROMState *s, X86CPU *cpu, target_ulong ip)
|
|||||||
|
|
||||||
if (!kvm_enabled()) {
|
if (!kvm_enabled()) {
|
||||||
cs->current_tb = NULL;
|
cs->current_tb = NULL;
|
||||||
tb_gen_code(env, current_pc, current_cs_base, current_flags, 1);
|
tb_gen_code(cs, current_pc, current_cs_base, current_flags, 1);
|
||||||
cpu_resume_from_signal(env, NULL);
|
cpu_resume_from_signal(cs, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -266,13 +266,15 @@ static void pc_compat_1_7(QEMUMachineInitArgs *args)
|
|||||||
{
|
{
|
||||||
smbios_type1_defaults = false;
|
smbios_type1_defaults = false;
|
||||||
gigabyte_align = false;
|
gigabyte_align = false;
|
||||||
|
option_rom_has_mr = true;
|
||||||
|
x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pc_compat_1_6(QEMUMachineInitArgs *args)
|
static void pc_compat_1_6(QEMUMachineInitArgs *args)
|
||||||
{
|
{
|
||||||
pc_compat_1_7(args);
|
pc_compat_1_7(args);
|
||||||
has_pci_info = false;
|
has_pci_info = false;
|
||||||
rom_file_in_ram = false;
|
rom_file_has_mr = false;
|
||||||
has_acpi_build = false;
|
has_acpi_build = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +300,7 @@ static void pc_compat_1_3(QEMUMachineInitArgs *args)
|
|||||||
static void pc_compat_1_2(QEMUMachineInitArgs *args)
|
static void pc_compat_1_2(QEMUMachineInitArgs *args)
|
||||||
{
|
{
|
||||||
pc_compat_1_3(args);
|
pc_compat_1_3(args);
|
||||||
disable_kvm_pv_eoi();
|
x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pc_init_pci_1_7(QEMUMachineInitArgs *args)
|
static void pc_init_pci_1_7(QEMUMachineInitArgs *args)
|
||||||
@@ -344,7 +346,7 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
|
|||||||
has_pci_info = false;
|
has_pci_info = false;
|
||||||
has_acpi_build = false;
|
has_acpi_build = false;
|
||||||
smbios_type1_defaults = false;
|
smbios_type1_defaults = false;
|
||||||
disable_kvm_pv_eoi();
|
x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
|
||||||
enable_compat_apic_id_mode();
|
enable_compat_apic_id_mode();
|
||||||
pc_init1(args, 1, 0);
|
pc_init1(args, 1, 0);
|
||||||
}
|
}
|
||||||
@@ -357,7 +359,7 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
|
|||||||
if (!args->cpu_model) {
|
if (!args->cpu_model) {
|
||||||
args->cpu_model = "486";
|
args->cpu_model = "486";
|
||||||
}
|
}
|
||||||
disable_kvm_pv_eoi();
|
x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
|
||||||
enable_compat_apic_id_mode();
|
enable_compat_apic_id_mode();
|
||||||
pc_init1(args, 0, 1);
|
pc_init1(args, 0, 1);
|
||||||
}
|
}
|
||||||
|
@@ -244,13 +244,15 @@ static void pc_compat_1_7(QEMUMachineInitArgs *args)
|
|||||||
{
|
{
|
||||||
smbios_type1_defaults = false;
|
smbios_type1_defaults = false;
|
||||||
gigabyte_align = false;
|
gigabyte_align = false;
|
||||||
|
option_rom_has_mr = true;
|
||||||
|
x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pc_compat_1_6(QEMUMachineInitArgs *args)
|
static void pc_compat_1_6(QEMUMachineInitArgs *args)
|
||||||
{
|
{
|
||||||
pc_compat_1_7(args);
|
pc_compat_1_7(args);
|
||||||
has_pci_info = false;
|
has_pci_info = false;
|
||||||
rom_file_in_ram = false;
|
rom_file_has_mr = false;
|
||||||
has_acpi_build = false;
|
has_acpi_build = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -72,6 +72,8 @@ DefinitionBlock (
|
|||||||
Name(_ADR, 0x00)
|
Name(_ADR, 0x00)
|
||||||
Name(_UID, 1)
|
Name(_UID, 1)
|
||||||
|
|
||||||
|
External(ISA, DeviceObj)
|
||||||
|
|
||||||
// _OSC: based on sample of ACPI3.0b spec
|
// _OSC: based on sample of ACPI3.0b spec
|
||||||
Name(SUPP, 0) // PCI _OSC Support Field value
|
Name(SUPP, 0) // PCI _OSC Support Field value
|
||||||
Name(CTRL, 0) // PCI _OSC Control Field value
|
Name(CTRL, 0) // PCI _OSC Control Field value
|
||||||
@@ -133,26 +135,6 @@ DefinitionBlock (
|
|||||||
#include "acpi-dsdt-hpet.dsl"
|
#include "acpi-dsdt-hpet.dsl"
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************
|
|
||||||
* VGA
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
Scope(\_SB.PCI0) {
|
|
||||||
Device(VGA) {
|
|
||||||
Name(_ADR, 0x00010000)
|
|
||||||
Method(_S1D, 0, NotSerialized) {
|
|
||||||
Return (0x00)
|
|
||||||
}
|
|
||||||
Method(_S2D, 0, NotSerialized) {
|
|
||||||
Return (0x00)
|
|
||||||
}
|
|
||||||
Method(_S3D, 0, NotSerialized) {
|
|
||||||
Return (0x00)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* LPC ISA bridge
|
* LPC ISA bridge
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
@@ -160,8 +142,7 @@ DefinitionBlock (
|
|||||||
Scope(\_SB.PCI0) {
|
Scope(\_SB.PCI0) {
|
||||||
/* PCI D31:f0 LPC ISA bridge */
|
/* PCI D31:f0 LPC ISA bridge */
|
||||||
Device(ISA) {
|
Device(ISA) {
|
||||||
/* PCI D31:f0 */
|
Name (_ADR, 0x001F0000) // _ADR: Address
|
||||||
Name(_ADR, 0x001f0000)
|
|
||||||
|
|
||||||
/* ICH9 PCI to ISA irq remapping */
|
/* ICH9 PCI to ISA irq remapping */
|
||||||
OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C)
|
OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C)
|
||||||
|
@@ -3,12 +3,12 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
|
|||||||
0x53,
|
0x53,
|
||||||
0x44,
|
0x44,
|
||||||
0x54,
|
0x54,
|
||||||
0xdf,
|
0xd7,
|
||||||
0x1c,
|
0x1c,
|
||||||
0x0,
|
0x0,
|
||||||
0x0,
|
0x0,
|
||||||
0x1,
|
0x1,
|
||||||
0xff,
|
0x3e,
|
||||||
0x42,
|
0x42,
|
||||||
0x58,
|
0x58,
|
||||||
0x50,
|
0x50,
|
||||||
@@ -415,11 +415,11 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
|
|||||||
0x0,
|
0x0,
|
||||||
0x0,
|
0x0,
|
||||||
0x0,
|
0x0,
|
||||||
0xf7,
|
0xd7,
|
||||||
0xc,
|
0xc,
|
||||||
0x0,
|
0x0,
|
||||||
0x0,
|
0x0,
|
||||||
0xf8,
|
0xd8,
|
||||||
0xc,
|
0xc,
|
||||||
0x88,
|
0x88,
|
||||||
0xd,
|
0xd,
|
||||||
@@ -853,61 +853,6 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
|
|||||||
0x79,
|
0x79,
|
||||||
0x0,
|
0x0,
|
||||||
0x10,
|
0x10,
|
||||||
0x36,
|
|
||||||
0x2e,
|
|
||||||
0x5f,
|
|
||||||
0x53,
|
|
||||||
0x42,
|
|
||||||
0x5f,
|
|
||||||
0x50,
|
|
||||||
0x43,
|
|
||||||
0x49,
|
|
||||||
0x30,
|
|
||||||
0x5b,
|
|
||||||
0x82,
|
|
||||||
0x2a,
|
|
||||||
0x56,
|
|
||||||
0x47,
|
|
||||||
0x41,
|
|
||||||
0x5f,
|
|
||||||
0x8,
|
|
||||||
0x5f,
|
|
||||||
0x41,
|
|
||||||
0x44,
|
|
||||||
0x52,
|
|
||||||
0xc,
|
|
||||||
0x0,
|
|
||||||
0x0,
|
|
||||||
0x1,
|
|
||||||
0x0,
|
|
||||||
0x14,
|
|
||||||
0x8,
|
|
||||||
0x5f,
|
|
||||||
0x53,
|
|
||||||
0x31,
|
|
||||||
0x44,
|
|
||||||
0x0,
|
|
||||||
0xa4,
|
|
||||||
0x0,
|
|
||||||
0x14,
|
|
||||||
0x8,
|
|
||||||
0x5f,
|
|
||||||
0x53,
|
|
||||||
0x32,
|
|
||||||
0x44,
|
|
||||||
0x0,
|
|
||||||
0xa4,
|
|
||||||
0x0,
|
|
||||||
0x14,
|
|
||||||
0x8,
|
|
||||||
0x5f,
|
|
||||||
0x53,
|
|
||||||
0x33,
|
|
||||||
0x44,
|
|
||||||
0x0,
|
|
||||||
0xa4,
|
|
||||||
0x0,
|
|
||||||
0x10,
|
|
||||||
0x4c,
|
0x4c,
|
||||||
0x7,
|
0x7,
|
||||||
0x2e,
|
0x2e,
|
||||||
@@ -1033,7 +978,7 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
|
|||||||
0x4e,
|
0x4e,
|
||||||
0x1,
|
0x1,
|
||||||
0x10,
|
0x10,
|
||||||
0x4b,
|
0x4a,
|
||||||
0x1e,
|
0x1e,
|
||||||
0x2f,
|
0x2f,
|
||||||
0x3,
|
0x3,
|
||||||
@@ -1051,7 +996,7 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
|
|||||||
0x5f,
|
0x5f,
|
||||||
0x5b,
|
0x5b,
|
||||||
0x82,
|
0x82,
|
||||||
0x2d,
|
0x2c,
|
||||||
0x53,
|
0x53,
|
||||||
0x4d,
|
0x4d,
|
||||||
0x43,
|
0x43,
|
||||||
@@ -1071,9 +1016,8 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
|
|||||||
0x53,
|
0x53,
|
||||||
0x54,
|
0x54,
|
||||||
0x41,
|
0x41,
|
||||||
0xb,
|
0xa,
|
||||||
0x0,
|
0xf0,
|
||||||
0xff,
|
|
||||||
0x8,
|
0x8,
|
||||||
0x5f,
|
0x5f,
|
||||||
0x43,
|
0x43,
|
||||||
@@ -7016,7 +6960,7 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
|
|||||||
0x1,
|
0x1,
|
||||||
0x10,
|
0x10,
|
||||||
0x47,
|
0x47,
|
||||||
0xe,
|
0x11,
|
||||||
0x5f,
|
0x5f,
|
||||||
0x53,
|
0x53,
|
||||||
0x42,
|
0x42,
|
||||||
@@ -7121,8 +7065,8 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
|
|||||||
0x54,
|
0x54,
|
||||||
0x1,
|
0x1,
|
||||||
0xb,
|
0xb,
|
||||||
0x0,
|
0xd8,
|
||||||
0xaf,
|
0xc,
|
||||||
0xa,
|
0xa,
|
||||||
0x20,
|
0x20,
|
||||||
0x5b,
|
0x5b,
|
||||||
@@ -7246,6 +7190,54 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
|
|||||||
0x3,
|
0x3,
|
||||||
0x75,
|
0x75,
|
||||||
0x60,
|
0x60,
|
||||||
|
0x5b,
|
||||||
|
0x82,
|
||||||
|
0x2e,
|
||||||
|
0x50,
|
||||||
|
0x52,
|
||||||
|
0x45,
|
||||||
|
0x53,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x48,
|
||||||
|
0x49,
|
||||||
|
0x44,
|
||||||
|
0xd,
|
||||||
|
0x41,
|
||||||
|
0x43,
|
||||||
|
0x50,
|
||||||
|
0x49,
|
||||||
|
0x30,
|
||||||
|
0x30,
|
||||||
|
0x30,
|
||||||
|
0x34,
|
||||||
|
0x0,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x43,
|
||||||
|
0x52,
|
||||||
|
0x53,
|
||||||
|
0x11,
|
||||||
|
0xd,
|
||||||
|
0xa,
|
||||||
|
0xa,
|
||||||
|
0x47,
|
||||||
|
0x1,
|
||||||
|
0xd8,
|
||||||
|
0xc,
|
||||||
|
0xd8,
|
||||||
|
0xc,
|
||||||
|
0x0,
|
||||||
|
0x20,
|
||||||
|
0x79,
|
||||||
|
0x0,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x53,
|
||||||
|
0x54,
|
||||||
|
0x41,
|
||||||
|
0xa,
|
||||||
|
0xb,
|
||||||
0x10,
|
0x10,
|
||||||
0x4f,
|
0x4f,
|
||||||
0x8,
|
0x8,
|
||||||
@@ -7392,5 +7384,5 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
|
|||||||
0x0
|
0x0
|
||||||
};
|
};
|
||||||
static unsigned short q35_dsdt_applesmc_sta[] = {
|
static unsigned short q35_dsdt_applesmc_sta[] = {
|
||||||
0x431
|
0x3fa
|
||||||
};
|
};
|
||||||
|
@@ -46,5 +46,55 @@ DefinitionBlock ("ssdt-pcihp.aml", "SSDT", 0x01, "BXPC", "BXSSDTPCIHP", 0x1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ACPI_EXTRACT_DEVICE_START ssdt_pcinohp_start
|
||||||
|
ACPI_EXTRACT_DEVICE_END ssdt_pcinohp_end
|
||||||
|
ACPI_EXTRACT_DEVICE_STRING ssdt_pcinohp_name
|
||||||
|
|
||||||
|
// Extract the offsets of the device name, address dword and the slot
|
||||||
|
// name byte - we fill them in for each device.
|
||||||
|
Device(SBB) {
|
||||||
|
ACPI_EXTRACT_NAME_DWORD_CONST ssdt_pcinohp_adr
|
||||||
|
Name(_ADR, 0xAA0000)
|
||||||
|
}
|
||||||
|
|
||||||
|
ACPI_EXTRACT_DEVICE_START ssdt_pcivga_start
|
||||||
|
ACPI_EXTRACT_DEVICE_END ssdt_pcivga_end
|
||||||
|
ACPI_EXTRACT_DEVICE_STRING ssdt_pcivga_name
|
||||||
|
|
||||||
|
// Extract the offsets of the device name, address dword and the slot
|
||||||
|
// name byte - we fill them in for each device.
|
||||||
|
Device(SCC) {
|
||||||
|
ACPI_EXTRACT_NAME_DWORD_CONST ssdt_pcivga_adr
|
||||||
|
Name(_ADR, 0xAA0000)
|
||||||
|
Method(_S1D, 0, NotSerialized) {
|
||||||
|
Return (0x00)
|
||||||
|
}
|
||||||
|
Method(_S2D, 0, NotSerialized) {
|
||||||
|
Return (0x00)
|
||||||
|
}
|
||||||
|
Method(_S3D, 0, NotSerialized) {
|
||||||
|
Return (0x00)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ACPI_EXTRACT_DEVICE_START ssdt_pciqxl_start
|
||||||
|
ACPI_EXTRACT_DEVICE_END ssdt_pciqxl_end
|
||||||
|
ACPI_EXTRACT_DEVICE_STRING ssdt_pciqxl_name
|
||||||
|
|
||||||
|
// Extract the offsets of the device name, address dword and the slot
|
||||||
|
// name byte - we fill them in for each device.
|
||||||
|
Device(SDD) {
|
||||||
|
ACPI_EXTRACT_NAME_DWORD_CONST ssdt_pciqxl_adr
|
||||||
|
Name(_ADR, 0xAA0000)
|
||||||
|
Method(_S1D, 0, NotSerialized) {
|
||||||
|
Return (0x00)
|
||||||
|
}
|
||||||
|
Method(_S2D, 0, NotSerialized) {
|
||||||
|
Return (0x00)
|
||||||
|
}
|
||||||
|
Method(_S3D, 0, NotSerialized) {
|
||||||
|
Return (0x03) // QXL
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,23 +1,38 @@
|
|||||||
static unsigned char ssdt_pcihp_name[] = {
|
static unsigned char ssdt_pcihp_name[] = {
|
||||||
0x33
|
0x34
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pcivga_end[] = {
|
||||||
|
0x99
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pcivga_name[] = {
|
||||||
|
0x70
|
||||||
};
|
};
|
||||||
static unsigned char ssdt_pcihp_adr[] = {
|
static unsigned char ssdt_pcihp_adr[] = {
|
||||||
0x44
|
0x45
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pcinohp_end[] = {
|
||||||
|
0x6d
|
||||||
};
|
};
|
||||||
static unsigned char ssdt_pcihp_end[] = {
|
static unsigned char ssdt_pcihp_end[] = {
|
||||||
0x5b
|
0x5c
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pciqxl_start[] = {
|
||||||
|
0x99
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pcinohp_name[] = {
|
||||||
|
0x5f
|
||||||
};
|
};
|
||||||
static unsigned char ssdp_pcihp_aml[] = {
|
static unsigned char ssdp_pcihp_aml[] = {
|
||||||
0x53,
|
0x53,
|
||||||
0x53,
|
0x53,
|
||||||
0x44,
|
0x44,
|
||||||
0x54,
|
0x54,
|
||||||
0x5b,
|
0xc6,
|
||||||
0x0,
|
0x0,
|
||||||
0x0,
|
0x0,
|
||||||
0x0,
|
0x0,
|
||||||
0x1,
|
0x1,
|
||||||
0xe8,
|
0x6b,
|
||||||
0x42,
|
0x42,
|
||||||
0x58,
|
0x58,
|
||||||
0x50,
|
0x50,
|
||||||
@@ -45,7 +60,8 @@ static unsigned char ssdp_pcihp_aml[] = {
|
|||||||
0x13,
|
0x13,
|
||||||
0x20,
|
0x20,
|
||||||
0x10,
|
0x10,
|
||||||
0x36,
|
0x41,
|
||||||
|
0xa,
|
||||||
0x5c,
|
0x5c,
|
||||||
0x2e,
|
0x2e,
|
||||||
0x5f,
|
0x5f,
|
||||||
@@ -98,11 +114,138 @@ static unsigned char ssdp_pcihp_aml[] = {
|
|||||||
0x5f,
|
0x5f,
|
||||||
0x53,
|
0x53,
|
||||||
0x55,
|
0x55,
|
||||||
0x4e
|
0x4e,
|
||||||
|
0x5b,
|
||||||
|
0x82,
|
||||||
|
0xf,
|
||||||
|
0x53,
|
||||||
|
0x42,
|
||||||
|
0x42,
|
||||||
|
0x5f,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x41,
|
||||||
|
0x44,
|
||||||
|
0x52,
|
||||||
|
0xc,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xaa,
|
||||||
|
0x0,
|
||||||
|
0x5b,
|
||||||
|
0x82,
|
||||||
|
0x2a,
|
||||||
|
0x53,
|
||||||
|
0x43,
|
||||||
|
0x43,
|
||||||
|
0x5f,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x41,
|
||||||
|
0x44,
|
||||||
|
0x52,
|
||||||
|
0xc,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xaa,
|
||||||
|
0x0,
|
||||||
|
0x14,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x53,
|
||||||
|
0x31,
|
||||||
|
0x44,
|
||||||
|
0x0,
|
||||||
|
0xa4,
|
||||||
|
0x0,
|
||||||
|
0x14,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x53,
|
||||||
|
0x32,
|
||||||
|
0x44,
|
||||||
|
0x0,
|
||||||
|
0xa4,
|
||||||
|
0x0,
|
||||||
|
0x14,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x53,
|
||||||
|
0x33,
|
||||||
|
0x44,
|
||||||
|
0x0,
|
||||||
|
0xa4,
|
||||||
|
0x0,
|
||||||
|
0x5b,
|
||||||
|
0x82,
|
||||||
|
0x2b,
|
||||||
|
0x53,
|
||||||
|
0x44,
|
||||||
|
0x44,
|
||||||
|
0x5f,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x41,
|
||||||
|
0x44,
|
||||||
|
0x52,
|
||||||
|
0xc,
|
||||||
|
0x0,
|
||||||
|
0x0,
|
||||||
|
0xaa,
|
||||||
|
0x0,
|
||||||
|
0x14,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x53,
|
||||||
|
0x31,
|
||||||
|
0x44,
|
||||||
|
0x0,
|
||||||
|
0xa4,
|
||||||
|
0x0,
|
||||||
|
0x14,
|
||||||
|
0x8,
|
||||||
|
0x5f,
|
||||||
|
0x53,
|
||||||
|
0x32,
|
||||||
|
0x44,
|
||||||
|
0x0,
|
||||||
|
0xa4,
|
||||||
|
0x0,
|
||||||
|
0x14,
|
||||||
|
0x9,
|
||||||
|
0x5f,
|
||||||
|
0x53,
|
||||||
|
0x33,
|
||||||
|
0x44,
|
||||||
|
0x0,
|
||||||
|
0xa4,
|
||||||
|
0xa,
|
||||||
|
0x3
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pciqxl_adr[] = {
|
||||||
|
0xa6
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pcinohp_adr[] = {
|
||||||
|
0x69
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pcivga_adr[] = {
|
||||||
|
0x7a
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pciqxl_name[] = {
|
||||||
|
0x9c
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pcivga_start[] = {
|
||||||
|
0x6d
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pciqxl_end[] = {
|
||||||
|
0xc6
|
||||||
};
|
};
|
||||||
static unsigned char ssdt_pcihp_start[] = {
|
static unsigned char ssdt_pcihp_start[] = {
|
||||||
0x30
|
0x31
|
||||||
};
|
};
|
||||||
static unsigned char ssdt_pcihp_id[] = {
|
static unsigned char ssdt_pcihp_id[] = {
|
||||||
0x3d
|
0x3e
|
||||||
|
};
|
||||||
|
static unsigned char ssdt_pcinohp_start[] = {
|
||||||
|
0x5c
|
||||||
};
|
};
|
||||||
|
@@ -281,7 +281,7 @@ static void kbd_write_command(void *opaque, hwaddr addr,
|
|||||||
kbd_update_irq(s);
|
kbd_update_irq(s);
|
||||||
break;
|
break;
|
||||||
case KBD_CCMD_READ_INPORT:
|
case KBD_CCMD_READ_INPORT:
|
||||||
kbd_queue(s, 0x00, 0);
|
kbd_queue(s, 0x80, 0);
|
||||||
break;
|
break;
|
||||||
case KBD_CCMD_READ_OUTPORT:
|
case KBD_CCMD_READ_OUTPORT:
|
||||||
kbd_queue(s, s->outport, 0);
|
kbd_queue(s, s->outport, 0);
|
||||||
|
@@ -148,7 +148,7 @@ typedef void (*vgic_translate_fn)(GICState *s, int irq, int cpu,
|
|||||||
uint32_t *field, bool to_kernel);
|
uint32_t *field, bool to_kernel);
|
||||||
|
|
||||||
/* synthetic translate function used for clear/set registers to completely
|
/* synthetic translate function used for clear/set registers to completely
|
||||||
* clear a setting using a clear-register before setting the remaing bits
|
* clear a setting using a clear-register before setting the remaining bits
|
||||||
* using a set-register */
|
* using a set-register */
|
||||||
static void translate_clear(GICState *s, int irq, int cpu,
|
static void translate_clear(GICState *s, int irq, int cpu,
|
||||||
uint32_t *field, bool to_kernel)
|
uint32_t *field, bool to_kernel)
|
||||||
|
@@ -93,9 +93,6 @@ static void ioapic_set_irq(void *opaque, int vector, int level)
|
|||||||
uint32_t mask = 1 << vector;
|
uint32_t mask = 1 << vector;
|
||||||
uint64_t entry = s->ioredtbl[vector];
|
uint64_t entry = s->ioredtbl[vector];
|
||||||
|
|
||||||
if (entry & (1 << IOAPIC_LVT_POLARITY_SHIFT)) {
|
|
||||||
level = !level;
|
|
||||||
}
|
|
||||||
if (((entry >> IOAPIC_LVT_TRIGGER_MODE_SHIFT) & 1) ==
|
if (((entry >> IOAPIC_LVT_TRIGGER_MODE_SHIFT) & 1) ==
|
||||||
IOAPIC_TRIGGER_LEVEL) {
|
IOAPIC_TRIGGER_LEVEL) {
|
||||||
/* level triggered */
|
/* level triggered */
|
||||||
|
@@ -269,7 +269,16 @@ static void ics_kvm_set_irq(void *opaque, int srcno, int val)
|
|||||||
|
|
||||||
static void ics_kvm_reset(DeviceState *dev)
|
static void ics_kvm_reset(DeviceState *dev)
|
||||||
{
|
{
|
||||||
ics_set_kvm_state(ICS(dev), 1);
|
ICSState *ics = ICS(dev);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
|
||||||
|
for (i = 0; i < ics->nr_irqs; i++) {
|
||||||
|
ics->irqs[i].priority = 0xff;
|
||||||
|
ics->irqs[i].saved_priority = 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
ics_set_kvm_state(ics, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ics_kvm_realize(DeviceState *dev, Error **errp)
|
static void ics_kvm_realize(DeviceState *dev, Error **errp)
|
||||||
|
@@ -13,7 +13,8 @@
|
|||||||
#include "hw/ssi.h"
|
#include "hw/ssi.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SSISlave ssidev;
|
SSISlave parent_obj;
|
||||||
|
|
||||||
qemu_irq interrupt;
|
qemu_irq interrupt;
|
||||||
uint8_t tb1, rb2, rb3;
|
uint8_t tb1, rb2, rb3;
|
||||||
int cycle;
|
int cycle;
|
||||||
@@ -22,6 +23,14 @@ typedef struct {
|
|||||||
int inputs, com;
|
int inputs, com;
|
||||||
} MAX111xState;
|
} MAX111xState;
|
||||||
|
|
||||||
|
#define TYPE_MAX_111X "max111x"
|
||||||
|
|
||||||
|
#define MAX_111X(obj) \
|
||||||
|
OBJECT_CHECK(MAX111xState, (obj), TYPE_MAX_111X)
|
||||||
|
|
||||||
|
#define TYPE_MAX_1110 "max1110"
|
||||||
|
#define TYPE_MAX_1111 "max1111"
|
||||||
|
|
||||||
/* Control-byte bitfields */
|
/* Control-byte bitfields */
|
||||||
#define CB_PD0 (1 << 0)
|
#define CB_PD0 (1 << 0)
|
||||||
#define CB_PD1 (1 << 1)
|
#define CB_PD1 (1 << 1)
|
||||||
@@ -92,7 +101,7 @@ static void max111x_write(MAX111xState *s, uint32_t value)
|
|||||||
|
|
||||||
static uint32_t max111x_transfer(SSISlave *dev, uint32_t value)
|
static uint32_t max111x_transfer(SSISlave *dev, uint32_t value)
|
||||||
{
|
{
|
||||||
MAX111xState *s = FROM_SSI_SLAVE(MAX111xState, dev);
|
MAX111xState *s = MAX_111X(dev);
|
||||||
max111x_write(s, value);
|
max111x_write(s, value);
|
||||||
return max111x_read(s);
|
return max111x_read(s);
|
||||||
}
|
}
|
||||||
@@ -103,7 +112,7 @@ static const VMStateDescription vmstate_max111x = {
|
|||||||
.minimum_version_id = 1,
|
.minimum_version_id = 1,
|
||||||
.minimum_version_id_old = 1,
|
.minimum_version_id_old = 1,
|
||||||
.fields = (VMStateField[]) {
|
.fields = (VMStateField[]) {
|
||||||
VMSTATE_SSI_SLAVE(ssidev, MAX111xState),
|
VMSTATE_SSI_SLAVE(parent_obj, MAX111xState),
|
||||||
VMSTATE_UINT8(tb1, MAX111xState),
|
VMSTATE_UINT8(tb1, MAX111xState),
|
||||||
VMSTATE_UINT8(rb2, MAX111xState),
|
VMSTATE_UINT8(rb2, MAX111xState),
|
||||||
VMSTATE_UINT8(rb3, MAX111xState),
|
VMSTATE_UINT8(rb3, MAX111xState),
|
||||||
@@ -115,11 +124,12 @@ static const VMStateDescription vmstate_max111x = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int max111x_init(SSISlave *dev, int inputs)
|
static int max111x_init(SSISlave *d, int inputs)
|
||||||
{
|
{
|
||||||
MAX111xState *s = FROM_SSI_SLAVE(MAX111xState, dev);
|
DeviceState *dev = DEVICE(d);
|
||||||
|
MAX111xState *s = MAX_111X(dev);
|
||||||
|
|
||||||
qdev_init_gpio_out(&dev->qdev, &s->interrupt, 1);
|
qdev_init_gpio_out(dev, &s->interrupt, 1);
|
||||||
|
|
||||||
s->inputs = inputs;
|
s->inputs = inputs;
|
||||||
/* TODO: add a user interface for setting these */
|
/* TODO: add a user interface for setting these */
|
||||||
@@ -133,7 +143,7 @@ static int max111x_init(SSISlave *dev, int inputs)
|
|||||||
s->input[7] = 0x80;
|
s->input[7] = 0x80;
|
||||||
s->com = 0;
|
s->com = 0;
|
||||||
|
|
||||||
vmstate_register(&dev->qdev, -1, &vmstate_max111x, s);
|
vmstate_register(dev, -1, &vmstate_max111x, s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,23 +159,36 @@ static int max1111_init(SSISlave *dev)
|
|||||||
|
|
||||||
void max111x_set_input(DeviceState *dev, int line, uint8_t value)
|
void max111x_set_input(DeviceState *dev, int line, uint8_t value)
|
||||||
{
|
{
|
||||||
MAX111xState *s = FROM_SSI_SLAVE(MAX111xState, SSI_SLAVE_FROM_QDEV(dev));
|
MAX111xState *s = MAX_111X(dev);
|
||||||
assert(line >= 0 && line < s->inputs);
|
assert(line >= 0 && line < s->inputs);
|
||||||
s->input[line] = value;
|
s->input[line] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void max111x_class_init(ObjectClass *klass, void *data)
|
||||||
|
{
|
||||||
|
SSISlaveClass *k = SSI_SLAVE_CLASS(klass);
|
||||||
|
|
||||||
|
k->transfer = max111x_transfer;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const TypeInfo max111x_info = {
|
||||||
|
.name = TYPE_MAX_111X,
|
||||||
|
.parent = TYPE_SSI_SLAVE,
|
||||||
|
.instance_size = sizeof(MAX111xState),
|
||||||
|
.class_init = max111x_class_init,
|
||||||
|
.abstract = true,
|
||||||
|
};
|
||||||
|
|
||||||
static void max1110_class_init(ObjectClass *klass, void *data)
|
static void max1110_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
SSISlaveClass *k = SSI_SLAVE_CLASS(klass);
|
SSISlaveClass *k = SSI_SLAVE_CLASS(klass);
|
||||||
|
|
||||||
k->init = max1110_init;
|
k->init = max1110_init;
|
||||||
k->transfer = max111x_transfer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo max1110_info = {
|
static const TypeInfo max1110_info = {
|
||||||
.name = "max1110",
|
.name = TYPE_MAX_1110,
|
||||||
.parent = TYPE_SSI_SLAVE,
|
.parent = TYPE_MAX_111X,
|
||||||
.instance_size = sizeof(MAX111xState),
|
|
||||||
.class_init = max1110_class_init,
|
.class_init = max1110_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -174,18 +197,17 @@ static void max1111_class_init(ObjectClass *klass, void *data)
|
|||||||
SSISlaveClass *k = SSI_SLAVE_CLASS(klass);
|
SSISlaveClass *k = SSI_SLAVE_CLASS(klass);
|
||||||
|
|
||||||
k->init = max1111_init;
|
k->init = max1111_init;
|
||||||
k->transfer = max111x_transfer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo max1111_info = {
|
static const TypeInfo max1111_info = {
|
||||||
.name = "max1111",
|
.name = TYPE_MAX_1111,
|
||||||
.parent = TYPE_SSI_SLAVE,
|
.parent = TYPE_MAX_111X,
|
||||||
.instance_size = sizeof(MAX111xState),
|
|
||||||
.class_init = max1111_class_init,
|
.class_init = max1111_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void max111x_register_types(void)
|
static void max111x_register_types(void)
|
||||||
{
|
{
|
||||||
|
type_register_static(&max111x_info);
|
||||||
type_register_static(&max1110_info);
|
type_register_static(&max1110_info);
|
||||||
type_register_static(&max1111_info);
|
type_register_static(&max1111_info);
|
||||||
}
|
}
|
||||||
|
@@ -195,8 +195,8 @@ static void process_tx_fcb(eTSEC *etsec)
|
|||||||
|
|
||||||
/* if packet is IP4 and IP checksum is requested */
|
/* if packet is IP4 and IP checksum is requested */
|
||||||
if (flags & FCB_TX_IP && flags & FCB_TX_CIP) {
|
if (flags & FCB_TX_IP && flags & FCB_TX_CIP) {
|
||||||
/* do IP4 checksum (TODO This funtion does TCP/UDP checksum but not sure
|
/* do IP4 checksum (TODO This function does TCP/UDP checksum
|
||||||
* if it also does IP4 checksum. */
|
* but not sure if it also does IP4 checksum.) */
|
||||||
net_checksum_calculate(etsec->tx_buffer + 8,
|
net_checksum_calculate(etsec->tx_buffer + 8,
|
||||||
etsec->tx_buffer_len - 8);
|
etsec->tx_buffer_len - 8);
|
||||||
}
|
}
|
||||||
@@ -592,7 +592,7 @@ void etsec_walk_rx_ring(eTSEC *etsec, int ring_nbr)
|
|||||||
|
|
||||||
/* TODO: Broadcast and Multicast */
|
/* TODO: Broadcast and Multicast */
|
||||||
|
|
||||||
if (bd.flags | BD_INTERRUPT) {
|
if (bd.flags & BD_INTERRUPT) {
|
||||||
/* Set RXFx */
|
/* Set RXFx */
|
||||||
etsec->regs[RSTAT].value |= 1 << (7 - ring_nbr);
|
etsec->regs[RSTAT].value |= 1 << (7 - ring_nbr);
|
||||||
|
|
||||||
@@ -601,7 +601,7 @@ void etsec_walk_rx_ring(eTSEC *etsec, int ring_nbr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (bd.flags | BD_INTERRUPT) {
|
if (bd.flags & BD_INTERRUPT) {
|
||||||
/* Set IEVENT */
|
/* Set IEVENT */
|
||||||
ievent_set(etsec, IEVENT_RXB);
|
ievent_set(etsec, IEVENT_RXB);
|
||||||
}
|
}
|
||||||
|
@@ -397,12 +397,15 @@ static int peer_detach(VirtIONet *n, int index)
|
|||||||
static void virtio_net_set_queues(VirtIONet *n)
|
static void virtio_net_set_queues(VirtIONet *n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int r;
|
||||||
|
|
||||||
for (i = 0; i < n->max_queues; i++) {
|
for (i = 0; i < n->max_queues; i++) {
|
||||||
if (i < n->curr_queues) {
|
if (i < n->curr_queues) {
|
||||||
assert(!peer_attach(n, i));
|
r = peer_attach(n, i);
|
||||||
|
assert(!r);
|
||||||
} else {
|
} else {
|
||||||
assert(!peer_detach(n, i));
|
r = peer_detach(n, i);
|
||||||
|
assert(!r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,7 +68,7 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory,
|
|||||||
/* XXX: should distinguish read/write cases */
|
/* XXX: should distinguish read/write cases */
|
||||||
memory_region_init_alias(&mem->alias[0], OBJECT(dev), "pam-pci", pci_address_space,
|
memory_region_init_alias(&mem->alias[0], OBJECT(dev), "pam-pci", pci_address_space,
|
||||||
start, size);
|
start, size);
|
||||||
memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", pci_address_space,
|
memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", ram_memory,
|
||||||
start, size);
|
start, size);
|
||||||
|
|
||||||
for (i = 0; i < 4; ++i) {
|
for (i = 0; i < 4; ++i) {
|
||||||
|
@@ -28,7 +28,9 @@
|
|||||||
#include "hw/pci/pci_bus.h"
|
#include "hw/pci/pci_bus.h"
|
||||||
#include "hw/pci/pci_host.h"
|
#include "hw/pci/pci_host.h"
|
||||||
#include "hw/i386/pc.h"
|
#include "hw/i386/pc.h"
|
||||||
|
#include "hw/loader.h"
|
||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
|
#include "elf.h"
|
||||||
|
|
||||||
#define TYPE_RAVEN_PCI_DEVICE "raven"
|
#define TYPE_RAVEN_PCI_DEVICE "raven"
|
||||||
#define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost"
|
#define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost"
|
||||||
@@ -38,6 +40,10 @@
|
|||||||
|
|
||||||
typedef struct RavenPCIState {
|
typedef struct RavenPCIState {
|
||||||
PCIDevice dev;
|
PCIDevice dev;
|
||||||
|
|
||||||
|
uint32_t elf_machine;
|
||||||
|
char *bios_name;
|
||||||
|
MemoryRegion bios;
|
||||||
} RavenPCIState;
|
} RavenPCIState;
|
||||||
|
|
||||||
#define RAVEN_PCI_HOST_BRIDGE(obj) \
|
#define RAVEN_PCI_HOST_BRIDGE(obj) \
|
||||||
@@ -52,6 +58,8 @@ typedef struct PRePPCIState {
|
|||||||
RavenPCIState pci_dev;
|
RavenPCIState pci_dev;
|
||||||
} PREPPCIState;
|
} PREPPCIState;
|
||||||
|
|
||||||
|
#define BIOS_SIZE (1024 * 1024)
|
||||||
|
|
||||||
static inline uint32_t PPC_PCIIO_config(hwaddr addr)
|
static inline uint32_t PPC_PCIIO_config(hwaddr addr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -169,10 +177,45 @@ static void raven_pcihost_initfn(Object *obj)
|
|||||||
|
|
||||||
static int raven_init(PCIDevice *d)
|
static int raven_init(PCIDevice *d)
|
||||||
{
|
{
|
||||||
|
RavenPCIState *s = RAVEN_PCI_DEVICE(d);
|
||||||
|
char *filename;
|
||||||
|
int bios_size = -1;
|
||||||
|
|
||||||
d->config[0x0C] = 0x08; // cache_line_size
|
d->config[0x0C] = 0x08; // cache_line_size
|
||||||
d->config[0x0D] = 0x10; // latency_timer
|
d->config[0x0D] = 0x10; // latency_timer
|
||||||
d->config[0x34] = 0x00; // capabilities_pointer
|
d->config[0x34] = 0x00; // capabilities_pointer
|
||||||
|
|
||||||
|
memory_region_init_ram(&s->bios, OBJECT(s), "bios", BIOS_SIZE);
|
||||||
|
memory_region_set_readonly(&s->bios, true);
|
||||||
|
memory_region_add_subregion(get_system_memory(), (uint32_t)(-BIOS_SIZE),
|
||||||
|
&s->bios);
|
||||||
|
vmstate_register_ram_global(&s->bios);
|
||||||
|
if (s->bios_name) {
|
||||||
|
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, s->bios_name);
|
||||||
|
if (filename) {
|
||||||
|
if (s->elf_machine != EM_NONE) {
|
||||||
|
bios_size = load_elf(filename, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, 1, s->elf_machine, 0);
|
||||||
|
}
|
||||||
|
if (bios_size < 0) {
|
||||||
|
bios_size = get_image_size(filename);
|
||||||
|
if (bios_size > 0 && bios_size <= BIOS_SIZE) {
|
||||||
|
hwaddr bios_addr;
|
||||||
|
bios_size = (bios_size + 0xfff) & ~0xfff;
|
||||||
|
bios_addr = (uint32_t)(-BIOS_SIZE);
|
||||||
|
bios_size = load_image_targphys(filename, bios_addr,
|
||||||
|
bios_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bios_size < 0 || bios_size > BIOS_SIZE) {
|
||||||
|
hw_error("qemu: could not load bios image '%s'\n", s->bios_name);
|
||||||
|
}
|
||||||
|
if (filename) {
|
||||||
|
g_free(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,12 +255,20 @@ static const TypeInfo raven_info = {
|
|||||||
.class_init = raven_class_init,
|
.class_init = raven_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Property raven_pcihost_properties[] = {
|
||||||
|
DEFINE_PROP_UINT32("elf-machine", PREPPCIState, pci_dev.elf_machine,
|
||||||
|
EM_NONE),
|
||||||
|
DEFINE_PROP_STRING("bios-name", PREPPCIState, pci_dev.bios_name),
|
||||||
|
DEFINE_PROP_END_OF_LIST()
|
||||||
|
};
|
||||||
|
|
||||||
static void raven_pcihost_class_init(ObjectClass *klass, void *data)
|
static void raven_pcihost_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||||
dc->realize = raven_pcihost_realizefn;
|
dc->realize = raven_pcihost_realizefn;
|
||||||
|
dc->props = raven_pcihost_properties;
|
||||||
dc->fw_name = "pci";
|
dc->fw_name = "pci";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -272,7 +272,7 @@ static void mch_update_smram(MCHPCIState *mch)
|
|||||||
PCIDevice *pd = PCI_DEVICE(mch);
|
PCIDevice *pd = PCI_DEVICE(mch);
|
||||||
|
|
||||||
memory_region_transaction_begin();
|
memory_region_transaction_begin();
|
||||||
smram_update(&mch->smram_region, pd->config[MCH_HOST_BRDIGE_SMRAM],
|
smram_update(&mch->smram_region, pd->config[MCH_HOST_BRIDGE_SMRAM],
|
||||||
mch->smm_enabled);
|
mch->smm_enabled);
|
||||||
memory_region_transaction_commit();
|
memory_region_transaction_commit();
|
||||||
}
|
}
|
||||||
@@ -283,7 +283,7 @@ static void mch_set_smm(int smm, void *arg)
|
|||||||
PCIDevice *pd = PCI_DEVICE(mch);
|
PCIDevice *pd = PCI_DEVICE(mch);
|
||||||
|
|
||||||
memory_region_transaction_begin();
|
memory_region_transaction_begin();
|
||||||
smram_set_smm(&mch->smm_enabled, smm, pd->config[MCH_HOST_BRDIGE_SMRAM],
|
smram_set_smm(&mch->smm_enabled, smm, pd->config[MCH_HOST_BRIDGE_SMRAM],
|
||||||
&mch->smram_region);
|
&mch->smram_region);
|
||||||
memory_region_transaction_commit();
|
memory_region_transaction_commit();
|
||||||
}
|
}
|
||||||
@@ -306,8 +306,8 @@ static void mch_write_config(PCIDevice *d,
|
|||||||
mch_update_pciexbar(mch);
|
mch_update_pciexbar(mch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ranges_overlap(address, len, MCH_HOST_BRDIGE_SMRAM,
|
if (ranges_overlap(address, len, MCH_HOST_BRIDGE_SMRAM,
|
||||||
MCH_HOST_BRDIGE_SMRAM_SIZE)) {
|
MCH_HOST_BRIDGE_SMRAM_SIZE)) {
|
||||||
mch_update_smram(mch);
|
mch_update_smram(mch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,7 +347,7 @@ static void mch_reset(DeviceState *qdev)
|
|||||||
pci_set_quad(d->config + MCH_HOST_BRIDGE_PCIEXBAR,
|
pci_set_quad(d->config + MCH_HOST_BRIDGE_PCIEXBAR,
|
||||||
MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT);
|
MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT);
|
||||||
|
|
||||||
d->config[MCH_HOST_BRDIGE_SMRAM] = MCH_HOST_BRIDGE_SMRAM_DEFAULT;
|
d->config[MCH_HOST_BRIDGE_SMRAM] = MCH_HOST_BRIDGE_SMRAM_DEFAULT;
|
||||||
|
|
||||||
mch_update(mch);
|
mch_update(mch);
|
||||||
}
|
}
|
||||||
|
51
hw/pci/pci.c
51
hw/pci/pci.c
@@ -48,7 +48,6 @@ static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
|
|||||||
static char *pcibus_get_dev_path(DeviceState *dev);
|
static char *pcibus_get_dev_path(DeviceState *dev);
|
||||||
static char *pcibus_get_fw_dev_path(DeviceState *dev);
|
static char *pcibus_get_fw_dev_path(DeviceState *dev);
|
||||||
static void pcibus_reset(BusState *qbus);
|
static void pcibus_reset(BusState *qbus);
|
||||||
static void pci_bus_finalize(Object *obj);
|
|
||||||
|
|
||||||
static Property pci_props[] = {
|
static Property pci_props[] = {
|
||||||
DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
|
DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
|
||||||
@@ -61,6 +60,34 @@ static Property pci_props[] = {
|
|||||||
DEFINE_PROP_END_OF_LIST()
|
DEFINE_PROP_END_OF_LIST()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const VMStateDescription vmstate_pcibus = {
|
||||||
|
.name = "PCIBUS",
|
||||||
|
.version_id = 1,
|
||||||
|
.minimum_version_id = 1,
|
||||||
|
.minimum_version_id_old = 1,
|
||||||
|
.fields = (VMStateField[]) {
|
||||||
|
VMSTATE_INT32_EQUAL(nirq, PCIBus),
|
||||||
|
VMSTATE_VARRAY_INT32(irq_count, PCIBus,
|
||||||
|
nirq, 0, vmstate_info_int32,
|
||||||
|
int32_t),
|
||||||
|
VMSTATE_END_OF_LIST()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static void pci_bus_realize(BusState *qbus, Error **errp)
|
||||||
|
{
|
||||||
|
PCIBus *bus = PCI_BUS(qbus);
|
||||||
|
|
||||||
|
vmstate_register(NULL, -1, &vmstate_pcibus, bus);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pci_bus_unrealize(BusState *qbus, Error **errp)
|
||||||
|
{
|
||||||
|
PCIBus *bus = PCI_BUS(qbus);
|
||||||
|
|
||||||
|
vmstate_unregister(NULL, &vmstate_pcibus, bus);
|
||||||
|
}
|
||||||
|
|
||||||
static void pci_bus_class_init(ObjectClass *klass, void *data)
|
static void pci_bus_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
BusClass *k = BUS_CLASS(klass);
|
BusClass *k = BUS_CLASS(klass);
|
||||||
@@ -68,6 +95,8 @@ static void pci_bus_class_init(ObjectClass *klass, void *data)
|
|||||||
k->print_dev = pcibus_dev_print;
|
k->print_dev = pcibus_dev_print;
|
||||||
k->get_dev_path = pcibus_get_dev_path;
|
k->get_dev_path = pcibus_get_dev_path;
|
||||||
k->get_fw_dev_path = pcibus_get_fw_dev_path;
|
k->get_fw_dev_path = pcibus_get_fw_dev_path;
|
||||||
|
k->realize = pci_bus_realize;
|
||||||
|
k->unrealize = pci_bus_unrealize;
|
||||||
k->reset = pcibus_reset;
|
k->reset = pcibus_reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +104,6 @@ static const TypeInfo pci_bus_info = {
|
|||||||
.name = TYPE_PCI_BUS,
|
.name = TYPE_PCI_BUS,
|
||||||
.parent = TYPE_BUS,
|
.parent = TYPE_BUS,
|
||||||
.instance_size = sizeof(PCIBus),
|
.instance_size = sizeof(PCIBus),
|
||||||
.instance_finalize = pci_bus_finalize,
|
|
||||||
.class_init = pci_bus_class_init,
|
.class_init = pci_bus_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -95,17 +123,6 @@ static uint16_t pci_default_sub_device_id = PCI_SUBDEVICE_ID_QEMU;
|
|||||||
|
|
||||||
static QLIST_HEAD(, PCIHostState) pci_host_bridges;
|
static QLIST_HEAD(, PCIHostState) pci_host_bridges;
|
||||||
|
|
||||||
static const VMStateDescription vmstate_pcibus = {
|
|
||||||
.name = "PCIBUS",
|
|
||||||
.version_id = 1,
|
|
||||||
.minimum_version_id = 1,
|
|
||||||
.minimum_version_id_old = 1,
|
|
||||||
.fields = (VMStateField []) {
|
|
||||||
VMSTATE_INT32_EQUAL(nirq, PCIBus),
|
|
||||||
VMSTATE_VARRAY_INT32(irq_count, PCIBus, nirq, 0, vmstate_info_int32, int32_t),
|
|
||||||
VMSTATE_END_OF_LIST()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
static int pci_bar(PCIDevice *d, int reg)
|
static int pci_bar(PCIDevice *d, int reg)
|
||||||
{
|
{
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
@@ -299,8 +316,6 @@ static void pci_bus_init(PCIBus *bus, DeviceState *parent,
|
|||||||
QLIST_INIT(&bus->child);
|
QLIST_INIT(&bus->child);
|
||||||
|
|
||||||
pci_host_bus_register(bus, parent);
|
pci_host_bus_register(bus, parent);
|
||||||
|
|
||||||
vmstate_register(NULL, -1, &vmstate_pcibus, bus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pci_bus_is_express(PCIBus *bus)
|
bool pci_bus_is_express(PCIBus *bus)
|
||||||
@@ -369,12 +384,6 @@ int pci_bus_num(PCIBus *s)
|
|||||||
return s->parent_dev->config[PCI_SECONDARY_BUS];
|
return s->parent_dev->config[PCI_SECONDARY_BUS];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pci_bus_finalize(Object *obj)
|
|
||||||
{
|
|
||||||
PCIBus *bus = PCI_BUS(obj);
|
|
||||||
vmstate_unregister(NULL, &vmstate_pcibus, bus);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
|
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
|
||||||
{
|
{
|
||||||
PCIDevice *s = container_of(pv, PCIDevice, config);
|
PCIDevice *s = container_of(pv, PCIDevice, config);
|
||||||
|
@@ -221,29 +221,23 @@ static void pcie_cap_slot_hotplug_common(PCIDevice *hotplug_dev,
|
|||||||
DeviceState *dev,
|
DeviceState *dev,
|
||||||
uint8_t **exp_cap, Error **errp)
|
uint8_t **exp_cap, Error **errp)
|
||||||
{
|
{
|
||||||
PCIDevice *pci_dev = PCI_DEVICE(dev);
|
|
||||||
*exp_cap = hotplug_dev->config + hotplug_dev->exp.exp_cap;
|
*exp_cap = hotplug_dev->config + hotplug_dev->exp.exp_cap;
|
||||||
uint16_t sltsta = pci_get_word(*exp_cap + PCI_EXP_SLTSTA);
|
uint16_t sltsta = pci_get_word(*exp_cap + PCI_EXP_SLTSTA);
|
||||||
|
|
||||||
PCIE_DEV_PRINTF(pci_dev, "hotplug state: %d\n", state);
|
PCIE_DEV_PRINTF(PCI_DEVICE(dev), "hotplug state: %d\n", state);
|
||||||
if (sltsta & PCI_EXP_SLTSTA_EIS) {
|
if (sltsta & PCI_EXP_SLTSTA_EIS) {
|
||||||
/* the slot is electromechanically locked.
|
/* the slot is electromechanically locked.
|
||||||
* This error is propagated up to qdev and then to HMP/QMP.
|
* This error is propagated up to qdev and then to HMP/QMP.
|
||||||
*/
|
*/
|
||||||
error_setg_errno(errp, -EBUSY, "slot is electromechanically locked");
|
error_setg_errno(errp, -EBUSY, "slot is electromechanically locked");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: multifunction hot-plug.
|
|
||||||
* Right now, only a device of function = 0 is allowed to be
|
|
||||||
* hot plugged/unplugged.
|
|
||||||
*/
|
|
||||||
assert(PCI_FUNC(pci_dev->devfn) == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcie_cap_slot_hotplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
|
void pcie_cap_slot_hotplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
uint8_t *exp_cap;
|
uint8_t *exp_cap;
|
||||||
|
PCIDevice *pci_dev = PCI_DEVICE(dev);
|
||||||
|
|
||||||
pcie_cap_slot_hotplug_common(PCI_DEVICE(hotplug_dev), dev, &exp_cap, errp);
|
pcie_cap_slot_hotplug_common(PCI_DEVICE(hotplug_dev), dev, &exp_cap, errp);
|
||||||
|
|
||||||
@@ -256,6 +250,12 @@ void pcie_cap_slot_hotplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: multifunction hot-plug.
|
||||||
|
* Right now, only a device of function = 0 is allowed to be
|
||||||
|
* hot plugged/unplugged.
|
||||||
|
*/
|
||||||
|
assert(PCI_FUNC(pci_dev->devfn) == 0);
|
||||||
|
|
||||||
pci_word_test_and_set_mask(exp_cap + PCI_EXP_SLTSTA,
|
pci_word_test_and_set_mask(exp_cap + PCI_EXP_SLTSTA,
|
||||||
PCI_EXP_SLTSTA_PDS);
|
PCI_EXP_SLTSTA_PDS);
|
||||||
pcie_cap_slot_event(PCI_DEVICE(hotplug_dev), PCI_EXP_HP_EV_PDC);
|
pcie_cap_slot_event(PCI_DEVICE(hotplug_dev), PCI_EXP_HP_EV_PDC);
|
||||||
|
@@ -472,14 +472,13 @@ static void ppce500_cpu_reset_sec(void *opaque)
|
|||||||
{
|
{
|
||||||
PowerPCCPU *cpu = opaque;
|
PowerPCCPU *cpu = opaque;
|
||||||
CPUState *cs = CPU(cpu);
|
CPUState *cs = CPU(cpu);
|
||||||
CPUPPCState *env = &cpu->env;
|
|
||||||
|
|
||||||
cpu_reset(cs);
|
cpu_reset(cs);
|
||||||
|
|
||||||
/* Secondary CPU starts in halted state for now. Needs to change when
|
/* Secondary CPU starts in halted state for now. Needs to change when
|
||||||
implementing non-kernel boot. */
|
implementing non-kernel boot. */
|
||||||
cs->halted = 1;
|
cs->halted = 1;
|
||||||
env->exception_index = EXCP_HLT;
|
cs->exception_index = EXCP_HLT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ppce500_cpu_reset(void *opaque)
|
static void ppce500_cpu_reset(void *opaque)
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
ram_addr_t ppc405_set_bootinfo (CPUPPCState *env, ppc4xx_bd_info_t *bd,
|
ram_addr_t ppc405_set_bootinfo (CPUPPCState *env, ppc4xx_bd_info_t *bd,
|
||||||
uint32_t flags)
|
uint32_t flags)
|
||||||
{
|
{
|
||||||
CPUState *cs = ENV_GET_CPU(env);
|
CPUState *cs = CPU(ppc_env_get_cpu(env));
|
||||||
ram_addr_t bdloc;
|
ram_addr_t bdloc;
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
|
@@ -117,7 +117,7 @@ static void spin_kick(void *data)
|
|||||||
mmubooke_create_initial_mapping(env, 0, map_start, map_size);
|
mmubooke_create_initial_mapping(env, 0, map_start, map_size);
|
||||||
|
|
||||||
cpu->halted = 0;
|
cpu->halted = 0;
|
||||||
env->exception_index = -1;
|
cpu->exception_index = -1;
|
||||||
cpu->stopped = false;
|
cpu->stopped = false;
|
||||||
qemu_cpu_kick(cpu);
|
qemu_cpu_kick(cpu);
|
||||||
}
|
}
|
||||||
|
@@ -456,7 +456,6 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
|
|||||||
MemoryRegion *sysmem = get_system_memory();
|
MemoryRegion *sysmem = get_system_memory();
|
||||||
PowerPCCPU *cpu = NULL;
|
PowerPCCPU *cpu = NULL;
|
||||||
CPUPPCState *env = NULL;
|
CPUPPCState *env = NULL;
|
||||||
char *filename;
|
|
||||||
nvram_t nvram;
|
nvram_t nvram;
|
||||||
M48t59State *m48t59;
|
M48t59State *m48t59;
|
||||||
MemoryRegion *PPC_io_memory = g_new(MemoryRegion, 1);
|
MemoryRegion *PPC_io_memory = g_new(MemoryRegion, 1);
|
||||||
@@ -464,9 +463,8 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
|
|||||||
#if 0
|
#if 0
|
||||||
MemoryRegion *xcsr = g_new(MemoryRegion, 1);
|
MemoryRegion *xcsr = g_new(MemoryRegion, 1);
|
||||||
#endif
|
#endif
|
||||||
int linux_boot, i, nb_nics1, bios_size;
|
int linux_boot, i, nb_nics1;
|
||||||
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
||||||
MemoryRegion *bios = g_new(MemoryRegion, 1);
|
|
||||||
uint32_t kernel_base, initrd_base;
|
uint32_t kernel_base, initrd_base;
|
||||||
long kernel_size, initrd_size;
|
long kernel_size, initrd_size;
|
||||||
DeviceState *dev;
|
DeviceState *dev;
|
||||||
@@ -509,43 +507,6 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
|
|||||||
vmstate_register_ram_global(ram);
|
vmstate_register_ram_global(ram);
|
||||||
memory_region_add_subregion(sysmem, 0, ram);
|
memory_region_add_subregion(sysmem, 0, ram);
|
||||||
|
|
||||||
/* allocate and load BIOS */
|
|
||||||
memory_region_init_ram(bios, NULL, "ppc_prep.bios", BIOS_SIZE);
|
|
||||||
memory_region_set_readonly(bios, true);
|
|
||||||
memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios);
|
|
||||||
vmstate_register_ram_global(bios);
|
|
||||||
if (bios_name == NULL)
|
|
||||||
bios_name = BIOS_FILENAME;
|
|
||||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
|
||||||
if (filename) {
|
|
||||||
bios_size = load_elf(filename, NULL, NULL, NULL,
|
|
||||||
NULL, NULL, 1, ELF_MACHINE, 0);
|
|
||||||
if (bios_size < 0) {
|
|
||||||
bios_size = get_image_size(filename);
|
|
||||||
if (bios_size > 0 && bios_size <= BIOS_SIZE) {
|
|
||||||
hwaddr bios_addr;
|
|
||||||
bios_size = (bios_size + 0xfff) & ~0xfff;
|
|
||||||
bios_addr = (uint32_t)(-bios_size);
|
|
||||||
bios_size = load_image_targphys(filename, bios_addr, bios_size);
|
|
||||||
}
|
|
||||||
if (bios_size > BIOS_SIZE) {
|
|
||||||
fprintf(stderr, "qemu: PReP bios '%s' is too large (0x%x)\n",
|
|
||||||
bios_name, bios_size);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bios_size = -1;
|
|
||||||
}
|
|
||||||
if (bios_size < 0 && !qtest_enabled()) {
|
|
||||||
fprintf(stderr, "qemu: could not load PPC PReP bios '%s'\n",
|
|
||||||
bios_name);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (filename) {
|
|
||||||
g_free(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (linux_boot) {
|
if (linux_boot) {
|
||||||
kernel_base = KERNEL_LOAD_ADDR;
|
kernel_base = KERNEL_LOAD_ADDR;
|
||||||
/* now we can load the kernel */
|
/* now we can load the kernel */
|
||||||
@@ -593,6 +554,11 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dev = qdev_create(NULL, "raven-pcihost");
|
dev = qdev_create(NULL, "raven-pcihost");
|
||||||
|
if (bios_name == NULL) {
|
||||||
|
bios_name = BIOS_FILENAME;
|
||||||
|
}
|
||||||
|
qdev_prop_set_string(dev, "bios-name", bios_name);
|
||||||
|
qdev_prop_set_uint32(dev, "elf-machine", ELF_MACHINE);
|
||||||
pcihost = PCI_HOST_BRIDGE(dev);
|
pcihost = PCI_HOST_BRIDGE(dev);
|
||||||
object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), NULL);
|
object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), NULL);
|
||||||
qdev_init_nofail(dev);
|
qdev_init_nofail(dev);
|
||||||
|
@@ -781,13 +781,15 @@ static int spapr_vga_init(PCIBus *pci_bus)
|
|||||||
{
|
{
|
||||||
switch (vga_interface_type) {
|
switch (vga_interface_type) {
|
||||||
case VGA_NONE:
|
case VGA_NONE:
|
||||||
|
return false;
|
||||||
|
case VGA_DEVICE:
|
||||||
|
return true;
|
||||||
case VGA_STD:
|
case VGA_STD:
|
||||||
return pci_vga_init(pci_bus) != NULL;
|
return pci_vga_init(pci_bus) != NULL;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "This vga model is not supported,"
|
fprintf(stderr, "This vga model is not supported,"
|
||||||
"currently it only supports -vga std\n");
|
"currently it only supports -vga std\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -356,7 +356,7 @@ static target_ulong h_set_dabr(PowerPCCPU *cpu, sPAPREnvironment *spapr,
|
|||||||
|
|
||||||
static target_ulong register_vpa(CPUPPCState *env, target_ulong vpa)
|
static target_ulong register_vpa(CPUPPCState *env, target_ulong vpa)
|
||||||
{
|
{
|
||||||
CPUState *cs = ENV_GET_CPU(env);
|
CPUState *cs = CPU(ppc_env_get_cpu(env));
|
||||||
uint16_t size;
|
uint16_t size;
|
||||||
uint8_t tmp;
|
uint8_t tmp;
|
||||||
|
|
||||||
@@ -406,7 +406,7 @@ static target_ulong deregister_vpa(CPUPPCState *env, target_ulong vpa)
|
|||||||
|
|
||||||
static target_ulong register_slb_shadow(CPUPPCState *env, target_ulong addr)
|
static target_ulong register_slb_shadow(CPUPPCState *env, target_ulong addr)
|
||||||
{
|
{
|
||||||
CPUState *cs = ENV_GET_CPU(env);
|
CPUState *cs = CPU(ppc_env_get_cpu(env));
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
|
||||||
if (addr == 0) {
|
if (addr == 0) {
|
||||||
@@ -442,7 +442,7 @@ static target_ulong deregister_slb_shadow(CPUPPCState *env, target_ulong addr)
|
|||||||
|
|
||||||
static target_ulong register_dtl(CPUPPCState *env, target_ulong addr)
|
static target_ulong register_dtl(CPUPPCState *env, target_ulong addr)
|
||||||
{
|
{
|
||||||
CPUState *cs = ENV_GET_CPU(env);
|
CPUState *cs = CPU(ppc_env_get_cpu(env));
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
|
||||||
if (addr == 0) {
|
if (addr == 0) {
|
||||||
@@ -529,7 +529,7 @@ static target_ulong h_cede(PowerPCCPU *cpu, sPAPREnvironment *spapr,
|
|||||||
hreg_compute_hflags(env);
|
hreg_compute_hflags(env);
|
||||||
if (!cpu_has_work(cs)) {
|
if (!cpu_has_work(cs)) {
|
||||||
cs->halted = 1;
|
cs->halted = 1;
|
||||||
env->exception_index = EXCP_HLT;
|
cs->exception_index = EXCP_HLT;
|
||||||
cs->exit_request = 1;
|
cs->exit_request = 1;
|
||||||
}
|
}
|
||||||
return H_SUCCESS;
|
return H_SUCCESS;
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
#include <libfdt.h>
|
#include <libfdt.h>
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
#include "qemu/error-report.h"
|
||||||
|
|
||||||
#include "hw/pci/pci_bus.h"
|
#include "hw/pci/pci_bus.h"
|
||||||
|
|
||||||
@@ -292,7 +293,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,
|
|||||||
ret_intr_type = RTAS_TYPE_MSIX;
|
ret_intr_type = RTAS_TYPE_MSIX;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "rtas_ibm_change_msi(%u) is not implemented\n", func);
|
error_report("rtas_ibm_change_msi(%u) is not implemented", func);
|
||||||
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
|
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -326,7 +327,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,
|
|||||||
/* Find a device number in the map to add or reuse the existing one */
|
/* Find a device number in the map to add or reuse the existing one */
|
||||||
ndev = spapr_msicfg_find(phb, config_addr, true);
|
ndev = spapr_msicfg_find(phb, config_addr, true);
|
||||||
if (ndev >= SPAPR_MSIX_MAX_DEVS || ndev < 0) {
|
if (ndev >= SPAPR_MSIX_MAX_DEVS || ndev < 0) {
|
||||||
fprintf(stderr, "No free entry for a new MSI device\n");
|
error_report("No free entry for a new MSI device");
|
||||||
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
|
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -335,7 +336,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,
|
|||||||
/* Check if there is an old config and MSI number has not changed */
|
/* Check if there is an old config and MSI number has not changed */
|
||||||
if (phb->msi_table[ndev].nvec && (req_num != phb->msi_table[ndev].nvec)) {
|
if (phb->msi_table[ndev].nvec && (req_num != phb->msi_table[ndev].nvec)) {
|
||||||
/* Unexpected behaviour */
|
/* Unexpected behaviour */
|
||||||
fprintf(stderr, "Cannot reuse MSI config for device#%d", ndev);
|
error_report("Cannot reuse MSI config for device#%d", ndev);
|
||||||
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
|
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -345,7 +346,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,
|
|||||||
irq = spapr_allocate_irq_block(req_num, false,
|
irq = spapr_allocate_irq_block(req_num, false,
|
||||||
ret_intr_type == RTAS_TYPE_MSI);
|
ret_intr_type == RTAS_TYPE_MSI);
|
||||||
if (irq < 0) {
|
if (irq < 0) {
|
||||||
fprintf(stderr, "Cannot allocate MSIs for device#%d", ndev);
|
error_report("Cannot allocate MSIs for device#%d", ndev);
|
||||||
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
|
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -505,12 +506,11 @@ static AddressSpace *spapr_pci_dma_iommu(PCIBus *bus, void *opaque, int devfn)
|
|||||||
return &phb->iommu_as;
|
return &phb->iommu_as;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spapr_phb_init(SysBusDevice *s)
|
static void spapr_phb_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(s);
|
SysBusDevice *s = SYS_BUS_DEVICE(dev);
|
||||||
sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s);
|
sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s);
|
||||||
PCIHostState *phb = PCI_HOST_BRIDGE(s);
|
PCIHostState *phb = PCI_HOST_BRIDGE(s);
|
||||||
const char *busname;
|
|
||||||
char *namebuf;
|
char *namebuf;
|
||||||
int i;
|
int i;
|
||||||
PCIBus *bus;
|
PCIBus *bus;
|
||||||
@@ -521,9 +521,9 @@ static int spapr_phb_init(SysBusDevice *s)
|
|||||||
if ((sphb->buid != -1) || (sphb->dma_liobn != -1)
|
if ((sphb->buid != -1) || (sphb->dma_liobn != -1)
|
||||||
|| (sphb->mem_win_addr != -1)
|
|| (sphb->mem_win_addr != -1)
|
||||||
|| (sphb->io_win_addr != -1)) {
|
|| (sphb->io_win_addr != -1)) {
|
||||||
fprintf(stderr, "Either \"index\" or other parameters must"
|
error_setg(errp, "Either \"index\" or other parameters must"
|
||||||
" be specified for PAPR PHB, not both\n");
|
" be specified for PAPR PHB, not both");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sphb->buid = SPAPR_PCI_BASE_BUID + sphb->index;
|
sphb->buid = SPAPR_PCI_BASE_BUID + sphb->index;
|
||||||
@@ -536,28 +536,28 @@ static int spapr_phb_init(SysBusDevice *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sphb->buid == -1) {
|
if (sphb->buid == -1) {
|
||||||
fprintf(stderr, "BUID not specified for PHB\n");
|
error_setg(errp, "BUID not specified for PHB");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sphb->dma_liobn == -1) {
|
if (sphb->dma_liobn == -1) {
|
||||||
fprintf(stderr, "LIOBN not specified for PHB\n");
|
error_setg(errp, "LIOBN not specified for PHB");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sphb->mem_win_addr == -1) {
|
if (sphb->mem_win_addr == -1) {
|
||||||
fprintf(stderr, "Memory window address not specified for PHB\n");
|
error_setg(errp, "Memory window address not specified for PHB");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sphb->io_win_addr == -1) {
|
if (sphb->io_win_addr == -1) {
|
||||||
fprintf(stderr, "IO window address not specified for PHB\n");
|
error_setg(errp, "IO window address not specified for PHB");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (find_phb(spapr, sphb->buid)) {
|
if (find_phb(spapr, sphb->buid)) {
|
||||||
fprintf(stderr, "PCI host bridges must have unique BUIDs\n");
|
error_setg(errp, "PCI host bridges must have unique BUIDs");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sphb->dtbusname = g_strdup_printf("pci@%" PRIx64, sphb->buid);
|
sphb->dtbusname = g_strdup_printf("pci@%" PRIx64, sphb->buid);
|
||||||
@@ -594,26 +594,8 @@ static int spapr_phb_init(SysBusDevice *s)
|
|||||||
get_system_io(), 0, SPAPR_PCI_IO_WIN_SIZE);
|
get_system_io(), 0, SPAPR_PCI_IO_WIN_SIZE);
|
||||||
memory_region_add_subregion(get_system_memory(), sphb->io_win_addr,
|
memory_region_add_subregion(get_system_memory(), sphb->io_win_addr,
|
||||||
&sphb->iowindow);
|
&sphb->iowindow);
|
||||||
/*
|
|
||||||
* Selecting a busname is more complex than you'd think, due to
|
bus = pci_register_bus(dev, NULL,
|
||||||
* interacting constraints. If the user has specified an id
|
|
||||||
* explicitly for the phb , then we want to use the qdev default
|
|
||||||
* of naming the bus based on the bridge device (so the user can
|
|
||||||
* then assign devices to it in the way they expect). For the
|
|
||||||
* first / default PCI bus (index=0) we want to use just "pci"
|
|
||||||
* because libvirt expects there to be a bus called, simply,
|
|
||||||
* "pci". Otherwise, we use the same name as in the device tree,
|
|
||||||
* since it's unique by construction, and makes the guest visible
|
|
||||||
* BUID clear.
|
|
||||||
*/
|
|
||||||
if (dev->id) {
|
|
||||||
busname = NULL;
|
|
||||||
} else if (sphb->index == 0) {
|
|
||||||
busname = "pci";
|
|
||||||
} else {
|
|
||||||
busname = sphb->dtbusname;
|
|
||||||
}
|
|
||||||
bus = pci_register_bus(dev, busname,
|
|
||||||
pci_spapr_set_irq, pci_spapr_map_irq, sphb,
|
pci_spapr_set_irq, pci_spapr_map_irq, sphb,
|
||||||
&sphb->memspace, &sphb->iospace,
|
&sphb->memspace, &sphb->iospace,
|
||||||
PCI_DEVFN(0, 0), PCI_NUM_PINS, TYPE_PCI_BUS);
|
PCI_DEVFN(0, 0), PCI_NUM_PINS, TYPE_PCI_BUS);
|
||||||
@@ -624,8 +606,9 @@ static int spapr_phb_init(SysBusDevice *s)
|
|||||||
sphb->tcet = spapr_tce_new_table(dev, sphb->dma_liobn,
|
sphb->tcet = spapr_tce_new_table(dev, sphb->dma_liobn,
|
||||||
sphb->dma_window_size);
|
sphb->dma_window_size);
|
||||||
if (!sphb->tcet) {
|
if (!sphb->tcet) {
|
||||||
fprintf(stderr, "Unable to create TCE table for %s\n", sphb->dtbusname);
|
error_setg(errp, "Unable to create TCE table for %s",
|
||||||
return -1;
|
sphb->dtbusname);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
address_space_init(&sphb->iommu_as, spapr_tce_get_iommu(sphb->tcet),
|
address_space_init(&sphb->iommu_as, spapr_tce_get_iommu(sphb->tcet),
|
||||||
sphb->dtbusname);
|
sphb->dtbusname);
|
||||||
@@ -642,13 +625,12 @@ static int spapr_phb_init(SysBusDevice *s)
|
|||||||
|
|
||||||
irq = spapr_allocate_lsi(0);
|
irq = spapr_allocate_lsi(0);
|
||||||
if (!irq) {
|
if (!irq) {
|
||||||
return -1;
|
error_setg(errp, "spapr_allocate_lsi failed");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sphb->lsi_table[i].irq = irq;
|
sphb->lsi_table[i].irq = irq;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spapr_phb_reset(DeviceState *qdev)
|
static void spapr_phb_reset(DeviceState *qdev)
|
||||||
@@ -731,11 +713,10 @@ static const char *spapr_phb_root_bus_path(PCIHostState *host_bridge,
|
|||||||
static void spapr_phb_class_init(ObjectClass *klass, void *data)
|
static void spapr_phb_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass);
|
PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass);
|
||||||
SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
|
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
hc->root_bus_path = spapr_phb_root_bus_path;
|
hc->root_bus_path = spapr_phb_root_bus_path;
|
||||||
sdc->init = spapr_phb_init;
|
dc->realize = spapr_phb_realize;
|
||||||
dc->props = spapr_phb_properties;
|
dc->props = spapr_phb_properties;
|
||||||
dc->reset = spapr_phb_reset;
|
dc->reset = spapr_phb_reset;
|
||||||
dc->vmsd = &vmstate_spapr_pci;
|
dc->vmsd = &vmstate_spapr_pci;
|
||||||
|
@@ -135,25 +135,23 @@ static unsigned s390_running_cpus;
|
|||||||
void s390_add_running_cpu(S390CPU *cpu)
|
void s390_add_running_cpu(S390CPU *cpu)
|
||||||
{
|
{
|
||||||
CPUState *cs = CPU(cpu);
|
CPUState *cs = CPU(cpu);
|
||||||
CPUS390XState *env = &cpu->env;
|
|
||||||
|
|
||||||
if (cs->halted) {
|
if (cs->halted) {
|
||||||
s390_running_cpus++;
|
s390_running_cpus++;
|
||||||
cs->halted = 0;
|
cs->halted = 0;
|
||||||
env->exception_index = -1;
|
cs->exception_index = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned s390_del_running_cpu(S390CPU *cpu)
|
unsigned s390_del_running_cpu(S390CPU *cpu)
|
||||||
{
|
{
|
||||||
CPUState *cs = CPU(cpu);
|
CPUState *cs = CPU(cpu);
|
||||||
CPUS390XState *env = &cpu->env;
|
|
||||||
|
|
||||||
if (cs->halted == 0) {
|
if (cs->halted == 0) {
|
||||||
assert(s390_running_cpus >= 1);
|
assert(s390_running_cpus >= 1);
|
||||||
s390_running_cpus--;
|
s390_running_cpus--;
|
||||||
cs->halted = 1;
|
cs->halted = 1;
|
||||||
env->exception_index = EXCP_HLT;
|
cs->exception_index = EXCP_HLT;
|
||||||
}
|
}
|
||||||
return s390_running_cpus;
|
return s390_running_cpus;
|
||||||
}
|
}
|
||||||
@@ -196,7 +194,7 @@ void s390_init_cpus(const char *cpu_model, uint8_t *storage_keys)
|
|||||||
|
|
||||||
ipi_states[i] = cpu;
|
ipi_states[i] = cpu;
|
||||||
cs->halted = 1;
|
cs->halted = 1;
|
||||||
cpu->env.exception_index = EXCP_HLT;
|
cs->exception_index = EXCP_HLT;
|
||||||
cpu->env.storage_keys = storage_keys;
|
cpu->env.storage_keys = storage_keys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1905,6 +1905,26 @@ static const VMStateInfo vmstate_info_scsi_requests = {
|
|||||||
.put = put_scsi_requests,
|
.put = put_scsi_requests,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool scsi_sense_state_needed(void *opaque)
|
||||||
|
{
|
||||||
|
SCSIDevice *s = opaque;
|
||||||
|
|
||||||
|
return s->sense_len > SCSI_SENSE_BUF_SIZE_OLD;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const VMStateDescription vmstate_scsi_sense_state = {
|
||||||
|
.name = "SCSIDevice/sense",
|
||||||
|
.version_id = 1,
|
||||||
|
.minimum_version_id = 1,
|
||||||
|
.minimum_version_id_old = 1,
|
||||||
|
.fields = (VMStateField []) {
|
||||||
|
VMSTATE_UINT8_SUB_ARRAY(sense, SCSIDevice,
|
||||||
|
SCSI_SENSE_BUF_SIZE_OLD,
|
||||||
|
SCSI_SENSE_BUF_SIZE - SCSI_SENSE_BUF_SIZE_OLD),
|
||||||
|
VMSTATE_END_OF_LIST()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const VMStateDescription vmstate_scsi_device = {
|
const VMStateDescription vmstate_scsi_device = {
|
||||||
.name = "SCSIDevice",
|
.name = "SCSIDevice",
|
||||||
.version_id = 1,
|
.version_id = 1,
|
||||||
@@ -1915,7 +1935,7 @@ const VMStateDescription vmstate_scsi_device = {
|
|||||||
VMSTATE_UINT8(unit_attention.asc, SCSIDevice),
|
VMSTATE_UINT8(unit_attention.asc, SCSIDevice),
|
||||||
VMSTATE_UINT8(unit_attention.ascq, SCSIDevice),
|
VMSTATE_UINT8(unit_attention.ascq, SCSIDevice),
|
||||||
VMSTATE_BOOL(sense_is_ua, SCSIDevice),
|
VMSTATE_BOOL(sense_is_ua, SCSIDevice),
|
||||||
VMSTATE_UINT8_ARRAY(sense, SCSIDevice, SCSI_SENSE_BUF_SIZE),
|
VMSTATE_UINT8_SUB_ARRAY(sense, SCSIDevice, 0, SCSI_SENSE_BUF_SIZE_OLD),
|
||||||
VMSTATE_UINT32(sense_len, SCSIDevice),
|
VMSTATE_UINT32(sense_len, SCSIDevice),
|
||||||
{
|
{
|
||||||
.name = "requests",
|
.name = "requests",
|
||||||
@@ -1927,6 +1947,14 @@ const VMStateDescription vmstate_scsi_device = {
|
|||||||
.offset = 0,
|
.offset = 0,
|
||||||
},
|
},
|
||||||
VMSTATE_END_OF_LIST()
|
VMSTATE_END_OF_LIST()
|
||||||
|
},
|
||||||
|
.subsections = (VMStateSubsection []) {
|
||||||
|
{
|
||||||
|
.vmsd = &vmstate_scsi_sense_state,
|
||||||
|
.needed = scsi_sense_state_needed,
|
||||||
|
}, {
|
||||||
|
/* empty */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -195,9 +195,9 @@ static int vscsi_send_iu(VSCSIState *s, vscsi_req *req,
|
|||||||
req->crq.s.IU_data_ptr = req->iu.srp.rsp.tag; /* right byte order */
|
req->crq.s.IU_data_ptr = req->iu.srp.rsp.tag; /* right byte order */
|
||||||
|
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
req->crq.s.status = 0x99; /* Just needs to be non-zero */
|
req->crq.s.status = VIOSRP_OK;
|
||||||
} else {
|
} else {
|
||||||
req->crq.s.status = 0x00;
|
req->crq.s.status = VIOSRP_ADAPTER_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc1 = spapr_vio_send_crq(&s->vdev, req->crq.raw);
|
rc1 = spapr_vio_send_crq(&s->vdev, req->crq.raw);
|
||||||
|
@@ -304,6 +304,8 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
|
|||||||
size_t resid)
|
size_t resid)
|
||||||
{
|
{
|
||||||
VirtIOSCSIReq *req = r->hba_private;
|
VirtIOSCSIReq *req = r->hba_private;
|
||||||
|
VirtIOSCSI *s = req->dev;
|
||||||
|
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
|
||||||
uint32_t sense_len;
|
uint32_t sense_len;
|
||||||
|
|
||||||
if (r->io_canceled) {
|
if (r->io_canceled) {
|
||||||
@@ -317,7 +319,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
|
|||||||
} else {
|
} else {
|
||||||
req->resp.cmd->resid = 0;
|
req->resp.cmd->resid = 0;
|
||||||
sense_len = scsi_req_get_sense(r, req->resp.cmd->sense,
|
sense_len = scsi_req_get_sense(r, req->resp.cmd->sense,
|
||||||
VIRTIO_SCSI_SENSE_SIZE);
|
vs->sense_size);
|
||||||
req->resp.cmd->sense_len = tswap32(sense_len);
|
req->resp.cmd->sense_len = tswap32(sense_len);
|
||||||
}
|
}
|
||||||
virtio_scsi_complete_req(req);
|
virtio_scsi_complete_req(req);
|
||||||
|
@@ -238,9 +238,10 @@ static int ssi_sd_load(QEMUFile *f, void *opaque, int version_id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ssi_sd_init(SSISlave *dev)
|
static int ssi_sd_init(SSISlave *d)
|
||||||
{
|
{
|
||||||
ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, dev);
|
DeviceState *dev = DEVICE(d);
|
||||||
|
ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, d);
|
||||||
DriveInfo *dinfo;
|
DriveInfo *dinfo;
|
||||||
|
|
||||||
s->mode = SSI_SD_CMD;
|
s->mode = SSI_SD_CMD;
|
||||||
@@ -249,7 +250,7 @@ static int ssi_sd_init(SSISlave *dev)
|
|||||||
if (s->sd == NULL) {
|
if (s->sd == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
register_savevm(&dev->qdev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
|
register_savevm(dev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -416,7 +416,7 @@ static void sh7750_mem_writel(void *opaque, hwaddr addr,
|
|||||||
case SH7750_PTEH_A7:
|
case SH7750_PTEH_A7:
|
||||||
/* If asid changes, clear all registered tlb entries. */
|
/* If asid changes, clear all registered tlb entries. */
|
||||||
if ((s->cpu->env.pteh & 0xff) != (mem_value & 0xff)) {
|
if ((s->cpu->env.pteh & 0xff) != (mem_value & 0xff)) {
|
||||||
tlb_flush(&s->cpu->env, 1);
|
tlb_flush(CPU(s->cpu), 1);
|
||||||
}
|
}
|
||||||
s->cpu->env.pteh = mem_value;
|
s->cpu->env.pteh = mem_value;
|
||||||
return;
|
return;
|
||||||
|
11
hw/ssi/ssi.c
11
hw/ssi/ssi.c
@@ -15,7 +15,7 @@
|
|||||||
#include "hw/ssi.h"
|
#include "hw/ssi.h"
|
||||||
|
|
||||||
struct SSIBus {
|
struct SSIBus {
|
||||||
BusState qbus;
|
BusState parent_obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TYPE_SSI_BUS "SSI"
|
#define TYPE_SSI_BUS "SSI"
|
||||||
@@ -60,7 +60,7 @@ static int ssi_slave_init(DeviceState *dev)
|
|||||||
|
|
||||||
if (ssc->transfer_raw == ssi_transfer_raw_default &&
|
if (ssc->transfer_raw == ssi_transfer_raw_default &&
|
||||||
ssc->cs_polarity != SSI_CS_NONE) {
|
ssc->cs_polarity != SSI_CS_NONE) {
|
||||||
qdev_init_gpio_in(&s->qdev, ssi_cs_default, 1);
|
qdev_init_gpio_in(dev, ssi_cs_default, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ssc->init(s);
|
return ssc->init(s);
|
||||||
@@ -88,7 +88,7 @@ static const TypeInfo ssi_slave_info = {
|
|||||||
|
|
||||||
DeviceState *ssi_create_slave_no_init(SSIBus *bus, const char *name)
|
DeviceState *ssi_create_slave_no_init(SSIBus *bus, const char *name)
|
||||||
{
|
{
|
||||||
return qdev_create(&bus->qbus, name);
|
return qdev_create(BUS(bus), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceState *ssi_create_slave(SSIBus *bus, const char *name)
|
DeviceState *ssi_create_slave(SSIBus *bus, const char *name)
|
||||||
@@ -108,11 +108,12 @@ SSIBus *ssi_create_bus(DeviceState *parent, const char *name)
|
|||||||
|
|
||||||
uint32_t ssi_transfer(SSIBus *bus, uint32_t val)
|
uint32_t ssi_transfer(SSIBus *bus, uint32_t val)
|
||||||
{
|
{
|
||||||
|
BusState *b = BUS(bus);
|
||||||
BusChild *kid;
|
BusChild *kid;
|
||||||
SSISlaveClass *ssc;
|
SSISlaveClass *ssc;
|
||||||
uint32_t r = 0;
|
uint32_t r = 0;
|
||||||
|
|
||||||
QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) {
|
QTAILQ_FOREACH(kid, &b->children, sibling) {
|
||||||
SSISlave *slave = SSI_SLAVE(kid->child);
|
SSISlave *slave = SSI_SLAVE(kid->child);
|
||||||
ssc = SSI_SLAVE_GET_CLASS(slave);
|
ssc = SSI_SLAVE_GET_CLASS(slave);
|
||||||
r |= ssc->transfer_raw(slave, val);
|
r |= ssc->transfer_raw(slave, val);
|
||||||
@@ -156,7 +157,7 @@ static int ssi_auto_connect_slave(Object *child, void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cs_line = qdev_get_gpio_in(DEVICE(dev), 0);
|
cs_line = qdev_get_gpio_in(DEVICE(dev), 0);
|
||||||
qdev_set_parent_bus(DEVICE(dev), &arg->bus->qbus);
|
qdev_set_parent_bus(DEVICE(dev), BUS(arg->bus));
|
||||||
**arg->cs_linep = cs_line;
|
**arg->cs_linep = cs_line;
|
||||||
(*arg->cs_linep)++;
|
(*arg->cs_linep)++;
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
/* config register */
|
/* config register */
|
||||||
#define R_CONFIG (0x00 / 4)
|
#define R_CONFIG (0x00 / 4)
|
||||||
#define IFMODE (1 << 31)
|
#define IFMODE (1U << 31)
|
||||||
#define ENDIAN (1 << 26)
|
#define ENDIAN (1 << 26)
|
||||||
#define MODEFAIL_GEN_EN (1 << 17)
|
#define MODEFAIL_GEN_EN (1 << 17)
|
||||||
#define MAN_START_COM (1 << 16)
|
#define MAN_START_COM (1 << 16)
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
|
|
||||||
#define R_LQSPI_CFG (0xa0 / 4)
|
#define R_LQSPI_CFG (0xa0 / 4)
|
||||||
#define R_LQSPI_CFG_RESET 0x03A002EB
|
#define R_LQSPI_CFG_RESET 0x03A002EB
|
||||||
#define LQSPI_CFG_LQ_MODE (1 << 31)
|
#define LQSPI_CFG_LQ_MODE (1U << 31)
|
||||||
#define LQSPI_CFG_TWO_MEM (1 << 30)
|
#define LQSPI_CFG_TWO_MEM (1 << 30)
|
||||||
#define LQSPI_CFG_SEP_BUS (1 << 30)
|
#define LQSPI_CFG_SEP_BUS (1 << 30)
|
||||||
#define LQSPI_CFG_U_PAGE (1 << 28)
|
#define LQSPI_CFG_U_PAGE (1 << 28)
|
||||||
|
@@ -106,9 +106,9 @@ static void grlib_gptimer_enable(GPTimer *timer)
|
|||||||
/* ptimer is triggered when the counter reach 0 but GPTimer is triggered at
|
/* ptimer is triggered when the counter reach 0 but GPTimer is triggered at
|
||||||
underflow. Set count + 1 to simulate the GPTimer behavior. */
|
underflow. Set count + 1 to simulate the GPTimer behavior. */
|
||||||
|
|
||||||
trace_grlib_gptimer_enable(timer->id, timer->counter + 1);
|
trace_grlib_gptimer_enable(timer->id, timer->counter);
|
||||||
|
|
||||||
ptimer_set_count(timer->ptimer, timer->counter + 1);
|
ptimer_set_count(timer->ptimer, (uint64_t)timer->counter + 1);
|
||||||
ptimer_run(timer->ptimer, 1);
|
ptimer_run(timer->ptimer, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -546,10 +546,10 @@ static int emulated_initfn(CCIDCardState *base)
|
|||||||
printf("%s: failed to initialize vcard\n", EMULATED_DEV_NAME);
|
printf("%s: failed to initialize vcard\n", EMULATED_DEV_NAME);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
qemu_thread_create(&card->event_thread_id, event_thread, card,
|
qemu_thread_create(&card->event_thread_id, "ccid/event", event_thread,
|
||||||
QEMU_THREAD_JOINABLE);
|
card, QEMU_THREAD_JOINABLE);
|
||||||
qemu_thread_create(&card->apdu_thread_id, handle_apdu_thread, card,
|
qemu_thread_create(&card->apdu_thread_id, "ccid/apdu", handle_apdu_thread,
|
||||||
QEMU_THREAD_JOINABLE);
|
card, QEMU_THREAD_JOINABLE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "qemu/event_notifier.h"
|
#include "qemu/event_notifier.h"
|
||||||
#include "qemu/thread.h"
|
#include "qemu/thread.h"
|
||||||
|
#include "qemu/rfifolock.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
|
|
||||||
typedef struct BlockDriverAIOCB BlockDriverAIOCB;
|
typedef struct BlockDriverAIOCB BlockDriverAIOCB;
|
||||||
@@ -47,6 +48,9 @@ typedef void IOHandler(void *opaque);
|
|||||||
struct AioContext {
|
struct AioContext {
|
||||||
GSource source;
|
GSource source;
|
||||||
|
|
||||||
|
/* Protects all fields from multi-threaded access */
|
||||||
|
RFifoLock lock;
|
||||||
|
|
||||||
/* The list of registered AIO handlers */
|
/* The list of registered AIO handlers */
|
||||||
QLIST_HEAD(, AioHandler) aio_handlers;
|
QLIST_HEAD(, AioHandler) aio_handlers;
|
||||||
|
|
||||||
@@ -104,6 +108,20 @@ void aio_context_ref(AioContext *ctx);
|
|||||||
*/
|
*/
|
||||||
void aio_context_unref(AioContext *ctx);
|
void aio_context_unref(AioContext *ctx);
|
||||||
|
|
||||||
|
/* Take ownership of the AioContext. If the AioContext will be shared between
|
||||||
|
* threads, a thread must have ownership when calling aio_poll().
|
||||||
|
*
|
||||||
|
* Note that multiple threads calling aio_poll() means timers, BHs, and
|
||||||
|
* callbacks may be invoked from a different thread than they were registered
|
||||||
|
* from. Therefore, code must use AioContext acquire/release or use
|
||||||
|
* fine-grained synchronization to protect shared state if other threads will
|
||||||
|
* be accessing it simultaneously.
|
||||||
|
*/
|
||||||
|
void aio_context_acquire(AioContext *ctx);
|
||||||
|
|
||||||
|
/* Relinquish ownership of the AioContext. */
|
||||||
|
void aio_context_release(AioContext *ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* aio_bh_new: Allocate a new bottom half structure.
|
* aio_bh_new: Allocate a new bottom half structure.
|
||||||
*
|
*
|
||||||
|
@@ -286,15 +286,6 @@ int bdrv_check(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix);
|
|||||||
int bdrv_amend_options(BlockDriverState *bs_new, QEMUOptionParameter *options);
|
int bdrv_amend_options(BlockDriverState *bs_new, QEMUOptionParameter *options);
|
||||||
|
|
||||||
/* external snapshots */
|
/* external snapshots */
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
BS_IS_A_FILTER,
|
|
||||||
BS_FILTER_PASS_DOWN,
|
|
||||||
BS_AUTHORIZATION_COUNT,
|
|
||||||
} BsAuthorization;
|
|
||||||
|
|
||||||
bool bdrv_generic_is_first_non_filter(BlockDriverState *bs,
|
|
||||||
BlockDriverState *candidate);
|
|
||||||
bool bdrv_recurse_is_first_non_filter(BlockDriverState *bs,
|
bool bdrv_recurse_is_first_non_filter(BlockDriverState *bs,
|
||||||
BlockDriverState *candidate);
|
BlockDriverState *candidate);
|
||||||
bool bdrv_is_first_non_filter(BlockDriverState *candidate);
|
bool bdrv_is_first_non_filter(BlockDriverState *candidate);
|
||||||
|
@@ -76,10 +76,10 @@ struct BlockDriver {
|
|||||||
const char *format_name;
|
const char *format_name;
|
||||||
int instance_size;
|
int instance_size;
|
||||||
|
|
||||||
/* this table of boolean contains authorizations for the block operations */
|
/* set to true if the BlockDriver is a block filter */
|
||||||
bool authorizations[BS_AUTHORIZATION_COUNT];
|
bool is_filter;
|
||||||
/* for snapshots complex block filter like Quorum can implement the
|
/* for snapshots block filter like Quorum can implement the
|
||||||
* following recursive callback instead of BS_IS_A_FILTER.
|
* following recursive callback.
|
||||||
* It's purpose is to recurse on the filter children while calling
|
* It's purpose is to recurse on the filter children while calling
|
||||||
* bdrv_recurse_is_first_non_filter on them.
|
* bdrv_recurse_is_first_non_filter on them.
|
||||||
* For a sample implementation look in the future Quorum block filter.
|
* For a sample implementation look in the future Quorum block filter.
|
||||||
|
@@ -360,9 +360,6 @@ int page_check_range(target_ulong start, target_ulong len, int flags);
|
|||||||
|
|
||||||
CPUArchState *cpu_copy(CPUArchState *env);
|
CPUArchState *cpu_copy(CPUArchState *env);
|
||||||
|
|
||||||
void QEMU_NORETURN cpu_abort(CPUArchState *env, const char *fmt, ...)
|
|
||||||
GCC_FMT_ATTR(2, 3);
|
|
||||||
|
|
||||||
/* Flags for use in ENV->INTERRUPT_PENDING.
|
/* Flags for use in ENV->INTERRUPT_PENDING.
|
||||||
|
|
||||||
The numbers assigned here are non-sequential in order to preserve
|
The numbers assigned here are non-sequential in order to preserve
|
||||||
@@ -413,27 +410,6 @@ void QEMU_NORETURN cpu_abort(CPUArchState *env, const char *fmt, ...)
|
|||||||
| CPU_INTERRUPT_TGT_EXT_3 \
|
| CPU_INTERRUPT_TGT_EXT_3 \
|
||||||
| CPU_INTERRUPT_TGT_EXT_4)
|
| CPU_INTERRUPT_TGT_EXT_4)
|
||||||
|
|
||||||
/* Breakpoint/watchpoint flags */
|
|
||||||
#define BP_MEM_READ 0x01
|
|
||||||
#define BP_MEM_WRITE 0x02
|
|
||||||
#define BP_MEM_ACCESS (BP_MEM_READ | BP_MEM_WRITE)
|
|
||||||
#define BP_STOP_BEFORE_ACCESS 0x04
|
|
||||||
#define BP_WATCHPOINT_HIT 0x08
|
|
||||||
#define BP_GDB 0x10
|
|
||||||
#define BP_CPU 0x20
|
|
||||||
|
|
||||||
int cpu_breakpoint_insert(CPUArchState *env, target_ulong pc, int flags,
|
|
||||||
CPUBreakpoint **breakpoint);
|
|
||||||
int cpu_breakpoint_remove(CPUArchState *env, target_ulong pc, int flags);
|
|
||||||
void cpu_breakpoint_remove_by_ref(CPUArchState *env, CPUBreakpoint *breakpoint);
|
|
||||||
void cpu_breakpoint_remove_all(CPUArchState *env, int mask);
|
|
||||||
int cpu_watchpoint_insert(CPUArchState *env, target_ulong addr, target_ulong len,
|
|
||||||
int flags, CPUWatchpoint **watchpoint);
|
|
||||||
int cpu_watchpoint_remove(CPUArchState *env, target_ulong addr,
|
|
||||||
target_ulong len, int flags);
|
|
||||||
void cpu_watchpoint_remove_by_ref(CPUArchState *env, CPUWatchpoint *watchpoint);
|
|
||||||
void cpu_watchpoint_remove_all(CPUArchState *env, int mask);
|
|
||||||
|
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
|
|
||||||
/* memory API */
|
/* memory API */
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <setjmp.h>
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
@@ -59,9 +58,7 @@ typedef uint64_t target_ulong;
|
|||||||
#define EXCP_HLT 0x10001 /* hlt instruction reached */
|
#define EXCP_HLT 0x10001 /* hlt instruction reached */
|
||||||
#define EXCP_DEBUG 0x10002 /* cpu stopped after a breakpoint or singlestep */
|
#define EXCP_DEBUG 0x10002 /* cpu stopped after a breakpoint or singlestep */
|
||||||
#define EXCP_HALTED 0x10003 /* cpu is halted (waiting for external event) */
|
#define EXCP_HALTED 0x10003 /* cpu is halted (waiting for external event) */
|
||||||
|
#define EXCP_YIELD 0x10004 /* cpu wants to yield timeslice to another */
|
||||||
#define TB_JMP_CACHE_BITS 12
|
|
||||||
#define TB_JMP_CACHE_SIZE (1 << TB_JMP_CACHE_BITS)
|
|
||||||
|
|
||||||
/* Only the bottom TB_JMP_PAGE_BITS of the jump cache hash bits vary for
|
/* Only the bottom TB_JMP_PAGE_BITS of the jump cache hash bits vary for
|
||||||
addresses on the same page. The top bits are the same. This allows
|
addresses on the same page. The top bits are the same. This allows
|
||||||
@@ -117,66 +114,9 @@ QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS));
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HOST_WORDS_BIGENDIAN
|
|
||||||
typedef struct icount_decr_u16 {
|
|
||||||
uint16_t high;
|
|
||||||
uint16_t low;
|
|
||||||
} icount_decr_u16;
|
|
||||||
#else
|
|
||||||
typedef struct icount_decr_u16 {
|
|
||||||
uint16_t low;
|
|
||||||
uint16_t high;
|
|
||||||
} icount_decr_u16;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct CPUBreakpoint {
|
|
||||||
target_ulong pc;
|
|
||||||
int flags; /* BP_* */
|
|
||||||
QTAILQ_ENTRY(CPUBreakpoint) entry;
|
|
||||||
} CPUBreakpoint;
|
|
||||||
|
|
||||||
typedef struct CPUWatchpoint {
|
|
||||||
target_ulong vaddr;
|
|
||||||
target_ulong len_mask;
|
|
||||||
int flags; /* BP_* */
|
|
||||||
QTAILQ_ENTRY(CPUWatchpoint) entry;
|
|
||||||
} CPUWatchpoint;
|
|
||||||
|
|
||||||
#define CPU_TEMP_BUF_NLONGS 128
|
#define CPU_TEMP_BUF_NLONGS 128
|
||||||
#define CPU_COMMON \
|
#define CPU_COMMON \
|
||||||
/* soft mmu support */ \
|
/* soft mmu support */ \
|
||||||
/* in order to avoid passing too many arguments to the MMIO \
|
|
||||||
helpers, we store some rarely used information in the CPU \
|
|
||||||
context) */ \
|
|
||||||
uintptr_t mem_io_pc; /* host pc at which the memory was \
|
|
||||||
accessed */ \
|
|
||||||
target_ulong mem_io_vaddr; /* target virtual addr at which the \
|
|
||||||
memory was accessed */ \
|
|
||||||
CPU_COMMON_TLB \
|
CPU_COMMON_TLB \
|
||||||
struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; \
|
|
||||||
\
|
|
||||||
int64_t icount_extra; /* Instructions until next timer event. */ \
|
|
||||||
/* Number of cycles left, with interrupt flag in high bit. \
|
|
||||||
This allows a single read-compare-cbranch-write sequence to test \
|
|
||||||
for both decrementer underflow and exceptions. */ \
|
|
||||||
union { \
|
|
||||||
uint32_t u32; \
|
|
||||||
icount_decr_u16 u16; \
|
|
||||||
} icount_decr; \
|
|
||||||
uint32_t can_do_io; /* nonzero if memory mapped IO is safe. */ \
|
|
||||||
\
|
|
||||||
/* from this point: preserved by CPU reset */ \
|
|
||||||
/* ice debug support */ \
|
|
||||||
QTAILQ_HEAD(breakpoints_head, CPUBreakpoint) breakpoints; \
|
|
||||||
\
|
|
||||||
QTAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints; \
|
|
||||||
CPUWatchpoint *watchpoint_hit; \
|
|
||||||
\
|
|
||||||
/* Core interrupt code */ \
|
|
||||||
sigjmp_buf jmp_env; \
|
|
||||||
int exception_index; \
|
|
||||||
\
|
|
||||||
/* user data */ \
|
|
||||||
void *opaque; \
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
/* cputlb.c */
|
/* cputlb.c */
|
||||||
void tlb_protect_code(ram_addr_t ram_addr);
|
void tlb_protect_code(ram_addr_t ram_addr);
|
||||||
void tlb_unprotect_code_phys(CPUArchState *env, ram_addr_t ram_addr,
|
void tlb_unprotect_code_phys(CPUState *cpu, ram_addr_t ram_addr,
|
||||||
target_ulong vaddr);
|
target_ulong vaddr);
|
||||||
void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start,
|
void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start,
|
||||||
uintptr_t length);
|
uintptr_t length);
|
||||||
@@ -31,12 +31,12 @@ void tlb_set_dirty(CPUArchState *env, target_ulong vaddr);
|
|||||||
extern int tlb_flush_count;
|
extern int tlb_flush_count;
|
||||||
|
|
||||||
/* exec.c */
|
/* exec.c */
|
||||||
void tb_flush_jmp_cache(CPUArchState *env, target_ulong addr);
|
void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr);
|
||||||
|
|
||||||
MemoryRegionSection *
|
MemoryRegionSection *
|
||||||
address_space_translate_for_iotlb(AddressSpace *as, hwaddr addr, hwaddr *xlat,
|
address_space_translate_for_iotlb(AddressSpace *as, hwaddr addr, hwaddr *xlat,
|
||||||
hwaddr *plen);
|
hwaddr *plen);
|
||||||
hwaddr memory_region_section_get_iotlb(CPUArchState *env,
|
hwaddr memory_region_section_get_iotlb(CPUState *cpu,
|
||||||
MemoryRegionSection *section,
|
MemoryRegionSection *section,
|
||||||
target_ulong vaddr,
|
target_ulong vaddr,
|
||||||
hwaddr paddr, hwaddr xlat,
|
hwaddr paddr, hwaddr xlat,
|
||||||
|
@@ -80,16 +80,16 @@ void restore_state_to_opc(CPUArchState *env, struct TranslationBlock *tb,
|
|||||||
void cpu_gen_init(void);
|
void cpu_gen_init(void);
|
||||||
int cpu_gen_code(CPUArchState *env, struct TranslationBlock *tb,
|
int cpu_gen_code(CPUArchState *env, struct TranslationBlock *tb,
|
||||||
int *gen_code_size_ptr);
|
int *gen_code_size_ptr);
|
||||||
bool cpu_restore_state(CPUArchState *env, uintptr_t searched_pc);
|
bool cpu_restore_state(CPUState *cpu, uintptr_t searched_pc);
|
||||||
void page_size_init(void);
|
void page_size_init(void);
|
||||||
|
|
||||||
void QEMU_NORETURN cpu_resume_from_signal(CPUArchState *env1, void *puc);
|
void QEMU_NORETURN cpu_resume_from_signal(CPUState *cpu, void *puc);
|
||||||
void QEMU_NORETURN cpu_io_recompile(CPUArchState *env, uintptr_t retaddr);
|
void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
|
||||||
TranslationBlock *tb_gen_code(CPUArchState *env,
|
TranslationBlock *tb_gen_code(CPUState *cpu,
|
||||||
target_ulong pc, target_ulong cs_base, int flags,
|
target_ulong pc, target_ulong cs_base, int flags,
|
||||||
int cflags);
|
int cflags);
|
||||||
void cpu_exec_init(CPUArchState *env);
|
void cpu_exec_init(CPUArchState *env);
|
||||||
void QEMU_NORETURN cpu_loop_exit(CPUArchState *env1);
|
void QEMU_NORETURN cpu_loop_exit(CPUState *cpu);
|
||||||
int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
|
int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
|
||||||
void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
|
void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
|
||||||
int is_cpu_write_access);
|
int is_cpu_write_access);
|
||||||
@@ -98,18 +98,18 @@ void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end,
|
|||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as);
|
void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as);
|
||||||
/* cputlb.c */
|
/* cputlb.c */
|
||||||
void tlb_flush_page(CPUArchState *env, target_ulong addr);
|
void tlb_flush_page(CPUState *cpu, target_ulong addr);
|
||||||
void tlb_flush(CPUArchState *env, int flush_global);
|
void tlb_flush(CPUState *cpu, int flush_global);
|
||||||
void tlb_set_page(CPUArchState *env, target_ulong vaddr,
|
void tlb_set_page(CPUState *cpu, target_ulong vaddr,
|
||||||
hwaddr paddr, int prot,
|
hwaddr paddr, int prot,
|
||||||
int mmu_idx, target_ulong size);
|
int mmu_idx, target_ulong size);
|
||||||
void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
|
void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
|
||||||
#else
|
#else
|
||||||
static inline void tlb_flush_page(CPUArchState *env, target_ulong addr)
|
static inline void tlb_flush_page(CPUState *cpu, target_ulong addr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void tlb_flush(CPUArchState *env, int flush_global)
|
static inline void tlb_flush(CPUState *cpu, int flush_global)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -332,7 +332,7 @@ bool io_mem_read(struct MemoryRegion *mr, hwaddr addr,
|
|||||||
bool io_mem_write(struct MemoryRegion *mr, hwaddr addr,
|
bool io_mem_write(struct MemoryRegion *mr, hwaddr addr,
|
||||||
uint64_t value, unsigned size);
|
uint64_t value, unsigned size);
|
||||||
|
|
||||||
void tlb_fill(CPUArchState *env1, target_ulong addr, int is_write, int mmu_idx,
|
void tlb_fill(CPUState *cpu, target_ulong addr, int is_write, int mmu_idx,
|
||||||
uintptr_t retaddr);
|
uintptr_t retaddr);
|
||||||
|
|
||||||
uint8_t helper_ldb_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx);
|
uint8_t helper_ldb_cmmu(CPUArchState *env, target_ulong addr, int mmu_idx);
|
||||||
@@ -380,20 +380,25 @@ extern int singlestep;
|
|||||||
/* cpu-exec.c */
|
/* cpu-exec.c */
|
||||||
extern volatile sig_atomic_t exit_request;
|
extern volatile sig_atomic_t exit_request;
|
||||||
|
|
||||||
/* Deterministic execution requires that IO only be performed on the last
|
/**
|
||||||
instruction of a TB so that interrupts take effect immediately. */
|
* cpu_can_do_io:
|
||||||
static inline int can_do_io(CPUArchState *env)
|
* @cpu: The CPU for which to check IO.
|
||||||
|
*
|
||||||
|
* Deterministic execution requires that IO only be performed on the last
|
||||||
|
* instruction of a TB so that interrupts take effect immediately.
|
||||||
|
*
|
||||||
|
* Returns: %true if memory-mapped IO is safe, %false otherwise.
|
||||||
|
*/
|
||||||
|
static inline bool cpu_can_do_io(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
|
||||||
|
|
||||||
if (!use_icount) {
|
if (!use_icount) {
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
/* If not executing code then assume we are ok. */
|
/* If not executing code then assume we are ok. */
|
||||||
if (cpu->current_tb == NULL) {
|
if (cpu->current_tb == NULL) {
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
return env->can_do_io != 0;
|
return cpu->can_do_io != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -26,13 +26,15 @@ static inline void gen_tb_start(void)
|
|||||||
|
|
||||||
icount_label = gen_new_label();
|
icount_label = gen_new_label();
|
||||||
count = tcg_temp_local_new_i32();
|
count = tcg_temp_local_new_i32();
|
||||||
tcg_gen_ld_i32(count, cpu_env, offsetof(CPUArchState, icount_decr.u32));
|
tcg_gen_ld_i32(count, cpu_env,
|
||||||
|
-ENV_OFFSET + offsetof(CPUState, icount_decr.u32));
|
||||||
/* This is a horrid hack to allow fixing up the value later. */
|
/* This is a horrid hack to allow fixing up the value later. */
|
||||||
icount_arg = tcg_ctx.gen_opparam_ptr + 1;
|
icount_arg = tcg_ctx.gen_opparam_ptr + 1;
|
||||||
tcg_gen_subi_i32(count, count, 0xdeadbeef);
|
tcg_gen_subi_i32(count, count, 0xdeadbeef);
|
||||||
|
|
||||||
tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, icount_label);
|
tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, icount_label);
|
||||||
tcg_gen_st16_i32(count, cpu_env, offsetof(CPUArchState, icount_decr.u16.low));
|
tcg_gen_st16_i32(count, cpu_env,
|
||||||
|
-ENV_OFFSET + offsetof(CPUState, icount_decr.u16.low));
|
||||||
tcg_temp_free_i32(count);
|
tcg_temp_free_i32(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,14 +53,14 @@ static void gen_tb_end(TranslationBlock *tb, int num_insns)
|
|||||||
static inline void gen_io_start(void)
|
static inline void gen_io_start(void)
|
||||||
{
|
{
|
||||||
TCGv_i32 tmp = tcg_const_i32(1);
|
TCGv_i32 tmp = tcg_const_i32(1);
|
||||||
tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUArchState, can_do_io));
|
tcg_gen_st_i32(tmp, cpu_env, -ENV_OFFSET + offsetof(CPUState, can_do_io));
|
||||||
tcg_temp_free_i32(tmp);
|
tcg_temp_free_i32(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void gen_io_end(void)
|
static inline void gen_io_end(void)
|
||||||
{
|
{
|
||||||
TCGv_i32 tmp = tcg_const_i32(0);
|
TCGv_i32 tmp = tcg_const_i32(0);
|
||||||
tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUArchState, can_do_io));
|
tcg_gen_st_i32(tmp, cpu_env, -ENV_OFFSET + offsetof(CPUState, can_do_io));
|
||||||
tcg_temp_free_i32(tmp);
|
tcg_temp_free_i32(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -836,13 +836,13 @@ void memory_region_set_alias_offset(MemoryRegion *mr,
|
|||||||
hwaddr offset);
|
hwaddr offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* memory_region_present: translate an address/size relative to a
|
* memory_region_present: checks if an address relative to a @parent
|
||||||
* MemoryRegion into a #MemoryRegionSection.
|
* translates into #MemoryRegion within @parent
|
||||||
*
|
*
|
||||||
* Answer whether a #MemoryRegion within @parent covers the address
|
* Answer whether a #MemoryRegion within @parent covers the address
|
||||||
* @addr.
|
* @addr.
|
||||||
*
|
*
|
||||||
* @parent: a MemoryRegion within which @addr is a relative address
|
* @parent: a #MemoryRegion within which @addr is a relative address
|
||||||
* @addr: the area within @parent to be searched
|
* @addr: the area within @parent to be searched
|
||||||
*/
|
*/
|
||||||
bool memory_region_present(MemoryRegion *parent, hwaddr addr);
|
bool memory_region_present(MemoryRegion *parent, hwaddr addr);
|
||||||
|
@@ -126,12 +126,12 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env,
|
|||||||
MemoryRegion *mr = iotlb_to_region(cpu->as, physaddr);
|
MemoryRegion *mr = iotlb_to_region(cpu->as, physaddr);
|
||||||
|
|
||||||
physaddr = (physaddr & TARGET_PAGE_MASK) + addr;
|
physaddr = (physaddr & TARGET_PAGE_MASK) + addr;
|
||||||
env->mem_io_pc = retaddr;
|
cpu->mem_io_pc = retaddr;
|
||||||
if (mr != &io_mem_rom && mr != &io_mem_notdirty && !can_do_io(env)) {
|
if (mr != &io_mem_rom && mr != &io_mem_notdirty && !cpu_can_do_io(cpu)) {
|
||||||
cpu_io_recompile(env, retaddr);
|
cpu_io_recompile(cpu, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
env->mem_io_vaddr = addr;
|
cpu->mem_io_vaddr = addr;
|
||||||
io_mem_read(mr, physaddr, &val, 1 << SHIFT);
|
io_mem_read(mr, physaddr, &val, 1 << SHIFT);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@@ -158,7 +158,7 @@ WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||||||
do_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
do_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tlb_fill(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
tlb_fill(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
||||||
tlb_addr = env->tlb_table[mmu_idx][index].ADDR_READ;
|
tlb_addr = env->tlb_table[mmu_idx][index].ADDR_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ WORD_TYPE helper_be_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||||||
do_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
do_unaligned_access(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tlb_fill(env, addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
tlb_fill(ENV_GET_CPU(env), addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
|
||||||
tlb_addr = env->tlb_table[mmu_idx][index].ADDR_READ;
|
tlb_addr = env->tlb_table[mmu_idx][index].ADDR_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,12 +333,12 @@ static inline void glue(io_write, SUFFIX)(CPUArchState *env,
|
|||||||
MemoryRegion *mr = iotlb_to_region(cpu->as, physaddr);
|
MemoryRegion *mr = iotlb_to_region(cpu->as, physaddr);
|
||||||
|
|
||||||
physaddr = (physaddr & TARGET_PAGE_MASK) + addr;
|
physaddr = (physaddr & TARGET_PAGE_MASK) + addr;
|
||||||
if (mr != &io_mem_rom && mr != &io_mem_notdirty && !can_do_io(env)) {
|
if (mr != &io_mem_rom && mr != &io_mem_notdirty && !cpu_can_do_io(cpu)) {
|
||||||
cpu_io_recompile(env, retaddr);
|
cpu_io_recompile(cpu, retaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
env->mem_io_vaddr = addr;
|
cpu->mem_io_vaddr = addr;
|
||||||
env->mem_io_pc = retaddr;
|
cpu->mem_io_pc = retaddr;
|
||||||
io_mem_write(mr, physaddr, val, 1 << SHIFT);
|
io_mem_write(mr, physaddr, val, 1 << SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||||||
do_unaligned_access(env, addr, 1, mmu_idx, retaddr);
|
do_unaligned_access(env, addr, 1, mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tlb_fill(env, addr, 1, mmu_idx, retaddr);
|
tlb_fill(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
||||||
tlb_addr = env->tlb_table[mmu_idx][index].addr_write;
|
tlb_addr = env->tlb_table[mmu_idx][index].addr_write;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +436,7 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||||||
do_unaligned_access(env, addr, 1, mmu_idx, retaddr);
|
do_unaligned_access(env, addr, 1, mmu_idx, retaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tlb_fill(env, addr, 1, mmu_idx, retaddr);
|
tlb_fill(ENV_GET_CPU(env), addr, 1, mmu_idx, retaddr);
|
||||||
tlb_addr = env->tlb_table[mmu_idx][index].addr_write;
|
tlb_addr = env->tlb_table[mmu_idx][index].addr_write;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,8 +4,8 @@
|
|||||||
#define HW_BOARDS_H
|
#define HW_BOARDS_H
|
||||||
|
|
||||||
#include "sysemu/blockdev.h"
|
#include "sysemu/blockdev.h"
|
||||||
#include "sysemu/qemumachine.h"
|
|
||||||
#include "hw/qdev.h"
|
#include "hw/qdev.h"
|
||||||
|
#include "qom/object.h"
|
||||||
|
|
||||||
typedef struct QEMUMachineInitArgs {
|
typedef struct QEMUMachineInitArgs {
|
||||||
const QEMUMachine *machine;
|
const QEMUMachine *machine;
|
||||||
@@ -50,9 +50,59 @@ struct QEMUMachine {
|
|||||||
const char *hw_version;
|
const char *hw_version;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define TYPE_MACHINE_SUFFIX "-machine"
|
||||||
int qemu_register_machine(QEMUMachine *m);
|
int qemu_register_machine(QEMUMachine *m);
|
||||||
QEMUMachine *find_default_machine(void);
|
|
||||||
|
|
||||||
extern QEMUMachine *current_machine;
|
#define TYPE_MACHINE "machine"
|
||||||
|
#define MACHINE(obj) \
|
||||||
|
OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
|
||||||
|
#define MACHINE_GET_CLASS(obj) \
|
||||||
|
OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
|
||||||
|
#define MACHINE_CLASS(klass) \
|
||||||
|
OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
|
||||||
|
|
||||||
|
typedef struct MachineState MachineState;
|
||||||
|
typedef struct MachineClass MachineClass;
|
||||||
|
|
||||||
|
MachineClass *find_default_machine(void);
|
||||||
|
extern MachineState *current_machine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MachineClass:
|
||||||
|
* @qemu_machine: #QEMUMachine
|
||||||
|
*/
|
||||||
|
struct MachineClass {
|
||||||
|
/*< private >*/
|
||||||
|
ObjectClass parent_class;
|
||||||
|
/*< public >*/
|
||||||
|
|
||||||
|
QEMUMachine *qemu_machine;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MachineState:
|
||||||
|
*/
|
||||||
|
struct MachineState {
|
||||||
|
/*< private >*/
|
||||||
|
Object parent_obj;
|
||||||
|
/*< public >*/
|
||||||
|
|
||||||
|
char *accel;
|
||||||
|
bool kernel_irqchip;
|
||||||
|
int kvm_shadow_mem;
|
||||||
|
char *kernel;
|
||||||
|
char *initrd;
|
||||||
|
char *append;
|
||||||
|
char *dtb;
|
||||||
|
char *dumpdtb;
|
||||||
|
int phandle_start;
|
||||||
|
char *dt_compatible;
|
||||||
|
bool dump_guest_core;
|
||||||
|
bool mem_merge;
|
||||||
|
bool usb;
|
||||||
|
char *firmware;
|
||||||
|
|
||||||
|
QEMUMachineInitArgs init_args;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -102,7 +102,7 @@ Object *ich9_lpc_find(void);
|
|||||||
#define ICH9_USB_UHCI1_DEV 29
|
#define ICH9_USB_UHCI1_DEV 29
|
||||||
#define ICH9_USB_UHCI1_FUNC 0
|
#define ICH9_USB_UHCI1_FUNC 0
|
||||||
|
|
||||||
/* D30:F0 DMI-to-PCI brdige */
|
/* D30:F0 DMI-to-PCI bridge */
|
||||||
#define ICH9_D2P_BRIDGE "ICH9 D2P BRIDGE"
|
#define ICH9_D2P_BRIDGE "ICH9 D2P BRIDGE"
|
||||||
#define ICH9_D2P_BRIDGE_SAVEVM_VERSION 0
|
#define ICH9_D2P_BRIDGE_SAVEVM_VERSION 0
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user