Commit Graph

15909 Commits

Author SHA1 Message Date
Blue Swirl 07dd0035d8 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 <blauwirbel@gmail.com>
2011-08-21 19:52:31 +00:00
Blue Swirl 97bbb109b1 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_t                    config;               /*  5660     1 */
	uint8_t                    aux1;                 /*  5661     1 */
	uint8_t                    aux2;                 /*  5662     1 */
	uint8_t                    diag;                 /*  5663     1 */
	uint8_t                    mctrl;                /*  5664     1 */
	uint8_t                    sysctrl;              /*  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 <blauwirbel@gmail.com>
2011-08-21 19:52:29 +00:00
Blue Swirl f90074f493 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 <blauwirbel@gmail.com>
2011-08-21 19:52:27 +00:00
Austin Clements 94ac5cd20c monitor: Prevent sign-extension of 32-bit addresses printed by info tlb
This is the same fix that was recently applied to info mem.  Before
this change, info tlb output looked like:

ffffffffffffc000: 000000000fffc000 --------W
ffffffffffffd000: 000000000fffd000 --------W
ffffffffffffe000: 000000000fffe000 --------W
fffffffffffff000: 000000000ffff000 --------W

With this change, it looks like

00000000ffffc000: 000000000fffc000 --------W
00000000ffffd000: 000000000fffd000 --------W
00000000ffffe000: 000000000fffe000 --------W
00000000fffff000: 000000000ffff000 --------W

Signed-off-by: Austin Clements <amdragon@mit.edu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 19:50:03 +00:00
Blue Swirl aec7c6dc68 Merge branch 'queues/slirp' of git://git.kiszka.org/qemu
* 'queues/slirp' of git://git.kiszka.org/qemu:
  slirp: Fix bit field types in IP header structs
2011-08-21 19:19:29 +00:00
Richard Henderson 64ba39af27 tcg-ia64: Fix typos in AREG0 setup in prologue.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 18:52:26 +00:00
Richard Henderson 6e6a99249c tcg-hppa: Fix CPU_TEMP_BUF_NLONGS oversight.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 18:52:25 +00:00
Richard Henderson cb25c80a9b tcg: Constant fold neg, andc, orc, eqv, nand, nor.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 18:52:25 +00:00
Richard Henderson 25c4d9cc84 tcg: Always define all of the TCGOpcode enum members.
By always defining these symbols, we can eliminate a lot of ifdefs.

To allow this to be checked reliably, the semantics of the
TCG_TARGET_HAS_* macros must be changed from def/undef to true/false.
This allows even more ifdefs to be removed, converting them into
C if statements.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 18:52:24 +00:00
Richard Henderson 8399ad59e7 tcg: Add and use TCG_OPF_64BIT.
This allows the simplification of the op_bits function from
tcg/optimize.c.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 18:52:22 +00:00
Brad 4b29ec41c8 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 <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 18:46:34 +00:00
Blue Swirl 58a06675d3 Convert last qemu_free and qemu_malloc uses
7267c0947d missed
a few cases, fix them.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 18:42:08 +00:00
Austin Clements c76c8416be monitor: Show combined protection bits in "info mem"
Previously, "info mem" considered and displayed only the last-level
protection bits for a memory range, which doesn't accurrately
represent the protection of that range.  Now it shows the combined
protection.

Signed-off-by: Austin Clements <amdragon@mit.edu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 16:42:39 +00:00
Austin Clements 8a94b8ca53 monitor: Fix "info mem" to print the last memory range
"info mem" groups its output into contiguous ranges with identical
protection bits, but previously forgot to print the last range.

Signed-off-by: Austin Clements <amdragon@mit.edu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 16:42:36 +00:00
Austin Clements b49ca72dd7 monitor: Prevent sign-extension of 32-bit addresses printed by info mem
Previously, on 32-bit i386, info mem used signed 32-bit int's to store
the page table indexes.  As a result, address calculation was done in
32 bits and then incorrectly sign-extended to 64 bits, yielding output
like

ffffffffef000000-ffffffffef031000 0000000000031000 ur-
ffffffffef7bc000-ffffffffef7bd000 0000000000001000 urw
ffffffffef7bd000-ffffffffef7be000 0000000000001000 ur-

This makes these indexes unsigned, which yields correct output

00000000ef000000-00000000ef031000 0000000000031000 ur-
00000000ef7bc000-00000000ef7bd000 0000000000001000 urw
00000000ef7bd000-00000000ef7be000 0000000000001000 ur-

Signed-off-by: Austin Clements <amdragon@mit.edu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 16:42:31 +00:00
Stefan Weil 59ad3403c2 w32: Fix format string regression
Commit 953ffe0f93
introduced FMT_pid which is wrong for w32 and w64 getpid():
those getpid() implementations always return an int value.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 15:33:33 +00:00
Stefan Weil 0e0167bacc w64: Add definition of FMT_pid
For mingw-w64, pid_t is _pid_t which is __int64,
so this platform needs its own definition of FMT_pid.

Reviewed-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 15:33:22 +00:00
Stefan Weil 3feaca9e88 Fix conversions from pointer to tcg_target_long
tcg_gen_exit_tb takes a parameter of type tcg_target_long,
so the type casts of pointer to long should be replaced by
type casts of pointer to tcg_target_long.

These changes are needed for build environments where
sizeof(long) != sizeof(void *), especially for w64.

See 4b4a72e556 which fixed the
same issue for the other targets.

Cc: Alexander Graf <agraf@suse.de>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Acked-by: Guan Xuetao<gxt@mprc.pku.edu.cn>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-21 15:32:21 +00:00
Anthony Liguori 92f562ec56 Remove remenants of qemu_malloc
This covers the various check commands

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-21 08:37:10 -05:00
Anthony Liguori 145e21dbd0 Update HACKING to refer to g_malloc instead of qemu_malloc
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-21 08:16:56 -05:00
Anthony Liguori 0750112af4 Add trace points for g_malloc/g_free functions
Derived from a patch submitted by Avi Kivity.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20 23:01:09 -05:00
Anthony Liguori 41a748265f Remove qemu_malloc/qemu_free
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20 23:01:08 -05:00
Anthony Liguori 7267c0947d Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20 23:01:08 -05:00
Anthony Liguori 14015304b6 Make glib mandatory and fixup utils appropriately
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20 23:01:03 -05:00
Jan Kiszka 0ac543de94 Reorder default ram_size initialization
code_gen_alloc depends on it, and that is now called earlier via
configure_accelerator.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-08-21 00:50:23 +02:00
Blue Swirl 02fa69b6e8 scsi-disk: fix DPRINTF
The variable 'status' does not exist anymore, adjust DPRINTF
accordingly.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-20 09:22:52 +00:00
Peter Maydell 871708bf39 target-cris/opcode-cris.h: rename REG_PC/SP to CRIS_REG_PC/SP
The REG_PC constant used in opcode-cris.h can clash with a
similar define in system include files. In particular the
Ubuntu Lucid SPARC signal.h will define REG_PC, and since
qemu-common.h now includes signal.h this was causing compile
failures. Rename the constants to avoid this issue.
(NB that REG_SP is not actually used within QEMU.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-08-20 01:41:01 +02:00
Engin AYDOGAN dc804ab776 hw/stellaris: Add support for RCC2 register
Add support for the RCC2 register on Fury class devices.
Based on a patch by Vijay Kumar.

Signed-off-by: Engin AYDOGAN <engin@bzzzt.biz>
[Peter Maydell: fixed comment typos, minor cleanup of unreachable code]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-17 23:02:15 +00:00
Peter Maydell b3aaff11ec hw/pl061.c: Support GPIOAMSEL register
Support the GPIOAMSEL register found on some Stellaris boards.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-17 23:01:47 +00:00
Peter Maydell a35faa94c8 hw/pl061: Convert to VMState
Convert the PL061 to VMState. We choose to widen the struct members
to uint32_t rather than the other two options of breaking migration
compatibility or using vmstate hacks to read/write a 32 bit value
into an 8 bit struct field.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-17 23:01:41 +00:00
Peter Maydell acb9b72240 vexpress, realview: Use pl111, not pl110
The Versatile Express, Realview EB, PBX A9 and PB A8 boards all
use a PL111 for their graphics, not a PL110. Now we model the
PL111, use it on these board models.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-17 23:01:27 +00:00
Peter Maydell 242ea2c6bc versatilepb: Implement SYS_CLCD mux control register bits
On the Versatile PB, PL110 graphics adaptor only natively supports
5551 pixel format; an external mux swaps bits around to allow
RGB565 and BGR565, under the control of bits [1:0] in the SYS_CLCD
system register.

Implement these SYS_CLCD register bits, and use a gpio line to
feed them out of the system register model, across the versatilepb
board and into the pl110 so we can select the right format.

This is necessary as recent Linux versatile kernels default to
programming the CLCD and mux for 16 bit BGR rather than 16 bit RGB.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-17 23:01:21 +00:00
Peter Maydell 4fbf55568b hw/pl110: Model the PL111 CLCD controller
Model the PL111 CLCD controller. This is a minor variation
on the PL110; the major programmer visible differences are
support for hardware cursor (unimplemented) and two new
pixel formats.

Since syborg_fb.c borrows the pl11x pixel drawing routines,
we also update it to cope with the new slightly larger array
of function pointers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-08-17 23:01:11 +00:00
Paolo Bonzini 8b2a04eeb9 scsi: do not overwrite memory on REQUEST SENSE commands with a large buffer
Other scsi_target_reqops commands were careful about not using r->cmd.xfer
directly, and instead always cap it to a fixed length.  This was not done
for REQUEST SENSE, and this patch fixes it.

Reported-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-16 19:11:51 +00:00
Jan Kiszka 1b930bfa09 slirp: Fix bit field types in IP header structs
-mms-bitfields prevents that the bitfields in current IP header structs
are packed into a single byte as it is required. Fix this by using
uint8_t as backing type.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2011-08-14 23:34:44 -07:00
Peter Maydell 3b6ffe5030 hw/scsi-bus.c: Fix use of uninitialised variable
Don't use req before it has been initialised in scsi_req_new().
This fixes a compile failure due to gcc complaining about this.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-14 19:34:25 +00:00
Michael Roth 7534ba0130 qapi: fix build issue due to missing newline in generated header
Fixes a build issue on RHEL5, and potentially other distros, where gcc
will generate an error due to us not writing a trailing "\n" when
generating *qmp-commands.h

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:30 -05:00
Avi Kivity 7075ba3097 memory: correct documentation typos
Noted by Drew Jones.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:30 -05:00
Avi Kivity d0a9b5bc0a memory: add API for creating ROM/device regions
ROM/device regions act as mapped RAM for reads, can I/O memory for
writes.  This allow emulation of flash devices.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:30 -05:00
Avi Kivity 545e92e06a memory: reclaim resources when a memory region is destroyed for good
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:29 -05:00
Jiri Denemark 76dc3cf82c build: Move QEMU_INCLUDES before QEMU_CFLAGS
This patch fixes build when any of the include paths from QEMU_CFLAGS
contains a header file with similar name to a header file in qemu
sources. I hit it with error.h included by qapi/qapi-types-core.h. GCC
decided to use /usr/include/alsa/error.h instead of qemu's error.h.

Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:29 -05:00
Stefan Weil 83b2f0a0d8 configure: Disable guest_agent for mingw32
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 <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:29 -05:00
Paolo Bonzini 98254542f9 scsi: add special traces for common commands
Can be useful when debugging the device scan phase.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:28 -05:00
Paolo Bonzini c7b488721d scsi: report unit attention on reset
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:28 -05:00
Paolo Bonzini 6dc06f08b3 scsi: add support for unit attention conditions
Unit attention conditions override any sense data the device already
has.  Their signaling and clearing is handled entirely by the SCSIBus
code, and they are completely transparent to the SCSIDevices.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:28 -05:00
Paolo Bonzini a872a3049a scsi: add a bunch more common sense codes
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:05 -05:00
Paolo Bonzini 739df2150d scsi: move handling of REQUEST SENSE to common code
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:31:05 -05:00
Paolo Bonzini fdaef06917 scsi: move handling of REPORT LUNS and invalid LUNs to common code
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:30:20 -05:00
Paolo Bonzini afa46c468a scsi: move request parsing to common code
Also introduce the first occurrence of "independent" SCSIReqOps,
to handle invalid commands in common code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:29:01 -05:00
Paolo Bonzini 87dcd1b2c2 scsi: push lun field to SCSIDevice
This will let SCSIBus detect requests sent to an invalid LUN, and
handle them itself.  However, there will be still support for only one
LUN per target

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12 08:29:01 -05:00