Re: [Qemu-devel] Make thread pool implementation modular
Am 02.11.2013 00:34, schrieb Matthias Brugger: This patch series makes the thread pool implementation modular. This allows each drive to use a special implementation. The patch series prepares qemu to be able to include thread pools different the one actually implemented. It will allow to implement approaches like paravirtualized block requests [1]. Please use scripts/checkpatch.pl to check any patch before sending it to the list. There are currently errors and warnings for patch 1 and patch 3 which should be fixed. In patch 3 you can also fix defintion in the patch description. Regards, Stefan
Re: [Qemu-devel] [RFC PATCH] spapr: add ibmveth to the supported network adapters list
Il 01/11/2013 11:52, Alexey Kardashevskiy ha scritto: On 10/28/2013 05:03 AM, Alexander Graf wrote: On 10.10.2013, at 20:09, Alexey Kardashevskiy a...@ozlabs.ru wrote: The problem is that -net nic,model=? does not print ibmveth in the list while it is actually supported. Most of the QEMU emulated network devices are PCI but ibmveth (a.k.a. spapr-vlan) is not. However with -net nic,model=?, QEMU prints only PCI devices in the list, even if it does not say that the list is all about PCI devices. This adds ?/help handling in spapr.c and adds ibmveth in the beginning of the list. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- This is an RFC patch. The other solutions could be: 1. add ibmveth into pci_nic_models[] in hw/pci/pci.c but this would not be correct as ibmveth is not PCI and it must appear only on pseries machine. 2. implemement short version of qdev_print_category_devices() and call it with DEVICE_CATEGORY_NETWORK but that would print more devices than pci_nic_init_nofail() can handle (vmxnet3, usb-bt-dongle). 3. fix qemu_check_nic_model() to specifically say that this is a list of PCI devices and there might be some other devices which -net nic,model+ supports but there are not PCI but that could break compatibility (some management software may rely on this exact string). 4. Reject the patch and just say that people must stop using -net. Ok for me :) Since -net is kind of obsolete interface and does not seem to be extended ever, the proposed patch does not look too ugly, does not it? --- hw/ppc/spapr.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c0613e4..45ed3da 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1276,6 +1276,21 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) if (strcmp(nd-model, ibmveth) == 0) { spapr_vlan_create(spapr-vio_bus, nd); +} else if (is_help_option(nd-model)) { +static const char * const nic_models[] = { +ibmveth, +ne2k_pci, +i82551, +i82557b, +i82559er, +rtl8139, +e1000, +pcnet, +virtio, +NULL +}; I don't like the idea of duplicating that list. Neither do I :) But the list itself already looks quite ugly. Basically the list of supported -net models is incorrect today even on x86 where you can say -net nic,model=ne2k_isa. It really is only a list of PCI devices. I can think of a number of convoluted ways to fix this up, but I think that ignoring fully accuracy of the output of -net model=? is the most straight forward thing to do. Does any of your convoluted ways include adding a new category (DEVICE_CATEGORY_NETWORK_LEGACY?) into enum DeviceCategory, adding devices from the list above and fixing qemu_show_nic_models() to show what is in the category? Why do you even need a new category? Just take everything in the network category and put it in the help. Paolo
Re: [Qemu-devel] [RFC PATCH] spapr: add ibmveth to the supported network adapters list
Alexander Graf ag...@suse.de writes: Am 01.11.2013 um 03:52 schrieb Alexey Kardashevskiy a...@ozlabs.ru: [...] Or -net interface is deprecated and we do not want even touch it? I don't think we should deprecate it. It's easier to use than anything else. Ahci adoption heavily suffered from not being enabled in -drive - I don't want that again here. How exactly is -net nic,netdev=NET-ID,macaddr=MACADDR,model=MODEL,... easier to use than -device DEVNAME,netdev=NET-ID,macaddr=MACADDR,... ? Especially now that -device help shows valid DEVNAMEs under the heading Network devices.
Re: [Qemu-devel] [RFC PATCH] spapr: add ibmveth to the supported network adapters list
Paolo Bonzini pbonz...@redhat.com writes: Il 01/11/2013 11:52, Alexey Kardashevskiy ha scritto: On 10/28/2013 05:03 AM, Alexander Graf wrote: On 10.10.2013, at 20:09, Alexey Kardashevskiy a...@ozlabs.ru wrote: The problem is that -net nic,model=? does not print ibmveth in the list while it is actually supported. Most of the QEMU emulated network devices are PCI but ibmveth (a.k.a. spapr-vlan) is not. However with -net nic,model=?, QEMU prints only PCI devices in the list, even if it does not say that the list is all about PCI devices. This adds ?/help handling in spapr.c and adds ibmveth in the beginning of the list. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- This is an RFC patch. The other solutions could be: 1. add ibmveth into pci_nic_models[] in hw/pci/pci.c but this would not be correct as ibmveth is not PCI and it must appear only on pseries machine. 2. implemement short version of qdev_print_category_devices() and call it with DEVICE_CATEGORY_NETWORK but that would print more devices than pci_nic_init_nofail() can handle (vmxnet3, usb-bt-dongle). 3. fix qemu_check_nic_model() to specifically say that this is a list of PCI devices and there might be some other devices which -net nic,model+ supports but there are not PCI but that could break compatibility (some management software may rely on this exact string). 4. Reject the patch and just say that people must stop using -net. Ok for me :) Since -net is kind of obsolete interface and does not seem to be extended ever, the proposed patch does not look too ugly, does not it? --- hw/ppc/spapr.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c0613e4..45ed3da 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1276,6 +1276,21 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) if (strcmp(nd-model, ibmveth) == 0) { spapr_vlan_create(spapr-vio_bus, nd); +} else if (is_help_option(nd-model)) { +static const char * const nic_models[] = { +ibmveth, +ne2k_pci, +i82551, +i82557b, +i82559er, +rtl8139, +e1000, +pcnet, +virtio, +NULL +}; I don't like the idea of duplicating that list. Neither do I :) But the list itself already looks quite ugly. Basically the list of supported -net models is incorrect today even on x86 where you can say -net nic,model=ne2k_isa. It really is only a list of PCI devices. I can think of a number of convoluted ways to fix this up, but I think that ignoring fully accuracy of the output of -net model=? is the most straight forward thing to do. Does any of your convoluted ways include adding a new category (DEVICE_CATEGORY_NETWORK_LEGACY?) into enum DeviceCategory, adding devices from the list above and fixing qemu_show_nic_models() to show what is in the category? Why do you even need a new category? Just take everything in the network category and put it in the help. You *can't* currently construct -net nic,model=help output from registered qdev NICs, because: * -net nic generally doesn't accept all qdev NICs, and * the model names accepted by -net nic need *not* match the qdev device model names (example: virtio != virtio-net), and * -net nic may accept model names that map to a non-qdevified NIC (not sure such NICs still exist). How model names map to device models is entirely up to board code. Boards supporting PCI use the common helper pci_nic_init_nofail() for PCI models. Due to the way pci_nic_init_nofail() captures model=help, the help output lists *only* the models supported via pci_nic_init_nofail(), not the others. That's simply a bug. My advice would be to let -net nic rot in peace.
[Qemu-devel] using qemu binary translation to run I386 code under x86_64
Hi all, I am new to the list and to qemu development in general, so my question might be discussed already (though I failed to find an answer in archives, thus writing here). I want to use qemu to execute x86 32-bit binary code inside of x86_64 process under OS X. In future, I would like to be able to execute the same code on other architectures (not x86). Background: I have a library written in 32-bit intel assembly which does not use any system calls (just computations). Eventhough sources are available, there is no plans to rewrite it into C, because code is very ancient, parts are received from reverse-engineering/disasming (and thus are unmaintainable) etc. Up until recently, I was using helper 32-bit executable, interfacing with it through stdandart input/output from 64-bit process. It is no longer an option unfortunately. Is it possible to: 1. set up memory of target CPU (load the binary, write in function arguments) 2. using qemu, call the function from the library 3. read memory of target CPU (get data, returned by the function). Thing is that I don't need full system emulation (hardware, bios, etc) - that would be an overkill. qemu usermode looks very promising in that regard, but it seems support for darwin was removed... So, I wonder whether things I am asking are already possible and how much efford it might require? Thanks in advance for all your help! Lex
Re: [Qemu-devel] [RFC PATCH] spapr: add ibmveth to the supported network adapters list
On 11/02/2013 09:56 PM, Paolo Bonzini wrote: Il 01/11/2013 11:52, Alexey Kardashevskiy ha scritto: On 10/28/2013 05:03 AM, Alexander Graf wrote: On 10.10.2013, at 20:09, Alexey Kardashevskiy a...@ozlabs.ru wrote: The problem is that -net nic,model=? does not print ibmveth in the list while it is actually supported. Most of the QEMU emulated network devices are PCI but ibmveth (a.k.a. spapr-vlan) is not. However with -net nic,model=?, QEMU prints only PCI devices in the list, even if it does not say that the list is all about PCI devices. This adds ?/help handling in spapr.c and adds ibmveth in the beginning of the list. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- This is an RFC patch. The other solutions could be: 1. add ibmveth into pci_nic_models[] in hw/pci/pci.c but this would not be correct as ibmveth is not PCI and it must appear only on pseries machine. 2. implemement short version of qdev_print_category_devices() and call it with DEVICE_CATEGORY_NETWORK but that would print more devices than pci_nic_init_nofail() can handle (vmxnet3, usb-bt-dongle). 3. fix qemu_check_nic_model() to specifically say that this is a list of PCI devices and there might be some other devices which -net nic,model+ supports but there are not PCI but that could break compatibility (some management software may rely on this exact string). 4. Reject the patch and just say that people must stop using -net. Ok for me :) Since -net is kind of obsolete interface and does not seem to be extended ever, the proposed patch does not look too ugly, does not it? --- hw/ppc/spapr.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c0613e4..45ed3da 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1276,6 +1276,21 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) if (strcmp(nd-model, ibmveth) == 0) { spapr_vlan_create(spapr-vio_bus, nd); +} else if (is_help_option(nd-model)) { +static const char * const nic_models[] = { +ibmveth, +ne2k_pci, +i82551, +i82557b, +i82559er, +rtl8139, +e1000, +pcnet, +virtio, +NULL +}; I don't like the idea of duplicating that list. Neither do I :) But the list itself already looks quite ugly. Basically the list of supported -net models is incorrect today even on x86 where you can say -net nic,model=ne2k_isa. It really is only a list of PCI devices. I can think of a number of convoluted ways to fix this up, but I think that ignoring fully accuracy of the output of -net model=? is the most straight forward thing to do. Does any of your convoluted ways include adding a new category (DEVICE_CATEGORY_NETWORK_LEGACY?) into enum DeviceCategory, adding devices from the list above and fixing qemu_show_nic_models() to show what is in the category? Why do you even need a new category? Just take everything in the network category and put it in the help. Because at the moment spapr creates PCI NICs (i.e. what pci_nic_init_nofail can create) and ibmveth with -net interface and does not support bluetooth-network and n2k-isa. -- Alexey
Re: [Qemu-devel] [PATCH V4 1/6] snapshot: add parameter *errp in snapshot create
On 14.10.2013 23:52, Wenchao Xia wrote: The return value is only used for error report before this patch, so change the function protype to return void. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qcow2-snapshot.c| 27 +++ block/qcow2.h |4 +++- block/rbd.c | 21 - block/sheepdog.c | 29 - block/snapshot.c | 19 +-- blockdev.c| 10 -- include/block/block_int.h |5 +++-- include/block/snapshot.h |5 +++-- qemu-img.c| 10 ++ savevm.c | 12 10 files changed, 95 insertions(+), 47 deletions(-) diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 3529c68..b373f9a 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -347,7 +347,9 @@ static int find_snapshot_by_id_or_name(BlockDriverState *bs, } /* if no id is provided, a new one is constructed */ -int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) +void qcow2_snapshot_create(BlockDriverState *bs, + QEMUSnapshotInfo *sn_info, + Error **errp) { BDRVQcowState *s = bs-opaque; QCowSnapshot *new_snapshot_list = NULL; @@ -366,7 +368,8 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) /* Check that the ID is unique */ if (find_snapshot_by_id_and_name(bs, sn_info-id_str, NULL) = 0) { -return -EEXIST; +error_setg(errp, Snapshot with id %s already exist, sn_info-id_str); +return; } /* Populate sn with passed data */ @@ -383,6 +386,9 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) l1_table_offset = qcow2_alloc_clusters(bs, s-l1_size * sizeof(uint64_t)); if (l1_table_offset 0) { ret = l1_table_offset; +error_setg(errp, + Failed in allocation of snapshot L1 table: %d (%s), + ret, strerror(-ret)); You may want to use error_setg_errno instead (here and in many other places in this patch). goto fail; } @@ -397,12 +403,20 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) ret = qcow2_pre_write_overlap_check(bs, 0, sn-l1_table_offset, s-l1_size * sizeof(uint64_t)); if (ret 0) { +error_setg(errp, Failed in overlap check for snapshot L1 table at % + PRIu64 with size % PRIu64 : %d (%s), + sn-l1_table_offset, s-l1_size * sizeof(uint64_t), + ret, strerror(-ret)); s-l1_size * sizeof(uint64_t) is of the same type as uint64_t (PRIu64) only on 64 bit systems. On 32 bit systems, it probably is the same as uint32_t (because of a different size_t width). goto fail; } ret = bdrv_pwrite(bs-file, sn-l1_table_offset, l1_table, s-l1_size * sizeof(uint64_t)); if (ret 0) { +error_setg(errp, Failed in update of snapshot L1 table at % + PRIu64 with size % PRIu64 : %d (%s), + sn-l1_table_offset, s-l1_size * sizeof(uint64_t), + ret, strerror(-ret)); Same here. goto fail; } @@ -416,6 +430,9 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) */ ret = qcow2_update_snapshot_refcount(bs, s-l1_table_offset, s-l1_size, 1); if (ret 0) { +error_setg(errp, Failed in update of refcount for snapshot at % + PRIu64 with size %d: %d (%s), + s-l1_table_offset, s-l1_size, ret, strerror(-ret)); goto fail; } @@ -431,6 +448,8 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) ret = qcow2_write_snapshots(bs); if (ret 0) { +/* Following line will be replaced with more detailed error later */ +error_setg(errp, Failed in write of snapshot); g_free(s-snapshots); s-snapshots = old_snapshot_list; s-nb_snapshots--; @@ -452,14 +471,14 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) qcow2_check_refcounts(bs, result, 0); } #endif -return 0; +return; fail: g_free(sn-id_str); g_free(sn-name); g_free(l1_table); -return ret; +return; } /* copy the snapshot 'snapshot_name' into the current disk image */ diff --git a/block/qcow2.h b/block/qcow2.h index 922e190..c0a3d01 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -481,7 +481,9 @@ int qcow2_zero_clusters(BlockDriverState *bs, uint64_t offset, int nb_sectors); int qcow2_expand_zero_clusters(BlockDriverState *bs); /* qcow2-snapshot.c functions */ -int
Re: [Qemu-devel] [PATCH V4 2/6] qcow2: add error message in qcow2_write_snapshots()
On 14.10.2013 23:52, Wenchao Xia wrote: The function still returns int since qcow2_snapshot_delete() will return the number. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qcow2-snapshot.c | 48 ++-- 1 files changed, 42 insertions(+), 6 deletions(-) diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index b373f9a..4bd494b 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -152,7 +152,7 @@ fail: } /* add at the end of the file a new list of snapshots */ -static int qcow2_write_snapshots(BlockDriverState *bs) +static int qcow2_write_snapshots(BlockDriverState *bs, Error **errp) { BDRVQcowState *s = bs-opaque; QCowSnapshot *sn; @@ -183,10 +183,18 @@ static int qcow2_write_snapshots(BlockDriverState *bs) offset = snapshots_offset; if (offset 0) { ret = offset; +error_setg(errp, + Failed in allocation of cluster for snapshot list: + %d (%s), + ret, strerror(-ret)); Again, error_setg_errno() is your friend. goto fail; } ret = bdrv_flush(bs); if (ret 0) { +error_setg(errp, + Failed in flush after snapshot list cluster allocation: + %d (%s), + ret, strerror(-ret)); goto fail; } @@ -194,6 +202,10 @@ static int qcow2_write_snapshots(BlockDriverState *bs) * must indeed be completely free */ ret = qcow2_pre_write_overlap_check(bs, 0, offset, snapshots_size); if (ret 0) { +error_setg(errp, + Failed in overlap check for snapshot list cluster at % + PRIi64 with size %d: %d (%s), + offset, snapshots_size, ret, strerror(-ret)); goto fail; } @@ -227,24 +239,40 @@ static int qcow2_write_snapshots(BlockDriverState *bs) ret = bdrv_pwrite(bs-file, offset, h, sizeof(h)); if (ret 0) { +error_setg(errp, + Failed in write of snapshot header at % + PRIi64 with size % PRIu64 : %d (%s), + offset, sizeof(h), ret, strerror(-ret)); Again, on 32 bit systems, sizeof(size_t) is generally 4 and not 8 (you may want to cast sizeof(h) to int and just use %d). goto fail; } offset += sizeof(h); ret = bdrv_pwrite(bs-file, offset, extra, sizeof(extra)); if (ret 0) { +error_setg(errp, + Failed in write of extra snapshot data at % + PRIi64 with size % PRIu64 : %d (%s), + offset, sizeof(extra), ret, strerror(-ret)); Same here. goto fail; } offset += sizeof(extra); ret = bdrv_pwrite(bs-file, offset, sn-id_str, id_str_size); if (ret 0) { +error_setg(errp, + Failed in write of snapshot id string at % + PRIi64 with size %d: %d (%s), + offset, id_str_size, ret, strerror(-ret)); goto fail; } offset += id_str_size; ret = bdrv_pwrite(bs-file, offset, sn-name, name_size); if (ret 0) { +error_setg(errp, + Failed in write of snapshot name string at % + PRIi64 with size %d: %d (%s), + offset, name_size, ret, strerror(-ret)); goto fail; } offset += name_size; @@ -256,6 +284,9 @@ static int qcow2_write_snapshots(BlockDriverState *bs) */ ret = bdrv_flush(bs); if (ret 0) { +error_setg(errp, + Failed in flush after snapshot list update: %d (%s), + ret, strerror(-ret)); goto fail; } @@ -268,6 +299,11 @@ static int qcow2_write_snapshots(BlockDriverState *bs) ret = bdrv_pwrite_sync(bs-file, offsetof(QCowHeader, nb_snapshots), header_data, sizeof(header_data)); if (ret 0) { +error_setg(errp, + Failed in update of image header at % + PRIi64 with size % PRIu64 :%d (%s), + offsetof(QCowHeader, nb_snapshots), sizeof(header_data), + ret, strerror(-ret)); And here (also applies to offsetof(), which returns size_t as well). Also, you forgot a space after the colon (although you should be using error_setg_errno() anyway). Max goto fail; } @@ -283,6 +319,9 @@ fail: qcow2_free_clusters(bs, snapshots_offset, snapshots_size, QCOW2_DISCARD_ALWAYS); } +if (errp) { +g_assert(error_is_set(errp)); +} return ret; } @@ -446,10 +485,8 @@ void qcow2_snapshot_create(BlockDriverState *bs,
Re: [Qemu-devel] [PATCH V4 3/6] qcow2: do not free clusters when fail in header update in qcow2_write_snapshots
On 14.10.2013 23:52, Wenchao Xia wrote: Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qcow2-snapshot.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 4bd494b..c933b7f 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -304,6 +304,13 @@ static int qcow2_write_snapshots(BlockDriverState *bs, Error **errp) PRIi64 with size % PRIu64 :%d (%s), offsetof(QCowHeader, nb_snapshots), sizeof(header_data), ret, strerror(-ret)); +/* + * If the snapshot data part have been updated on disk, Then the s/have/has/; s/Then/then/ + * clusters at snapshot_offset may be used in next snapshot operation. + * If we free those clusters in fail path, they may be allocated and + * made dirty causing damage, so skip cluster free for safe. s/for/to be/ + */ +snapshots_offset = 0; goto fail; } Other then that: Reviewed-by: Max Reitz mre...@redhat.com
Re: [Qemu-devel] [PATCH V4 4/6] qcow2: cancel the modification on fail in qcow2_snapshot_create()
On 14.10.2013 23:52, Wenchao Xia wrote: Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- Reviewed-by: Max Reitz mre...@redhat.com
Re: [Qemu-devel] [PATCH V4 5/6] blkdebug: add debug events for snapshot
On 14.10.2013 23:52, Wenchao Xia wrote: Some code in qcow2-snapshot.c directly access bs-file, so in those s/access/accesses/ points error can't be injected by other events. Since the code in Perhaps places instead of points? (And s/error/errors/) qcow2-snapshot.c is qcow2's internal detail similar as L1 table, Maybe something like qcow2-snapshot.c is similar to the other qcow2 internal code (in regards to e.g. the L1 table) would be easier to parse, although I'm not sure whether it has the same meaning you wanted to convey. so add some debug events. Maybe remove the so, because you already had a since in the previous subordinate clause? Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- Aside from that: Reviewed-by: Max Reitz mre...@redhat.com
Re: [Qemu-devel] [PATCH V4 6/6] qemu-iotests: add test for qcow2 snapshot
On 14.10.2013 23:52, Wenchao Xia wrote: This test will focus on the low level procedure of qcow2 snapshot operations, now it covers only the create operation. Overlap error paths are not checked since no good way to trigger those errors. Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- Reviewed-by: Max Reitz mre...@redhat.com
[Qemu-devel] [PATCH] qemu-iotests: Filter out actual image size in 067
The actual size of the image file may differ depending on the Linux kernel currently running on the host. Filtering out this value makes this test pass in such cases. Signed-off-by: Max Reitz mre...@redhat.com --- tests/qemu-iotests/067 | 2 +- tests/qemu-iotests/067.out | 10 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067 index 79dc38b..d025192 100755 --- a/tests/qemu-iotests/067 +++ b/tests/qemu-iotests/067 @@ -45,7 +45,7 @@ function do_run_qemu() function run_qemu() { -do_run_qemu $@ 21 | _filter_testdir | _filter_qmp +do_run_qemu $@ 21 | _filter_testdir | _filter_qmp | sed -e 's/\(actual-size:\s*\)[0-9]\+/\1SIZE/g' } size=128M diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out index 4bb9ff9..8d271cc 100644 --- a/tests/qemu-iotests/067.out +++ b/tests/qemu-iotests/067.out @@ -6,7 +6,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virtio-blk-pci,drive=disk,id=virtio0 QMP_VERSION {return: {}} -{return: [{io-status: ok, device: disk, locked: false, removable: false, inserted: {iops_rd: 0, image: {virtual-size: 134217728, filename: TEST_DIR/t.qcow2, cluster-size: 65536, format: qcow2, actual-size: 139264, format-specific: {type: qcow2, data: {compat: 1.1, lazy-refcounts: false}}, dirty-flag: false}, iops_wr: 0, ro: false, backing_file_depth: 0, drv: qcow2, iops: 0, bps_wr: 0, encrypted: false, bps: 0, bps_rd: 0, file: TEST_DIR/t.qcow2, encryption_key_missing: false}, type: unknown}, {io-status: ok, device: ide1-cd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: floppy0, locked: false, removable: true, tray_open: false, type: unknown}, {device: sd0, locked: false, removable: true, tray_open: false, type: unknown}]} +{return: [{io-status: ok, device: disk, locked: false, removable: false, inserted: {iops_rd: 0, image: {virtual-size: 134217728, filename: TEST_DIR/t.qcow2, cluster-size: 65536, format: qcow2, actual-size: SIZE, format-specific: {type: qcow2, data: {compat: 1.1, lazy-refcounts: false}}, dirty-flag: false}, iops_wr: 0, ro: false, backing_file_depth: 0, drv: qcow2, iops: 0, bps_wr: 0, encrypted: false, bps: 0, bps_rd: 0, file: TEST_DIR/t.qcow2, encryption_key_missing: false}, type: unknown}, {io-status: ok, device: ide1-cd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: floppy0, locked: false, removable: true, tray_open: false, type: unknown}, {device: sd0, locked: false, removable: true, tray_open: false, type: unknown}]} {return: {}} {return: {}} {timestamp: {seconds: TIMESTAMP, microseconds: TIMESTAMP}, event: DEVICE_DELETED, data: {path: /machine/peripheral/virtio0/virtio-backend}} @@ -24,7 +24,7 @@ QMP_VERSION Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk QMP_VERSION {return: {}} -{return: [{device: disk, locked: false, removable: true, inserted: {iops_rd: 0, image: {virtual-size: 134217728, filename: TEST_DIR/t.qcow2, cluster-size: 65536, format: qcow2, actual-size: 139264, format-specific: {type: qcow2, data: {compat: 1.1, lazy-refcounts: false}}, dirty-flag: false}, iops_wr: 0, ro: false, backing_file_depth: 0, drv: qcow2, iops: 0, bps_wr: 0, encrypted: false, bps: 0, bps_rd: 0, file: TEST_DIR/t.qcow2, encryption_key_missing: false}, tray_open: false, type: unknown}, {io-status: ok, device: ide1-cd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: floppy0, locked: false, removable: true, tray_open: false, type: unknown}, {device: sd0, locked: false, removable: true, tray_open: false, type: unknown}]} +{return: [{device: disk, locked: false, removable: true, inserted: {iops_rd: 0, image: {virtual-size: 134217728, filename: TEST_DIR/t.qcow2, cluster-size: 65536, format: qcow2, actual-size: SIZE, format-specific: {type: qcow2, data: {compat: 1.1, lazy-refcounts: false}}, dirty-flag: false}, iops_wr: 0, ro: false, backing_file_depth: 0, drv: qcow2, iops: 0, bps_wr: 0, encrypted: false, bps: 0, bps_rd: 0, file: TEST_DIR/t.qcow2, encryption_key_missing: false}, tray_open: false, type: unknown}, {io-status: ok, device: ide1-cd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: floppy0, locked: false, removable: true, tray_open: false, type: unknown}, {device: sd0, locked: false, removable: true, tray_open: false, type: unknown}]} {return: {}} {return: {}} {return: {}} @@ -44,7 +44,7 @@ Testing: QMP_VERSION {return: {}} {return: OK\r\n} -{return: [{io-status: ok, device: ide1-cd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: floppy0, locked: false, removable: true, tray_open: false, type: unknown}, {device: sd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: disk, locked: false, removable: true, inserted: {iops_rd: 0, image: {virtual-size:
Re: [Qemu-devel] [PATCH V4 3/6] qcow2: do not free clusters when fail in header update in qcow2_write_snapshots
On 02.11.2013 14:04, Max Reitz wrote: On 14.10.2013 23:52, Wenchao Xia wrote: Signed-off-by: Wenchao Xia xiaw...@linux.vnet.ibm.com --- block/qcow2-snapshot.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 4bd494b..c933b7f 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -304,6 +304,13 @@ static int qcow2_write_snapshots(BlockDriverState *bs, Error **errp) PRIi64 with size % PRIu64 :%d (%s), offsetof(QCowHeader, nb_snapshots), sizeof(header_data), ret, strerror(-ret)); +/* + * If the snapshot data part have been updated on disk, Then the s/have/has/; s/Then/then/ + * clusters at snapshot_offset may be used in next snapshot operation. + * If we free those clusters in fail path, they may be allocated and + * made dirty causing damage, so skip cluster free for safe. s/for/to be/ + */ +snapshots_offset = 0; goto fail; } Other then that: Reviewed-by: Max Reitz mre...@redhat.com *than, of course; if I am already correcting other people's orthography, I have to do the same for mine. ;-) Max
Re: [Qemu-devel] [PATCH] qemu-iotests: Filter out actual image size in 067
Le Saturday 02 Nov 2013 à 14:52:11 (+0100), Max Reitz a écrit : The actual size of the image file may differ depending on the Linux kernel currently running on the host. Filtering out this value makes this test pass in such cases. Signed-off-by: Max Reitz mre...@redhat.com --- tests/qemu-iotests/067 | 2 +- tests/qemu-iotests/067.out | 10 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067 index 79dc38b..d025192 100755 --- a/tests/qemu-iotests/067 +++ b/tests/qemu-iotests/067 @@ -45,7 +45,7 @@ function do_run_qemu() function run_qemu() { -do_run_qemu $@ 21 | _filter_testdir | _filter_qmp +do_run_qemu $@ 21 | _filter_testdir | _filter_qmp | sed -e 's/\(actual-size:\s*\)[0-9]\+/\1SIZE/g' } size=128M diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out index 4bb9ff9..8d271cc 100644 --- a/tests/qemu-iotests/067.out +++ b/tests/qemu-iotests/067.out @@ -6,7 +6,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virtio-blk-pci,drive=disk,id=virtio0 QMP_VERSION {return: {}} -{return: [{io-status: ok, device: disk, locked: false, removable: false, inserted: {iops_rd: 0, image: {virtual-size: 134217728, filename: TEST_DIR/t.qcow2, cluster-size: 65536, format: qcow2, actual-size: 139264, format-specific: {type: qcow2, data: {compat: 1.1, lazy-refcounts: false}}, dirty-flag: false}, iops_wr: 0, ro: false, backing_file_depth: 0, drv: qcow2, iops: 0, bps_wr: 0, encrypted: false, bps: 0, bps_rd: 0, file: TEST_DIR/t.qcow2, encryption_key_missing: false}, type: unknown}, {io-status: ok, device: ide1-cd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: floppy0, locked: false, removable: true, tray_open: false, type: unknown}, {device: sd0, locked: false, removable: true, tray_open: false, type: unknown}]} +{return: [{io-status: ok, device: disk, locked: false, removable: false, inserted: {iops_rd: 0, image: {virtual-size: 134217728, filename: TEST_DIR/t.qcow2, cluster-size: 65536, format: qcow2, actual-size: SIZE, format-specific: {type: qcow2, data: {compat: 1.1, lazy-refcounts: false}}, dirty-flag: false}, iops_wr: 0, ro: false, backing_file_depth: 0, drv: qcow2, iops: 0, bps_wr: 0, encrypted: false, bps: 0, bps_rd: 0, file: TEST_DIR/t.qcow2, encryption_key_missing: false}, type: unknown}, {io-status: ok, device: ide1-cd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: floppy0, locked: false, removable: true, tray_open: false, type: unknown}, {device: sd0, locked: false, removable: true, tray_open: false, type: unknown}]} {return: {}} {return: {}} {timestamp: {seconds: TIMESTAMP, microseconds: TIMESTAMP}, event: DEVICE_DELETED, data: {path: /machine/peripheral/virtio0/virtio-backend}} @@ -24,7 +24,7 @@ QMP_VERSION Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk QMP_VERSION {return: {}} -{return: [{device: disk, locked: false, removable: true, inserted: {iops_rd: 0, image: {virtual-size: 134217728, filename: TEST_DIR/t.qcow2, cluster-size: 65536, format: qcow2, actual-size: 139264, format-specific: {type: qcow2, data: {compat: 1.1, lazy-refcounts: false}}, dirty-flag: false}, iops_wr: 0, ro: false, backing_file_depth: 0, drv: qcow2, iops: 0, bps_wr: 0, encrypted: false, bps: 0, bps_rd: 0, file: TEST_DIR/t.qcow2, encryption_key_missing: false}, tray_open: false, type: unknown}, {io-status: ok, device: ide1-cd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: floppy0, locked: false, removable: true, tray_open: false, type: unknown}, {device: sd0, locked: false, removable: true, tray_open: false, type: unknown}]} +{return: [{device: disk, locked: false, removable: true, inserted: {iops_rd: 0, image: {virtual-size: 134217728, filename: TEST_DIR/t.qcow2, cluster-size: 65536, format: qcow2, actual-size: SIZE, format-specific: {type: qcow2, data: {compat: 1.1, lazy-refcounts: false}}, dirty-flag: false}, iops_wr: 0, ro: false, backing_file_depth: 0, drv: qcow2, iops: 0, bps_wr: 0, encrypted: false, bps: 0, bps_rd: 0, file: TEST_DIR/t.qcow2, encryption_key_missing: false}, tray_open: false, type: unknown}, {io-status: ok, device: ide1-cd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: floppy0, locked: false, removable: true, tray_open: false, type: unknown}, {device: sd0, locked: false, removable: true, tray_open: false, type: unknown}]} {return: {}} {return: {}} {return: {}} @@ -44,7 +44,7 @@ Testing: QMP_VERSION {return: {}} {return: OK\r\n} -{return: [{io-status: ok, device: ide1-cd0, locked: false, removable: true, tray_open: false, type: unknown}, {device: floppy0, locked: false, removable: true, tray_open: false, type: unknown},
[Qemu-devel] [PATCH for-1.7 1/3] sun4m: Add FCode ROM for TCX framebuffer
Upstream OpenBIOS now implements SBus probing in order to determine the contents of a physical bus slot, which is required to allow OpenBIOS to identify the framebuffer without help from the fw_cfg interface. SBus probing works by detecting the presence of an FCode program (effectively tokenised Forth) at the base address of each slot, and if present executes it so that it creates its own device node in the OpenBIOS device tree. The FCode ROM is generated as part of the OpenBIOS build and should generally be updated at the same time. Signed-off-by: Mark Cave-Ayland mark.cave-ayl...@ilande.co.uk CC: Blue Swirl blauwir...@gmail.com CC: Bob Breuer breu...@mc.net CC: Artyom Tarasenko atar4q...@gmail.com --- Makefile |2 +- hw/display/tcx.c | 27 ++- hw/sparc/sun4m.c | 17 ++--- pc-bios/QEMU,tcx.bin | Bin 0 - 1242 bytes pc-bios/README |4 ++-- 5 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 pc-bios/QEMU,tcx.bin diff --git a/Makefile b/Makefile index b15003f..3235039 100644 --- a/Makefile +++ b/Makefile @@ -286,7 +286,7 @@ ifdef INSTALL_BLOBS BLOBS=bios.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \ vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \ acpi-dsdt.aml q35-acpi-dsdt.aml \ -ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc \ +ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin \ pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \ pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \ efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \ diff --git a/hw/display/tcx.c b/hw/display/tcx.c index 24876d3..06bf66f 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -25,8 +25,12 @@ #include qemu-common.h #include ui/console.h #include ui/pixel_ops.h +#include hw/loader.h #include hw/sysbus.h +#define TCX_ROM_FILE QEMU,tcx.bin +#define FCODE_MAX_ROM_SIZE 0x1 + #define MAXX 1024 #define MAXY 768 #define TCX_DAC_NREGS 16 @@ -43,6 +47,8 @@ typedef struct TCXState { QemuConsole *con; uint8_t *vram; uint32_t *vram24, *cplane; +hwaddr prom_addr; +MemoryRegion rom; MemoryRegion vram_mem; MemoryRegion vram_8bit; MemoryRegion vram_24bit; @@ -529,14 +535,32 @@ static int tcx_init1(SysBusDevice *dev) { TCXState *s = TCX(dev); ram_addr_t vram_offset = 0; -int size; +int size, ret; uint8_t *vram_base; +char *fcode_filename; memory_region_init_ram(s-vram_mem, OBJECT(s), tcx.vram, s-vram_size * (1 + 4 + 4)); vmstate_register_ram_global(s-vram_mem); vram_base = memory_region_get_ram_ptr(s-vram_mem); +/* FCode ROM */ +memory_region_init_ram(s-rom, NULL, tcx.prom, FCODE_MAX_ROM_SIZE); +vmstate_register_ram_global(s-rom); +memory_region_set_readonly(s-rom, true); +sysbus_init_mmio(dev, s-rom); + +fcode_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, TCX_ROM_FILE); +if (fcode_filename) { +ret = load_image_targphys(fcode_filename, s-prom_addr, + FCODE_MAX_ROM_SIZE); +} + +if (ret 0 || ret FCODE_MAX_ROM_SIZE) { +fprintf(stderr, tcx: could not load prom '%s'\n, TCX_ROM_FILE); +return -1; +} + /* 8-bit plane */ s-vram = vram_base; size = s-vram_size; @@ -598,6 +622,7 @@ static Property tcx_properties[] = { DEFINE_PROP_UINT16(width,TCXState, width, -1), DEFINE_PROP_UINT16(height, TCXState, height,-1), DEFINE_PROP_UINT16(depth,TCXState, depth, -1), +DEFINE_PROP_HEX64(prom_addr, TCXState, prom_addr, -1), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index a0d366c..94f7950 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -537,24 +537,27 @@ static void tcx_init(hwaddr addr, int vram_size, int width, qdev_prop_set_uint16(dev, width, width); qdev_prop_set_uint16(dev, height, height); qdev_prop_set_uint16(dev, depth, depth); +qdev_prop_set_uint64(dev, prom_addr, addr); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); +/* FCode ROM */ +sysbus_mmio_map(s, 0, addr); /* 8-bit plane */ -sysbus_mmio_map(s, 0, addr + 0x0080ULL); +sysbus_mmio_map(s, 1, addr + 0x0080ULL); /* DAC */ -sysbus_mmio_map(s, 1, addr + 0x0020ULL); +sysbus_mmio_map(s, 2, addr + 0x0020ULL); /* TEC (dummy) */ -sysbus_mmio_map(s, 2, addr + 0x0070ULL); +sysbus_mmio_map(s, 3, addr + 0x0070ULL); /* THC 24 bit: NetBSD writes here even with 8-bit display: dummy */ -sysbus_mmio_map(s, 3, addr + 0x00301000ULL); +sysbus_mmio_map(s, 4, addr + 0x00301000ULL); if (depth == 24) { /* 24-bit plane */ -sysbus_mmio_map(s, 4, addr + 0x0200ULL); +sysbus_mmio_map(s, 5, addr + 0x0200ULL); /* Control plane */ -sysbus_mmio_map(s, 5, addr + 0x0a00ULL); +
[Qemu-devel] [PATCH for-1.7 3/3] sun4m: Add Sun CG3 framebuffer initialisation function
In order to allow the user to choose the framebuffer for sparc-softmmu, add -vga tcx and -vga cg3 options to the QEMU command line. If no option is specified, the default TCX framebuffer is used. Signed-off-by: Mark Cave-Ayland mark.cave-ayl...@ilande.co.uk CC: Blue Swirl blauwir...@gmail.com CC: Bob Breuer breu...@mc.net CC: Artyom Tarasenko atar4q...@gmail.com --- hw/sparc/sun4m.c| 60 +-- include/sysemu/sysemu.h |1 + vl.c| 24 +++ 3 files changed, 83 insertions(+), 2 deletions(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 94f7950..4c6c450 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -561,6 +561,31 @@ static void tcx_init(hwaddr addr, int vram_size, int width, } } +static void cg3_init(hwaddr addr, qemu_irq irq, int vram_size, int width, +int height, int depth) +{ +DeviceState *dev; +SysBusDevice *s; + +dev = qdev_create(NULL, SUNW,cgthree); +qdev_prop_set_uint32(dev, vram_size, vram_size); +qdev_prop_set_uint16(dev, width, width); +qdev_prop_set_uint16(dev, height, height); +qdev_prop_set_uint16(dev, depth, depth); +qdev_prop_set_uint64(dev, prom_addr, addr); +qdev_init_nofail(dev); +s = SYS_BUS_DEVICE(dev); + +/* FCode ROM */ +sysbus_mmio_map(s, 0, addr); +/* DAC */ +sysbus_mmio_map(s, 1, addr + 0x40ULL); +/* 8-bit plane */ +sysbus_mmio_map(s, 2, addr + 0x80ULL); + +sysbus_connect_irq(s, 0, irq); +} + /* NCR89C100/MACIO Internal ID register */ #define TYPE_MACIO_ID_REGISTER macio_idreg @@ -918,8 +943,39 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, } num_vsimms = 0; if (num_vsimms == 0) { -tcx_init(hwdef-tcx_base, 0x0010, graphic_width, graphic_height, - graphic_depth); +if (vga_interface_type == VGA_CG3) { +if (graphic_depth != 8) { +fprintf(stderr, qemu: Unsupported depth: %d\n, graphic_depth); +exit(1); +} + +if (!(graphic_width == 1024 graphic_height == 768) +!(graphic_width == 1152 graphic_height == 900)) { +fprintf(stderr, qemu: Unsupported resolution: %d x %d\n, +graphic_width, graphic_height); +exit(1); +} + +/* sbus irq 5 */ +cg3_init(hwdef-tcx_base, slavio_irq[11], 0x0010, + graphic_width, graphic_height, graphic_depth); +} else { +/* If no display specified, default to TCX */ +if (graphic_depth != 8 graphic_depth != 24) { +fprintf(stderr, qemu: Unsupported depth: %d\n, +graphic_depth); +exit(1); +} + +if (!(graphic_width == 1024 graphic_height == 768)) { +fprintf(stderr, qemu: Unsupported resolution: %d x %d\n, +graphic_width, graphic_height); +exit(1); +} + +tcx_init(hwdef-tcx_base, 0x0010, graphic_width, graphic_height, + graphic_depth); +} } for (i = num_vsimms; i MAX_VSIMMS; i++) { diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index cd5791e..2698f6d 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -104,6 +104,7 @@ extern int autostart; typedef enum { VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL, +VGA_TCX, VGA_CG3, } VGAInterfaceType; extern int vga_interface_type; diff --git a/vl.c b/vl.c index efbff65..e11f4cf 100644 --- a/vl.c +++ b/vl.c @@ -2082,6 +2082,16 @@ static bool qxl_vga_available(void) return object_class_by_name(qxl-vga); } +static bool tcx_vga_available(void) +{ +return object_class_by_name(SUNW,tcx); +} + +static bool cg3_vga_available(void) +{ +return object_class_by_name(SUNW,cgthree); +} + static void select_vgahw (const char *p) { const char *opts; @@ -2117,6 +2127,20 @@ static void select_vgahw (const char *p) fprintf(stderr, Error: QXL VGA not available\n); exit(0); } +} else if (strstart(p, tcx, opts)) { +if (tcx_vga_available()) { +vga_interface_type = VGA_TCX; +} else { +fprintf(stderr, Error: TCX framebuffer not available\n); +exit(0); +} +} else if (strstart(p, cg3, opts)) { +if (cg3_vga_available()) { +vga_interface_type = VGA_CG3; +} else { +fprintf(stderr, Error: CG3 framebuffer not available\n); +exit(0); +} } else if (!strstart(p, none, opts)) { invalid_vga: fprintf(stderr, Unknown vga type: %s\n, p); -- 1.7.10.4
[Qemu-devel] [PATCH for-1.7 0/3] sun4m: Add TCX FCode ROM and support for CG3 framebuffer
(This is a repost of the complete patchset rebased and with for-1.7 in the subject as requested by Anthony) This patchset does two things: firstly it adds an FCode ROM for the existing TCX framebuffer, and secondly provides QEMU with an implementation of the Sun CG3 8-bit framebuffer. It is based upon Bob Breuer's original work which has been rebased onto git master, and is now capable of running with the OpenBIOS CG3 FCode ROM instead of requiring copies of proprietary Sun ROMs. Note this patch has been around for a month or so but has been waiting for the updated OpenBIOS images to be included in QEMU. The reason for adding the TCX FCode ROM first is because Open Firmware such as OpenBIOS detects which framebuffer is in use by executing the FCode in the ROM to create the node in the device tree in exactly the same way as real hardware. This is in contrast to older versions of OpenBIOS where everything was hardcoded to use the TCX framebuffer. While this patch has not received much review, it is a reasonably simple and self-contained patchset and has been updated to reflect the comments received from the initial post of the Add FCode ROM for TCX framebuffer patch. For this reason, I feel that this patchset is a candidate for 1.7. The motivation behind this patch is that older operating systems such as Debian Woody and Solaris (running OpenWindows) do not contain drivers for the TCX framebuffer and as a result currently cannot run in graphical mode. The screenshots linked below show qemu-system-sparc successfully running both Debian Woody and the Solaris 8 installer in graphical mode with the CG3 framebuffer selected during testing: http://www.ilande.co.uk/tmp/debian-woody.png http://www.ilande.co.uk/tmp/sol8-1.png http://www.ilande.co.uk/tmp/sol8-2.png The CG3 framebuffer is selected by passing -vga cg3 on the command line to qemu-system-sparc. If either -vga tcx is specified (or the -vga argument is omitted) then qemu-system-sparc defaults to using the existing TCX framebuffer to maintain compatibility. Signed-off-by: Mark Cave-Ayland mark.cave-ayl...@ilande.co.uk Mark Cave-Ayland (3): sun4m: Add FCode ROM for TCX framebuffer sun4m: Add Sun CG3 framebuffer and corresponding OpenBIOS FCode ROM sun4m: Add Sun CG3 framebuffer initialisation function Makefile |2 +- default-configs/sparc-softmmu.mak |1 + hw/display/Makefile.objs |1 + hw/display/cg3.c | 359 + hw/display/tcx.c | 27 ++- hw/sparc/sun4m.c | 77 +++- include/sysemu/sysemu.h |1 + pc-bios/QEMU,cgthree.bin | Bin 0 - 682 bytes pc-bios/QEMU,tcx.bin | Bin 0 - 1242 bytes pc-bios/README|4 +- vl.c | 24 +++ 11 files changed, 483 insertions(+), 13 deletions(-) create mode 100644 hw/display/cg3.c create mode 100644 pc-bios/QEMU,cgthree.bin create mode 100644 pc-bios/QEMU,tcx.bin -- 1.7.10.4
[Qemu-devel] [PATCH for-1.7 2/3] sun4m: Add Sun CG3 framebuffer and corresponding OpenBIOS FCode ROM
The CG3 framebuffer is a simple 8-bit framebuffer for use with operating systems such as early Solaris that do not have drivers for TCX. Signed-off-by: Mark Cave-Ayland mark.cave-ayl...@ilande.co.uk CC: Blue Swirl blauwir...@gmail.com CC: Bob Breuer breu...@mc.net CC: Artyom Tarasenko atar4q...@gmail.com --- Makefile |2 +- default-configs/sparc-softmmu.mak |1 + hw/display/Makefile.objs |1 + hw/display/cg3.c | 359 + pc-bios/QEMU,cgthree.bin | Bin 0 - 682 bytes pc-bios/README|4 +- 6 files changed, 364 insertions(+), 3 deletions(-) create mode 100644 hw/display/cg3.c create mode 100644 pc-bios/QEMU,cgthree.bin diff --git a/Makefile b/Makefile index 3235039..8692e6e 100644 --- a/Makefile +++ b/Makefile @@ -286,7 +286,7 @@ ifdef INSTALL_BLOBS BLOBS=bios.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \ vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \ acpi-dsdt.aml q35-acpi-dsdt.aml \ -ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin \ +ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \ pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \ pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \ efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \ diff --git a/default-configs/sparc-softmmu.mak b/default-configs/sparc-softmmu.mak index 8fc93dd..ab796b3 100644 --- a/default-configs/sparc-softmmu.mak +++ b/default-configs/sparc-softmmu.mak @@ -10,6 +10,7 @@ CONFIG_EMPTY_SLOT=y CONFIG_PCNET_COMMON=y CONFIG_LANCE=y CONFIG_TCX=y +CONFIG_CG3=y CONFIG_SLAVIO=y CONFIG_CS4231=y CONFIG_GRLIB=y diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs index 540df82..7ed76a9 100644 --- a/hw/display/Makefile.objs +++ b/hw/display/Makefile.objs @@ -28,6 +28,7 @@ obj-$(CONFIG_OMAP) += omap_lcdc.o obj-$(CONFIG_PXA2XX) += pxa2xx_lcd.o obj-$(CONFIG_SM501) += sm501.o obj-$(CONFIG_TCX) += tcx.o +obj-$(CONFIG_CG3) += cg3.o obj-$(CONFIG_VGA) += vga.o diff --git a/hw/display/cg3.c b/hw/display/cg3.c new file mode 100644 index 000..b09bf23 --- /dev/null +++ b/hw/display/cg3.c @@ -0,0 +1,359 @@ +/* + * QEMU CG3 Frame buffer + * + * Copyright (c) 2012 Bob Breuer + * Copyright (c) 2013 Mark Cave-Ayland + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the Software), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include qemu-common.h +#include ui/console.h +#include hw/sysbus.h +#include hw/loader.h + +/* #define DEBUG_CG3 */ + +#define CG3_ROM_FILE QEMU,cgthree.bin +#define FCODE_MAX_ROM_SIZE 0x1 + +#define CG3_REG_SIZE 0x20 +#define CG3_VRAM_SIZE 0x10 +#define CG3_VRAM_OFFSET 0x80 + +#ifdef DEBUG_CG3 +#define DPRINTF(fmt, ...) \ +printf(CG3: fmt , ## __VA_ARGS__) +#else +#define DPRINTF(fmt, ...) +#endif + +#define TYPE_CG3 SUNW,cgthree +#define CG3(obj) OBJECT_CHECK(CG3State, (obj), TYPE_CG3) + +typedef struct CG3State { +SysBusDevice parent_obj; + +QemuConsole *con; +qemu_irq irq; +hwaddr prom_addr; +MemoryRegion vram_mem; +MemoryRegion rom; +MemoryRegion reg; +uint32_t vram_size; +int full_update; +uint8_t regs[16]; +uint8_t r[256], g[256], b[256]; +uint16_t width, height, depth; +uint8_t dac_index, dac_state; +} CG3State; + +static void cg3_update_display(void *opaque) +{ +CG3State *s = opaque; +DisplaySurface *surface = qemu_console_surface(s-con); +const uint8_t *pix; +uint32_t *data; +uint32_t dval; +int x, y, y_start; +unsigned int width, height; +ram_addr_t page, page_min, page_max; + +if (surface_bits_per_pixel(surface) != 32) { +return; +} +width = s-width; +height = s-height; + +y_start = -1; +page_min = -1; +page_max = 0; +page = 0; +pix = memory_region_get_ram_ptr(s-vram_mem); +data = (uint32_t *)surface_data(surface); + +for (y = 0; y
[Qemu-devel] [Bug 1247478] [NEW] usb passthrough mass storage write data corruption
Public bug reported: the windows 7 professional guest writes to usb high speed mass storage devices connected via host-libusb in bulk packages of either size 20480 or 4096 (as far as the actual file data is concerned and except for the last packet for odd-sized files). The pattern is: 3 times bulk out 20480 1 time bulk out 4096 and that repeats for files longer than 65536 bytes. the file on the usb disk is corrupted and it is always corrupt in the last 4096 bytes of each 20480 byte sized transfer. that means a file is corrupt at 16384-20480 and 36864-40960 and 57344-61440. and so on. and because the 4096 sized bulk out is always error free, the next corrupt span is from 81920-86016. the last 4096 bytes of the 20480 sized transfer is always identical to the first 4096 bytes of the same transfer. to reproduce: run windows7 guest on and pass through usb2.0 disk with host-libusb. write a large file. (possibly check the bulk transfer sizes with usbmon). note that attaching usb disks with hw/usb/dev-storage does work just fine. cannot reproduce with linux as it always writes just 4096 bytes and writes with a linux guest are always ok even with usb passthrough. ** Affects: qemu Importance: Undecided Status: New -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1247478 Title: usb passthrough mass storage write data corruption Status in QEMU: New Bug description: the windows 7 professional guest writes to usb high speed mass storage devices connected via host-libusb in bulk packages of either size 20480 or 4096 (as far as the actual file data is concerned and except for the last packet for odd-sized files). The pattern is: 3 times bulk out 20480 1 time bulk out 4096 and that repeats for files longer than 65536 bytes. the file on the usb disk is corrupted and it is always corrupt in the last 4096 bytes of each 20480 byte sized transfer. that means a file is corrupt at 16384-20480 and 36864-40960 and 57344-61440. and so on. and because the 4096 sized bulk out is always error free, the next corrupt span is from 81920-86016. the last 4096 bytes of the 20480 sized transfer is always identical to the first 4096 bytes of the same transfer. to reproduce: run windows7 guest on and pass through usb2.0 disk with host-libusb. write a large file. (possibly check the bulk transfer sizes with usbmon). note that attaching usb disks with hw/usb/dev-storage does work just fine. cannot reproduce with linux as it always writes just 4096 bytes and writes with a linux guest are always ok even with usb passthrough. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1247478/+subscriptions
Re: [Qemu-devel] [RFC PATCH] spapr: add ibmveth to the supported network adapters list
Am 02.11.2013 um 12:51 schrieb Markus Armbruster arm...@redhat.com: Alexander Graf ag...@suse.de writes: Am 01.11.2013 um 03:52 schrieb Alexey Kardashevskiy a...@ozlabs.ru: [...] Or -net interface is deprecated and we do not want even touch it? I don't think we should deprecate it. It's easier to use than anything else. Ahci adoption heavily suffered from not being enabled in -drive - I don't want that again here. How exactly is -net nic,netdev=NET-ID,macaddr=MACADDR,model=MODEL,... easier to use than -device DEVNAME,netdev=NET-ID,macaddr=MACADDR,... ? Especially now that -device help shows valid DEVNAMEs under the heading Network devices. The same way -device ahci -drive ...,if=none -device ide-drive,... Is harder than -drive if=ahci. Users didn't even realize ahci support was in the code base... Alex
Re: [Qemu-devel] savevm/loadvm
On 11/02/2013 01:16 AM, Max Reitz wrote: Hi, Sorry I'm just now replying to this. I ran into the same issue (and another one) and it should be fixed by the upstream commits eedff66f21e542650d895801549ce05ac108278b and 6e13610aa454beba52944e8df6d93158d68ab911. Those have been merged to master yesterday, so could you re-build qemu from master and try again? Yes, this works now, thanks! Kind regards, Max On 08.10.2013 10:40, Alexey Kardashevskiy wrote: Hi! I need the community help with savevm/loadvm. I run QEMU like this: ./qemu-system-ppc64 \ -drive file=virtimg/fc19_16GB.qcow2 \ -nodefaults \ -m 2048 \ -machine pseries \ -nographic \ -vga none \ -enable-kvm The disk image is an 16GB qcow2 image. Now I start the guest and do savevm 1 and loadvm 1 from the qemu console. Everything works. Then I exit qemu, make sure that the snapshot is there and run QEMU as above plus -loadvm 1. It fails with: qemu-system-ppc64: qcow2: Loading snapshots with different disk size is not implemented qemu-system-ppc64: Error -95 while activating snapshot '2' on 'scsi0-hd0' The check is added by commit 90b277593df873d3a2480f002e2eb5fe1f8e5277 qcow2: Save disk size in snapshot header. As I cannot realize the whole idea of the patch, I looked a bit deeper. This is the check: int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) { [...] if (sn-disk_size != bs-total_sectors * BDRV_SECTOR_SIZE) { error_report(qcow2: Loading snapshots with different disk size is not implemented); ret = -ENOTSUP; goto fail; } My understanding of the patch was that the disk_size should remain 16GB (0x4..) as it uses bs-total_sectors and never changes it. And bs-growable is 0 for qcow2 image because it is not really growable. At least the total_sectors value from the qcow2 file header does not change between QEMU starts. However qcow2_save_vmstate() sets bs-growable to 1 for a short time (commit 178e08a58f40dd5aef2ce774fe0850f5d0e56918 from 2009) and this triggers a branch in bdrv_co_do_writev() which changes bs-total_sectors. So when QEMU writes snapshots to the file, the disk_size field of a snapshot has bigger value (for example 0x4.007b.8180). And the check above fails. It does not fail if to do loadvm _in_the_same_run_ after savevm because QEMU operates with the updated bs-total_sectors. What the proper fix would be? Or it is not a bug at all and I should be using something else for -loadvm? Thanks. -- Alexey
[Qemu-devel] [migration] questions about removing the old block-migration code
Hi, Juan I read below words on the report of KVM Live Migration: Weather forecast (May 29, 2013), We were going to remove the old block-migration code Then people fixed it Good: it works now Bad: We have to maintain both It uses the same port than migration You need to migrate all/none of block devices The old block-migration code said above is that in block-migration.c? What are the reasons of removing the old block-migration code? Buggy implementation? Or need to migrate all/none of block devices? What's the substitutional method? drive_mirror? Thanks, Zhang Haoyu