Re: [Qemu-devel] Safely reopening image files by stashing fds
On 08/05/2011 09:19 PM, Anthony Liguori wrote: On 08/05/2011 10:43 AM, Kevin Wolf wrote: Am 05.08.2011 17:24, schrieb Stefan Hajnoczi: On Fri, Aug 5, 2011 at 3:28 PM, Christoph Hellwig wrote: On Fri, Aug 05, 2011 at 02:12:48PM +0100, Daniel P. Berrange wrote: Because you cannot change O_DIRECT on an open fd :(. This is why we're going through this pain. Hmm, I remember hearing that before, but looking at the current fcntl() manpage, it claims you *can* change O_DIRECT using SET_FL. Perhaps this is a newish feature, but it'd be nicer to use it if possible ? It's been there since day 1 of O_DIRECT support. Sorry, my bad. So for Linux we could just use fcntl for block_set_hostcache and not bother with reopening. However, we will need to reopen should we wish to support changing O_DSYNC. We do wish to support that. Anthony thinks that allowing the guest to toggle WCE is a prerequisite for making cache=writeback the default. And this is something that I definitely want to do for 1.0. Indeed. We discussed the following so far... 1. How to safely reopen image files 2. Dynamic hostcache change 3. Support for dynamic change of O_DSYNC Since 2 is independent of 1, shall I go ahead implementing hostcache change using fcntl. Implementation for safely reopening image files using "BDRVReopenState" can be done separately as a pre-requisite before implementing 3 Thanks, Supriya Regards, Anthony Liguori Kevin
Re: [Qemu-devel] Compilation error of coroutine-win32.c with gcc version 3.4.5 (mingw-vista special r3)
2011/8/8 Stefan Hajnoczi : > On Mon, Aug 8, 2011 at 1:30 AM, Roy Tam wrote: >> Hi all, >> >> I checked out latest git and tried to compile QEMU but I got this message: >> qemu$ make V=1 >> gcc -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN >> -DWINVER=0x501 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE >> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes >> -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes >> -fno-strict-aliasing -O3 -msse3 -msse2 -msse -mmmx >> -fomit-frame-pointer -mpreferred-stack-boundary=2 -ffast-math -pipe >> -funroll-loops -fforce-addr -mfpmath=sse -Wendif-labels >> -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self >> -Wold-style-definition -mms-bitfields -Ic:/MinGW/include/glib-2.0 >> -Ic:/MinGW/lib/glib-2.0/include -I/usr/home/User/qemu/slirp -I. >> -I/usr/home/User/qemu -I/usr/home/User/qemu/fpu -MMD -MP -MT >> coroutine-win32.o -MF ./coroutine-win32.d -O2 -g -c -o >> coroutine-win32.o coroutine-win32.c >> coroutine-win32.c:36: error: thread-local storage not supported for this >> target >> coroutine-win32.c:37: error: thread-local storage not supported for this >> target >> make: *** [coroutine-win32.o] Error 1 > > Hi Roy, > Others have successfully built for win32. Are you able to upgrade to > a newer toolchain, gcc-3.4 is 6 years old and doesn't support __thread > variables? I tried many MinGW GCC 4.x(from 4.5.0 to 4.7.0) but resulting an internal compiler error when compiling op_helper.c > > Stefan >
Re: [Qemu-devel] [PATCH] monitor: HMP: fix consecutive integer expression parsing
Blue Swirl writes: > On Fri, Aug 5, 2011 at 9:08 PM, Anthony Liguori wrote: >> On 08/05/2011 03:39 PM, Blue Swirl wrote: >>> >>> On Fri, Aug 5, 2011 at 4:51 PM, Anthony Liguori >>> wrote: On 08/03/2011 06:57 AM, Alon Levy wrote: > > Currently a command that takes two consecutive integer operations, like > client_migrate_info, will be incorrectly parsed by the human monitor if > the second expression begins with a minus ('-') or plus ('+') sign: > > client_migrate_info > client_migrate_info spice localhost 5900 -1 > => port = 5899 = 5900 - 1 > tls-port = -1 > But expected by the user to be: > port = 5900 > tls-port = -1 > > The fix is that for any required integer (ilM) expression followed by > another > integer expression (ilM) the first expression will be parsed by > expr_unary > instead of expr_sum. So you can still use arithmetic, but you have to > enclose > it in parenthesis: > > Command line | Old parsed result | With patch result > (1+1) 2 | 2, 2 | 2, 2 > 1 -1 | 0, -1 | 1, -1 > The rest are bizarre but not any worse then before > 1+2+3 | 6, 5 | 1, 5 > (1+2)+3 | 3, 3 | 3, 3 I vote for just removing the expression parsing entirely. It's incredibly non-intuitive and I don't think anyone really uses it. Does anyone strongly object? >>> >>> I think the expressions would be useful with memory addresses, like >>> "xp/i $pc-4", but I usually start GDB in these cases. Can we disable >>> the expressions only for ports? >> >> Not sure what you mean by ports. You mean for anything but vc? My goal in >> disabling the expressions would be to simplify the parsing by removing all >> that messy code. > > Retain the parsing for only memory addresses, remove from other areas. Feasible, but we'd still be open to ambiguities around addresses, and we'd still be maintaining all that messy code. > Another way would be to require any expressions to be enclosed in > parentheses for all cases. Reduces the ambiguities, but some remain. Is (1 + 2) one argument (which can evaluate into the integer 3), or three arguments (which can evaluate into the strings/filenames/whatever "(1", "+" and "2)")? Depends on argument types, just like it does without parenthesis. > But I don't object to removing the code very much, as I said I use > GDB. Also the setjmp stuff is buggy. We have more important problems to solve than providing our users with yet another pocket calculator.
Re: [Qemu-devel] Compilation error of coroutine-win32.c with gcc version 3.4.5 (mingw-vista special r3)
On Mon, Aug 8, 2011 at 1:30 AM, Roy Tam wrote: > Hi all, > > I checked out latest git and tried to compile QEMU but I got this message: > qemu$ make V=1 > gcc -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN > -DWINVER=0x501 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE > -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes > -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes > -fno-strict-aliasing -O3 -msse3 -msse2 -msse -mmmx > -fomit-frame-pointer -mpreferred-stack-boundary=2 -ffast-math -pipe > -funroll-loops -fforce-addr -mfpmath=sse -Wendif-labels > -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self > -Wold-style-definition -mms-bitfields -Ic:/MinGW/include/glib-2.0 > -Ic:/MinGW/lib/glib-2.0/include -I/usr/home/User/qemu/slirp -I. > -I/usr/home/User/qemu -I/usr/home/User/qemu/fpu -MMD -MP -MT > coroutine-win32.o -MF ./coroutine-win32.d -O2 -g -c -o > coroutine-win32.o coroutine-win32.c > coroutine-win32.c:36: error: thread-local storage not supported for this > target > coroutine-win32.c:37: error: thread-local storage not supported for this > target > make: *** [coroutine-win32.o] Error 1 Hi Roy, Others have successfully built for win32. Are you able to upgrade to a newer toolchain, gcc-3.4 is 6 years old and doesn't support __thread variables? Stefan
Re: [Qemu-devel] [PATCH] Permit -mem-path without sync mmu
On Fri, Aug 05, 2011 at 12:30:53PM -0300, Marcelo Tosatti wrote: > On Fri, Aug 05, 2011 at 08:16:42AM +0200, Jan Kiszka wrote: > > On 2011-08-05 06:02, David Gibson wrote: > > > At present, an explicit test disallows use of -mem-path when kvm is > > > enabled > > > but KVM_CAP_SYNC_MMU is not set. In particular, this prevents the user > > > from using hugetlbfs to back the guest memory. > > > > > > I can see no reason for this check, and when I asked about it previously, > > > the only theory offered was that this was a limitation of the very early > > > days of kvm which only happened to match the SYNC_MMU flag by accident. > > > > > > This patch, therefore, removes the check. This is of particular use to > > > us on POWER, where we haven't yet implement SYNC_MMU, but where backing > > > the guest with hugepages is possible, and in fact mandatory (for now). > > > > > > Signed-off-by: David Gibson > > > --- > > > exec.c |5 - > > > 1 files changed, 0 insertions(+), 5 deletions(-) > > > > > > diff --git a/exec.c b/exec.c > > > index 476b507..041637c 100644 > > > --- a/exec.c > > > +++ b/exec.c > > > @@ -2818,11 +2818,6 @@ static void *file_ram_alloc(RAMBlock *block, > > > return NULL; > > > } > > > > > > -if (kvm_enabled() && !kvm_has_sync_mmu()) { > > > -fprintf(stderr, "host lacks kvm mmu notifiers, -mem-path > > > unsupported\n"); > > > -return NULL; > > > -} > > > - > > > if (asprintf(&filename, "%s/qemu_back_mem.XX", path) == -1) { > > > return NULL; > > > } > > > > This is nothing trivial, see ce9a92411d in qemu-kvm or > > http://thread.gmane.org/gmane.comp.emulators.kvm.devel/27380. And it > > should rather target uq/master. CCing Avi, Marcelo, and the kvm list. > > > > Jan Well, sending the patch flushed out the real reason for that check, at least, as I thought it might. > Yes, the check cannot be removed because there is the possibility of > corruption using hugepages without mmu notifiers (described in the > archived message above). Ok, so. If I understand the archived message correctly. First, this check *is* all about hugepages - which is not obvious from the test itself. Second, if userspace qemu passing hugepages to kvm can cause (host) kernel memory corruption, that is clearly a host kernel bug. So am I correct in thinking this is basically just a safety feature if qemu is run on a buggy kernel. Presumably this bug was corrected at some point? Is the presence of the SYNC_MMU feature just being used as a proxy for "is this kernel recent enough to have the corruption bug fixed"? In any case this test sure as hell needs a big comment next to it explaining this context. > Why are mmu notifiers not implemented for PPC again? It's just not done yet; we're working on it. (That is, mmu notifiers are certainly present on PPC, it's just they're not wired up to kvm, yet). -- 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 3/7] QemuState: Add additional states
Luiz Capitulino writes: > On Thu, 04 Aug 2011 11:02:06 +0200 > Markus Armbruster wrote: > >> Luiz Capitulino writes: >> >> > Currently, only vm_start() and vm_stop() change the VM state. That's, >> > the state is only changed when starting or stopping the VM. >> > >> > This commit adds the qemu_state_set() function, making it possible >> > to also do state transitions when qemu is stopped or running. >> > >> > Additional states are also added and the current state is stored. >> > This is going to be used by the next commits. [...] >> > diff --git a/vl.c b/vl.c >> > index faa7c5f..2619c8e 100644 >> > --- a/vl.c >> > +++ b/vl.c >> > @@ -320,6 +320,22 @@ static int default_driver_check(QemuOpts *opts, void >> > *opaque) >> > } >> > >> > /***/ >> > +/* QEMU state */ >> > + >> > +static QemuState qemu_current_state = QSTATE_NOSTATE; >> > + >> > +QemuState qemu_state_get(void) >> > +{ >> > +return qemu_current_state; >> > +} >> > + >> > +void qemu_state_set(QemuState state) >> > +{ >> > +assert(state < QSTATE_MAX); >> >> Beware, comparison is signed if QemuState is signed (implementation >> defined; QSTATE_MAX is int). > > It's unsigned here and I got the expected warning when I did: > > assert(state >= 0); > > Don't how to address that (besides dropping the check). It's not likely to catch anthing the compiler doesn't. If you want to check, and want to check thoroughly, then I'm afraid you need to cast state. >> > +qemu_current_state = state; >> > +} >> > + >> > +/***/ >> [...]
[Qemu-devel] [PATCH] qdev: Remove some non-run codes in qdev_walk_children().
As you have known, qdev_reset_one() forever return a ZERO value to its caller, so some branches can not be forever covered in qdev_walk_children(). I thought that the return value for dev->info->reset(dev) can be returned, but dev->info->reset(dev) is referring to a function with void type. Signed-off-by: Zhi Yong Wu --- hw/qdev.c |5 + 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 292b52f..cbc5e02 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -513,10 +513,7 @@ int qdev_walk_children(DeviceState *dev, qdev_walkerfn *devfn, int err; if (devfn) { -err = devfn(dev, opaque); -if (err) { -return err; -} +devfn(dev, opaque); } QLIST_FOREACH(bus, &dev->child_bus, sibling) { -- 1.7.2.3
[Qemu-devel] [RFC] postcopy livemigration proposal
This mail is on "Yabusame: Postcopy Live Migration for Qemu/KVM" on which we'll give a talk at KVM-forum. The purpose of this mail is to letting developers know it in advance so that we can get better feedback on its design/implementation approach early before our starting to implement it. Background == * What's is postcopy livemigration It is is yet another live migration mechanism for Qemu/KVM, which implements the migration technique known as "postcopy" or "lazy" migration. Just after the "migrate" command is invoked, the execution host of a VM is instantaneously switched to a destination host. The benefit is, total migration time is shorter because it transfer a page only once. On the other hand precopy may repeat sending same pages again and again because they can be dirtied. The switching time from the source to the destination is several hunderds mili seconds so that it enables quick load balancing. For details, please refer to the papers. We believe this is useful for others so that we'd like to merge this feature into the upstream qemu/kvm. The existing implementation that we have right now is very ad-hoc because it's for academic research. For the upstream merge, we're starting to re-design/implement it and we'd like to get feedback early. Although many improvements/optimizations are possible, we should implement/merge the simple/clean, but extensible as well, one at first and then improve/optimize it later. postcopy livemigration will be introduced as optional feature. The existing precopy livemigration remains as default behavior. * related links: project page http://sites.google.com/site/grivonhome/quick-kvm-migration Enabling Instantaneous Relocation of Virtual Machines with a Lightweight VMM Extension, (proof-of-concept, ad-hoc prototype. not a new design) http://grivon.googlecode.com/svn/pub/docs/ccgrid2010-hirofuchi-paper.pdf http://grivon.googlecode.com/svn/pub/docs/ccgrid2010-hirofuchi-talk.pdf Reactive consolidation of virtual machines enabled by postcopy live migration (advantage for VM consolidation) http://portal.acm.org/citation.cfm?id=1996125 http://www.emn.fr/x-info/ascola/lib/exe/fetch.php?media=internet:vtdc-postcopy.pdf Qemu wiki http://wiki.qemu.org/Features/PostCopyLiveMigration Design/Implementation = The basic idea of postcopy livemigration is to use a sort of distributed shared memory between the migration source and destination. The migration procedure looks like - start migration stop the guest VM on the source and send the machine states except guest RAM to the destination - resume the guest VM on the destination without guest RAM contents - Hook guest access to pages, and pull page contents from the source This continues until all the pages are pulled to the destination The big picture is depicted at http://wiki.qemu.org/File:Postcopy-livemigration.png There are several design points. - who takes care of pulling page contents. an independent daemon vs a thread in qemu The daemon approach is preferable because an independent daemon would easy for debug postcopy memory mechanism without qemu. If required, it wouldn't be difficult to convert a daemon into a thread in qemu - connection between the source and the destination The connection for live migration can be re-used after sending machine state. - transfer protocol The existing protocol that exists today can be extended. - hooking guest RAM access Introduce a character device to handle page fault. When page fault occurs, it queues page request up to user space daemon at the destination. And the daemon pulls page contents from the source and serves it into the character device. Then the page fault is resovlved. * More on hooking guest RAM access There are several candidate for the implementation. Our preference is character device approach. - inserting hooks into everywhere in qemu/kvm This is impractical - backing store for guest ram a block device or a file can be used to back guest RAM. Thus hook the guest ram access. pros - new device driver isn't needed. cons - future improvement would be difficult - some KVM host feature(KSM, THP) wouldn't work - character device qemu mmap() the dedicated character device, and then hook page fault. pros - straght forward approach - future improvement would be easy cons - new driver is needed - some KVM host feature(KSM, THP) wouldn't work They checks if a given VMA is anonymous. This can be fixed. - swap device When creating guest, it is set up as if all the guest RAM is swapped out to a dedicated swap device, which may be nbd disk (or some kind of user space block device, BUSE?). When the VM tries to access memory, swap-in is triggered and IO to the swap device is issued. Then the IO to swap is routed to the daemon in user space with nbd protocol (or
[Qemu-devel] [STABLE] Fix forcing multicast msgs to loopback on OpenBSD.
Could this please be pulled back to the 0.15 branch? commit b49b710aae35add54321e4ba1b338cf6db25c2a2 Author: Brad Smith Date: Sat Jul 30 19:08:51 2011 -0400 Fix forcing multicast msgs to loopback on OpenBSD. On 07/08/11 7:10 AM, Blue Swirl wrote: Thanks, applied. On Sat, Jul 30, 2011 at 11:34 PM, Brad wrote: On Fri, Jul 29, 2011 at 07:15:11PM -0400, Brad wrote: Fix forcing multicast msgs to loopback on OpenBSD. e.g. $ sudo qemu -m 128 -no-fd-bootchk \ -hda virtual.img -boot n -nographic \ -net nic,vlan=0,model=rtl8139,macaddr=52:54:00:12:34:03 \ -net user -tftp /usr/src/sys/arch/i386/compile/TEST -bootp pxeboot \ -net nic,vlan=1,model=rtl8139,macaddr=52:54:00:23:03:01 \ -net tap,vlan=1,script=no \ -net nic,vlan=3,model=rtl8139,macaddr=52:54:00:23:03:03 \ -net socket,vlan=3,mcast=230.0.0.1:10003 setsockopt(SOL_IP, IP_MULTICAST_LOOP): Invalid argument qemu: -net socket,vlan=3,mcast=230.0.0.1:10003: Device 'socket' could not be initialized Signed-off-by: Brad Smith An updated diff taking Blue Swirl's comment into consideration. --- net/socket.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/net/socket.c b/net/socket.c index 11fe5f3..5cd0b9a 100644 --- a/net/socket.c +++ b/net/socket.c @@ -154,6 +154,12 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr, struct in_addr struct ip_mreq imr; int fd; int val, ret; +#ifdef __OpenBSD__ +unsigned char loop; +#else +int loop; +#endif + if (!IN_MULTICAST(ntohl(mcastaddr->sin_addr.s_addr))) { fprintf(stderr, "qemu: error: specified mcastaddr \"%s\" (0x%08x) does not contain a multicast address\n", inet_ntoa(mcastaddr->sin_addr), @@ -197,9 +203,9 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr, struct in_addr } /* Force mcast msgs to loopback (eg. several QEMUs in same host */ -val = 1; +loop = 1; ret=setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, - (const char *)&val, sizeof(val)); + (const char *)&loop, sizeof(loop)); if (ret< 0) { perror("setsockopt(SOL_IP, IP_MULTICAST_LOOP)"); goto fail; -- 1.7.6 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Re: [Qemu-devel] support for Freescale MPC8xx (850/860) processors/platforms
Hi, Anyone working on Freescale MPC8xx (embedded PowerPC) processors ?? I'm trying to ascertain if the MPC8xx (MPC850) processors are supported, and if not, how much effort would be required to get it working. Thanks for any help. Brendan. On 5/08/11 9:31 PM, Brendan Simon (eTRIX) wrote: > Hello, > > Does QEMU support the Freescale MPC8xx (MPC850) processors or > platforms (e.g FADS860) ?? > > Googling shows some code that suggests that it is not supported. > > > cpu_abort(env, "/MPC8xx/ MMU model is not implemented\n"); > > > If not supported, does anyone have any idea how much work there would > be to add support for MPC850/860 and to create a platform that has > supports DRAM, Flash, the CPM peripherals (SMC/USARTS, SCC/UARTS, > SCC/Ethernet, BRG timers, etc) ?? > > The platform I would like to build has 1 x Ethernet (using SCC2), 1 x > UART (on SMC1), 1 x UART (on SCC3), 1 x UART (external UART chip), and > an Altera CPLD with digital I/O. > > Are there any other similar platforms I could look at, to either port > or use as a reference, to build an MPC850 platform as described ?? > > Thanks, > Brendan. >
[Qemu-devel] Compilation error of coroutine-win32.c with gcc version 3.4.5 (mingw-vista special r3)
Hi all, I checked out latest git and tried to compile QEMU but I got this message: qemu$ make V=1 gcc -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -O3 -msse3 -msse2 -msse -mmmx -fomit-frame-pointer -mpreferred-stack-boundary=2 -ffast-math -pipe -funroll-loops -fforce-addr -mfpmath=sse -Wendif-labels -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wold-style-definition -mms-bitfields -Ic:/MinGW/include/glib-2.0 -Ic:/MinGW/lib/glib-2.0/include -I/usr/home/User/qemu/slirp -I. -I/usr/home/User/qemu -I/usr/home/User/qemu/fpu -MMD -MP -MT coroutine-win32.o -MF ./coroutine-win32.d -O2 -g -c -o coroutine-win32.o coroutine-win32.c coroutine-win32.c:36: error: thread-local storage not supported for this target coroutine-win32.c:37: error: thread-local storage not supported for this target make: *** [coroutine-win32.o] Error 1 Please advice. Best regards, Roy
[Qemu-devel] [PATCH] Check for presence of compiler -pthread flag
Check for presence of compiler -pthread flag. OpenBSD / FreeBSD and some other OS's require the use of cc -pthread to link threaded programs so have QEMU's configure script check for the presence of the flag and use it if so. Signed-off-by: Brad Smith --- configure |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure b/configure index 0c67a4a..bd850f3 100755 --- a/configure +++ b/configure @@ -1858,7 +1858,7 @@ fi ## # pthread probe -PTHREADLIBS_LIST="-lpthread -lpthreadGC2" +PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2" pthread=no cat > $TMPC << EOF -- 1.7.6 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
[Qemu-devel] [PATCH] qcow2: fix typo in documentation for qcow2_get_cluster_offset()
Documentation states the num is measured in clusters, but its actually measured in sectors Signed-off-by: Devin Nakamura --- block/qcow2-cluster.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 81cf77d..154597e 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -381,10 +381,10 @@ static int copy_sectors(BlockDriverState *bs, uint64_t start_sect, * For a given offset of the disk image, find the cluster offset in * qcow2 file. The offset is stored in *cluster_offset. * - * on entry, *num is the number of contiguous clusters we'd like to + * on entry, *num is the number of contiguous sectors we'd like to * access following offset. * - * on exit, *num is the number of contiguous clusters we can read. + * on exit, *num is the number of contiguous sectors we can read. * * Return 0, if the offset is found * Return -errno, otherwise. -- 1.7.6.rc1
Re: [Qemu-devel] [PATCH 2/3] usb-redir: Call qemu_chr_guest_open/close
On 08/07/2011 12:41 PM, Hans de Goede wrote: Hi, On 08/07/2011 05:52 PM, Anthony Liguori wrote: On 08/07/2011 08:21 AM, Hans de Goede wrote: To let the chardev now we're ready start receiving data. This is necessary with the spicevmc chardev to get it registered with the spice-server. Signed-off-by: Hans de Goede --- usb-redir.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index e212993..ec88c0b 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -809,6 +809,8 @@ static int usbredir_initfn(USBDevice *udev) qemu_chr_add_handlers(dev->cs, usbredir_chardev_can_read, usbredir_chardev_read, usbredir_chardev_event, dev); + /* Let the other side know we are ready */ + qemu_chr_guest_open(dev->cs); You should do guest_open before adding handlers. Erm, no, guest_open may lead to a callback in the chardev, to which it may respond by immediately queuing a few writes / doing a read. So after my char-flow changes, you won't be allowed to set handlers unless you've called open. We want qemu_chr_guest_open() -> qemu_chr_fe_open() and for it to be analogous to a qemu_chr_be_open() which would be called immediately after accept() returned on a socket to signal that the backend is opened. Because there's an intermediate queue, even if a write happens after open, no data will be lost. So conceptionally, it makes sense to set handlers after open IMHO. But most importantly to this series, no backend can possibly generate a write before you get to call add handlers so you've got nothing to worry about here (based on the code today). Regards, Anthony Liguori To me it makes much more sense to actually call guest_open when we are ready to receive data / to be read from, rather then to do it before our handlers are hooked up and thus before we are ready. Regards, Hans
[Qemu-devel] [PATCH 11/11] m48t59: avoid structure holes spotted by pahole
Report from pahole on amd64 host: struct M48t59State { uint32_t type; /* 0 4 */ /* XXX 4 bytes hole, try to pack */ qemu_irq IRQ; /* 8 8 */ uint32_t io_base; /*16 4 */ uint32_t size; /*20 4 */ time_t time_offset; /*24 8 */ time_t stop_time;/*32 8 */ struct tm alarm;/*4056 */ /* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */ struct QEMUTimer * alrm_timer; /*96 8 */ struct QEMUTimer * wd_timer; /* 104 8 */ uint8_tlock; /* 112 1 */ /* XXX 1 byte hole, try to pack */ uint16_t addr; /* 114 2 */ /* XXX 4 bytes hole, try to pack */ uint8_t * buffer; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ /* size: 128, cachelines: 2 */ /* sum members: 119, holes: 3, sum holes: 9 */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/m48t59.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/m48t59.c b/hw/m48t59.c index 537c0f7..67685cd 100644 --- a/hw/m48t59.c +++ b/hw/m48t59.c @@ -50,8 +50,6 @@ */ struct M48t59State { -/* Model parameters */ -uint32_t type; // 2 = m48t02, 8 = m48t08, 59 = m48t59 /* Hardware parameters */ qemu_irq IRQ; uint32_t io_base; @@ -64,9 +62,12 @@ struct M48t59State { struct QEMUTimer *alrm_timer; struct QEMUTimer *wd_timer; /* NVRAM storage */ -uint8_t lock; -uint16_t addr; uint8_t *buffer; +/* Model parameters */ +uint32_t type; /* 2 = m48t02, 8 = m48t08, 59 = m48t59 */ +/* NVRAM storage */ +uint16_t addr; +uint8_t lock; }; typedef struct M48t59ISAState { -- 1.6.2.4 From b8a1e6b0170f26924c35750ba387a656ea2c614c Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 20:02:02 + Subject: [PATCH 11/11] m48t59: avoid structure holes spotted by pahole Report from pahole on amd64 host: struct M48t59State { uint32_t type; /* 0 4 */ /* XXX 4 bytes hole, try to pack */ qemu_irq IRQ; /* 8 8 */ uint32_t io_base; /*16 4 */ uint32_t size; /*20 4 */ time_t time_offset; /*24 8 */ time_t stop_time;/*32 8 */ struct tm alarm;/*4056 */ /* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */ struct QEMUTimer * alrm_timer; /*96 8 */ struct QEMUTimer * wd_timer; /* 104 8 */ uint8_tlock; /* 112 1 */ /* XXX 1 byte hole, try to pack */ uint16_t addr; /* 114 2 */ /* XXX 4 bytes hole, try to pack */ uint8_t * buffer; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ /* size: 128, cachelines: 2 */ /* sum members: 119, holes: 3, sum holes: 9 */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/m48t59.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/m48t59.c b/hw/m48t59.c index 537c0f7..67685cd 100644 --- a/hw/m48t59.c +++ b/hw/m48t59.c @@ -50,8 +50,6 @@ */ struct M48t59State { -/* Model parameters */ -uint32_t type; // 2 = m48t02, 8 = m48t08, 59 = m48t59 /* Hardware parameters */ qemu_irq IRQ; uint32_t io_base; @@ -64,9 +62,12 @@ struct M48t59State { struct QEMUTimer *alrm_timer; struct QEMUTimer *wd_timer; /* NVRAM storage */ -uint8_t lock; -uint16_t addr; uint8_t *buffer; +/* Model parameters */ +uint32_t type; /* 2 = m48t02, 8 = m48t08, 59 = m48t59 */ +/* NVRAM storage */ +uint16_t addr; +uint8_t lock; }; typedef struct M48t59ISAState { -- 1.7.2.5
[Qemu-devel] [PATCH 10/11] escc: avoid structure holes spotted by pahole
Edited report from pahole on amd64 host: struct ChannelState { ... ChnTypetype; /*32 4 */ /* XXX 4 bytes hole, try to pack */ ... uint8_trregs[16];/*6616 */ /* XXX 2 bytes hole, try to pack */ ... /* size: 392, cachelines: 7 */ /* sum members: 382, holes: 2, sum holes: 6 */ /* padding: 4 */ /* last cacheline: 8 bytes */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/escc.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/escc.c b/hw/escc.c index f6fd919..9d73d99 100644 --- a/hw/escc.c +++ b/hw/escc.c @@ -108,18 +108,19 @@ typedef struct { #define SERIAL_REGS 16 typedef struct ChannelState { qemu_irq irq; -uint32_t reg; uint32_t rxint, txint, rxint_under_svc, txint_under_svc; -ChnID chn; // this channel, A (base+4) or B (base+0) -ChnType type; struct ChannelState *otherchn; -uint8_t rx, tx, wregs[SERIAL_REGS], rregs[SERIAL_REGS]; +uint32_t reg; +uint8_t wregs[SERIAL_REGS], rregs[SERIAL_REGS]; SERIOQueue queue; CharDriverState *chr; int e0_mode, led_mode, caps_lock_mode, num_lock_mode; int disabled; int clock; uint32_t vmstate_dummy; +ChnID chn; // this channel, A (base+4) or B (base+0) +ChnType type; +uint8_t rx, tx; } ChannelState; struct SerialState { -- 1.6.2.4 From 3d7a4479fca08fea065b45de24485ef91f210a51 Mon Sep 17 00:00:00 2001 Message-Id: <3d7a4479fca08fea065b45de24485ef91f210a51.1312750600.git.blauwir...@gmail.com> In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:55:23 + Subject: [PATCH 10/11] escc: avoid structure holes spotted by pahole Edited report from pahole on amd64 host: struct ChannelState { ... ChnTypetype; /*32 4 */ /* XXX 4 bytes hole, try to pack */ ... uint8_trregs[16];/*6616 */ /* XXX 2 bytes hole, try to pack */ ... /* size: 392, cachelines: 7 */ /* sum members: 382, holes: 2, sum holes: 6 */ /* padding: 4 */ /* last cacheline: 8 bytes */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/escc.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/escc.c b/hw/escc.c index f6fd919..9d73d99 100644 --- a/hw/escc.c +++ b/hw/escc.c @@ -108,18 +108,19 @@ typedef struct { #define SERIAL_REGS 16 typedef struct ChannelState { qemu_irq irq; -uint32_t reg; uint32_t rxint, txint, rxint_under_svc, txint_under_svc; -ChnID chn; // this channel, A (base+4) or B (base+0) -ChnType type; struct ChannelState *otherchn; -uint8_t rx, tx, wregs[SERIAL_REGS], rregs[SERIAL_REGS]; +uint32_t reg; +uint8_t wregs[SERIAL_REGS], rregs[SERIAL_REGS]; SERIOQueue queue; CharDriverState *chr; int e0_mode, led_mode, caps_lock_mode, num_lock_mode; int disabled; int clock; uint32_t vmstate_dummy; +ChnID chn; // this channel, A (base+4) or B (base+0) +ChnType type; +uint8_t rx, tx; } ChannelState; struct SerialState { -- 1.7.2.5
[Qemu-devel] [PATCH 09/11] fdc: avoid structure holes spotted by pahole
Edited report from pahole on amd64 host: struct FDCtrl { uint8_tversion; /* 0 1 */ /* XXX 7 bytes hole, try to pack */ qemu_irq irq; /* 8 8 */ intdma_chann;/*16 4 */ /* XXX 4 bytes hole, try to pack */ ... uint8_tstatus2; /*42 1 */ /* XXX 5 bytes hole, try to pack */ uint8_t * fifo; /*48 8 */ ... uint8_tpwrd; /*76 1 */ /* XXX 3 bytes hole, try to pack */ intsun4m;/*80 4 */ uint8_tnum_floppies; /*84 1 */ /* XXX 3 bytes hole, try to pack */ FDrive drives[2];/*8864 */ /* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */ intreset_sensei; /* 152 4 */ /* size: 160, cachelines: 3 */ /* sum members: 134, holes: 5, sum holes: 22 */ /* padding: 4 */ /* last cacheline: 32 bytes */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/fdc.c | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/fdc.c b/hw/fdc.c index edf0360..580b657 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -374,13 +374,13 @@ enum { #define FD_FORMAT_CMD(state) ((state) & FD_STATE_FORMAT) struct FDCtrl { -/* Controller's identification */ -uint8_t version; -/* HW */ qemu_irq irq; -int dma_chann; /* Controller state */ QEMUTimer *result_timer; +int dma_chann; +/* Controller's identification */ +uint8_t version; +/* HW */ uint8_t sra; uint8_t srb; uint8_t dor; @@ -401,21 +401,21 @@ struct FDCtrl { uint8_t data_dir; uint8_t eot; /* last wanted sector */ /* States kept only to be returned back */ -/* Timers state */ -uint8_t timer0; -uint8_t timer1; /* precompensation */ uint8_t precomp_trk; uint8_t config; uint8_t lock; /* Power down config (also with status regB access mode */ uint8_t pwrd; -/* Sun4m quirks? */ -int sun4m; /* Floppy drives */ uint8_t num_floppies; +/* Sun4m quirks? */ +int sun4m; FDrive drives[MAX_FD]; int reset_sensei; +/* Timers state */ +uint8_t timer0; +uint8_t timer1; }; typedef struct FDCtrlSysBus { -- 1.6.2.4 From 12ec5e100f9198cd6a6be2b00e17b5399eecbaa7 Mon Sep 17 00:00:00 2001 Message-Id: <12ec5e100f9198cd6a6be2b00e17b5399eecbaa7.1312750600.git.blauwir...@gmail.com> In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:43:38 + Subject: [PATCH 09/11] fdc:avoid structure holes spotted by pahole Edited report from pahole on amd64 host: struct FDCtrl { uint8_tversion; /* 0 1 */ /* XXX 7 bytes hole, try to pack */ qemu_irq irq; /* 8 8 */ intdma_chann;/*16 4 */ /* XXX 4 bytes hole, try to pack */ ... uint8_tstatus2; /*42 1 */ /* XXX 5 bytes hole, try to pack */ uint8_t * fifo; /*48 8 */ ... uint8_tpwrd; /*76 1 */ /* XXX 3 bytes hole, try to pack */ intsun4m;/*80 4 */ uint8_tnum_floppies; /*84 1 */ /* XXX 3 bytes hole, try to pack */ FDrive drives[2];/*8864 */ /* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */ intreset_sensei; /* 152 4 */ /* size: 160, cachelines: 3 */ /* sum members: 134, holes: 5, sum holes: 22 */ /* padding: 4 */ /* last cacheline: 32 bytes */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/fdc.c | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/fdc.c b/hw/fdc.c index edf0360..580b657 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -374,13 +374,13 @@ enum { #define FD_FORMAT_CMD(state) ((state) & FD_STATE_FORMAT) struct FDCtrl { -/* Controller's identification */ -uint8_t version; -/* HW */ qemu_irq irq; -int dma_chann; /* Controller state */ QEMUTimer *result_timer; +int dma_chann; +/* Controller's identification */ +uint8_t version; +/* HW */ uint8_t sra; uint8_t srb; uint8
[Qemu-devel] [PATCH 08/11] pcnet: avoid structure holes spotted by pahole
Edited report from pahole on amd64 host: struct PCNetState_st { ... uint16_t bcr[32]; /* 34064 */ /* XXX 4 bytes hole, try to pack */ ... inttx_busy; /* 4520 4 */ /* XXX 4 bytes hole, try to pack */ qemu_irq irq; /* 4528 8 */ void (*phys_mem_read)(void *, target_phys_addr_t, uint8_t *, int, int); /* 4536 8 */ /* --- cacheline 71 boundary (4544 bytes) --- */ void (*phys_mem_write)(void *, target_phys_addr_t, uint8_t *, int, int); /* 4544 8 */ void * dma_opaque; /* 4552 8 */ intlooptest; /* 4560 4 */ /* size: 4568, cachelines: 72 */ /* sum members: 4556, holes: 2, sum holes: 8 */ /* padding: 4 */ /* last cacheline: 24 bytes */ }; /* definitions: 2 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/pcnet.h |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/pcnet.h b/hw/pcnet.h index 534bdf9..9a7b122 100644 --- a/hw/pcnet.h +++ b/hw/pcnet.h @@ -11,15 +11,15 @@ struct PCNetState_st { NICState *nic; NICConf conf; QEMUTimer *poll_timer; -int rap, isr, lnkst; +int rap, isr; uint32_t rdra, tdra; +uint64_t timer; uint8_t prom[16]; uint16_t csr[128]; uint16_t bcr[32]; -uint64_t timer; int mmio_index, xmit_pos; uint8_t buffer[4096]; -int tx_busy; +int tx_busy, lnkst; qemu_irq irq; void (*phys_mem_read)(void *dma_opaque, target_phys_addr_t addr, uint8_t *buf, int len, int do_bswap); -- 1.6.2.4 From 6eda685443fbe094e7a551149c52dfdc9e6be6a6 Mon Sep 17 00:00:00 2001 Message-Id: <6eda685443fbe094e7a551149c52dfdc9e6be6a6.1312750600.git.blauwir...@gmail.com> In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:38:49 + Subject: [PATCH 08/11] pcnet: void structure holes spotted by pahole Edited report from pahole on amd64 host: struct PCNetState_st { ... uint16_t bcr[32]; /* 34064 */ /* XXX 4 bytes hole, try to pack */ ... inttx_busy; /* 4520 4 */ /* XXX 4 bytes hole, try to pack */ qemu_irq irq; /* 4528 8 */ void (*phys_mem_read)(void *, target_phys_addr_t, uint8_t *, int, int); /* 4536 8 */ /* --- cacheline 71 boundary (4544 bytes) --- */ void (*phys_mem_write)(void *, target_phys_addr_t, uint8_t *, int, int); /* 4544 8 */ void * dma_opaque; /* 4552 8 */ intlooptest; /* 4560 4 */ /* size: 4568, cachelines: 72 */ /* sum members: 4556, holes: 2, sum holes: 8 */ /* padding: 4 */ /* last cacheline: 24 bytes */ }; /* definitions: 2 */ Fix by rearranging structures to avoid padding. Signed-off-by: Blue Swirl --- hw/pcnet.h |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/pcnet.h b/hw/pcnet.h index 534bdf9..9a7b122 100644 --- a/hw/pcnet.h +++ b/hw/pcnet.h @@ -11,15 +11,15 @@ struct PCNetState_st { NICState *nic; NICConf conf; QEMUTimer *poll_timer; -int rap, isr, lnkst; +int rap, isr; uint32_t rdra, tdra; +uint64_t timer; uint8_t prom[16]; uint16_t csr[128]; uint16_t bcr[32]; -uint64_t timer; int mmio_index, xmit_pos; uint8_t buffer[4096]; -int tx_busy; +int tx_busy, lnkst; qemu_irq irq; void (*phys_mem_read)(void *dma_opaque, target_phys_addr_t addr, uint8_t *buf, int len, int do_bswap); -- 1.7.2.5
[Qemu-devel] [PATCH 07/11] esp: avoid structure holes spotted by pahole
Report from pahole on amd64 host: struct ESPState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ uint32_t it_shift; /* 5648 4 */ /* XXX 4 bytes hole, try to pack */ qemu_irq irq; /* 5656 8 */ uint8_trregs[16];/* 566416 */ uint8_twregs[16];/* 568016 */ /* --- cacheline 89 boundary (5696 bytes) --- */ int32_tti_size; /* 5696 4 */ uint32_t ti_rptr; /* 5700 4 */ uint32_t ti_wptr; /* 5704 4 */ uint8_tti_buf[16]; /* 570816 */ uint32_t status; /* 5724 4 */ uint32_t dma; /* 5728 4 */ /* XXX 4 bytes hole, try to pack */ SCSIBusbus; /* 5736 2120 */ /* --- cacheline 122 boundary (7808 bytes) was 48 bytes ago --- */ SCSIDevice * current_dev; /* 7856 8 */ SCSIRequest * current_req; /* 7864 8 */ /* --- cacheline 123 boundary (7872 bytes) --- */ uint8_tcmdbuf[16]; /* 787216 */ uint32_t cmdlen; /* 7888 4 */ uint32_t do_cmd; /* 7892 4 */ uint32_t dma_left; /* 7896 4 */ uint32_t dma_counter; /* 7900 4 */ uint8_t * async_buf;/* 7904 8 */ uint32_t async_len;/* 7912 4 */ /* XXX 4 bytes hole, try to pack */ ESPDMAMemoryReadWriteFunc dma_memory_read; /* 7920 8 */ ESPDMAMemoryReadWriteFunc dma_memory_write; /* 7928 8 */ /* --- cacheline 124 boundary (7936 bytes) --- */ void * dma_opaque; /* 7936 8 */ intdma_enabled; /* 7944 4 */ /* XXX 4 bytes hole, try to pack */ void (*dma_cb)(ESPState *); /* 7952 8 */ /* size: 7960, cachelines: 125 */ /* sum members: 7944, holes: 4, sum holes: 16 */ /* last cacheline: 24 bytes */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/esp.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/esp.c b/hw/esp.c index 9ddd637..e0ce051 100644 --- a/hw/esp.c +++ b/hw/esp.c @@ -54,15 +54,15 @@ typedef struct ESPState ESPState; struct ESPState { SysBusDevice busdev; -uint32_t it_shift; -qemu_irq irq; uint8_t rregs[ESP_REGS]; uint8_t wregs[ESP_REGS]; +qemu_irq irq; +uint32_t it_shift; int32_t ti_size; uint32_t ti_rptr, ti_wptr; -uint8_t ti_buf[TI_BUFSZ]; uint32_t status; uint32_t dma; +uint8_t ti_buf[TI_BUFSZ]; SCSIBus bus; SCSIDevice *current_dev; SCSIRequest *current_req; @@ -75,13 +75,14 @@ struct ESPState { /* The size of the current DMA transfer. Zero if no transfer is in progress. */ uint32_t dma_counter; -uint8_t *async_buf; +int dma_enabled; + uint32_t async_len; +uint8_t *async_buf; ESPDMAMemoryReadWriteFunc dma_memory_read; ESPDMAMemoryReadWriteFunc dma_memory_write; void *dma_opaque; -int dma_enabled; void (*dma_cb)(ESPState *s); }; -- 1.6.2.4 From eea9f844b8444f63ee3435ad1913f31f7ad3e373 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:33:30 + Subject: [PATCH 07/11] esp: avoid structure holes spotted by pahole Report from pahole on amd64 host: struct ESPState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ uint32_t it_shift; /* 5648 4 */ /* XXX 4 bytes hole, try to pack */ qemu_irq irq; /* 5656 8 */ uint8_trregs[16];/* 566416 */ uint8_twregs[16];/* 568016 */ /* --- cacheline 89 boundary (5696 bytes) --- */ int32_tti_size; /* 5696 4 */ uint32_t ti_rptr; /* 5700 4 */ uint32_t ti_wptr; /* 5
[Qemu-devel] [PATCH 06/11] sun4m: avoid structure holes spotted by pahole
Edited report from pahole on amd64 host: struct sun4c_hwdef { ... uint8_tnvram_machine_id; /* 112 1 */ /* XXX 1 byte hole, try to pack */ ... /* size: 136, cachelines: 3 */ /* sum members: 135, holes: 1, sum holes: 1 */ /* last cacheline: 8 bytes */ }; /* definitions: 1 */ struct sun4d_hwdef { ... uint8_tnvram_machine_id; /* 128 1 */ /* XXX 1 byte hole, try to pack */ ... /* size: 152, cachelines: 3 */ /* sum members: 151, holes: 1, sum holes: 1 */ /* last cacheline: 24 bytes */ }; /* definitions: 1 */ struct sun4m_hwdef { ... uint8_tnvram_machine_id; /* 260 1 */ /* XXX 1 byte hole, try to pack */ uint16_t machine_id; /* 262 2 */ uint32_t iommu_version;/* 264 4 */ /* XXX 4 bytes hole, try to pack */ ... /* size: 288, cachelines: 5 */ /* sum members: 283, holes: 2, sum holes: 5 */ /* last cacheline: 32 bytes */ }; /* definitions: 1 */ Fix by rearranging the structures to avoid padding. Signed-off-by: Blue Swirl --- hw/sun4m.c | 20 ++-- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/sun4m.c b/hw/sun4m.c index df3aa32..5afb1b1 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -97,12 +97,12 @@ struct sun4m_hwdef { target_phys_addr_t reg_base, vram_base; } vsimm[MAX_VSIMMS]; target_phys_addr_t ecc_base; -uint32_t ecc_version; -uint8_t nvram_machine_id; -uint16_t machine_id; -uint32_t iommu_version; uint64_t max_mem; const char * const default_cpu_model; +uint32_t ecc_version; +uint32_t iommu_version; +uint16_t machine_id; +uint8_t nvram_machine_id; }; #define MAX_IOUNITS 5 @@ -115,11 +115,11 @@ struct sun4d_hwdef { target_phys_addr_t ledma_base, le_base; target_phys_addr_t tcx_base; target_phys_addr_t sbi_base; -uint8_t nvram_machine_id; -uint16_t machine_id; -uint32_t iounit_version; uint64_t max_mem; const char * const default_cpu_model; +uint32_t iounit_version; +uint16_t machine_id; +uint8_t nvram_machine_id; }; struct sun4c_hwdef { @@ -128,11 +128,11 @@ struct sun4c_hwdef { target_phys_addr_t serial_base, fd_base; target_phys_addr_t idreg_base, dma_base, esp_base, le_base; target_phys_addr_t tcx_base, aux1_base; -uint8_t nvram_machine_id; -uint16_t machine_id; -uint32_t iommu_version; uint64_t max_mem; const char * const default_cpu_model; +uint32_t iommu_version; +uint16_t machine_id; +uint8_t nvram_machine_id; }; int DMA_get_channel_mode (int nchan) -- 1.6.2.4 From dce5a7901b80ee038a6c28ee0520588531b8e5cb Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:22:46 + Subject: [PATCH 06/11] sun4m: avoid structure holes spotted by pahole Edited report from pahole on amd64 host: struct sun4c_hwdef { ... uint8_tnvram_machine_id; /* 112 1 */ /* XXX 1 byte hole, try to pack */ ... /* size: 136, cachelines: 3 */ /* sum members: 135, holes: 1, sum holes: 1 */ /* last cacheline: 8 bytes */ }; /* definitions: 1 */ struct sun4d_hwdef { ... uint8_tnvram_machine_id; /* 128 1 */ /* XXX 1 byte hole, try to pack */ ... /* size: 152, cachelines: 3 */ /* sum members: 151, holes: 1, sum holes: 1 */ /* last cacheline: 24 bytes */ }; /* definitions: 1 */ struct sun4m_hwdef { ... uint8_tnvram_machine_id; /* 260 1 */ /* XXX 1 byte hole, try to pack */ uint16_t machine_id; /* 262 2 */ uint32_t iommu_version;/* 264 4 */ /* XXX 4 bytes hole, try to pack */ ... /* size: 288, cachelines: 5 */ /* sum members: 283, holes: 2, sum holes: 5 */ /* last cacheline: 32 bytes */ }; /* definitions: 1 */ Fix by rearranging structures to avoid padding. Signed-off-by: Blue Swirl --- hw/sun4m.c | 20 ++-- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/sun4m.c b/hw/sun4m.c index df3aa32..5afb1b1 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -97,12 +97,12 @@ struct sun4m_hwdef { target_phys_addr_t reg_base, vram_base; } vsimm[MAX_VSIMMS]; target_phys_addr_t ecc_base; -uint32_t ecc_version; -uint8_t nvram_machine_id; -uint16_t machine_id; -uint32_t iommu_version; uint64_t max_mem; const char * const default_cpu_model; +uint32_t ecc_version; +uint32_t iommu_version; +uint16_t machine_id; +uint8_t nvram_machine_id; }; #define MAX_IOUNITS 5 @
[Qemu-devel] [PATCH 05/11] tcx: avoid structure holes spotted by pahole
Report from pahole on amd64 host: struct TCXState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ target_phys_addr_t addr; /* 5648 8 */ DisplayState * ds; /* 5656 8 */ uint8_t * vram; /* 5664 8 */ uint32_t * vram24; /* 5672 8 */ uint32_t * cplane; /* 5680 8 */ ram_addr_t vram_offset; /* 5688 8 */ /* --- cacheline 89 boundary (5696 bytes) --- */ ram_addr_t vram24_offset;/* 5696 8 */ ram_addr_t cplane_offset;/* 5704 8 */ uint32_t vram_size;/* 5712 4 */ uint16_t width;/* 5716 2 */ uint16_t height; /* 5718 2 */ uint16_t depth;/* 5720 2 */ uint8_tr[256]; /* 5722 256 */ /* --- cacheline 93 boundary (5952 bytes) was 26 bytes ago --- */ uint8_tg[256]; /* 5978 256 */ /* --- cacheline 97 boundary (6208 bytes) was 26 bytes ago --- */ uint8_tb[256]; /* 6234 256 */ /* XXX 2 bytes hole, try to pack */ /* --- cacheline 101 boundary (6464 bytes) was 28 bytes ago --- */ uint32_t palette[256]; /* 6492 1024 */ /* --- cacheline 117 boundary (7488 bytes) was 28 bytes ago --- */ uint8_tdac_index;/* 7516 1 */ uint8_tdac_state;/* 7517 1 */ /* size: 7520, cachelines: 118 */ /* sum members: 7516, holes: 1, sum holes: 2 */ /* padding: 2 */ /* last cacheline: 32 bytes */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/tcx.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/tcx.c b/hw/tcx.c index 0e32830..309600d 100644 --- a/hw/tcx.c +++ b/hw/tcx.c @@ -42,9 +42,9 @@ typedef struct TCXState { uint32_t *vram24, *cplane; ram_addr_t vram_offset, vram24_offset, cplane_offset; uint32_t vram_size; -uint16_t width, height, depth; -uint8_t r[256], g[256], b[256]; uint32_t palette[256]; +uint8_t r[256], g[256], b[256]; +uint16_t width, height, depth; uint8_t dac_index, dac_state; } TCXState; -- 1.6.2.4 From 8d58424cbef59c326a7cbaddb64509614a56595d Mon Sep 17 00:00:00 2001 Message-Id: <8d58424cbef59c326a7cbaddb64509614a56595d.1312750600.git.blauwir...@gmail.com> In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:13:24 + Subject: [PATCH 05/11] tcx: avoid structure holes spotted by pahole Report from pahole on amd64 host: struct TCXState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ target_phys_addr_t addr; /* 5648 8 */ DisplayState * ds; /* 5656 8 */ uint8_t * vram; /* 5664 8 */ uint32_t * vram24; /* 5672 8 */ uint32_t * cplane; /* 5680 8 */ ram_addr_t vram_offset; /* 5688 8 */ /* --- cacheline 89 boundary (5696 bytes) --- */ ram_addr_t vram24_offset;/* 5696 8 */ ram_addr_t cplane_offset;/* 5704 8 */ uint32_t vram_size;/* 5712 4 */ uint16_t width;/* 5716 2 */ uint16_t height; /* 5718 2 */ uint16_t depth;/* 5720 2 */ uint8_tr[256]; /* 5722 256 */ /* --- cacheline 93 boundary (5952 bytes) was 26 bytes ago --- */ uint8_tg[256]; /* 5978 256 */ /* --- cacheline 97 boundary (6208 bytes) was 26 bytes ago --- */ uint8_tb[256]; /* 6234 256 */ /* XXX 2 bytes hole, try to pack */ /* --- cacheline 101 boundary (6464 bytes) was 28 bytes ago --- */ uint32_t palette[256]; /* 6492 1024 */ /* --- cacheline 117 boundary (7488 bytes) was 28 bytes ago --- */ uint8_tdac_index;/* 7516 1 */ uint8_tdac_state;
[Qemu-devel] [PATCH 04/11] sun4m_iommu: avoid structure holes spotted by pahole
Report from pahole on amd64 host: struct IOMMUState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ uint32_t regs[4096]; /* 5648 16384 */ /* --- cacheline 344 boundary (22016 bytes) was 16 bytes ago --- */ target_phys_addr_t iostart; /* 22032 8 */ uint32_t version; /* 22040 4 */ /* XXX 4 bytes hole, try to pack */ qemu_irq irq; /* 22048 8 */ /* size: 22056, cachelines: 345 */ /* sum members: 22052, holes: 1, sum holes: 4 */ /* last cacheline: 40 bytes */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/sun4m_iommu.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/sun4m_iommu.c b/hw/sun4m_iommu.c index 7f5dad5..6eeadfa 100644 --- a/hw/sun4m_iommu.c +++ b/hw/sun4m_iommu.c @@ -130,8 +130,8 @@ typedef struct IOMMUState { SysBusDevice busdev; uint32_t regs[IOMMU_NREGS]; target_phys_addr_t iostart; -uint32_t version; qemu_irq irq; +uint32_t version; } IOMMUState; static uint32_t iommu_mem_readl(void *opaque, target_phys_addr_t addr) -- 1.6.2.4 From 9e23cde2ab480b2e53af94acc6fa9572d17b5e5f Mon Sep 17 00:00:00 2001 Message-Id: <9e23cde2ab480b2e53af94acc6fa9572d17b5e5f.1312750600.git.blauwir...@gmail.com> In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:09:50 + Subject: [PATCH 04/11] sun4m_iommu: avoid structure holes spotted by pahole Report from pahole on amd64 host: struct IOMMUState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ uint32_t regs[4096]; /* 5648 16384 */ /* --- cacheline 344 boundary (22016 bytes) was 16 bytes ago --- */ target_phys_addr_t iostart; /* 22032 8 */ uint32_t version; /* 22040 4 */ /* XXX 4 bytes hole, try to pack */ qemu_irq irq; /* 22048 8 */ /* size: 22056, cachelines: 345 */ /* sum members: 22052, holes: 1, sum holes: 4 */ /* last cacheline: 40 bytes */ }; /* definitions: 1 */ Fix by rearranging structures to avoid padding. Signed-off-by: Blue Swirl --- hw/sun4m_iommu.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/sun4m_iommu.c b/hw/sun4m_iommu.c index 7f5dad5..6eeadfa 100644 --- a/hw/sun4m_iommu.c +++ b/hw/sun4m_iommu.c @@ -130,8 +130,8 @@ typedef struct IOMMUState { SysBusDevice busdev; uint32_t regs[IOMMU_NREGS]; target_phys_addr_t iostart; -uint32_t version; qemu_irq irq; +uint32_t version; } IOMMUState; static uint32_t iommu_mem_readl(void *opaque, target_phys_addr_t addr) -- 1.7.2.5
[Qemu-devel] [PATCH 03/11] slavio_intctl: avoid structure holes spotted by pahole
Report from pahole on amd64 host: struct SLAVIO_INTCTLState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ uint32_t intregm_pending; /* 5648 4 */ uint32_t intregm_disabled; /* 5652 4 */ uint32_t target_cpu; /* 5656 4 */ /* XXX 4 bytes hole, try to pack */ qemu_irq cpu_irqs[16][16]; /* 5664 2048 */ /* --- cacheline 120 boundary (7680 bytes) was 32 bytes ago --- */ SLAVIO_CPUINTCTLState slaves[16]; /* 7712 384 */ /* --- cacheline 126 boundary (8064 bytes) was 32 bytes ago --- */ /* size: 8096, cachelines: 127 */ /* sum members: 8092, holes: 1, sum holes: 4 */ /* last cacheline: 32 bytes */ }; /* definitions: 1 */ struct SLAVIO_CPUINTCTLState { uint32_t intreg_pending; /* 0 4 */ /* XXX 4 bytes hole, try to pack */ struct SLAVIO_INTCTLState * master; /* 8 8 */ uint32_t cpu; /*16 4 */ uint32_t irl_out; /*20 4 */ /* size: 24, cachelines: 1 */ /* sum members: 20, holes: 1, sum holes: 4 */ /* last cacheline: 24 bytes */ }; /* definitions: 1 */ Fix by rearranging the structures to avoid padding. Signed-off-by: Blue Swirl --- hw/slavio_intctl.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c index a83e5b8..329c251 100644 --- a/hw/slavio_intctl.c +++ b/hw/slavio_intctl.c @@ -46,22 +46,22 @@ struct SLAVIO_INTCTLState; typedef struct SLAVIO_CPUINTCTLState { -uint32_t intreg_pending; struct SLAVIO_INTCTLState *master; +uint32_t intreg_pending; uint32_t cpu; uint32_t irl_out; } SLAVIO_CPUINTCTLState; typedef struct SLAVIO_INTCTLState { SysBusDevice busdev; -uint32_t intregm_pending; -uint32_t intregm_disabled; -uint32_t target_cpu; #ifdef DEBUG_IRQ_COUNT uint64_t irq_count[32]; #endif qemu_irq cpu_irqs[MAX_CPUS][MAX_PILS]; SLAVIO_CPUINTCTLState slaves[MAX_CPUS]; +uint32_t intregm_pending; +uint32_t intregm_disabled; +uint32_t target_cpu; } SLAVIO_INTCTLState; #define INTCTL_MAXADDR 0xf -- 1.6.2.4 From df7130de6e6268363e09dee3e6103eb10652b92e Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:06:26 + Subject: [PATCH 03/11] slavio_intctl: avoid structure holes spotted by pahole Report from pahole on amd64 host: struct SLAVIO_INTCTLState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ uint32_t intregm_pending; /* 5648 4 */ uint32_t intregm_disabled; /* 5652 4 */ uint32_t target_cpu; /* 5656 4 */ /* XXX 4 bytes hole, try to pack */ qemu_irq cpu_irqs[16][16]; /* 5664 2048 */ /* --- cacheline 120 boundary (7680 bytes) was 32 bytes ago --- */ SLAVIO_CPUINTCTLState slaves[16]; /* 7712 384 */ /* --- cacheline 126 boundary (8064 bytes) was 32 bytes ago --- */ /* size: 8096, cachelines: 127 */ /* sum members: 8092, holes: 1, sum holes: 4 */ /* last cacheline: 32 bytes */ }; /* definitions: 1 */ struct SLAVIO_CPUINTCTLState { uint32_t intreg_pending; /* 0 4 */ /* XXX 4 bytes hole, try to pack */ struct SLAVIO_INTCTLState * master; /* 8 8 */ uint32_t cpu; /*16 4 */ uint32_t irl_out; /*20 4 */ /* size: 24, cachelines: 1 */ /* sum members: 20, holes: 1, sum holes: 4 */ /* last cacheline: 24 bytes */ }; /* definitions: 1 */ Fix by rearranging structures to avoid padding. Signed-off-by: Blue Swirl --- hw/slavio_intctl.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c index a83e5b8..329c251 100644 --- a/hw/slavio_intctl.c +++ b/hw/slavio_intctl.c @@ -46,22 +46,22 @@ struct SLAVIO_INTCTLState; typedef struct SLAVIO_CPUINTCTLState { -uint32_t intreg_pending; struct SLAVIO_INTCTLState *master; +uint32_t intreg_pending; uint32_t cpu; uint32_t irl_out; } SLAVIO_CPUINTCTLState; typedef struct SLAVIO_INTCTLState { SysBusDevice busdev; -uint32_t intregm_pending; -uint32_t intregm_disabled; -uint32_t target_cpu; #ifdef DEBUG_IRQ_COUNT uint64_t irq_count[
[Qemu-devel] [PATCH 02/11] slavio_misc: avoid structure holes spotted by pahole
Report from pahole on amd64 host: struct MiscState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ qemu_irq irq; /* 5648 8 */ uint32_t dummy;/* 5656 4 */ uint8_tconfig; /* 5660 1 */ uint8_taux1; /* 5661 1 */ uint8_taux2; /* 5662 1 */ uint8_tdiag; /* 5663 1 */ uint8_tmctrl;/* 5664 1 */ uint8_tsysctrl; /* 5665 1 */ uint16_t leds; /* 5666 2 */ /* XXX 4 bytes hole, try to pack */ qemu_irq fdc_tc; /* 5672 8 */ /* size: 5680, cachelines: 89 */ /* sum members: 5676, holes: 1, sum holes: 4 */ /* last cacheline: 48 bytes */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/slavio_misc.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c index 198360d..1f5a2d7 100644 --- a/hw/slavio_misc.c +++ b/hw/slavio_misc.c @@ -37,13 +37,13 @@ typedef struct MiscState { SysBusDevice busdev; qemu_irq irq; +qemu_irq fdc_tc; uint32_t dummy; uint8_t config; uint8_t aux1, aux2; uint8_t diag, mctrl; uint8_t sysctrl; uint16_t leds; -qemu_irq fdc_tc; } MiscState; typedef struct APCState { -- 1.6.2.4 From 386cc069182db6e0657eac26270aa1a3ef282774 Mon Sep 17 00:00:00 2001 Message-Id: <386cc069182db6e0657eac26270aa1a3ef282774.1312750600.git.blauwir...@gmail.com> In-Reply-To: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> References: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:03:18 + Subject: [PATCH 02/11] slavio_misc: avoid structure holes spotted by pahole Report from pahole on amd64 host: struct MiscState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ qemu_irq irq; /* 5648 8 */ uint32_t dummy;/* 5656 4 */ uint8_tconfig; /* 5660 1 */ uint8_taux1; /* 5661 1 */ uint8_taux2; /* 5662 1 */ uint8_tdiag; /* 5663 1 */ uint8_tmctrl;/* 5664 1 */ uint8_tsysctrl; /* 5665 1 */ uint16_t leds; /* 5666 2 */ /* XXX 4 bytes hole, try to pack */ qemu_irq fdc_tc; /* 5672 8 */ /* size: 5680, cachelines: 89 */ /* sum members: 5676, holes: 1, sum holes: 4 */ /* last cacheline: 48 bytes */ }; /* definitions: 1 */ Fix by rearranging the structure to avoid padding. Signed-off-by: Blue Swirl --- hw/slavio_misc.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c index 198360d..1f5a2d7 100644 --- a/hw/slavio_misc.c +++ b/hw/slavio_misc.c @@ -37,13 +37,13 @@ typedef struct MiscState { SysBusDevice busdev; qemu_irq irq; +qemu_irq fdc_tc; uint32_t dummy; uint8_t config; uint8_t aux1, aux2; uint8_t diag, mctrl; uint8_t sysctrl; uint16_t leds; -qemu_irq fdc_tc; } MiscState; typedef struct APCState { -- 1.7.2.5
[Qemu-devel] [PATCH 01/11] slavio_timer: avoid structure holes spotted by pahole
Report from pahole on amd64 host: struct SLAVIO_TIMERState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ uint32_t num_cpus; /* 5648 4 */ /* XXX 4 bytes hole, try to pack */ CPUTimerState cputimer[17]; /* 5656 816 */ /* --- cacheline 101 boundary (6464 bytes) was 8 bytes ago --- */ uint32_t cputimer_mode;/* 6472 4 */ /* size: 6480, cachelines: 102 */ /* sum members: 6472, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 16 bytes */ }; /* definitions: 1 */ struct CPUTimerState { qemu_irq irq; /* 0 8 */ ptimer_state * timer;/* 8 8 */ uint32_t count;/*16 4 */ uint32_t counthigh;/*20 4 */ uint32_t reached; /*24 4 */ /* XXX 4 bytes hole, try to pack */ uint64_t limit;/*32 8 */ uint32_t running; /*40 4 */ /* size: 48, cachelines: 1 */ /* sum members: 40, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 48 bytes */ }; /* definitions: 1 */ Fix by rearranging the structures to avoid padding. Signed-off-by: Blue Swirl --- hw/slavio_timer.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c index 5511313..f18c8d7 100644 --- a/hw/slavio_timer.c +++ b/hw/slavio_timer.c @@ -48,16 +48,16 @@ typedef struct CPUTimerState { qemu_irq irq; ptimer_state *timer; uint32_t count, counthigh, reached; -uint64_t limit; -// processor only +/* processor only */ uint32_t running; +uint64_t limit; } CPUTimerState; typedef struct SLAVIO_TIMERState { SysBusDevice busdev; uint32_t num_cpus; -CPUTimerState cputimer[MAX_CPUS + 1]; uint32_t cputimer_mode; +CPUTimerState cputimer[MAX_CPUS + 1]; } SLAVIO_TIMERState; typedef struct TimerContext { -- 1.6.2.4 From 54eae070f9056790fa41b468360d23cdd17503f4 Mon Sep 17 00:00:00 2001 Message-Id: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwir...@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:00:23 + Subject: [PATCH 01/11] slavio_timer: avoid structure holes spotted by pahole Report from pahole on amd64 host: struct SLAVIO_TIMERState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ uint32_t num_cpus; /* 5648 4 */ /* XXX 4 bytes hole, try to pack */ CPUTimerState cputimer[17]; /* 5656 816 */ /* --- cacheline 101 boundary (6464 bytes) was 8 bytes ago --- */ uint32_t cputimer_mode;/* 6472 4 */ /* size: 6480, cachelines: 102 */ /* sum members: 6472, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 16 bytes */ }; /* definitions: 1 */ struct CPUTimerState { qemu_irq irq; /* 0 8 */ ptimer_state * timer;/* 8 8 */ uint32_t count;/*16 4 */ uint32_t counthigh;/*20 4 */ uint32_t reached; /*24 4 */ /* XXX 4 bytes hole, try to pack */ uint64_t limit;/*32 8 */ uint32_t running; /*40 4 */ /* size: 48, cachelines: 1 */ /* sum members: 40, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 48 bytes */ }; /* definitions: 1 */ Fix by rearranging structures to avoid padding. Signed-off-by: Blue Swirl --- hw/slavio_timer.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c index 5511313..f18c8d7 100644 --- a/hw/slavio_timer.c +++ b/hw/slavio_timer.c @@ -48,16 +48,16 @@ typedef struct CPUTimerState { qemu_irq irq; ptimer_state *timer; uint32_t count, counthigh, reached; -uint64_t limit; -// processor only +/* processor only */ uint32_t running; +uint64_t limit; } CPUTimerState; typedef struct SLAVIO_TIMERState { SysBusDevice busdev; uint32_t num_cpus; -CPUTimerState cputimer[MAX_CPUS + 1]; uint32_t cputimer_mode; +CPUTimerState cputimer[MAX_CPUS + 1]; } SLAVIO_TIMERState; typedef struct TimerContext { -- 1.7.2.5
[Qemu-devel] [PATCH 00/11] structure hole removal
I discovered the excellent tool pahole, which shows structure holes resulting from suboptimal structure field order. In this patch set, Sparc device structure fields are arranged so that holes are avoided on amd64 host. I checked that on i386 build, no new holes appeared. Blue Swirl (11): slavio_timer: avoid structure holes spotted by pahole slavio_misc: avoid structure holes spotted by pahole slavio_intctl: avoid structure holes spotted by pahole sun4m_iommu: avoid structure holes spotted by pahole tcx: avoid structure holes spotted by pahole sun4m: avoid structure holes spotted by pahole esp: avoid structure holes spotted by pahole pcnet: avoid structure holes spotted by pahole fdc: avoid structure holes spotted by pahole escc: avoid structure holes spotted by pahole m48t59: avoid structure holes spotted by pahole hw/escc.c |9 + hw/esp.c | 11 ++- hw/fdc.c | 18 +- hw/m48t59.c|9 + hw/pcnet.h |6 +++--- hw/slavio_intctl.c |8 hw/slavio_misc.c |2 +- hw/slavio_timer.c |6 +++--- hw/sun4m.c | 20 ++-- hw/sun4m_iommu.c |2 +- hw/tcx.c |4 ++-- 11 files changed, 49 insertions(+), 46 deletions(-)
[Qemu-devel] [Bug 822408] [NEW] Unable to access disk image on mipsel host
Public bug reported: Something is wrong with hard disk images on MIPSel host. The host system is mips64el (Loongson cpu, Linux 2.6.39, eglibc 2.13) Tried Qemu 0.14.1 and 0.15.0-rc2, both compiled with GCC 4.6.0. First I was trying to install WinXP (i386-softmmu). Starting install, create partition, format (either quick and full), seems to complete, boom the error: " Setup was unable to format the partition. The disk may be damaged. Make sure the drive is switched on and properly connected to your computer. If the disk is a SCSI disk, make sure your SCSI devices are properly terminated. Consult your computer manual or SCSI adapter documentation for more information. You must select a different partition for Windows XP. To continue, press ENTER. " This happens with both raw and qcow2 image format. Tried 10Gb image, tried 16Gb one - no difference. On a x86 host, that formatting makes the image (qcow2) grow to about 81 Mb by the time it reaches 100% formatted (quick), but on mipsel it grows to 0.8Mb at the same time and the error appears. I tried the same installing of Windows in Qemu on x86 host and copied over the completed image. In that case it starts loading, but in the middle of the animation there is an error: " STOP: c221 Unknown Hard Error \Systemroot\System32\ntdll.dll " (or HAL.dll) So, i tried linux-0.2.img.bz2 from the Qemu site, and that fails too. Thus it's the minimal bug reproduction thing. During boot there are multiple errors like: " hda: dma_intr: status=0x41 { DriveReady Error } hda: dma_intr: error=0x04 { DriveStatusError } hda: Failed opcode was: unknown " It booted and kind of worked, there were weird glitches in every program. Unusable. Summarily, that suggest some error in hard disk emulation or back storage, specific either to MIPSel or non-x86 hosts. ** Affects: qemu Importance: Undecided Status: New -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/822408 Title: Unable to access disk image on mipsel host Status in QEMU: New Bug description: Something is wrong with hard disk images on MIPSel host. The host system is mips64el (Loongson cpu, Linux 2.6.39, eglibc 2.13) Tried Qemu 0.14.1 and 0.15.0-rc2, both compiled with GCC 4.6.0. First I was trying to install WinXP (i386-softmmu). Starting install, create partition, format (either quick and full), seems to complete, boom the error: " Setup was unable to format the partition. The disk may be damaged. Make sure the drive is switched on and properly connected to your computer. If the disk is a SCSI disk, make sure your SCSI devices are properly terminated. Consult your computer manual or SCSI adapter documentation for more information. You must select a different partition for Windows XP. To continue, press ENTER. " This happens with both raw and qcow2 image format. Tried 10Gb image, tried 16Gb one - no difference. On a x86 host, that formatting makes the image (qcow2) grow to about 81 Mb by the time it reaches 100% formatted (quick), but on mipsel it grows to 0.8Mb at the same time and the error appears. I tried the same installing of Windows in Qemu on x86 host and copied over the completed image. In that case it starts loading, but in the middle of the animation there is an error: " STOP: c221 Unknown Hard Error \Systemroot\System32\ntdll.dll " (or HAL.dll) So, i tried linux-0.2.img.bz2 from the Qemu site, and that fails too. Thus it's the minimal bug reproduction thing. During boot there are multiple errors like: " hda: dma_intr: status=0x41 { DriveReady Error } hda: dma_intr: error=0x04 { DriveStatusError } hda: Failed opcode was: unknown " It booted and kind of worked, there were weird glitches in every program. Unusable. Summarily, that suggest some error in hard disk emulation or back storage, specific either to MIPSel or non-x86 hosts. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/822408/+subscriptions
Re: [Qemu-devel] RFC: moving fsfreeze support from the userland guest agent to the guest kernel
Well, we want to support Microsoft's VSS, and that requires a guest agent that communicates with all the "writers" (applications), waiting for them to flush their app data in order to generate a consistent app-level snapshot. The VSS platform does most of the work. Still, at the bottom line, the agent's role is only to find the right moment in time. This moment can be relayed back to libvirt, and from there do it according to your suggestion, so that the guest agent does not do the freeze, and it is actually not a mandatory component. Ronen.
[Qemu-devel] [PATCH 0/4] usb/hid: bugfixes, more on usb and hid split
This USB patchset moves the VM state stuff from usb-hid.c to hid.c, so it can be reused by other devices. There is one major drawback: i need to increase the vmstate version_id of the usb-hid device. I don't know if you agree with this change. Alternatively, we could add a load_old function which just skips old versions. Michael Walle (4): hid: register kbd hander in init() hid: introduce hid vmstate macros usb-hid: use hid vmstate macro milkymist-softusb: use hid code directly hw/hid.c | 63 - hw/hw.h| 20 hw/milkymist-softusb.c | 122 +++- hw/usb-hid.c | 51 +++- 4 files changed, 127 insertions(+), 129 deletions(-) -- 1.7.2.5
[Qemu-devel] [PATCH 2/4] hid: introduce hid vmstate macros
Add VMSTATE macros to describe a HIDState. Based on usb-hid.c descriptions. Signed-off-by: Michael Walle --- hw/hid.c | 58 ++ hw/hw.h | 20 2 files changed, 78 insertions(+), 0 deletions(-) diff --git a/hw/hid.c b/hw/hid.c index 6934f05..90a9b3d 100644 --- a/hw/hid.c +++ b/hw/hid.c @@ -402,3 +402,61 @@ void hid_init(HIDState *hs, int kind, HIDEventFunc event) 1, "QEMU HID Tablet"); } } + +static int hid_post_load(void *opaque, int version_id) +{ +HIDState *s = opaque; + +if (s->idle) { +hid_set_next_idle(s, qemu_get_clock_ns(vm_clock)); +} +return 0; +} + +static const VMStateDescription vmstate_hid_ptr_queue = { +.name = "HIDPointerEventQueue", +.version_id = 1, +.minimum_version_id = 1, +.fields = (VMStateField[]) { +VMSTATE_INT32(xdx, HIDPointerEvent), +VMSTATE_INT32(ydy, HIDPointerEvent), +VMSTATE_INT32(dz, HIDPointerEvent), +VMSTATE_INT32(buttons_state, HIDPointerEvent), +VMSTATE_END_OF_LIST() +} +}; + +const VMStateDescription vmstate_hid_ptr_device = { +.name = "HIDPointerDevice", +.version_id = 1, +.minimum_version_id = 1, +.post_load = hid_post_load, +.fields = (VMStateField[]) { +VMSTATE_STRUCT_ARRAY(ptr.queue, HIDState, QUEUE_LENGTH, 0, + vmstate_hid_ptr_queue, HIDPointerEvent), +VMSTATE_UINT32(head, HIDState), +VMSTATE_UINT32(n, HIDState), +VMSTATE_INT32(protocol, HIDState), +VMSTATE_UINT8(idle, HIDState), +VMSTATE_END_OF_LIST(), +} +}; + +const VMStateDescription vmstate_hid_keyboard_device = { +.name = "HIDKeyboardDevice", +.version_id = 1, +.minimum_version_id = 1, +.post_load = hid_post_load, +.fields = (VMStateField[]) { +VMSTATE_UINT32_ARRAY(kbd.keycodes, HIDState, QUEUE_LENGTH), +VMSTATE_UINT16(kbd.modifiers, HIDState), +VMSTATE_UINT8(kbd.leds, HIDState), +VMSTATE_UINT8_ARRAY(kbd.key, HIDState, 16), +VMSTATE_INT32(kbd.keys, HIDState), +VMSTATE_UINT32(head, HIDState), +VMSTATE_UINT32(n, HIDState), +VMSTATE_INT32(protocol, HIDState), +VMSTATE_UINT8(idle, HIDState), +VMSTATE_END_OF_LIST(), +} +}; diff --git a/hw/hw.h b/hw/hw.h index df6ca65..a124da9 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -701,6 +701,26 @@ extern const VMStateDescription vmstate_ptimer; .offset = vmstate_offset_pointer(_state, _field, ptimer_state), \ } +extern const VMStateDescription vmstate_hid_keyboard_device; + +#define VMSTATE_HID_KEYBOARD_DEVICE(_field, _state) {\ +.name = (stringify(_field)), \ +.size = sizeof(HIDState), \ +.vmsd = &vmstate_hid_keyboard_device, \ +.flags = VMS_STRUCT,\ +.offset = vmstate_offset_value(_state, _field, HIDState),\ +} + +extern const VMStateDescription vmstate_hid_ptr_device; + +#define VMSTATE_HID_POINTER_DEVICE(_field, _state) { \ +.name = (stringify(_field)), \ +.size = sizeof(HIDState), \ +.vmsd = &vmstate_hid_ptr_device, \ +.flags = VMS_STRUCT,\ +.offset = vmstate_offset_value(_state, _field, HIDState),\ +} + /* _f : field name _f_n : num of elements field_name _n : num of elements -- 1.7.2.5
Re: [Qemu-devel] [PATCH 2/3] usb-redir: Call qemu_chr_guest_open/close
Hi, On 08/07/2011 05:52 PM, Anthony Liguori wrote: On 08/07/2011 08:21 AM, Hans de Goede wrote: To let the chardev now we're ready start receiving data. This is necessary with the spicevmc chardev to get it registered with the spice-server. Signed-off-by: Hans de Goede --- usb-redir.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index e212993..ec88c0b 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -809,6 +809,8 @@ static int usbredir_initfn(USBDevice *udev) qemu_chr_add_handlers(dev->cs, usbredir_chardev_can_read, usbredir_chardev_read, usbredir_chardev_event, dev); + /* Let the other side know we are ready */ + qemu_chr_guest_open(dev->cs); You should do guest_open before adding handlers. Erm, no, guest_open may lead to a callback in the chardev, to which it may respond by immediately queuing a few writes / doing a read. To me it makes much more sense to actually call guest_open when we are ready to receive data / to be read from, rather then to do it before our handlers are hooked up and thus before we are ready. Regards, Hans
Re: [Qemu-devel] [PATCH 1/3] spice-qemu-char: Generate chardev open/close events
Hi, On 08/07/2011 05:52 PM, Anthony Liguori wrote: On 08/07/2011 08:21 AM, Hans de Goede wrote: Define a state callback and make that generate chardev open/close events when called by the spice-server. Note that for all but the newest spice-server versions (which have a fix for this) the code ignores these events for a spicevmc with a subtype of vdagent, this subtype specific knowledge is undesirable, but unavoidable for now, see: http://lists.freedesktop.org/archives/spice-devel/2011-July/004837.html Signed-off-by: Hans de Goede --- spice-qemu-char.c | 46 +- 1 files changed, 45 insertions(+), 1 deletions(-) diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 95bf6b6..0a5059d 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -69,11 +69,50 @@ static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len) return bytes; } +static void vmc_state(SpiceCharDeviceInstance *sin, int connected) +{ + SpiceCharDriver *scd = container_of(sin, SpiceCharDriver, sin); + int event; + +#if SPICE_SERVER_VERSION< 0x000901 + /* + * spice-server calls the state callback for the agent channel when the + * spice client connects / disconnects. Given that not the client but + * the server is doing the parsing of the messages this is wrong as the + * server is still listening. Worse, this causes the parser in the server + * to go out of sync, so we ignore state calls for subtype vdagent + * spicevmc chardevs. For the full story see: + * http://lists.freedesktop.org/archives/spice-devel/2011-July/004837.html + */ + if (strcmp(sin->subtype, "vdagent") == 0) { + return; + } +#endif + + if ((scd->chr->opened&& connected) || + (!scd->chr->opened&& !connected)) { + return; + } + + if (connected) { + scd->chr->opened = 1; + event = CHR_EVENT_OPENED; + } else { + scd->chr->opened = 0; + event = CHR_EVENT_CLOSED; + } + + if (scd->chr->chr_event) { + scd->chr->chr_event(scd->chr->handler_opaque, event); + } You should use qemu_chr_event and then this whole block of code disappears since it already manages the opened flag. Right, good one, Regards, Hans
[Qemu-devel] [PATCH 1/4] hid: register kbd hander in init()
Register the keyboard event handler in hid's init() instead of its reset() function. Signed-off-by: Michael Walle --- hw/hid.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/hid.c b/hw/hid.c index 7b5ef5f..6934f05 100644 --- a/hw/hid.c +++ b/hw/hid.c @@ -359,7 +359,6 @@ void hid_reset(HIDState *hs) { switch (hs->kind) { case HID_KEYBOARD: -qemu_add_kbd_event_handler(hid_keyboard_event, hs); memset(hs->kbd.keycodes, 0, sizeof(hs->kbd.keycodes)); memset(hs->kbd.key, 0, sizeof(hs->kbd.key)); hs->kbd.keys = 0; @@ -393,7 +392,9 @@ void hid_init(HIDState *hs, int kind, HIDEventFunc event) hs->kind = kind; hs->event = event; -if (hs->kind == HID_MOUSE) { +if (hs->kind == HID_KEYBOARD) { +qemu_add_kbd_event_handler(hid_keyboard_event, hs); +} else if (hs->kind == HID_MOUSE) { hs->ptr.eh_entry = qemu_add_mouse_event_handler(hid_pointer_event, hs, 0, "QEMU HID Mouse"); } else if (hs->kind == HID_TABLET) { -- 1.7.2.5
[Qemu-devel] [PATCH 3/4] usb-hid: use hid vmstate macro
Increase version id, this will make almost any saved vm incompatible :( Signed-off-by: Michael Walle --- hw/usb-hid.c | 51 --- 1 files changed, 8 insertions(+), 43 deletions(-) diff --git a/hw/usb-hid.c b/hw/usb-hid.c index e5d57de..2efbc8d 100644 --- a/hw/usb-hid.c +++ b/hw/usb-hid.c @@ -538,61 +538,26 @@ void usb_hid_datain_cb(USBDevice *dev, void *opaque, void (*datain)(void *)) s->datain = datain; } -static int usb_hid_post_load(void *opaque, int version_id) -{ -USBHIDState *s = opaque; - -if (s->hid.idle) { -hid_set_next_idle(&s->hid, qemu_get_clock_ns(vm_clock)); -} -return 0; -} - -static const VMStateDescription vmstate_usb_ptr_queue = { -.name = "usb-ptr-queue", -.version_id = 1, -.minimum_version_id = 1, -.fields = (VMStateField []) { -VMSTATE_INT32(xdx, HIDPointerEvent), -VMSTATE_INT32(ydy, HIDPointerEvent), -VMSTATE_INT32(dz, HIDPointerEvent), -VMSTATE_INT32(buttons_state, HIDPointerEvent), -VMSTATE_END_OF_LIST() -} -}; static const VMStateDescription vmstate_usb_ptr = { .name = "usb-ptr", -.version_id = 1, -.minimum_version_id = 1, -.post_load = usb_hid_post_load, +.version_id = 2, +.minimum_version_id = 2, +.minimum_version_id_old = 2, .fields = (VMStateField []) { VMSTATE_USB_DEVICE(dev, USBHIDState), -VMSTATE_STRUCT_ARRAY(hid.ptr.queue, USBHIDState, QUEUE_LENGTH, 0, - vmstate_usb_ptr_queue, HIDPointerEvent), -VMSTATE_UINT32(hid.head, USBHIDState), -VMSTATE_UINT32(hid.n, USBHIDState), -VMSTATE_INT32(hid.protocol, USBHIDState), -VMSTATE_UINT8(hid.idle, USBHIDState), +VMSTATE_HID_POINTER_DEVICE(hid, USBHIDState), VMSTATE_END_OF_LIST() } }; static const VMStateDescription vmstate_usb_kbd = { .name = "usb-kbd", -.version_id = 1, -.minimum_version_id = 1, -.post_load = usb_hid_post_load, +.version_id = 2, +.minimum_version_id = 2, +.minimum_version_id_old = 2, .fields = (VMStateField []) { VMSTATE_USB_DEVICE(dev, USBHIDState), -VMSTATE_UINT32_ARRAY(hid.kbd.keycodes, USBHIDState, QUEUE_LENGTH), -VMSTATE_UINT32(hid.head, USBHIDState), -VMSTATE_UINT32(hid.n, USBHIDState), -VMSTATE_UINT16(hid.kbd.modifiers, USBHIDState), -VMSTATE_UINT8(hid.kbd.leds, USBHIDState), -VMSTATE_UINT8_ARRAY(hid.kbd.key, USBHIDState, 16), -VMSTATE_INT32(hid.kbd.keys, USBHIDState), -VMSTATE_INT32(hid.protocol, USBHIDState), -VMSTATE_UINT8(hid.idle, USBHIDState), +VMSTATE_HID_KEYBOARD_DEVICE(hid, USBHIDState), VMSTATE_END_OF_LIST() } }; -- 1.7.2.5
[Qemu-devel] [PATCH 4/4] milkymist-softusb: use hid code directly
Remove the dummy USB device and use the HID code directly. Use the HID code for the mouse support, too. Signed-off-by: Michael Walle --- hw/milkymist-softusb.c | 122 +++- 1 files changed, 38 insertions(+), 84 deletions(-) diff --git a/hw/milkymist-softusb.c b/hw/milkymist-softusb.c index 75c85ae..fe4eedb 100644 --- a/hw/milkymist-softusb.c +++ b/hw/milkymist-softusb.c @@ -25,7 +25,7 @@ #include "sysbus.h" #include "trace.h" #include "console.h" -#include "usb.h" +#include "hid.h" #include "qemu-error.h" enum { @@ -46,9 +46,8 @@ enum { struct MilkymistSoftUsbState { SysBusDevice busdev; -USBBus usbbus; -USBPort usbport[2]; -USBDevice *usbdev; +HIDState hid_kbd; +HIDState hid_mouse; qemu_irq irq; @@ -62,13 +61,10 @@ struct MilkymistSoftUsbState { uint32_t regs[R_MAX]; /* mouse state */ -int mouse_dx; -int mouse_dy; -int mouse_dz; -uint8_t mouse_buttons_state; +uint8_t mouse_hid_buffer[4]; /* keyboard state */ -uint8_t kbd_usb_buffer[8]; +uint8_t kbd_hid_buffer[8]; }; typedef struct MilkymistSoftUsbState MilkymistSoftUsbState; @@ -177,16 +173,10 @@ static inline void softusb_write_pmem(MilkymistSoftUsbState *s, static void softusb_mouse_changed(MilkymistSoftUsbState *s) { uint8_t m; -uint8_t buf[4]; - -buf[0] = s->mouse_buttons_state; -buf[1] = s->mouse_dx; -buf[2] = s->mouse_dy; -buf[3] = s->mouse_dz; softusb_read_dmem(s, COMLOC_MEVT_PRODUCE, &m, 1); trace_milkymist_softusb_mevt(m); -softusb_write_dmem(s, COMLOC_MEVT_BASE + 4 * m, buf, 4); +softusb_write_dmem(s, COMLOC_MEVT_BASE + 4 * m, s->mouse_hid_buffer, 4); m = (m + 1) & 0xf; softusb_write_dmem(s, COMLOC_MEVT_PRODUCE, &m, 1); @@ -200,7 +190,7 @@ static void softusb_kbd_changed(MilkymistSoftUsbState *s) softusb_read_dmem(s, COMLOC_KEVT_PRODUCE, &m, 1); trace_milkymist_softusb_kevt(m); -softusb_write_dmem(s, COMLOC_KEVT_BASE + 8 * m, s->kbd_usb_buffer, 8); +softusb_write_dmem(s, COMLOC_KEVT_BASE + 8 * m, s->kbd_hid_buffer, 8); m = (m + 1) & 0x7; softusb_write_dmem(s, COMLOC_KEVT_PRODUCE, &m, 1); @@ -208,62 +198,42 @@ static void softusb_kbd_changed(MilkymistSoftUsbState *s) qemu_irq_pulse(s->irq); } -static void softusb_mouse_event(void *opaque, - int dx, int dy, int dz, int buttons_state) +static void softusb_kbd_hid_datain(HIDState *hs) { -MilkymistSoftUsbState *s = opaque; +MilkymistSoftUsbState *s = container_of(hs, MilkymistSoftUsbState, hid_kbd); +int len; /* if device is in reset, do nothing */ if (s->regs[R_CTRL] & CTRL_RESET) { return; } -trace_milkymist_softusb_mouse_event(dx, dy, dz, buttons_state); +len = hid_keyboard_poll(hs, s->kbd_hid_buffer, sizeof(s->kbd_hid_buffer)); -s->mouse_dx = dx; -s->mouse_dy = dy; -s->mouse_dz = dz; -s->mouse_buttons_state = buttons_state; - -softusb_mouse_changed(s); +if (len == 8) { +softusb_kbd_changed(s); +} } -static void softusb_usbdev_datain(void *opaque) +static void softusb_mouse_hid_datain(HIDState *hs) { -MilkymistSoftUsbState *s = opaque; - -USBPacket p; - -usb_packet_init(&p); -usb_packet_setup(&p, USB_TOKEN_IN, 0, 1); -usb_packet_addbuf(&p, s->kbd_usb_buffer, sizeof(s->kbd_usb_buffer)); -s->usbdev->info->handle_data(s->usbdev, &p); -usb_packet_cleanup(&p); - -softusb_kbd_changed(s); -} +MilkymistSoftUsbState *s = +container_of(hs, MilkymistSoftUsbState, hid_mouse); +int len; -static void softusb_attach(USBPort *port) -{ -} +/* if device is in reset, do nothing */ +if (s->regs[R_CTRL] & CTRL_RESET) { +return; +} -static void softusb_detach(USBPort *port) -{ -} +len = hid_pointer_poll(hs, s->mouse_hid_buffer, +sizeof(s->mouse_hid_buffer)); -static void softusb_child_detach(USBPort *port, USBDevice *child) -{ +if (len == 4) { +softusb_mouse_changed(s); +} } -static USBPortOps softusb_ops = { -.attach = softusb_attach, -.detach = softusb_detach, -.child_detach = softusb_child_detach, -}; - -static USBBusOps softusb_bus_ops = { -}; - static void milkymist_softusb_reset(DeviceState *d) { MilkymistSoftUsbState *s = @@ -273,11 +243,11 @@ static void milkymist_softusb_reset(DeviceState *d) for (i = 0; i < R_MAX; i++) { s->regs[i] = 0; } -s->mouse_dx = 0; -s->mouse_dy = 0; -s->mouse_dz = 0; -s->mouse_buttons_state = 0; -memset(s->kbd_usb_buffer, 0, sizeof(s->kbd_usb_buffer)); +memset(s->kbd_hid_buffer, 0, sizeof(s->kbd_hid_buffer)); +memset(s->mouse_hid_buffer, 0, sizeof(s->mouse_hid_buffer)); + +hid_reset(&s->hid_kbd); +hid_reset(&s->hid_mouse); /* defaults */ s->regs[R_CTRL] = CTRL_RESET; @@ -304,23 +274,8 @@ static int milkymist_softusb_init(SysBusDevice *dev) cpu_regist
Re: [Qemu-devel] [PATCH] configure: Disable guest_agent for mingw32
Am 07.08.2011 17:50, schrieb Anthony Liguori: On 08/06/2011 03:47 PM, Stefan Weil wrote: guest_agent is not supported for mingw32, so the default value should be 'no', not 'yes'. Why is it not supported? It should build just fine. If the answer is, -mms-bitfield, then we should fix slirp instead of disabling guest-agent. Regards, Anthony Liguori Code extract from configure: if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then tools="qemu-nbd\$(EXESUF) $tools" if [ "$guest_agent" = "yes" ]; then tools="qemu-ga\$(EXESUF) $tools" fi if [ "$check_utests" = "yes" ]; then tools="check-qint check-qstring check-qdict check-qlist $tools" tools="check-qfloat check-qjson $tools" fi fi MinGW32 is neither linux nor bsd nor solaris, so guest_agent="yes" won't enable qemu-ga.exe. Of course this (and the bitfield related problems) should be fixed in git master, but not in stable-0.15. So for 0.15, the patch is a must (unless you are prepared to take additional patches for the bitfield issues). Even for git master, the patch is reasonable because it allows QEMU builds with most mingw32 installations. As soon as there is a w32 QEMU working with glib-2.0 and a w32 qemu-ga.exe (and some documentation in the QEMU wiki how to get glib-2.0 and python), the patch can be reverted. Regards, Stefan Weil
Re: [Qemu-devel] [PATCH 2/3] usb-redir: Call qemu_chr_guest_open/close
On 08/07/2011 08:21 AM, Hans de Goede wrote: To let the chardev now we're ready start receiving data. This is necessary with the spicevmc chardev to get it registered with the spice-server. Signed-off-by: Hans de Goede --- usb-redir.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index e212993..ec88c0b 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -809,6 +809,8 @@ static int usbredir_initfn(USBDevice *udev) qemu_chr_add_handlers(dev->cs, usbredir_chardev_can_read, usbredir_chardev_read, usbredir_chardev_event, dev); +/* Let the other side know we are ready */ +qemu_chr_guest_open(dev->cs); You should do guest_open before adding handlers. Regards, Anthony Liguori return 0; } @@ -830,6 +832,7 @@ static void usbredir_handle_destroy(USBDevice *udev) { USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev); +qemu_chr_guest_close(dev->cs); qemu_chr_close(dev->cs); /* Note must be done after qemu_chr_close, as that causes a close event */ qemu_bh_delete(dev->open_close_bh);
Re: [Qemu-devel] [PATCH 1/3] spice-qemu-char: Generate chardev open/close events
On 08/07/2011 08:21 AM, Hans de Goede wrote: Define a state callback and make that generate chardev open/close events when called by the spice-server. Note that for all but the newest spice-server versions (which have a fix for this) the code ignores these events for a spicevmc with a subtype of vdagent, this subtype specific knowledge is undesirable, but unavoidable for now, see: http://lists.freedesktop.org/archives/spice-devel/2011-July/004837.html Signed-off-by: Hans de Goede --- spice-qemu-char.c | 46 +- 1 files changed, 45 insertions(+), 1 deletions(-) diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 95bf6b6..0a5059d 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -69,11 +69,50 @@ static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len) return bytes; } +static void vmc_state(SpiceCharDeviceInstance *sin, int connected) +{ +SpiceCharDriver *scd = container_of(sin, SpiceCharDriver, sin); +int event; + +#if SPICE_SERVER_VERSION< 0x000901 +/* + * spice-server calls the state callback for the agent channel when the + * spice client connects / disconnects. Given that not the client but + * the server is doing the parsing of the messages this is wrong as the + * server is still listening. Worse, this causes the parser in the server + * to go out of sync, so we ignore state calls for subtype vdagent + * spicevmc chardevs. For the full story see: + * http://lists.freedesktop.org/archives/spice-devel/2011-July/004837.html + */ +if (strcmp(sin->subtype, "vdagent") == 0) { +return; +} +#endif + +if ((scd->chr->opened&& connected) || +(!scd->chr->opened&& !connected)) { +return; +} + +if (connected) { +scd->chr->opened = 1; +event = CHR_EVENT_OPENED; +} else { +scd->chr->opened = 0; +event = CHR_EVENT_CLOSED; +} + +if (scd->chr->chr_event) { +scd->chr->chr_event(scd->chr->handler_opaque, event); +} You should use qemu_chr_event and then this whole block of code disappears since it already manages the opened flag. Regards, Anthony Liguori
Re: [Qemu-devel] [PATCH] configure: Disable guest_agent for mingw32
On 08/06/2011 03:47 PM, Stefan Weil wrote: guest_agent is not supported for mingw32, so the default value should be 'no', not 'yes'. Why is it not supported? It should build just fine. If the answer is, -mms-bitfield, then we should fix slirp instead of disabling guest-agent. Regards, Anthony Liguori This removes the dependencies to glib-2.0 and python which makes native and cross builds for w32 much easier (no need to get and install these extra packages). It also avoids the problems caused by different bitfield alignment which is required by glib-2.0. It is still possible to set guest_agent=yes via configure option. Signed-off-by: Stefan Weil --- configure |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 0c67a4a..4cb33d9 100755 --- a/configure +++ b/configure @@ -493,6 +493,7 @@ if test "$mingw32" = "yes" ; then bindir="\${prefix}" sysconfdir="\${prefix}" confsuffix="" + guest_agent="no" fi werror=""
[Qemu-devel] [PATCH 3/3] usb-redir: Device disconnect + re-connect robustness fixes
These fixes mainly target the other side sending some (error status) packets after a disconnect packet. In some cases these would get queued up and then reported to the controller when a new device gets connected. * Fully reset device state on disconnect * Don't allow a connect message when already connected * Ignore iso and interrupt status messages when disconnected Signed-off-by: Hans de Goede --- usb-redir.c | 22 +- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index ec88c0b..5d9483d 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -874,6 +874,11 @@ static void usbredir_device_connect(void *priv, { USBRedirDevice *dev = priv; +if (qemu_timer_pending(dev->attach_timer) || dev->dev.attached) { +ERROR("Received device connect while already connected\n"); +return; +} + switch (device_connect->speed) { case usb_redir_speed_low: DPRINTF("attaching low speed device\n"); @@ -902,19 +907,26 @@ static void usbredir_device_connect(void *priv, static void usbredir_device_disconnect(void *priv) { USBRedirDevice *dev = priv; +int i; /* Stop any pending attaches */ qemu_del_timer(dev->attach_timer); if (dev->dev.attached) { usb_device_detach(&dev->dev); -usbredir_cleanup_device_queues(dev); /* * Delay next usb device attach to give the guest a chance to see * see the detach / attach in case of quick close / open succession */ dev->next_attach_time = qemu_get_clock_ms(vm_clock) + 200; } + +/* Reset state so that the next dev connected starts with a clean slate */ +usbredir_cleanup_device_queues(dev); +memset(dev->endpoint, 0, sizeof(dev->endpoint)); +for (i = 0; i < MAX_ENDPOINTS; i++) { +QTAILQ_INIT(&dev->endpoint[i].bufpq); +} } static void usbredir_interface_info(void *priv, @@ -1006,6 +1018,10 @@ static void usbredir_iso_stream_status(void *priv, uint32_t id, DPRINTF("iso status %d ep %02X id %u\n", iso_stream_status->status, ep, id); +if (!dev->dev.attached) { +return; +} + dev->endpoint[EP2I(ep)].iso_error = iso_stream_status->status; if (iso_stream_status->status == usb_redir_stall) { DPRINTF("iso stream stopped by peer ep %02X\n", ep); @@ -1023,6 +1039,10 @@ static void usbredir_interrupt_receiving_status(void *priv, uint32_t id, DPRINTF("interrupt recv status %d ep %02X id %u\n", interrupt_receiving_status->status, ep, id); +if (!dev->dev.attached) { +return; +} + dev->endpoint[EP2I(ep)].interrupt_error = interrupt_receiving_status->status; if (interrupt_receiving_status->status == usb_redir_stall) { -- 1.7.5.1
[Qemu-devel] [PATCH 2/3] usb-redir: Call qemu_chr_guest_open/close
To let the chardev now we're ready start receiving data. This is necessary with the spicevmc chardev to get it registered with the spice-server. Signed-off-by: Hans de Goede --- usb-redir.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index e212993..ec88c0b 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -809,6 +809,8 @@ static int usbredir_initfn(USBDevice *udev) qemu_chr_add_handlers(dev->cs, usbredir_chardev_can_read, usbredir_chardev_read, usbredir_chardev_event, dev); +/* Let the other side know we are ready */ +qemu_chr_guest_open(dev->cs); return 0; } @@ -830,6 +832,7 @@ static void usbredir_handle_destroy(USBDevice *udev) { USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev); +qemu_chr_guest_close(dev->cs); qemu_chr_close(dev->cs); /* Note must be done after qemu_chr_close, as that causes a close event */ qemu_bh_delete(dev->open_close_bh); -- 1.7.5.1
[Qemu-devel] [PATCH 1/3] spice-qemu-char: Generate chardev open/close events
Define a state callback and make that generate chardev open/close events when called by the spice-server. Note that for all but the newest spice-server versions (which have a fix for this) the code ignores these events for a spicevmc with a subtype of vdagent, this subtype specific knowledge is undesirable, but unavoidable for now, see: http://lists.freedesktop.org/archives/spice-devel/2011-July/004837.html Signed-off-by: Hans de Goede --- spice-qemu-char.c | 46 +- 1 files changed, 45 insertions(+), 1 deletions(-) diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 95bf6b6..0a5059d 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -69,11 +69,50 @@ static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len) return bytes; } +static void vmc_state(SpiceCharDeviceInstance *sin, int connected) +{ +SpiceCharDriver *scd = container_of(sin, SpiceCharDriver, sin); +int event; + +#if SPICE_SERVER_VERSION < 0x000901 +/* + * spice-server calls the state callback for the agent channel when the + * spice client connects / disconnects. Given that not the client but + * the server is doing the parsing of the messages this is wrong as the + * server is still listening. Worse, this causes the parser in the server + * to go out of sync, so we ignore state calls for subtype vdagent + * spicevmc chardevs. For the full story see: + * http://lists.freedesktop.org/archives/spice-devel/2011-July/004837.html + */ +if (strcmp(sin->subtype, "vdagent") == 0) { +return; +} +#endif + +if ((scd->chr->opened && connected) || +(!scd->chr->opened && !connected)) { +return; +} + +if (connected) { +scd->chr->opened = 1; +event = CHR_EVENT_OPENED; +} else { +scd->chr->opened = 0; +event = CHR_EVENT_CLOSED; +} + +if (scd->chr->chr_event) { +scd->chr->chr_event(scd->chr->handler_opaque, event); +} +} + static SpiceCharDeviceInterface vmc_interface = { .base.type = SPICE_INTERFACE_CHAR_DEVICE, .base.description = "spice virtual channel char device", .base.major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR, .base.minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR, +.state = vmc_state, .write = vmc_write, .read = vmc_read, }; @@ -197,7 +236,12 @@ int qemu_chr_open_spice(QemuOpts *opts, CharDriverState **_chr) chr->chr_guest_open = spice_chr_guest_open; chr->chr_guest_close = spice_chr_guest_close; -qemu_chr_generic_open(chr); +#if SPICE_SERVER_VERSION < 0x000901 +/* See comment in vmc_state() */ +if (strcmp(subtype, "vdagent") == 0) { +qemu_chr_generic_open(chr); +} +#endif *_chr = chr; return 0; -- 1.7.5.1
[Qemu-devel] [PATCH] escc: replace DPRINTFs with tracepoints
Signed-off-by: Blue Swirl --- hw/escc.c| 60 + trace-events | 15 ++ 2 files changed, 29 insertions(+), 46 deletions(-) diff --git a/hw/escc.c b/hw/escc.c index f6fd919..9e72d5e 100644 --- a/hw/escc.c +++ b/hw/escc.c @@ -27,15 +27,7 @@ #include "escc.h" #include "qemu-char.h" #include "console.h" - -/* debug serial */ -//#define DEBUG_SERIAL - -/* debug keyboard */ -//#define DEBUG_KBD - -/* debug mouse */ -//#define DEBUG_MOUSE +#include "trace.h" /* * Chipset docs: @@ -69,25 +61,6 @@ * 2010-May-23 Artyom Tarasenko: Reworked IUS logic */ -#ifdef DEBUG_SERIAL -#define SER_DPRINTF(fmt, ...) \ -do { printf("SER: " fmt , ## __VA_ARGS__); } while (0) -#else -#define SER_DPRINTF(fmt, ...) -#endif -#ifdef DEBUG_KBD -#define KBD_DPRINTF(fmt, ...) \ -do { printf("KBD: " fmt , ## __VA_ARGS__); } while (0) -#else -#define KBD_DPRINTF(fmt, ...) -#endif -#ifdef DEBUG_MOUSE -#define MS_DPRINTF(fmt, ...)\ -do { printf("MSC: " fmt , ## __VA_ARGS__); } while (0) -#else -#define MS_DPRINTF(fmt, ...) -#endif - typedef enum { chn_a, chn_b, } ChnID; @@ -249,7 +222,7 @@ static void put_queue(void *opaque, int b) ChannelState *s = opaque; SERIOQueue *q = &s->queue; -SER_DPRINTF("channel %c put: 0x%02x\n", CHN_C(s), b); +trace_escc_put_queue(CHN_C(s), b); if (q->count >= SERIO_QUEUE_SIZE) return; q->data[q->wptr] = b; @@ -273,7 +246,7 @@ static uint32_t get_queue(void *opaque) q->rptr = 0; q->count--; } -SER_DPRINTF("channel %c get 0x%02x\n", CHN_C(s), val); +trace_escc_get_queue(CHN_C(s), val); if (q->count > 0) serial_receive_byte(s, 0); return val; @@ -300,7 +273,7 @@ static void escc_update_irq(ChannelState *s) irq = escc_update_irq_chn(s); irq |= escc_update_irq_chn(s->otherchn); -SER_DPRINTF("IRQ = %d\n", irq); +trace_escc_update_irq(irq); qemu_set_irq(s->irq, irq); } @@ -485,8 +458,7 @@ static void escc_update_parameters(ChannelState *s) ssp.parity = parity; ssp.data_bits = data_bits; ssp.stop_bits = stop_bits; -SER_DPRINTF("channel %c: speed=%d parity=%c data=%d stop=%d\n", CHN_C(s), -speed, parity, data_bits, stop_bits); +trace_escc_update_parameters(CHN_C(s), speed, parity, data_bits, stop_bits); qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); } @@ -503,8 +475,7 @@ static void escc_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) s = &serial->chn[channel]; switch (saddr) { case SERIAL_CTRL: -SER_DPRINTF("Write channel %c, reg[%d] = %2.2x\n", CHN_C(s), s->reg, -val & 0xff); +trace_escc_mem_writeb_ctrl(CHN_C(s), s->reg, val & 0xff); newreg = 0; switch (s->reg) { case W_CMD: @@ -574,7 +545,7 @@ static void escc_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) s->reg = 0; break; case SERIAL_DATA: -SER_DPRINTF("Write channel %c, ch %d\n", CHN_C(s), val); +trace_escc_mem_writeb_data(CHN_C(s), val); s->tx = val; if (s->wregs[W_TXCTRL2] & TXCTRL2_TXEN) { // tx enabled if (s->chr) @@ -605,8 +576,7 @@ static uint32_t escc_mem_readb(void *opaque, target_phys_addr_t addr) s = &serial->chn[channel]; switch (saddr) { case SERIAL_CTRL: -SER_DPRINTF("Read channel %c, reg[%d] = %2.2x\n", CHN_C(s), s->reg, -s->rregs[s->reg]); +trace_escc_mem_readb_ctrl(CHN_C(s), s->reg, s->rregs[s->reg]); ret = s->rregs[s->reg]; s->reg = 0; return ret; @@ -617,7 +587,7 @@ static uint32_t escc_mem_readb(void *opaque, target_phys_addr_t addr) ret = get_queue(s); else ret = s->rx; -SER_DPRINTF("Read channel %c, ch %d\n", CHN_C(s), ret); +trace_escc_mem_readb_data(CHN_C(s), ret); if (s->chr) qemu_chr_accept_input(s->chr); return ret; @@ -643,7 +613,7 @@ static int serial_can_receive(void *opaque) static void serial_receive_byte(ChannelState *s, int ch) { -SER_DPRINTF("channel %c put ch %d\n", CHN_C(s), ch); +trace_escc_serial_receive_byte(CHN_C(s), ch); s->rregs[R_STATUS] |= STATUS_RXAV; s->rx = ch; set_rxint(s); @@ -767,8 +737,7 @@ static void sunkbd_event(void *opaque, int ch) ChannelState *s = opaque; int release = ch & 0x80; -KBD_DPRINTF("Untranslated keycode %2.2x (%s)\n", ch, release? "release" : -"press"); +trace_escc_sunkbd_event_in(ch); switch (ch) { case 58: // Caps lock press s->caps_lock_mode ^= 1; @@ -802,13 +771,13 @@ static void sunkbd_event(void *opaque, int ch) } else { ch = keycodes[ch & 0x7f]; } -KBD_DPRINTF("Translat
Re: [Qemu-devel] [PATCH] Fix forcing multicast msgs to loopback on OpenBSD.
Thanks, applied. On Sat, Jul 30, 2011 at 11:34 PM, Brad wrote: > On Fri, Jul 29, 2011 at 07:15:11PM -0400, Brad wrote: >> Fix forcing multicast msgs to loopback on OpenBSD. >> >> e.g. >> $ sudo qemu -m 128 -no-fd-bootchk \ >> -hda virtual.img -boot n -nographic \ >> -net nic,vlan=0,model=rtl8139,macaddr=52:54:00:12:34:03 \ >> -net user -tftp /usr/src/sys/arch/i386/compile/TEST -bootp pxeboot \ >> -net nic,vlan=1,model=rtl8139,macaddr=52:54:00:23:03:01 \ >> -net tap,vlan=1,script=no \ >> -net nic,vlan=3,model=rtl8139,macaddr=52:54:00:23:03:03 \ >> -net socket,vlan=3,mcast=230.0.0.1:10003 >> setsockopt(SOL_IP, IP_MULTICAST_LOOP): Invalid argument >> qemu: -net socket,vlan=3,mcast=230.0.0.1:10003: Device 'socket' could not be >> initialized >> >> >> Signed-off-by: Brad Smith > > An updated diff taking Blue Swirl's comment into consideration. > > > --- > net/socket.c | 10 -- > 1 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/net/socket.c b/net/socket.c > index 11fe5f3..5cd0b9a 100644 > --- a/net/socket.c > +++ b/net/socket.c > @@ -154,6 +154,12 @@ static int net_socket_mcast_create(struct sockaddr_in > *mcastaddr, struct in_addr > struct ip_mreq imr; > int fd; > int val, ret; > +#ifdef __OpenBSD__ > + unsigned char loop; > +#else > + int loop; > +#endif > + > if (!IN_MULTICAST(ntohl(mcastaddr->sin_addr.s_addr))) { > fprintf(stderr, "qemu: error: specified mcastaddr \"%s\" (0x%08x) does > not contain a multicast address\n", > inet_ntoa(mcastaddr->sin_addr), > @@ -197,9 +203,9 @@ static int net_socket_mcast_create(struct sockaddr_in > *mcastaddr, struct in_addr > } > > /* Force mcast msgs to loopback (eg. several QEMUs in same host */ > - val = 1; > + loop = 1; > ret=setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, > - (const char *)&val, sizeof(val)); > + (const char *)&loop, sizeof(loop)); > if (ret < 0) { > perror("setsockopt(SOL_IP, IP_MULTICAST_LOOP)"); > goto fail; > -- > 1.7.6 > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > >
Re: [Qemu-devel] [PATCH] configure: Disable guest_agent for mingw32
Am 06.08.2011 22:47, schrieb Stefan Weil: guest_agent is not supported for mingw32, so the default value should be 'no', not 'yes'. This removes the dependencies to glib-2.0 and python which makes native and cross builds for w32 much easier (no need to get and install these extra packages). It also avoids the problems caused by different bitfield alignment which is required by glib-2.0. It is still possible to set guest_agent=yes via configure option. Signed-off-by: Stefan Weil --- configure |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 0c67a4a..4cb33d9 100755 --- a/configure +++ b/configure @@ -493,6 +493,7 @@ if test "$mingw32" = "yes" ; then bindir="\${prefix}" sysconfdir="\${prefix}" confsuffix="" + guest_agent="no" fi werror="" Please apply this patch (or a similar solution) to QEMU 0.15, too. Otherwise QEMU 0.15 won't be usable with w32 (slirp bitfields). Thanks, Stefan Weil
Re: [Qemu-devel] [PATCH] use mmap to allocate execute memory
Thanks, applied. On Mon, Jul 25, 2011 at 9:05 AM, Christoph Egger wrote: > On 07/23/11 18:17, Anthony Liguori wrote: >> >> On 06/17/2011 05:11 AM, Christoph Egger wrote: >>> >>> Use mmap to allocate executable memory on NetBSD as well. >>> >>> From: Tobias Nygren >>> Signed-off-by: Christoph Egger >>> >>> diff --git a/exec.c b/exec.c >>> index 09928a3..1954a1c 100644 >>> --- a/exec.c >>> +++ b/exec.c >>> @@ -520,7 +520,8 @@ static void code_gen_alloc(unsigned long tb_size) >>> } >>> } >>> #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \ >>> - || defined(__DragonFly__) || defined(__OpenBSD__) >> >> Your mailer munged this patch. > > ... or by the MS Exchange Server. > > Resending the patch as attachment, the only one > way I have that works for everyone. Sorry. > > > Use mmap to allocate executable memory on NetBSD as well. > > From: Tobias Nygren > Signed-off-by: Christoph Egger > > > -- > ---to satisfy European Law for business letters: > Advanced Micro Devices GmbH > Einsteinring 24, 85689 Dornach b. Muenchen > Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd > Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen > Registergericht Muenchen, HRB Nr. 43632 >
Re: [Qemu-devel] [PATCH] fix network interface tap backend
On Mon, Jul 25, 2011 at 9:03 AM, Christoph Egger wrote: > On 07/23/11 18:17, Anthony Liguori wrote: >> >> On 06/17/2011 03:56 AM, Christoph Egger wrote: >>> >>> Fix network interface tap backend work on NetBSD. >>> It uses an ioctl to get the tap name. >>> >>> From Manuel Bouyer >>> Signed-off-by: Christoph Egger >>> >>> diff --git a/net/tap-bsd.c b/net/tap-bsd.c >>> index 2f3efde..577aafe 100644 >>> --- a/net/tap-bsd.c >>> +++ b/net/tap-bsd.c >>> @@ -28,6 +28,8 @@ >>> #include "qemu-error.h" >>> >>> #ifdef __NetBSD__ >>> +#include >> >> Your mailer munged this patch. > > ... or by the MS Exchange Server. > > Resending the patch as attachment, the only one > way I have that works for everyone. Sorry. Please attach the whole commit for example from 'git show', instead of just the diff. That can be fed to 'git am' directly. Now I had to combine the lines below and the patch by hand. Thanks, applied. > Fix network interface tap backend work on NetBSD. > It uses an ioctl to get the tap name. > > From Manuel Bouyer > Signed-off-by: Christoph Egger > > -- > ---to satisfy European Law for business letters: > Advanced Micro Devices GmbH > Einsteinring 24, 85689 Dornach b. Muenchen > Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd > Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen > Registergericht Muenchen, HRB Nr. 43632 >
Re: [Qemu-devel] [PATCH] darwin-user: Remove two unused variables
Thanks, applied. On Fri, Jul 22, 2011 at 9:43 PM, Stefan Weil wrote: > Am 22.07.2011 22:48, schrieb Andreas Färber: >> >> Hi Stefan W., >> >> Am 20.07.2011 um 21:40 schrieb Stefan Weil: >> >>> cppcheck report: >>> >>> darwin-user/signal.c:322: style: Unused variable: i >>> darwin-user/signal.c:322: style: >>> Variable 'err' is assigned a value that is never used >> >> Does this really bug you? I'm a bit skeptical towards trying to fix >> warnings in code that doesn't compile either way... (or does it by now?) >> >> Andreas > > Hi Andreas, > > the warnings were the result of a static code inspection with > a program called cppcheck. I don't compile darwin code, > so I did not notice that the code does not compile. > > Is there a good reason to keep those two unused variables? > Fixing the issue helps with static code analysis because > unnecessary manual code checks can be avoided. > > Cheers, > Stefan > > >
Re: [Qemu-devel] [PATCH] TCG: fix copy propagation
Thanks for testing, applied. On Sun, Aug 7, 2011 at 6:48 AM, Stefan Weil wrote: > Am 06.08.2011 23:26, schrieb Blue Swirl: >> >> Copy propagation introduced in 22613af4a6d9602001e6d0e7b6d98aa40aa018dc >> considered only global registers. However, register temps and stack >> allocated locals must be handled differently because register temps >> don't survive across brcond. >> >> Fix by propagating only within same class of temps. >> >> Signed-off-by: Blue Swirl >> --- >> tcg/optimize.c | 15 +-- >> tcg/tcg.h | 5 + >> 2 files changed, 14 insertions(+), 6 deletions(-) >> >> diff --git a/tcg/optimize.c b/tcg/optimize.c >> index a3bfa5e..7eb5eb1 100644 >> --- a/tcg/optimize.c >> +++ b/tcg/optimize.c >> @@ -185,12 +185,15 @@ static int op_to_movi(int op) >> } >> } >> >> -static void tcg_opt_gen_mov(TCGArg *gen_args, TCGArg dst, TCGArg src, >> - int nb_temps, int nb_globals) >> +static void tcg_opt_gen_mov(TCGContext *s, TCGArg *gen_args, TCGArg dst, >> + TCGArg src, int nb_temps, int nb_globals) >> { >> reset_temp(dst, nb_temps, nb_globals); >> assert(temps[src].state != TCG_TEMP_COPY); >> - if (src>= nb_globals) { >> + /* Don't try to copy if one of temps is a global or either one >> + is local and another is register */ >> + if (src>= nb_globals&& dst>= nb_globals&& >> + tcg_arg_is_local(s, src) == tcg_arg_is_local(s, dst)) { >> assert(temps[src].state != TCG_TEMP_CONST); >> if (temps[src].state != TCG_TEMP_HAS_COPY) { >> temps[src].state = TCG_TEMP_HAS_COPY; >> @@ -474,7 +477,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, >> uint16_t *tcg_opc_ptr, >> gen_opc_buf[op_index] = INDEX_op_nop; >> } else { >> gen_opc_buf[op_index] = op_to_mov(op); >> - tcg_opt_gen_mov(gen_args, args[0], args[1], >> + tcg_opt_gen_mov(s, gen_args, args[0], args[1], >> nb_temps, nb_globals); >> gen_args += 2; >> args += 3; >> @@ -500,7 +503,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, >> uint16_t *tcg_opc_ptr, >> gen_opc_buf[op_index] = INDEX_op_nop; >> } else { >> gen_opc_buf[op_index] = op_to_mov(op); >> - tcg_opt_gen_mov(gen_args, args[0], args[1], nb_temps, >> + tcg_opt_gen_mov(s, gen_args, args[0], args[1], >> nb_temps, >> nb_globals); >> gen_args += 2; >> args += 3; >> @@ -523,7 +526,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, >> uint16_t *tcg_opc_ptr, >> break; >> } >> if (temps[args[1]].state != TCG_TEMP_CONST) { >> - tcg_opt_gen_mov(gen_args, args[0], args[1], >> + tcg_opt_gen_mov(s, gen_args, args[0], args[1], >> nb_temps, nb_globals); >> gen_args += 2; >> args += 2; >> diff --git a/tcg/tcg.h b/tcg/tcg.h >> index e76f9af..e2a7095 100644 >> --- a/tcg/tcg.h >> +++ b/tcg/tcg.h >> @@ -410,6 +410,11 @@ static inline TCGv_i64 tcg_temp_local_new_i64(void) >> void tcg_temp_free_i64(TCGv_i64 arg); >> char *tcg_get_arg_str_i64(TCGContext *s, char *buf, int buf_size, >> TCGv_i64 arg); >> >> +static inline bool tcg_arg_is_local(TCGContext *s, TCGArg arg) >> +{ >> + return s->temps[arg].temp_local; >> +} >> + >> #if defined(CONFIG_DEBUG_TCG) >> /* If you call tcg_clear_temp_count() at the start of a section of >> * code which is not supposed to leak any TCG temporaries, then > > This fixes qemu-system-x86_64 and qemu-system-mips64(el) on 32 bit hosts. > > Tested-by: Stefan Weil > >
Re: [Qemu-devel] [PATCH] Remove unused is_softmmu parameter from cpu_handle_mmu_fault
Thanks for the Ack, applied. On Fri, Aug 5, 2011 at 3:49 PM, Richard Henderson wrote: > On 08/03/2011 11:00 AM, Blue Swirl wrote: >> Parameter is_softmmu (and its evil mutant twin brother is_softmuu) >> is not used in cpu_*_handle_mmu_fault() functions, remove them >> and adjust callers. >> >> Signed-off-by: Blue Swirl > > Acked-by: Richard Henderson > > > r~ > >> --- >> target-alpha/cpu.h | 2 +- >> target-alpha/helper.c | 4 ++-- >> target-alpha/op_helper.c | 2 +- >> target-arm/cpu.h | 2 +- >> target-arm/helper.c | 4 ++-- >> target-arm/op_helper.c | 2 +- >> target-cris/cpu.h | 2 +- >> target-cris/helper.c | 11 +-- >> target-cris/op_helper.c | 2 +- >> target-i386/cpu.h | 2 +- >> target-i386/helper.c | 4 ++-- >> target-i386/op_helper.c | 2 +- >> target-lm32/cpu.h | 2 +- >> target-lm32/helper.c | 2 +- >> target-lm32/op_helper.c | 2 +- >> target-m68k/cpu.h | 2 +- >> target-m68k/helper.c | 4 ++-- >> target-m68k/op_helper.c | 2 +- >> target-microblaze/cpu.h | 2 +- >> target-microblaze/helper.c | 4 ++-- >> target-microblaze/op_helper.c | 2 +- >> target-mips/cpu.h | 2 +- >> target-mips/helper.c | 6 +++--- >> target-mips/op_helper.c | 2 +- >> target-ppc/cpu.h | 2 +- >> target-ppc/helper.c | 4 ++-- >> target-ppc/op_helper.c | 2 +- >> target-s390x/cpu.h | 2 +- >> target-s390x/helper.c | 12 ++-- >> target-s390x/op_helper.c | 2 +- >> target-sh4/cpu.h | 2 +- >> target-sh4/helper.c | 4 ++-- >> target-sh4/op_helper.c | 2 +- >> target-sparc/cpu.h | 2 +- >> target-sparc/helper.c | 6 +++--- >> target-sparc/op_helper.c | 2 +- >> target-unicore32/cpu.h | 2 +- >> target-unicore32/helper.c | 2 +- >> user-exec.c | 2 +- >> 39 files changed, 59 insertions(+), 60 deletions(-) >
[Qemu-devel] [PATCH] Fix build failure when coroutines need gthreads but guest agent is disabled
When coroutines use GThreads instead of Win32 threads or ucontexts, glib and gthreads must be used. Signed-off-by: Blue Swirl --- configure | 39 +-- 1 files changed, 21 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 0c67a4a..a25e65c 100755 --- a/configure +++ b/configure @@ -1843,15 +1843,32 @@ EOF fi ## +# check if we have makecontext + +ucontext_coroutine=no +if test "$darwin" != "yes"; then + cat > $TMPC << EOF +#include +int main(void) { makecontext(0, 0, 0); } +EOF + if compile_prog "" "" ; then + ucontext_coroutine=yes + fi +fi + +## # glib support probe -if test "$guest_agent" != "no" ; then +if test "$guest_agent" != "no" -o "$ucontext_coroutine" != "yes" -a "$mingw32" != "yes"; then if $pkg_config --modversion glib-2.0 > /dev/null 2>&1 ; then glib_cflags=`$pkg_config --cflags glib-2.0 2>/dev/null` glib_libs=`$pkg_config --libs glib-2.0 2>/dev/null` -libs_softmmu="$glib_libs $libs_softmmu" -libs_tools="$glib_libs $libs_tools" +gthread_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null` +gthread_libs=`$pkg_config --libs gthread-2.0 2>/dev/null` +glib_cflags="$glib_cflags $gthread_cflags" +libs_softmmu="$glib_libs $gthread_libs $libs_softmmu" +libs_tools="$glib_libs $gthread_libs $libs_tools" else -echo "glib-2.0 required to compile QEMU" +echo "glib-2.0 required to compile QEMU with guest agent or gthread based coroutines" exit 1 fi fi @@ -2557,20 +2574,6 @@ EOF fi ## -# check if we have makecontext - -ucontext_coroutine=no -if test "$darwin" != "yes"; then - cat > $TMPC << EOF -#include -int main(void) { makecontext(0, 0, 0); } -EOF - if compile_prog "" "" ; then - ucontext_coroutine=yes - fi -fi - -## # End of CC checks # After here, no more $cc or $ld runs -- 1.6.2.4
Re: [Qemu-devel] [PATCH v3 29/39] sun4u: convert to memory API
On 08/05/2011 06:30 PM, Anthony Liguori wrote: -isa_bus_new(&s->qdev); +EbusState *s = container_of(pci_dev, EbusState, pci_dev); DO_UPCAST() is the qdev macro for this. Fixed. -- error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH][SPARC] Fix handling of conditional branches in delay slot of a conditional branch
On Sat, Aug 6, 2011 at 9:33 PM, Artyom Tarasenko wrote: > Since it's a pure bug fix, do you think can it be applied to 0.15 as well? Maybe. Anthony/Jordan, please consider applying these to stable: 548f66d Fix handling of conditional branches in delay slot of a conditional branch 6749432 Sparc: fix non-faulting unassigned memory accesses ccb57e0 SPARC64: fix fnor* and fnand* > On Sat, Aug 6, 2011 at 10:14 PM, Blue Swirl wrote: >> Thanks, applied. >> >> On Sat, Aug 6, 2011 at 3:01 PM, Artyom Tarasenko wrote: >>> Check whether dc->npc is dynamic before using its value for branch. >>> >>> Signed-off-by: Artyom Tarasenko >>> --- >>> Particaluary the patch fixes handling of the constructions like >>> >>> 0x13e26c0: brz,pn %o0, 0x13e26e4 >>> 0x13e26c4: brlez,pn %o1, 0x13e26e4 >>> >>> present in NetBSD-5.1 >>> >>> target-sparc/translate.c | 30 +- >>> 1 files changed, 21 insertions(+), 9 deletions(-) >>> >>> diff --git a/target-sparc/translate.c b/target-sparc/translate.c >>> index 958fbc5..dee67b3 100644 >>> --- a/target-sparc/translate.c >>> +++ b/target-sparc/translate.c >>> @@ -1286,7 +1286,6 @@ static inline void gen_cond_reg(TCGv r_dst, int cond, >>> TCGv r_src) >>> } >>> #endif >>> >>> -/* XXX: potentially incorrect if dynamic npc */ >>> static void do_branch(DisasContext *dc, int32_t offset, uint32_t insn, int >>> cc, >>> TCGv r_cond) >>> { >>> @@ -1321,13 +1320,17 @@ static void do_branch(DisasContext *dc, int32_t >>> offset, uint32_t insn, int cc, >>> } else { >>> dc->pc = dc->npc; >>> dc->jump_pc[0] = target; >>> - dc->jump_pc[1] = dc->npc + 4; >>> - dc->npc = JUMP_PC; >>> + if (unlikely(dc->npc == DYNAMIC_PC)) { >>> + dc->jump_pc[1] = DYNAMIC_PC; >>> + tcg_gen_addi_tl(cpu_pc, cpu_npc, 4); >>> + } else { >>> + dc->jump_pc[1] = dc->npc + 4; >>> + dc->npc = JUMP_PC; >>> + } >>> } >>> } >>> } >>> >>> -/* XXX: potentially incorrect if dynamic npc */ >>> static void do_fbranch(DisasContext *dc, int32_t offset, uint32_t insn, >>> int cc, >>> TCGv r_cond) >>> { >>> @@ -1362,14 +1365,18 @@ static void do_fbranch(DisasContext *dc, int32_t >>> offset, uint32_t insn, int cc, >>> } else { >>> dc->pc = dc->npc; >>> dc->jump_pc[0] = target; >>> - dc->jump_pc[1] = dc->npc + 4; >>> - dc->npc = JUMP_PC; >>> + if (unlikely(dc->npc == DYNAMIC_PC)) { >>> + dc->jump_pc[1] = DYNAMIC_PC; >>> + tcg_gen_addi_tl(cpu_pc, cpu_npc, 4); >>> + } else { >>> + dc->jump_pc[1] = dc->npc + 4; >>> + dc->npc = JUMP_PC; >>> + } >>> } >>> } >>> } >>> >>> #ifdef TARGET_SPARC64 >>> -/* XXX: potentially incorrect if dynamic npc */ >>> static void do_branch_reg(DisasContext *dc, int32_t offset, uint32_t insn, >>> TCGv r_cond, TCGv r_reg) >>> { >>> @@ -1384,8 +1391,13 @@ static void do_branch_reg(DisasContext *dc, int32_t >>> offset, uint32_t insn, >>> } else { >>> dc->pc = dc->npc; >>> dc->jump_pc[0] = target; >>> - dc->jump_pc[1] = dc->npc + 4; >>> - dc->npc = JUMP_PC; >>> + if (unlikely(dc->npc == DYNAMIC_PC)) { >>> + dc->jump_pc[1] = DYNAMIC_PC; >>> + tcg_gen_addi_tl(cpu_pc, cpu_npc, 4); >>> + } else { >>> + dc->jump_pc[1] = dc->npc + 4; >>> + dc->npc = JUMP_PC; >>> + } >>> } >>> } >>> >>> -- >>> 1.7.3.4 >>> >>> >> > > > > -- > Regards, > Artyom Tarasenko > > solaris/sparc under qemu blog: http://tyom.blogspot.com/ >
Re: [Qemu-devel] [PATCH v3 28/39] isa-mmio: concert to memory API
On 08/05/2011 06:29 PM, Anthony Liguori wrote: On 08/04/2011 08:06 AM, Avi Kivity wrote: Reviewed-by: Richard Henderson Signed-off-by: Avi Kivity For the subject, s:concert:convert:g Fixed -- error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH v3 25/39] ne2000: convert to memory API
On 08/05/2011 06:28 PM, Anthony Liguori wrote: diff --git a/hw/ne2000-isa.c b/hw/ne2000-isa.c index e41dbba..ce7b365 100644 --- a/hw/ne2000-isa.c +++ b/hw/ne2000-isa.c @@ -61,24 +61,18 @@ static const VMStateDescription vmstate_isa_ne2000 = { } }; +#include "exec-memory.h" + Should be at the top of the file. Well, it was meant to stick out as a sore thumb, since it's incorrect except in memory.c and exec.c. I have it rendered in comic-sans in my editor for extra effect. I fixed it here and everywhere else. -- error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH v3 13/39] rtl8139: convert to memory API
On 08/05/2011 05:21 PM, Anthony Liguori wrote: +{ 0, 0x100, 4, .write = rtl8139_ioport_writel, }, +PORTIO_END Hrm, I missed this #define when it was introduced. Elsewhere we use: VMSTATE_END_OF_LIST() DEFINE_PROP_END_OF_LIST() For consistency, we ought to use PORTIO_END_OF_LIST() Okay, fixed. -- error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH v3 14/39] ac97: convert to memory API
On 08/05/2011 07:47 PM, malc wrote: On Fri, 5 Aug 2011, Anthony Liguori wrote: > On 08/04/2011 08:06 AM, Avi Kivity wrote: > > fixes BAR sizing as well. > > > > Reviewed-by: Richard Henderson > > Signed-off-by: Avi Kivity > > Reviewed-by: Anthony Liguori > > Malc, please Ack > Ok, please notify me when this is pushed so i can correct the formatting consistency issues. What exactly do you want changed? -- error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH v3 10/39] Integrate I/O memory regions into qemu
On 08/05/2011 05:15 PM, Anthony Liguori wrote: */ MemoryRegion *get_system_memory(void); +MemoryRegion *get_system_io(void); + @@ -28,6 +28,8 @@ Could you add a doc comment for this function? Done. -- error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH v3 05/39] cirrus: simplify mmio BAR access functions
On 08/05/2011 05:08 PM, Anthony Liguori wrote: .read = cirrus_mmio_read, .write = cirrus_mmio_write, .endianness = DEVICE_LITTLE_ENDIAN, +.impl = { +.min_access_size = 1, +.max_access_size = 1, +}, }; static const MemoryRegionOps cirrus_mmio_io_ops = { Nevermind, I get the lack of old_mmio usage now. Well, the real reason was that old_mmio didn't exist when I wrote the patchset, and I didn't want to undo all this work when it appeared. -- error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH v3 02/39] pci: add API to get a BAR's mapped address
On 08/05/2011 04:53 PM, Anthony Liguori wrote: On 08/04/2011 08:05 AM, Avi Kivity wrote: This is a hack, for devices that have a back-channel to read this address back outside the normal configuration mechanisms, such as VMware svga. Reviewed-by: Richard Henderson Signed-off-by: Avi Kivity Can we add a comment to the header file to this effect? I think I'll just update the changelog. There is nothing hacky about the API - it just reads documented PCI registers - it's the hardware that needs the API that's hacky, since the value in the registers doesn't mean much. -- error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH v3 01/39] virtio-pci: get config on init
On 08/05/2011 04:52 PM, Anthony Liguori wrote: static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, @@ -689,6 +686,10 @@ void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev) proxy->host_features |= 0x1<< VIRTIO_F_NOTIFY_ON_EMPTY; proxy->host_features |= 0x1<< VIRTIO_F_BAD_FEATURE; proxy->host_features = vdev->get_features(vdev, proxy->host_features); + +if (vdev->config_len) { +vdev->get_config(vdev, vdev->config); +} Thinking more closely, I don't think this right. Updating on map ensured that the config was refreshed after each time the bar was mapped. In the very least, the config needs to be refreshed during reset because the guest may write to the guest space which should get cleared after reset. Michael, please provide the correct fix. Best merged directly, not via my patchset. -- error compiling committee.c: too many arguments to function