Commit graph

5915 commits

Author SHA1 Message Date
Scott Wood 93dd5e852c kvm: ppc: booke206: use MMU API
Share the TLB array with KVM.  This allows us to set the initial TLB
both on initial boot and reset, is useful for debugging, and could
eventually be used to support migration.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:48:04 +02:00
Nishanth Aravamudan 6872205403 pseries: use macro for firmware filename
For some time we've had a nicely defined macro with the filename for our
firmware image.  However we didn't actually use it in the place we're
supposed to.  This patch fixes it.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:48:04 +02:00
David Gibson 827200a2df pseries: Add real mode debugging hcalls
PAPR systems support several hypercalls intended for use in real mode
debugging tools.  These implement reads and writes to arbitrary guest
physical addresses.  This is useful for real mode software because it
allows access to IO addresses and memory outside the RMA without going
through the somewhat involved process of setting up the hash page table
and enabling translation.

We want these so that when we add real IO devices, the SLOF firmware can
boot from them without having to enter virtual mode.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:48:04 +02:00
David Gibson f73a2575a3 pseries: More complete WIMG validation in H_ENTER code
Currently our implementation of the H_ENTER hypercall, which inserts a
mapping in the hash page table assumes that only ordinary memory is ever
mapped, and only permits mapping attribute bits accordingly (WIMG==0010).

However, we intend to start adding emulated IO to the pseries platform
(and real IO with PCI passthrough on kvm) which means this simple test
will no longer suffice.

This patch extends the h_enter validation code to check if the given
address is a RAM address.  If it is it enforces WIMG==0010, otherwise
it assumes that it is an IO mapping and instead enforces WIMG=010x.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:48:03 +02:00
David Gibson 9dfef5aae4 pseries: interrupt controller should not have a 'reg' property
The interrupt controller presented in the device tree for the pseries
machine is manipulated by the guest only through hypervisor calls.  It
has no real or emulated registers for the guest to access.

However, it currently has a bogus 'reg' property advertising a register
window.  Moreover, this property has an invalid format, being a 32-bit
zero, when the #address-cells property on the root bus indicates that it
needs a 64-bit address.  Since the guest never attempts to manipulate
the node directly, it works, but it is ugly and can cause warnings when
manipulating the device tree in other tools (such as future firmware
versions).

This patch, therefore, corrects the problem by entirely removing the
interrupt-controller node's 'reg' property.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:48:03 +02:00
David Gibson 0c103f8e69 pseries: Add a phandle to the xicp interrupt controller device tree node
Future devices we will be adding to the pseries machine (e.g. PCI) will
need nodes in the device tree which explicitly reference the top-level
interrupt controller via interrupt-parent or interrupt-map properties.

In order to do this, the interrupt controller node needs an assigned
phandle.  This patch adds the appropriate property, in preparation.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:48:02 +02:00
David Gibson cc67b9c899 pseries: Bugfixes for interrupt numbering in XICS code
The implementation of the XICS interrupt controller contains several
(difficult to trigger) bugs due to the fact that we were not 100%
consistent with which irq numbering we used.  In most places, global
numbers were used as handled by the presentation layer, however a few
functions took "local" numberings, that is the source number within
the interrupt source controller which is offset from the global
number.  In most cases the function and its caller agreed on this, but
in a few cases it didn't.

This patch cleans this up by always using global numbering.
Translation to the local number is now always and only done when we
look up the individual interrupt source state structure.  This should
remove the existing bugs and with luck reduce the chances of
re-introducing such bugs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:48:02 +02:00
Alexander Graf 0a8b293893 PPC: SPAPR: Use KVM function for time info
One of the things we can't fake on PPC is the timer speed. So
we need to extract the frequency information from the host and
put it back into the guest device tree.

Luckily, we already have functions for that from the non-pseries
targets, so all we need to do is to connect the dots and the guest
suddenly gets to know its real timer speeds.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:48:02 +02:00
Alexander Graf f61b4bedaf PPC: Enable to use PAPR with PR style KVM
When running PR style KVM, we need to tell the kernel that we want
to run in PAPR mode now. This means that we need to pass some more
register information down and enable papr mode. We also need to align
the HTAB to htab_size boundary.

Using this patch, -M pseries works with kvm even on non-hv kvm
implementations, as long as the preceding kernel patches are in.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - match on CONFIG_PSERIES

v2 -> v3:

  - remove HIOR pieces from PAPR patch (ABI breakage)
2011-10-06 09:48:02 +02:00
Alexander Graf a2a674204b PPC: E500: Bump CPU count to 15
Now that we have everything in place, make the machine description
aware of the fact that we can now handle 15 virtual CPUs!

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - Max cpus is 15 because of MPIC
2011-10-06 09:48:02 +02:00
Alexander Graf 1e3debf098 MPC8544DS: Generate CPU nodes on init
With this patch, we generate CPU nodes in the machine initialization, giving
us the freedom to generate as many nodes as we want and as the machine supports,
but only those.

This is a first step towards a much cleaner device tree generation
infrastructure, where we would not require precompiled dtb blobs anymore.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:48:02 +02:00
Alexander Graf 10f25a46c5 PPC: E500: Update cpu-release-addr property in cpu nodes
The guest OS wants to know where the guest spins, so let's tell him while
updating the CPU nodes with the frequencies anyways.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - use new spin table address
2011-10-06 09:48:00 +02:00
Alexander Graf 5c145dacac PPC: E500: Add PV spinning code
CPUs that are not the boot CPU need to run in spinning code to check if they
should run off to execute and if so where to jump to. This usually happens
by leaving secondary CPUs looping and checking if some variable in memory
changed.

In an environment like Qemu however we can be more clever. We can just export
the spin table the primary CPU modifies as MMIO region that would event based
wake up the respective secondary CPUs. That saves us quite some cycles while
the secondary CPUs are not up yet.

So this patch adds a PV device that simply exports the spinning table into the
guest and thus allows the primary CPU to wake up secondary ones.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - change into MMIO scheme
  - map the secondary NIP instead of 0 1:1
  - only map 64MB for TLB, same as u-boot
  - prepare code for 64-bit spinnings

v2 -> v3:

  - remove r6
  - set MAS2_M
  - map EA 0
  - use second TLB1 entry

v3 -> v4:

  - change to memoryops

v4 -> v5:

  - fix endianness bugs

v5 -> v6:

  - add header
2011-10-06 09:47:52 +02:00
Alexander Graf 66bc7e0040 PPC: E500: Remove unneeded CPU nodes
We should only keep CPU nodes in the device tree around that we really have
virtual CPUs for. So remove all superfluous entries that we just keep there
in case someone wants to create a lot of vCPUs.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:35 +02:00
Alexander Graf 621d05e301 PPC: E500: Update freqs for all CPUs
Now that we can so nicely find out the host's frequencies, we should also
make sure that we get them into all virtual CPUs' device tree nodes.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:35 +02:00
Alexander Graf 7dadd40c89 PPC: bamboo: Use kvm api for freq and clock frequencies
Now that we have nice and shiny APIs to read out the host's clock and timebase
frequencies, let's use them in the bamboo code as well!

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:34 +02:00
Alexander Graf 66ae790247 PPC: E500: Remove mpc8544_copy_soc_cell
We don't need mpc8544_copy_soc_cell anymore, since we're explicitly reading
host values and writing guest values respectively.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:34 +02:00
Alexander Graf 911d6e7ad1 PPC: E500: Use generic kvm function for freq
Now that we have generic KVM functions to read out the host tb and clock
frequencies, let's use them in the e500 code!

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:34 +02:00
Alexander Graf a489f7f711 PPC: bamboo: Move host fdt copy to target
We have some code in generic kvm_ppc.c that is only used by 440. Move to
the 440 specific device code.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:34 +02:00
Alexander Graf a915249fa1 PPC: E500: Generate IRQ lines for many CPUs
Now that we can generate multiple envs for all our virtual CPUs, we
also need to tell the MPIC that we have multiple CPUs connected and
connect them all to the respective virtual interrupt lines.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:33 +02:00
Alexander Graf e61c36d58d PPC: E500: create multiple envs
When creating a VM, we should go through smp_cpus and create a virtual CPU for
every CPU the user requested. This patch adds support for that and moves some
code around to make that more convenient.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:33 +02:00
Alexander Graf bbc5842211 PPC: Bump MPIC up to 32 supported CPUs
The MPIC emulation is now capable of handling up to 32 CPUs. Reflect that in
the code exporting the numbers out and fix an integer overflow while at it.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - Max cpus is 15 due to cINT routing
  - Report nb_cpus not MAX_CPUS in MPIC capabilities
2011-10-06 09:43:33 +02:00
Alexander Graf 0d33defbe3 PPC: MPIC: Fix CI bit definitions
The bit definitions for critical interrupt routing are in PowerPC order
(most significant bit is 0), while we end up shifting it with normal bit
order. Turn the numbers around so we actually end up fetching the
right ones.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:33 +02:00
Alexander Graf 3ee82442c5 PPC: MPIC: Remove read functionality for WO registers
The IPI dispatch registers are write only according to every MPIC
spec I have found. So instead of pretending you could read back something
from them, better not handle them at all.

Reported-by: Elie Richa <richa@adacore.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:33 +02:00
Alexander Graf 9250fd24a9 PPC: Set MPIC IDE for IPI to 0
We use the IDE register with IPIs as a mask to keep track which processors
have already acknowledged the respective interrupt. So we need to initialize
it to 0 to make sure that it doesn't accidently fire an IPI on CPU0 when the
first IPI is triggered.

Reported-by: Elie Richa <richa@adacore.com>
Signed-off-by: Alexander Graf <agraf@suse.de>

---

v2 -> v3:

  - fix IDE IPI reset
2011-10-06 09:43:33 +02:00
Alexander Graf a675155e2d PPC: Fix IPI support in MPIC
The current IPI support in the MPIC code is incomplete and doesn't work. This
code adds proper support for IPIs in MPIC by using the IDE register to remember
which CPUs IPIs are still outstanding to. New triggers through the IPI trigger
register only add to the list of CPUs we want to IPI.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - Use MAX_IPI instead of hardcoded 4

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:33 +02:00
Alexander Graf bc59d9c916 PPC: Extend MPIC MMIO range
The MPIC exports a page for each CPU that it controls. To support more than
one CPU, we need to also reserve the MMIO space according to the amount of
CPUs we want to support.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:33 +02:00
Alexander Graf 704c7e5d0f PPC: Add CPU local MMIO regions to MPIC
The MPIC exports a register set for each CPU connected to it. They can all
be accessed through specific registers or using a shadow page that is mapped
differently depending on which CPU accesses it.

This patch implements the shadow map, making it possible for guests to access
the CPU local registers using the same address on each CPU.

Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:33 +02:00
Paolo Bonzini 416343b144 spapr: make irq customizable via qdev
This also lets the user see the irq in "info qtree".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:32 +02:00
Paolo Bonzini 77c7ea5ebb spapr: prepare for qdevification of irq
Restructure common properties for sPAPR devices so that IRQ definitions
can be added in one place.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:32 +02:00
Paolo Bonzini 277f9acf79 spapr: proper qdevification
Right now the spapr devices cannot be instantiated with -device,
because the IRQs need to be passed to the spapr_*_create functions.
Do this instead in the bus's init wrapper.

This is particularly important with the conversion from scsi-disk
to scsi-{cd,hd} that Markus made.  After his patches, if you
specify a scsi-cd device attached to an if=none drive, the default
VSCSI controller will not be created and, without qdevification,
you will not be able to add yours.

NOTE from agraf: added small compile fix

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2011-10-06 09:43:32 +02:00
Jan Kiszka 4789bc39aa lsi: Fix tag reference in debug print
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-10-05 09:19:05 +01:00
Antony Pavlov f6c6106537 gt64xxx.c: remove reference to non-existing ISD_handle field
The commit fc2bf44972
removed ISD_handle field from struct GT64120State,
so remove the field from DPRINTF too.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-10-05 09:19:05 +01:00
Antony Pavlov ce8d2800f7 gt64xxx.c: fix length modifier in DPRINTF format string
The commit fc2bf44972
changed the type of val argument of the function gt64120_writel()
from uint32_t to uint64_t, so we need to change the corresponding
length modifier from "%x" to "%" PRIx64.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-10-05 09:19:05 +01:00
Luiz Capitulino 0461d5a699 RunState: Rename enum values as generated by the QAPI
Next commit will convert the query-status command to use the
RunState type as generated by the QAPI.

In order to "transparently" replace the current enum by the QAPI
one, we have to make some changes to some enum values.

As the changes are simple renames, I'll do them in one shot. The
changes are:

 - Rename the prefix from RSTATE_ to RUN_STATE_
 - RUN_STATE_SAVEVM to RUN_STATE_SAVE_VM
 - RUN_STATE_IN_MIGRATE to RUN_STATE_INMIGRATE
 - RUN_STATE_PANICKED to RUN_STATE_INTERNAL_ERROR
 - RUN_STATE_POST_MIGRATE to RUN_STATE_POSTMIGRATE
 - RUN_STATE_PRE_LAUNCH to RUN_STATE_PRELAUNCH
 - RUN_STATE_PRE_MIGRATE to RUN_STATE_PREMIGRATE
 - RUN_STATE_RESTORE to RUN_STATE_RESTORE_VM
 - RUN_STATE_PRE_MIGRATE to RUN_STATE_FINISH_MIGRATE

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-10-04 11:02:57 -03:00
Michael Walle 779277cab4 milkymist: new interrupt map
Due to the new uart core version the interrupt mapping has changed.

Signed-off-by: Michael Walle <michael@walle.cc>
2011-10-03 12:44:22 +02:00
Michael Walle fcfa339778 milkymist_uart: support new core version
The new version of the uart core introduces status and control bits.

Signed-off-by: Michael Walle <michael@walle.cc>
2011-10-03 12:44:22 +02:00
Edgar E. Iglesias d11cf8cc80 etrax-dma: Remove bogus if statement
Reported-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-10-03 10:20:13 +02:00
Michael Walle 306f66b42f milkymist-{minimac2,softusb}: rename memory names
Be consistent with other milkymist models.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:03 +02:00
Michael Walle 883abf8d2c milkymist-vgafb: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:03 +02:00
Michael Walle 5adb30d38b milkymist-uart: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:03 +02:00
Michael Walle 7100453f2e milkymist-tmu2: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:03 +02:00
Michael Walle dfa87ccfad milkymist-sysctl: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:03 +02:00
Michael Walle d46ccfcef3 milkymist-pfpu: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:03 +02:00
Michael Walle 8c85d15b3f milkymist-memcard: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:03 +02:00
Michael Walle 321c17ae97 milkymist-hpdmc: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:02 +02:00
Michael Walle 9496e1c335 milkymist-ac97: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:02 +02:00
Fabien Chouteau 71cf9e6242 openpic: Memory API conversion for mpic
This patch converts mpic to the new memory API (through old mmio).

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:02 +02:00
Peter Maydell 5a95b51dd8 hw/smc91c111: Convert to MemoryRegion
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:02 +02:00
Richard Henderson 38bc50f7e2 sun4u: Pass address_space_mem to sun4uv_init
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:02 +02:00
Richard Henderson 27a9d2eacb sm501: Pass address_space_mem to sm501_init
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:02 +02:00
Richard Henderson a6dc4c2d95 pxa: Pass in address_space to pxa{255, 270}_init
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:02 +02:00
Richard Henderson 3e9f0113b4 ppc440: Pass in address_space_mem to ppc440ep_init
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:02 +02:00
Richard Henderson 52ce55a102 ppc405: Pass in address_space_mem to ppc405{cr, ep}_init
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:02 +02:00
Richard Henderson 39186d8ab8 serial: Add MemoryRegion parameter to serial_mm_init
Remove the get_system_memory() call from serial_mm_init, pushing
it back into the callers.  In many cases we already have the
system memory region available.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:02 +02:00
Richard Henderson 2ff0c7c3c2 serial: Remove ioregister parameter from serial_mm_init
All callers passed 1.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:01 +02:00
Richard Henderson fb50cfe44d serial: Use enum device_endian in serial_mm_init parameter
The use of DEVICE_NATIVE_ENDIAN cleans up lots of ifdefs in
many of the callers.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:01 +02:00
Richard Henderson 8e8ffc44e8 serial: Convert serial_mm_init to MemoryRegion
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:01 +02:00
Edgar E. Iglesias 06dccb82df etrax-eth: Convert to MemoryRegion
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:01 +02:00
Edgar E. Iglesias 9dcb06ce1d etrax-dma: Convert to MemoryRegion
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:01 +02:00
Edgar E. Iglesias b8e5da2c59 etrax-timer: Convert to MemoryRegion
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:01 +02:00
Edgar E. Iglesias dbfb57f3b1 etrax-ser: Convert to MemoryRegion
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:01 +02:00
Edgar E. Iglesias 5dd25f368c etrax-pic: Convert to MemoryRegion
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-10-02 16:14:01 +02:00
Blue Swirl bf4b9889ab ESP: convert to trace framework
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-01 09:28:40 +00:00
Alexander Graf b39491a83d PPC: Drop initial ESCC mapping
We are mapping ESCC to a static (incorrect) address on machine init. This
overlaps with our vram, rendering the screen barely usable.

Since openBIOS is clever enough to map ESCC to where it needs to be, we can
just drop that invalid map and everyone's happy.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-01 06:45:35 +00:00
Jan Kiszka 7e17a21706 mips_fulong2e: Reorder ISA bus and i8259 creation
Missed during memory region conversion: The i8259 now depends on the ISA
bus being created first. Reorder the initialization.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-10-01 06:23:52 +00:00
Anthony Liguori 62ec6073cd Merge remote-tracking branch 'aneesh/for-upstream-5' into staging 2011-09-29 13:32:05 -05:00
Blue Swirl 46f3069cba PPC: use memory API to construct the PCI hole
Avoid vga.chain4 mapping by constructing a PCI hole for upper
2G of the PCI space.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-27 19:16:46 +00:00
Anthony Liguori 3b7653ac48 Merge remote-tracking branch 'qemu-kvm-tmp/memory/urgent' into staging 2011-09-26 08:00:47 -05:00
Anthony Liguori 4c54661feb Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging 2011-09-26 08:00:40 -05:00
Anthony Liguori 2f977dd7e8 Merge remote-tracking branch 'pmaydell/omap-for-upstream' into staging 2011-09-26 08:00:00 -05:00
Avi Kivity 12da94ff8f ppc_prep: fix pci config space initialization
Use data_mem for the data mmio region, not conf_mem.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 17:15:43 +03:00
Richard Henderson 2f290a8c3d fdc: Convert isabus_fdc_init1 to MemoryRegion
This requires some amount of hoop-jumping, so that we don't
inadvertently claim port 0x3f6, which is used by ISA IDE.

The sysbus initialization path is as yet unconverted.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:37 +03:00
Richard Henderson a941ae4515 serial: Convert serial_isa_initfn to MemoryRegion
The serial_mm_init path is as yet unconverted.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:37 +03:00
Richard Henderson dbff76ac33 pckbd: Convert to MemoryRegion
Slightly non-obvious with mips_jazz passing in the region
structure to populate.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:37 +03:00
Richard Henderson 098d314a32 i8259: Convert to MemoryRegion
The only non-obvious part is pic_poll_read which used
"addr1 >> 7" to detect whether one referred to either
the master or slave PIC.  Instead, test this directly.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:37 +03:00
Avi Kivity bac8ad41ab ppc_prep: initialize i8259 after the ISA bus
Succeeding i8259 conversion to ISA requires this.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:37 +03:00
Avi Kivity a4ac5e64de mips_r4k: initialize i8259 after the ISA bus
Succeeding i8259 conversion to ISA requires this.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:37 +03:00
Avi Kivity e155c99be9 mips_jazz: initialize i8259 after the ISA bus
Succeeding i8259 conversion to ISA requires this.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Avi Kivity 5632ae46d5 mips_malta: move i8259 initialization after piix4 initialization
i8259 is an ISA device (or at least, depends on the ISA infrastructure to
register its ioport); and the ISA bus is supplied by piix4.  Later patches
make this dependency explicit.

Use qemu_irq_proxy() to stop the cycle by adding an extra layer of
indirection.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson 60ea6aa8fc i8254: Convert to MemoryRegion
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson beae397945 cs4231a: Convert to MemoryRegion
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson 4bae1efe63 pc: Re-order pc_init1 to initialize the ISA bus before ISA devices
In particular, the i8259 was being initialized before the ISA bus,
leading to a crash.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson 78e2059352 isa: add isa_register_ioport()
To replace isa_init_ioport and isa_init_ioport_range
as the ISA devices are converted to the memory api.

[avi: use memory_region_size()]

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson c2d0d01202 isa: Pass i/o address space to isa_bus_new
Not used yet, but at least we're provided with the correct region.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:35 +03:00
Richard Henderson e11d64390b pci: add pci_address_space_io()
Returns the I/O address space.  Useful for implementing
PCI-ISA bridge devices.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:57:47 +03:00
Hervé Poussineau e8beeae4c0 adlib: remove write-only variable
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 13:42:33 -05:00
Avi Kivity 22ec3283ef irq: introduce qemu_irq_proxy()
In some cases we have a circular dependency involving irqs - the irq
controller depends on a bus, which in turn depends on the irq controller.
Add qemu_irq_proxy() which acts as a passthrough, except that the target
irq may be set later on.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 11:51:05 -05:00
David Gibson b90d2f3512 virtio: Use global memory barrier macros
The virtio code uses wmb() macros in several places, as required by the
SMP-aware virtio protocol.  However the wmb() macro is locally defined
to be a compiler barrier only.  This is probably sufficient on x86
due to its strong storage ordering model, but it certainly isn't on other
platforms, such as ppc.

In any case, qemu already has some globally defined memory barrier macros
in qemu-barrier.h.  This patch, therefore converts virtio.c to use those
barrier macros.  The macros in qemu-barrier.h are also wrong (or at least,
safe for x86 only) but this way at least there's only one place to fix
them.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 11:51:05 -05:00
Donald Dutile ffe3ce1173 pci-devfn: check that device/slot number is within range
Need to check that guest slot/device number is not > 31 or walk off
the devfn table when checking if a devfn is available or not in a guest.

before this fix, passing in an addr=abc  or addr=34,
can crash qemu, sometimes fail gracefully if data past end
of devfn table fails the availability test.

with this fix, get clean error:
Property 'pci-assign.addr' doesn't take value '34'

also tested when no addr= param passed for guest (pcicfg) address,
and that worked as well.

Signed-off-by: Don Dutile <ddutile@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 10:55:34 -05:00
Hervé Poussineau c1d23eaccc isapc: give system address space when pci is disabled
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 10:55:34 -05:00
Jan Kiszka 4c08fd1e42 cirrus: Unbreak ISA support
Do not try to map against the PCI bar in the ISA version of the device.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 10:55:33 -05:00
Jan Kiszka 53d6e68255 vga: Unbreak ISA support
We need to initialize legacy_address_space during ISA VGA setup so that
the chain-4 alias can be registered properly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 10:55:33 -05:00
Jan Kiszka 57285cc3c6 pc: Disable HPET for ISA machine
There was no HPET on ISA boxes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 10:55:33 -05:00
Jan Kiszka 4463aee630 pc: Unbreak ROM mapping for ISA machine
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-23 10:55:33 -05:00
dann frazier dd8e93799f e1000: Don't set the Capabilities List bit
[Originally sent to qemu-kvm list, but I was redirected here]

The Capabilities Pointer is NULL, so this bit shouldn't be set. The state of
this bit doesn't appear to change any behavior on Linux/Windows versions we've
tested, but it does cause Windows' PCI/PCI Express Compliance Test to balk.

I happen to have a physical 82540EM controller, and it also sets the
Capabilities Bit, but it actually has items on the capabilities list to go
with it :)

Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 10:55:32 -05:00
Peter Maydell bdbc1b3cd4 hw/omap1: Wire up GPIO clock
Wire up the OMAP1 GPIO clock -- this fixes a hw_error() on startup
with OMAP1 based machines (sx1, cheetah).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-09-23 09:54:56 +00:00
Peter Maydell 0919ac7876 omap_intc: Qdevify
Convert the omap_intc devices to qdev. This includes adding
a 'revision' property which will be needed for omap3.

The bulk of this patch is the replacement of "s->irq[x][y]"
with  "qdev_get_gpio_in(s->ih[x], y)" now that the interrupt
controller exposes its input lines as qdev gpio inputs.

The devices are named "omap-intc" and "omap2-intc", following
the filename and the OMAP2/3 hardware names, although some
internal functions are still named "omap_inth_*".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-09-23 09:44:38 +00:00
Peter Maydell 53bb614ee3 omap_intc: Use MemoryRegion API
Convert omap_intc to use the MemoryRegion API

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-09-23 09:44:38 +00:00
Peter Maydell 7e36b264ce hw/omap_gpmc: Modify correct field when writing IRQSTATUS register
Writing to IRQSTATUS should affect irqst, not irqen -- error
spotted by Andrzej Zaborowski.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-09-23 08:36:58 +02:00
Peter Maydell 7196345549 hw/omap_gpmc: Add comment about FIFOTHRESHOLDSTATUS bit
Promote the remark about why we handle FIFOTHRESHOLDSTATUS the
way we do from the commit message of de8af7fe0 to a comment in
the code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-09-23 08:36:36 +02:00
Aneesh Kumar K.V 5f5422258e hw/9pfs: Add handle based fs driver
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:53 +05:30
Aneesh Kumar K.V bccacf6c79 hw/9pfs: Implement TFLUSH operation
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V ce421a1961 hw/9pfs: Avoid unnecessary get_fid in v9fs_clunk
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 532decb715 hw/9pfs: Add fs driver specific details to fscontext
Add a new context flag PATHNAME_FSCONTEXT and indicate whether
the fs driver track fid using path names. Also add a private
pointer that help us to track fs driver specific values in there

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 0174fe73e6 hw/9pfs: Add init callback to fs driver
This call back can be used to do fs driver specific initialization.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 2289be19ae hw/9pfs: Move fid pathname tracking to seperate data type.
This enables us to add handles to track fids later. The
V9fsPath added is similar to V9fsString except that the
size include the NULL byte also.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 02cb7f3a25 hw/9pfs: Use read-write lock for protecting fid path.
On rename we take the write lock and this ensure path
doesn't change as we operate on them.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 70c18fc08b hw/9pfs: Make v9fs_string* functions non-static
We will use them later in other files

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Anthony Liguori d85a1302a9 Merge remote-tracking branch 'kwolf/for-anthony' into staging 2011-09-22 10:31:26 -05:00
Anthony Liguori 9ba2a054db Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-09-22 10:29:42 -05:00
Anthony Liguori bdd2672109 Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging 2011-09-22 10:27:14 -05:00
Daniel Verkamp 465f1ab161 ahci: add port I/O index-data pair
Implement an I/O space index-data register pair as defined by the AHCI
spec, including the corresponding SATA PCI capability and BAR.

This allows real-mode code to access the AHCI registers; real-mode
code cannot address the memory-mapped register space because it is
beyond the first megabyte.

Signed-off-by: Daniel Verkamp <daniel@drv.nu>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-21 14:32:20 +02:00
Jan Kiszka 43b26fc851 Drop unneeded pthread.h inclusions
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-21 10:49:16 +01:00
Avi Kivity 2654c962b8 omap1: convert to memory API (part VI)
Easy RAM stuff.

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-21 11:14:42 +03:00
Avi Kivity 90aeba9dac soc_dma: drop soc_dma_port_add_mem_ram()
It's a trivial wrapper for soc_dma_port_add_mem(), which makes
the memory API conversion more difficult because it takes a ram
addr_t.  Drop.

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-21 11:14:38 +03:00
Avi Kivity 9898b79abe omap_lcdc: remove imif, emiff from structure
Not used.

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-21 11:14:35 +03:00
Avi Kivity 763b946c28 omap1: convert to memory API (part V)
Tricky aliases.

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-21 11:14:32 +03:00
Avi Kivity 60fe76e3ad omap1: convert to memory API (part IV)
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-21 11:14:30 +03:00
Avi Kivity a4ebbd18b1 omap1: convert to memory API (part III)
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-21 11:14:27 +03:00
Avi Kivity e7aa0ae034 omap1: convert to memory API (part II)
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-21 11:14:25 +03:00
Avi Kivity 4b3fedf3a5 omap1: convert to memory API (part I)
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-21 11:14:10 +03:00
Anthony Liguori 03c39eb558 Merge remote-tracking branch 'mst-tmp/for_anthony' into staging 2011-09-20 15:22:10 -05:00
Anthony Liguori c8af89af96 Merge remote-tracking branch 'kwolf/for-anthony' into staging 2011-09-20 15:21:03 -05:00
Anthony Liguori 7f67d8922e Merge remote-tracking branch 'qmp/queue/qmp' into staging 2011-09-20 15:16:00 -05:00
Michael S. Tsirkin 336411cafd pci_bridge: simplify memory regions some more
replace alloc/free with struct members.
todo: smash with initial implementation after
testing.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-09-20 17:46:12 +03:00
Paolo Bonzini bd5da23265 scsi: fix sign extension problems
When assigning a 32-bit value to cmd->xfer (which is 64-bits)
it can be erroneously sign extended because the intermediate
32-bit computation is signed.  Fix this by standardizing on
the ld*_be_p functions.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-20 12:27:44 +02:00
Alexander Motin a26a13da68 AHCI Port Interrupt Enable register cleaning on soft reset
I've found that FreeBSD AHCI driver doesn't work with AHCI hardware
emulation of QEMU 0.15.0. I believe the problem is on QEMU's side. As I
see, it clears port's Interrupt Enable register each time when reset of
any level happens. Is is reasonable for the global controller reset. It
is probably not good, but acceptable for FreeBSD driver for the port
hard reset. But it is IMO wrong for the device soft reset. None of real
hardware I know behaves that way.

Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-20 12:27:44 +02:00
Paolo Bonzini 7285477ab1 scsi-disk: lazily allocate bounce buffer
It will not be needed for reads and writes if the HBA provides a sglist.
In addition, this lets scsi-disk refuse commands with an excessive
allocation length, as well as limit memory on usual well-behaved guests.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-20 12:27:43 +02:00
Paolo Bonzini 103b40f51e scsi-disk: commonize iovec creation between reads and writes
Also, consistently use qiov.size instead of iov.iov_len.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-20 12:27:43 +02:00
Michael S. Tsirkin 7df32ca08a pci: implement bridge filtering
Support bridge filtering on top of the memory
API as suggested by Avi Kivity:

Create a memory region for the bridge's address space.  This region is
not directly added to system_memory or its descendants.  Devices under
the bridge see this region as its pci_address_space().  The region is
as large as the entire address space - it does not take into account
any windows.

For each of the three windows (pref, non-pref, vga), create an alias
with the appropriate start and size.  Map the alias into the bridge's
parent's pci_address_space(), as subregions.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-09-19 21:22:30 +03:00
Wen Congyang 778d179939 pci_bridge: use parent bus's address space
The switch to the new memory API caused the following problem:

The pci device may call pci_register_bar() to use PCI bus's address
space.  But we don't init PCI bus's address space if it is not bus
0.  A crash was reported:
http://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02243.html

More work will be needed to make bridge filtering work correctly
with the memory API.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-09-19 21:22:30 +03:00
Jan Kiszka a92eb87a44 pci: Remove unused mem_base from PCIBus
Obsoleted by f64e02b6cc.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-09-19 21:22:29 +03:00
Michael S. Tsirkin 817e0b6fe8 pci: interrupt pin documentation update
Fix up some erroneous comments in code:
interrupt pins are named A-D, the
interrupt pin register is always readonly
and isn't zeroed out on reset.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-09-19 21:22:29 +03:00
Jan Kiszka ab346bb23f pci: Remove unused pci_reserve_capability
eepro100 was the last user. Now pci_add_capability is powerful enough.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-09-19 21:22:29 +03:00
Paolo Bonzini bbca72c621 dma-helpers: rename is_write to to_dev
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-19 11:35:33 +02:00
Paolo Bonzini 1b8f8a6f91 scsi-generic: do not disable FUA
I found no rationale for this in the logs, and it is quite bad because
it will make scsi-generic unsafe WRT power failures.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-19 11:34:34 +02:00
Avi Kivity 19b4a424d8 musicpal: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-18 17:06:53 +03:00
Avi Kivity 0ae164504e mips_r4k: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-18 17:06:53 +03:00
Avi Kivity 23ebf23dd1 mips_mipssim: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-18 17:06:53 +03:00
Avi Kivity ea85df72b6 mips_malta: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-18 17:06:53 +03:00
Avi Kivity 60581b3777 mips_jazz: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-18 17:06:53 +03:00
Blue Swirl 530889ff95 sun4u: don't set up isa_mem_base
Since we use memory API in sun4u.c, after
71579cae30, setting up isa_mem_base
puts vga.chain4 outside of the physical address space.

Fix by removing obsolete isa_mem_base set up.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-18 12:00:19 +00:00
Stefan Hajnoczi 4e1837f855 trace: add virtio_set_status() trace event
The virtio device lifecycle can be observed by looking at the sequence
of set status operations.  This is especially important for catching the
reset operation (status value 0), which resets the device and all
virtqueues.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-17 15:14:24 +00:00
Gerd Hoffmann a8467c7a0e qdev: print bus properties too
Make qdev_device_help print both device and bus properties.
Helps libvirt to figure whenever bus properties such as
PCI.multifunction are supported present or not.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-16 09:06:28 -05:00
Jan Kiszka 71579cae30 vga: Respect isa_mem_base when registering chain4 alias
This does not yet unbreak PPC (which has its own problems) but
potentially other non-x86 systems where isa_mem_base is != 0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-16 09:06:28 -05:00
Peter Maydell df3f457b4b hw/integratorcp: Fix bugs in writes to CM_CTRL system register
Fix a number of bugs in the implementation of writes to the CM_CTRL
system register:
 * write to cm_ctrl, not cm_init !
 * an '&' vs '^' typo meant we would write the inverse of the bits
 * handling the LED via printf() meant we spew lots of output
   to stdout when Linux uses the LED as a heartbeat indicator
 * we would hw_error() if a reset was requested rather than
   actually resetting

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-16 08:28:46 -05:00
Jan Kiszka 2313e998d7 vga: Fix text mode screendumps
In text mode, even a full refresh of the screen takes multiple updates.
As we reset the dump file pointer after the first call, we only wrote
the first line.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-16 08:25:57 -05:00
Stefan Weil b2bedb2144 Remove blanks before \n in output strings
Those blanks violate the coding conventions, see
scripts/checkpatch.pl.

Blanks missing after colons in the changed lines were added.

This patch does not try to fix tabs, long lines and other
problems in the changed lines, therefore checkpatch.pl reports
many violations.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-16 08:25:56 -05:00
Luiz Capitulino 1354869c38 Drop the vm_running global variable
Use runstate_is_running() instead, which is introduced by this commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-15 16:39:32 -03:00
Luiz Capitulino 1dfb4dd993 Replace the VMSTOP macros with a proper state type
Today, when notifying a VM state change with vm_state_notify(),
we pass a VMSTOP macro as the 'reason' argument. This is not ideal
because the VMSTOP macros tell why qemu stopped and not exactly
what the current VM state is.

One example to demonstrate this problem is that vm_start() calls
vm_state_notify() with reason=0, which turns out to be VMSTOP_USER.

This commit fixes that by replacing the VMSTOP macros with a proper
state type called RunState.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2011-09-15 16:39:32 -03:00
Anthony Liguori c7fbbdf9c8 Merge remote-tracking branch 'aneesh/for-upstream-4' into staging 2011-09-15 13:28:28 -05:00
Stefan Weil 847f171e6a ahci: Remove unused struct member
Member variable is_read is written, but never read
(contrary to its name). Remove it.

Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:22 +02:00
Markus Armbruster 25ad22bc4e ide/atapi scsi-disk: Make monitor eject -f, then change work
change fails while the tray is locked by the guest.  eject -f forces
it open and removes any media.  Unfortunately, the tray closes again
instantly.  Since the lock remains as it is, there is no way to insert
another medium unless the guest voluntarily unlocks.

Fix by leaving the tray open after monitor eject.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:22 +02:00
Markus Armbruster 7d4b4ba5c2 block: New change_media_cb() parameter load
To let device models distinguish between eject and load.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:22 +02:00
Markus Armbruster 7b6f9300d5 block: New bdrv_set_buffer_alignment()
Device models should be able to set it without an unclean include of
block_int.h.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:22 +02:00
Markus Armbruster fb0c61a5a5 hw: Trim superfluous #include "block_int.h"
Including it in device models is unclean, including it without a
reason adds insult to injury.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:21 +02:00
Markus Armbruster d1a0739de5 block: Move BlockConf & friends from block_int.h to block.h
It's convenience stuff for block device models, so block.h isn't the
ideal home either, but better than block_int.h.

Permits moving some #include "block_int.h" from device model .h into
.c.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:21 +02:00
Markus Armbruster e4def80b36 block: Show whether the virtual tray is open in info block
Need to ask the device, so this requires new BlockDevOps member
is_tray_open().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:21 +02:00
Markus Armbruster 9e6a4c9177 block: Drop BlockDriverState member removable
It's a confused mess (see previous commit).  No users remain.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:21 +02:00
Markus Armbruster 2c6942fa7b block: Clean up remaining users of "removable"
BlockDriverState member removable is a confused mess.  It is true when
an ide-cd, scsi-cd or floppy qdev is attached, or when the
BlockDriverState was created with -drive if={floppy,sd} or -drive
if={ide,scsi,xen,none},media=cdrom ("created removable"), except when
an ide-hd, scsi-hd, scsi-generic or virtio-blk qdev is attached.

Three users remain:

1. eject_device(), via bdrv_is_removable() uses it to determine
   whether a block device can eject media.

2. bdrv_info() is monitor command "info block".  QMP documentation
   says "true if the device is removable, false otherwise".  From the
   monitor user's point of view, the only sensible interpretation of
   "is removable" is "can eject media with monitor commands eject and
   change".

A block device can eject media unless a device is attached that
doesn't support it.  Switch the two users over to new
bdrv_dev_has_removable_media() that returns exactly that.

3. bdrv_getlength() uses to suppress its length cache when media can
   change (see commit 46a4e4e6).  Media change is either monitor
   command change (updates the length cache), monitor command eject
   (doesn't update the length cache, easily fixable), or physical
   media change (invalidates length cache, not so easily fixable).

I'm refraining from improving anything here, because this series is
long enough already.  Instead, I simply switch it over to
bdrv_dev_has_removable_media() as well.

This changes the behavior of the length cache and of monitor commands
eject and change in two cases:

a. drive not created removable, no device attached

   The commit makes the drive removable, and defeats the length cache.

   Example: -drive if=none

b. drive created removable, but the attached drive is non-removable,
   and doesn't call bdrv_set_removable(..., 0) (most devices don't)

   The commit makes the drive non-removable, and enables the length
   cache.

   Example: -drive if=xen,media=cdrom -M xenpv

   The other non-removable devices that don't call
   bdrv_set_removable() can't currently use a drive created removable,
   either because they aren't qdevified, or because they lack a drive
   property.  Won't stay that way.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:21 +02:00
Markus Armbruster db118fe725 ide/atapi: Preserve tray state on migration
Use a subsection, so that migration to older version still works,
provided the tray is closed and unlocked.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:21 +02:00
Markus Armbruster 68bb01f398 scsi-disk: Fix START_STOP to fail when it can't eject
Don't fail when tray is already open.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:21 +02:00
Markus Armbruster 48f65b3f52 ide/atapi: Don't fail eject when tray is already open
MMC-5 6.40.2.6 specifies that START STOP UNIT succeeds when the drive
already has the requested state.  cmd_start_stop_unit() fails when
asked to eject while the tray is open and locked.  Fix that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:21 +02:00
Markus Armbruster 025e849a50 block: Rename bdrv_set_locked() to bdrv_lock_medium()
While there, make the locked parameter bool.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:20 +02:00
Markus Armbruster f107639a6f block: Drop medium lock tracking, ask device models instead
Requires new BlockDevOps member is_medium_locked().  Implement for IDE
and SCSI CD-ROMs.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:20 +02:00
Markus Armbruster fdec4404dd block: Leave enforcing tray lock to device models
The device model knows best when to accept the guest's eject command.
No need to detour through the block layer.

bdrv_eject() can't fail anymore.  Make it void.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:20 +02:00
Markus Armbruster 81b1008d50 scsi-disk: Track tray locked state
We already track it in BlockDriverState.  Just like tray open/close
state, we should track it in the device models instead, because it's
device state.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:20 +02:00
Markus Armbruster a0a7573b84 ide/atapi: Track tray locked state
We already track it in BlockDriverState.  Just like tray open/close
state, we should track it in the device models instead, because it's
device state.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:20 +02:00
Markus Armbruster a1aff5bf67 block: Revert entanglement of bdrv_is_inserted() with tray status
Commit 4be9762a changed bdrv_is_inserted() to fail when the tray is
open.  Unfortunately, there are two different kinds of users, with
conflicting needs.

1. Device models using bdrv_eject(), currently ide-cd and scsi-cd.
They expect bdrv_is_inserted() to reflect the tray status.  Commit
4be9762a makes them happy.

2. Code that wants to know whether a BlockDriverState has media, such
as find_image_format(), bdrv_flush_all().  Commit 4be9762a makes them
unhappy.  In particular, it breaks flush on VM stop for media ejected
by the guest.

Revert the change to bdrv_is_inserted().  Check the tray status in the
device models instead.

Note on IDE: Since only ATAPI devices have a tray, and they don't
accept ATA commands since the recent commit "ide: Reject ATA commands
specific to drive kinds", checking in atapi.c suffices.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:20 +02:00
Markus Armbruster ece0d5e9a7 scsi-disk: Track tray open/close state
We already track it in BlockDriverState since commit 4be9762a.  As
discussed in that commit's message, we should track it in the device
device models instead, because it's device state.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:20 +02:00
Markus Armbruster bfd52647ad scsi-disk: Factor out scsi_disk_emulate_start_stop()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:20 +02:00
Markus Armbruster dd06333392 ide/atapi: Track tray open/close state
We already track it in BlockDriverState since commit 4be9762a.  As
discussed in that commit's message, we should track it in the device
device models instead, because it's device state.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:20 +02:00
Markus Armbruster f077656418 ide/atapi: Clean up misleading name in cmd_start_stop_unit()
"eject" is misleading; it means "eject" when start is clear, but
"load" when start is set.  Rename to loej, because that's how MMC-5
calls it, in section 6.40.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:19 +02:00
Markus Armbruster 3cfc22692e ide: Reject ATA commands specific to drive kinds
ACS-2 Table B.2 explicitly prohibits ATAPI devices from implementing
WIN_RECAL, WIN_READ_EXT, WIN_READDMA_EXT, WIN_READ_NATIVE_MAX,
WIN_MULTREAD_EXT, WIN_WRITE, WIN_WRITE_ONCE, WIN_WRITE_EXT,
WIN_WRITEDMA_EXT, WIN_MULTWRITE_EXT, WIN_WRITE_VERIFY, WIN_VERIFY,
WIN_VERIFY_ONCE, WIN_VERIFY_EXT, WIN_SPECIFY, WIN_MULTREAD,
WIN_MULTWRITE, WIN_SETMULT, WIN_READDMA, WIN_READDMA_ONCE,
WIN_WRITEDMA, WIN_WRITEDMA_ONCE, WIN_FLUSH_CACHE_EXT.  Restrict them
to IDE_HD and IDE_CFATA.

Same for CFA_WRITE_SECT_WO_ERASE, CFA_WRITE_MULTI_WO_ERASE.  Restrict
them to IDE_CFATA, like the other CFA_ commands.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:19 +02:00
Markus Armbruster 844505b12e ide: Use a table to declare which drive kinds accept each command
No functional change.

It would be nice to have handler functions in the table, like commit
e1a064f9 did for ATAPI.  Left for another day.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:19 +02:00
Markus Armbruster 3f76a7c381 ide: Fix ATA command READ to set ATAPI signature for CD-ROM
Must set the ATAPI device signature, see ATA4 8.27.5.2 Outputs for
PACKET Command feature set devices, and ACS-2 7.36.6 Outputs for
PACKET feature set devices.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12 15:17:18 +02:00
Max Filippov 47d05a8629 target-xtensa: add dc232b core and board
This is Diamond 232L Standard Core Rev.B (LE).

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 16:57:40 +00:00
Max Filippov f3df4c04d8 target-xtensa: implement CPENABLE and PRID SRs
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 16:57:39 +00:00
Max Filippov b994e91b00 target-xtensa: implement interrupt option
See ISA, 4.4.6 (interrupt option), 4.4.7 (high priority interrupt
option) and 4.4.8 (timer interrupt option) for details.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 16:57:39 +00:00
Max Filippov 7b039f741c target-xtensa: add sample board
Sample board and sample CPU core are used for debug and may be used for
development of custom SoC emulators.

This board has two fixed size memory regions for DTCM and ITCM and
variable length SRAM region.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 16:57:36 +00:00
Max Filippov 2328826b1d target-xtensa: add target stubs
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 16:57:36 +00:00
Hervé Poussineau 83818f7cdd mipsnet: use trace framework
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 16:50:46 +00:00
Hervé Poussineau d118d64a92 mipsnet: convert to qdev
Move mipsnet_init() function to mipssim machine

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 16:50:46 +00:00
Blue Swirl f64e02b6cc PCI: delete unused mem_base and pci_to_cpu_addr
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 14:56:04 +00:00
Blue Swirl a6c6f44ae4 lsi53c895a: avoid a warning from clang analyzer
Avoid this warning from clang analyzer by deleting the variable:
/src/qemu/hw/lsi53c895a.c:895:5: warning: Value stored to 'id' is never read
    id = (current_tag >> 8) & 0xf;

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 14:52:33 +00:00
Blue Swirl 18f88f1195 hid: fix misassignment
The code does not have any effect as is, fix it.

Spotted by clang analyzer:
/src/qemu/hw/hid.c:99:13: warning: Value stored to 'x1' is never read
            x1 = 1;

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 14:49:51 +00:00
Blue Swirl 48bb9f53f4 scsi-bus: remove duplicate table entries
Remove duplicate entries from SCSI command table, spotted by
clang analyzer:
/src/qemu/hw/scsi-bus.c:979:40: warning: initializer overrides prior initialization of this subobject
        [ ERASE_16                 ] = "ERASE_16",
/src/qemu/hw/scsi-bus.c:978:40: note: previous initialization is here
        [ WRITE_SAME_16            ] = "WRITE_SAME_16",
/src/qemu/hw/scsi-bus.c:984:40: warning: initializer overrides prior initialization of this subobject
        [ MAINTENANCE_IN           ] = "MAINTENANCE_IN",
/src/qemu/hw/scsi-bus.c:917:40: note: previous initialization is here
        [ MAINTENANCE_IN           ] = "MAINTENANCE_IN",
/src/qemu/hw/scsi-bus.c:985:40: warning: initializer overrides prior initialization of this subobject
        [ MAINTENANCE_OUT          ] = "MAINTENANCE_OUT",
/src/qemu/hw/scsi-bus.c:918:40: note: previous initialization is here
        [ MAINTENANCE_OUT          ] = "MAINTENANCE_OUT",

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 14:48:08 +00:00
Blue Swirl 1213406bf8 g364fb: compile in hwlib
Compile g364fb in hwlib. Two compilations less for the full build.

Acked-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-09-10 14:46:12 +00:00
Anthony Liguori 282c355b17 Merge remote-tracking branch 'sstabellini/xen-next' into staging 2011-09-09 13:13:27 -05:00
Anthony Liguori da5391edd1 Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-09-09 13:09:57 -05:00
Gerd Hoffmann ad8b818686 Don't use g_thread_get_initialized.
Initialize glib threads unconditionally in main() instead
of using g_thread_get_initialized in the 9p code.

Fixes a build failure on RHEL-5, which ships glib 2.12.
g_thread_get_initialized was added in 2.20.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09 12:58:16 -05:00
Amit Shah 3b86b13ab0 virtio-balloon: Disassociate from the balloon handlers on unplug
Adding a 2nd balloon device after unplugging the first one doesn't work.
Also, the 'info balloon' command should indicate an error mentioning no
balloon device is registered after unplug.

Reproduction steps given by Shaolong Hu:

(qemu) info balloon
Device 'balloon' has not been activated by the guest
(qemu) device_add virtio-balloon-pci,id=balloon1
(qemu) info balloon
balloon: actual=4096
(qemu) balloon 2048
(qemu) info balloon
balloon: actual=2048
(qemu) device_del balloon1
(qemu) info balloon
balloon: actual=4096
(qemu) balloon 2048
(qemu) info balloon
balloon: actual=4096
(qemu) device_del balloon1
Device 'balloon1' not found
(qemu) device_add virtio-balloon-pci,id=balloon1
Another balloon device already registered
Device 'virtio-balloon-pci' could not be initialized
(qemu) device_add virtio-balloon-pci,id=balloon2
Another balloon device already registered
Device 'virtio-balloon-pci' could not be initialized

Reported-by: Shaolong Hu <shu@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09 12:58:16 -05:00
John Haxby 6d6467305a Move the xenfb pointer handler to the connected method
Ensure that we read "request-abs-pointer" after the frontend has written
it.  This means that we will correctly set up an ansolute or relative
pointer handler correctly.

Signed-off-by: John Haxby <john.haxby@oracle.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2011-09-09 13:13:16 +00:00
John Haxby 384087b2fe Introduce a new 'connected' xendev op called when Connected.
Rename the existing xendev 'connect' op to 'initialised' and introduce
a new 'connected' op.  This new op, if defined, is called when the
backend is connected.  Note that since there is no state transition this
may be called more than once.

Signed-off-by: John Haxby <john.haxby@oracle.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2011-09-09 13:13:16 +00:00
Aneesh Kumar K.V 7834cf77be hw/9pfs: add 9P2000.L unlinkat operation
unlinkat - Remove a directory entry

size[4] Tunlinkat tag[2] dirfid[4] name[s] flag[4]
size[4] Runlinkat tag[2]

older Tremove have the below request format

size[4] Tremove tag[2] fid[4]

The remove message is used to remove a directory entry either file or directory
The remove opreation is actually a directory opertation and should ideally have
dirfid, if not we cannot represent the fid on server with anything other than
name. We will have to derive the directory name from fid in the Tremove request.

NOTE: The operation doesn't clunk the unlink fid.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-09 15:07:01 +05:30
Aneesh Kumar K.V 89bf65938a hw/9pfs: add 9P2000.L renameat operation
rename - change name of file or directory

size[4] Trenameat tag[2] olddirfid[4] oldname[s] newdirfid[4] newname[s]
size[4] Rrenameat tag[2]

older Trename have the below request format

size[4] Trename tag[2] fid[4] newdirfid[4] name[s]

The rename message is used to change the name of a file, possibly moving it
to a new directory. The rename opreation is actually a directory opertation
and should ideally have olddirfid, if not we cannot represent the fid on server
with anything other than name. We will have to derive the old directory name
from fid in the Trename request.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-09 14:46:03 +05:30
Aneesh Kumar K.V 10e72295bd hw/9pfs: Fix memleaks in some 9p operation
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-09 14:46:00 +05:30
Aneesh Kumar K.V 25427ec143 hw/9pfs: Initialize rest of qid field to zero.
Since qid is allocated out of stack we need to intialize
the field to zero. Otherwise we will send wrong qid value
to client.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-09 14:45:55 +05:30
Aneesh Kumar K.V 407fee0f02 hw/9pfs: Update the fidp path before opendir
We need to update the fidp path before opendir. Since we don't
use the fid returned by mkdir, earlier code should not have
much issue. We do a double v9fs_string_copy here. The later patch
cleanup the entire function.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-09 14:45:53 +05:30
Stefan Weil 5a61cb60d6 Fix include statements for qemu-common.h
* qemu-common.h is not a system include file, so it should be included
  with "" instead of <>. Otherwise incremental builds might fail
  because only local include files are checked for changes.

* linux-user/syscall.c included the file twice.

Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-09 09:56:12 +01:00
Stefan Weil 069d89b8a8 virtio-9p: Fix syntax error in debug code
This error was reported by cppcheck:

qemu/hw/9pfs/virtio-9p-debug.c:342:
error: Invalid number of character ({) when these macros are defined:
'DEBUG_DATA'.

Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-09 09:51:07 +01:00
Anthony Liguori 573da34a41 Merge remote-tracking branch 'spice/spice.v42' into staging 2011-09-08 09:07:57 -05:00
Anthony Liguori 220724ca4a Merge remote-tracking branch 'kwolf/for-anthony' into staging 2011-09-08 09:05:14 -05:00
Anthony Liguori d8ac46d950 Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging 2011-09-08 09:03:57 -05:00
Anthony Liguori 9d0baba110 Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-09-08 08:59:32 -05:00
Anthony Liguori a60fce0bcc Merge remote-tracking branch 'kraxel/usb.26' into staging 2011-09-08 08:57:33 -05:00
Anthony Liguori 63236c15e9 Merge remote-tracking branch 'aneesh/for-upstream-3' into staging 2011-09-08 08:52:59 -05:00
Juha Riihimäki 5b1cdb4ead usb-musb: Add reset function
Add a separate reset function musb_reset() to the usb-musb interface,
so that users who implement a reset function can also reset usb-musb.
Use this in tusb6010.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
[Riku Voipio: Fixes and restructuring patchset]
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
[Peter Maydell: More fixes and cleanups for upstream submission]
Signed-off-by:  Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:27 +02:00
Peter Maydell 406c20754a usb-musb: Take a DeviceState* in init function
Initialise usb-musb by passing it a DeviceState* and the offset of the
IRQs in its gpio array, rather than a plain pointer to an irq array.
This is simpler for callers and also allows us to pass in a valid parent
to usb_bus_new(), so the USB bus actually appears in the qdev tree.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:27 +02:00
Peter Maydell 9147b75288 usb: Remove leading underscores from __musb_irq_max
Identifiers with double leading underscore are reserved, so rename
__musb_irq_max so we don't encroach on reserved namespace.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:27 +02:00
Gerd Hoffmann 891fb2cd45 usb: claim port at device initialization time.
This patch makes qemu assign a port when creating the device, not when
attaching it.  For most usb devices this isn't a noticable difference
because they are in attached state all the time.

The change affects usb-host devices which live in detached state while
the real device is unplugged from the host.  They have a fixed port
assigned all the time now instead of getting grabbing one on attach and
releasing it at detach, i.e. they stop floating around at the usb bus.

The change also allows to simplify usb-hub.  It doesn't need the
handle_attach() callback any more to configure the downstream ports.
This can be done at device initialitation time now.  The changed
initialization order (first grab upstream port, then register downstream
ports) also fixes some icky corner cases.  For example it is not possible
any more to plug the hub into one of its own downstream ports.

The usb host adapters must care too.  USBPort->dev being non-NULL
doesn't imply any more the device is in attached state.  The host
adapters must additionally check the USBPort->dev->attached flag.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:26 +02:00
Gerd Hoffmann 7755260f01 usb-ccid: remote wakeup support
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:26 +02:00
Gerd Hoffmann 97237e0a5a usb-ccid: switch to USBDesc*
Switch the smard card emulation to use the USBDesc*
structs for the usb descriptors.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:26 +02:00
Gerd Hoffmann 4d8debba76 usb: fix use after free
The ->complete() callback might have released the USBPacket (uhci
actually does), so we must not touch it after the callback returns.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:26 +02:00
Gerd Hoffmann 2fe80192ba usb-ehci: handle siTDs
This patch adds code to do minimal siTD handling, which is basically
just following the next pointer.  This is good enougth to handle the
inactive siTDs used by FreeBSD.  Active siTDs are skipped too as we
don't have split transfer support in qemu, additionally a warning is
printed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:58:16 +02:00
Yonit Halperin 40010aea63 qxl: s/qxl_set_irq/qxl_update_irq/
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:20:09 +02:00
Yonit Halperin efbf2950f5 qxl: send interrupt after migration in case ram->int_pending != 0, RHBZ #732949
if qxl_send_events was called from spice server context, and then
migration had completed before a call to pipe_read, the target
guest qxl driver didn't get the interrupt. In addition,
qxl_send_events ignored further interrupts of the same kind, since
ram->int_pending was set. As a result, the guest driver was stacked
or very slow (when the waiting for the interrupt was with timeout).

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:20:09 +02:00
Peter Maydell a680f7e7cb hw/qxl: Fix format string errors
Fix format string errors causing compile failure on 32 bit hosts
when spice is enabled.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-09-07 09:20:09 +02:00
Paolo Bonzini cfc606da0d scsi: improve MODE SENSE emulation
- do not return extra pages when requesting all pages (PAGE CODE = 0x3f)

- return correct sense code for PC = 3 (saved parameters not supported)

- do not return geometry pages for CD devices

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 15:45:20 +02:00
Paolo Bonzini eae31cb998 scsi: fill in additional sense length correctly
Even though we do not use them, we should include the last three
bytes of sense data in the additional sense length.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 15:28:37 +02:00
Paolo Bonzini f651526271 scsi: refine constants for READ CAPACITY 16
Rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 to distinguish
from the 12-byte CDB variant, and add a constant for the subcommand.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 15:14:41 +02:00
Paolo Bonzini 8e321cc622 scsi: fix accounting of writes
Writes go through scsi_write_complete at least twice, the first time
to get some data without having actually written anything.  Because
of this, the first time scsi_write_complete is called it will call
bdrv_acct_done and account a read incorrectly.  Fix this by looking
at the aiocb.  I am doing the same in scsi_read_complete for symmetry,
but it is only needed in the (bogus) case of bdrv_aio_readv returning
NULL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 13:15:25 +02:00
Paolo Bonzini 0a4ac106f7 scsi: execute SYNCHRONIZE_CACHE asynchronously
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 13:02:16 +02:00
Markus Armbruster ba5b7ad449 block: Declare qemu_blockalign() in block.h, not block_int.h
Device models should be able to use it without an unclean include of
block_int.h.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:24:07 +02:00
Markus Armbruster 124386cc75 spitz tosa: Simplify "drive is suitable for microdrive" test
We try the drive defined with -drive if=ide,index=0 (or equivalent
sugar).  We use it only if (dinfo && bdrv_is_inserted(dinfo->bdrv) &&
!bdrv_is_removable(dinfo->bdrv)).  This is a convoluted way to test
for "drive media can't be removed".

The only way to create such a drive with -drive if=ide is media=cdrom.
And that sets dinfo->media_cd, so just test that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:24:07 +02:00
Markus Armbruster f9e8fda479 xen: Clean up pci_piix3_xen_ide_unplug()'s test for "not a CD"
pci_piix3_xen_ide_unplug() unplugs only disks, not CD-ROMs.  It peeks
into the DriveInfo's BlockDriverState to distinguish between the two.
Unclean; use DriveInfo member media_cd, like xen_config_dev_blk().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:24:07 +02:00
Markus Armbruster 18d9005529 fdc: Make media change detection more robust
fdctrl_change_cb() gets called on a virtual media change via monitor.
It would be nice if host device block drivers called it on physical
media change, but they don't.

bdrv_media_changed() lets you poll for media change, but it returns
"don't know" except with block driver "host_floppy".

FDrive member media_changed gets set on device initialization and by
fdctrl_change_cb(), and cleared by fdctrl_media_changed().  Thus, it's
set on first entry to fdctrl_media_changed() since device
initialization or virtual media change.

fdctrl_media_changed() ignores media_changed unless
bdrv_media_changed() returns "don't know".  If we change media via
monitor (setting media_changed), and the new media's block driver
returns 0, we lose.  Fortunately, "host_floppy" always returns 1 on
first call.  Brittle.  Clean it up not to rely on it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:24:06 +02:00
Markus Armbruster 8e49ca4624 block: Leave tracking media change to device models
hw/fdc.c is the only one that cares.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:24:06 +02:00
Markus Armbruster 656fbeff92 ide: Give vmstate structs internal linkage where possible
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:24:06 +02:00
Markus Armbruster 814839c00b ide: Clean up case label indentation in ide_exec_cmd()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:23:51 +02:00
Markus Armbruster 1d4316d385 ide: Update command code definitions as per ACS-2 Table B.2
Drop WIN_SRST, it has the same value as WIN_DEVICE_RESET.

Drop unused WIN_RESTORE, it has the same value as WIN_RECAL.

Drop codes that are not implemented and long obsolete: WIN_READ_LONG,
WIN_READ_LONG_ONCE, WIN_WRITE_LONG, WIN_WRITE_LONG_ONCE, WIN_FORMAT
(all obsolete since ATA4), WIN_ACKMEDIACHANGE, WIN_POSTBOOT,
WIN_PREBOOT (obsolete since ATA3), WIN_WRITE_SAME (obsolete since
ATA3, code reused for something else in ACS2), WIN_IDENTIFY_DMA
(obsolete since ATA4).

Drop codes that are not implemented and vendor-specific:
EXABYTE_ENABLE_NEST, DISABLE_SEAGATE.

Drop WIN_INIT, it isn't implemented, its value used to be reserved,
and is used for something else since ATA8.

CFA_IDLEIMMEDIATE isn't specific to CFATA.  ACS-2 shows it as a
defined command in ATA-1, -2 and -3.  Rename to WIN_IDLEIMMEDIATE2.

Mark vendor specific, retired, and obsolete codes.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:23:51 +02:00
Markus Armbruster 145feb176f block: Split change_cb() into change_media_cb(), resize_cb()
Multiplexing callbacks complicates matters needlessly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:23:51 +02:00
Markus Armbruster 0e49de5232 block: Generalize change_cb() to BlockDevOps
So we can more easily add device model callbacks.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:23:51 +02:00
Markus Armbruster fa879d62eb block: Attach non-qdev devices as well
For now, this just protects against programming errors like having the
same drive back multiple non-qdev devices, or untimely bdrv_delete().
Later commits will add other interesting uses.

While there, rename BlockDriverState member peer to dev, bdrv_attach()
to bdrv_attach_dev(), bdrv_detach() to bdrv_detach_dev(), and
bdrv_get_attached() to bdrv_get_attached_dev().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-06 11:23:51 +02:00
Edgar E. Iglesias c4cb2578b5 mips: Add SMP support to the Malta board
No change to the CPU kinds, so SMP will only work if
manually changing the cpu to 34Kf:

-cpu 34Kf -smp 2

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-09-06 11:09:39 +02:00
Avi Kivity c50a6def96 milkymist: convert to memory API
Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:52 +03:00
Avi Kivity 5105ed3b19 milkymist-softusb: convert to memory API
Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:52 +03:00
Avi Kivity 8a53d56fdc milkymist-minimac2: convert to memory API
Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:52 +03:00
Avi Kivity c378b364ee mcf5208: convert to memory API
Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:51 +03:00
Avi Kivity 02e5c16757 mainstone: convert to memory API
Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:51 +03:00
Avi Kivity 88fa8031bd lm32_boards: convert to memory API
Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:51 +03:00
Avi Kivity cbdea0ca89 dummy_m68k: convert to memory API
Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:51 +03:00
Avi Kivity cfe5f01104 pflash_cfi01/pflash_cfi02: convert to memory API
cfi02 is annoying in that is ignores some address bits; we probably
want explicit support in the memory API for that.

In order to get the correct opaque into the MemoryRegion object, the
allocation scheme is changed so that the flash emulation code allocates
memory, instead of the caller.  This clears a FIXME in the flash code.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:51 +03:00
Avi Kivity 72124c01c6 piix_pci: wrap memory update in a transaction
The code will remap all PAMs, even if just one is updated, resulting
in reduced performance.  Wrap in a transaction to detect that those
other PAMs have not changed.

Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:51 +03:00
Avi Kivity 64c048f4a8 cirrus: wrap memory update in a transaction
This prevents spurious unmapping and remapping of the vga windows,
which reduces performance.

Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:51 +03:00
Avi Kivity a4911d6425 leon3: convert to memory API
Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:51 +03:00
Avi Kivity 211adf4d51 integratorcp: convert to memory API (RAM/flash only)
Reviewed-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:51 +03:00
Avi Kivity d40b2af8ba sysbus: add sysbus_add_memory_overlap()
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:50 +03:00
Avi Kivity b0e3d5ac2f axis_dev88: convert to memory API (RAM only)
Reviewed-by: Richard Henderson  <rth@twiddle.net>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-04 17:46:50 +03:00