aboutsummaryrefslogtreecommitdiff
path: root/hw/pc.c
AgeCommit message (Collapse)AuthorFilesLines
2010-06-27Remove useless device dependency of HAS_AUDIOBlue Swirl1-2/+0
System architecture dictates whether HAS_AUDIO is defined. It's then useless to check for HAS_AUDIO in files which are only used on those architectures which always have audio. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-06-19apic: qdev conversion cleanupBlue Swirl1-1/+30
Make APICState completely private to apic.c by using DeviceState in external APIs. Move apic_init() to pc.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-06-19apic: avoid using CPUState internalsBlue Swirl1-2/+32
Move the actual CPUState contents handling to cpu.h and cpuid.c. Handle CPU reset and set env->halted in pc.c. Add a function to get the local APIC state of the current CPU for the MMIO. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-06-19apic: avoid passing CPUState from devicesBlue Swirl1-4/+6
Pass only APICState from pc.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-06-14pass info about hpets to seabios.]Gleb Natapov1-0/+3
Currently HPET ACPI table is created regardless of whether qemu actually created hpet device. This may confuse some guests that don't check that hpet is functional before using it. Solve this by passing info about hpets in qemu to seabios via fw config interface. Additional benefit is that seabios no longer uses hard coded hpet configuration. Proposed interface supports up to 8 hpets. This is the number defined by hpet spec. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-06-14Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori1-0/+1
Conflicts: hw/pc.c
2010-06-13hpet/rtc: Rework RTC IRQ replacement by HPETJan Kiszka1-6/+8
Allow the intercept the RTC IRQ for the HPET legacy mode. Then push routing to IRQ8 completely into the HPET. This allows to turn hpet_in_legacy_mode() into a private function. Furthermore, this stops the RTC from clearing IRQ8 even if the HPET is in control. This patch comes with a side effect: The RTC timers will no longer be stoppend when there is no IRQ consumer, possibly causing a minor performance degration. But as the guest may want to redirect the RTC to the SCI in that mode, it should normally disable unused IRQ source anyway. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-06-13hpet: Convert to qdevJan Kiszka1-1/+6
Register the HPET as a sysbus device and create it that way. As it can route its IRQs to any ISA IRQ, we need to connect it to all 24 of them. Once converted to qdev, we can move reset handler and vmstate registration into its hands as well. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-06-04blockdev: Collect block device code in new blockdev.cMarkus Armbruster1-0/+1
Anything that moves hundreds of lines out of vl.c can't be all bad. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-29pc: improve debuggingBlue Swirl1-0/+12
Add a DPRINTF macro and use it for ISA and PIC interrupts. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-22Compile dma only onceBlue Swirl1-1/+12
Use a qemu_irq to request CPU exit. 7 compilations less for the full build. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-22Compile pckbd only onceBlue Swirl1-22/+11
Use a qemu_irq to indicate A20 line changes. Move I/O port 92 to pckbd.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-20pc: fix segfault introduced by 3d53f5c36ff6Eduard - Gabriel Munteanu1-2/+2
Commit 3d53f5c36ff6 introduced a segfault by erroneously making fw_cfg a 'void **' and passing it around in different ways. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15rtc: make rtc_xxx accept/return ISADevice instead of RTCState.Isaku Yamahata1-5/+6
To match rtc_xxx with qdev, make rtc_xxx accept and return ISADevice instead of RTCState. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: split out piix specific part from pc.c into pc_piix.cIsaku Yamahata1-326/+25
Finally, we can safely split out the piix specific part from pc.c into pc_piix.c. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: split out pci device init from pc_init1() into pc_pci_device_init()Isaku Yamahata1-7/+12
Split out pci device initialization from pc_init1() into pc_pci_device_init(). and removed unnecessary braces. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: split out basic device init from pc_init1() into pc_basic_device_init()Isaku Yamahata1-38/+48
Split out basic device, i.e. legacy devices like floppy, initialization from pc_init1() into pc_basic_device_init(). Later it will be used. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: split out vga initialization from pc_init1() into pc_vga_init().Isaku Yamahata1-18/+23
Split out vga initialization which is independent of piix from pc_init1() as pc_vga_init(). Later it will be used. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: split out memory allocation from pc_init1() into pc_memory_init()Isaku Yamahata1-28/+45
Split out memory allocation and rom/bios loading which doesn't depend on piix from pc_init1() into pc_memory_init(). Later it will be used. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: split out cpu initialization from pc_init1() into pc_cpus_init().Isaku Yamahata1-12/+19
split out cpu initialization which is piix independent from pc_init1() into pc_cpus_init(). Later it will be used. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: make pc_init1() not refer ferr_irq directly.Isaku Yamahata1-1/+7
By introducing a registering function, make pc_init1() not refer to ferr_irq directly in order to make ferr_irq piix independent. Later pc_init1() will be split out into another file keeping ferr_irq static. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: introduce a function to allocate cpu irq.Isaku Yamahata1-1/+6
Introduce a function, pc_allocate_cpu_irq(), to allocate cpu irq in order to make pic_irq_request() piix independent. Later piix code will be split out to another file keeping pic_irq_request() static. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: remove global variable rtc_state by using qemu_irq.Isaku Yamahata1-9/+7
Remove the reference to the global variable, rtc_state, by passing function argument to cmos_init_hd(), cmos_init(). Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Cc: Paolo Bonzini <bonzini@gnu.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: remove a global variable, floppy_controller.Isaku Yamahata1-3/+5
Remove a global variable, floppy_controller. Since it is unnecessarily global, make it local and pass it as a function argument. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: make an unnecessary global variable, pit, local.Isaku Yamahata1-1/+1
remove unnecessary global static variables, pit. Make it local. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc, i440fx: Make smm enable/disable function i440fx independent.Isaku Yamahata1-3/+15
make cpu_smm_update() generic to be independent on i440fx by registering a callback. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-15pc: initialize ioapic before use.Isaku Yamahata1-3/+3
The changeset of 2c8d9340203c7f19265fd4cb2341f568217a3af6 prevents isa_irq_handler() from NULL refering of IsaIrqState::ioapic. However it would be better to initialize the member before reference. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-03hw: better i440 emulationBernhard M. Wiedemann1-1/+1
updated version of an old patch http://xenon.stanford.edu/~eswierk/misc/qemu-linuxbios/qemu-piix-ram-size.patch that together with http://www.mail-archive.com/linuxbios@linuxbios.org/msg02390.html (which is already in coreboot trunk) allows coreboot to autodetect the amount of RAM within qemu/kvm from a register in i440 northbridge. The message on the old patch states: Unfortunately the current version of qemu does not set these registers, but I have patched qemu so that it emulates the i440 more faithfully in this regard. Signed-off-by: Bernhard M. Wiedemann <qemudevbmw@lsmod.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-25x86: remove dead assignments, spotted by clang analyzerBlue Swirl1-4/+2
Value stored is never read. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-19Check for invalid initrd fileM. Mohan Kumar1-0/+6
When qemu is invoked with an invalid initrd file, it crashes. Following patch prints a error message and exits if an invalid initrd is specified. Includes changes suggested by JV. Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-29Compile acpi only onceBlue Swirl1-9/+27
Use qemu_irqs to trigger CMOS S3 and SMI events. Avoid using kvm.h, which uses CPUState. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-21Move x86 specific PC declarations to a separate fileBlue Swirl1-0/+1
x86 definitions (especially CPUState uses) prevent many files from being compiled within libhw. Move x86 specific declarations (APIC stuff) to a separate file. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-16error: Replace qemu_error() by error_report()Markus Armbruster1-3/+3
error_report() terminates the message with a newline. Strip it it from its arguments. This fixes a few error messages lacking a newline: net_handle_fd_param()'s "No file descriptor named %s found", and tap_open()'s "vnet_hdr=1 requested, but no kernel support for IFF_VNET_HDR available" (all three versions). There's one place that passes arguments without newlines intentionally: load_vmstate(). Fix it up.
2010-03-16pc: Factor common code out of pc_boot_set() and cmos_init()Markus Armbruster1-20/+8
Code duplicated in commit 0ecdffbb. The two versions are similar, but not identical: * cmos_init() reports errors to stderr, pc_boot_set() via qemu_error(). The latter is fine for both, so pick that for the common code. * cmos_init() obeys fd_bootchk, pc_boot_set() ignores it. Make it a parameter of the common code.
2010-03-16pc: Fix error reporting for -boot onceMarkus Armbruster1-4/+3
Commit 0ecdffbb created pc_boot_set() for use from monitor command "boot_set", via qemu_boot_set(). pc_boot_set() reports errors to cur_mon, which works fine for monitor code. Commit e0f084bf reused the function int reset handler restore_boot_devices(). Use of cur_mon is problematic in that context. For instance, the "Too many boot devices for PC" error for "-boot order=abcdefgh,once=c" goes to the monitor instead of stderr. The monitor may not even exist. Fix by switching to qemu_error().
2010-03-04x86: Extend validity of bsp_to_cpuJan Kiszka1-1/+2
As we hard-wire the BSP to CPU 0 anyway and cpuid_apic_id equals cpu_index, bsp_to_cpu can also be based on the latter directly. This will help an early user of it: KVM while initializing mp_state. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-03-04Allocate memory below 4GB as one chunkAvi Kivity1-9/+2
Instead of allocating a separate chunk for the first 640KB and another for 1MB+, allocate one large chunk. This plays well in terms of alignment and size with large pages. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-02-19QEMU e820 reservation patchJes Sorensen1-0/+35
Hi, Kevin and I have agreed on the approach for this one now. So here is the latest version of the patch for QEMU, submitting e820 reservation entries via fw_cfg. Cheers, Jes Use qemu-cfg to provide the BIOS with an optional table of e820 entries. Notify the BIOS of the location of the TSS+EPT range to by reserving it via the e820 table. This matches a corresponding patch for Seabios, however older versions of Seabios will default to the hardcoded address range and stay compatible with current QEMU. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19pc: Add backward compatibility options for virtio-serialAmit Shah1-0/+28
virtio-serial-pci can support multiple ports in the current development version that will become 0.13. Add compatibility options for the 0.12 and 0.11 pc machine types. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19pc: Bump up pc version to 0.13 and add a 0.12 compat versionAmit Shah1-1/+9
The version 0.13 will be the new default and compatibility options will be added to the 0.12 version. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-14Remove conditional rom loading supportBlue Swirl1-3/+0
Commit c2039bd0ffce8807e0eaac55254fde790825fa92 made rom loading automatic for non-PC architectures. Remove now mostly unused conditional rom loading support. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-07fdc: don't use reserved _t suffixBlue Swirl1-1/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-01-20virtio-console: qdev conversion, new virtio-serial-busAmit Shah1-10/+1
This commit converts the virtio-console device to create a new virtio-serial bus that can host console and generic serial ports. The file hosting this code is now called virtio-serial-bus.c. The virtio console is now a very simple qdev device that sits on the virtio-serial-bus and communicates between the bus and qemu's chardevs. This commit also includes a few changes to the virtio backing code for pci and s390 to spawn the virtio-serial bus. As a result of the qdev conversion, we get rid of a lot of legacy code. The old-style way of instantiating a virtio console using -virtioconsole ... is maintained, but the new, preferred way is to use -device virtio-serial -device virtconsole,chardev=... With this commit, multiple devices as well as multiple ports with a single device can be supported. For multiple ports support, each port gets an IO vq pair. Since the guest needs to know in advance how many vqs a particular device will need, we have to set this number as a property of the virtio-serial device and also as a config option. In addition, we also spawn a pair of control IO vqs. This is an internal channel meant for guest-host communication for things like port open/close, sending port properties over to the guest, etc. This commit is a part of a series of other commits to get the full implementation of multiport support. Future commits will add other support as well as ride on the savevm version that we bump up here. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-19pc: add driver version compat propertiesGerd Hoffmann1-0/+16
This patch adds compat property entries for ide-disk.ver and scsi-disk.ver to pc-0.10 and pc-0.11. With this patch applied the scsi and ide disks report "0.10" and "0.11" as version when you start qemu with "-M pc-0.10" or "-M pc-0.11". Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-11pc: add rombar to compat properties for pc-0.10 and pc-0.11Gerd Hoffmann1-0/+8
So '-M pc-0.10' and '-M pc-0.11' will use the fw_cfg rom load method by default. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-11roms: rework rom loading via fwGerd Hoffmann1-2/+1
This patch changes the way rom loading via fw_cfg is handled. Instead of having pc_init1() call a function which passed all roms to the firmware config we simply pass a pointer to fw_cfg to the rom loader. Advantage: loading roms via firmware works also for devices which are initialized after pc_init1(), i.e. everyting added via -device. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-11pc: add machine type for 0.12Gerd Hoffmann1-1/+17
Add a new machine type for qemu 0.12. Also fixup the 0.11 machine type: msi for virtio-blk-pci was enabled after the 0.11 release, so turn it off in the 0.11 machine type. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-08multiboot: Separate multiboot loading into separate fileAdam Lackorzynski1-302/+3
Move multiboot loading code into separate files as suggested by Alex Graf. Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-08multiboot: Support arbitrary number of modules.Adam Lackorzynski1-101/+167
Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-25hw/pc.c: fix warnings with _FORTIFY_SOURCEKirill A. Shutemov1-3/+12
CC i386-softmmu/pc.o cc1: warnings being treated as errors /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c: In function 'load_multiboot': /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c:614: error: ignoring return value of 'fread', declared with attribute warn_unused_result /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c: In function 'load_linux': /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c:888: error: ignoring return value of 'fread', declared with attribute warn_unused_result /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c:889: error: ignoring return value of 'fread', declared with attribute warn_unused_result make[1]: *** [pc.o] Error 1 Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>