sdk/emulator/qemu.git
13 years agoversatile_pci: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:32 +0000 (17:17 +0300)]
versatile_pci: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoarm11mpcore: use sysbus_init_mmio_cb2
Avi Kivity [Mon, 15 Aug 2011 14:17:31 +0000 (17:17 +0300)]
arm11mpcore: use sysbus_init_mmio_cb2

This tells the sysbus code it need not use IO_MEM_UNASSIGNED.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agosh_pci: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:30 +0000 (17:17 +0300)]
sh_pci: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agosysbus: add a variant of sysbus_init_mmio_cb with an unmap callback
Avi Kivity [Mon, 15 Aug 2011 14:17:29 +0000 (17:17 +0300)]
sysbus: add a variant of sysbus_init_mmio_cb with an unmap callback

sysbus_init_mmio_cb() uses the destructive IO_MEM_UNASSIGNED to remove a
region.  Provide an alternative that calls an unmap callback, so the removal
may be done non-destructively.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoppc4xx_sdram: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:27 +0000 (17:17 +0300)]
ppc4xx_sdram: convert to memory API

Clumsy due to the lack of clipping support, needed for
changing exposed ram size.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoppc405_uc: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:26 +0000 (17:17 +0300)]
ppc405_uc: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopcie_host: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:25 +0000 (17:17 +0300)]
pcie_host: convert to memory API

Assuming that mmcfg size cannot change at runtime.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoonenand: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:24 +0000 (17:17 +0300)]
onenand: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoomap_gpmc/nseries/tusb6010: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:23 +0000 (17:17 +0300)]
omap_gpmc/nseries/tusb6010: convert to memory API

Somewhat clumsy since it needs a variable sized region.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agotusb6010: move declarations to new file tusb6010.h
Avi Kivity [Mon, 15 Aug 2011 14:17:22 +0000 (17:17 +0300)]
tusb6010: move declarations to new file tusb6010.h

Avoid #include hell.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agogt64xxx.c: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:21 +0000 (17:17 +0300)]
gt64xxx.c: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoarmv7m: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:20 +0000 (17:17 +0300)]
armv7m: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoarm_timer: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:19 +0000 (17:17 +0300)]
arm_timer: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoarm_sysctl: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:18 +0000 (17:17 +0300)]
arm_sysctl: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoarm_gic: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:17 +0000 (17:17 +0300)]
arm_gic: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoapic: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:16 +0000 (17:17 +0300)]
apic: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoapb_pci: convert to memory API
Avi Kivity [Mon, 15 Aug 2011 14:17:15 +0000 (17:17 +0300)]
apb_pci: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopcnet: fix wrong opaque (broken by bd8d6f7cadb6ace98c779135217a4ed7b5fccc23)
Hervé Poussineau [Sat, 20 Aug 2011 14:29:50 +0000 (16:29 +0200)]
pcnet: fix wrong opaque (broken by bd8d6f7cadb6ace98c779135217a4ed7b5fccc23)

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoImprovements to libtool support.
Brad [Sun, 14 Aug 2011 00:30:14 +0000 (20:30 -0400)]
Improvements to libtool support.

Improvements to the libtool support in QEMU. Replace hard coded
libtool in the infrastructure with $(LIBTOOL) and allow
overriding the libtool binary used via the configure
script.

Reviewed-by: Andreas F=E4rber <andreas.faerber@web.de>
Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agow32: Fix qemu_ftruncate64
Stefan Weil [Sat, 20 Aug 2011 10:10:05 +0000 (12:10 +0200)]
w32: Fix qemu_ftruncate64

SetFilePointer returns INVALID_SET_FILE_POINTER when it fails.
In addition, GetLastError must be checked.

The first call of SetFilePointer did not use INVALID_SET_FILE_POINTER,
the second call used wrong error handling.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agobuild: list libraries after objects, for proper linkage
Diego Elio Pettenò [Sun, 14 Aug 2011 13:31:24 +0000 (15:31 +0200)]
build: list libraries after objects, for proper linkage

Without this change, when using -Wl,--as-needed with GNU linker, the
libraries would be discarded.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agofix code format
Robert Wang [Fri, 19 Aug 2011 09:17:12 +0000 (17:17 +0800)]
fix code format

Fix code format to make checkpatch.pl happy.

Signed-off-by: Robert Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoe1000: use MII status register for link up/down
Bjørn Mork [Wed, 17 Aug 2011 09:03:14 +0000 (11:03 +0200)]
e1000: use MII status register for link up/down

Some guests will use the standard MII status register
to verify link state.  They will not notice link changes
unless this register is updated.

Verified with Linux 3.0 and Windows XP guests.

Without this patch, ethtool will report speed and duplex as
unknown when the link is down, but still report the link as
up.  This is because the Linux e1000 driver checks the
mac_reg[STATUS] register link state before it checks speed
and duplex, but uses the phy_reg[PHY_STATUS] register for
the actual link state check.  Fix by updating both registers
on link state changes.

Linux guest before:

 (qemu) set_link e1000.0 off

 kvm-sid:~# ethtool eth0
 Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: umbg
        Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes

 (qemu) set_link e1000.0 on

Linux guest after:

 (qemu) set_link e1000.0 off
 [   63.384221] e1000: eth0 NIC Link is Down

 kvm-sid:~# ethtool eth0
 Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: umbg
        Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: no

 (qemu) set_link e1000.0 on
 [   84.304582] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: document the functions that will be the public interface
Anthony Liguori [Mon, 15 Aug 2011 16:17:41 +0000 (11:17 -0500)]
char: document the functions that will be the public interface

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: remove qemu_chr_send_event()
Anthony Liguori [Mon, 15 Aug 2011 16:17:40 +0000 (11:17 -0500)]
char: remove qemu_chr_send_event()

It's dead code.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: rename qemu_chr_get_msgfd() -> qemu_chr_fe_get_msgfd()
Anthony Liguori [Mon, 15 Aug 2011 16:17:39 +0000 (11:17 -0500)]
char: rename qemu_chr_get_msgfd() -> qemu_chr_fe_get_msgfd()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: rename qemu_chr_close() -> qemu_chr_delete()
Anthony Liguori [Mon, 15 Aug 2011 16:17:38 +0000 (11:17 -0500)]
char: rename qemu_chr_close() -> qemu_chr_delete()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: qemu_chr_open_opts() -> qemu_chr_new_from_opts()
Anthony Liguori [Mon, 15 Aug 2011 16:17:37 +0000 (11:17 -0500)]
char: qemu_chr_open_opts() -> qemu_chr_new_from_opts()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: rename qemu_chr_open() -> qemu_chr_new()
Anthony Liguori [Mon, 15 Aug 2011 16:17:36 +0000 (11:17 -0500)]
char: rename qemu_chr_open() -> qemu_chr_new()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: rename qemu_chr_set_echo() -> qemu_chr_fe_set_echo()
Anthony Liguori [Mon, 15 Aug 2011 16:17:35 +0000 (11:17 -0500)]
char: rename qemu_chr_set_echo() -> qemu_chr_fe_set_echo()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: qemu_chr_ioctl() -> qemu_chr_fe_ioctl()
Anthony Liguori [Mon, 15 Aug 2011 16:17:34 +0000 (11:17 -0500)]
char: qemu_chr_ioctl() -> qemu_chr_fe_ioctl()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: rename qemu_chr_guest_close() -> qemu_chr_fe_close()
Anthony Liguori [Mon, 15 Aug 2011 16:17:33 +0000 (11:17 -0500)]
char: rename qemu_chr_guest_close() -> qemu_chr_fe_close()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: rename qemu_chr_guest_open() -> qemu_chr_fe_open()
Anthony Liguori [Mon, 15 Aug 2011 16:17:32 +0000 (11:17 -0500)]
char: rename qemu_chr_guest_open() -> qemu_chr_fe_open()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: rename qemu_chr_can_read() -> qemu_chr_be_can_read()
Anthony Liguori [Mon, 15 Aug 2011 16:17:31 +0000 (11:17 -0500)]
char: rename qemu_chr_can_read() -> qemu_chr_be_can_read()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: rename qemu_chr_read() -> qemu_chr_be_write()
Anthony Liguori [Mon, 15 Aug 2011 16:17:30 +0000 (11:17 -0500)]
char: rename qemu_chr_read() -> qemu_chr_be_write()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: rename qemu_chr_printf() -> qemu_chr_fe_printf()
Anthony Liguori [Mon, 15 Aug 2011 16:17:29 +0000 (11:17 -0500)]
char: rename qemu_chr_printf() -> qemu_chr_fe_printf()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agochar: rename qemu_chr_write() -> qemu_chr_fe_write()
Anthony Liguori [Mon, 15 Aug 2011 16:17:28 +0000 (11:17 -0500)]
char: rename qemu_chr_write() -> qemu_chr_fe_write()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agotcg/ppc64: fix 16/32 mixup
malc [Mon, 22 Aug 2011 14:26:15 +0000 (18:26 +0400)]
tcg/ppc64: fix 16/32 mixup

Signed-off-by: malc <av1474@comtv.ru>
13 years agoMerge branch 'master' of git://git.qemu.org/qemu
malc [Mon, 22 Aug 2011 10:41:12 +0000 (14:41 +0400)]
Merge branch 'master' of git://git.qemu.org/qemu

13 years agotcg/ppc64: implement not_i32/64 and ext32u_i64
malc [Mon, 22 Aug 2011 10:40:00 +0000 (14:40 +0400)]
tcg/ppc64: implement not_i32/64 and ext32u_i64

Signed-off-by: malc <av1474@comtv.ru>
13 years agotcg/ppc32: implement deposit_i32
malc [Mon, 22 Aug 2011 10:39:00 +0000 (14:39 +0400)]
tcg/ppc32: implement deposit_i32

Signed-off-by: malc <av1474@comtv.ru>
13 years agoMerge remote-tracking branch 'pmaydell/armhw-for-upstream' into staging
Anthony Liguori [Sun, 21 Aug 2011 23:34:33 +0000 (18:34 -0500)]
Merge remote-tracking branch 'pmaydell/armhw-for-upstream' into staging

13 years agoguest agent: remove uneeded dependencies
Michael Roth [Thu, 11 Aug 2011 20:38:12 +0000 (15:38 -0500)]
guest agent: remove uneeded dependencies

This patch tries to cull any uneeded library dependencies from the guest
agent to improve portability across various distros. We do so by being
as explicit as possible about in-tree dependencies rather than relying
on existing *-obj-y targets, and by manually setting LIBS for the
qemu-ga target to avoid pulling in LIBS_TOOLS libraries discovered by
configure.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoguest agent: remove g_strcmp0 usage
Michael Roth [Thu, 11 Aug 2011 20:38:11 +0000 (15:38 -0500)]
guest agent: remove g_strcmp0 usage

g_strcmp0 isn't in all version of glib 2.0, so don't use it to avoid
build breakage on older distros.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomemory: crack wide ioport accesses into smaller ones when needed
Avi Kivity [Thu, 11 Aug 2011 07:40:26 +0000 (10:40 +0300)]
memory: crack wide ioport accesses into smaller ones when needed

The memory API supports cracking wide accesses into narrower ones
when needed; but this was no implemented for the pio address space,
causing lsi53c895a's IO BAR to malfunction.

Fix by correctly cracking wide accesses when needed.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomemory: abstract cracking of write access ops into a function
Avi Kivity [Thu, 11 Aug 2011 07:40:25 +0000 (10:40 +0300)]
memory: abstract cracking of write access ops into a function

The memory API automatically cracks large reads and writes into smaller
ones when needed.  Factor out this mechanism, which is now duplicated between
memory reads and memory writes, into a function.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoescc: replace DPRINTFs with tracepoints
Blue Swirl [Sun, 7 Aug 2011 11:01:05 +0000 (11:01 +0000)]
escc: replace DPRINTFs with tracepoints

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agom48t59: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 20:02:02 +0000 (20:02 +0000)]
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;                /*    40    56 */
/* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */
struct QEMUTimer *         alrm_timer;           /*    96     8 */
struct QEMUTimer *         wd_timer;             /*   104     8 */
uint8_t                    lock;                 /*   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 <blauwirbel@gmail.com>
13 years agoescc: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 19:55:23 +0000 (19:55 +0000)]
escc: avoid structure holes spotted by pahole

Edited report from pahole on amd64 host:
struct ChannelState {
...
ChnType                    type;                 /*    32     4 */

/* XXX 4 bytes hole, try to pack */
...
uint8_t                    rregs[16];            /*    66    16 */

/* 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 <blauwirbel@gmail.com>
13 years agofdc: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 19:43:38 +0000 (19:43 +0000)]
fdc: avoid structure holes spotted by pahole

Edited report from pahole on amd64 host:
struct FDCtrl {
uint8_t                    version;              /*     0     1 */

/* XXX 7 bytes hole, try to pack */

qemu_irq                   irq;                  /*     8     8 */
int                        dma_chann;            /*    16     4 */

/* XXX 4 bytes hole, try to pack */
...
uint8_t                    status2;              /*    42     1 */

/* XXX 5 bytes hole, try to pack */

uint8_t *                  fifo;                 /*    48     8 */
...
uint8_t                    pwrd;                 /*    76     1 */

/* XXX 3 bytes hole, try to pack */

int                        sun4m;                /*    80     4 */
uint8_t                    num_floppies;         /*    84     1 */

/* XXX 3 bytes hole, try to pack */

FDrive                     drives[2];            /*    88    64 */
/* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */
int                        reset_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 <blauwirbel@gmail.com>
13 years agopcnet: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 19:38:49 +0000 (19:38 +0000)]
pcnet: avoid structure holes spotted by pahole

Edited report from pahole on amd64 host:
struct PCNetState_st {
...
uint16_t                   bcr[32];              /*   340    64 */

/* XXX 4 bytes hole, try to pack */
...
int                        tx_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 */
int                        looptest;             /*  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 <blauwirbel@gmail.com>
13 years agoesp: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 19:33:30 +0000 (19:33 +0000)]
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_t                    rregs[16];            /*  5664    16 */
uint8_t                    wregs[16];            /*  5680    16 */
/* --- cacheline 89 boundary (5696 bytes) --- */
int32_t                    ti_size;              /*  5696     4 */
uint32_t                   ti_rptr;              /*  5700     4 */
uint32_t                   ti_wptr;              /*  5704     4 */
uint8_t                    ti_buf[16];           /*  5708    16 */
uint32_t                   status;               /*  5724     4 */
uint32_t                   dma;                  /*  5728     4 */

/* XXX 4 bytes hole, try to pack */

SCSIBus                    bus;                  /*  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_t                    cmdbuf[16];           /*  7872    16 */
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 */
int                        dma_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 <blauwirbel@gmail.com>
13 years agosun4m: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 19:22:46 +0000 (19:22 +0000)]
sun4m: avoid structure holes spotted by pahole

Edited report from pahole on amd64 host:
struct sun4c_hwdef {
...
uint8_t                    nvram_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_t                    nvram_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_t                    nvram_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 <blauwirbel@gmail.com>
13 years agotcx: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 19:13:24 +0000 (19:13 +0000)]
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_t                    r[256];               /*  5722   256 */
/* --- cacheline 93 boundary (5952 bytes) was 26 bytes ago --- */
uint8_t                    g[256];               /*  5978   256 */
/* --- cacheline 97 boundary (6208 bytes) was 26 bytes ago --- */
uint8_t                    b[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_t                    dac_index;            /*  7516     1 */
uint8_t                    dac_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 <blauwirbel@gmail.com>
13 years agosun4m_iommu: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 19:09:50 +0000 (19:09 +0000)]
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 <blauwirbel@gmail.com>
13 years agoslavio_intctl: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 19:06:26 +0000 (19:06 +0000)]
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>
13 years agoslavio_misc: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 19:03:18 +0000 (19:03 +0000)]
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>
13 years agoslavio_timer: avoid structure holes spotted by pahole
Blue Swirl [Sun, 7 Aug 2011 19:00:23 +0000 (19:00 +0000)]
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>
13 years agomonitor: Prevent sign-extension of 32-bit addresses printed by info tlb
Austin Clements [Sun, 21 Aug 2011 18:49:45 +0000 (14:49 -0400)]
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:

ffffffffffffc000000000000fffc000 --------W
ffffffffffffd000000000000fffd000 --------W
ffffffffffffe000000000000fffe000 --------W
fffffffffffff000000000000ffff000 --------W

With this change, it looks like

00000000ffffc000000000000fffc000 --------W
00000000ffffd000000000000fffd000 --------W
00000000ffffe000000000000fffe000 --------W
00000000fffff000000000000ffff000 --------W

Signed-off-by: Austin Clements <amdragon@mit.edu>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge branch 'queues/slirp' of git://git.kiszka.org/qemu
Blue Swirl [Sun, 21 Aug 2011 19:19:29 +0000 (19:19 +0000)]
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

13 years agotcg-ia64: Fix typos in AREG0 setup in prologue.
Richard Henderson [Wed, 17 Aug 2011 21:11:49 +0000 (14:11 -0700)]
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>
13 years agotcg-hppa: Fix CPU_TEMP_BUF_NLONGS oversight.
Richard Henderson [Wed, 17 Aug 2011 21:11:48 +0000 (14:11 -0700)]
tcg-hppa: Fix CPU_TEMP_BUF_NLONGS oversight.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg: Constant fold neg, andc, orc, eqv, nand, nor.
Richard Henderson [Wed, 17 Aug 2011 21:11:47 +0000 (14:11 -0700)]
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>
13 years agotcg: Always define all of the TCGOpcode enum members.
Richard Henderson [Wed, 17 Aug 2011 21:11:46 +0000 (14:11 -0700)]
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>
13 years agotcg: Add and use TCG_OPF_64BIT.
Richard Henderson [Wed, 17 Aug 2011 21:11:45 +0000 (14:11 -0700)]
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>
13 years agoCheck for presence of compiler -pthread flag.
Brad [Mon, 8 Aug 2011 00:02:11 +0000 (20:02 -0400)]
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>
13 years agoConvert last qemu_free and qemu_malloc uses
Blue Swirl [Sun, 21 Aug 2011 18:42:08 +0000 (18:42 +0000)]
Convert last qemu_free and qemu_malloc uses

7267c0947d7e8ae5dff7bafd932c3bc285f43e5c missed
a few cases, fix them.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomonitor: Show combined protection bits in "info mem"
Austin Clements [Mon, 15 Aug 2011 03:22:28 +0000 (23:22 -0400)]
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>
13 years agomonitor: Fix "info mem" to print the last memory range
Austin Clements [Mon, 15 Aug 2011 03:22:04 +0000 (23:22 -0400)]
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>
13 years agomonitor: Prevent sign-extension of 32-bit addresses printed by info mem
Austin Clements [Mon, 15 Aug 2011 03:19:21 +0000 (23:19 -0400)]
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>
13 years agow32: Fix format string regression
Stefan Weil [Fri, 15 Jul 2011 19:38:14 +0000 (21:38 +0200)]
w32: Fix format string regression

Commit 953ffe0f935f40c0d6061d69e76e0339393b54f8
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>
13 years agow64: Add definition of FMT_pid
Stefan Weil [Fri, 15 Jul 2011 19:38:13 +0000 (21:38 +0200)]
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>
13 years agoFix conversions from pointer to tcg_target_long
Stefan Weil [Fri, 15 Jul 2011 19:38:12 +0000 (21:38 +0200)]
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 4b4a72e55660abf7efe85aca78762dcfea5519ad 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>
13 years agoRemove remenants of qemu_malloc
Anthony Liguori [Sun, 21 Aug 2011 13:36:21 +0000 (08:36 -0500)]
Remove remenants of qemu_malloc

This covers the various check commands

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoUpdate HACKING to refer to g_malloc instead of qemu_malloc
Anthony Liguori [Sun, 21 Aug 2011 13:16:56 +0000 (08:16 -0500)]
Update HACKING to refer to g_malloc instead of qemu_malloc

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoAdd trace points for g_malloc/g_free functions
Anthony Liguori [Sun, 21 Aug 2011 03:38:31 +0000 (22:38 -0500)]
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>
13 years agoRemove qemu_malloc/qemu_free
Anthony Liguori [Sun, 21 Aug 2011 03:23:03 +0000 (22:23 -0500)]
Remove qemu_malloc/qemu_free

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoUse glib memory allocation and free functions
Anthony Liguori [Sun, 21 Aug 2011 03:09:37 +0000 (22:09 -0500)]
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>
13 years agoMake glib mandatory and fixup utils appropriately
Anthony Liguori [Sun, 21 Aug 2011 03:18:37 +0000 (22:18 -0500)]
Make glib mandatory and fixup utils appropriately

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoReorder default ram_size initialization
Jan Kiszka [Mon, 15 Aug 2011 23:18:57 +0000 (16:18 -0700)]
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>
13 years agoscsi-disk: fix DPRINTF
Blue Swirl [Sat, 20 Aug 2011 09:21:42 +0000 (09:21 +0000)]
scsi-disk: fix DPRINTF

The variable 'status' does not exist anymore, adjust DPRINTF
accordingly.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-cris/opcode-cris.h: rename REG_PC/SP to CRIS_REG_PC/SP
Peter Maydell [Fri, 19 Aug 2011 23:27:04 +0000 (00:27 +0100)]
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>
13 years agohw/stellaris: Add support for RCC2 register
Engin AYDOGAN [Wed, 3 Aug 2011 21:15:23 +0000 (22:15 +0100)]
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>
13 years agohw/pl061.c: Support GPIOAMSEL register
Peter Maydell [Wed, 3 Aug 2011 22:04:49 +0000 (23:04 +0100)]
hw/pl061.c: Support GPIOAMSEL register

Support the GPIOAMSEL register found on some Stellaris boards.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13 years agohw/pl061: Convert to VMState
Peter Maydell [Wed, 3 Aug 2011 22:13:45 +0000 (23:13 +0100)]
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>
13 years agovexpress, realview: Use pl111, not pl110
Peter Maydell [Fri, 22 Jul 2011 15:36:54 +0000 (15:36 +0000)]
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>
13 years agoversatilepb: Implement SYS_CLCD mux control register bits
Peter Maydell [Fri, 22 Jul 2011 13:42:39 +0000 (13:42 +0000)]
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>
13 years agohw/pl110: Model the PL111 CLCD controller
Peter Maydell [Fri, 22 Jul 2011 13:19:33 +0000 (13:19 +0000)]
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>
13 years agoscsi: do not overwrite memory on REQUEST SENSE commands with a large buffer
Paolo Bonzini [Sun, 14 Aug 2011 21:05:49 +0000 (14:05 -0700)]
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>
13 years agoslirp: Fix bit field types in IP header structs
Jan Kiszka [Sat, 6 Aug 2011 12:23:29 +0000 (14:23 +0200)]
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>
13 years agohw/scsi-bus.c: Fix use of uninitialised variable
Peter Maydell [Fri, 12 Aug 2011 16:49:36 +0000 (17:49 +0100)]
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>
13 years agoqapi: fix build issue due to missing newline in generated header
Michael Roth [Wed, 10 Aug 2011 18:10:51 +0000 (13:10 -0500)]
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>
13 years agomemory: correct documentation typos
Avi Kivity [Mon, 8 Aug 2011 16:58:50 +0000 (19:58 +0300)]
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>
13 years agomemory: add API for creating ROM/device regions
Avi Kivity [Mon, 8 Aug 2011 16:58:49 +0000 (19:58 +0300)]
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>
13 years agomemory: reclaim resources when a memory region is destroyed for good
Avi Kivity [Mon, 8 Aug 2011 16:58:48 +0000 (19:58 +0300)]
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>
13 years agobuild: Move QEMU_INCLUDES before QEMU_CFLAGS
Jiri Denemark [Wed, 10 Aug 2011 10:04:34 +0000 (12:04 +0200)]
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>
13 years agoconfigure: Disable guest_agent for mingw32
Stefan Weil [Sat, 6 Aug 2011 20:47:22 +0000 (22:47 +0200)]
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>
13 years agoscsi: add special traces for common commands
Paolo Bonzini [Wed, 3 Aug 2011 08:49:19 +0000 (10:49 +0200)]
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>
13 years agoscsi: report unit attention on reset
Paolo Bonzini [Wed, 3 Aug 2011 08:49:18 +0000 (10:49 +0200)]
scsi: report unit attention on reset

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoscsi: add support for unit attention conditions
Paolo Bonzini [Wed, 3 Aug 2011 08:49:17 +0000 (10:49 +0200)]
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>