summaryrefslogtreecommitdiffstats
path: root/hw/pc.c
Commit message (Collapse)AuthorAgeFilesLines
* multiboot: Limit number of multiboot modulesAdam Lackorzynski2009-10-151-1/+8
| | | | | | | | | Add size checks to avoid overwriting the multiboot structure when too many modules are loaded. Patchworks-ID: 35700 Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* multiboot: Fix cmdline of modulesAdam Lackorzynski2009-10-151-1/+1
| | | | | | | | Fix address specified for cmdline value of module in multiboot structure. Patchworks-ID: 35699 Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* rom loader: fix sparc -kernel boot.Gerd Hoffmann2009-10-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Changes: (1) register pstrcpy_targphys() in rom list, it is used for kernel command lines by a number of architectures. (2) add rom_ptr() function to get a pointer for applying changes to loaded images. Needed for example to tell the linux kernel where it finds the initrd image by updating the header. (3) make sparc use rom_ptr for initrd setup. booting sparc-test works now, and 'info roms' shows this: (qemu) info roms addr=0000000000000000 size=0x2a3828 mem=ram name="phdr #0: vmlinux-2.6.11+tcx" addr=00000000007ff000 size=0x00000e mem=ram name="cmdline" addr=0000000000800000 size=0x400000 mem=ram name="/root/qemu-test/sparc-test/linux.img" addr=0000000070000000 size=0x0e4000 mem=rom name="phdr #0: /home/kraxel/projects/qemu/build-zfull/pc-bios/openbios-sparc32" reboot via 'system_reset' works too. Patchworks-ID: 35262 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* New qdev_init_nofail()Markus Armbruster2009-10-071-1/+1
| | | | | | | | | | | | | | | | | | | Like qdev_init(), but terminate program via hw_error() instead of returning an error value. Use it instead of qdev_init() where terminating the program on failure is okay, either because it's during machine construction, or because we know that failure can't happen. Because relying in the latter is somewhat unclean, and the former is not always obvious, it would be nice to go back to qdev_init() in the not-so-obvious cases, only with proper error handling. I'm leaving that for another day, because it involves making sure that error values are properly checked by all callers. Patchworks-ID: 35168 Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Reorganize option rom (+linux kernel) loading.Gerd Hoffmann2009-10-061-186/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds infrastructure to maintain memory regions which must be restored on reset. That includes roms (vga bios and option roms on pc), but is also used when loading linux kernels directly. Features: - loading files is supported. - passing blobs is supported. - target address range is supported (for optionrom area). - fixed target memory address is supported (linux kernel). New in v2: - writes to ROM are done only at initial boot. - also handle aout and uimage loaders. - drop unused fread_targphys() function. The final memory layout is created once all memory regions are registered. The option roms get addresses assigned and the registered regions are checked against overlaps. Finally all data is copyed to the guest memory. Advantages: (1) Filling memory on initial boot and on reset takes the same code path, making reset more robust. (2) The need to keep track of the option rom load address is gone. (3) Due to (2) option roms can be loaded outside pc_init(). This allows to move the pxe rom loading into the nic drivers for example. Additional bonus: There is a 'info roms' monitor command now. The patch also switches over pc.c and removes the option_rom_setup_reset() and load_option_rom() functions. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Improve error reporting on file accessJustin M. Forbes2009-10-051-6/+6
| | | | | | | | | By making the error reporting include strerror(errno), it gives the user a bit more indication as to why qemu failed. This is particularly important for people running qemu as a non root user. Signed-off-by: Justin M. Forbes <jforbes@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix pci_add nic not to exit on bad modelMarkus Armbruster2009-10-051-1/+1
| | | | | | | | | | | | | | | | Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() to create the NIC. When MODEL is unknown or "?", this prints to stderr and terminates the program. Change pci_nic_init() not to treat "?" specially, and to return NULL on failure. Switch uses during startup to new convenience wrapper pci_nic_init_nofail(), which behaves just like pci_nic_init() used to do. Bonus bug fix: we now check for qdev_init() failing there. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* serial: convert isa to qdevGerd Hoffmann2009-10-051-5/+1
| | | | | | | | | | | Everything using standard isa I/O ports and IRQ windup is considerd being an actual isa device. That are all serial_init() users except mips_mipssim() which seems to have a non-standard IRQ windup. baud rate is fixed at 115200 now as no caller passed in something else. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* floppy: add drive properties.Gerd Hoffmann2009-10-051-4/+2
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: windup acpi-based hotplugGerd Hoffmann2009-10-051-2/+1
| | | | | | | | Switch over acpi-based PCI hotplug for pc over to the new qdev-based pci hotplugging. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* parallel: convert isa to qdevGerd Hoffmann2009-10-051-2/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* i2c: addresses are load/save as uint8_t values, change types to reflect thisJuan Quintela2009-10-051-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Get rid of _t suffix"Anthony Liguori2009-10-011-15/+15
| | | | | | | | | | | | In the very least, a change like this requires discussion on the list. The naming convention is goofy and it causes a massive merge problem. Something like this _must_ be presented on the list first so people can provide input and cope with it. This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Get rid of _t suffixmalc2009-10-011-15/+15
| | | | | | | Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
* Compile loader only onceBlue Swirl2009-09-201-1/+4
| | | | | | | | | | | | | Callers must pass ELF machine, byte swapping and symbol LSB clearing information to ELF loader. A.out loader needs page size information, pass that too as a parameter. Extract prototypes to a separate file. Move loader.[ch] and elf_ops.h under hw. Adjust callers. Also use target_phys_addr_t instead of target_ulong for addresses: loader addresses aren't virtual. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* ide/isa: convert to qdev.Gerd Hoffmann2009-09-151-2/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: move a declaration to headerBlue Swirl2009-09-131-2/+0
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: add 'const'Blue Swirl2009-09-131-6/+7
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qdev/isa: convert real time clockGerd Hoffmann2009-09-101-1/+1
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* qdev/isa: convert ne2000Gerd Hoffmann2009-09-101-1/+1
| | | | | | | Also split the isa bits into a separate source file, so we don't drag in a dependency for isa-bus.o for machines which want ne2k_pci only. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* qdev: simplify isa irq assignmentsGerd Hoffmann2009-09-101-1/+1
| | | | | | | | | isa-bus owns the isa irqs now, so it can hand them out directly. There is no need for the separate isa_connect_irqs step, drop it. Also hard-code isa interrupts which can't be configured anyway. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* qdev: drop iobase properties from isa busGerd Hoffmann2009-09-101-2/+2
| | | | | | | | | | Lot of ISA devices work at fixed addresses, so having iobase as bus property doesn't make much sense. Devices which can have different iobases will get a device property. Also simply hard-code stuff which can't be configured anyway. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* isapc: pick a more sane default cpu for such old hardware.Gerd Hoffmann2009-09-101-0/+2
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* isapc: Fix irq routingGerd Hoffmann2009-09-101-1/+2
| | | | | | | Only send irqs to ioapic in case we have one. Fixes qemu segfault. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Fix indentationBlue Swirl2009-09-061-26/+26
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* mips malta: Fix fdc regression and use qdev for i8042 setupStefan Weil2009-09-041-1/+1
| | | | | | | | | | | | | | | | | 8baf73adf664e79eae201c3f618078a220a661d9 (qdev/isa: convert fdc) breaks MIPS Malta: Tried to create isa device isa-fdc with no isa bus present Fix this by creating an isa bus for piix4. This change also requires some more qdev related changes (similar changes were applied to pc.c) and allows cleaning of piix3/piix4 code. Thanks to Gerd Hoffmann for his hints. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* ide: pass down DriveInfo instead of BlockDriverStateGerd Hoffmann2009-09-041-8/+7
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fold piix3_init() intto i440fx_initJuan Quintela2009-09-041-2/+1
| | | | | | | i440fx_init will now work properly if we don't setup piix3 Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use PCII440FXState instead of generic PCIDeviceJuan Quintela2009-09-041-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* switch balloon initialization to -device.Gerd Hoffmann2009-08-271-7/+0
| | | | | | | | | | | | | | With that patch applied "-balloon virtio,args" becomes a shortcut for "-device virtio-balloon-pci,args". Side effects: - ballon device gains support for id=<tag>. - ballon device is off by default now. - initialization order changes, which may in different pci slot assignment depending on the VM configuration. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* ide: split away ide-isa.cGerd Hoffmann2009-08-271-0/+1
| | | | | | | | | create ide-isa.c and place isa bus support there. only build ide-isa support for platforms using it. also create ide.h header file. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: convert watchdogsMarkus Armbruster2009-08-271-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | -watchdog NAME is now equivalent to -device NAME, except it treats option argument '?' specially, and supports only one watchdog. A side effect is that a device created with -watchdog may now receive a different PCI address. i6300esb is now available on any machine with a PCI bus, not just PCs. ib700 is still PC only, but that could be changed easily. The only remaining use of struct WatchdogTimerModel and watchdog_add_model() is supporting '-watchdog ?'. Should be replaced by searching device_info_list for watchdog devices when we can identify them there. Also fixes ib700 not to use vm_clock before it is initialized: in wdt_ib700_init(), called from register_watchdogs(), which runs before init_timers(). The bug made ib700_write_enable_reg() crash in qemu_del_timer(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Move isa_connect_irq calls into isa_create_simpleGerd Hoffmann2009-08-271-3/+1
| | | | | | | | Now with isa-bus maintaining the isa irqs we can move the isa_connect_irq() calls into isa_create_simple(). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add isa_reserve_irq().Jes Sorensen2009-08-271-10/+14
| | | | | | | | | | | | | | | | | | | Introduce isa_reserve_irq() which marks an irq reserved and returns the appropriate qemu_irq entry from the i8259 table. isa_reserve_irq() is a temporary interface to be used to allocate ISA IRQs for devices which have not yet been converted to qdev, and for special cases which are not suited for qdev conversions, such as the 'ferr'. This patch goes on top of Gerd Hoffmann's which makes isa-bus.c own the ISA irq table. [ added isa-bus.o to some targets to fix build failures -- kraxel ] Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* isa bus irq changes and fixes.Gerd Hoffmann2009-08-271-3/+5
| | | | | | | | | | | | | | | Changes: (1) make isa-bus maintain isa irqs, complain when allocating already taken irqs. (2) note that (1) works only for isa devices converted to qdev already (floppy and ps2/kbd/mouse right now), so more work is needed to make this really useful. (3) split floppy init into isa and sysbus versions. (4) add sysbus->isa bridge & fix -M isapc breakage. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make the e1000 the default network adapter for the pc target.Anthony Liguori2009-08-241-2/+2
| | | | | | | | | | | | | | The ne2k is an ancient card that performs pretty terribly under QEMU. In many modern OSes, there is no longer drivers available for the ne2k. Switch the default network adapter to e1000. This card is more widely suppported and performs rather well under QEMU. There may be very old OSes that had a ne2k driver but not an e1000 driver but I think this is likely the exception. I think the average user is better served with an e1000 vs ne2k. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio-blk: add msi support.Gerd Hoffmann2009-08-241-0/+4
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Unbreak large mem support by removing kqemuAnthony Liguori2009-08-241-11/+1
| | | | | | | | | | | | | | | | | | | | | | kqemu introduces a number of restrictions on the i386 target. The worst is that it prevents large memory from working in the default build. Furthermore, kqemu is fundamentally flawed in a number of ways. It relies on the TSC as a time source which will not be reliable on a multiple processor system in userspace. Since most modern processors are multicore, this severely limits the utility of kqemu. kvm is a viable alternative for people looking to accelerate qemu and has the benefit of being supported by the upstream Linux kernel. If someone can implement work arounds to remove the restrictions introduced by kqemu, I'm happy to avoid and/or revert this patch. N.B. kqemu will still function in the 0.11 series but this patch removes it from the 0.12 series. Paul, please Ack or Nack this patch. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Route IOAPIC interrupts via ISA busAvi Kivity2009-08-241-8/+8
| | | | | | | | Instead of calling the IOAPIC from the PIC, raise IOAPIC irqs via the ISA bus. As a side effect, IOAPIC lines 16-23 are enabled. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Route PC irqs to ISA bus instead of i8259 directlyAvi Kivity2009-08-241-15/+31
| | | | | | | | | | | A PC has its motherboard IRQ lines connected to both the PIC and IOAPIC. Currently, qemu routes IRQs to the PIC which then calls the IOAPIC, an incestuous arrangement. In order to clean this up, create a new ISA IRQ abstraction, and have devices raise ISA IRQs (which in turn raise the i8259 IRQs as usual). Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QEMU set irq0override in fw_cfgJes Sorensen2009-08-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Hi, After discussing the issue with Avi, Gleb and a couple others on irq, we came to the conclusion that it is preferred to have QEMU request features from the BIOS, rather than notifying the BIOS that it is running on QEMU or KVM. This way memory ranges can change etc. and an older BIOS will continue to work on newer QEMU if it receives the info as a fw_cfg value. This one also matches what qemu-kvm does for irq0override, except I haven't made it configurable. I leave that as an exercise for whoever would be interested in switching off irq0override. Thanks, Jes Set irq0 override in fw_cfg, informing the BIOS that QEMU expects override on irq0. This matches qemu-kvm, and will help sharing a single BIOS binary. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev/isa: make pc use qdev for i8042 setup.Gerd Hoffmann2009-08-101-1/+4
| | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* qdev-ify virtio-blk.Gerd Hoffmann2009-08-101-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First user of the new drive property. With this patch applied host and guest config can be specified separately, like this: -drive if=none,id=disk1,file=/path/to/disk.img -device virtio-blk-pci,drive=disk1 You can set any property for virtio-blk-pci now. You can set the pci address via addr=. You can switch the device into 0.10 compat mode using class=0x0180. As this is per device you can have one 0.10 and one 0.11 virtio block device in a single virtual machine. Old syntax continues to work. Internally it does the same as the two lines above though. One side effect this has is a different initialization order, which might result in a different pci address being assigned by default. Long term plan here is to have this working for all block devices, i.e. once all scsi is properly qdev-ified you will be able to do something like this: -drive if=none,id=sda,file=/path/to/disk.img -device lsi,id=lsi,addr=<pciaddr> -device scsi-disk,drive=sda,bus=lsi.0,lun=<n> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* Remove the pc-0-10 machine typeMark McLoughlin2009-07-301-50/+5
| | | | | | | | We have the pc-0.10 machine type now which does exactly the same thing. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* kill drives_tableGerd Hoffmann2009-07-271-14/+7
| | | | | | | | | | | | | | First step cleaning up the drives handling. This one does nothing but removing drives_table[], still it became seriously big. drive_get_index() is gone and is replaced by drives_get() which hands out DriveInfo pointers instead of a table index. This needs adaption in *tons* of places all over. The drives are now maintained as linked list. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add a pc-0.11 machine type and make the pc type an aliasMark McLoughlin2009-07-271-1/+2
| | | | | | | | | | | | The pc-0.11 type allows users of qemu-0.11 to use a machine type which they know will remain compatible when the upgrade to qemu-0.12. Management tools may choose to canonicalize the 'pc' machine type to 'pc-0.11' so that if the 'pc' alias changes target in future versions of qemu, the machine type used will remain compatible. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev/compat: virtio-net-pci 0.10 compatibility.Gerd Hoffmann2009-07-161-0/+4
| | | | | | | | Add vectors property, allowing to turn off msi by setting vectors=0. Add compat property to pc-0.10 disabling msi. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev/compat: virtio-console-pci 0.10 compatibility.Gerd Hoffmann2009-07-161-0/+4
| | | | | | | | Add class property to virtio-console-pci allowing to specify the PCI class. Add compat property to pc-0.10 to set the old PCI class. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev/compat: virtio-blk-pci 0.10 compatibility.Gerd Hoffmann2009-07-161-0/+5
| | | | | | | | Add class property to virtio-blk-pci allowing to specify the PCI class. Add compat property to pc-0.10 to set the old PCI class. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev/compat: add pc-0.10 machine type.Gerd Hoffmann2009-07-161-0/+11
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud