#
fa28f71b |
| 07-Aug-2012 |
Alexey Kardashevskiy <aik@ozlabs.ru> |
pseries: Separate PCI RTAS setup from common from emulation specific PCI setup
Currently the RTAS functions for handling PCI are registered from the class init code for the PCI host bridge. That so
pseries: Separate PCI RTAS setup from common from emulation specific PCI setup
Currently the RTAS functions for handling PCI are registered from the class init code for the PCI host bridge. That sort of makes sense now, but will break in the future when vfio gives us multiple types of host bridge for pseries (emulated and pass-through, at least). The RTAS functions will be common across all host bridge types (and will call out to different places internally depending on the type).
So, this patch moves the RTAS registration into its own function called direct from the machine setup code.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
a307d594 |
| 07-Aug-2012 |
Alexey Kardashevskiy <aik@ozlabs.ru> |
pseries: Rework irq assignment to avoid carrying qemu_irqs around
Currently, the interfaces in the pseries machine code for assignment and setup of interrupts pass around qemu_irq objects. That was
pseries: Rework irq assignment to avoid carrying qemu_irqs around
Currently, the interfaces in the pseries machine code for assignment and setup of interrupts pass around qemu_irq objects. That was done in an attempt not to be too closely linked to the specific XICS interrupt controller. However interactions with the device tree setup made that attempt rather futile, and XICS is part of the PAPR spec anyway, so this really just meant we had to carry both the qemu_irq pointers and the XICS irq numbers around.
This mess will just get worse when we add upcoming PCI MSI support, since that will require tracking a bunch more interrupt. Therefore, this patch reworks the spapr code to just use XICS irq numbers (roughly equivalent to GSIs on x86) and only retrieve the qemu_irq pointers from the XICS code when we need them (a trivial lookup).
This is a reworked and generalized version of an earlier spapr_pci specific patch from Alexey Kardashevskiy.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [agraf: fix checkpath warning] Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
e0fdbd7c |
| 13-Jun-2012 |
Alexey Kardashevskiy <aik@ozlabs.ru> |
pseries pci: spapr_populate_pci_devices renamed to spapr_populate_pci_dt
spapr_populate_pci_devices() populates the device tree only with bus properties and has nothing to do with the devices on it
pseries pci: spapr_populate_pci_devices renamed to spapr_populate_pci_dt
spapr_populate_pci_devices() populates the device tree only with bus properties and has nothing to do with the devices on it as PCI BAR allocation is done by the system firmware (SLOF).
New name - spapr_populate_pci_dt() - describes the functionality better.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
231903bf |
| 13-Jun-2012 |
Alexey Kardashevskiy <aik@ozlabs.ru> |
pseries pci: removed redundant busdev
The PCIHostState struct already contains SysBusDevice so the one in sPAPRPHBState has to go.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by:
pseries pci: removed redundant busdev
The PCIHostState struct already contains SysBusDevice so the one in sPAPRPHBState has to go.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
c4889f54 |
| 18-Jul-2012 |
Alexey Kardashevskiy <aik@ozlabs.ru> |
powerpc pci: fixed packing of ranges[]
By default mingw-gcc is trying to pack structures the way to preserve binary compatibility with MS Visual C what leads to incorrect and unexpected padding in t
powerpc pci: fixed packing of ranges[]
By default mingw-gcc is trying to pack structures the way to preserve binary compatibility with MS Visual C what leads to incorrect and unexpected padding in the PCI bus ranges property of the sPAPR PHB.
The patch replaces __attribute__((packed)) with more strict QEMU_PACKED which actually is __attribute__((gcc_struct, packed)) on Windows.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Tested-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Stefan Weil <sw@weilnetz.de> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
show more ...
|
#
edded454 |
| 27-Jun-2012 |
David Gibson <david@gibson.dropbear.id.au> |
pseries: Implement IOMMU and DMA for PAPR PCI devices
Currently the pseries machine emulation does not support DMA for emulated PCI devices, because the PAPR spec always requires a (guest visible, p
pseries: Implement IOMMU and DMA for PAPR PCI devices
Currently the pseries machine emulation does not support DMA for emulated PCI devices, because the PAPR spec always requires a (guest visible, paravirtualized) IOMMU which was not implemented. Now that we have infrastructure for IOMMU emulation, we can correct this and allow PCI DMA for pseries.
With the existing PAPR IOMMU code used for VIO devices, this is almost trivial. We use a single DMAContext for each (virtual) PCI host bridge, which is the usual configuration on real PAPR machines (which often have _many_ PCI host bridges).
Cc: Alex Graf <agraf@suse.de>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|
#
0866aca1 |
| 23-Dec-2011 |
Anthony Liguori <aliguori@us.ibm.com> |
qbus: Make child devices links
Make qbus children show up as link<> properties. There is no stable addressing for qbus children so we use an unstable naming convention.
This is okay in QOM though
qbus: Make child devices links
Make qbus children show up as link<> properties. There is no stable addressing for qbus children so we use an unstable naming convention.
This is okay in QOM though because the composition name is expected to be what's stable.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
show more ...
|
#
7fb0bd34 |
| 25-Apr-2012 |
David Gibson <david@gibson.dropbear.id.au> |
pseries: Use the same interrupt swizzling for host bridges as p2p bridges
Currently the pseries PCI code uses a somewhat strange scheme of PCI irq allocation - one per slot up to a maximum that's gr
pseries: Use the same interrupt swizzling for host bridges as p2p bridges
Currently the pseries PCI code uses a somewhat strange scheme of PCI irq allocation - one per slot up to a maximum that's greater than the usual 4. This scheme more or less worked, because we were able to tell the guest the irq mapping in the device tree, however it's a bit odd and may break assumptions in the future. Worse, the array used to construct the dev tree interrupt map was mis-sized, we got away with it only because it happened that our SPAPR_PCI_NUM_LSI value was greater than 7.
This patch changes the pseries PCI code to use the same interrupt swizzling scheme as is standardized for PCI to PCI bridges. This makes for better consistency, deals better with any devices which use multiple interrupt pins and will make life easier in the future when we add passthrough of what may be either a host bridge or a PCI to PCI bridge. This won't break existing guests, because they don't assume a particular mapping scheme for host bridges, but just follow what we tell them in the device tree (also updated to match, of course). This patch also fixes the allocation of the irq map.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
92615a5a |
| 02-Apr-2012 |
David Gibson <david@gibson.dropbear.id.au> |
pseries: Fix RTAS based config access
On the pseries platform, access to PCI config space is via RTAS calls( which go to the hypervisor) rather than MMIO. This means we don't use the same code path
pseries: Fix RTAS based config access
On the pseries platform, access to PCI config space is via RTAS calls( which go to the hypervisor) rather than MMIO. This means we don't use the same code path as nearly everyone else which goes through pci_host.c and we're missing some of the parameter checking along the way.
We do have some parameter checking in the RTAS calls, but it's not enough. It checks for overruns, but does not check for unaligned accesses, oversized accesses (which means the guest could trigger an assertion failure from pci_host_config_{read,write}_common(). Worse it doesn't do the basic checking for the number of RTAS arguments and results before accessing them.
This patch fixes these bugs.
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [AF: Fix typos spotted by mst] Signed-off-by: Andreas Färber <afaerber@suse.de>
show more ...
|
#
298a9710 |
| 12-Mar-2012 |
David Gibson <david@gibson.dropbear.id.au> |
pseries: Configure PCI bridge using properties
Currently, the function spapr_create_phb() uses its parameters to initialize the correct memory windows for the new PCI Host Bridge (PHB). This is not
pseries: Configure PCI bridge using properties
Currently, the function spapr_create_phb() uses its parameters to initialize the correct memory windows for the new PCI Host Bridge (PHB). This is not the way things are supposed to be done with qdevs, and means you can't create extra PHBs easily using -device.
Since pSeries machines can and do have many PHBs with various configurations, this is a real limitation, not just a theoretical. This patch, therefore, alters the PHB initialization code to use qdev properties to set these parameters of the new bridge, moving most of the code from spapr_create_phb() to spapr_phb_init().
While we're at it, we change the naming of each PCI bus and its associated memory regions to be less arbitrary and make it easier to relate the guest and qemu views of memory to each other.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
d07fee7e |
| 07-Mar-2012 |
David Gibson <david@gibson.dropbear.id.au> |
pseries: Add support for level interrupts to XICS
The pseries "xics" interrupt controller, like most interrupt controllers can support both message (i.e. edge sensitive) interrupts and level sensiti
pseries: Add support for level interrupts to XICS
The pseries "xics" interrupt controller, like most interrupt controllers can support both message (i.e. edge sensitive) interrupts and level sensitive interrupts, but it needs to know which are which.
When I implemented the xics emulation for qemu, the only devices we supported were the PAPR virtual IO devices. These devices only use message interrupts, so they were the only ones I implemented in xics.
Since then, however, we have added support for PCI devices, which use level sensitive interrupts. It turns out the message interrupt logic still actually works most of the time for these, but there are circumstances where we can lost interrupts due to the incorrect interrupt logic.
This patch, therefore, implements the correct xics level-sensitive interrupt logic. The type of the interrupt is set when a device allocates a new xics interrupt.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
76ab9583 |
| 27-Feb-2012 |
Alexey Kardashevskiy <aik@ozlabs.ru> |
pseries: Remove PCI device from PCI host bridge code
The sPAPR PCI code defines a PCI device "spapr-pci-host-bridge-pci" which is never used. This came over from the earlier bridge driver we used a
pseries: Remove PCI device from PCI host bridge code
The sPAPR PCI code defines a PCI device "spapr-pci-host-bridge-pci" which is never used. This came over from the earlier bridge driver we used as a template. Some other bridges appear on their own PCI bus as a device, but that is not true of pSeries bridges, which are pure host to PCI with no visible presence on the PCI side.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
323abebf |
| 27-Feb-2012 |
David Gibson <david@gibson.dropbear.id.au> |
pseries: Remove unused constant from PCI code
The 'bars' constant array was used in experimental device allocation code which is no longer necessary now that we always run the SLOF firmware. This pa
pseries: Remove unused constant from PCI code
The 'bars' constant array was used in experimental device allocation code which is no longer necessary now that we always run the SLOF firmware. This patch removes the now redundant variable.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
a348f108 |
| 05-Feb-2012 |
Stefan Weil <sw@weilnetz.de> |
Add missing const attributes for MemoryRegionOps
Most MemoryRegionOps already had the const attribute. This patch adds it to the remaining ones.
Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-o
Add missing const attributes for MemoryRegionOps
Most MemoryRegionOps already had the const attribute. This patch adds it to the remaining ones.
Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
show more ...
|
#
83f7d43a |
| 09-Feb-2012 |
Andreas Färber <afaerber@suse.de> |
qom: Unify type registration
Replace device_init() with generalized type_init().
While at it, unify naming convention: type_init([$prefix_]register_types) Also, type_init() is a function, so add pr
qom: Unify type registration
Replace device_init() with generalized type_init().
While at it, unify naming convention: type_init([$prefix_]register_types) Also, type_init() is a function, so add preceding blank line where necessary and don't put a semicolon after the closing brace.
Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Anthony Liguori <anthony@codemonkey.ws> Cc: malc <av1474@comtv.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|
#
39bffca2 |
| 08-Dec-2011 |
Anthony Liguori <aliguori@us.ibm.com> |
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and then rebased it into a single step which avoids repeatedly touch
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and then rebased it into a single step which avoids repeatedly touching every file in the tree.
The first step was a sed-based addition of the parent type to the subclass registration functions.
The second step was another sed-based removal of subclass registration functions while also adding virtual functions from the base class into a class_init function as appropriate.
Finally, a python script was used to convert the DeviceInfo structures and qdev_register_subclass functions to TypeInfo structures, class_init functions, and type_register_static calls.
We are almost fully converted to QOM after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|
#
73093354 |
| 25-Jan-2012 |
Anthony Liguori <aliguori@us.ibm.com> |
qdev: change ambiguous qdev names
Reported-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
#
999e12bb |
| 24-Jan-2012 |
Anthony Liguori <aliguori@us.ibm.com> |
sysbus: apic: ioapic: convert to QEMU Object Model
This converts three devices because apic and ioapic are subclasses of sysbus. Converting subclasses independently of their base class is prohibitiv
sysbus: apic: ioapic: convert to QEMU Object Model
This converts three devices because apic and ioapic are subclasses of sysbus. Converting subclasses independently of their base class is prohibitively hard.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|
#
40021f08 |
| 04-Dec-2011 |
Anthony Liguori <aliguori@us.ibm.com> |
pci: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
#
88045ac5 |
| 18-Jan-2012 |
Alexander Graf <agraf@suse.de> |
PPC: Pseries: Check for PCI boundaries
We call pci_host_config_{read,write}_common() which perform PCI config accesses. However they don't do all limit checking the way we expect it to.
So let's in
PPC: Pseries: Check for PCI boundaries
We call pci_host_config_{read,write}_common() which perform PCI config accesses. However they don't do all limit checking the way we expect it to.
So let's introduce a small wrapper around them, making them behave the way we would without touching generic code.
This patch is based on a patch by David Gibson which put this logic into the generic code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
4d8d5467 |
| 11-Jan-2012 |
Benjamin Herrenschmidt <benh@kernel.crashing.org> |
pseries: SLOF PCI flag day
Currently on the pseries machine the SLOF firmware is used normally, but we bypass it when -kernel is specified. Having these two
different boot paths can cause some con
pseries: SLOF PCI flag day
Currently on the pseries machine the SLOF firmware is used normally, but we bypass it when -kernel is specified. Having these two
different boot paths can cause some confusion.
In particular at present we need to "probe" the (emulated) PCI bus and produce device tree nodes for the PCI devices in qemu, for the -kernel case. In the SLOF case, it takes the device tree from qemu adds some stuff to it then passes it on to the kernel.
It's been decided that a better approach is to always boot through SLOF, even when using -kernel. WIth this approach we can leave PCI probing and device node creation to SLOF in all cases which removes a bunch of code in qemu, and avoids iterating the PCI devices from the machine specific init code which we're not supposed to do.
This patch changes qemu to always boot through SLOF, and not to create PCI nodes. Simultaneously it updates the included version of SLOF (submodule and binary image) to one which supports (and requires) the new approach.
The new SLOF version also includes a number of unrelated enhancements: support for booting from virtio-pci devices and e1000, greatly improved FCode support and many bugfixes. It also makes SLOF ready to be used even when specifying a kernel on the qemu command line.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
c9c3c80a |
| 11-Jan-2012 |
David Gibson <david@gibson.dropbear.id.au> |
pseries: Use correct dispatcher for PCI config space accesses
The pseries machine expects a para-virtualized guest and so supplies RTAS functions (via a hypercall) for performing PCI config space ac
pseries: Use correct dispatcher for PCI config space accesses
The pseries machine expects a para-virtualized guest and so supplies RTAS functions (via a hypercall) for performing PCI config space access. Currently the implementation of these calls into pci_default_{read,write}_config(). However this would be incorrect for any PCI device which overrides the default config read/write functions. AFAICT there's only one such device today, but we should still get it right. In addition the pci_host_config_{read,write}_common() functions which do correctly do this dispatch, perform bounds checking on the config space address, lack of which currently leads to an exploitable bug.
This patch corrects the problem.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
3f7565c9 |
| 11-Jan-2012 |
Benjamin Herrenschmidt <benh@kernel.crashing.org> |
pseries: Support PCI extended config space in RTAS calls
On the pseries machine (which expexts a paravirtualized guest), guest access to PCI config space is via host-provided RTAS functions. This p
pseries: Support PCI extended config space in RTAS calls
On the pseries machine (which expexts a paravirtualized guest), guest access to PCI config space is via host-provided RTAS functions. This patch extends these RTAS functions to permit access to PCI extended config space, as specified in PAPR.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
#
81584fd5 |
| 29-Nov-2011 |
David Gibson <david@gibson.dropbear.id.au> |
pseries: Fix array overrun bug in PCI code
spapr_populate_pci_devices() containd a loop with PCI_NUM_REGIONS (7) iterations. However this overruns the 'bars' global array, which only has 6 elements
pseries: Fix array overrun bug in PCI code
spapr_populate_pci_devices() containd a loop with PCI_NUM_REGIONS (7) iterations. However this overruns the 'bars' global array, which only has 6 elements. In fact we only want to run this loop for things listed in the bars array, so this patch corrects the loop bounds to reflect that.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
show more ...
|
#
3a26360d |
| 01-Nov-2011 |
Anthony Liguori <aliguori@us.ibm.com> |
spapr: fix build
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|