From: Ian Jackson Date: Thu, 2 Apr 2009 12:51:27 +0000 (+0100) Subject: Merge tag 'stable_0_10_0.branchpoint' X-Git-Tag: xen-3.4.0-rc2~12 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3057543e17321221e7bbccd974a33237c3ee92c2;p=qemu-xen-3.4-testing.git Merge tag 'stable_0_10_0.branchpoint' Conflicts: Makefile.target block-bochs.c block-cloop.c block-parallels.c block.c console.c console.h hw/ide.c hw/pc.c hw/pci.c hw/pci.h hw/usb-hid.c hw/vga.c loader.c net.h posix-aio-compat.c vl.c vnc.c --- 3057543e17321221e7bbccd974a33237c3ee92c2 diff --cc Makefile.target index d2023d51,f33f7621..7cfb4938 --- a/Makefile.target +++ b/Makefile.target @@@ -577,16 -574,17 +577,20 @@@ OBJS += pcnet. OBJS += rtl8139.o OBJS += e1000.o + # Serial mouse + OBJS += msmouse.o + ifeq ($(TARGET_BASE_ARCH), i386) # Hardware support -OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o -OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o +ifdef CONFIG_AUDIO +OBJS+= $(SOUND_HW) pcspk.o +CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE +endif +OBJS+= ide.o pckbd.o ps2.o vga.o dma.o +OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o + OBJS += device-hotplug.o pci-hotplug.o -CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE endif ifeq ($(TARGET_BASE_ARCH), ppc) CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE diff --cc block-bochs.c index ce4480ef,593cf697..ff231910 --- a/block-bochs.c +++ b/block-bochs.c @@@ -149,9 -149,7 +149,9 @@@ static int bochs_open(BlockDriverState s->catalog_size = le32_to_cpu(bochs.extra.redolog.catalog); s->catalog_bitmap = qemu_malloc(s->catalog_size * 4); + if (!s->catalog_bitmap) + goto fail; - if (qemu_read(s->fd, s->catalog_bitmap, s->catalog_size * 4) != + if (read(s->fd, s->catalog_bitmap, s->catalog_size * 4) != s->catalog_size * 4) goto fail; for (i = 0; i < s->catalog_size; i++) diff --cc block-cloop.c index 670ffae6,6985084b..d63fac24 --- a/block-cloop.c +++ b/block-cloop.c @@@ -75,9 -75,8 +75,9 @@@ cloop_close /* read offsets */ offsets_size=s->n_blocks*sizeof(uint64_t); - s->offsets=(uint64_t*)qemu_malloc(offsets_size); + if(!(s->offsets=(uint64_t*)malloc(offsets_size))) + goto cloop_close; - if(qemu_read_ok(s->fd,s->offsets,offsets_size)<0) + if(read(s->fd,s->offsets,offsets_size)n_blocks;i++) { s->offsets[i]=be64_to_cpu(s->offsets[i]); diff --cc block-parallels.c index bc41f8bf,8a8ec63d..60e39641 --- a/block-parallels.c +++ b/block-parallels.c @@@ -101,9 -101,8 +101,10 @@@ static int parallels_open(BlockDriverSt s->catalog_size = le32_to_cpu(ph.catalog_entries); s->catalog_bitmap = qemu_malloc(s->catalog_size * 4); + if (!s->catalog_bitmap) + goto fail; - if (qemu_read_ok(s->fd, s->catalog_bitmap, s->catalog_size * 4) < 0) + if (read(s->fd, s->catalog_bitmap, s->catalog_size * 4) != + s->catalog_size * 4) goto fail; for (i = 0; i < s->catalog_size; i++) le32_to_cpus(&s->catalog_bitmap[i]); diff --cc block-raw-posix.c index e8c10c1c,85ca7049..9a02d4f3 --- a/block-raw-posix.c +++ b/block-raw-posix.c @@@ -538,15 -533,7 +538,13 @@@ static int posix_aio_init(void return 0; s = qemu_malloc(sizeof(PosixAioState)); - if (s == NULL) - return -ENOMEM; + /* under some circumstances on Centos 4.3 (at least) + * SIGUSR2 is mistakenly blocked, which breaks badly */ + sigemptyset(&enable); + sigaddset(&enable,SIGUSR2); + sigprocmask(SIG_UNBLOCK,&enable,0); + sigfillset(&act.sa_mask); act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ act.sa_handler = aio_signal_handler; diff --cc block-vmdk.c index 25f8763c,71d7504b..b087a40a --- a/block-vmdk.c +++ b/block-vmdk.c @@@ -276,11 -276,9 +276,9 @@@ static int vmdk_snapshot_create(const c /* write RGD */ rgd_buf = qemu_malloc(gd_size); - if (!rgd_buf) - goto fail; if (lseek(p_fd, rgd_offset, SEEK_SET) == -1) goto fail_rgd; - if (read(p_fd, rgd_buf, gd_size) != gd_size) + if (qemu_read_ok(p_fd, rgd_buf, gd_size) < 0) goto fail_rgd; if (lseek(snp_fd, rgd_offset, SEEK_SET) == -1) goto fail_rgd; @@@ -290,11 -288,9 +288,9 @@@ /* write GD */ gd_buf = qemu_malloc(gd_size); - if (!gd_buf) - goto fail_rgd; if (lseek(p_fd, gd_offset, SEEK_SET) == -1) goto fail_gd; - if (read(p_fd, gd_buf, gd_size) != gd_size) + if (qemu_read_ok(p_fd, gd_buf, gd_size) < 0) goto fail_gd; if (lseek(snp_fd, gd_offset, SEEK_SET) == -1) goto fail_gd; diff --cc block.c index f59ac6f4,7c744c74..c6f9c4d7 --- a/block.c +++ b/block.c @@@ -584,9 -561,9 +585,11 @@@ int bdrv_read(BlockDriverState *bs, int if (!drv) return -ENOMEDIUM; + if (bdrv_check_request(bs, sector_num, nb_sectors)) + return -EIO; - if (bdrv_rw_badreq_sectors(bs, sector_num, nb_sectors)) - return -EDOM; ++ if (bdrv_check_request(bs, sector_num, nb_sectors)) ++ return -EIO; if (drv->bdrv_pread) { int ret, len; len = nb_sectors * 512; @@@ -1181,8 -1154,6 +1187,8 @@@ int bdrv_write_compressed(BlockDriverSt BlockDriver *drv = bs->drv; if (!drv) return -ENOMEDIUM; - if (bdrv_rw_badreq_sectors(bs, sector_num, nb_sectors)) - return -EDOM; ++ if (bdrv_check_request(bs, sector_num, nb_sectors)) ++ return -EIO; if (!drv->bdrv_write_compressed) return -ENOTSUP; return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors); diff --cc console.c index 882ec691,3f2794e1..66b154b2 --- a/console.c +++ b/console.c @@@ -1245,10 -1277,7 +1242,8 @@@ DisplayState *graphic_console_init(vga_ DisplayState *ds; ds = (DisplayState *) qemu_mallocz(sizeof(DisplayState)); - if (ds == NULL) - return NULL; - ds->surface = qemu_create_displaysurface(640, 480, 32, 640 * 4); + ds->allocator = &default_allocator; + ds->surface = qemu_create_displaysurface(ds, 640, 480, 32, 640 * 4); s = new_console(ds, GRAPHIC_CONSOLE); if (s == NULL) { @@@ -1525,13 -1552,9 +1518,9 @@@ PixelFormat qemu_default_pixelformat(in return pf; } -DisplaySurface* qemu_create_displaysurface(int width, int height, int bpp, int linesize) +DisplaySurface* defaultallocator_create_displaysurface(int width, int height, int bpp, int linesize) { DisplaySurface *surface = (DisplaySurface*) qemu_mallocz(sizeof(DisplaySurface)); - if (surface == NULL) { - fprintf(stderr, "defaultallocator_create_displaysurface: malloc failed\n"); - exit(1); - } surface->width = width; surface->height = height; diff --cc hw/ide.c index febc87ed,6ad1d081..e8d676e8 --- a/hw/ide.c +++ b/hw/ide.c @@@ -3751,9 -3380,11 +3728,13 @@@ void pci_piix3_ide_init(PCIBus *bus, Bl ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6); ide_init_ioport(&d->ide_if[2], 0x170, 0x376); + buffered_pio_init(); + + for (i = 0; i < 4; i++) + if (hd_table[i]) + hd_table[i]->private = &d->dev; + - register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d); + register_savevm("ide", 0, 3, pci_ide_save, pci_ide_load, d); } /* hd_table must contain 4 block drivers */ diff --cc hw/pc.c index 878069de,38493907..5b59dfaf --- a/hw/pc.c +++ b/hw/pc.c @@@ -57,10 -54,9 +58,13 @@@ #define MAX_IDE_BUS 2 +#ifdef HAS_TPM +void tpm_tis_init(SetIRQFunc *set_irq, void *opaque, int irq); +#endif + + extern uint8_t *acpi_tables; + extern size_t acpi_tables_len; + static fdctrl_t *floppy_controller; static RTCState *rtc_state; static PITState *pit; diff --cc hw/pc.h index 0f7044aa,5578b3a9..8b71d48a --- a/hw/pc.h +++ b/hw/pc.h @@@ -102,10 -102,8 +102,11 @@@ i2c_bus *piix4_pm_init(PCIBus *bus, in qemu_irq sci_irq); void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr); void acpi_bios_init(void); + int acpi_table_add(const char *table_desc); +void acpi_php_add(int); +void acpi_php_del(int); + /* hpet.c */ extern int no_hpet; diff --cc hw/pci.c index 62298d10,97918a37..9b24e546 --- a/hw/pci.c +++ b/hw/pci.c @@@ -26,10 -26,8 +26,11 @@@ #include "console.h" #include "net.h" #include "virtio-net.h" + #include "sysemu.h" +#include "exec-all.h" +#include "qemu-xen.h" + //#define DEBUG_PCI struct PCIBus { @@@ -56,10 -54,22 +57,10 @@@ static void pci_set_irq(void *opaque, i target_phys_addr_t pci_mem_base; static uint16_t pci_default_sub_vendor_id = PCI_SUBVENDOR_ID_REDHAT_QUMRANET; static uint16_t pci_default_sub_device_id = PCI_SUBDEVICE_ID_QEMU; -static int pci_irq_index; static PCIBus *first_bus; - static int pcibus_load(QEMUFile *f, void *opaque, int version_id) -static void pcibus_save(QEMUFile *f, void *opaque) -{ - PCIBus *bus = (PCIBus *)opaque; - int i; - - qemu_put_be32(f, bus->nirq); - for (i = 0; i < bus->nirq; i++) - qemu_put_be32(f, bus->irq_count[i]); -} - + static int pcibus_load(QEMUFile *f, void *opaque, int version_id) { - PCIBus *bus = (PCIBus *)opaque; int i, nirq; if (version_id != 1) @@@ -184,14 -273,50 +254,60 @@@ PCIDevice *pci_register_device(PCIBus * return pci_dev; } ++int pci_devfn_in_use(PCIBus *bus, int devfn) ++{ ++ return bus->devices[devfn] ? 1 : 0; ++} ++ +void pci_hide_device(PCIDevice *pci_dev) +{ + PCIBus *bus = pci_dev->bus; + bus->devices[pci_dev->devfn] = NULL; +} + - void pci_register_io_region(PCIDevice *pci_dev, int region_num, - uint32_t size, int type, + static target_phys_addr_t pci_to_cpu_addr(target_phys_addr_t addr) + { + return addr + pci_mem_base; + } + + static void pci_unregister_io_regions(PCIDevice *pci_dev) + { + PCIIORegion *r; + int i; + + for(i = 0; i < PCI_NUM_REGIONS; i++) { + r = &pci_dev->io_regions[i]; + if (!r->size || r->addr == -1) + continue; + if (r->type == PCI_ADDRESS_SPACE_IO) { + isa_unassign_ioport(r->addr, r->size); + } else { + cpu_register_physical_memory(pci_to_cpu_addr(r->addr), + r->size, + IO_MEM_UNASSIGNED); + } + } + } + + int pci_unregister_device(PCIDevice *pci_dev) + { + int ret = 0; + + if (pci_dev->unregister) + ret = pci_dev->unregister(pci_dev); + if (ret) + return ret; + + pci_unregister_io_regions(pci_dev); + + qemu_free_irqs(pci_dev->irq); - pci_irq_index--; + pci_dev->bus->devices[pci_dev->devfn] = NULL; + qemu_free(pci_dev); + return 0; + } + + void pci_register_io_region(PCIDevice *pci_dev, int region_num, + uint32_t size, int type, PCIMapIORegionFunc *map_func) { PCIIORegion *r; @@@ -679,50 -807,16 +798,56 @@@ PCIDevice *pci_nic_init(PCIBus *bus, NI qemu_check_nic_model_list(nd, pci_nic_models, default_model); for (i = 0; pci_nic_models[i]; i++) - if (strcmp(nd->model, pci_nic_models[i]) == 0) - pci_nic_init_fns[i](bus, nd, devfn); + if (strcmp(nd->model, pci_nic_models[i]) == 0) { + pci_dev = pci_nic_init_fns[i](bus, nd, devfn); + if (pci_dev) + nd->private = pci_dev; + return pci_dev; + } + + return NULL; } +void pci_unplug_netifs(void) +{ + PCIBus *bus; + PCIDevice *dev; + PCIIORegion *region; + int x; + int i; + + /* We only support one PCI bus */ + for (bus = first_bus; bus; bus = NULL) { + for (x = 0; x < 256; x++) { + dev = bus->devices[x]; + if (dev && + dev->config[0xa] == 0 && + dev->config[0xb] == 2) { + /* Found a netif. Remove it from the bus. Note that + we don't free it here, since there could still be + references to it floating around. There are only + ever one or two structures leaked, and it's not + worth finding them all. */ + bus->devices[x] = NULL; + for (i = 0; i < PCI_NUM_REGIONS; i++) { + region = &dev->io_regions[i]; + if (region->addr == (uint32_t)-1 || + region->size == 0) + continue; + fprintf(logfile, "region type %d at [%x,%x).\n", + region->type, region->addr, + region->addr+region->size); + if (region->type == PCI_ADDRESS_SPACE_IO) { + isa_unassign_ioport(region->addr, region->size); + } else if (region->type == PCI_ADDRESS_SPACE_MEM) { + unregister_iomem(region->addr); + } + } + } + } + } +} + typedef struct { PCIDevice dev; PCIBus *bus; diff --cc hw/pci.h index a48ac309,56381e8a..ee13a368 --- a/hw/pci.h +++ b/hw/pci.h @@@ -185,6 -197,9 +197,7 @@@ struct PCIDevice /* do not access the following fields */ PCIConfigReadFunc *config_read; PCIConfigWriteFunc *config_write; + PCIUnregisterFunc *unregister; - /* ??? This is a PC-specific hack, and should be removed. */ - int irq_index; /* IRQ objects for the INTA-INTD pins. */ qemu_irq *irq; @@@ -203,9 -212,8 +216,10 @@@ PCIDevice *pci_register_device(PCIBus * int instance_size, int devfn, PCIConfigReadFunc *config_read, PCIConfigWriteFunc *config_write); + int pci_unregister_device(PCIDevice *pci_dev); +void pci_hide_device(PCIDevice *pci_dev); + void pci_register_io_region(PCIDevice *pci_dev, int region_num, uint32_t size, int type, PCIMapIORegionFunc *map_func); diff --cc loader.c index 519da521,71b9ba78..7339a6aa --- a/loader.c +++ b/loader.c @@@ -267,9 -266,7 +267,7 @@@ static void *load_at(int fd, int offset if (lseek(fd, offset, SEEK_SET) < 0) return NULL; ptr = qemu_malloc(size); - if (!ptr) - return NULL; - if (read(fd, ptr, size) != size) { + if (qemu_read_ok(fd, ptr, size) < 0) { qemu_free(ptr); return NULL; } @@@ -506,10 -503,8 +504,8 @@@ int load_uimage(const char *filename, t *ep = hdr->ih_ep; data = qemu_malloc(hdr->ih_size); - if (!data) - goto out; - if (read(fd, data, hdr->ih_size) != hdr->ih_size) { + if (qemu_read_ok(fd, data, hdr->ih_size) < 0) { fprintf(stderr, "Error reading file\n"); goto out; } diff --cc migration-exec.c index 220df0b4,6ed322a9..0df7796b --- a/migration-exec.c +++ b/migration-exec.c @@@ -60,16 -60,7 +60,12 @@@ MigrationState *exec_start_outgoing_mig FdMigrationState *s; FILE *f; +#ifdef CONFIG_STUBDOM + dprintf("stubdom migration? no popen!"); + return 0; +#else + s = qemu_mallocz(sizeof(*s)); - if (s == NULL) { - dprintf("Unable to allocate FdMigrationState\n"); - goto err; - } f = popen(command, "w"); if (f == NULL) { @@@ -114,9 -105,7 +110,8 @@@ err_after_open pclose(f); err_after_alloc: qemu_free(s); - err: return NULL; +#endif /*!CONFIG_STUBDOM*/ } int exec_start_incoming_migration(const char *command) diff --cc net.c index 9c4847b5,522df03a..fc27dcdc --- a/net.c +++ b/net.c @@@ -734,16 -756,10 +762,14 @@@ static TAPState *net_tap_fd_init(VLANSt TAPState *s; s = qemu_mallocz(sizeof(TAPState)); - if (!s) - return NULL; s->fd = fd; s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s); + s->next = head_net_tap; + head_net_tap = s; +#ifndef CONFIG_STUBDOM #ifdef HAVE_IOVEC s->vc->fd_readv = tap_receive_iov; +#endif #endif qemu_set_fd_handler(s->fd, tap_send, NULL, s); snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd); diff --cc net.h index 271b94f2,03c7f183..bc749d9f --- a/net.h +++ b/net.h @@@ -98,12 -102,11 +102,14 @@@ void net_slirp_redir(const char *redir_ void net_cleanup(void); int slirp_is_inited(void); void net_client_check(void); +void net_tap_shutdown_all(void); + void net_host_device_add(const char *device, const char *opts); + void net_host_device_remove(int vlan_id, const char *device); +#ifndef DEFAULT_NETWORK_SCRIPT #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" +#endif #ifdef __sun__ #define SMBD_COMMAND "/usr/sfw/sbin/smbd" #else diff --cc posix-aio-compat.c index a394d936,6b547f41..fa57e9b7 --- a/posix-aio-compat.c +++ b/posix-aio-compat.c @@@ -14,14 -14,12 +14,17 @@@ #include #include #include +#include - #include + #include + #include + #include + #include #include "osdep.h" +#include "qemu-common.h" + +#ifndef CONFIG_STUBDOM + #include "posix-aio-compat.h" static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; @@@ -126,12 -178,12 +177,12 @@@ int qemu_paio_init(struct qemu_paioini return 0; } -static int qemu_paio_submit(struct qemu_paiocb *aiocb, int is_write) +static int qemu_paio_submit(struct qemu_paiocb *aiocb, qemu_paio_function fn) { - aiocb->is_write = is_write; + aiocb->function = fn; aiocb->ret = -EINPROGRESS; aiocb->active = 0; - pthread_mutex_lock(&lock); + mutex_lock(&lock); if (idle_threads == 0 && cur_threads < max_threads) spawn_thread(); TAILQ_INSERT_TAIL(&request_list, aiocb, node); diff --cc qemu-char.c index b1d81f59,7cdeffd6..c1407717 --- a/qemu-char.c +++ b/qemu-char.c @@@ -555,17 -568,8 +548,11 @@@ static CharDriverState *qemu_chr_open_f CharDriverState *chr; FDCharDriver *s; + socket_set_nonblock(fd_in); + socket_set_nonblock(fd_out); + chr = qemu_mallocz(sizeof(CharDriverState)); - if (!chr) - return NULL; s = qemu_mallocz(sizeof(FDCharDriver)); - if (!s) { - free(chr); - return NULL; - } s->fd_in = fd_in; s->fd_out = fd_out; chr->opaque = s; diff --cc sdl.c index e9256732,c685b81f..4c676c04 --- a/sdl.c +++ b/sdl.c @@@ -685,15 -690,8 +739,13 @@@ void sdl_display_init(DisplayState *ds fprintf(stderr, "Could not initialize SDL - exiting\n"); exit(1); } +#ifndef _WIN32 + /* NOTE: we still want Ctrl-C to work, so we undo the SDL redirections */ + signal(SIGINT, SIG_DFL); + signal(SIGQUIT, SIG_DFL); +#endif dcl = qemu_mallocz(sizeof(DisplayChangeListener)); - if (!dcl) - exit(1); dcl->dpy_update = sdl_update; dcl->dpy_resize = sdl_resize; dcl->dpy_refresh = sdl_refresh; diff --cc vl.c index 61544498,d3863c49..40b3b6eb --- a/vl.c +++ b/vl.c @@@ -2578,11 -2593,9 +2633,11 @@@ int drive_init(struct drive_opt *arg, i case IF_MTD: case IF_VIRTIO: break; + case IF_BLKTAP: + abort(); } if (!file[0]) - return 0; + return -2; bdrv_flags = 0; if (snapshot) { bdrv_flags |= BDRV_O_SNAPSHOT; @@@ -4104,14 -4076,11 +4154,18 @@@ static void help(int exitcode #endif "-tb-size n set TB size\n" "-incoming p prepare for incoming migration, listen on port p\n" + #ifndef _WIN32 + "-chroot dir Chroot to dir just before starting the VM.\n" + "-runas user Change to user id user just before starting the VM.\n" + #endif "\n" + "Options specific to the Xen version:\n" + "-videoram set amount of memory available to virtual video adapter\n" + "-direct-pci s specify pci passthrough, with configuration string s\n" + "-pciemulation name:vendorid:deviceid:command:status:revision:classcode:headertype:subvendorid:subsystemid:interruputline:interruputpin\n" + "-vncunused bind the VNC server to an unused port\n" + "-std-vga alias for -vga std\n" + "\n" "During emulation, the following keys are useful:\n" "ctrl-alt-f toggle full screen\n" "ctrl-alt-n switch to virtual console 'n'\n" @@@ -4699,36 -4641,12 +4759,40 @@@ int main(int argc, char **argv, char ** const char *pid_file = NULL; int autostart; const char *incoming = NULL; + int fd = 0; + struct passwd *pwd = NULL; + const char *chroot_dir = NULL; + const char *run_as = NULL; qemu_cache_utils_init(envp); + logfile = stderr; /* initial value */ + +#if !defined(__sun__) && !defined(CONFIG_STUBDOM) + struct rlimit rl; + /* Maximise rlimits. Needed where default constraints are tight (*BSD). */ + if (getrlimit(RLIMIT_STACK, &rl) != 0) { + perror("getrlimit(RLIMIT_STACK)"); + exit(1); + } + rl.rlim_cur = rl.rlim_max; + if (setrlimit(RLIMIT_STACK, &rl) != 0) + perror("setrlimit(RLIMIT_STACK)"); + if (getrlimit(RLIMIT_DATA, &rl) != 0) { + perror("getrlimit(RLIMIT_DATA)"); + exit(1); + } + rl.rlim_cur = rl.rlim_max; + if (setrlimit(RLIMIT_DATA, &rl) != 0) + perror("setrlimit(RLIMIT_DATA)"); + rl.rlim_cur = RLIM_INFINITY; + rl.rlim_max = RLIM_INFINITY; + if (setrlimit(RLIMIT_RSS, &rl) != 0) + perror("setrlimit(RLIMIT_RSS)"); + rl.rlim_cur = RLIM_INFINITY; + rl.rlim_max = RLIM_INFINITY; + if (setrlimit(RLIMIT_MEMLOCK, &rl) != 0) + perror("setrlimit(RLIMIT_MEMLOCK)"); +#endif LIST_INIT (&vm_change_state_head); #ifndef _WIN32 @@@ -5783,13 -5618,11 +5856,15 @@@ } } + if (strlen(direct_pci_str) > 0) + direct_pci = direct_pci_str; + machine->init(ram_size, vga_ram_size, boot_devices, - kernel_filename, kernel_cmdline, initrd_filename, cpu_model); + kernel_filename, kernel_cmdline, initrd_filename, cpu_model, + direct_pci); + current_machine = machine; + /* Set KVM's vcpu state to qemu's initial CPUState. */ if (kvm_enabled()) { int ret;