summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-08-02 16:40:14 +0300
committerAvi Kivity <avi@redhat.com>2010-08-02 16:40:14 +0300
commitb83d4fb84583ce2c7860584750d42183f7fef5c5 (patch)
treeafc686386b73a8f7a911047ac231ce89d79f2502 /hw
parent01ac6428a04576ae6f84f07d82c98da304b9ac77 (diff)
parentad7ee4ad6c3a5388acf94dd532d291ea6d3a5972 (diff)
Merge remote branch 'upstream' into next
* upstream: (43 commits) Initialize a variable in all cases Fix uint8_t comparison with negative value Fix a warning on OpenSolaris Correctly identify multiple cpus in SMP systems Remove unused constant jazz led: Fix debug prints xilinx-s3adsp: Add support for loading u-boot images. xilinx-s3adsp: Fix loading of raw binaries. Remove unused eventfd.h migration: Accept 'cont' only after successful incoming migration mips64el: fulong: PCI_DEVFN() clean up. remove pointless if from vl.c fix variable type in qemu-io.c remove dead code from hw/loader.c savevm: Fix memory leak of compat struct virtio-serial: Check if more max_ports specified than we can handle linux-user: fix build on hosts not using guest base linux-user: Protect against allocation failure in load_symbols. cris: Correct settls1 testcase. cris: Correct ADDO and ADDOQ testcases. ... Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/ide/core.c18
-rw-r--r--hw/jazz_led.c21
-rw-r--r--hw/loader.c5
-rw-r--r--hw/mips_fulong2e.c14
-rw-r--r--hw/petalogix_s3adsp1800_mmu.c13
-rw-r--r--hw/vhost.c1
-rw-r--r--hw/vhost_net.c1
-rw-r--r--hw/virtio-blk.c8
-rw-r--r--hw/virtio-pci.c1
-rw-r--r--hw/virtio-serial-bus.c10
-rw-r--r--hw/virtio.h1
11 files changed, 69 insertions, 24 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index db000831e..631673fc0 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1643,6 +1643,21 @@ static void ide_atapi_cmd(IDEState *s)
ide_atapi_cmd_reply(s, len, max_len);
break;
}
+ case GPCMD_GET_EVENT_STATUS_NOTIFICATION:
+ max_len = ube16_to_cpu(packet + 7);
+
+ if (packet[1] & 0x01) { /* polling */
+ /* We don't support any event class (yet). */
+ cpu_to_ube16(buf, 0x00); /* No event descriptor returned */
+ buf[2] = 0x80; /* No Event Available (NEA) */
+ buf[3] = 0x00; /* Empty supported event classes */
+ ide_atapi_cmd_reply(s, 4, max_len);
+ } else { /* asynchronous mode */
+ /* Only polling is supported, asynchronous mode is not. */
+ ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
+ ASC_INV_FIELD_IN_CMD_PACKET);
+ }
+ break;
default:
ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
ASC_ILLEGAL_OPCODE);
@@ -2764,8 +2779,7 @@ static int ide_drive_pio_post_load(void *opaque, int version_id)
{
IDEState *s = opaque;
- if (s->end_transfer_fn_idx < 0 ||
- s->end_transfer_fn_idx > ARRAY_SIZE(transfer_end_table)) {
+ if (s->end_transfer_fn_idx > ARRAY_SIZE(transfer_end_table)) {
return -EINVAL;
}
s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx];
diff --git a/hw/jazz_led.c b/hw/jazz_led.c
index 18780e937..4cb680c3e 100644
--- a/hw/jazz_led.c
+++ b/hw/jazz_led.c
@@ -29,6 +29,15 @@
//#define DEBUG_LED
+#ifdef DEBUG_LED
+#define DPRINTF(fmt, ...) \
+do { printf("jazz led: " fmt , ## __VA_ARGS__); } while (0)
+#else
+#define DPRINTF(fmt, ...) do {} while (0)
+#endif
+#define BADF(fmt, ...) \
+do { fprintf(stderr, "jazz led ERROR: " fmt , ## __VA_ARGS__);} while (0)
+
typedef enum {
REDRAW_NONE = 0, REDRAW_SEGMENTS = 1, REDRAW_BACKGROUND = 2,
} screen_state_t;
@@ -49,12 +58,12 @@ static uint32_t led_readb(void *opaque, target_phys_addr_t addr)
val = s->segments;
break;
default:
-#ifdef DEBUG_LED
- printf("jazz led: invalid read [0x%x]\n", relative_addr);
-#endif
+ BADF("invalid read at [" TARGET_FMT_plx "]\n", addr);
val = 0;
}
+ DPRINTF("read addr=" TARGET_FMT_plx " val=0x%02x\n", addr, val);
+
return val;
}
@@ -92,15 +101,15 @@ static void led_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
{
LedState *s = opaque;
+ DPRINTF("write addr=" TARGET_FMT_plx " val=0x%02x\n", addr, val);
+
switch (addr) {
case 0:
s->segments = val;
s->state |= REDRAW_SEGMENTS;
break;
default:
-#ifdef DEBUG_LED
- printf("jazz led: invalid write of 0x%02x at [0x%x]\n", val, relative_addr);
-#endif
+ BADF("invalid write of 0x%08x at [" TARGET_FMT_plx "]\n", val, addr);
break;
}
}
diff --git a/hw/loader.c b/hw/loader.c
index 79a6f9518..49ac1fa1c 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -733,11 +733,6 @@ int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size)
s = rom->data;
l = rom->romsize;
- if (rom->addr < addr) {
- d = dest;
- s += (addr - rom->addr);
- l -= (addr - rom->addr);
- }
if ((d + l) > (dest + size)) {
l = dest - d;
}
diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c
index a9bbff64b..c6c13ca99 100644
--- a/hw/mips_fulong2e.c
+++ b/hw/mips_fulong2e.c
@@ -219,8 +219,8 @@ uint8_t eeprom_spd[0x80] = {
#ifdef HAS_AUDIO
static void audio_init (PCIBus *pci_bus)
{
- vt82c686b_ac97_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 5);
- vt82c686b_mc97_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 6);
+ vt82c686b_ac97_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 5));
+ vt82c686b_mc97_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 6));
}
#endif
@@ -349,18 +349,18 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device,
hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
}
- via_devfn = vt82c686b_init(pci_bus, FULONG2E_VIA_SLOT << 3);
+ via_devfn = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0));
if (via_devfn < 0) {
fprintf(stderr, "vt82c686b_init error \n");
exit(1);
}
isa_bus_irqs(i8259);
- vt82c686b_ide_init(pci_bus, hd, (FULONG2E_VIA_SLOT << 3) + 1);
- usb_uhci_vt82c686b_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 2);
- usb_uhci_vt82c686b_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 3);
+ vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1));
+ usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2));
+ usb_uhci_vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3));
- smbus = vt82c686b_pm_init(pci_bus, (FULONG2E_VIA_SLOT << 3) + 4,
+ smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4),
0xeee1, NULL);
eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
memcpy(eeprom_buf, eeprom_spd, sizeof(eeprom_spd));
diff --git a/hw/petalogix_s3adsp1800_mmu.c b/hw/petalogix_s3adsp1800_mmu.c
index 70b6a36e1..fcbb825d7 100644
--- a/hw/petalogix_s3adsp1800_mmu.c
+++ b/hw/petalogix_s3adsp1800_mmu.c
@@ -179,11 +179,22 @@ petalogix_s3adsp1800_init(ram_addr_t ram_size,
}
/* Always boot into physical ram. */
boot_info.bootstrap_pc = ddr_base + (entry & 0x0fffffff);
+
+ /* If it wasn't an ELF image, try an u-boot image. */
+ if (kernel_size < 0) {
+ target_phys_addr_t uentry, loadaddr;
+
+ kernel_size = load_uimage(kernel_filename, &uentry, &loadaddr, 0);
+ boot_info.bootstrap_pc = uentry;
+ high = (loadaddr + kernel_size + 3) & ~3;
+ }
+
+ /* Not an ELF image nor an u-boot image, try a RAW image. */
if (kernel_size < 0) {
- /* If we failed loading ELF's try a raw image. */
kernel_size = load_image_targphys(kernel_filename, ddr_base,
ram_size);
boot_info.bootstrap_pc = ddr_base;
+ high = (ddr_base + kernel_size + 3) & ~3;
}
boot_info.cmdline = high + 4096;
diff --git a/hw/vhost.c b/hw/vhost.c
index 65709d005..34c4745d8 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -11,7 +11,6 @@
*/
#include <sys/ioctl.h>
-#include <sys/eventfd.h>
#include "vhost.h"
#include "hw/hw.h"
/* For range_get_last */
diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index 606aa0c1c..0c00de272 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -20,7 +20,6 @@
#ifdef CONFIG_VHOST_NET
#include <linux/vhost.h>
-#include <sys/eventfd.h>
#include <sys/socket.h>
#include <linux/kvm.h>
#include <fcntl.h>
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index f50069d20..490cd4105 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -28,6 +28,7 @@ typedef struct VirtIOBlock
BlockConf *conf;
unsigned short sector_mask;
char sn[BLOCK_SERIAL_STRLEN];
+ DeviceState *qdev;
} VirtIOBlock;
static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev)
@@ -522,9 +523,16 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf)
s->vq = virtio_add_queue(&s->vdev, 128, virtio_blk_handle_output);
qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s);
+ s->qdev = dev;
register_savevm(dev, "virtio-blk", virtio_blk_id++, 2,
virtio_blk_save, virtio_blk_load, s);
bdrv_set_removable(s->bs, 0);
return &s->vdev;
}
+
+void virtio_blk_exit(VirtIODevice *vdev)
+{
+ VirtIOBlock *s = to_virtio_blk(vdev);
+ unregister_savevm(s->qdev, "virtio-blk", s);
+}
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 66a8948c9..3a0702455 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -603,6 +603,7 @@ static int virtio_blk_exit_pci(PCIDevice *pci_dev)
{
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
+ virtio_blk_exit(proxy->vdev);
blockdev_mark_auto_del(proxy->block.bs);
return virtio_exit_pci(pci_dev);
}
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 8e611c03e..0586b8985 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -734,11 +734,19 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, uint32_t max_nr_ports)
{
VirtIOSerial *vser;
VirtIODevice *vdev;
- uint32_t i;
+ uint32_t i, max_supported_ports;
if (!max_nr_ports)
return NULL;
+ /* Each port takes 2 queues, and one pair is for the control queue */
+ max_supported_ports = VIRTIO_PCI_QUEUE_MAX / 2 - 1;
+
+ if (max_nr_ports > max_supported_ports) {
+ error_report("maximum ports supported: %u", max_supported_ports);
+ return NULL;
+ }
+
vdev = virtio_common_init("virtio-serial", VIRTIO_ID_CONSOLE,
sizeof(struct virtio_console_config),
sizeof(VirtIOSerial));
diff --git a/hw/virtio.h b/hw/virtio.h
index e4306cd75..30e472aba 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -194,6 +194,7 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf);
void virtio_net_exit(VirtIODevice *vdev);
+void virtio_blk_exit(VirtIODevice *vdev);
#define DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) \
DEFINE_PROP_BIT("indirect_desc", _state, _field, \