diff options
50 files changed, 71 insertions, 33 deletions
diff --git a/blockdev.h b/blockdev.h index e707b8774..f26ac6ee6 100644 --- a/blockdev.h +++ b/blockdev.h @@ -16,15 +16,9 @@ void blockdev_mark_auto_del(BlockDriverState *bs); void blockdev_auto_del(BlockDriverState *bs); -typedef enum { - IF_NONE, - IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN, - IF_COUNT -} BlockInterfaceType; - #define BLOCK_SERIAL_STRLEN 20 -typedef struct DriveInfo { +struct DriveInfo { BlockDriverState *bdrv; char *id; const char *devaddr; @@ -35,7 +29,7 @@ typedef struct DriveInfo { QemuOpts *opts; char serial[BLOCK_SERIAL_STRLEN + 1]; QTAILQ_ENTRY(DriveInfo) next; -} DriveInfo; +}; #define MAX_IDE_DEVS 2 #define MAX_SCSI_DEVS 7 diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c index c1a9a561d..9704e2feb 100644 --- a/hw/device-hotplug.c +++ b/hw/device-hotplug.c @@ -25,6 +25,7 @@ #include "hw.h" #include "boards.h" #include "net.h" +#include "blockdev.h" DriveInfo *add_init_drive(const char *optstr) { diff --git a/hw/etraxfs.c b/hw/etraxfs.c index 46e2920c2..5ee5f979a 100644 --- a/hw/etraxfs.c +++ b/hw/etraxfs.c @@ -31,6 +31,7 @@ #include "loader.h" #include "elf.h" #include "cris-boot.h" +#include "blockdev.h" #define FLASH_SIZE 0x2000000 #define INTMEM_SIZE (128 * 1024) @@ -34,6 +34,7 @@ #include "isa.h" #include "sysbus.h" #include "qdev-addr.h" +#include "blockdev.h" /********************************************************/ /* debug Floppy devices */ @@ -2,7 +2,6 @@ #define HW_FDC_H /* fdc.c */ -#include "blockdev.h" #define MAX_FD 2 typedef struct FDCtrl FDCtrl; diff --git a/hw/gumstix.c b/hw/gumstix.c index c343a166e..af8b464b8 100644 --- a/hw/gumstix.c +++ b/hw/gumstix.c @@ -38,6 +38,7 @@ #include "sysemu.h" #include "devices.h" #include "boards.h" +#include "blockdev.h" static const int sector_len = 128 * 1024; diff --git a/hw/ide/core.c b/hw/ide/core.c index 631673fc0..3651d2be9 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -30,6 +30,7 @@ #include "qemu-timer.h" #include "sysemu.h" #include "dma.h" +#include "blockdev.h" #include <hw/ide/internal.h> diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 53468edcb..080876035 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -20,6 +20,7 @@ #include "dma.h" #include "qemu-error.h" #include <hw/ide/internal.h> +#include "blockdev.h" /* --------------------------------- */ diff --git a/hw/mainstone.c b/hw/mainstone.c index cba7e63b3..efa2959c7 100644 --- a/hw/mainstone.c +++ b/hw/mainstone.c @@ -17,6 +17,7 @@ #include "mainstone.h" #include "sysemu.h" #include "flash.h" +#include "blockdev.h" static struct keymap map[0xE0] = { [0 ... 0xDF] = { -1, -1 }, diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c index c6c13ca99..cbe71567a 100644 --- a/hw/mips_fulong2e.c +++ b/hw/mips_fulong2e.c @@ -37,6 +37,7 @@ #include "elf.h" #include "vt82c686.h" #include "mc146818rtc.h" +#include "blockdev.h" #define DEBUG_FULONG2E_INIT diff --git a/hw/mips_jazz.c b/hw/mips_jazz.c index 71b05a203..5d5305a82 100644 --- a/hw/mips_jazz.c +++ b/hw/mips_jazz.c @@ -36,6 +36,7 @@ #include "mips-bios.h" #include "loader.h" #include "mc146818rtc.h" +#include "blockdev.h" enum jazz_model_e { diff --git a/hw/mips_malta.c b/hw/mips_malta.c index 11e220a94..ec95cd850 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -45,6 +45,7 @@ #include "loader.h" #include "elf.h" #include "mc146818rtc.h" +#include "blockdev.h" //#define DEBUG_BOARD_INIT diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c index 61cd33a93..ca61431ee 100644 --- a/hw/mips_r4k.c +++ b/hw/mips_r4k.c @@ -22,6 +22,7 @@ #include "loader.h" #include "elf.h" #include "mc146818rtc.h" +#include "blockdev.h" #define MAX_IDE_BUS 2 diff --git a/hw/musicpal.c b/hw/musicpal.c index 33180a265..56f27669d 100644 --- a/hw/musicpal.c +++ b/hw/musicpal.c @@ -18,6 +18,7 @@ #include "flash.h" #include "console.h" #include "i2c.h" +#include "blockdev.h" #define MP_MISC_BASE 0x80002000 #define MP_MISC_SIZE 0x00001000 diff --git a/hw/omap1.c b/hw/omap1.c index cf0d42869..06370b6d3 100644 --- a/hw/omap1.c +++ b/hw/omap1.c @@ -25,6 +25,7 @@ #include "soc_dma.h" /* We use pc-style serial ports. */ #include "pc.h" +#include "blockdev.h" /* Should signal the TCMI/GPMC */ uint32_t omap_badwidth_read8(void *opaque, target_phys_addr_t addr) diff --git a/hw/omap_sx1.c b/hw/omap_sx1.c index c3f197393..44dc514f3 100644 --- a/hw/omap_sx1.c +++ b/hw/omap_sx1.c @@ -32,6 +32,7 @@ #include "boards.h" #include "arm-misc.h" #include "flash.h" +#include "blockdev.h" /*****************************************************************************/ /* Siemens SX1 Cellphone V1 */ @@ -41,6 +41,7 @@ #include "sysemu.h" #include "device-assignment.h" #include "kvm.h" +#include "blockdev.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 9e4bac867..bb4e69fd6 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -34,6 +34,7 @@ #include "kvm.h" #include "sysemu.h" #include "sysbus.h" +#include "blockdev.h" qemu_irq *ioapic_irq_hack; diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index f70dcd984..b370b9b32 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -32,6 +32,7 @@ #include "virtio-blk.h" #include "qemu-config.h" #include "device-assignment.h" +#include "blockdev.h" #if defined(TARGET_I386) static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon, diff --git a/hw/pcmcia.h b/hw/pcmcia.h index 360292395..50648c973 100644 --- a/hw/pcmcia.h +++ b/hw/pcmcia.h @@ -1,7 +1,6 @@ /* PCMCIA/Cardbus */ #include "qemu-common.h" -#include "blockdev.h" typedef struct { qemu_irq irq; diff --git a/hw/petalogix_s3adsp1800_mmu.c b/hw/petalogix_s3adsp1800_mmu.c index fcbb825d7..42de45963 100644 --- a/hw/petalogix_s3adsp1800_mmu.c +++ b/hw/petalogix_s3adsp1800_mmu.c @@ -34,6 +34,7 @@ #include "xilinx.h" #include "loader.h" #include "elf.h" +#include "blockdev.h" #define LMB_BRAM_SIZE (128 * 1024) #define FLASH_SIZE (16 * 1024 * 1024) diff --git a/hw/ppc405_boards.c b/hw/ppc405_boards.c index 40ff1b34e..662d7c437 100644 --- a/hw/ppc405_boards.c +++ b/hw/ppc405_boards.c @@ -31,6 +31,7 @@ #include "boards.h" #include "qemu-log.h" #include "loader.h" +#include "blockdev.h" #define BIOS_FILENAME "ppc405_rom.bin" #define BIOS_SIZE (2048 * 1024) diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c index fbba9b6fb..639dcde00 100644 --- a/hw/ppc_newworld.c +++ b/hw/ppc_newworld.c @@ -66,6 +66,7 @@ #include "kvm.h" #include "kvm_ppc.h" #include "hw/usb.h" +#include "blockdev.h" #define MAX_IDE_BUS 2 #define VGA_BIOS_SIZE 65536 diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index 6b3ab8961..de6005e35 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -41,6 +41,7 @@ #include "elf.h" #include "kvm.h" #include "kvm_ppc.h" +#include "blockdev.h" #define MAX_IDE_BUS 2 #define VGA_BIOS_SIZE 65536 diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c index fc3e17a0c..52fa9b6d9 100644 --- a/hw/ppc_prep.c +++ b/hw/ppc_prep.c @@ -37,6 +37,7 @@ #include "ide.h" #include "loader.h" #include "mc146818rtc.h" +#include "blockdev.h" //#define HARD_DEBUG_PPC_IO //#define DEBUG_PPC_IO diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index 953e9ee1d..26b9205db 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -15,6 +15,7 @@ #include "ssi.h" #include "qemu-timer.h" #include "qemu-char.h" +#include "blockdev.h" static struct { target_phys_addr_t io_base; diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 2d600f5ee..a493087a5 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -1,6 +1,7 @@ #include "net.h" #include "qdev.h" #include "qerror.h" +#include "blockdev.h" void *qdev_get_prop_ptr(DeviceState *dev, Property *prop) { @@ -29,6 +29,7 @@ #include "qdev.h" #include "sysemu.h" #include "monitor.h" +#include "blockdev.h" static int qdev_hotplug = 0; @@ -2,7 +2,6 @@ #define QDEV_H #include "hw.h" -#include "blockdev.h" #include "qemu-queue.h" #include "qemu-char.h" #include "qemu-option.h" @@ -36,6 +36,7 @@ #include "loader.h" #include "usb.h" #include "flash.h" +#include "blockdev.h" #define FLASH_BASE 0x00000000 #define FLASH_SIZE 0x02000000 diff --git a/hw/realview.c b/hw/realview.c index 70bcdb846..e9fcbc9a6 100644 --- a/hw/realview.c +++ b/hw/realview.c @@ -18,6 +18,7 @@ #include "boards.h" #include "bitbang_i2c.h" #include "sysbus.h" +#include "blockdev.h" #define SMP_BOOT_ADDR 0xe0000000 diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index b860a09ed..7aa0bcd1e 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -3,6 +3,7 @@ #include "scsi.h" #include "scsi-defs.h" #include "qdev.h" +#include "blockdev.h" static struct BusInfo scsi_bus_info = { .name = "SCSI", diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index f43f2d097..07a6d8694 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -36,6 +36,7 @@ do { fprintf(stderr, "scsi-disk: " fmt , ## __VA_ARGS__); } while (0) #include "scsi.h" #include "scsi-defs.h" #include "sysemu.h" +#include "blockdev.h" #define SCSI_DMA_BUF_SIZE 131072 #define SCSI_MAX_INQUIRY_LEN 256 diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c index a8b4176d8..aa4f62ae5 100644 --- a/hw/scsi-generic.c +++ b/hw/scsi-generic.c @@ -14,6 +14,7 @@ #include "qemu-common.h" #include "qemu-error.h" #include "scsi.h" +#include "blockdev.h" #ifdef __linux__ diff --git a/hw/spitz.c b/hw/spitz.c index ccf2a091f..a06446093 100644 --- a/hw/spitz.c +++ b/hw/spitz.c @@ -22,6 +22,7 @@ #include "block.h" #include "audio/audio.h" #include "boards.h" +#include "blockdev.h" #undef REG_FMT #define REG_FMT "0x%02lx" diff --git a/hw/sun4m.c b/hw/sun4m.c index a1373d407..7d7a7df1c 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -40,6 +40,7 @@ #include "qdev-addr.h" #include "loader.h" #include "elf.h" +#include "blockdev.h" //#define DEBUG_IRQ diff --git a/hw/sun4u.c b/hw/sun4u.c index 31c0c4c48..45a46d673 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -37,6 +37,7 @@ #include "ide.h" #include "loader.h" #include "elf.h" +#include "blockdev.h" //#define DEBUG_IRQ //#define DEBUG_EBUS @@ -19,6 +19,7 @@ #include "boards.h" #include "i2c.h" #include "ssi.h" +#include "blockdev.h" #define TOSA_RAM 0x04000000 #define TOSA_ROM 0x00800000 diff --git a/hw/usb-msd.c b/hw/usb-msd.c index 8b510cf90..0a95d8d50 100644 --- a/hw/usb-msd.c +++ b/hw/usb-msd.c @@ -15,6 +15,7 @@ #include "console.h" #include "monitor.h" #include "sysemu.h" +#include "blockdev.h" //#define DEBUG_MSD diff --git a/hw/versatilepb.c b/hw/versatilepb.c index 1d049f234..c51ee02c4 100644 --- a/hw/versatilepb.c +++ b/hw/versatilepb.c @@ -16,6 +16,7 @@ #include "pci.h" #include "usb-ohci.h" #include "boards.h" +#include "blockdev.h" /* Primary interrupt controller. */ diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 490cd4105..c3a73438f 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -13,6 +13,7 @@ #include <qemu-common.h> #include "qemu-error.h" +#include "blockdev.h" #include "virtio-blk.h" #ifdef __linux__ # include <scsi/sg.h> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 32fd5729f..1357d40b9 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -24,6 +24,7 @@ #include "net.h" #include "loader.h" #include "kvm.h" +#include "blockdev.h" /* from Linux's linux/virtio_pci.h */ diff --git a/hw/xen_backend.h b/hw/xen_backend.h index cc25f9d7d..292126dd1 100644 --- a/hw/xen_backend.h +++ b/hw/xen_backend.h @@ -4,8 +4,6 @@ #include "xen_common.h" #include "sysemu.h" #include "net.h" -#include "block_int.h" -#include "blockdev.h" /* ------------------------------------------------------------- */ diff --git a/hw/xen_devconfig.c b/hw/xen_devconfig.c index ea8f8c4c2..8d50216c0 100644 --- a/hw/xen_devconfig.c +++ b/hw/xen_devconfig.c @@ -1,4 +1,6 @@ #include "xen_backend.h" +#include "blockdev.h" +#include "block_int.h" /* XXX */ /* ------------------------------------------------------------- */ diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 9a466f3cc..134ac3388 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -41,6 +41,7 @@ #include "qemu-char.h" #include "xen_blkif.h" #include "xen_backend.h" +#include "blockdev.h" /* ------------------------------------------------------------- */ diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c index 586214d8b..77a34bf11 100644 --- a/hw/xen_machine_pv.c +++ b/hw/xen_machine_pv.c @@ -28,6 +28,7 @@ #include "boards.h" #include "xen_backend.h" #include "xen_domainbuild.h" +#include "blockdev.h" static void xen_init_pv(ram_addr_t ram_size, const char *boot_device, @@ -282,6 +282,9 @@ static int kvm_set_migration_log(int enable) for (i = 0; i < ARRAY_SIZE(s->slots); i++) { mem = &s->slots[i]; + if (!mem->memory_size) { + continue; + } if (!!(mem->flags & KVM_MEM_LOG_DIRTY_PAGES) == enable) { continue; } @@ -437,18 +440,10 @@ static void kvm_set_phys_mem(target_phys_addr_t start_addr, KVMSlot *mem, old; int err; - if (start_addr & ~TARGET_PAGE_MASK) { - if (flags >= IO_MEM_UNASSIGNED) { - if (!kvm_lookup_overlapping_slot(s, start_addr, - start_addr + size)) { - return; - } - fprintf(stderr, "Unaligned split of a KVM memory slot\n"); - } else { - fprintf(stderr, "Only page-aligned memory slots supported\n"); - } - abort(); - } + /* kvm works in page size chunks, but the function may be called + with sub-page size and unaligned start address. */ + size = TARGET_PAGE_ALIGN(size); + start_addr = TARGET_PAGE_ALIGN(start_addr); /* KVM does not support read-only slots */ phys_offset &= ~IO_MEM_ROM; diff --git a/qemu-common.h b/qemu-common.h index 3fb2f0b37..dfd3dc08a 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -201,6 +201,7 @@ typedef struct NICInfo NICInfo; typedef struct HCIInfo HCIInfo; typedef struct AudioState AudioState; typedef struct BlockDriverState BlockDriverState; +typedef struct DriveInfo DriveInfo; typedef struct DisplayState DisplayState; typedef struct DisplayChangeListener DisplayChangeListener; typedef struct DisplaySurface DisplaySurface; @@ -231,6 +232,12 @@ typedef struct VirtIODevice VirtIODevice; typedef uint64_t pcibus_t; +typedef enum { + IF_NONE, + IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN, + IF_COUNT +} BlockInterfaceType; + void cpu_exec_init_all(unsigned long tb_size); /* CPU save/load. */ diff --git a/qemu-options.hx b/qemu-options.hx index 66c84a0b7..c194f0aae 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -484,7 +484,6 @@ possible drivers and properties, use @code{-device ?} and @code{-device @var{driver},?}. ETEXI -#ifdef CONFIG_LINUX DEFHEADING(File system options:) DEF("fsdev", HAS_ARG, QEMU_OPTION_fsdev, @@ -517,9 +516,7 @@ Create a file-system-"device" for local-filesystem. @end table ETEXI -#endif -#ifdef CONFIG_LINUX DEFHEADING(Virtual File system pass-through options:) DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs, @@ -556,7 +553,6 @@ Create a Virtual file-system-pass through for local-filesystem. @end table ETEXI -#endif DEFHEADING() @@ -1837,6 +1837,7 @@ int main(int argc, char **argv, char **envp) DisplayChangeListener *dcl; int cyls, heads, secs, translation; QemuOpts *hda_opts = NULL, *opts; + QemuOptsList *olist; int optind; const char *optarg; const char *loadvm = NULL; @@ -2314,9 +2315,13 @@ int main(int argc, char **argv, char **envp) exit(1); } break; -#ifdef CONFIG_VIRTFS case QEMU_OPTION_fsdev: - opts = qemu_opts_parse(qemu_find_opts("fsdev"), optarg, 1); + olist = qemu_find_opts("fsdev"); + if (!olist) { + fprintf(stderr, "fsdev is not supported by this qemu build.\n"); + exit(1); + } + opts = qemu_opts_parse(olist, optarg, 1); if (!opts) { fprintf(stderr, "parse error: %s\n", optarg); exit(1); @@ -2327,7 +2332,12 @@ int main(int argc, char **argv, char **envp) char *arg_9p = NULL; int len = 0; - opts = qemu_opts_parse(qemu_find_opts("virtfs"), optarg, 1); + olist = qemu_find_opts("virtfs"); + if (!olist) { + fprintf(stderr, "virtfs is not supported by this qemu build.\n"); + exit(1); + } + opts = qemu_opts_parse(olist, optarg, 1); if (!opts) { fprintf(stderr, "parse error: %s\n", optarg); exit(1); @@ -2378,7 +2388,6 @@ int main(int argc, char **argv, char **envp) qemu_free(arg_9p); break; } -#endif case QEMU_OPTION_serial: add_device_config(DEV_SERIAL, optarg); default_serial = 0; |