[Qemu-devel] [Bug 921208] Re: win7/x64 installer hangs on startup with 0x0000005d.
the westmere cpudef with level 2,9,10,11 doesn't work for win7/x64. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/921208 Title: win7/x64 installer hangs on startup with 0x005d. Status in QEMU: New Bug description: hi, during booting win7/x64 installer i'm observing a bsod with 0x005d ( msdn: unsupported_processor ). used command line: qemu-system-x86_64 -m 2048 -hda w7-system.img -cdrom win7_x64.iso -boot d adding '-machine accel=kvm' instead of default tcg accel helps to boot. installed software: qemu-1.0 linux-3.2.1 glibc-2.14.1 gcc-4.6.2 hw cpu: processor : 0..7 vendor_id : GenuineIntel cpu family : 6 model : 42 model name : Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz stepping: 7 microcode : 0x14 cpu MHz : 1995.739 cache size : 6144 KB physical id : 0 siblings: 8 core id : 3 cpu cores : 4 apicid : 7 initial apicid : 7 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid bogomips: 3992.23 clflush size: 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/921208/+subscriptions
Re: [Qemu-devel] [PATCH] qom: Make object_unref() free the object's memory when refcount goes to 0.
On 02/24/2012 05:11 PM, Anthony Liguori wrote: On 02/23/2012 10:21 AM, Alexander Barabash wrote: On 02/22/2012 09:12 PM, Anthony Liguori wrote: On 02/22/2012 12:00 PM, alexander_barab...@mentor.com wrote: From: Alexander Barabashalexander_barab...@mentor.com Why do you want to have a delete notifier list, rather than just a delete callback. Because a notifier list allows for third parties to receive the event (think GObject signal/slots). This is a valid point, but wouldn't it logical to issue an event before running the destructor? Along the lines: void object_finalize(void *data) { Object *obj = data; TypeImpl *ti = obj-class-type; object_deinit(obj, ti); object_property_del_all(obj); g_assert(obj-ref == 0); object_finalized_notification(obj); } ... void object_unref(Object *obj) { g_assert(obj-ref 0); if (obj-ref == 1) { object_is_about_to_be_finalized_notification(obj); } obj-ref--; /* parent always holds a reference to its children */ if (obj-ref == 0) { object_finalize(obj); } } Here, there is a notification while the object is still alive (in the sense that it has not been finalized). Then, if the object is actually finalized, there is notification about that. By the way, using weak references would spare us the notification list. Object's memory will not be freed as long as a weak reference to it exists. Access through a weak reference to a dead object will remove that weak reference. This way, we shall also avoid problems with circular references between objects. Regards, Alex At the point where refcount == 0, the destructor has been called already, so there is not much to be done, except for reclaim the memory. Right, but the memory is not allocated by the core of Object. This is important in order to allow in-place object creation. You could special case this and have a flag to indicate whether the object has allocated it's own memory or not but I think the two approaches end up having equal complexity whereas the NotifierList gives you a lot more flexibility. It makes it possible to use a small object allocator for Objects which could be useful one day if we use objects in a fast path (like using Objects to allocate packets in the network layer or requests in the block layer). Regards, Anthony Liguori
Re: [Qemu-devel] [PATCH 4/8] Add universal DMA helper functions
On Fri, Feb 24, 2012 at 02:27:39PM +1100, David Gibson wrote: Not that long ago, every device implementation using DMA directly accessed guest memory using cpu_physical_memory_*(). This meant that adding support for a guest visible IOMMU would require changing every one of these devices to go through IOMMU translation. Shortly before qemu 1.0, I made a start on fixing this by providing helper functions for PCI DMA. These are currently just stubs which call the direct access functions, but mean that an IOMMU can be implemented in one place, rather than for every PCI device. Clearly, this doesn't help for non PCI devices, which could also be IOMMU translated on some platforms. It is also problematic for the devices which have both PCI and non-PCI version (e.g. OHCI, AHCI) - we cannot use the the pci_dma_*() functions, because they assume the presence of a PCIDevice, but we don't want to have to check between pci_dma_*() and cpu_physical_memory_*() every time we do a DMA in the device code. This patch makes the first step on addressing both these problems, by introducing new (stub) dma helper functions which can be used for any DMA capable device. These dma functions take a DMAContext *, a new (currently empty) variable describing the DMA address space in which the operation is to take place. NULL indicates untranslated DMA directly into guest physical address space. The intention is that in future non-NULL values will given information about any necessary IOMMU translation. DMA using devices must obtain a DMAContext (or, potentially, contexts) from their bus or platform. For now this patch just converts the PCI wrappers to be implemented in terms of the universal wrappers, converting other drivers can take place over time. Cc: Michael S. Tsirkin m...@redhat.com Cc: Joerg Rodel joerg.ro...@amd.com Cc: Eduard - Gabriel Munteanu eduard.munte...@linux360.ro Cc: Richard Henderson r...@twiddle.net Signed-off-by: David Gibson da...@gibson.dropbear.id.au I'm a bit confused with all the stubbing going on. Is this the final form of the pci_* functions or just a stub? If the final form, we probably should just open-code them - they don't buy us much. If not, let's add a comment? --- dma.h| 87 ++ hw/pci.h | 21 -- 2 files changed, 99 insertions(+), 9 deletions(-) diff --git a/dma.h b/dma.h index 79be131..d7428df 100644 --- a/dma.h +++ b/dma.h @@ -28,6 +28,93 @@ typedef enum { DMA_DIRECTION_FROM_DEVICE = 1, } DMADirection; +typedef struct DMAContext { why do we need the empty struct? Someone will allocate an instance of it? If not, typedef struct DMAContext DMAContext; in qemu-common.h would be enough. + +typedef void DMAInvalidateMapFunc(void *); + +static inline int dma_memory_rw(DMAContext *dma, dma_addr_t addr, +void *buf, dma_addr_t len, DMADirection dir) +{ +cpu_physical_memory_rw(addr, buf, (target_phys_addr_t)len, + dir == DMA_DIRECTION_FROM_DEVICE); +return 0; +} + +static inline int dma_memory_read(DMAContext *dma, dma_addr_t addr, + void *buf, dma_addr_t len) +{ +return dma_memory_rw(dma, addr, buf, len, DMA_DIRECTION_TO_DEVICE); +} + +static inline int dma_memory_write(DMAContext *dma, dma_addr_t addr, + const void *buf, dma_addr_t len) +{ +return dma_memory_rw(dma, addr, (void *)buf, len, + DMA_DIRECTION_FROM_DEVICE); +} + +static inline void *dma_memory_map(DMAContext *dma, + DMAInvalidateMapFunc *cb, void *opaque, + dma_addr_t addr, dma_addr_t *len, + DMADirection dir) +{ +target_phys_addr_t xlen = *len; +void *p; + +p = cpu_physical_memory_map(addr, xlen, +dir == DMA_DIRECTION_FROM_DEVICE); +*len = xlen; +return p; +} + +static inline void dma_memory_unmap(DMAContext *dma, +void *buffer, dma_addr_t len, +DMADirection dir, dma_addr_t access_len) +{ +return cpu_physical_memory_unmap(buffer, (target_phys_addr_t)len, + dir == DMA_DIRECTION_FROM_DEVICE, + access_len); +} + +#define DEFINE_LDST_DMA(_lname, _sname, _bits, _end) \ +static inline uint##_bits##_t ld##_lname##_##_end##_dma(DMAContext *dma, \ +dma_addr_t addr) \ +{ \ +uint##_bits##_t val;\ +dma_memory_read(dma, addr, val, (_bits) / 8); \ +return
[Qemu-devel] [PATCH] libcacard: Spelling and grammar fixes in documentation
* it's - its * it's - it is (that's no fix, but makes future checks easier) * this functions - this function * replacable - replaceable * reader's - readers * logins into - logs into Signed-off-by: Stefan Weil s...@weilnetz.de --- docs/libcacard.txt | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/libcacard.txt b/docs/libcacard.txt index f7d7519..559db8a 100644 --- a/docs/libcacard.txt +++ b/docs/libcacard.txt @@ -10,7 +10,7 @@ such as signing, card removal/insertion, etc. are mapped to real, physical cards which are shared with the client machine the emulator is running on, or the cards could be pure software constructs. -The emulator is structured to allow multiple replacable or additional pieces, +The emulator is structured to allow multiple replaceable or additional pieces, so it can be easily modified for future requirements. The primary envisioned modifications are: @@ -32,7 +32,7 @@ be emulated as well, including PIV, newer versions of CAC, PKCS #15, etc. Replacing the Socket Based Virtual Reader Interface. -The current implementation contains a replacable module vscclient.c. The +The current implementation contains a replaceable module vscclient.c. The current vscclient.c implements a sockets interface to the virtual ccid reader on the guest. CCID commands that are pertinent to emulation are passed across the socket, and their responses are passed back along that same socket. @@ -42,7 +42,7 @@ implements a program with a main entry. It also handles argument parsing for the emulator. An application that wants to use the virtual reader can replace vscclient.c -with it's own implementation that connects to it's own CCID reader. The calls +with its own implementation that connects to its own CCID reader. The calls that the CCID reader can call are: VReaderList * vreader_get_reader_list(); @@ -72,12 +72,12 @@ that the CCID reader can call are: VReader * vreader_list_get_reader(VReaderListEntry *) This function returns the reader stored in the reader List entry. Caller gets - a new reference to a reader. The caller must free it's reference when it is + a new reference to a reader. The caller must free its reference when it is finished with vreader_free(). void vreader_free(VReader *reader); - This function frees a reference to a reader. Reader's are reference counted + This function frees a reference to a reader. Readers are reference counted and are automatically deleted when the last reference is freed. void vreader_list_delete(VReaderList *list); @@ -87,7 +87,7 @@ that the CCID reader can call are: VReaderStatus vreader_power_on(VReader *reader, char *atr, int *len); - This functions simulates a card power on. Virtual cards do not care about + This function simulates a card power on. A virtual card does not care about the actual voltage and other physical parameters, but it does care that the card is actually on or off. Cycling the card causes the card to reset. If the caller provides enough space, vreader_power_on will return the ATR of @@ -104,7 +104,7 @@ that the CCID reader can call are: unsigned char *receive_buf, int receive_buf_len); - This functions send a raw apdu to a card and returns the card's response. + This function sends a raw apdu to a card and returns the card's response. The CCID front end should return the response back. Most of the emulation is driven from these APDUs. @@ -217,10 +217,10 @@ the card using the following functions: VCardStatus vcard_add_applet(VCard *card, VCardApplet *applet); Add an applet onto the list of applets attached to the card. Once an applet - has been added, it can be selected by it's aid, and then commands will be + has been added, it can be selected by its aid, and then commands will be routed to it VCardProcessAPDU function. This function adopts the applet the passed int applet. Note: 2 applets with the same AID should not be added to - the same card. It's permissible to add more than one applet. Multiple applets + the same card. It is permissible to add more than one applet. Multiple applets may have the same VCardPRocessAPDU entry point. The certs and keys should be attached to private data associated with one or @@ -335,7 +335,7 @@ and applet. VCard7816Status vcard_emul_login(VCard *card, unsigned char *pin, int pin_len); -This function logins into the card and return the standard 7816 status +This function logs into the card and returns the standard 7816 status word depending on the success or failure of the call. void vcard_emul_delete_key(VCardKey *key); @@ -424,7 +424,7 @@ functions: cert_len, and keys are all arrays of length cert_count. These are the
[Qemu-devel] [PATCH] Spelling fixes in comments (it's - its)
* it's - its (fixed for all files) * dont - don't (only fixed in a line which was touched by the previous fix) Signed-off-by: Stefan Weil s...@weilnetz.de --- configure |2 +- hw/exynos4210_mct.c |2 +- hw/usb-ccid.c |2 +- include/qemu/object.h |4 ++-- kvm-all.c |2 +- libcacard/vscclient.c |2 +- linux-user/signal.c |2 +- qemu-file.h |2 +- target-mips/op_helper.c |2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/configure b/configure index c6c863a..5c46f1c 100755 --- a/configure +++ b/configure @@ -231,7 +231,7 @@ for opt do done # OS specific # Using uname is really, really broken. Once we have the right set of checks -# we can eliminate it's usage altogether +# we can eliminate its usage altogether. cc=${CC-${cross_prefix}gcc} ar=${AR-${cross_prefix}ar} diff --git a/hw/exynos4210_mct.c b/hw/exynos4210_mct.c index 01e3fb8..7474fcf 100644 --- a/hw/exynos4210_mct.c +++ b/hw/exynos4210_mct.c @@ -888,7 +888,7 @@ static void exynos4210_ltick_event(void *opaque) static uint64_t time2[2] = {0}; #endif -/* Call tick_timer event handler, it will update it's tcntb and icntb */ +/* Call tick_timer event handler, it will update its tcntb and icntb. */ exynos4210_ltick_timer_event(s-tick_timer); /* get tick_timer cnt */ diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c index 0b2ac80..6ddcba7 100644 --- a/hw/usb-ccid.c +++ b/hw/usb-ccid.c @@ -5,7 +5,7 @@ * * Written by Alon Levy, with contributions from Robert Relyea. * - * Based on usb-serial.c, see it's copyright and attributions below. + * Based on usb-serial.c, see its copyright and attributions below. * * This work is licensed under the terms of the GNU GPL, version 2.1 or later. * See the COPYING file in the top-level directory. diff --git a/include/qemu/object.h b/include/qemu/object.h index dd7f3c0..ec2d294 100644 --- a/include/qemu/object.h +++ b/include/qemu/object.h @@ -124,7 +124,7 @@ typedef struct InterfaceInfo InterfaceInfo; * * Once all of the parent classes have been initialized, #TypeInfo::class_init * is called to let the class being instantiated provide default initialize for - * it's virtual functions. Here is how the above example might be modified + * its virtual functions. Here is how the above example might be modified * to introduce an overridden virtual function: * * example @@ -527,7 +527,7 @@ Type type_register_static(const TypeInfo *info); * type_register: * @info: The #TypeInfo of the new type * - * Unlike type_register_static(), this call does not require @info or it's + * Unlike type_register_static(), this call does not require @info or its * string members to continue to exist after the call returns. * * Returns: 0 on failure, the new #Type on success. diff --git a/kvm-all.c b/kvm-all.c index c4babda..0729020 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -34,7 +34,7 @@ #include sys/eventfd.h #endif -/* KVM uses PAGE_SIZE in it's definition of COALESCED_MMIO_MAX */ +/* KVM uses PAGE_SIZE in its definition of COALESCED_MMIO_MAX */ #define PAGE_SIZE TARGET_PAGE_SIZE //#define DEBUG_KVM diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c index e317a25..4fbcc89 100644 --- a/libcacard/vscclient.c +++ b/libcacard/vscclient.c @@ -129,7 +129,7 @@ event_thread(void *arg) vevent_delete(event); continue; } -/* this reader hasn't been told it's status from qemu yet, wait for +/* this reader hasn't been told its status from qemu yet, wait for * that status */ while (pending_reader != NULL) { qemu_cond_wait(pending_reader_condition, pending_reader_lock); diff --git a/linux-user/signal.c b/linux-user/signal.c index 79a39dc..cefd2ff 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -2700,7 +2700,7 @@ get_sigframe(struct target_sigaction *ka, CPUState *regs, size_t frame_size) sp = regs-active_tc.gpr[29]; /* - * FPU emulator may have it's own trampoline active just + * FPU emulator may have its own trampoline active just * above the user stack, 16-bytes before the next lowest * 16 byte boundary. Try to avoid trashing it. */ diff --git a/qemu-file.h b/qemu-file.h index 8da1021..31b83f6 100644 --- a/qemu-file.h +++ b/qemu-file.h @@ -47,7 +47,7 @@ typedef int (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf, */ typedef int (QEMUFileCloseFunc)(void *opaque); -/* Called to determine if the file has exceeded it's bandwidth allocation. The +/* Called to determine if the file has exceeded its bandwidth allocation. The * bandwidth capping is a soft limit, not a hard limit. */ typedef int (QEMUFileRateLimit)(void *opaque); diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index c51b9cb..7d6773d 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c @@
Re: [Qemu-devel] [PATCH] libcacard: Spelling and grammar fixes in documentation
On Sun, Feb 26, 2012 at 02:30:21PM +0100, Stefan Weil wrote: Ack. * it's - its * it's - it is (that's no fix, but makes future checks easier) * this functions - this function * replacable - replaceable * reader's - readers * logins into - logs into Signed-off-by: Stefan Weil s...@weilnetz.de --- docs/libcacard.txt | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/libcacard.txt b/docs/libcacard.txt index f7d7519..559db8a 100644 --- a/docs/libcacard.txt +++ b/docs/libcacard.txt @@ -10,7 +10,7 @@ such as signing, card removal/insertion, etc. are mapped to real, physical cards which are shared with the client machine the emulator is running on, or the cards could be pure software constructs. -The emulator is structured to allow multiple replacable or additional pieces, +The emulator is structured to allow multiple replaceable or additional pieces, so it can be easily modified for future requirements. The primary envisioned modifications are: @@ -32,7 +32,7 @@ be emulated as well, including PIV, newer versions of CAC, PKCS #15, etc. Replacing the Socket Based Virtual Reader Interface. -The current implementation contains a replacable module vscclient.c. The +The current implementation contains a replaceable module vscclient.c. The current vscclient.c implements a sockets interface to the virtual ccid reader on the guest. CCID commands that are pertinent to emulation are passed across the socket, and their responses are passed back along that same socket. @@ -42,7 +42,7 @@ implements a program with a main entry. It also handles argument parsing for the emulator. An application that wants to use the virtual reader can replace vscclient.c -with it's own implementation that connects to it's own CCID reader. The calls +with its own implementation that connects to its own CCID reader. The calls that the CCID reader can call are: VReaderList * vreader_get_reader_list(); @@ -72,12 +72,12 @@ that the CCID reader can call are: VReader * vreader_list_get_reader(VReaderListEntry *) This function returns the reader stored in the reader List entry. Caller gets - a new reference to a reader. The caller must free it's reference when it is + a new reference to a reader. The caller must free its reference when it is finished with vreader_free(). void vreader_free(VReader *reader); - This function frees a reference to a reader. Reader's are reference counted + This function frees a reference to a reader. Readers are reference counted and are automatically deleted when the last reference is freed. void vreader_list_delete(VReaderList *list); @@ -87,7 +87,7 @@ that the CCID reader can call are: VReaderStatus vreader_power_on(VReader *reader, char *atr, int *len); - This functions simulates a card power on. Virtual cards do not care about + This function simulates a card power on. A virtual card does not care about the actual voltage and other physical parameters, but it does care that the card is actually on or off. Cycling the card causes the card to reset. If the caller provides enough space, vreader_power_on will return the ATR of @@ -104,7 +104,7 @@ that the CCID reader can call are: unsigned char *receive_buf, int receive_buf_len); - This functions send a raw apdu to a card and returns the card's response. + This function sends a raw apdu to a card and returns the card's response. The CCID front end should return the response back. Most of the emulation is driven from these APDUs. @@ -217,10 +217,10 @@ the card using the following functions: VCardStatus vcard_add_applet(VCard *card, VCardApplet *applet); Add an applet onto the list of applets attached to the card. Once an applet - has been added, it can be selected by it's aid, and then commands will be + has been added, it can be selected by its aid, and then commands will be routed to it VCardProcessAPDU function. This function adopts the applet the passed int applet. Note: 2 applets with the same AID should not be added to - the same card. It's permissible to add more than one applet. Multiple applets + the same card. It is permissible to add more than one applet. Multiple applets may have the same VCardPRocessAPDU entry point. The certs and keys should be attached to private data associated with one or @@ -335,7 +335,7 @@ and applet. VCard7816Status vcard_emul_login(VCard *card, unsigned char *pin, int pin_len); -This function logins into the card and return the standard 7816 status +This function logs into the card and returns the standard 7816 status word depending on the success or
[Qemu-devel] [PATCH] Fix spelling in comments (iff - if)
Signed-off-by: Stefan Weil s...@weilnetz.de --- a.out.h|2 +- arm-dis.c | 22 +++--- block.c|2 +- block/qcow2-refcount.c |4 ++-- hw/alpha_typhoon.c |2 +- hw/hid.h |2 +- hw/pcnet.c |2 +- m68k-dis.c |4 ++-- memory.h |4 ++-- monitor.c |2 +- net/socket.c |2 +- qemu-img.c |2 +- tcg/hppa/tcg-target.c |6 +++--- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/a.out.h b/a.out.h index 33ca7f7..7ea8d5a 100644 --- a/a.out.h +++ b/a.out.h @@ -136,7 +136,7 @@ struct external_scnhdr { */ struct external_lineno { union { -host_ulong l_symndx; /* function name symbol index, iff l_lnno 0 */ +host_ulong l_symndx; /* function name symbol index, if l_lnno 0 */ host_ulong l_paddr;/* (physical) address of line number*/ } l_addr; unsigned short l_lnno; /* line number */ diff --git a/arm-dis.c b/arm-dis.c index 6bc4d71..db15eca 100644 --- a/arm-dis.c +++ b/arm-dis.c @@ -130,8 +130,8 @@ struct opcode16 %zcodeprint a double precision VFP reg Codes: 0=Dm, 1=Dd, 2=Dn, 3=multi-list - %bitfield'c print specified char iff bitfield is all ones - %bitfield`c print specified char iff bitfield is all zeroes + %bitfield'c print specified char if bitfield is all ones + %bitfield`c print specified char if bitfield is all zeroes %bitfield?ab...select from array of values in big endian order %L print as an iWMMXt N/M width field. @@ -522,8 +522,8 @@ static const struct opcode32 coprocessor_opcodes[] = %bitfieldTn print short scaled width limited by n %bitfieldUn print long scaled width limited by n - %bitfield'c print specified char iff bitfield is all ones - %bitfield`c print specified char iff bitfield is all zeroes + %bitfield'c print specified char if bitfield is all ones + %bitfield`c print specified char if bitfield is all zeroes %bitfield?ab...select from array of values in big endian order */ static const struct opcode32 neon_opcodes[] = @@ -787,8 +787,8 @@ static const struct opcode32 neon_opcodes[] = %c print condition code (always bits 28-31) %m print register mask for ldm/stm instruction %o print operand2 (immediate or register + shift) - %p print 'p' iff bits 12-15 are 15 - %t print 't' iff bit 21 set and bit 24 clear + %p print 'p' if bits 12-15 are 15 + %t print 't' if bit 21 set and bit 24 clear %B print arm BLX(1) destination %C print the PSR sub type. %U print barrier type. @@ -800,8 +800,8 @@ static const struct opcode32 neon_opcodes[] = %bitfieldxprint the bitfield in hex %bitfieldXprint the bitfield as 1 hex digit without leading 0x - %bitfield'c print specified char iff bitfield is all ones - %bitfield`c print specified char iff bitfield is all zeroes + %bitfield'c print specified char if bitfield is all ones + %bitfield`c print specified char if bitfield is all zeroes %bitfield?ab...select from array of values in big endian order %e print arm SMI operand (bits 0..7,8..19). @@ -1090,7 +1090,7 @@ static const struct opcode32 arm_opcodes[] = %bitfielda print (bitfield * 4) as a pc-rel offset + decoded symbol %bitfieldB print Thumb branch destination (signed displacement) %bitfieldc print bitfield as a condition code - %bitnum'c print specified char iff bit is one + %bitnum'c print specified char if bit is one %bitnum?abprint a if bit is one else print b. */ static const struct opcode16 thumb_opcodes[] = @@ -1248,8 +1248,8 @@ static const struct opcode16 thumb_opcodes[] = %bitfieldrprint bitfield as an ARM register %bitfieldcprint bitfield as a condition code - %bitfield'c print specified char iff bitfield is all ones - %bitfield`c print specified char iff bitfield is all zeroes + %bitfield'c print specified char if bitfield is all ones + %bitfield`c print specified char if bitfield is all zeroes %bitfield?ab... select from array of values in big endian order With one exception at the bottom (done because BL and BLX(1) need diff --git a/block.c b/block.c index e27d528..54c02f0 100644 --- a/block.c +++ b/block.c @@ -2269,7 +2269,7 @@ typedef struct BdrvCoIsAllocatedData { } BdrvCoIsAllocatedData; /* - * Returns true iff the specified sector is present in the disk image. Drivers + * Returns true if the specified sector is
Re: [Qemu-devel] [PATCH v2] net: add the support for -netdev socket, listen
On Sat, Feb 18, 2012 at 9:19 AM, zwu.ker...@gmail.com wrote: From: Zhi Yong Wu wu...@linux.vnet.ibm.com The -net socket,listen option does not work with the newer -netdev syntax: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg01508.html This patch makes it work now. Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com --- net.c | 26 + net.h | 2 + net/socket.c | 72 +- 3 files changed, 84 insertions(+), 16 deletions(-) I wanted to understand the problem better so I tried out -net socket,listen=. Here is its behavior: 1. A client can connect to QEMU, this creates a new socket VLANClientState on the VLAN. 2. If another client connects to QEMU, another VLANClientState is created. That means many socket clients can be added to the same VLAN. 3. When a simple TCP client like netcat connects and then disconnects, the VLANClientState remains forever. There seems to be no cleanup. This patch does not handle the -net socket,listen= case where multiple clients connect. Also, the -netdev socket,listen= semantics cannot match -net socket-listen= semantics because there is only one peer at any time. Some options: 1. Do not accept new connections while a client is connected. Once the client disconnects we can accept a new connection. This maintains the 1-1 peer behavior. 2. Integrate with vlan-hub so that multiple clients can connect even with -netdev. Connections will create new NetClientStates and auto-attach to the hub. This mimics -net socket,listen= but requires a hub to be used. 3. Forbid -netdev socket,listen=, only allow -net socket,listen=. I think #1 would be okay, although it no longer allows multiple connections, but I don't have a strong opinion either way. Stefan
[Qemu-devel] [PATCH] qed: replace vm_clock with rt_clock for qemu-tool compatibility
The QED dirty bit timer marks the file clean after allocating writes have drained. This is cheaper than clearing/setting the dirty bit on each allocating write because the timer introduces a grace period which can be extended if more allocating writes arrive. The vm_clock was used in an attempt to prevent modifying the image file when live migration has stopped the VM. Unfortunately vm_clock is unavailable in the qemu-tool environment and will abort(3)! Since QED currently does not support live migration, just replace vm_clock with rt_clock and add comments explaining the migration blocker. Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com --- Zhi Yong: This patch is needed in addition to the qemu_init_main_loop() patches you sent recently. Without this patch QED may read the vm_clock, which calls abort(3) in qemu-tool.c. Together, our patches make QED work again in qemu-img and qemu-io. block/qed.c | 16 +++- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/block/qed.c b/block/qed.c index a041d31..fdb90e3 100644 --- a/block/qed.c +++ b/block/qed.c @@ -353,10 +353,7 @@ static void qed_start_need_check_timer(BDRVQEDState *s) { trace_qed_start_need_check_timer(s); -/* Use vm_clock so we don't alter the image file while suspended for - * migration. - */ -qemu_mod_timer(s-need_check_timer, qemu_get_clock_ns(vm_clock) + +qemu_mod_timer(s-need_check_timer, qemu_get_clock_ns(rt_clock) + get_ticks_per_sec() * QED_NEED_CHECK_TIMEOUT); } @@ -494,9 +491,18 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags) } } -s-need_check_timer = qemu_new_timer_ns(vm_clock, +s-need_check_timer = qemu_new_timer_ns(rt_clock, qed_need_check_timer_cb, s); +/* There are two issues with live migration: + * + * 1. The destination will open the image file and see the dirty bit is + *set, causing it to repair the image while the source still has it + *open for writing. + * + * 2. The timer used for clearing the dirty bit uses rt_clock and can in + *theory fire when the VM is not running during migration. + */ error_set(s-migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, qed, bs-device_name, live migration); -- 1.7.9
Re: [Qemu-devel] [PATCH 1/2] qemu-img: fix segment fault when the image format is qed
On Sun, Feb 19, 2012 at 2:24 PM, zwu.ker...@gmail.com wrote: From: Zhi Yong Wu wu...@linux.vnet.ibm.com [root@f15 qemu]# qemu-img info /home/zwu/work/misc/rh6.img image: /home/zwu/work/misc/rh6.img file format: qed virtual size: 4.0G (4294967296 bytes) disk size: 1.2G cluster_size: 65536 Segmentation fault (core dumped) Today when i were fixing another issue, i found this issue; After simple investigation, i found that the required clock vm_clock is not created for qemu tool. Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com --- qemu-img.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) Please also see the qed: replace vm_clock with rt_clock for qemu-tool compatibility patch which I just sent. Using vm_clock is not possible in qemu-tool and leads to abort(3) when running qemu-io write commands. Reviewed-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com
[Qemu-devel] [PATCH 1/6] usb-redir: Fix printing of device version
The device version is in bcd format, which requires some special handling to print. Signed-off-by: Hans de Goede hdego...@redhat.com --- usb-redir.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index 85f40d6..9b804e9 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -1076,8 +1076,10 @@ static void usbredir_device_connect(void *priv, usb_redir_cap_connect_device_version)) { INFO(attaching %s device %04x:%04x version %d.%d class %02x\n, speed, device_connect-vendor_id, device_connect-product_id, - device_connect-device_version_bcd 8, - device_connect-device_version_bcd 0xff, + ((device_connect-device_version_bcd 0xf000) 12) * 10 + + ((device_connect-device_version_bcd 0x0f00) 8), + ((device_connect-device_version_bcd 0x00f0) 4) * 10 + + ((device_connect-device_version_bcd 0x000f) 0), device_connect-device_class); } else { INFO(attaching %s device %04x:%04x class %02x\n, speed, -- 1.7.7.6
[Qemu-devel] [PATCH 2/6] usb-redir: Always clear device state on filter reject
Always call usbredir_device_disconnect() when usbredir_check_filter() fails to clean up all the device state (ie received endpoint info). Signed-off-by: Hans de Goede hdego...@redhat.com --- usb-redir.c | 11 +++ 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index 9b804e9..fe3b0a3 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -985,7 +985,7 @@ static int usbredir_check_filter(USBRedirDevice *dev) { if (dev-interface_info.interface_count == 0) { ERROR(No interface info for device\n); -return -1; +goto error; } if (dev-filter_rules) { @@ -993,7 +993,7 @@ static int usbredir_check_filter(USBRedirDevice *dev) usb_redir_cap_connect_device_version)) { ERROR(Device filter specified and peer does not have the connect_device_version capability\n); -return -1; +goto error; } if (usbredirfilter_check( @@ -1010,11 +1010,15 @@ static int usbredir_check_filter(USBRedirDevice *dev) dev-device_info.product_id, dev-device_info.device_version_bcd, 0) != 0) { -return -1; +goto error; } } return 0; + +error: +usbredir_device_disconnect(dev); +return -1; } /* @@ -1140,7 +1144,6 @@ static void usbredir_interface_info(void *priv, if (usbredir_check_filter(dev)) { ERROR(Device no longer matches filter after interface info change, disconnecting!\n); -usbredir_device_disconnect(dev); } } } -- 1.7.7.6
[Qemu-devel] [PATCH 5/6] usb-redir: Return USB_RET_NAK when we've no data for an interrupt endpoint
We should return USB_RET_NAK, rather then a 0 sized packet, when we've no data for an interrupt IN endpoint. Signed-off-by: Hans de Goede hdego...@redhat.com --- usb-redir.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index c76e55d..ea828a8 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -558,7 +558,9 @@ static int usbredir_handle_interrupt_data(USBRedirDevice *dev, /* Check interrupt_error for stream errors */ status = dev-endpoint[EP2I(ep)].interrupt_error; dev-endpoint[EP2I(ep)].interrupt_error = 0; -return usbredir_handle_status(dev, status, 0); +if (status) +return usbredir_handle_status(dev, status, 0); +return USB_RET_NAK; } DPRINTF(interrupt-token-in ep %02X status %d len %d\n, ep, intp-status, intp-len); -- 1.7.7.6
[Qemu-devel] [PATCH 4/6] usb-redir: Limit return values returned by iso packets
The usbredir protocol uses a status of usb_redir_stall to indicate that an iso data stream has stopped (ie because the urbs failed on resubmit), but iso packets should never return a result of USB_RET_STALL, since iso endpoints cannot stall. So instead simply always return USB_RET_NAK on iso stream errors. Signed-off-by: Hans de Goede hdego...@redhat.com --- usb-redir.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index d10d8de..c76e55d 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -441,7 +441,7 @@ static int usbredir_handle_iso_data(USBRedirDevice *dev, USBPacket *p, /* Check iso_error for stream errors, otherwise its an underrun */ status = dev-endpoint[EP2I(ep)].iso_error; dev-endpoint[EP2I(ep)].iso_error = 0; -return usbredir_handle_status(dev, status, 0); +return status ? USB_RET_NAK : 0; } DPRINTF2(iso-token-in ep %02X status %d len %d queue-size: %d\n, ep, isop-status, isop-len, dev-endpoint[EP2I(ep)].bufpq_size); @@ -449,7 +449,7 @@ static int usbredir_handle_iso_data(USBRedirDevice *dev, USBPacket *p, status = isop-status; if (status != usb_redir_success) { bufp_free(dev, isop, ep); -return usbredir_handle_status(dev, status, 0); +return USB_RET_NAK; } len = isop-len; -- 1.7.7.6
[Qemu-devel] [PATCH 3/6] usb-redir: Let the usb-host know about our device filtering
libusbredirparser-0.3.4 adds 2 new packets which allows us to notify the usb-host: -about the usb device filter we have (if any), so that it knows not the even try to redirect certain devices -when we reject a device based on filtering (in case it tries anyways) Signed-off-by: Hans de Goede hdego...@redhat.com --- configure |2 +- usb-redir.c | 20 2 files changed, 21 insertions(+), 1 deletions(-) diff --git a/configure b/configure index c7e37df..a4848a4 100755 --- a/configure +++ b/configure @@ -2541,7 +2541,7 @@ fi # check for usbredirparser for usb network redirection support if test $usb_redir != no ; then -if $pkg_config --atleast-version=0.3.3 libusbredirparser /dev/null 21 ; then +if $pkg_config --atleast-version=0.3.4 libusbredirparser /dev/null 21 ; then usb_redir=yes usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2/dev/null) usb_redir_libs=$($pkg_config --libs libusbredirparser 2/dev/null) diff --git a/usb-redir.c b/usb-redir.c index fe3b0a3..d10d8de 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -106,6 +106,7 @@ struct AsyncURB { QTAILQ_ENTRY(AsyncURB)next; }; +static void usbredir_hello(void *priv, struct usb_redir_hello_header *h); static void usbredir_device_connect(void *priv, struct usb_redir_device_connect_header *device_connect); static void usbredir_device_disconnect(void *priv); @@ -812,6 +813,7 @@ static void usbredir_open_close_bh(void *opaque) dev-parser-log_func = usbredir_log; dev-parser-read_func = usbredir_read; dev-parser-write_func = usbredir_write; +dev-parser-hello_func = usbredir_hello; dev-parser-device_connect_func = usbredir_device_connect; dev-parser-device_disconnect_func = usbredir_device_disconnect; dev-parser-interface_info_func = usbredir_interface_info; @@ -830,6 +832,7 @@ static void usbredir_open_close_bh(void *opaque) dev-read_buf_size = 0; usbredirparser_caps_set_cap(caps, usb_redir_cap_connect_device_version); +usbredirparser_caps_set_cap(caps, usb_redir_cap_filter); usbredirparser_init(dev-parser, VERSION, caps, USB_REDIR_CAPS_SIZE, 0); usbredirparser_do_write(dev-parser); } @@ -1018,6 +1021,10 @@ static int usbredir_check_filter(USBRedirDevice *dev) error: usbredir_device_disconnect(dev); +if (usbredirparser_peer_has_cap(dev-parser, usb_redir_cap_filter)) { +usbredirparser_send_filter_reject(dev-parser); +usbredirparser_do_write(dev-parser); +} return -1; } @@ -1043,6 +1050,19 @@ static int usbredir_handle_status(USBRedirDevice *dev, } } +static void usbredir_hello(void *priv, struct usb_redir_hello_header *h) +{ +USBRedirDevice *dev = priv; + +/* Try to send the filter info now that we've the usb-host's caps */ +if (usbredirparser_peer_has_cap(dev-parser, usb_redir_cap_filter) +dev-filter_rules) { +usbredirparser_send_filter_filter(dev-parser, dev-filter_rules, + dev-filter_rules_count); +usbredirparser_do_write(dev-parser); +} +} + static void usbredir_device_connect(void *priv, struct usb_redir_device_connect_header *device_connect) { -- 1.7.7.6
[Qemu-devel] [PATCH 6/6] usb-ehci: Handle ISO packets failing with an error other then NAK
Before this patch the ehci code was not checking for any other errors other then USB_RET_NAK. This causes 2 problems: 1) Other errors are not reported to the guest. 2) When transactions with the ITD_XACT_IOC bit set completing with another error would not result in USBSTS_INT getting set. I hit this problem when unplugging devices while iso data was streaming from the device to the guest. When this happens it takes a while for the guest to process the unplugging and remove ISO transactions from the ehci schedule, in the mean time these transactions would complete with a result of USB_RET_NODEV, which was not handled. This lead to the Linux guest's usb subsystem hanging, that is it would no longer see new usb devices getting plugged in and running for example lsusb would lead to a stuck (D state) lsusb process. This patch fixes this. Signed-off-by: Hans de Goede hdego...@redhat.com --- hw/usb-ehci.c | 22 +++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c index 69bcc4b..a6b6ae5 100644 --- a/hw/usb-ehci.c +++ b/hw/usb-ehci.c @@ -1512,11 +1512,27 @@ static int ehci_process_itd(EHCIState *ehci, /* IN */ set_field(itd-transact[i], ret, ITD_XACT_LENGTH); } - -if (itd-transact[i] ITD_XACT_IOC) { -ehci_record_interrupt(ehci, USBSTS_INT); +} else { +switch (ret) { +default: +fprintf(stderr, Unexpected iso usb result: %d\n, ret); +/* Fall through */ +case USB_RET_NODEV: +/* 3.3.2: XACTERR is only allowed on IN transactions */ +if (dir) { +itd-transact[i] |= ITD_XACT_XACTERR; +ehci_record_interrupt(ehci, USBSTS_ERRINT); +} +break; +case USB_RET_BABBLE: +itd-transact[i] |= ITD_XACT_BABBLE; +ehci_record_interrupt(ehci, USBSTS_ERRINT); +break; } } +if (itd-transact[i] ITD_XACT_IOC) { +ehci_record_interrupt(ehci, USBSTS_INT); +} itd-transact[i] = ~ITD_XACT_ACTIVE; } } -- 1.7.7.6
[Qemu-devel] [PATCH 2/4] libcacard: link with glib for g_strndup
Without it the produced library for make libcacard.la has an unresolved symbol. Signed-off-by: Alon Levy al...@redhat.com --- configure |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 9535f66..88c5fd9 100755 --- a/configure +++ b/configure @@ -2571,8 +2571,8 @@ if test $smartcard != no ; then int main(void) { PK11_FreeSlot(0); return 0; } EOF smartcard_cflags=-I\$(SRC_PATH)/libcacard -libcacard_libs=$($pkg_config --libs nss 2/dev/null) -libcacard_cflags=$($pkg_config --cflags nss 2/dev/null) +libcacard_libs=$($pkg_config --libs nss 2/dev/null) $glib_libs +libcacard_cflags=$($pkg_config --cflags nss 2/dev/null) $glib_cflags if $pkg_config --atleast-version=3.12.8 nss /dev/null 21 \ compile_prog $smartcard_cflags $libcacard_cflags $libcacard_libs; then smartcard_nss=yes -- 1.7.9.1
[Qemu-devel] [PATCH 1/4] usb-desc: fix user trigerrable segfaults (!config)
Check for dev-config being NULL in two places: USB_REQ_GET_CONFIGURATION and USB_REQ_GET_STATUS. The behavior of USB_REQ_GET_STATUS is unspecified in the Default state, that corresponds to dev-config being NULL (it defaults to NULL and is reset whenever a SET_CONFIGURATION with value 0, or attachment). I implemented it to correspond with the state before ed5a83ddd8c1d8ec7b1015315530cf29949e7c48, the commit moving SET_STATUS to usb-desc; if dev-config is not set we return whatever is in the first configuration. The behavior of USB_REQ_GET_CONFIGURATION is also undefined before any SET_CONFIGURATION, but here we just return 0 (same as specified for the Address state). A win7 guest failed to initialize the device before this patch, segfaulting when GET_STATUS was called with dev-config == NULL. With this patch the passthrough device still doesn't work but the failure is unrelated. Signed-off-by: Alon Levy al...@redhat.com --- hw/usb-desc.c | 20 +--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/hw/usb-desc.c b/hw/usb-desc.c index 3c3ed6a..ccf85ad 100644 --- a/hw/usb-desc.c +++ b/hw/usb-desc.c @@ -536,7 +536,11 @@ int usb_desc_handle_control(USBDevice *dev, USBPacket *p, break; case DeviceRequest | USB_REQ_GET_CONFIGURATION: -data[0] = dev-config-bConfigurationValue; +/* + * 9.4.2: 0 should be returned if the device is unconfigured, otherwise + * the non zero value of bConfigurationValue. + */ +data[0] = dev-config ? dev-config-bConfigurationValue : 0; ret = 1; break; case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: @@ -544,9 +548,18 @@ int usb_desc_handle_control(USBDevice *dev, USBPacket *p, trace_usb_set_config(dev-addr, value, ret); break; -case DeviceRequest | USB_REQ_GET_STATUS: +case DeviceRequest | USB_REQ_GET_STATUS: { +const USBDescConfig *config = dev-config ? +dev-config : dev-device-confs[0]; + data[0] = 0; -if (dev-config-bmAttributes 0x40) { +/* + * Default state: Device behavior when this request is received while + *the device is in the Default state is not specified. + * We return the same value that a configured device would return if + * it used the first configuration. + */ +if (config-bmAttributes 0x40) { data[0] |= 1 USB_DEVICE_SELF_POWERED; } if (dev-remote_wakeup) { @@ -555,6 +568,7 @@ int usb_desc_handle_control(USBDevice *dev, USBPacket *p, data[1] = 0x00; ret = 2; break; +} case DeviceOutRequest | USB_REQ_CLEAR_FEATURE: if (value == USB_DEVICE_REMOTE_WAKEUP) { dev-remote_wakeup = 0; -- 1.7.9.1
[Qemu-devel] [PATCH 3/4] usb-ccid: advertise SELF_POWERED
Before commit ed5a83ddd8c1d8ec7b1015315530cf29949e7c48 each device provided it's own response to USB_REQ_GET_STATUS, but after it that response was based on bmAttributes, which was errounously set for usb-ccid as 0xa0 and not 0xe0. Signed-off-by: Alon Levy al...@redhat.com --- hw/usb-ccid.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c index 0b2ac80..ce01e34 100644 --- a/hw/usb-ccid.c +++ b/hw/usb-ccid.c @@ -447,7 +447,7 @@ static const USBDescDevice desc_device = { { .bNumInterfaces= 1, .bConfigurationValue = 1, -.bmAttributes = 0xa0, +.bmAttributes = 0xe0, .bMaxPower = 50, .nif = 1, .ifs = desc_iface0, -- 1.7.9.1
Re: [Qemu-devel] [PATCH 1/4] usb-desc: fix user trigerrable segfaults (!config)
On Sun, Feb 26, 2012 at 05:09:21PM +0100, Alon Levy wrote: Check for dev-config being NULL in two places: USB_REQ_GET_CONFIGURATION and USB_REQ_GET_STATUS. The behavior of USB_REQ_GET_STATUS is unspecified in the Default state, that corresponds to dev-config being NULL (it defaults to NULL and is reset whenever a SET_CONFIGURATION with value 0, or attachment). I implemented it to correspond with the state before ed5a83ddd8c1d8ec7b1015315530cf29949e7c48, the commit moving SET_STATUS to usb-desc; if dev-config is not set we return whatever is in the first configuration. The behavior of USB_REQ_GET_CONFIGURATION is also undefined before any SET_CONFIGURATION, but here we just return 0 (same as specified for the Address state). A win7 guest failed to initialize the device before this patch, s/the device/a usb-ccid device/ Using the default win7 smartcard driver. segfaulting when GET_STATUS was called with dev-config == NULL. With this patch the passthrough device still doesn't work but the failure is unrelated. Signed-off-by: Alon Levy al...@redhat.com --- hw/usb-desc.c | 20 +--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/hw/usb-desc.c b/hw/usb-desc.c index 3c3ed6a..ccf85ad 100644 --- a/hw/usb-desc.c +++ b/hw/usb-desc.c @@ -536,7 +536,11 @@ int usb_desc_handle_control(USBDevice *dev, USBPacket *p, break; case DeviceRequest | USB_REQ_GET_CONFIGURATION: -data[0] = dev-config-bConfigurationValue; +/* + * 9.4.2: 0 should be returned if the device is unconfigured, otherwise + * the non zero value of bConfigurationValue. + */ +data[0] = dev-config ? dev-config-bConfigurationValue : 0; ret = 1; break; case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: @@ -544,9 +548,18 @@ int usb_desc_handle_control(USBDevice *dev, USBPacket *p, trace_usb_set_config(dev-addr, value, ret); break; -case DeviceRequest | USB_REQ_GET_STATUS: +case DeviceRequest | USB_REQ_GET_STATUS: { +const USBDescConfig *config = dev-config ? +dev-config : dev-device-confs[0]; + data[0] = 0; -if (dev-config-bmAttributes 0x40) { +/* + * Default state: Device behavior when this request is received while + *the device is in the Default state is not specified. + * We return the same value that a configured device would return if + * it used the first configuration. + */ +if (config-bmAttributes 0x40) { data[0] |= 1 USB_DEVICE_SELF_POWERED; } if (dev-remote_wakeup) { @@ -555,6 +568,7 @@ int usb_desc_handle_control(USBDevice *dev, USBPacket *p, data[1] = 0x00; ret = 2; break; +} case DeviceOutRequest | USB_REQ_CLEAR_FEATURE: if (value == USB_DEVICE_REMOTE_WAKEUP) { dev-remote_wakeup = 0; -- 1.7.9.1
[Qemu-devel] [PATCH 4/4] libcacard: fix reported ATR length
Signed-off-by: Alon Levy al...@redhat.com --- libcacard/vcardt.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libcacard/vcardt.h b/libcacard/vcardt.h index 538bdde..d4d8e2e 100644 --- a/libcacard/vcardt.h +++ b/libcacard/vcardt.h @@ -26,8 +26,8 @@ typedef struct VCardEmulStruct VCardEmul; #define MAX_CHANNEL 4 /* create an ATR with appropriate historical bytes */ -#define VCARD_ATR_PREFIX(size) 0x3b, 0x66+(size), 0x00, 0xff, \ - 'V', 'C', 'A', 'R', 'D', '_' +#define VCARD_ATR_PREFIX(size) (0x3b, 0x68+(size), 0x00, 0xff, \ + 'V', 'C', 'A', 'R', 'D', '_') typedef enum { -- 1.7.9.1
Re: [Qemu-devel] [PATCH] Fix spelling in comments (iff - if)
On 02/26/2012 07:39 AM, Stefan Weil wrote: Signed-off-by: Stefan Weils...@weilnetz.de --- a.out.h|2 +- arm-dis.c | 22 +++--- block.c|2 +- block/qcow2-refcount.c |4 ++-- hw/alpha_typhoon.c |2 +- hw/hid.h |2 +- hw/pcnet.c |2 +- m68k-dis.c |4 ++-- memory.h |4 ++-- monitor.c |2 +- net/socket.c |2 +- qemu-img.c |2 +- tcg/hppa/tcg-target.c |6 +++--- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/a.out.h b/a.out.h index 33ca7f7..7ea8d5a 100644 --- a/a.out.h +++ b/a.out.h @@ -136,7 +136,7 @@ struct external_scnhdr { */ struct external_lineno { union { -host_ulong l_symndx; /* function name symbol index, iff l_lnno 0 */ I don't know if this is the intention but this may be short hand for 'if and only if'. I do use this short hand quite a bit myself. http://en.wikipedia.org/wiki/If_and_only_if Regards, Anthony Liguori
Re: [Qemu-devel] qemu.org wiki account
On Sat, Feb 25, 2012 at 2:41 PM, Hans de Goede hdego...@redhat.com wrote: I wanted to add a summer of code idea to: http://wiki.qemu.org/Google_Summer_of_Code_2012 But I cannot find an obvious way to create an account. So did I miss the obvious way? Or do I need someone to do it for me? I created an account for you, please see the off-list message for your login details. Thanks for proposing a GSoC idea! Stefan
Re: [Qemu-devel] [PATCH] Spelling fixes in comments (it's - its)
Am 26.02.2012 14:35, schrieb Stefan Weil: * it's - its (fixed for all files) * dont - don't (only fixed in a line which was touched by the previous fix) Signed-off-by: Stefan Weil s...@weilnetz.de Reviewed-by: Andreas Färber afaer...@suse.de Except for one omission: --- configure |2 +- hw/exynos4210_mct.c |2 +- hw/usb-ccid.c |2 +- include/qemu/object.h |4 ++-- kvm-all.c |2 +- libcacard/vscclient.c |2 +- linux-user/signal.c |2 +- qemu-file.h |2 +- target-mips/op_helper.c |2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index c51b9cb..7d6773d 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c @@ -1930,7 +1930,7 @@ target_ulong helper_evpe(void) do { if (other_cpu != env - /* If the VPE is WFI, dont distrub it's sleep. */ + /* If the VPE is WFI, don't distrub its sleep. */ While at it, please also fix disturb. :) Also I've generally wondered if there is a reason for having two spaces before */? Some do, some don't. Andreas !mips_vpe_is_wfi(other_cpu)) { /* Enable the VPE. */ other_cpu-mvp-CP0_MVPControl |= (1 CP0MVPCo_EVP); -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PULL 00/12] target-xtensa queue
Hi. This is a pull request for my current target-xtensa queue. Changes in the queue are: - 'info tlb' monitor command; - debug option implementation; - a few minor fixes. ping? Debug option series has been posted to the list as an RFC, there were no changes in it since then. Please pull. Thanks. -- Max The following changes since commit 99c7f87826337fa81f2f0f9baa9ca0a44faf90e9: input: send kbd+mouse events only to running guests. (2012-02-17 11:02:55 -0600) are available in the git repository at: git://jcmvbkbc.spb.ru/dumb/qemu-xtensa.git xtensa Max Filippov (12): target-xtensa: define TLB_TEMPLATE for MMU-less cores target-xtensa: implement info tlb monitor command target-xtensa: fetch 3rd opcode byte only when needed target-xtensa: add DEBUGCAUSE SR and configuration target-xtensa: implement instruction breakpoints target-xtensa: add ICOUNT SR and debug exception exec: add missing breaks to the watch_mem_write exec: fix check_watchpoint exiting cpu_loop exec: let cpu_watchpoint_insert accept larger watchpoints target-xtensa: add DBREAK data breakpoints target-xtensa: add DEBUG_SECTION to overlay tool target-xtensa: add breakpoint tests exec.c | 18 +++- hmp-commands.hx | 2 +- monitor.c | 4 +- target-xtensa/core-dc232b.c | 1 + target-xtensa/core-fsf.c | 1 + target-xtensa/cpu.h | 43 target-xtensa/helper.c | 110 target-xtensa/helpers.h | 7 ++ target-xtensa/op_helper.c | 100 ++ target-xtensa/overlay_tool.h | 23 - target-xtensa/translate.c | 156 - tests/tcg/xtensa/Makefile | 1 + tests/tcg/xtensa/test_break.S | 223 + 13 files changed, 674 insertions(+), 15 deletions(-) create mode 100644 tests/tcg/xtensa/test_break.S -- 1.7.7.6 -- Thanks. -- Max
[Qemu-devel] [PULL] VirtFS update
Hi Anthony, Please pull the below VirtFS update -aneesh The following changes since commit 235fe3bfd46b1104575b540d0bc3fdf584030b99: qom: add test tools (2012-02-22 12:18:26 -0600) are available in the git repository at: git://github.com/kvaneesh/QEMU.git for-upstream for you to fetch changes up to 67d6fa53629f1eb3401974d740310c10e03fa1c9: hw/9pfs: Endian fixes for virtfs (2012-02-24 14:01:19 +0530) Benjamin Herrenschmidt (1): hw/9pfs: Endian fixes for virtfs Meador Inge (1): ./configure: add option for disabling VirtFS Makefile|2 ++ configure | 25 +++-- hw/9pfs/virtio-9p.c |8 +--- 3 files changed, 26 insertions(+), 9 deletions(-)
[Qemu-devel] [PATCH 2/2] hw/9pfs: Endian fixes for virtfs
From: Benjamin Herrenschmidt b...@kernel.crashing.org This patch fixes several endian bugs in virtfs. Cc: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: David Gibson da...@gibson.dropbear.id.au Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- hw/9pfs/virtio-9p.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index a72ffc3..c633fb9 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -1349,7 +1349,9 @@ static void v9fs_open(void *opaque) if (s-proto_version == V9FS_PROTO_2000L) { err = pdu_unmarshal(pdu, offset, dd, fid, mode); } else { -err = pdu_unmarshal(pdu, offset, db, fid, mode); +uint8_t modebyte; +err = pdu_unmarshal(pdu, offset, db, fid, modebyte); +mode = modebyte; } if (err 0) { goto out_nofid; @@ -3260,9 +3262,9 @@ void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) ptr = pdu-elem.out_sg[0].iov_base; -memcpy(pdu-size, ptr, 4); +pdu-size = le32_to_cpu(*(uint32_t *)ptr); pdu-id = ptr[4]; -memcpy(pdu-tag, ptr + 5, 2); +pdu-tag = le16_to_cpu(*(uint16_t *)(ptr + 5)); qemu_co_queue_init(pdu-complete); submit_pdu(s, pdu); } -- 1.7.9
[Qemu-devel] [PATCH 1/2] ./configure: add option for disabling VirtFS
From: Meador Inge mead...@codesourcery.com Signed-off-by: Meador Inge mead...@codesourcery.com Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- Makefile |2 ++ configure | 25 +++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c67493e..ac82afe 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,9 @@ HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF) ifdef BUILD_DOCS DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt +ifdef CONFIG_VIRTFS DOCS+=fsdev/virtfs-proxy-helper.1 +endif else DOCS= endif diff --git a/configure b/configure index 037f7f7..05a778d 100755 --- a/configure +++ b/configure @@ -121,6 +121,7 @@ docs= fdt= nptl= sdl= +virtfs= vnc=yes sparse=no uuid= @@ -586,6 +587,10 @@ for opt do ;; --enable-sdl) sdl=yes ;; + --disable-virtfs) virtfs=no + ;; + --enable-virtfs) virtfs=yes + ;; --disable-vnc) vnc=no ;; --enable-vnc) vnc=yes @@ -993,6 +998,8 @@ echo --disable-strip disable stripping binaries echo --disable-werror disable compilation abort on warning echo --disable-sdldisable SDL echo --enable-sdl enable SDL +echo --disable-virtfs disable VirtFS +echo --enable-virtfs enable VirtFS echo --disable-vncdisable VNC echo --enable-vnc enable VNC echo --enable-cocoa enable COCOA (Mac OS X only) @@ -2805,8 +2812,15 @@ confdir=$sysconfdir$confsuffix tools= if test $softmmu = yes ; then tools=qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools - if [ $cap = yes -a $linux = yes ] ; then - tools=$tools fsdev/virtfs-proxy-helper\$(EXESUF) + if test $virtfs != no ; then + if test $cap = yes test $linux = yes test $attr = yes ; then + virtfs=yes + tools=$tools fsdev/virtfs-proxy-helper\$(EXESUF) + else + if test $virtfs = yes; then + feature_not_found virtfs + fi + fi fi if [ $linux = yes -o $bsd = yes -o $solaris = yes ] ; then tools=qemu-nbd\$(EXESUF) $tools @@ -2871,6 +2885,7 @@ echo Audio drivers $audio_drv_list echo Extra audio cards $audio_card_list echo Block whitelist $block_drv_whitelist echo Mixer emulation $mixemu +echo VirtFS support$virtfs echo VNC support $vnc if test $vnc = yes ; then echo VNC TLS support $vnc_tls @@ -3160,10 +3175,8 @@ fi if test $libattr = yes ; then echo CONFIG_LIBATTR=y $config_host_mak fi -if test $linux = yes ; then - if test $attr = yes ; then -echo CONFIG_VIRTFS=y $config_host_mak - fi +if test $virtfs = yes ; then + echo CONFIG_VIRTFS=y $config_host_mak fi if test $blobs = yes ; then echo INSTALL_BLOBS=yes $config_host_mak -- 1.7.9
[Qemu-devel] [PATCH v2] Spelling fixes in comments (it's - its)
* it's - its (fixed for all files) * dont - don't (only fixed in a line which was touched by the previous fix) * distrub - disturb (fixed in the same line) Reviewed-by: Andreas Färber afaer...@suse.de Signed-off-by: Stefan Weil s...@weilnetz.de --- This 2nd version of the patch added the fix for 'distrub' as suggested by Andreas Färber. configure |2 +- hw/exynos4210_mct.c |2 +- hw/usb-ccid.c |2 +- include/qemu/object.h |4 ++-- kvm-all.c |2 +- libcacard/vscclient.c |2 +- linux-user/signal.c |2 +- qemu-file.h |2 +- target-mips/op_helper.c |2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/configure b/configure index c6c863a..5c46f1c 100755 --- a/configure +++ b/configure @@ -231,7 +231,7 @@ for opt do done # OS specific # Using uname is really, really broken. Once we have the right set of checks -# we can eliminate it's usage altogether +# we can eliminate its usage altogether. cc=${CC-${cross_prefix}gcc} ar=${AR-${cross_prefix}ar} diff --git a/hw/exynos4210_mct.c b/hw/exynos4210_mct.c index 01e3fb8..7474fcf 100644 --- a/hw/exynos4210_mct.c +++ b/hw/exynos4210_mct.c @@ -888,7 +888,7 @@ static void exynos4210_ltick_event(void *opaque) static uint64_t time2[2] = {0}; #endif -/* Call tick_timer event handler, it will update it's tcntb and icntb */ +/* Call tick_timer event handler, it will update its tcntb and icntb. */ exynos4210_ltick_timer_event(s-tick_timer); /* get tick_timer cnt */ diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c index 0b2ac80..6ddcba7 100644 --- a/hw/usb-ccid.c +++ b/hw/usb-ccid.c @@ -5,7 +5,7 @@ * * Written by Alon Levy, with contributions from Robert Relyea. * - * Based on usb-serial.c, see it's copyright and attributions below. + * Based on usb-serial.c, see its copyright and attributions below. * * This work is licensed under the terms of the GNU GPL, version 2.1 or later. * See the COPYING file in the top-level directory. diff --git a/include/qemu/object.h b/include/qemu/object.h index dd7f3c0..ec2d294 100644 --- a/include/qemu/object.h +++ b/include/qemu/object.h @@ -124,7 +124,7 @@ typedef struct InterfaceInfo InterfaceInfo; * * Once all of the parent classes have been initialized, #TypeInfo::class_init * is called to let the class being instantiated provide default initialize for - * it's virtual functions. Here is how the above example might be modified + * its virtual functions. Here is how the above example might be modified * to introduce an overridden virtual function: * * example @@ -527,7 +527,7 @@ Type type_register_static(const TypeInfo *info); * type_register: * @info: The #TypeInfo of the new type * - * Unlike type_register_static(), this call does not require @info or it's + * Unlike type_register_static(), this call does not require @info or its * string members to continue to exist after the call returns. * * Returns: 0 on failure, the new #Type on success. diff --git a/kvm-all.c b/kvm-all.c index c4babda..0729020 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -34,7 +34,7 @@ #include sys/eventfd.h #endif -/* KVM uses PAGE_SIZE in it's definition of COALESCED_MMIO_MAX */ +/* KVM uses PAGE_SIZE in its definition of COALESCED_MMIO_MAX */ #define PAGE_SIZE TARGET_PAGE_SIZE //#define DEBUG_KVM diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c index e317a25..4fbcc89 100644 --- a/libcacard/vscclient.c +++ b/libcacard/vscclient.c @@ -129,7 +129,7 @@ event_thread(void *arg) vevent_delete(event); continue; } -/* this reader hasn't been told it's status from qemu yet, wait for +/* this reader hasn't been told its status from qemu yet, wait for * that status */ while (pending_reader != NULL) { qemu_cond_wait(pending_reader_condition, pending_reader_lock); diff --git a/linux-user/signal.c b/linux-user/signal.c index 79a39dc..cefd2ff 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -2700,7 +2700,7 @@ get_sigframe(struct target_sigaction *ka, CPUState *regs, size_t frame_size) sp = regs-active_tc.gpr[29]; /* - * FPU emulator may have it's own trampoline active just + * FPU emulator may have its own trampoline active just * above the user stack, 16-bytes before the next lowest * 16 byte boundary. Try to avoid trashing it. */ diff --git a/qemu-file.h b/qemu-file.h index 8da1021..31b83f6 100644 --- a/qemu-file.h +++ b/qemu-file.h @@ -47,7 +47,7 @@ typedef int (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf, */ typedef int (QEMUFileCloseFunc)(void *opaque); -/* Called to determine if the file has exceeded it's bandwidth allocation. The +/* Called to determine if the file has exceeded its bandwidth allocation. The * bandwidth capping is a soft limit, not a hard limit. */ typedef int
Re: [Qemu-devel] [PATCH] libcacard: Spelling and grammar fixes in documentation
On 26 February 2012 13:30, Stefan Weil s...@weilnetz.de wrote: @@ -217,10 +217,10 @@ the card using the following functions: VCardStatus vcard_add_applet(VCard *card, VCardApplet *applet); Add an applet onto the list of applets attached to the card. Once an applet - has been added, it can be selected by it's aid, and then commands will be + has been added, it can be selected by its aid, and then commands will be While you're changing this line, it looks like 'aid' here should be 'AID' (it is capitalised elsewhere in the doc except where referring to a function parameter name). routed to it VCardProcessAPDU function. This function adopts the applet the passed int applet. The sentence This function... clearly needs correcting as it doesn't make much sense as it stands, but I'm not sure what it should be changed to. Note: 2 applets with the same AID should not be added to - the same card. It's permissible to add more than one applet. Multiple applets + the same card. It is permissible to add more than one applet. Multiple applets may have the same VCardPRocessAPDU entry point. -- PMM
Re: [Qemu-devel] [PATCH] libcacard: Spelling and grammar fixes in documentation
Am 26.02.2012 19:18, schrieb Peter Maydell: On 26 February 2012 13:30, Stefan Weils...@weilnetz.de wrote: @@ -217,10 +217,10 @@ the card using the following functions: VCardStatus vcard_add_applet(VCard *card, VCardApplet *applet); Add an applet onto the list of applets attached to the card. Once an applet - has been added, it can be selected by it's aid, and then commands will be + has been added, it can be selected by its aid, and then commands will be While you're changing this line, it looks like 'aid' here should be 'AID' (it is capitalised elsewhere in the doc except where referring to a function parameter name). routed to it VCardProcessAPDU function. This function adopts the applet the passed int applet. The sentence This function... clearly needs correcting as it doesn't make much sense as it stands, but I'm not sure what it should be changed to. Nor was I when I read that sentence, that's why I did not fix it :-) AID looks correct, so I'll send an update of my patch which fixes that, too. Thanks, Stefan Weil
Re: [Qemu-devel] [PATCH] Fix spelling in comments (iff - if)
Am 26.02.2012 17:39, schrieb Anthony Liguori: On 02/26/2012 07:39 AM, Stefan Weil wrote: Signed-off-by: Stefan Weils...@weilnetz.de --- a.out.h|2 +- arm-dis.c | 22 +++--- block.c|2 +- block/qcow2-refcount.c |4 ++-- hw/alpha_typhoon.c |2 +- hw/hid.h |2 +- hw/pcnet.c |2 +- m68k-dis.c |4 ++-- memory.h |4 ++-- monitor.c |2 +- net/socket.c |2 +- qemu-img.c |2 +- tcg/hppa/tcg-target.c |6 +++--- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/a.out.h b/a.out.h index 33ca7f7..7ea8d5a 100644 --- a/a.out.h +++ b/a.out.h @@ -136,7 +136,7 @@ struct external_scnhdr { */ struct external_lineno { union { -host_ulong l_symndx; /* function name symbol index, iff l_lnno 0 */ I don't know if this is the intention but this may be short hand for 'if and only if'. I do use this short hand quite a bit myself. http://en.wikipedia.org/wiki/If_and_only_if Regards, Anthony Liguori Thank you for this information which was new for me. I reviewed my own patch, and there are indeed some 'iff' which might be used for 'if and only if'. Others cannot have this meaning because there are several alternatives with the same result. For the description of function return values 'if and only if' also looks strange. Some comments just translate an if statement in text. Here 'if and only if' would not match the C code which only says 'if'. I'll send new patches for these different categories, then it will be easier to accept or reject them. Many authors regard iff as unsuitable in formal writing (citation from Wikipedia).Personally, I'd also prefer to see 'if and only if' in full length or in symbolic notation (==) when this is the intention, not an abbreviation like 'iff'. Regards, Stefan Weil
[Qemu-devel] [PATCH v2] libcacard: Spelling and grammar fixes in documentation
* it's - its * it's - it is (that's no fix, but makes future checks easier) * this functions - this function * replacable - replaceable * reader's - readers * logins into - logs into v2: Also replace 'aid' by 'AID' (thanks to Peter Maydell for this hint). Signed-off-by: Stefan Weil s...@weilnetz.de --- docs/libcacard.txt | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/libcacard.txt b/docs/libcacard.txt index f7d7519..1772733 100644 --- a/docs/libcacard.txt +++ b/docs/libcacard.txt @@ -10,7 +10,7 @@ such as signing, card removal/insertion, etc. are mapped to real, physical cards which are shared with the client machine the emulator is running on, or the cards could be pure software constructs. -The emulator is structured to allow multiple replacable or additional pieces, +The emulator is structured to allow multiple replaceable or additional pieces, so it can be easily modified for future requirements. The primary envisioned modifications are: @@ -32,7 +32,7 @@ be emulated as well, including PIV, newer versions of CAC, PKCS #15, etc. Replacing the Socket Based Virtual Reader Interface. -The current implementation contains a replacable module vscclient.c. The +The current implementation contains a replaceable module vscclient.c. The current vscclient.c implements a sockets interface to the virtual ccid reader on the guest. CCID commands that are pertinent to emulation are passed across the socket, and their responses are passed back along that same socket. @@ -42,7 +42,7 @@ implements a program with a main entry. It also handles argument parsing for the emulator. An application that wants to use the virtual reader can replace vscclient.c -with it's own implementation that connects to it's own CCID reader. The calls +with its own implementation that connects to its own CCID reader. The calls that the CCID reader can call are: VReaderList * vreader_get_reader_list(); @@ -72,12 +72,12 @@ that the CCID reader can call are: VReader * vreader_list_get_reader(VReaderListEntry *) This function returns the reader stored in the reader List entry. Caller gets - a new reference to a reader. The caller must free it's reference when it is + a new reference to a reader. The caller must free its reference when it is finished with vreader_free(). void vreader_free(VReader *reader); - This function frees a reference to a reader. Reader's are reference counted + This function frees a reference to a reader. Readers are reference counted and are automatically deleted when the last reference is freed. void vreader_list_delete(VReaderList *list); @@ -87,7 +87,7 @@ that the CCID reader can call are: VReaderStatus vreader_power_on(VReader *reader, char *atr, int *len); - This functions simulates a card power on. Virtual cards do not care about + This function simulates a card power on. A virtual card does not care about the actual voltage and other physical parameters, but it does care that the card is actually on or off. Cycling the card causes the card to reset. If the caller provides enough space, vreader_power_on will return the ATR of @@ -104,7 +104,7 @@ that the CCID reader can call are: unsigned char *receive_buf, int receive_buf_len); - This functions send a raw apdu to a card and returns the card's response. + This function sends a raw apdu to a card and returns the card's response. The CCID front end should return the response back. Most of the emulation is driven from these APDUs. @@ -217,10 +217,10 @@ the card using the following functions: VCardStatus vcard_add_applet(VCard *card, VCardApplet *applet); Add an applet onto the list of applets attached to the card. Once an applet - has been added, it can be selected by it's aid, and then commands will be + has been added, it can be selected by its AID, and then commands will be routed to it VCardProcessAPDU function. This function adopts the applet the passed int applet. Note: 2 applets with the same AID should not be added to - the same card. It's permissible to add more than one applet. Multiple applets + the same card. It is permissible to add more than one applet. Multiple applets may have the same VCardPRocessAPDU entry point. The certs and keys should be attached to private data associated with one or @@ -335,7 +335,7 @@ and applet. VCard7816Status vcard_emul_login(VCard *card, unsigned char *pin, int pin_len); -This function logins into the card and return the standard 7816 status +This function logs into the card and returns the standard 7816 status word depending on the success or failure of the call. void vcard_emul_delete_key(VCardKey *key); @@ -424,7 +424,7 @@ functions:
Re: [Qemu-devel] [PATCH] Fix spelling in comments (iff - if)
On 26 February 2012 18:58, Stefan Weil s...@weilnetz.de wrote: Many authors regard iff as unsuitable in formal writing (citation from Wikipedia).Personally, I'd also prefer to see 'if and only if' in full length or in symbolic notation (==) when this is the intention, not an abbreviation like 'iff'. Yes, I used to use 'iff' (a hangover from having studied maths...) but I now think that outside those fields it's too easy for a reader to confuse it with a typo for 'if' and so it's better avoided (by using if when that's OK and expanding to if and only if in the odd cases where the distinction actually matters.) -- PMM
[Qemu-devel] [PATCH v2 0/2] Group Live Snapshots
This patchset adds the ability to take a snapshot of a group of devices, rather than each device individually. Upon failure of any snapshot, all snapshots taken by the command will be abandoned, and the appropriate failure code returned. This differs from v1 in that: * The QAPI input mechanism for JSON-arrays of qdict items is now used correctly, and there is no modification of the existing monitor code. This drops the original patch 1 from v1. * Rather than use bdrv_close() and bdrv_open() to pivot the snapshot, the fields of the BlockDriverState are manipulated so that there are no irrecoverable failure points in the snapshot process. This is based on a suggestion by Kevin Wolf. * The qapi block code was broken out into patch 1/2, and the QMP command placed patch 2/2 * Since there are no irrecoverable error points, there is a no need for a command to return a list of failures. There is at most one failure to report, which is the first failure encountered. In light of that, patch 3 from v1 was dropped. Some things for careful review: In patch 1/2, in the new bdrv_append() function: * Are all of the relevant fields preserved in the top bs? (see 'bdrv_append()') * Conversely, are any of the fields being preserved that should not be? * Are there race condition concerns at the end of bdrv_append(), at the line '*bs_top = tmp;', which replaces the contents of the current top bs? Jeff Cody (2): qapi: Introduce blockdev-group-snapshot-sync command QMP: Add qmp command for blockdev-group-snapshot-sync block.c | 47 block.h |1 + blockdev.c | 128 ++ qapi-schema.json | 38 qmp-commands.hx | 39 5 files changed, 253 insertions(+), 0 deletions(-) -- 1.7.9.rc2.1.g69204
[Qemu-devel] [PATCH v2 1/2] qapi: Introduce blockdev-group-snapshot-sync command
This is a QAPI/QMP only command to take a snapshot of a group of devices. This is similar to the blockdev-snapshot-sync command, except blockdev-group-snapshot-sync accepts a list devices, filenames, and formats. It is attempted to keep the snapshot of the group atomic; if the creation or open of any of the new snapshots fails, then all of the new snapshots are abandoned, and the name of the snapshot image that failed is returned. The failure case should not interrupt any operations. Rather than use bdrv_close() along with a subsequent bdrv_open() to perform the pivot, the original image is never closed and the new image is placed 'in front' of the original image via manipulation of the BlockDriverState fields. Thus, once the new snapshot image has been successfully created, there are no more failure points before pivoting to the new snapshot. This allows the group of disks to remain consistent with each other, even across snapshot failures. Signed-off-by: Jeff Cody jc...@redhat.com --- block.c | 47 block.h |1 + blockdev.c | 128 ++ qapi-schema.json | 38 4 files changed, 214 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c index 3621d11..0045ab1 100644 --- a/block.c +++ b/block.c @@ -880,6 +880,53 @@ void bdrv_make_anon(BlockDriverState *bs) bs-device_name[0] = '\0'; } +/* + * Add new bs contents at the top of an image chain while the chain is live, + * while keeping required fields on the top layer. + * + * It is assumed that bs_new already points to an existing image, + * with the correct backing filename of top-backing_file + */ +void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top) +{ +BlockDriverState tmp; + +/* the new bs must not be in bdrv_states */ +bdrv_make_anon(bs_new); + +tmp = *bs_new; +tmp.backing_hd = bs_new; + +/* there are some fields that need to stay on the top layer: */ + +/* dev info */ +tmp.dev_ops = bs_top-dev_ops; +tmp.dev_opaque = bs_top-dev_opaque; +tmp.dev = bs_top-dev; +tmp.buffer_alignment = bs_top-buffer_alignment; +tmp.copy_on_read = bs_top-copy_on_read; + +/* i/o timing parameters */ +tmp.slice_time= bs_top-slice_time; +tmp.slice_start = bs_top-slice_start; +tmp.slice_end = bs_top-slice_end; +tmp.io_limits = bs_top-io_limits; +tmp.io_base = bs_top-io_base; +tmp.throttled_reqs= bs_top-throttled_reqs; +tmp.block_timer = bs_top-block_timer; +tmp.io_limits_enabled = bs_top-io_limits_enabled; + +/* keep the same entry in bdrv_states */ +pstrcpy(tmp.device_name, sizeof(tmp.device_name), bs_top-device_name); +tmp.list = bs_top-list; + +/* swap contents of the fixed new bs and the current top */ +*bs_new = *bs_top; +*bs_top = tmp; + +bdrv_detach_dev(bs_new, bs_new-dev); +} + void bdrv_delete(BlockDriverState *bs) { assert(!bs-dev); diff --git a/block.h b/block.h index cae289b..190a780 100644 --- a/block.h +++ b/block.h @@ -114,6 +114,7 @@ int bdrv_create(BlockDriver *drv, const char* filename, int bdrv_create_file(const char* filename, QEMUOptionParameter *options); BlockDriverState *bdrv_new(const char *device_name); void bdrv_make_anon(BlockDriverState *bs); +void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top); void bdrv_delete(BlockDriverState *bs); int bdrv_parse_cache_flags(const char *mode, int *flags); int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags); diff --git a/blockdev.c b/blockdev.c index 05e7c5e..560f7e8 100644 --- a/blockdev.c +++ b/blockdev.c @@ -714,6 +714,134 @@ void qmp_blockdev_snapshot_sync(const char *device, const char *snapshot_file, } } + +/* New and old BlockDriverState structs for group snapshots */ +typedef struct BlkGroupSnapshotStates { +BlockDriverState *old_bs; +BlockDriverState *new_bs; +bool is_open; +QSIMPLEQ_ENTRY(BlkGroupSnapshotStates) entry; +} BlkGroupSnapshotStates; + +/* + * 'Atomic' group snapshots. The snapshots are taken as a set, and if any fail + * then we do not pivot any of the devices in the group, and abandon the + * snapshots + */ +void qmp_blockdev_group_snapshot_sync(SnapshotDevList *dev_list, + Error **errp) +{ +int ret = 0; +SnapshotDevList *dev_entry = dev_list; +SnapshotDev *dev_info = NULL; +BlkGroupSnapshotStates *states; +BlockDriver *proto_drv; +BlockDriver *drv; +int flags; +const char *format; +const char *snapshot_file; + +QSIMPLEQ_HEAD(snap_bdrv_states, BlkGroupSnapshotStates) snap_bdrv_states; +QSIMPLEQ_INIT(snap_bdrv_states); + +/* We don't do anything in this loop that commits us to the snapshot */ +while (NULL != dev_entry) { +dev_info = dev_entry-value; +
[Qemu-devel] [PATCH v2 2/2] QMP: Add qmp command for blockdev-group-snapshot-sync
This adds the QMP command for blockdev-group-snapshot-sync. It takes an array in as the input, for the argument devlist. The array consists of the following elements: + device:device to snapshot. e.g. ide-hd0, virtio0 + snapshot-file: path file for the snapshot image. e.g. /tmp/file.img + format:snapshot format. e.g., qcow2. Optional There is no HMP equivalent for the command. Signed-off-by: Jeff Cody jc...@redhat.com --- qmp-commands.hx | 39 +++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/qmp-commands.hx b/qmp-commands.hx index bd6b641..365489c 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -665,6 +665,45 @@ EQMP .args_type = device:B, .mhandler.cmd_new = qmp_marshal_input_block_job_cancel, }, +{ +.name = blockdev-group-snapshot-sync, +.args_type = devlist:O, +.params = device:B,snapshot-file:s,format:s?, +.mhandler.cmd_new = qmp_marshal_input_blockdev_group_snapshot_sync, +}, + +SQMP +blockdev-group-snapshot-sync +-- + +Synchronous snapshot of one or more block devices. A list array input +is accepted, that contains the device and snapshot file information for +each device in group. The default format, if not specified, is qcow2. + +If there is any failure creating or opening a new snapshot, all snapshots +for the group are abandoned, and the original disks pre-snapshot attempt +are used. + + +Arguments: + +devlist array: +- device: device name to snapshot (json-string) +- snapshot-file: name of new image file (json-string) +- format: format of new image (json-string, optional) + +Example: + +- { execute: blockdev-group-snapshot-sync, arguments: + { devlist: [{ device: ide-hd0, + snapshot-file: /some/place/my-image, + format: qcow2 }, +{ device: ide-hd1, + snapshot-file: /some/place/my-image2, + format: qcow2 }] } } +- { return: {} } + +EQMP { .name = blockdev-snapshot-sync, -- 1.7.9.rc2.1.g69204
Re: [Qemu-devel] [PATCH] Fix spelling in comments (iff - if)
On 02/26/2012 12:58 PM, Stefan Weil wrote: Am 26.02.2012 17:39, schrieb Anthony Liguori: On 02/26/2012 07:39 AM, Stefan Weil wrote: Signed-off-by: Stefan Weils...@weilnetz.de --- a.out.h | 2 +- arm-dis.c | 22 +++--- block.c | 2 +- block/qcow2-refcount.c | 4 ++-- hw/alpha_typhoon.c | 2 +- hw/hid.h | 2 +- hw/pcnet.c | 2 +- m68k-dis.c | 4 ++-- memory.h | 4 ++-- monitor.c | 2 +- net/socket.c | 2 +- qemu-img.c | 2 +- tcg/hppa/tcg-target.c | 6 +++--- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/a.out.h b/a.out.h index 33ca7f7..7ea8d5a 100644 --- a/a.out.h +++ b/a.out.h @@ -136,7 +136,7 @@ struct external_scnhdr { */ struct external_lineno { union { - host_ulong l_symndx; /* function name symbol index, iff l_lnno 0 */ I don't know if this is the intention but this may be short hand for 'if and only if'. I do use this short hand quite a bit myself. http://en.wikipedia.org/wiki/If_and_only_if Regards, Anthony Liguori Thank you for this information which was new for me. I reviewed my own patch, and there are indeed some 'iff' which might be used for 'if and only if'. Others cannot have this meaning because there are several alternatives with the same result. For the description of function return values 'if and only if' also looks strange. Some comments just translate an if statement in text. Here 'if and only if' would not match the C code which only says 'if'. I'll send new patches for these different categories, then it will be easier to accept or reject them. Many authors regard iff as unsuitable in formal writing (citation from Wikipedia).Personally, I'd also prefer to see 'if and only if' in full length or in symbolic notation (==) when this is the intention, not an abbreviation like 'iff'. Yup, just pointing out that in some cases it may be intentional. Regards, Anthony Liguori Regards, Stefan Weil
Re: [Qemu-devel] [PATCH 4/8] Add universal DMA helper functions
On Sun, Feb 26, 2012 at 12:04:49PM +0200, Michael S. Tsirkin wrote: On Fri, Feb 24, 2012 at 02:27:39PM +1100, David Gibson wrote: Not that long ago, every device implementation using DMA directly accessed guest memory using cpu_physical_memory_*(). This meant that adding support for a guest visible IOMMU would require changing every one of these devices to go through IOMMU translation. Shortly before qemu 1.0, I made a start on fixing this by providing helper functions for PCI DMA. These are currently just stubs which call the direct access functions, but mean that an IOMMU can be implemented in one place, rather than for every PCI device. Clearly, this doesn't help for non PCI devices, which could also be IOMMU translated on some platforms. It is also problematic for the devices which have both PCI and non-PCI version (e.g. OHCI, AHCI) - we cannot use the the pci_dma_*() functions, because they assume the presence of a PCIDevice, but we don't want to have to check between pci_dma_*() and cpu_physical_memory_*() every time we do a DMA in the device code. This patch makes the first step on addressing both these problems, by introducing new (stub) dma helper functions which can be used for any DMA capable device. These dma functions take a DMAContext *, a new (currently empty) variable describing the DMA address space in which the operation is to take place. NULL indicates untranslated DMA directly into guest physical address space. The intention is that in future non-NULL values will given information about any necessary IOMMU translation. DMA using devices must obtain a DMAContext (or, potentially, contexts) from their bus or platform. For now this patch just converts the PCI wrappers to be implemented in terms of the universal wrappers, converting other drivers can take place over time. Cc: Michael S. Tsirkin m...@redhat.com Cc: Joerg Rodel joerg.ro...@amd.com Cc: Eduard - Gabriel Munteanu eduard.munte...@linux360.ro Cc: Richard Henderson r...@twiddle.net Signed-off-by: David Gibson da...@gibson.dropbear.id.au I'm a bit confused with all the stubbing going on. Is this the final form of the pci_* functions or just a stub? If the final form, we probably should just open-code them - they don't buy us much. If not, let's add a comment? It is a stub. The final form needs to deal with address translation, permissions checking and invalidating memory maps. [snip] Eduard
Re: [Qemu-devel] [PATCH 4/8] Add universal DMA helper functions
On Fri, Feb 24, 2012 at 02:27:39PM +1100, David Gibson wrote: Not that long ago, every device implementation using DMA directly accessed guest memory using cpu_physical_memory_*(). This meant that adding support for a guest visible IOMMU would require changing every one of these devices to go through IOMMU translation. Shortly before qemu 1.0, I made a start on fixing this by providing helper functions for PCI DMA. These are currently just stubs which call the direct access functions, but mean that an IOMMU can be implemented in one place, rather than for every PCI device. Clearly, this doesn't help for non PCI devices, which could also be IOMMU translated on some platforms. It is also problematic for the devices which have both PCI and non-PCI version (e.g. OHCI, AHCI) - we cannot use the the pci_dma_*() functions, because they assume the presence of a PCIDevice, but we don't want to have to check between pci_dma_*() and cpu_physical_memory_*() every time we do a DMA in the device code. This patch makes the first step on addressing both these problems, by introducing new (stub) dma helper functions which can be used for any DMA capable device. These dma functions take a DMAContext *, a new (currently empty) variable describing the DMA address space in which the operation is to take place. NULL indicates untranslated DMA directly into guest physical address space. The intention is that in future non-NULL values will given information about any necessary IOMMU translation. DMA using devices must obtain a DMAContext (or, potentially, contexts) from their bus or platform. For now this patch just converts the PCI wrappers to be implemented in terms of the universal wrappers, converting other drivers can take place over time. Cc: Michael S. Tsirkin m...@redhat.com Cc: Joerg Rodel joerg.ro...@amd.com Cc: Eduard - Gabriel Munteanu eduard.munte...@linux360.ro Cc: Richard Henderson r...@twiddle.net Signed-off-by: David Gibson da...@gibson.dropbear.id.au Hi, Thanks for pushing this forward. I got caught up in other stuff, perhaps I'll be able to beat you to submitting the actual implementation soon. :-) [snip] Eduard
Re: [Qemu-devel] [offtopic] Sparc Softmmu
On Thu, Feb 23, 2012 at 23:47, P. Wilhelm bearcat.pi...@gmail.com wrote: We use the old Solaris/Sparc in a medical device we produce where I work. Since we can't get new Sparc hardware any longer (many countries no longer accept refurbished devices - so we can't sell this product to them when we use refurbish IT parts) that is reasonable cost for our application, we need to find a way to continue to produce our product. The application is moderately complicated and will take some effort/time to port to another OS / processor. I was just evaluating the possibility of using an emulated Sparc machine to replace the Solaris box. The thought behind using Qemu was that we can reduce hardware obsolescence issues in the future with this layer of abstraction. Conceivably, future hardware changes would be easier to do with less regulatory overhead. My evaluation was exciting because I was able to, with just a couple of days of work, get our application up and running and talking to the other hardware associated our product. However, given the maturity level of Qemu for Solaris on Sparc, we'll almost certainly do a port of our application to other hardware and OS. With the evaluation work, my interest was piqued, so I've continued to play around with Solaris / Sparc on Qemu on my own time. Since I had a fairly well encapsulated symptom, I thought I might be able to help identify a fix or two for Qemu. Another possibility is to make a Solaris/Sparc to Solaris/x86 user emulator like Linux, BSD and Darwin user emulators. They just translate CPU instructions and system call parameters instead of emulating a whole machine. The license of Solaris headers is not compatible with QEMU though but this could be avoided. I sent a quick patch once to the list which could be used as a starting point if you want to try this way. But I probably would not trust QEMU if my life depended on it, and as COPYING explains, there is also no warranty. Respectfully, Paul On 2/21/2012 12:49 PM, Artyom Tarasenko wrote: Hi Paul, may I ask you why do you need Solaris 8/sparc? I spent really a lot of time on sparc emulation in qemu, it was fun and I would probably do it further, but I saw no projects where it would be useful. Somehow it looked that all the apps available for Solaris are available for Linux/Windows as well... Do you by any chance have an example of an app which would be worth the efforts? Artyom On Sun, Feb 19, 2012 at 4:45 PM, P. Wilhelmbearcat.pi...@gmail.com wrote: I've been able to install Solaris 8 using CDs on the Sparc Softmmu client system. Kudos to those responsible for Sparc development! I've been able to run a number of applications without problems on the client machine. I noticed something odd, however, and have been trying to isolate the cause. Hopefully, someone here will have an idea or two for me to try. The issue: The syslogd seems to accept and post to the appropriate log file only a small number of messages before no longer updating the log file when further messages are posted, the syslogd seems to hang. The symptom does not appear to be different when rebooting or restarting the syslog daemon. The daemon will post a couple of message to the log file and then stop accepting any more. Why ask here? I've done a couple of things to see if I can isolate the source of the oddity and they seem to point to qemu. What I've done so far: 1) I've tried using logger and a C program I wrote to use the syslog() function. - Both have the same issue noted above. 2) I've used both the OpenBios and SS5.bin bios. - Symptom does not change between the two. 3) I checked my /etc/syslog.conf on real hardware running the same version of Solaris 8. Syslogging works as you'd expect there. (Note - I don't have real SparcStation 5 hardware. I've been using an old Sun4u machine, Ultra-1 -- hopefully, that does not invalidate my real hardware checks.). 4) I ran syslogd in debug mode on both the client and the real hardware, but did not see anything in the output from each that gave a clue as to the issue. Generally, the output confirmed that I had syslogd configured the same way on both. How to proceed? I am a reasonably adept software developer, however, I do not have experience at the guts-level of Solaris OS or Sparc hardware. My work on Solaris/Sparc has been at the application level, but I have worked at the hardware level on other (proprietary) systems. If I had access to syslogd source code, I'd be comfortable working from there, but I am fairly certain that is not available - let me know if I am wrong. I've thought about looking for an open source syslog daemon and trying to use it instead of the Solaris version. Any thoughts about next steps are appreciated. Respectfully, Paul
Re: [Qemu-devel] [PATCH 6/6] kvm: Fix dirty tracking with large kernel page size
On Fri, Feb 24, 2012 at 00:23, David Gibson da...@gibson.dropbear.id.au wrote: From: Benjamin Herrenschmidt b...@kernel.crashing.org If the kernel page size is larger than TARGET_PAGE_SIZE, which happens for example on ppc64 with kernels compiled for 64K pages, the dirty tracking doesn't work. I think a better solution would be to push this to memory API and underlying exec.c dirty tracking so that they use the same page size as kernel (only in this KVM case, in general dirty tracking should match TARGET_PAGE_SIZE granularity). Cc: Avi Kivity a...@redhat.com Cc: Marcelo Tossatti mtossa...@redhat.com Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: David Gibson da...@gibson.dropbear.id.au --- kvm-all.c | 7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 5e188bf..3f8cfd9 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -348,10 +348,11 @@ static int kvm_set_migration_log(int enable) static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, unsigned long *bitmap) { - unsigned int i, j; + unsigned int i, j; unsigned long page_number, c; target_phys_addr_t addr, addr1; unsigned int len = ((section-size / TARGET_PAGE_SIZE) + HOST_LONG_BITS - 1) / HOST_LONG_BITS; + unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE; /* * bitmap-traveling is faster than memory-traveling (for addr...) @@ -363,10 +364,10 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, do { j = ffsl(c) - 1; c = ~(1ul j); - page_number = i * HOST_LONG_BITS + j; + page_number = (i * HOST_LONG_BITS + j) * hpratio; addr1 = page_number * TARGET_PAGE_SIZE; addr = section-offset_within_region + addr1; - memory_region_set_dirty(section-mr, addr, TARGET_PAGE_SIZE); + memory_region_set_dirty(section-mr, addr, TARGET_PAGE_SIZE * hpratio); } while (c != 0); } } -- 1.7.9
Re: [Qemu-devel] [PATCH 8/8] Make dma_addr_t 64 bit always
On Fri, Feb 24, 2012 at 04:57, David Gibson da...@gibson.dropbear.id.au wrote: On Fri, Feb 24, 2012 at 02:27:43PM +1100, David Gibson wrote: Oops, ignore this one folks. As is probably obvious, this was a testing patch not meant to go into the main series. Actually I'm not sure what would be the correct way to calculate the size. For example, on Sparc32 the virtual address space and CPU registers are 32 bits, physical address space 36 bits, but device virtual memory address space (DVMA, used by devices to talk to IOMMU) is only 32 bits. --- dma.h | 9 ++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dma.h b/dma.h index b8cfd1d..ee540f4 100644 --- a/dma.h +++ b/dma.h @@ -18,10 +18,13 @@ typedef struct ScatterGatherEntry ScatterGatherEntry; #if defined(TARGET_PHYS_ADDR_BITS) -typedef target_phys_addr_t dma_addr_t; +/* Bus addresses can be different size from CPU physical addresses, + * and indeed they can be different on different busses. So make + * these always 64-bit which should handle every usual case */ +typedef uint64_t dma_addr_t; -#define DMA_ADDR_BITS TARGET_PHYS_ADDR_BITS -#define DMA_ADDR_FMT TARGET_FMT_plx +#define DMA_ADDR_BITS 64 +#define DMA_ADDR_FMT % PRIx64 typedef enum { DMA_DIRECTION_TO_DEVICE = 0, -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
[Qemu-devel] [PATCH] hw/omap_i2c: Convert to qdev
From: Juha Riihimäki juha.riihim...@nokia.com Convert the omap_i2c device to qdev. Signed-off-by: Juha Riihimäki juha.riihim...@nokia.com [Riku Voipio: Fixes and restructuring patchset] Signed-off-by: Riku Voipio riku.voi...@iki.fi [Peter Maydell: More fixes and cleanups for upstream submission] Signed-off-by: Peter Maydell peter.mayd...@linaro.org --- This isn't the only omap_i2c patch I have in my tree (there's a lot of omap3 support that still needs untangling) but I think this change make sense on its own, so here it is. hw/nseries.c | 12 +++ hw/omap.h | 13 +-- hw/omap1.c| 13 +-- hw/omap2.c| 35 -- hw/omap_i2c.c | 107 + 5 files changed, 101 insertions(+), 79 deletions(-) diff --git a/hw/nseries.c b/hw/nseries.c index c5b3184..a5cfa8c 100644 --- a/hw/nseries.c +++ b/hw/nseries.c @@ -45,7 +45,6 @@ struct n800_s { uint32_t (*txrx)(void *opaque, uint32_t value, int len); uWireSlave *chip; } ts; -i2c_bus *i2c; int keymap[0x80]; DeviceState *kbd; @@ -194,12 +193,10 @@ static void n8x0_i2c_setup(struct n800_s *s) { DeviceState *dev; qemu_irq tmp_irq = qdev_get_gpio_in(s-cpu-gpio, N8X0_TMP105_GPIO); - -/* Attach the CPU on one end of our I2C bus. */ -s-i2c = omap_i2c_bus(s-cpu-i2c[0]); +i2c_bus *i2c = omap_i2c_bus(s-cpu-i2c[0]); /* Attach a menelaus PM chip */ -dev = i2c_create_slave(s-i2c, twl92230, N8X0_MENELAUS_ADDR); +dev = i2c_create_slave(i2c, twl92230, N8X0_MENELAUS_ADDR); qdev_connect_gpio_out(dev, 3, qdev_get_gpio_in(s-cpu-ih[0], OMAP_INT_24XX_SYS_NIRQ)); @@ -207,7 +204,7 @@ static void n8x0_i2c_setup(struct n800_s *s) qemu_system_powerdown = qdev_get_gpio_in(dev, 3); /* Attach a TMP105 PM chip (A0 wired to ground) */ -dev = i2c_create_slave(s-i2c, tmp105, N8X0_TMP105_ADDR); +dev = i2c_create_slave(i2c, tmp105, N8X0_TMP105_ADDR); qdev_connect_gpio_out(dev, 0, tmp_irq); } @@ -391,7 +388,8 @@ static void n810_kbd_setup(struct n800_s *s) /* Attach the LM8322 keyboard to the I2C bus, * should happen in n8x0_i2c_setup and s-kbd be initialised here. */ -s-kbd = i2c_create_slave(s-i2c, lm8323, N810_LM8323_ADDR); +s-kbd = i2c_create_slave(omap_i2c_bus(s-cpu-i2c[0]), + lm8323, N810_LM8323_ADDR); qdev_connect_gpio_out(s-kbd, 0, kbd_irq); } diff --git a/hw/omap.h b/hw/omap.h index 60fa34c..49ff0bf 100644 --- a/hw/omap.h +++ b/hw/omap.h @@ -764,16 +764,7 @@ void omap_mmc_handlers(struct omap_mmc_s *s, qemu_irq ro, qemu_irq cover); void omap_mmc_enable(struct omap_mmc_s *s, int enable); /* omap_i2c.c */ -struct omap_i2c_s; -struct omap_i2c_s *omap_i2c_init(MemoryRegion *sysmem, - target_phys_addr_t base, - qemu_irq irq, - qemu_irq *dma, - omap_clk clk); -struct omap_i2c_s *omap2_i2c_init(struct omap_target_agent_s *ta, -qemu_irq irq, qemu_irq *dma, omap_clk fclk, omap_clk iclk); -void omap_i2c_reset(struct omap_i2c_s *s); -i2c_bus *omap_i2c_bus(struct omap_i2c_s *s); +i2c_bus *omap_i2c_bus(DeviceState *omap_i2c); # define cpu_is_omap310(cpu) (cpu-mpu_model == omap310) # define cpu_is_omap1510(cpu) (cpu-mpu_model == omap1510) @@ -867,7 +858,7 @@ struct omap_mpu_state_s { struct omap_pwl_s *pwl; struct omap_pwt_s *pwt; -struct omap_i2c_s *i2c[2]; +DeviceState *i2c[2]; struct omap_rtc_s *rtc; diff --git a/hw/omap1.c b/hw/omap1.c index 1aa5f23..3d8e7ab 100644 --- a/hw/omap1.c +++ b/hw/omap1.c @@ -3694,7 +3694,6 @@ static void omap1_mpu_reset(void *opaque) omap_uwire_reset(mpu-microwire); omap_pwl_reset(mpu-pwl); omap_pwt_reset(mpu-pwt); -omap_i2c_reset(mpu-i2c[0]); omap_rtc_reset(mpu-rtc); omap_mcbsp_reset(mpu-mcbsp1); omap_mcbsp_reset(mpu-mcbsp2); @@ -3993,9 +3992,15 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, s-pwt = omap_pwt_init(system_memory, 0xfffb6000, omap_findclk(s, armxor_ck)); -s-i2c[0] = omap_i2c_init(system_memory, 0xfffb3800, - qdev_get_gpio_in(s-ih[1], OMAP_INT_I2C), -s-drq[OMAP_DMA_I2C_RX], omap_findclk(s, mpuper_ck)); +s-i2c[0] = qdev_create(NULL, omap_i2c); +qdev_prop_set_uint8(s-i2c[0], revision, 0x11); +qdev_prop_set_ptr(s-i2c[0], fclk, omap_findclk(s, mpuper_ck)); +qdev_init_nofail(s-i2c[0]); +busdev = sysbus_from_qdev(s-i2c[0]); +sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s-ih[1], OMAP_INT_I2C)); +sysbus_connect_irq(busdev, 1, s-drq[OMAP_DMA_I2C_TX]); +sysbus_connect_irq(busdev, 2, s-drq[OMAP_DMA_I2C_RX]); +sysbus_mmio_map(busdev, 0, 0xfffb3800); s-rtc =
[Qemu-devel] [PATCH 0/8] Add GTK UI to enable basic accessibility (v2)
I realize UIs are the third rail of QEMU development, but over the years I've gotten a lot of feedback from users about our UI. I think everyone struggles with the SDL interface and its lack of discoverability but it's worse than I think most people realize for users that rely on accessibility tools. The two pieces of feedback I've gotten the most re: accessibility are the lack of QEMU's enablement for screen readers and the lack of configurable accelerators. Since we render our own terminal using a fixed sized font, we don't respect system font settings which means we ignore if the user has configured large print. We also don't integrate at all with screen readers which means that for blind users, the virtual consoles may as well not even exist. We also don't allow any type of configuration of accelerators. For users with limited dexterity (this is actually more common than you would think), they may use an input device that only inputs one key at a time. Holding down two keys at once is not possible for these users. These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK, solve these problems. By using GTK, we can leverage VteTerminal for screen reader integration and font configuration. We can also use GTK's accelerator support to make accelerators configurable (Gnome provides a global accelerator configuration interface). I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go there eventually but that's not what this series is about. This is just attempting to use a richer toolkit such that we can enable basic accessibility support. As a consequence, the UI is much more usable even for a user without accessibility requirements so it's a win-win. Also available at: https://github.com/aliguori/qemu/tree/gtk.2 --- v1 - v2 - Add internationalization support. I don't actually speak any other languages so I added a placeholder for a German translation. This can be tested with LANGUAGE=de_DE.UTF-8 qemu-system-x86_64 - Fixed the terminal size for VteTerminal widgets. I think the behavior makes sense now. - Fixed lots of issues raised in review comments (see individual patches) Known Issues: - I saw the X crash once. I think it has to do with widget sizes. I need to work harder to reproduce. - I've not recreated the reported memory leak yet. - I haven't added backwards compatibility code for older VteTerminal widgets yet.
[Qemu-devel] [PATCH 2/8] chr: check to see if front end has registered a read function
Signed-off-by: Anthony Liguori aligu...@us.ibm.com --- qemu-char.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 5b2b35e..22bfb29 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -160,7 +160,9 @@ int qemu_chr_be_can_write(CharDriverState *s) void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len) { -s-chr_read(s-handler_opaque, buf, len); +if (s-chr_read) { +s-chr_read(s-handler_opaque, buf, len); +} } int qemu_chr_fe_get_msgfd(CharDriverState *s) -- 1.7.4.1
[Qemu-devel] [PATCH 8/8] gtk: make default UI
A user can still enable SDL with '-sdl' or '-display sdl' but start making the default display GTK by default. I'd also like to deprecate the SDL display and remove it in a few releases. Signed-off-by: Anthony Liguori aligu...@us.ibm.com --- vl.c | 38 -- 1 files changed, 24 insertions(+), 14 deletions(-) diff --git a/vl.c b/vl.c index 1d4c350..95d4e79 100644 --- a/vl.c +++ b/vl.c @@ -3290,6 +3290,25 @@ int main(int argc, char **argv, char **envp) add_device_config(DEV_VIRTCON, vc:80Cx24C); } +if (display_type == DT_DEFAULT) { +#if defined(CONFIG_GTK) +display_type = DT_GTK; +#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA) +display_type = DT_SDL; +#elif defined(CONFIG_VNC) +vnc_display = localhost:0,to=99; +show_vnc_port = 1; +#else +display_type = DT_NONE; +#endif +} + +#if defined(CONFIG_GTK) +if (display_type == DT_GTK) { +early_gtk_display_init(); +} +#endif + socket_init(); if (qemu_opts_foreach(qemu_find_opts(chardev), chardev_init_func, NULL, 1) != 0) @@ -3502,20 +3521,6 @@ int main(int argc, char **argv, char **envp) /* just use the first displaystate for the moment */ ds = get_displaystate(); -if (using_spice) -display_remote++; -if (display_type == DT_DEFAULT !display_remote) { -#if defined(CONFIG_SDL) || defined(CONFIG_COCOA) -display_type = DT_SDL; -#elif defined(CONFIG_VNC) -vnc_display = localhost:0,to=99; -show_vnc_port = 1; -#else -display_type = DT_NONE; -#endif -} - - /* init local displays */ switch (display_type) { case DT_NOGRAPHIC: @@ -3534,6 +3539,11 @@ int main(int argc, char **argv, char **envp) cocoa_display_init(ds, full_screen); break; #endif +#if defined(CONFIG_GTK) +case DT_GTK: +gtk_display_init(ds); +break; +#endif default: break; } -- 1.7.4.1
[Qemu-devel] [PATCH 7/8] gtk: add translation support
The de_DE translation is just a placeholder so that I could test the infrastructure. Signed-off-by: Anthony Liguori aligu...@us.ibm.com --- Makefile |3 +++ configure |4 po/Makefile| 43 +++ po/de_DE.po| 37 + po/messages.po | 37 + ui/gtk.c | 18 +- 6 files changed, 137 insertions(+), 5 deletions(-) create mode 100644 po/Makefile create mode 100644 po/de_DE.po create mode 100644 po/messages.po diff --git a/Makefile b/Makefile index aa758dd..d8f33f7 100644 --- a/Makefile +++ b/Makefile @@ -296,6 +296,9 @@ ifneq ($(BLOBS),) $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x $(DESTDIR)$(datadir); \ done endif +ifeq ($(CONFIG_GTK),y) + $(MAKE) -C po $@ || exit 1 +endif $(INSTALL_DIR) $(DESTDIR)$(datadir)/keymaps set -e; for x in $(KEYMAPS); do \ $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x $(DESTDIR)$(datadir)/keymaps; \ diff --git a/configure b/configure index 4c80673..7d5cb38 100755 --- a/configure +++ b/configure @@ -3916,6 +3916,10 @@ if [ $source_path != `pwd` ]; then mkdir -p libcacard rm -f libcacard/Makefile symlink $source_path/libcacard/Makefile libcacard/Makefile + +mkdir -p po +rm -f po/Makefile +symlink $source_path/po/Makefile po/Makefile fi d=libuser diff --git a/po/Makefile b/po/Makefile new file mode 100644 index 000..0e2c11b --- /dev/null +++ b/po/Makefile @@ -0,0 +1,43 @@ +# This makefile is very special as it's meant to build as part of the build +# process and also within the source tree to update the translation files. + +VERSION=$(shell cat ../VERSION) +TRANSLATIONS=de_DE +SRCS=$(addsuffix .po, $(TRANSLATIONS)) +OBJS=$(addsuffix .mo, $(TRANSLATIONS)) + +SRC_PATH=.. + +-include ../config-host.mak + +vpath %.po $(SRC_PATH)/po + +all: + @echo Use 'make update' to update translation files + @echo or us 'make build' or 'make install' to build and install + @echo the translation files + +update: $(SRCS) + +build: $(OBJS) + +clean: + $(RM) $(OBJS) + +install: $(OBJS) + for obj in $(OBJS); do \ + base=`basename $$obj .mo`; \ + $(INSTALL) -d $(DESTDIR)$(prefix)/share/locale/$$base/LC_MESSAGES; \ + $(INSTALL) -m644 $$obj $(DESTDIR)$(prefix)/share/locale/$$base/LC_MESSAGES/qemu.mo; \ + done + +%.mo: + @msgfmt -o $@ $(SRC_PATH)/po/`basename $@ .mo`.po + +messages.po: $(SRC_PATH)/ui/gtk.c + @xgettext -o $@ --foreign-user --package-name=QEMU --package-version=1.0.50 --msgid-bugs-address=qemu-devel@nongnu.org -k_ -C $ + +de_DE.po: messages.po $(SRC_PATH)/ui/gtk.c + @msgmerge $@ $ $@.bak mv $@.bak $@ + +.PHONY: $(SRCS) clean all diff --git a/po/de_DE.po b/po/de_DE.po new file mode 100644 index 000..aa4ef42 --- /dev/null +++ b/po/de_DE.po @@ -0,0 +1,37 @@ +# SOME DESCRIPTIVE TITLE. +# This file is put in the public domain. +# FIRST AUTHOR EMAIL@ADDRESS, YEAR. +# +#, fuzzy +msgid +msgstr +Project-Id-Version: QEMU 1.0.50\n +Report-Msgid-Bugs-To: qemu-devel@nongnu.org\n +POT-Creation-Date: 2012-02-26 11:30-0600\n +PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n +Last-Translator: FULL NAME EMAIL@ADDRESS\n +Language-Team: LANGUAGE l...@li.org\n +Language: \n +MIME-Version: 1.0\n +Content-Type: text/plain; charset=UTF-8\n +Content-Transfer-Encoding: 8bit\n + +#: ../ui/gtk.c:769 +msgid _File +msgstr _File FIXME + +#: ../ui/gtk.c:779 +msgid _View +msgstr _View FIXME + +#: ../ui/gtk.c:781 +msgid _Full Screen +msgstr _Full Screen FIXME + +#: ../ui/gtk.c:805 +msgid _Grab Input +msgstr _Grab Input FIXME + +#: ../ui/gtk.c:831 +msgid Show _Tabs +msgstr Show _Tabs FIXME diff --git a/po/messages.po b/po/messages.po new file mode 100644 index 000..741e782 --- /dev/null +++ b/po/messages.po @@ -0,0 +1,37 @@ +# SOME DESCRIPTIVE TITLE. +# This file is put in the public domain. +# FIRST AUTHOR EMAIL@ADDRESS, YEAR. +# +#, fuzzy +msgid +msgstr +Project-Id-Version: QEMU 1.0.50\n +Report-Msgid-Bugs-To: qemu-devel@nongnu.org\n +POT-Creation-Date: 2012-02-26 11:30-0600\n +PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n +Last-Translator: FULL NAME EMAIL@ADDRESS\n +Language-Team: LANGUAGE l...@li.org\n +Language: \n +MIME-Version: 1.0\n +Content-Type: text/plain; charset=CHARSET\n +Content-Transfer-Encoding: 8bit\n + +#: ../ui/gtk.c:769 +msgid _File +msgstr + +#: ../ui/gtk.c:779 +msgid _View +msgstr + +#: ../ui/gtk.c:781 +msgid _Full Screen +msgstr + +#: ../ui/gtk.c:805 +msgid _Grab Input +msgstr + +#: ../ui/gtk.c:831 +msgid Show _Tabs +msgstr diff --git a/ui/gtk.c b/ui/gtk.c index 578cb94..5b759bc 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -31,8 +31,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#define GETTEXT_PACKAGE qemu +#define LOCALEDIR po + #include gtk/gtk.h #include gdk/gdkkeysyms.h +#include glib/gi18n.h
[Qemu-devel] [PATCH 6/8] gtk: add support for screen scaling and full screen (v2)
Basic menu items to enter full screen mode and zoom in/out. Unlike SDL, we don't allow arbitrary scaling based on window resizing. The current behavior with SDL causes a lot of problems for me. Sometimes I accidentally resize the window a tiny bit while trying to move it (Ubuntu's 1-pixel window decorations don't help here). After that, scaling is now active and if the screen changes size again, badness ensues since the aspect ratio is skewed. Allowing zooming by 25% in and out should cover most use cases. We can add a more flexible scaling later but for now, I think this is a more friendly behavior. Signed-off-by: Anthony Liguori aligu...@us.ibm.com --- v1 - v2 - fix scaling (Paolo) - use ctrl-alt-+ instead of ctrl-alt-= for zoom --- ui/gtk.c | 92 +++--- 1 files changed, 88 insertions(+), 4 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 0dac807..578cb94 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -79,6 +79,9 @@ typedef struct GtkDisplayState GtkWidget *view_menu_item; GtkWidget *view_menu; +GtkWidget *full_screen_item; +GtkWidget *zoom_in_item; +GtkWidget *zoom_out_item; GtkWidget *grab_item; GtkWidget *vga_item; @@ -99,6 +102,7 @@ typedef struct GtkDisplayState double scale_x; double scale_y; +gboolean full_screen; GdkCursor *null_cursor; Notifier mouse_mode_notifier; @@ -123,7 +127,7 @@ static void gd_update_cursor(GtkDisplayState *s, gboolean override) on_vga = (gtk_notebook_get_current_page(GTK_NOTEBOOK(s-notebook)) == 0); if ((override || on_vga) -(kbd_mouse_is_absolute() || gd_is_grab_active(s))) { +(s-full_screen || kbd_mouse_is_absolute() || gd_is_grab_active(s))) { gdk_window_set_cursor(window, s-null_cursor); } else { gdk_window_set_cursor(window, NULL); @@ -215,9 +219,11 @@ static void gd_resize(DisplayState *ds) ds-surface-height, ds-surface-linesize); -gtk_widget_set_size_request(s-drawing_area, -ds-surface-width * s-scale_x, -ds-surface-height * s-scale_y); +if (!s-full_screen) { +gtk_widget_set_size_request(s-drawing_area, +ds-surface-width * s-scale_x, +ds-surface-height * s-scale_y); +} } /** QEMU Events **/ @@ -474,6 +480,54 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque) } } +static void gd_menu_full_screen(GtkMenuItem *item, void *opaque) +{ +GtkDisplayState *s = opaque; + +if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(s-full_screen_item))) { +gtk_notebook_set_show_tabs(GTK_NOTEBOOK(s-notebook), FALSE); +gtk_widget_set_size_request(s-menu_bar, 0, 0); +gtk_widget_set_size_request(s-drawing_area, -1, -1); +gtk_window_set_resizable(GTK_WINDOW(s-window), TRUE); +gtk_window_fullscreen(GTK_WINDOW(s-window)); +gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s-grab_item), TRUE); +s-full_screen = TRUE; +} else { +gtk_window_unfullscreen(GTK_WINDOW(s-window)); +gd_menu_show_tabs(GTK_MENU_ITEM(s-show_tabs_item), s); +gtk_widget_set_size_request(s-menu_bar, -1, -1); +gtk_widget_set_size_request(s-drawing_area, s-ds-surface-width, s-ds-surface-height); +gtk_window_set_resizable(GTK_WINDOW(s-window), FALSE); +gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s-grab_item), FALSE); +s-full_screen = FALSE; +} + +gd_update_cursor(s, FALSE); +} + +static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque) +{ +GtkDisplayState *s = opaque; + +s-scale_x += .25; +s-scale_y += .25; + +gd_resize(s-ds); +} + +static void gd_menu_zoom_out(GtkMenuItem *item, void *opaque) +{ +GtkDisplayState *s = opaque; + +s-scale_x -= .25; +s-scale_y -= .25; + +s-scale_x = MAX(s-scale_x, .25); +s-scale_y = MAX(s-scale_y, .25); + +gd_resize(s-ds); +} + static void gd_menu_grab_input(GtkMenuItem *item, void *opaque) { GtkDisplayState *s = opaque; @@ -523,6 +577,9 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2, if (!on_vga) { gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s-grab_item), FALSE); +} else if (s-full_screen) { +gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s-grab_item), + TRUE); } if (arg2 == 0) { @@ -690,6 +747,12 @@ static void gd_connect_signals(GtkDisplayState *s) g_signal_connect(s-quit_item, activate, G_CALLBACK(gd_menu_quit), s); +g_signal_connect(s-full_screen_item, activate, + G_CALLBACK(gd_menu_full_screen), s); +
Re: [Qemu-devel] English proof-reading services for your scientific, research or academic papers
Dear Proofreader, I have an interest in your proofreading service and a question on the delivery of proofreading service. For the manuscrpt of around 5000 words when theqoutput of the service will be delivered? Best regards, Fumiyo Kondo Division of Policy and Planning Sciences Faculty of Engineering, Information and Systems University of Tsukuba Tel Fax: 029 (853) 5223 Email: ko...@sk.tsukuba.ac.jp http://shakosv.sk.tsukuba.ac.jp/~kondo/
[Qemu-devel] [PATCH 4/8] gtk: add virtual console support (v2)
This enables VteTerminal to be used to render the text consoles. VteTerminal is the same widget used by gnome-terminal which means it's VT100 emulation is as good as they come. It's also screen reader accessible, supports copy/paste, proper scrolling and most of the other features you would expect from a terminal widget. Signed-off-by: Anthony Liguori aligu...@us.ibm.com --- v1 - v2 - make sure to activate the menu item when switching tabs - fix sizing of non-0 pages --- console.c |4 +- console.h |4 +- ui/gtk.c | 160 + 3 files changed, 164 insertions(+), 4 deletions(-) diff --git a/console.c b/console.c index 6434ed0..c12f02a 100644 --- a/console.c +++ b/console.c @@ -1551,9 +1551,9 @@ static CharDriverState *text_console_init(QemuOpts *opts) static VcHandler *vc_handler = text_console_init; -int vc_init(QemuOpts *opts, CharDriverState **_chr) +CharDriverState *vc_init(QemuOpts *opts) { -return vc_handler(opts, _chr); +return vc_handler(opts); } void register_vc_handler(VcHandler *handler) diff --git a/console.h b/console.h index 9b4b390..27d7929 100644 --- a/console.h +++ b/console.h @@ -363,9 +363,9 @@ void qemu_console_resize(DisplayState *ds, int width, int height); void qemu_console_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_y, int w, int h); -typedef int (VcHandler)(QemuOpts *, CharDriverState **); +typedef CharDriverState *(VcHandler)(QemuOpts *); -int vc_init(QemuOpts *opts, CharDriverState **_chr); +CharDriverState *vc_init(QemuOpts *opts); void register_vc_handler(VcHandler *handler); /* sdl.c */ diff --git a/ui/gtk.c b/ui/gtk.c index 591a987..0579a55 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -56,6 +56,8 @@ #define dprintf(fmt, ...) do { } while (0) #endif +#define MAX_VCS 10 + typedef struct VirtualConsole { GtkWidget *menu_item; @@ -79,6 +81,9 @@ typedef struct GtkDisplayState GtkWidget *view_menu; GtkWidget *vga_item; +int nb_vcs; +VirtualConsole vc[MAX_VCS]; + GtkWidget *show_tabs_item; GtkWidget *vbox; @@ -400,6 +405,15 @@ static void gd_menu_switch_vc(GtkMenuItem *item, void *opaque) if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(s-vga_item))) { gtk_notebook_set_current_page(GTK_NOTEBOOK(s-notebook), 0); +} else { +int i; + +for (i = 0; i s-nb_vcs; i++) { +if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(s-vc[i].menu_item))) { +gtk_notebook_set_current_page(GTK_NOTEBOOK(s-notebook), i + 1); +break; +} +} } } @@ -418,16 +432,154 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2, gpointer data) { GtkDisplayState *s = data; +guint last_page; if (!gtk_widget_get_realized(s-notebook)) { return; } +last_page = gtk_notebook_get_current_page(nb); + +if (last_page) { +gtk_widget_set_size_request(s-vc[last_page - 1].terminal, -1, -1); +} + +if (arg2 == 0) { +gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s-vga_item), TRUE); +} else { +VirtualConsole *vc = s-vc[arg2 - 1]; +VteTerminal *term = VTE_TERMINAL(vc-terminal); +int width, height; + +width = 80 * vte_terminal_get_char_width(term); +height = 25 * vte_terminal_get_char_height(term); + +gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc-menu_item), TRUE); +gtk_widget_set_size_request(vc-terminal, width, height); +} + gd_update_cursor(s, TRUE); } +/** Virtual Console Callbacks **/ + +static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len) +{ +VirtualConsole *vc = chr-opaque; + +return write(vc-fd, buf, len); +} + +static int nb_vcs; +static CharDriverState *vcs[MAX_VCS]; + +static CharDriverState *gd_vc_handler(QemuOpts *opts) +{ +CharDriverState *chr; + +chr = g_malloc0(sizeof(*chr)); +chr-chr_write = gd_vc_chr_write; + +vcs[nb_vcs++] = chr; + +return chr; +} + void early_gtk_display_init(void) { +register_vc_handler(gd_vc_handler); +} + +static gboolean gd_vc_in(GIOChannel *chan, GIOCondition cond, void *opaque) +{ +VirtualConsole *vc = opaque; +uint8_t buffer[1024]; +ssize_t len; + +len = read(vc-fd, buffer, sizeof(buffer)); +if (len = 0) { +return FALSE; +} + +qemu_chr_be_write(vc-chr, buffer, len); + +return TRUE; +} + +static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSList *group) +{ +const char *label; +char buffer[32]; +char path[32]; +VtePty *pty; +GIOChannel *chan; +GtkWidget *scrolled_window; +GtkAdjustment *hadjustment, *vadjustment; +int master_fd, slave_fd, ret; +struct termios tty; + +snprintf(buffer, sizeof(buffer), vc%d, index); +snprintf(path,
[Qemu-devel] [PATCH 1/8] console: allow VCs to be overridden by UI
We want to expose VCs using a VteTerminal widget. We need access to provide our own CharDriverState in order to do this. Signed-off-by: Anthony Liguori aligu...@us.ibm.com --- console.c | 14 +- console.h |6 +- qemu-char.c |2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/console.c b/console.c index 6a463f5..6434ed0 100644 --- a/console.c +++ b/console.c @@ -1513,7 +1513,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds) chr-init(chr); } -CharDriverState *text_console_init(QemuOpts *opts) +static CharDriverState *text_console_init(QemuOpts *opts) { CharDriverState *chr; TextConsole *s; @@ -1549,6 +1549,18 @@ CharDriverState *text_console_init(QemuOpts *opts) return chr; } +static VcHandler *vc_handler = text_console_init; + +int vc_init(QemuOpts *opts, CharDriverState **_chr) +{ +return vc_handler(opts, _chr); +} + +void register_vc_handler(VcHandler *handler) +{ +vc_handler = handler; +} + void text_consoles_set_display(DisplayState *ds) { int i; diff --git a/console.h b/console.h index a95b581..56cda3c 100644 --- a/console.h +++ b/console.h @@ -356,7 +356,6 @@ void vga_hw_text_update(console_ch_t *chardata); int is_graphic_console(void); int is_fixedsize_console(void); -CharDriverState *text_console_init(QemuOpts *opts); void text_consoles_set_display(DisplayState *ds); void console_select(unsigned int index); void console_color_init(DisplayState *ds); @@ -364,6 +363,11 @@ void qemu_console_resize(DisplayState *ds, int width, int height); void qemu_console_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_y, int w, int h); +typedef int (VcHandler)(QemuOpts *, CharDriverState **); + +int vc_init(QemuOpts *opts, CharDriverState **_chr); +void register_vc_handler(VcHandler *handler); + /* sdl.c */ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame); diff --git a/qemu-char.c b/qemu-char.c index bb9e3f5..5b2b35e 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2707,7 +2707,7 @@ static const struct { { .name = socket,.open = qemu_chr_open_socket }, { .name = udp, .open = qemu_chr_open_udp }, { .name = msmouse, .open = qemu_chr_open_msmouse }, -{ .name = vc,.open = text_console_init }, +{ .name = vc,.open = vc_init }, #ifdef _WIN32 { .name = file, .open = qemu_chr_open_win_file_out }, { .name = pipe, .open = qemu_chr_open_win_pipe }, -- 1.7.4.1
[Qemu-devel] [PATCH 3/8] ui: add basic GTK gui (v2)
This is minimalistic and just contains the basic widget infrastructure. The GUI consists of a menu and a GtkNotebook. To start with, the notebook has its tabs hidden which provides a UI that looks very similar to SDL with the exception of the menu bar. The menu bar allows a user to toggle the visibility of the tabs. Cairo is used for rendering. I used gtk-vnc as a reference. gtk-vnc solves the same basic problems as QEMU since it was originally written as a remote display for QEMU. So for the most part, the approach to rendering and keyboard handling should be pretty solid for GTK. Signed-off-by: Anthony Liguori aligu...@us.ibm.com --- v1 - v2 - add gtk-vnc license - fix key propagation --- Makefile |2 + Makefile.objs |1 + configure | 25 +++- console.h |4 + sysemu.h |1 + ui/gtk.c | 572 + 6 files changed, 604 insertions(+), 1 deletions(-) create mode 100644 ui/gtk.c diff --git a/Makefile b/Makefile index ad1e627..aa758dd 100644 --- a/Makefile +++ b/Makefile @@ -120,6 +120,8 @@ ui/cocoa.o: ui/cocoa.m ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS) +ui/gtk.o: QEMU_CFLAGS += $(GTK_CFLAGS) $(VTE_CFLAGS) + ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS) bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS) diff --git a/Makefile.objs b/Makefile.objs index 808de6a..86b63c0 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -147,6 +147,7 @@ ui-obj-y += keymaps.o ui-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o ui-obj-$(CONFIG_COCOA) += cocoa.o ui-obj-$(CONFIG_CURSES) += curses.o +ui-obj-$(CONFIG_GTK) += gtk.o vnc-obj-y += vnc.o d3des.o vnc-obj-y += vnc-enc-zlib.o vnc-enc-hextile.o vnc-obj-y += vnc-enc-tight.o vnc-palette.o diff --git a/configure b/configure index f9d5330..4c80673 100755 --- a/configure +++ b/configure @@ -250,7 +250,7 @@ sdl_config=${SDL_CONFIG-${cross_prefix}sdl-config} # default flags for all hosts QEMU_CFLAGS=-fno-strict-aliasing $QEMU_CFLAGS QEMU_CFLAGS=-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS -QEMU_CFLAGS=-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS +QEMU_CFLAGS=-Wredundant-decls $QEMU_CFLAGS QEMU_CFLAGS=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS QEMU_CFLAGS=-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS QEMU_INCLUDES=-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu @@ -1498,6 +1498,23 @@ if test $sparse != no ; then fi ## +# GTK probe + +if test $gtk != no; then +if $pkg_config gtk+-2.0 --modversion /dev/null 2/dev/null \ + $pkg_config vte --modversion /dev/null 2/dev/null; then + gtk_cflags=`$pkg_config --cflags gtk+-2.0 2/dev/null` + gtk_libs=`$pkg_config --libs gtk+-2.0 2/dev/null` + vte_cflags=`$pkg_config --cflags vte 2/dev/null` + vte_libs=`$pkg_config --libs vte 2/dev/null` + libs_softmmu=$gtk_libs $vte_libs $libs_softmmu + gtk=yes +else + gtk=no +fi +fi + +## # SDL probe # Look for sdl configuration program (pkg-config or sdl-config). Try @@ -2879,6 +2896,7 @@ if test $darwin = yes ; then echo Cocoa support $cocoa fi echo SDL support $sdl +echo GTK support $gtk echo curses support$curses echo curl support $curl echo mingw32 support $mingw32 @@ -3162,6 +3180,11 @@ if test $bluez = yes ; then echo BLUEZ_CFLAGS=$bluez_cflags $config_host_mak fi echo GLIB_CFLAGS=$glib_cflags $config_host_mak +if test $gtk = yes ; then + echo CONFIG_GTK=y $config_host_mak + echo GTK_CFLAGS=$gtk_cflags $config_host_mak + echo VTE_CFLAGS=$vte_cflags $config_host_mak +fi if test $xen = yes ; then echo CONFIG_XEN_BACKEND=y $config_host_mak echo CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version $config_host_mak diff --git a/console.h b/console.h index 56cda3c..9b4b390 100644 --- a/console.h +++ b/console.h @@ -398,4 +398,8 @@ static inline int vnc_display_pw_expire(DisplayState *ds, time_t expires) /* curses.c */ void curses_display_init(DisplayState *ds, int full_screen); +/* gtk.c */ +void early_gtk_display_init(void); +void gtk_display_init(DisplayState *ds); + #endif diff --git a/sysemu.h b/sysemu.h index 98118cc..7b46bb8 100644 --- a/sysemu.h +++ b/sysemu.h @@ -92,6 +92,7 @@ typedef enum DisplayType DT_DEFAULT, DT_CURSES, DT_SDL, +DT_GTK, DT_NOGRAPHIC, DT_NONE, } DisplayType; diff --git a/ui/gtk.c b/ui/gtk.c new file mode 100644 index 000..591a987 --- /dev/null +++ b/ui/gtk.c @@ -0,0 +1,572 @@ +/* + * GTK UI + * + * Copyright IBM, Corp. 2012 + * + * Authors: + * Anthony Liguori aligu...@us.ibm.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. + * + * Portions from gtk-vnc: + * + * GTK VNC Widget + * + * Copyright (C) 2006 Anthony Liguori anth...@codemonkey.ws + * Copyright (C) 2009-2010
[Qemu-devel] [PATCH 5/8] gtk: add support for input grabbing
There is a small deviation from SDL's behavior here. Instead of Ctrl+Alt triggering grab, we now use Ctrl-Alt-g to trigger grab. GTK will not accept Ctrl+Alt as an accelerator since it just consists of modifiers. Having grab as a proper accelerator is important as it allows a user to override the accelerator for accessibility purposes. We also are not automatically grabbing on left-click. Besides the inability to tie mouse clicks to an accelerator, I think this behavior is hard to discover and since it only happens depending on the guest state, it can lead to confusing behavior. This can be changed in the future if there's a strong resistence to dropping left-click-to-grab, but I think we're better off dropping it. Signed-off-by: Anthony Liguori aligu...@us.ibm.com --- ui/gtk.c | 102 +++-- 1 files changed, 98 insertions(+), 4 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 0579a55..0dac807 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -79,6 +79,7 @@ typedef struct GtkDisplayState GtkWidget *view_menu_item; GtkWidget *view_menu; +GtkWidget *grab_item; GtkWidget *vga_item; int nb_vcs; @@ -107,6 +108,11 @@ static GtkDisplayState *global_state; /** Utility Functions **/ +static bool gd_is_grab_active(GtkDisplayState *s) +{ +return gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(s-grab_item)); +} + static void gd_update_cursor(GtkDisplayState *s, gboolean override) { GdkWindow *window; @@ -116,7 +122,8 @@ static void gd_update_cursor(GtkDisplayState *s, gboolean override) on_vga = (gtk_notebook_get_current_page(GTK_NOTEBOOK(s-notebook)) == 0); -if ((override || on_vga) kbd_mouse_is_absolute()) { +if ((override || on_vga) +(kbd_mouse_is_absolute() || gd_is_grab_active(s))) { gdk_window_set_cursor(window, s-null_cursor); } else { gdk_window_set_cursor(window, NULL); @@ -127,15 +134,20 @@ static void gd_update_caption(GtkDisplayState *s) { const char *status = ; gchar *title; +const char *grab = ; + +if (gd_is_grab_active(s)) { +grab = - Press Ctrl+Alt+G to release grab; +} if (!runstate_is_running()) { status = [Stopped]; } if (qemu_name) { -title = g_strdup_printf(QEMU (%s)%s, qemu_name, status); +title = g_strdup_printf(QEMU (%s)%s%s, qemu_name, status, grab); } else { -title = g_strdup_printf(QEMU%s, status); +title = g_strdup_printf(QEMU%s%s, status, grab); } gtk_window_set_title(GTK_WINDOW(s-window), title); @@ -309,10 +321,44 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, s-last_x = x; s-last_y = y; -if (kbd_mouse_is_absolute()) { +if (kbd_mouse_is_absolute() || gd_is_grab_active(s)) { kbd_mouse_event(dx, dy, 0, s-button_mask); } +if (!kbd_mouse_is_absolute() gd_is_grab_active(s)) { +GdkDrawable *drawable = GDK_DRAWABLE(gtk_widget_get_window(s-drawing_area)); +GdkDisplay *display = gdk_drawable_get_display(drawable); +GdkScreen *screen = gdk_drawable_get_screen(drawable); +int x = (int)motion-x_root; +int y = (int)motion-y_root; + +/* In relative mode check to see if client pointer hit + * one of the screen edges, and if so move it back by + * 200 pixels. This is important because the pointer + * in the server doesn't correspond 1-for-1, and so + * may still be only half way across the screen. Without + * this warp, the server pointer would thus appear to hit + * an invisible wall */ +if (x == 0) { +x += 200; +} +if (y == 0) { +y += 200; +} +if (x == (gdk_screen_get_width(screen) - 1)) { +x -= 200; +} +if (y == (gdk_screen_get_height(screen) - 1)) { +y -= 200; +} + +if (x != (int)motion-x_root || y != (int)motion-y_root) { +gdk_display_warp_pointer(display, screen, x, y); +s-last_x = -1; +s-last_y = -1; +return FALSE; +} +} return TRUE; } @@ -428,11 +474,39 @@ static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque) } } +static void gd_menu_grab_input(GtkMenuItem *item, void *opaque) +{ +GtkDisplayState *s = opaque; + +if (gd_is_grab_active(s)) { + gdk_keyboard_grab(gtk_widget_get_window(GTK_WIDGET(s-drawing_area)), + FALSE, + GDK_CURRENT_TIME); + gdk_pointer_grab(gtk_widget_get_window(GTK_WIDGET(s-drawing_area)), +FALSE, /* All events to come to our window directly */ +GDK_POINTER_MOTION_MASK | +GDK_BUTTON_PRESS_MASK | +GDK_BUTTON_RELEASE_MASK | +GDK_BUTTON_MOTION_MASK | +
Re: [Qemu-devel] [PATCH 6/6] kvm: Fix dirty tracking with large kernel page size
On Sun, Feb 26, 2012 at 09:41:17PM +, Blue Swirl wrote: On Fri, Feb 24, 2012 at 00:23, David Gibson da...@gibson.dropbear.id.au wrote: From: Benjamin Herrenschmidt b...@kernel.crashing.org If the kernel page size is larger than TARGET_PAGE_SIZE, which happens for example on ppc64 with kernels compiled for 64K pages, the dirty tracking doesn't work. I think a better solution would be to push this to memory API and underlying exec.c dirty tracking so that they use the same page size as kernel (only in this KVM case, in general dirty tracking should match TARGET_PAGE_SIZE granularity). I'm having trouble reconciling the two parts of this comment. If it should be in terms of TARGET_PAGE_SIZE generally, why _not_ keep it that way always, and just do a fixup when we have to send the data to the host kernel in terms of host kernel page size? -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 4/8] Add universal DMA helper functions
On Sun, Feb 26, 2012 at 12:04:49PM +0200, Michael S. Tsirkin wrote: On Fri, Feb 24, 2012 at 02:27:39PM +1100, David Gibson wrote: Not that long ago, every device implementation using DMA directly accessed guest memory using cpu_physical_memory_*(). This meant that adding support for a guest visible IOMMU would require changing every one of these devices to go through IOMMU translation. Shortly before qemu 1.0, I made a start on fixing this by providing helper functions for PCI DMA. These are currently just stubs which call the direct access functions, but mean that an IOMMU can be implemented in one place, rather than for every PCI device. Clearly, this doesn't help for non PCI devices, which could also be IOMMU translated on some platforms. It is also problematic for the devices which have both PCI and non-PCI version (e.g. OHCI, AHCI) - we cannot use the the pci_dma_*() functions, because they assume the presence of a PCIDevice, but we don't want to have to check between pci_dma_*() and cpu_physical_memory_*() every time we do a DMA in the device code. This patch makes the first step on addressing both these problems, by introducing new (stub) dma helper functions which can be used for any DMA capable device. These dma functions take a DMAContext *, a new (currently empty) variable describing the DMA address space in which the operation is to take place. NULL indicates untranslated DMA directly into guest physical address space. The intention is that in future non-NULL values will given information about any necessary IOMMU translation. DMA using devices must obtain a DMAContext (or, potentially, contexts) from their bus or platform. For now this patch just converts the PCI wrappers to be implemented in terms of the universal wrappers, converting other drivers can take place over time. Cc: Michael S. Tsirkin m...@redhat.com Cc: Joerg Rodel joerg.ro...@amd.com Cc: Eduard - Gabriel Munteanu eduard.munte...@linux360.ro Cc: Richard Henderson r...@twiddle.net Signed-off-by: David Gibson da...@gibson.dropbear.id.au I'm a bit confused with all the stubbing going on. Is this the final form of the pci_* functions or just a stub? If the final form, we probably should just open-code them - they don't buy us much. If not, let's add a comment? Well.. it's the intended final form of pci_dma_*() - which do become trivial wrappers, yes. It's _not_ the intended final form of dma_*(), which need to grow code to do actual IOMMU translation. I'll add a comment about this in the next round. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 6/6] kvm: Fix dirty tracking with large kernel page size
On Mon, 2012-02-27 at 11:16 +1100, David Gibson wrote: If the kernel page size is larger than TARGET_PAGE_SIZE, which happens for example on ppc64 with kernels compiled for 64K pages, the dirty tracking doesn't work. I think a better solution would be to push this to memory API and underlying exec.c dirty tracking so that they use the same page size as kernel (only in this KVM case, in general dirty tracking should match TARGET_PAGE_SIZE granularity). That sounds horrible... you propose a -MUCH- more invasive change to a nasty complex core piece of code to deal with what is fixed by a 2-liner patch ? Cheers, Ben.
Re: [Qemu-devel] [PATCH 6/6] kvm: Fix dirty tracking with large kernel page size
On 26.02.2012, at 22:41, Blue Swirl wrote: On Fri, Feb 24, 2012 at 00:23, David Gibson da...@gibson.dropbear.id.au wrote: From: Benjamin Herrenschmidt b...@kernel.crashing.org If the kernel page size is larger than TARGET_PAGE_SIZE, which happens for example on ppc64 with kernels compiled for 64K pages, the dirty tracking doesn't work. I think a better solution would be to push this to memory API and underlying exec.c dirty tracking so that they use the same page size as kernel (only in this KVM case, in general dirty tracking should match TARGET_PAGE_SIZE granularity). Yeah, that would allow us to make sure we only align MMIO regions where we can, but I don't think it's an easy change to make. And this way the common page size throughout QEMU is TARGET_PAGE_SIZE, which other pieces of code rely on. Also, dynamically changing TARGET_PAGE_SIZE has unknown performance implications. So for the time being, I definitely think this is the right approach. It's easy and isolated :). Alex
[Qemu-devel] [PATCH] kvm: notify host when guest paniced
We can know the guest is paniced when the guest runs on xen. But we do not have such feature on kvm. This patch implemnts this feature, and the implementation is the same as xen: register panic notifier, and call hypercall when the guest is paniced. Signed-off-by: Wen Congyang we...@cn.fujitsu.com --- arch/x86/kernel/kvm.c| 12 arch/x86/kvm/svm.c |8 ++-- arch/x86/kvm/vmx.c |8 ++-- arch/x86/kvm/x86.c | 13 +++-- include/linux/kvm.h |1 + include/linux/kvm_para.h |1 + 6 files changed, 37 insertions(+), 6 deletions(-) diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index f0c6fd6..b928d1d 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -331,6 +331,17 @@ static struct notifier_block kvm_pv_reboot_nb = { .notifier_call = kvm_pv_reboot_notify, }; +static int +kvm_pv_panic_notify(struct notifier_block *nb, unsigned long code, void *unused) +{ + kvm_hypercall0(KVM_HC_GUEST_PANIC); + return NOTIFY_DONE; +} + +static struct notifier_block kvm_pv_panic_nb = { + .notifier_call = kvm_pv_panic_notify, +}; + static u64 kvm_steal_clock(int cpu) { u64 steal; @@ -417,6 +428,7 @@ void __init kvm_guest_init(void) paravirt_ops_setup(); register_reboot_notifier(kvm_pv_reboot_nb); + atomic_notifier_chain_register(panic_notifier_list, kvm_pv_panic_nb); for (i = 0; i KVM_TASK_SLEEP_HASHSIZE; i++) spin_lock_init(async_pf_sleepers[i].lock); if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF)) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 0b7690e..38b4705 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1900,10 +1900,14 @@ static int halt_interception(struct vcpu_svm *svm) static int vmmcall_interception(struct vcpu_svm *svm) { + int ret; + svm-next_rip = kvm_rip_read(svm-vcpu) + 3; skip_emulated_instruction(svm-vcpu); - kvm_emulate_hypercall(svm-vcpu); - return 1; + ret = kvm_emulate_hypercall(svm-vcpu); + + /* Ignore the error? */ + return ret == 0 ? 0 : 1; } static unsigned long nested_svm_get_tdp_cr3(struct kvm_vcpu *vcpu) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 66147ca..1b57ebb 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -4582,9 +4582,13 @@ static int handle_halt(struct kvm_vcpu *vcpu) static int handle_vmcall(struct kvm_vcpu *vcpu) { + int ret; + skip_emulated_instruction(vcpu); - kvm_emulate_hypercall(vcpu); - return 1; + ret = kvm_emulate_hypercall(vcpu); + + /* Ignore the error? */ + return ret == 0 ? 0 : 1; } static int handle_invd(struct kvm_vcpu *vcpu) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c9d99e5..3fc2853 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4923,7 +4923,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) u64 param, ingpa, outgpa, ret; uint16_t code, rep_idx, rep_cnt, res = HV_STATUS_SUCCESS, rep_done = 0; bool fast, longmode; - int cs_db, cs_l; + int cs_db, cs_l, r = 1; /* * hypercall generates UD from non zero cpl and real mode @@ -4964,6 +4964,10 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) case HV_X64_HV_NOTIFY_LONG_SPIN_WAIT: kvm_vcpu_on_spin(vcpu); break; + case KVM_HC_GUEST_PANIC: + vcpu-run-exit_reason = KVM_EXIT_GUEST_PANIC; + r = 0; + break; default: res = HV_STATUS_INVALID_HYPERCALL_CODE; break; @@ -4977,7 +4981,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) kvm_register_write(vcpu, VCPU_REGS_RAX, ret 0x); } - return 1; + return r; } int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) @@ -5013,6 +5017,11 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) case KVM_HC_VAPIC_POLL_IRQ: ret = 0; break; + case KVM_HC_GUEST_PANIC: + ret = 0; + vcpu-run-exit_reason = KVM_EXIT_GUEST_PANIC; + r = 0; + break; default: ret = -KVM_ENOSYS; break; diff --git a/include/linux/kvm.h b/include/linux/kvm.h index acbe429..8f0e31b 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -163,6 +163,7 @@ struct kvm_pit_config { #define KVM_EXIT_OSI 18 #define KVM_EXIT_PAPR_HCALL 19 #define KVM_EXIT_S390_UCONTROL 20 +#define KVM_EXIT_GUEST_PANIC 21 /* For KVM_EXIT_INTERNAL_ERROR */ #define KVM_INTERNAL_ERROR_EMULATION 1 diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h index ff476dd..cf94023 100644 --- a/include/linux/kvm_para.h +++ b/include/linux/kvm_para.h @@ -19,6 +19,7 @@ #define KVM_HC_MMU_OP 2 #define KVM_HC_FEATURES3 #define KVM_HC_PPC_MAP_MAGIC_PAGE
[Qemu-devel] [PATCH]qemu: deal with guest paniced event
When the host knows the guest is paniced, it will set exit_reason to KVM_EXIT_GUEST_PANIC. So if qemu receive this exit_reason, we can send a event to tell management application that the guest is paniced. Signed-off-by: Wen Congyang we...@cn.fujitsu.com --- kvm-all.c |3 +++ linux-headers/linux/kvm.h |1 + monitor.c |3 +++ monitor.h |1 + 4 files changed, 8 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index c4babda..ae428ab 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1190,6 +1190,9 @@ int kvm_cpu_exec(CPUState *env) (uint64_t)run-hw.hardware_exit_reason); ret = -1; break; +case KVM_EXIT_GUEST_PANIC: +monitor_protocol_event(QEVENT_GUEST_PANICED, NULL); +break; case KVM_EXIT_INTERNAL_ERROR: ret = kvm_handle_internal_error(env, run); break; diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index f6b5343..45dd031 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -163,6 +163,7 @@ struct kvm_pit_config { #define KVM_EXIT_OSI 18 #define KVM_EXIT_PAPR_HCALL 19 #define KVM_EXIT_S390_UCONTROL 20 +#define KVM_EXIT_GUEST_PANIC 21 /* For KVM_EXIT_INTERNAL_ERROR */ #define KVM_INTERNAL_ERROR_EMULATION 1 diff --git a/monitor.c b/monitor.c index 953e748..9802792 100644 --- a/monitor.c +++ b/monitor.c @@ -494,6 +494,9 @@ void monitor_protocol_event(MonitorEvent event, QObject *data) case QEVENT_WAKEUP: event_name = WAKEUP; break; +case QEVENT_GUEST_PANICED: +event_name = GUEST_PANICED; +break; default: abort(); break; diff --git a/monitor.h b/monitor.h index 0d49800..a62da93 100644 --- a/monitor.h +++ b/monitor.h @@ -41,6 +41,7 @@ typedef enum MonitorEvent { QEVENT_DEVICE_TRAY_MOVED, QEVENT_SUSPEND, QEVENT_WAKEUP, +QEVENT_GUEST_PANICED, QEVENT_MAX, } MonitorEvent; -- 1.7.1
Re: [Qemu-devel] [PULL] Zynq-7000 EPP platform model
On Sat, Feb 25, 2012 at 2:37 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 02/20/2012 12:25 AM, Peter Crosthwaite wrote: Pull Request for Zynq-7000 platform model initial support. The following changes since commit 99c7f87826337fa81f2f0f9baa9ca0a44faf90e9: input: send kbd+mouse events only to running guests. (2012-02-17 11:02:55 -0600) are available in the git repository at: git://developer.petalogix.com/private/peterc/qemu.git zynq-initial.6 Peter A. G. Crosthwaite (4): cadence_uart: initial version of device model cadence_ttc: initial version of device model cadence_gem: initial version of device model xilinx_zynq: machine model initial version MAINTAINERS | 5 + Makefile.target | 4 + hw/cadence_gem.c | 1229 ++ hw/cadence_ttc.c | 439 ++ hw/cadence_uart.c | 559 +++ hw/xilinx_zynq.c | 173 +++ hw/zynq_arm_sysctl.c | 532 ++ I'd prefer this comes through Peter's tree for now. If Peter wants to pull from you into his tree, I'm okay with that. Ok. v7 is up on the mailing list and addresses the bulk of Peters comments re v6. Awaiting further review. Regards, Anthony Liguori Regards, Peter
Re: [Qemu-devel] [PATCH 0/8] Add GTK UI to enable basic accessibility (v2)
On Sun, 26 Feb 2012, Anthony Liguori wrote: I realize UIs are the third rail of QEMU development, but over the years I've gotten a lot of feedback from users about our UI. I think everyone struggles with the SDL interface and its lack of discoverability but it's worse than I think most people realize for users that rely on accessibility tools. The two pieces of feedback I've gotten the most re: accessibility are the lack of QEMU's enablement for screen readers and the lack of configurable accelerators. Since we render our own terminal using a fixed sized font, we don't respect system font settings which means we ignore if the user has configured large print. We also don't integrate at all with screen readers which means that for blind users, the virtual consoles may as well not even exist. We also don't allow any type of configuration of accelerators. For users with limited dexterity (this is actually more common than you would think), they may use an input device that only inputs one key at a time. Holding down two keys at once is not possible for these users. These are solved problems though and while we could reinvent all of this ourselves with SDL, we would be crazy if we did. Modern toolkits, like GTK, solve these problems. By using GTK, we can leverage VteTerminal for screen reader integration and font configuration. We can also use GTK's accelerator support to make accelerators configurable (Gnome provides a global accelerator configuration interface). I'm not attempting to make a pretty desktop virtualization UI. Maybe we'll go there eventually but that's not what this series is about. This is just attempting to use a richer toolkit such that we can enable basic accessibility support. As a consequence, the UI is much more usable even for a user without accessibility requirements so it's a win-win. Also available at: https://github.com/aliguori/qemu/tree/gtk.2 --- v1 - v2 - Add internationalization support. I don't actually speak any other languages so I added a placeholder for a German translation. This can be tested with LANGUAGE=de_DE.UTF-8 qemu-system-x86_64 gnome-terminal, well basically every terminal that isn't konsole, is utterly incapable of rendering anything with complex shaping (devanagari/gurumukhi/whatever for instance), i'd go on a limb and say that it's defficiency in the underlying terminal emulation (VteTerminal?), so claiming to support internationalization is disingenuous. - Fixed the terminal size for VteTerminal widgets. I think the behavior makes sense now. - Fixed lots of issues raised in review comments (see individual patches) Known Issues: - I saw the X crash once. I think it has to do with widget sizes. I need to work harder to reproduce. - I've not recreated the reported memory leak yet. - I haven't added backwards compatibility code for older VteTerminal widgets yet. -- mailto:av1...@comtv.ru
Re: [Qemu-devel] [PATCH v2] net: add the support for -netdev socket, listen
On Sun, Feb 26, 2012 at 10:48 PM, Stefan Hajnoczi stefa...@gmail.com wrote: On Sat, Feb 18, 2012 at 9:19 AM, zwu.ker...@gmail.com wrote: From: Zhi Yong Wu wu...@linux.vnet.ibm.com The -net socket,listen option does not work with the newer -netdev syntax: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg01508.html This patch makes it work now. Signed-off-by: Zhi Yong Wu wu...@linux.vnet.ibm.com --- net.c | 26 + net.h | 2 + net/socket.c | 72 +- 3 files changed, 84 insertions(+), 16 deletions(-) I wanted to understand the problem better so I tried out -net socket,listen=. Here is its behavior: 1. A client can connect to QEMU, this creates a new socket VLANClientState on the VLAN. 2. If another client connects to QEMU, another VLANClientState is created. That means many socket clients can be added to the same VLAN. 3. When a simple TCP client like netcat connects and then disconnects, the VLANClientState remains forever. There seems to be no cleanup. This patch does not handle the -net socket,listen= case where multiple clients connect. good catch, thanks. Also, the -netdev socket,listen= semantics cannot match -net socket-listen= semantics because there is only one peer at any time. Some options: 1. Do not accept new connections while a client is connected. Once the client disconnects we can accept a new connection. This maintains the 1-1 peer behavior. 2. Integrate with vlan-hub so that multiple clients can connect even with -netdev. Connections will create new NetClientStates and auto-attach to the hub. This mimics -net socket,listen= but requires a hub to be used. 3. Forbid -netdev socket,listen=, only allow -net socket,listen=. I think #1 would be okay, although it no longer allows multiple connections, but I don't have a strong opinion either way. Stefan -- Regards, Zhi Yong Wu
Re: [Qemu-devel] [PATCH] qed: replace vm_clock with rt_clock for qemu-tool compatibility
On Sun, Feb 26, 2012 at 10:55 PM, Stefan Hajnoczi stefa...@linux.vnet.ibm.com wrote: The QED dirty bit timer marks the file clean after allocating writes have drained. This is cheaper than clearing/setting the dirty bit on each allocating write because the timer introduces a grace period which can be extended if more allocating writes arrive. The vm_clock was used in an attempt to prevent modifying the image file when live migration has stopped the VM. Unfortunately vm_clock is unavailable in the qemu-tool environment and will abort(3)! Since QED currently does not support live migration, just replace vm_clock with rt_clock and add comments explaining the migration blocker. Signed-off-by: Stefan Hajnoczi stefa...@linux.vnet.ibm.com --- Zhi Yong: This patch is needed in addition to the qemu_init_main_loop() patches you sent recently. Without this patch QED may read the vm_clock, which calls abort(3) in qemu-tool.c. Together, our patches make QED work again in qemu-img Since vm_clock is created via qemu_init_main_loop(), when QED read vm_clock, why will this call abort()? Can you elaborate this? what is its call path? and qemu-io. block/qed.c | 16 +++- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/block/qed.c b/block/qed.c index a041d31..fdb90e3 100644 --- a/block/qed.c +++ b/block/qed.c @@ -353,10 +353,7 @@ static void qed_start_need_check_timer(BDRVQEDState *s) { trace_qed_start_need_check_timer(s); - /* Use vm_clock so we don't alter the image file while suspended for - * migration. - */ - qemu_mod_timer(s-need_check_timer, qemu_get_clock_ns(vm_clock) + + qemu_mod_timer(s-need_check_timer, qemu_get_clock_ns(rt_clock) + get_ticks_per_sec() * QED_NEED_CHECK_TIMEOUT); } @@ -494,9 +491,18 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags) } } - s-need_check_timer = qemu_new_timer_ns(vm_clock, + s-need_check_timer = qemu_new_timer_ns(rt_clock, qed_need_check_timer_cb, s); + /* There are two issues with live migration: + * + * 1. The destination will open the image file and see the dirty bit is + * set, causing it to repair the image while the source still has it + * open for writing. + * + * 2. The timer used for clearing the dirty bit uses rt_clock and can in + * theory fire when the VM is not running during migration. + */ error_set(s-migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, qed, bs-device_name, live migration); -- 1.7.9 -- Regards, Zhi Yong Wu