aboutsummaryrefslogtreecommitdiffstats
path: root/hw/pc.c
AgeCommit message (Collapse)AuthorFilesLines
2012-01-27isa: pic: convert to QEMU Object ModelAnthony Liguori1-7/+13
This converts two devices at once because PIC subclasses ISA and converting subclasses independently is extremely hard. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-23Merge remote-tracking branch 'qemu-kvm/uq/master' into stagingAnthony Liguori1-7/+13
* qemu-kvm/uq/master: kvm: Activate in-kernel irqchip support kvm: x86: Add user space part for in-kernel IOAPIC kvm: x86: Add user space part for in-kernel i8259 kvm: x86: Add user space part for in-kernel APIC kvm: x86: Establish IRQ0 override control kvm: Introduce core services for in-kernel irqchip support memory: Introduce memory_region_init_reservation ioapic: Factor out base class for KVM reuse ioapic: Drop post-load irr initialization i8259: Factor out base class for KVM reuse i8259: Completely privatize PicState apic: Open-code timer save/restore apic: Factor out base class for KVM reuse apic: Introduce apic_report_irq_delivered apic: Inject external NMI events via LINT1 apic: Stop timer on reset kvm: Move kvmclock into hw/kvm folder msi: Generalize msix_supported to msi_supported hyper-v: initialize Hyper-V CPUID leaves. hyper-v: introduce Hyper-V support infrastructure. Conflicts: Makefile.target Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-22vga: make Cirrus ISA device optionalBlue Swirl1-1/+1
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-01-22vga: improve VGA logicBlue Swirl1-5/+0
Improve VGA selection logic, push check for device availabilty to vl.c. Create the devices at board level unconditionally. Remove now unused pci_try_create*() functions. Make PCI VGA devices optional. Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-01-19kvm: x86: Add user space part for in-kernel APICJan Kiszka1-5/+10
This introduces the alternative APIC device which makes use of KVM's in-kernel device model. External NMI injection via LINT1 is emulated by checking the current state of the in-kernel APIC, only injecting a NMI into the VCPU if LINT1 is unmasked and configured to DM_NMI. MSI is not yet supported, so we disable this when the in-kernel model is in use. CC: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-01-19kvm: x86: Establish IRQ0 override controlJan Kiszka1-1/+2
KVM is forced to disable the IRQ0 override when we run with in-kernel irqchip but without IRQ routing support of the kernel. Set the fwcfg value correspondingly. This aligns us with qemu-kvm. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-01-19msi: Generalize msix_supported to msi_supportedJan Kiszka1-2/+2
Rename msix_supported to msi_supported and control MSI and MSI-X activation this way. That was likely to original intention for this flag, but MSI support came after MSI-X. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-01-04vmstate, memory: decouple vmstate from memory APIAvi Kivity1-3/+6
Currently creating a memory region automatically registers it for live migration. This differs from other state (which is enumerated in a VMStateDescription structure) and ties the live migration code into the memory core. Decouple the two by introducing a separate API, vmstate_register_ram(), for registering a RAM block for migration. Currently the same implementation is reused, but later it can be moved into a separate list, and registrations can be moved to VMStateDescription blocks. Signed-off-by: Avi Kivity <avi@redhat.com>
2011-12-22Set numa topology for max_cpusVasilis Liaskovitis1-4/+4
qemu-kvm passes numa/SRAT topology information for smp_cpus to SeaBIOS. However SeaBIOS always expects to setup max_cpus number of SRAT cpu entries (MaxCountCPUs variable in build_srat function of Seabios). When qemu-kvm runs with smp_cpus != max_cpus (e.g. -smp 2,maxcpus=4), Seabios will mistakenly use memory SRAT info for setting up CPU SRAT entries for the offline CPUs. Wrong SRAT memory entries are also created. This breaks NUMA in a guest. Fix by setting up SRAT info for max_cpus in qemu-kvm. Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-20isa: give ISABus/ISADevice to isa_create(), isa_bus_irqs() and isa_get_irq() ↵Hervé Poussineau1-14/+14
functions NULL is a valid bus/device, so there is no change in behaviour. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15qom: add vga node to the pc composition treeAnthony Liguori1-10/+16
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-06fix spelling in hw sub directoryDong Xu Wang1-1/+1
Correct obvious spelling errors in qemu/hw directory. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-11hw/pc.c: Fix use-while-uninitialized of fd_type[]Peter Maydell1-3/+1
Fix a use-while-uninitialized of the fd_type[] array (introduced in commit 34d4260e1, noticed by Coverity). This is more theoretical than practical, since it's quite hard to get here with floppy==NULL (the qdev_try_create() of the isa-fdc device has to fail). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-07disable automatic loading of sgabios when -nographicPaolo Bonzini1-9/+0
sgabios hasn't gotten a lot of coverage since it was not shipped. For 1.0, let's disable the automatic loading of the option ROM in -nographic mode. We can put it back for 1.1. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-02Fix X86 CPU topology in KVM modeBharata B Rao1-1/+0
apic id returned to guest kernel in ebx for cpuid(function=1) depends on CPUX86State->cpuid_apic_id which gets populated after the cpuid information is cached in the host kernel. This results in broken CPU topology in guest. Fix this by setting cpuid_apic_id before cpuid information is passed to the host kernel. This is done by moving the setting of cpuid_apic_id to cpu_x86_init() where it will work for both KVM as well as TCG modes. Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Bharata B Rao <bharata.rao@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-21pc: Fix floppy drives with if=noneKevin Wolf1-11/+14
Commit 63ffb564 broke floppy devices specified on the command line like -drive file=...,if=none,id=floppy -global isa-fdc.driveA=floppy because it relies on drive_get() which works only with -fda/-drive if=floppy. This patch resembles what we're already doing for IDE, i.e. remember the floppy device that was created and use that to extract the BlockDriverStates where needed. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2011-10-16pc: Fix and clean up PIC-to-APIC IRQ pathJan Kiszka1-3/+0
The master PIC is connected to the LINTIN0 of the APICs. As the APIC currently does not track the state of that line, we have to ask the PIC to reinject its IRQ after the CPU picked up an event from the APIC. This introduces pic_get_output to read the master PIC IRQ line state without changing it. The APIC uses this function to decide if a PIC IRQ should be reinjected on apic_update_irq. This reflects better how the real hardware works. The patch fixes some failures of the kvm unit tests apic and eventinj by allowing to enable the proper CPU IRQ deassertion when the guest masks some pending IRQs at PIC level. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-16pc: Generalize ISA IRQs to GSIsJan Kiszka1-9/+9
The ISA bus IRQ range is 0..15. What isa_irq_handler and IsaIrqState are actually dealing with are the Global System Interrupts. Refactor the code to clarify this. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-16pc: Drop useless test from isa_irq_handlerJan Kiszka1-3/+2
IsaIrqState::ioapic is always non-NULL. Probably, the concrete qemu_irq was supposed to be tested, but that's already done by qemu_set_irq. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-11pc: Convert port92 to isa_register_ioportRichard Henderson1-3/+13
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-23pc: Unbreak ROM mapping for ISA machineJan Kiszka1-4/+4
This is based on the original fix by Hervé Poussineau: pc_memory_init actually takes a memory region for mapping BIOS and extension ROMs. That equals the PCI memory region if PCI is available, but must be system memory in the ISA case. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-03Use new macro QEMU_PACKED for packed structuresStefan Weil1-2/+2
Most changes were made using these commands: git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/' git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/' git grep -la '__attribute__((__packed__))'|xargs perl -pi -e 's/__attribute__\(\(__packed__\)\)/QEMU_PACKED/' git grep -la '__attribute__ ((__packed__))'|xargs perl -pi -e 's/__attribute__ \(\(__packed__\)\)/QEMU_PACKED/' git grep -la '__attribute((packed))'|xargs perl -pi -e 's/__attribute\(\(packed\)\)/QEMU_PACKED/' Whitespace in linux-user/syscall_defs.h was fixed manually to avoid warnings from scripts/checkpatch.pl. Manual changes were also applied to hw/pc.c. I did not fix indentation with tabs in block/vvfat.c. The patch will show 4 errors with scripts/checkpatch.pl. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-22440fx: fix PAM, PCI holesAvi Kivity1-4/+7
The current implementation of PAM and the PCI holes is broken in several ways: - PCI BARs are not restricted to the PCI hole (a BAR may hide memory) - PCI devices do not respect PAM (if a PCI device maps a region while PAM maps the region to RAM, the request will be honored) This patch fixes things by introducing a pci address space, and using memory region aliases to represent PAM regions, SMRAM, and PCI holes. The memory hierarchy looks something like system_memory | +--- low memory alias (0-0xe0000000) | | | +-- ram@0 | +--- high memory alias (0x100000000-EOM) | | | +-- ram@0xe0000000 | +--- pci hole alias (end of low memory-0x100000000) | | | +-- pci@end-of-low-memory | | +--- pam[n] (0xc0000-0xc3fff etc) (when set to pci, priority 1) | | | +-- pci@0xc4000 etc | +--- smram (0xa0000-0xbffff) (when set to pci/vga, priority 1) | +-- pci@0xa0000 etc ram (simple ram region) pci | +--- BARn | +--- VGA 0xa0000-0xbffff | +--- ROMs Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22vga: drop get_system_memory() from vga devices and derivativesAvi Kivity1-1/+2
Instead, use the bus accessors, or get the address space directly from the board constructor. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-11/+11
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12pc: make vgabios exit port more usefulAnthony Liguori1-2/+2
We've always listened on port 501 for vgabios panic messages. In the entire time I've worked on QEMU, I've never actually seen a vgabios panic message :-) If we change the semantics of this port a little bit, it makes it possible to use it for more interesting use-cases. I chose this approach instead of adding a new I/O port because it avoids having a guest visible change. This change allows single-byte access to port 501 and also uses the value written to construct an exit code. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-29pc: convert pc_memory_init() to memory APIAvi Kivity1-19/+40
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-29pc: grab system_memoryAvi Kivity1-1/+2
While eventually this should come from the machine initialization function, take a short cut to avoid converting all machines now. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-07Add an isa device for SGAGlauber Costa1-0/+9
This patch adds a dummy legacy ISA device whose responsibility is to deploy sgabios, an option rom for a serial graphics adapter. The proposal is that this device is always-on when -nographics, but can otherwise be enable in any setup when -device sga is used. [v2: suggestions on qdev by Markus ] [v3: cleanups and documentation, per list suggestions ] Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-05-08pc, Disable vmport initialisation with Xen.Anthony PERARD1-3/+8
This is because there is not synchronisation of the vcpu register between Xen and QEMU, so vmport can't work properly. This patch introduces no_vmport parameter to pc_basic_device_init. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-08pc_memory_init: Move memory calculation to the caller.Anthony PERARD1-14/+3
This patch moves above_4g_mem_size and below_4g_mem_size calculation in the caller of pc_memory_init (pc_init1). And the prototype of pc_memory_init is changed because there is no need anymore to have variable pointer and the ram_size parameter. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-03-22vmmouse: Fix initializationJan Kiszka1-0/+1
Latest refactorings left vmmouse nonfunctional behind. Fix it by adding the required device initialization. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-03-12pc: fix wrong CMOS values for floppy drivesBlue Swirl1-1/+1
Before commit 63ffb564dca94f8bda01ed6d209784104630a4d2, states for floppy drives were calculated in fdc.c:fd_revalidate(). There it is also considered whether a disk is inserted or not. The commit didn't copy the logic completely to pc.c, which caused a regression. Fix by adding the same check also to pc.c. Reported-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Tested-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20pc: remove test on TARGET_PHYS_ADDR_BITS == 32Aurelien Jarno1-7/+0
Both i386 and x86_64 targets are now using target_phys_bits=64. Remove useless code. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-20i8254: convert to qdevBlue Swirl1-3/+2
Convert to qdev. Don't expose PITState. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20fdc: refactor device creationBlue Swirl1-12/+19
Turn fdc_init_isa into an inline function. Get floppy geometry directly from the drives. Don't expose FDCtrl. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-20fdc: use FDriveType for floppy drive typeBlue Swirl1-8/+11
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12hpet: make optionalBlue Swirl1-4/+7
Ignore failure with hpet device creation. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12x86: make vmmouse optionalBlue Swirl1-2/+4
Compile vmmouse in hwlib. Ignore failure if vmmouse device can't be created. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12vmmouse: convert to qdevBlue Swirl1-2/+3
Convert to qdev, also add a proper reset function. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12vmport: convert to qdevBlue Swirl1-0/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-12x86,MIPS: make vmware_vga optionalBlue Swirl1-3/+8
Allow failure with vmware_vga device creation and use standard VGA instead. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-25audio: consolidate audio_init()Isaku Yamahata1-17/+0
consolidate audio_init() and remove references to shoundhw. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-06pc: move port 92 stuff back to pc.c from pckbd.cBlue Swirl1-3/+86
956a3e6bb7386de48b642d4fee11f7f86a2fcf9a introduced a bug concerning reset bit for port 92. Since the keyboard output port and port 92 are not compatible anyway, let's separate them. Reported-by: Peter Lieven <pl@dlh.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com> -- v2: added reset handler and VMState
2010-12-27Merge branch 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemuAurelien Jarno1-0/+8
* 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemu: vnc/spice: add set_passwd monitor command. vnc: support password expire vnc: auth reject cleanup spice: add qmp 'query-spice' and hmp 'info spice' commands. spice: connection events. spice: add qxl device spice: add qxl vgabios binary.
2010-12-11Add bootindex for option roms.Gleb Natapov1-3/+4
Extend -option-rom command to have additional parameter ,bootindex=. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-09spice: add qxl deviceGerd Hoffmann1-0/+8
qxl is a paravirtual graphics card. The qxl device is the bridge between the guest and the spice server (aka libspice-server). The spice server will send the rendering commands to the spice client, which will actually render them. The spice server is also able to render locally, which is done in case the guest wants read something from video memory. Local rendering is also used to support display over vnc and sdl. qxl is activated using "-vga qxl". qxl supports multihead, additional cards can be added via '-device qxl". [ v2: add copyright to files ] [ v2: use qemu-common.h for standard includes ] [ v2: create separate qxl-vga device for primary ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-21pc: disable the BOCHS BIOS panic portBernhard Kohl1-2/+2
We have an OS which writes to port 0x400 when probing for special hardware. This causes an exit of the VM. With SeaBIOS this port isn't used anyway. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-By: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16pc: Fix e820 fw_cfg for big endianAlex Williamson1-7/+7
Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16pc: e820 qemu_cfg tables need to be packedAlex Williamson1-2/+2
We can't let the compiler define the alignment for qemu_cfg data. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>