Stefan Hajnoczi [Wed, 20 Feb 2013 10:28:28 +0000 (11:28 +0100)]
slirp: switch to GPollFD
Slirp uses rfds/wfds/xfds more extensively than other QEMU components.
The rarely-used out-of-band TCP data feature is used. That means we
need the full table of select(2) to g_poll(3) events:
rfds -> G_IO_IN | G_IO_HUP | G_IO_ERR
wfds -> G_IO_OUT | G_IO_ERR
xfds -> G_IO_PRI
I came up with this table by looking at Linux fs/select.c which maps
select(2) to poll(2) internally.
Another detail to watch out for are the global variables that reference
rfds/wfds/xfds during slirp_select_poll(). sofcantrcvmore() and
sofcantsendmore() use these globals to clear fd_set bits. When
sofcantrcvmore() is called, the wfds bit is cleared so that the write
handler will no longer be run for this iteration of the event loop.
This actually seems buggy to me since TCP connections can be half-closed
and we'd still want to handle data in half-duplex fashion. I think the
real intention is to avoid running the read/write handler when the
socket has been fully closed. This is indicated with the SS_NOFDREF
state bit so we now check for it before invoking the TCP write handler.
Note that UDP/ICMP code paths don't care because they are
connectionless.
Note that slirp/ has a lot of tabs and sometimes mixed tabs with spaces.
I followed the style of the surrounding code.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id:
1361356113-11049-6-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Stefan Hajnoczi [Wed, 20 Feb 2013 10:28:27 +0000 (11:28 +0100)]
slirp: slirp/slirp.c coding style cleanup
The slirp glue code uses tabs in some places. Since the next patch will
modify the file, convert tabs to spaces and fix checkpatch.pl issues.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id:
1361356113-11049-5-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Stefan Hajnoczi [Wed, 20 Feb 2013 10:28:26 +0000 (11:28 +0100)]
main-loop: switch POSIX glib integration to GPollFD
Convert glib file descriptor polling from rfds/wfds/xfds to GPollFD.
The Windows code still needs poll_fds[] and n_poll_fds but they can now
become local variables.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id:
1361356113-11049-4-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Stefan Hajnoczi [Wed, 20 Feb 2013 10:28:25 +0000 (11:28 +0100)]
main-loop: switch to g_poll() on POSIX hosts
Use g_poll(3) instead of select(2). Well, this is kind of a cheat.
It's true that we're now using g_poll(3) on POSIX hosts but the *_fill()
and *_poll() functions are still using rfds/wfds/xfds.
We've set the scene to start converting *_fill() and *_poll() functions
step-by-step until no more rfds/wfds/xfds users remain. Then we'll drop
the temporary gpollfds_from_select() and gpollfds_to_select() functions
and be left with native g_poll(2).
On Windows things are a little crazy: convert from rfds/wfds/xfds to
GPollFDs, back to rfds/wfds/xfds, call select(2), rfds/wfds/xfds back to
GPollFDs, and finally back to rfds/wfds/xfds again. This is only
temporary and keeps the Windows build working through the following
patches. We'll drop this excessive conversion later and be left with a
single GPollFDs -> select(2) -> GPollFDs sequence that allows Windows to
use select(2) while the rest of QEMU only knows about GPollFD.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id:
1361356113-11049-3-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Stefan Hajnoczi [Wed, 20 Feb 2013 10:28:24 +0000 (11:28 +0100)]
main-loop: fix select_ret uninitialized variable warning
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id:
1361356113-11049-2-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Thu, 21 Feb 2013 15:39:17 +0000 (09:39 -0600)]
Merge remote-tracking branch 'kraxel/usb.78' into staging
# By Gerd Hoffmann
# Via Gerd Hoffmann
* kraxel/usb.78:
uas-uas: usb3 streams
usb-xhci: usb3 streams
usb-core: usb3 streams
usb: fix endpoint descriptor ordering
usb-redir: simplify packet copy
usb: make usb_packet_copy operate on combined packets
usb: add usb_ep_set_halted
usb-host: remove usb_host_device_close
usb-host: move legacy cmd line bits
usb-storage: use scsi_req_enqueue return value
allow disabling usb smartcard support
make usb devices configurable
fix scripts/make_device_config.sh
usb: Makefile cleanup
Anthony Liguori [Thu, 21 Feb 2013 15:38:27 +0000 (09:38 -0600)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
# By Alin Tomescu (1) and others
# Via Stefan Hajnoczi
* stefanha/trivial-patches:
.gitignore: Ignore optionrom/*.asm
ppc: fix bamboo >256MB RAM initialization in hw/ppc4xx_devs.c
Add some missing qtest binaries to .gitignore
xilinx_axienet.c: Assert no error when making link
Remove forward declaration of non-existant variable
Cole Robinson [Tue, 19 Feb 2013 22:41:28 +0000 (17:41 -0500)]
.gitignore: Ignore optionrom/*.asm
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Alin Tomescu [Thu, 21 Feb 2013 02:36:09 +0000 (21:36 -0500)]
ppc: fix bamboo >256MB RAM initialization in hw/ppc4xx_devs.c
I was trying to launch a PowerPC "bamboo" machine with more than 256MB of RAM
with qemu-system-ppc -M bamboo -kernel $kernel -initrd $ramdisk -m 512, but QEMU
would just hang. However, when I used -m 256, the machine would boot.
I looked through the code in hw/ and it seems there is an error when the
RAM memory is setup (if my understanding is correct).
After patching it, the machine launched and booted successfully with 512MB of
RAM.
Signed-off-by: Alin Tomescu <tomescu.alin@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
David Gibson [Thu, 21 Feb 2013 02:34:40 +0000 (13:34 +1100)]
Add some missing qtest binaries to .gitignore
These binaries are generated during make check on at least some
configurations, so att them to .gitignore.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Peter Crosthwaite [Mon, 11 Feb 2013 07:16:05 +0000 (17:16 +1000)]
xilinx_axienet.c: Assert no error when making link
This gives an awful silent failure when it doesn't work. Assert against link
creation failure.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Hervé Poussineau [Sun, 10 Feb 2013 22:11:05 +0000 (23:11 +0100)]
Remove forward declaration of non-existant variable
This variable has been removed 5 years ago in
970ac5a3082428dca91171f270dcd95d6f4b2636.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Gerd Hoffmann [Fri, 25 Jan 2013 16:38:59 +0000 (17:38 +0100)]
uas-uas: usb3 streams
Add usb3 streams support to the uas (usb attached scsi) emulation.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 25 Jan 2013 16:23:44 +0000 (17:23 +0100)]
usb-xhci: usb3 streams
Add streams support to the xhci emulation. No secondary streams yet,
only linear stream arays are supported for now.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Tue, 29 Jan 2013 11:44:35 +0000 (12:44 +0100)]
usb-core: usb3 streams
This patch adds support for usb3 streams to the usb subsystem core.
This is just adding a streams field / parameter in a number of places.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Mon, 28 Jan 2013 14:52:57 +0000 (15:52 +0100)]
usb: fix endpoint descriptor ordering
Fix the ordering of the endpoint descriptors for superspeed endpoints:
The superspeed companion must come first, possible additional
descriptors for the endpoint after that.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Thu, 24 Jan 2013 14:40:37 +0000 (15:40 +0100)]
usb-redir: simplify packet copy
usb_packet_copy can handle combined packets now,
so it isn't needed to special-case them any more.
Also use the new usb_packet_size() function.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Thu, 24 Jan 2013 14:38:23 +0000 (15:38 +0100)]
usb: make usb_packet_copy operate on combined packets
Likewise usb_packet_skip.
Also usb_packet_size.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Wed, 12 Dec 2012 12:40:59 +0000 (13:40 +0100)]
usb: add usb_ep_set_halted
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 30 Nov 2012 12:02:47 +0000 (13:02 +0100)]
usb-host: remove usb_host_device_close
Nobody implements that anyway.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Wed, 23 Jan 2013 13:15:38 +0000 (14:15 +0100)]
usb-host: move legacy cmd line bits
The code handling the "-usbdevice host:..." legacy command line
syntax is moved to the new hw/usb/host-legacy.c file.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Tue, 22 Jan 2013 13:17:05 +0000 (14:17 +0100)]
usb-storage: use scsi_req_enqueue return value
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 1 Feb 2013 10:08:24 +0000 (11:08 +0100)]
allow disabling usb smartcard support
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 1 Feb 2013 09:49:43 +0000 (10:49 +0100)]
make usb devices configurable
Leave the core usb devices (usb hub, tablet, mouse, keyboard)
enabled unconditionally. Make the other ones configurable.
Exceptions:
- bluetooth: not qdevified yet, has a vl.c dependency because
of that, thus disabling isn't as easy as not linking the
object file.
- smardcard: ccid-card-emulated depends on that one *and*
CONFIG_SMARTCARD_NSS. So it isn't a one-liner and comes
as separate patch because of that.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 1 Feb 2013 09:48:34 +0000 (10:48 +0100)]
fix scripts/make_device_config.sh
Make it handle multiple include statements in a file:
(1) The printf needs a space so the include files will be separated.
(2) Also $f can contain multiple failes, so redirection will not work
and we have to use cat to process all files.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 1 Feb 2013 08:53:17 +0000 (09:53 +0100)]
usb: Makefile cleanup
Group files, sprinkle in some comments.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Paolo Bonzini [Fri, 11 Jan 2013 16:46:57 +0000 (17:46 +0100)]
rtc-test: add testcases for alarms in 12hour mode
Trying (unsuccessfully) to break the device model as mentioned in
https://bugs.launchpad.net/qemu/+bug/
1090558.
At least if someone tries to fix that, it won't break what works...
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id:
1357922817-17584-3-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Fri, 11 Jan 2013 16:46:56 +0000 (17:46 +0100)]
rtc-test: always set register B in its entirety
Eliminate dependencies between one test and the others.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id:
1357922817-17584-2-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Andre Przywara [Thu, 18 Oct 2012 09:16:58 +0000 (11:16 +0200)]
vnc-tls: Fix compilation with newer versions of GNU-TLS
In my installation of GNU-TLS (v3.0.23) the type
gnutls_anon_server_credentials is marked deprecated, so -Werror
breaks compilation.
Simply replacing it with the newer ..._t version fixed the compilation
on my machine (Slackware 14.0). I cannot tell how far back this "new"
type goes, at least the header file in RHEL 5.0 (v1.4.1) seems to have
it already. If someone finds a broken distribution, tell me and I
insert some compat code.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Message-id:
1350551818-14717-1-git-send-email-andre.przywara@amd.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Markus Armbruster [Wed, 13 Feb 2013 18:49:43 +0000 (19:49 +0100)]
doc help: Collect block device stuff under its own heading
Collect them from "Standard options", "File system options", "Virtual
File system pass-through options", "Debug/Expert options".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id:
1360781383-28635-8-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Markus Armbruster [Wed, 13 Feb 2013 18:49:42 +0000 (19:49 +0100)]
doc help: A few options are under inappropriate headings, fix
--device is under heading "USB options". --name and --uuid are under
"Virtual File system pass-through options". Move all three to
"Standard options".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id:
1360781383-28635-7-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Markus Armbruster [Wed, 13 Feb 2013 18:49:41 +0000 (19:49 +0100)]
help: Fix markup of heading "USB options" so it appears in -help
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id:
1360781383-28635-6-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Markus Armbruster [Wed, 13 Feb 2013 18:49:40 +0000 (19:49 +0100)]
doc: Fix texinfo @table markup in qemu-options.hx
End tables before headings, start new ones afterwards. Fixes
incorrect indentation of headings "File system options" and "Virtual
File system pass-through options" in manual page and qemu-doc.
Normalize markup some to increase chances it survives future edits.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id:
1360781383-28635-5-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Markus Armbruster [Wed, 13 Feb 2013 18:49:39 +0000 (19:49 +0100)]
doc: Fill some option doc gaps in manual page and qemu-doc
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id:
1360781383-28635-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Markus Armbruster [Wed, 13 Feb 2013 18:49:38 +0000 (19:49 +0100)]
doc: Fix some option entries in qemu-doc's function index
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id:
1360781383-28635-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Markus Armbruster [Wed, 13 Feb 2013 18:49:37 +0000 (19:49 +0100)]
help: Drop bogus help on -qtest and -qtest-log
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id:
1360781383-28635-2-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Andreas Färber [Sat, 16 Feb 2013 10:27:26 +0000 (11:27 +0100)]
isa: Split off instance_init for ISADevice
Prepares for assigning IRQs before QOM realize.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Message-id:
1361010446-1427-1-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Andreas Färber [Sat, 16 Feb 2013 21:44:03 +0000 (22:44 +0100)]
qtest: Add MMIO support
Introduce [qtest_]{read,write}[bwlq]() libqtest functions and
corresponding QTest protocol commands to replace local versions in
libi2c-omap.c.
Also convert m48t59-test's cmos_{read,write}_mmio() to {read,write}b().
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Message-id:
1361051043-27944-4-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Andreas Färber [Sat, 16 Feb 2013 21:44:02 +0000 (22:44 +0100)]
libqtest: Introduce qtest_qmpv() and convert remaining macro
In order to convert qmp() macro to an inline function, expose a
qtest_qmpv() function, reused by qtest_qmp().
We can't apply GCC_FMT_ATTR() since fdc-test is using zero-length format
strings, which would result in warnings treated as errors.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Message-id:
1361051043-27944-3-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Andreas Färber [Sat, 16 Feb 2013 21:44:01 +0000 (22:44 +0100)]
libqtest: Convert macros to functions and clean up documentation
libqtest.h provides a number of shortcut macros to avoid tests feeding
it the QTestState they operate on. Most of these can easily be turned
into static inline functions, so let's do that for clarity.
This avoids getting off-by-one error messages when passing wrong args.
Some macros had a val argument but documented @value argument. Fix this.
While touching things, enforce gtk-doc markup for return values and for
referencing types.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Message-id:
1361051043-27944-2-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Mon, 18 Feb 2013 14:37:29 +0000 (08:37 -0600)]
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
# By Andreas Färber
# Via Andreas Färber
* afaerber/qom-cpu: (47 commits)
target-i386: Split command line parsing out of cpu_x86_register()
target-i386: Move cpu_x86_init()
target-lm32: Drop unused cpu_lm32_close() prototype
target-s390x: Drop unused cpu_s390x_close() prototype
spapr_hcall: Replace open-coded CPU loop with qemu_get_cpu()
ppce500_spin: Replace open-coded CPU loop with qemu_get_cpu()
e500: Replace open-coded loop with qemu_get_cpu()
cpu: Add CPUArchState pointer to CPUState
cputlb: Pass CPUState to cpu_unlink_tb()
cpu: Move current_tb field to CPUState
cpu: Move exit_request field to CPUState
cpu: Move running field to CPUState
cpu: Move host_tid field to CPUState
target-cris: Introduce CRISCPU subclasses
target-m68k: Pass M68kCPU to m68k_set_irq_level()
mcf_intc: Pass M68kCPU to mcf_intc_init()
mcf5206: Pass M68kCPU to mcf5206_init()
target-m68k: Return M68kCPU from cpu_m68k_init()
ppc405_uc: Pass PowerPCCPU to ppc40x_{core,chip,system}_reset()
target-xtensa: Move TCG initialization to XtensaCPU initfn
...
Richard Henderson [Sat, 16 Feb 2013 20:47:01 +0000 (12:47 -0800)]
tests: Add unit tests for mulu64 and muls64
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Sat, 16 Feb 2013 20:47:00 +0000 (12:47 -0800)]
host-utils: Improve mulu64 and muls64
The new formulation makes better use of add-with-carry type insns
that the host may have. Use gcc's sign adjustment trick to avoid
having to perform a 128-bit negation.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Sat, 16 Feb 2013 20:46:59 +0000 (12:46 -0800)]
host-utils: Use __int128_t for mul[us]64
Replace some x86_64 specific inline assembly with something that
all 64-bit hosts ought to optimize well. At worst this becomes
a call to the gcc __multi3 routine, which is no worse than our
implementation in util/host-utils.c.
With gcc 4.7, we get identical code generation for x86_64. We
now get native multiplication on ia64 and s390x hosts. With minor
improvements to gcc we can get it for ppc64 as well.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Andreas Färber [Sat, 16 Feb 2013 22:21:24 +0000 (23:21 +0100)]
tcg/ppc: Fix build of tcg_qemu_tb_exec()
Commit
0b0d3320db74cde233ee7855ad32a9c121d20eb4 (TCG: Final globals
clean-up) moved code_gen_prologue but forgot to update ppc code.
This broke the build on 32-bit ppc. ppc64 is unaffected.
Cc: Evgeny Voevodin <evgenyvoevodin@gmail.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Andreas Färber [Sun, 27 Jan 2013 13:32:05 +0000 (14:32 +0100)]
target-sparc: Fix debug output for DEBUG_MMU
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Andreas Färber [Fri, 15 Feb 2013 13:06:56 +0000 (14:06 +0100)]
target-i386: Split command line parsing out of cpu_x86_register()
In order to instantiate a CPU subtype we will need to know which type,
so move the cpu_model splitting into cpu_x86_init().
Parameters need to be set on the X86CPU instance, so move
cpu_x86_parse_featurestr() into cpu_x86_init() as well.
This leaves cpu_x86_register() operating on the model name only.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Fri, 1 Feb 2013 14:12:13 +0000 (15:12 +0100)]
target-i386: Move cpu_x86_init()
Consolidate CPU functions in cpu.c.
Allows to make cpu_x86_register() static.
No functional changes.
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 2 Feb 2013 11:13:15 +0000 (12:13 +0100)]
target-lm32: Drop unused cpu_lm32_close() prototype
It was never implemented.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 2 Feb 2013 11:10:37 +0000 (12:10 +0100)]
target-s390x: Drop unused cpu_s390x_close() prototype
It was never implemented.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Fri, 15 Feb 2013 15:43:08 +0000 (16:43 +0100)]
spapr_hcall: Replace open-coded CPU loop with qemu_get_cpu()
The helper functions all access ppc-specific fields only so don't bother
to change arguments to PowerPCCPU and use env_ptr instead.
No functional change.
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Fri, 15 Feb 2013 14:56:27 +0000 (15:56 +0100)]
ppce500_spin: Replace open-coded CPU loop with qemu_get_cpu()
Potentially env could be NULL whereas cpu would still be valid and
correspond to a previous env.
Wrapping this in qemu_get_cpu(), env is no longer needed, so simplify
code that existed before
55e5c2850293547203874098f7cec148ffd12dfa.
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Fri, 15 Feb 2013 14:21:13 +0000 (15:21 +0100)]
e500: Replace open-coded loop with qemu_get_cpu()
Since we still need env for ppc-specific fields, obtain it via the new
env_ptr fields to avoid "cpu" name conflicts between CPUState and
PowerPCCPU for now.
This fixes a potential issue with env being NULL at the end of the loop
but cpu still being a valid pointer corresponding to a previous env.
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Thu, 17 Jan 2013 11:13:41 +0000 (12:13 +0100)]
cpu: Add CPUArchState pointer to CPUState
The target-specific ENV_GET_CPU() macros have allowed us to navigate
from CPUArchState to CPUState. The reverse direction was not supported.
Avoid introducing CPU_GET_ENV() macros by initializing an untyped
pointer that is initialized in derived instance_init functions.
The field may not be called "env" due to it being poisoned.
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Thu, 17 Jan 2013 08:16:15 +0000 (09:16 +0100)]
cputlb: Pass CPUState to cpu_unlink_tb()
CPUArchState is no longer needed.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Wed, 16 Jan 2013 18:29:31 +0000 (19:29 +0100)]
cpu: Move current_tb field to CPUState
Explictly NULL it on CPU reset since it was located before breakpoints.
Change vapic_report_tpr_access() argument to CPUState. This also
resolves the use of void* for cpu.h independence.
Change vAPIC patch_instruction() argument to X86CPU.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Mon, 17 Dec 2012 07:02:44 +0000 (08:02 +0100)]
cpu: Move exit_request field to CPUState
Since it was located before breakpoints field, it needs to be reset.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Mon, 17 Dec 2012 06:34:52 +0000 (07:34 +0100)]
cpu: Move running field to CPUState
Pass CPUState to cpu_exec_{start,end}() functions.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Mon, 17 Dec 2012 06:12:13 +0000 (07:12 +0100)]
cpu: Move host_tid field to CPUState
Change gdbstub's cpu_index() argument to CPUState now that CPUArchState
is no longer used.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Wed, 6 Feb 2013 16:18:12 +0000 (17:18 +0100)]
target-cris: Introduce CRISCPU subclasses
Use class_init functions to initialize the VR in preparation for
overriding v32+ behavior there.
Move cpu_cris_init() to cpu.c and hook up a class_by_name callback.
This change leads to unknown -cpu model names no longer falling back
to a CPU with VR 32 but instead returning NULL.
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Fri, 18 Jan 2013 13:20:52 +0000 (14:20 +0100)]
target-m68k: Pass M68kCPU to m68k_set_irq_level()
Simplifies use of cpu_reset_interrupt() et al.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Fri, 18 Jan 2013 13:15:09 +0000 (14:15 +0100)]
mcf_intc: Pass M68kCPU to mcf_intc_init()
Store it in mcf_intc_state.
Prepares for passing it to m68k_set_irq_level().
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Fri, 18 Jan 2013 13:10:34 +0000 (14:10 +0100)]
mcf5206: Pass M68kCPU to mcf5206_init()
Store it in m5206_mbar_state. Prepares for passing M68kCPU to
m68k_set_irq_level().
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Fri, 18 Jan 2013 13:03:58 +0000 (14:03 +0100)]
target-m68k: Return M68kCPU from cpu_m68k_init()
Turn cpu_init() into a static inline function for backwards
compatibility.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Fri, 18 Jan 2013 14:57:51 +0000 (15:57 +0100)]
ppc405_uc: Pass PowerPCCPU to ppc40x_{core,chip,system}_reset()
Prepares for changing cpu_interrupt() argument to CPUState.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
Andreas Färber [Sun, 20 Jan 2013 00:46:45 +0000 (01:46 +0100)]
target-xtensa: Move TCG initialization to XtensaCPU initfn
Combine this with breakpoint handler registration, guarding both with
tcg_enabled() to suppress also TCG init for qtest. Rename the handler to
xtensa_breakpoint_handler() since it needs to become global.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sun, 20 Jan 2013 00:36:47 +0000 (01:36 +0100)]
target-unicore32: Move TCG initialization to UniCore32CPU initfn
Normalize the "inited" logic and add a tcg_enabled() check to suppress
it for qtest.
Ensures that a QOM-created UniCore32CPU is usable.
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sun, 20 Jan 2013 00:34:18 +0000 (01:34 +0100)]
target-sparc: Move TCG initialization to SPARCCPU initfn
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sun, 20 Jan 2013 00:30:32 +0000 (01:30 +0100)]
target-sh4: Move TCG initialization to SuperHCPU initfn
Add a tcg_enabled() check to suppress it for qtest.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 19 Jan 2013 21:43:32 +0000 (22:43 +0100)]
target-s390x: Move TCG initialization to S390CPU initfn
Ensures that a QOM-created S390CPU is usable.
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sun, 20 Jan 2013 00:26:37 +0000 (01:26 +0100)]
target-ppc: Move TCG initialization to PowerPCCPU initfn
Ensures that a QOM-created PowerPCCPU is usable.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sun, 20 Jan 2013 00:22:25 +0000 (01:22 +0100)]
target-mips: Move TCG initialization to MIPSCPU initfn
Make mips_tcg_init() non-static and add tcg_enabled() check to suppress
it for qtest.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sun, 20 Jan 2013 00:10:52 +0000 (01:10 +0100)]
target-microblaze: Move TCG initialization to MicroBlazeCPU initfn
Split off TCG initialization from cpu_mb_init() into mb_tcg_init() to
call it from the initfn.
Ensures that a QOM-created MicroBlazeCPU is usable.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 19 Jan 2013 23:48:29 +0000 (00:48 +0100)]
target-m68k: Move TCG initialization to M68kCPU initfn
Add a tcg_enabled() check to suppress it for qtest.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 19 Jan 2013 23:05:12 +0000 (00:05 +0100)]
target-lm32: Move TCG initialization to LM32CPU initfn
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 19 Jan 2013 22:55:42 +0000 (23:55 +0100)]
target-cris: Move TCG initialization to CRISCPU initfn
Split out TCG initialization from cpu_cris_init(). Avoid CPUCRISState
dependency for v10-specific initialization and for non-v10 by inlining
the decision into the initfn as well.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 19 Jan 2013 06:37:45 +0000 (07:37 +0100)]
target-arm: Move TCG initialization to ARMCPU initfn
Ensures that a QOM-created ARMCPU is usable.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Wed, 16 Jan 2013 03:19:35 +0000 (04:19 +0100)]
target-xtensa: Introduce QOM realizefn for XtensaCPU
Introduce realizefn and set realized = true in cpu_xtensa_init().
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 5 Jan 2013 13:38:30 +0000 (14:38 +0100)]
target-unicore32: Introduce QOM realizefn for UniCore32CPU
Introduce a realizefn and set realized = true in uc32_cpu_init().
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
[AF: Invoke the parent's realizefn]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Wed, 16 Jan 2013 03:13:19 +0000 (04:13 +0100)]
target-sparc: Introduce QOM realizefn for SPARCCPU
Introduce realizefn and set realized = true in cpu_sparc_init().
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Mon, 23 Apr 2012 16:16:02 +0000 (18:16 +0200)]
target-sh4: Introduce QOM realizefn for SuperHCPU
Introduce a realizefn and set realized = true in cpu_sh4_init().
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Wed, 16 Jan 2013 03:00:41 +0000 (04:00 +0100)]
target-s390x: Introduce QOM realizefn for S390CPU
Introduce realizefn and set realized = true in cpu_s390x_init().
Defer CPU reset from initfn to realizefn.
Acked-by: Richard Henderson <rth@twiddle.net>
[AF: Invoke parent's realizefn]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Wed, 16 Jan 2013 02:48:37 +0000 (03:48 +0100)]
target-mips: Introduce QOM realizefn for MIPSCPU
Introduce a realizefn and set realized = true from cpu_mips_init().
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 5 Jan 2013 14:27:31 +0000 (15:27 +0100)]
target-microblaze: Introduce QOM realizefn for MicroBlazeCPU
Introduce realizefn and set realized = true from cpu_mb_init().
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 5 Jan 2013 14:15:30 +0000 (15:15 +0100)]
target-m68k: Introduce QOM realizefn for M68kCPU
Introduce realizefn and set realized = true in cpu_m68k_init().
Split off GDB registration to a new m68k_cpu_init_gdb() so that it can
be called from the realizefn.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Wed, 16 Jan 2013 02:31:27 +0000 (03:31 +0100)]
target-lm32: Introduce QOM realizefn for LM32CPU
Introduce a realizefn and set realized = true in cpu_lm32_init().
Also move cpu_reset() call from initfn to realizefn.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 5 Jan 2013 14:41:21 +0000 (15:41 +0100)]
target-cris: Introduce QOM realizefn for CRISCPU
Introduce realizefn and set realized = true from cpu_cris_init().
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Wed, 16 Jan 2013 02:55:14 +0000 (03:55 +0100)]
target-ppc: Update PowerPCCPU to QOM realizefn
Adapt ppc_cpu_realize() signature, hook it up to DeviceClass and set
realized = true in cpu_ppc_init().
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 5 Jan 2013 13:11:07 +0000 (14:11 +0100)]
target-openrisc: Update OpenRISCCPU to QOM realizefn
Update the openrisc_cpu_realize() signature, hook it up to
DeviceClass::realize and set realized = true in cpu_openrisc_init().
qapi/error.h is now included through qdev and no longer needed.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Jia Liu <proljc@gmail.com>
Andreas Färber [Wed, 16 Jan 2013 02:41:47 +0000 (03:41 +0100)]
target-i386: Update X86CPU to QOM realizefn
Adapt the signature of x86_cpu_realize(), hook up to
DeviceClass::realize and set realized = true in cpu_x86_init().
The QOM realizefn cannot depend on errp being non-NULL as in
cpu_x86_init(), so use a local Error to preserve error handling behavior
on APIC initialization errors.
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
[AF: Invoke parent's realizefn]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 5 Jan 2013 09:18:18 +0000 (10:18 +0100)]
target-arm: Update ARMCPU to QOM realizefn
Turn arm_cpu_realize() into a QOM realize function, no longer called
via cpu.h prototype. To maintain the semantics of cpu_init(), set
realized = true explicitly in cpu_arm_init().
Move GDB coprocessor registration, CPU reset and vCPU initialization
into the realizefn.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 5 Jan 2013 13:01:30 +0000 (14:01 +0100)]
target-alpha: Update AlphaCPU to QOM realizefn
Update the alpha_cpu_realize() signature and hook up to
DeviceClass::realize. Set realized = true in cpu_alpha_init().
qapi/error.h is included through qdev now and no longer needed.
Acked-by: Richard Henderson <rth@twiddle.net>
[AF: Invoke parent's realizefn]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Andreas Färber [Sat, 19 Jan 2013 05:17:06 +0000 (06:17 +0100)]
cpu: Prepare QOM realizefn
Overwrite the default implementation with a no-op, no longer
attempting to call DeviceClass::init.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Richard Henderson [Thu, 14 Feb 2013 01:47:43 +0000 (17:47 -0800)]
bitops: Remove routines redundant with host-utils
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Thu, 14 Feb 2013 01:47:42 +0000 (17:47 -0800)]
bitops: Replace bitops_ctol with ctzl
The is the only remaining user.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Thu, 14 Feb 2013 01:47:41 +0000 (17:47 -0800)]
bitops: Inline bitops_flsl
This is the only remaining user.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Thu, 14 Feb 2013 01:47:40 +0000 (17:47 -0800)]
target-i386: Inline bitops_flsl
Use clz32 directly. Which makes slightly more sense given
that the input is type "int" and not type "long".
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Thu, 14 Feb 2013 01:47:39 +0000 (17:47 -0800)]
bitops: Write bitops_flsl in terms of clzl
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Thu, 14 Feb 2013 01:47:38 +0000 (17:47 -0800)]
memory: Use non-bitops ctzl
A memory size of zero is invalid, and so that edge condition
does not occur.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Richard Henderson [Thu, 14 Feb 2013 01:47:37 +0000 (17:47 -0800)]
bitops: Use non-bitops ctzl
The use of ctz has already eliminated zero, and thus the difference
in edge conditions between the two routines is irrelevant.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>