diff mbox

[v6,01/10] i440fx: make types configurable at run-time

Message ID 1421659723-2496-2-git-send-email-tiejun.chen@intel.com
State New
Headers show

Commit Message

Tiejun Chen Jan. 19, 2015, 9:28 a.m. UTC
From: "Michael S. Tsirkin" <mst@redhat.com>

Xen wants to supply a different pci and host devices,
inheriting i440fx devices. Make types configurable.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
 hw/i386/pc_piix.c    | 4 +++-
 hw/pci-host/piix.c   | 9 ++++-----
 include/hw/i386/pc.h | 6 +++++-
 3 files changed, 12 insertions(+), 7 deletions(-)

Comments

Gerd Hoffmann Jan. 19, 2015, 11:36 a.m. UTC | #1
On Mo, 2015-01-19 at 17:28 +0800, Tiejun Chen wrote:
> From: "Michael S. Tsirkin" <mst@redhat.com>
> 
> Xen wants to supply a different pci and host devices,
> inheriting i440fx devices. Make types configurable.

Description is misleading, this isn't about xen but about IGD
passthrough.  Guess kvm needs this too once kvmgt lands upstream.

Otherwise looks sane to me.

cheers,
  Gerd
Tiejun Chen Jan. 20, 2015, 2:48 a.m. UTC | #2
On 2015/1/19 19:36, Gerd Hoffmann wrote:
> On Mo, 2015-01-19 at 17:28 +0800, Tiejun Chen wrote:
>> From: "Michael S. Tsirkin" <mst@redhat.com>
>>
>> Xen wants to supply a different pci and host devices,
>> inheriting i440fx devices. Make types configurable.
>
> Description is misleading, this isn't about xen but about IGD

Its about IGD passthrough in Xen side.

> passthrough.  Guess kvm needs this too once kvmgt lands upstream.
>

But I'm not sure if KvmGT is really going to be this so just CCed Jike 
who are focusing on KvmGT currently, and he also promised to have a 
closer loot at this.

Thanks
Tiejun

> Otherwise looks sane to me.
>
> cheers,
>    Gerd
>
>
>
Tiejun Chen Jan. 20, 2015, 5:08 a.m. UTC | #3
On 2015/1/19 19:36, Gerd Hoffmann wrote:
> On Mo, 2015-01-19 at 17:28 +0800, Tiejun Chen wrote:
>> From: "Michael S. Tsirkin" <mst@redhat.com>
>>
>> Xen wants to supply a different pci and host devices,
>> inheriting i440fx devices. Make types configurable.
>
> Description is misleading, this isn't about xen but about IGD
> passthrough.  Guess kvm needs this too once kvmgt lands upstream.
>

So just rephrase this as follows:

i440fx: make types configurable at run-time

IGD passthrough wants to supply a different pci and
host devices, inheriting i440fx devices. Make types
configurable.

Thanks
Tiejun
Gerd Hoffmann Jan. 20, 2015, 8:25 a.m. UTC | #4
On Di, 2015-01-20 at 10:48 +0800, Chen, Tiejun wrote:
> On 2015/1/19 19:36, Gerd Hoffmann wrote:
> > On Mo, 2015-01-19 at 17:28 +0800, Tiejun Chen wrote:
> >> From: "Michael S. Tsirkin" <mst@redhat.com>
> >>
> >> Xen wants to supply a different pci and host devices,
> >> inheriting i440fx devices. Make types configurable.
> >
> > Description is misleading, this isn't about xen but about IGD
> 
> Its about IGD passthrough in Xen side.

As far I can see the only really xen specific stuff here is the pci
pass-through bits, i.e. how we handle the IGD device itself.

The northbridge & isa-bridge emulation extensions needed for IGD should
be pretty much common for IGD passthough on xen, IGD passthrough on kvm
(vfio) and IGD virtualization (xengt+kvmgt).

cheers,
  Gerd
Jike Song Jan. 20, 2015, 8:32 a.m. UTC | #5
On 01/20/2015 04:25 PM, Gerd Hoffmann wrote:
> On Di, 2015-01-20 at 10:48 +0800, Chen, Tiejun wrote:
>> On 2015/1/19 19:36, Gerd Hoffmann wrote:
>>> On Mo, 2015-01-19 at 17:28 +0800, Tiejun Chen wrote:
>>>> From: "Michael S. Tsirkin" <mst@redhat.com>
>>>>
>>>> Xen wants to supply a different pci and host devices,
>>>> inheriting i440fx devices. Make types configurable.
>>>
>>> Description is misleading, this isn't about xen but about IGD
>>
>> Its about IGD passthrough in Xen side.
>
> As far I can see the only really xen specific stuff here is the pci
> pass-through bits, i.e. how we handle the IGD device itself.
>
> The northbridge & isa-bridge emulation extensions needed for IGD should
> be pretty much common for IGD passthough on xen, IGD passthrough on kvm
> (vfio) and IGD virtualization (xengt+kvmgt).

This is exactly what I proposed in another thread :)

>
> cheers,
>    Gerd
>

--
Thanks,
Jike
diff mbox

Patch

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index f0a3201..cc10f72 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -200,7 +200,9 @@  static void pc_init1(MachineState *machine,
     }
 
     if (pci_enabled) {
-        pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
+        pci_bus = i440fx_init(TYPE_I440FX_PCI_HOST_BRIDGE,
+                              TYPE_I440FX_PCI_DEVICE,
+                              &i440fx_state, &piix3_devfn, &isa_bus, gsi,
                               system_memory, system_io, machine->ram_size,
                               below_4g_mem_size,
                               above_4g_mem_size,
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 1530038..adc5025 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -40,7 +40,6 @@ 
  * http://download.intel.com/design/chipsets/datashts/29054901.pdf
  */
 
-#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
 #define I440FX_PCI_HOST_BRIDGE(obj) \
     OBJECT_CHECK(I440FXState, (obj), TYPE_I440FX_PCI_HOST_BRIDGE)
 
@@ -91,7 +90,6 @@  typedef struct PIIX3State {
     MemoryRegion rcr_mem;
 } PIIX3State;
 
-#define TYPE_I440FX_PCI_DEVICE "i440FX"
 #define I440FX_PCI_DEVICE(obj) \
     OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
 
@@ -305,7 +303,8 @@  static int i440fx_initfn(PCIDevice *dev)
     return 0;
 }
 
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
+PCIBus *i440fx_init(const char *host_type, const char *pci_type,
+                    PCII440FXState **pi440fx_state,
                     int *piix3_devfn,
                     ISABus **isa_bus, qemu_irq *pic,
                     MemoryRegion *address_space_mem,
@@ -325,7 +324,7 @@  PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
     unsigned i;
     I440FXState *i440fx;
 
-    dev = qdev_create(NULL, TYPE_I440FX_PCI_HOST_BRIDGE);
+    dev = qdev_create(NULL, host_type);
     s = PCI_HOST_BRIDGE(dev);
     b = pci_bus_new(dev, NULL, pci_address_space,
                     address_space_io, 0, TYPE_PCI_BUS);
@@ -333,7 +332,7 @@  PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
     object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev), NULL);
     qdev_init_nofail(dev);
 
-    d = pci_create_simple(b, 0, TYPE_I440FX_PCI_DEVICE);
+    d = pci_create_simple(b, 0, pci_type);
     *pi440fx_state = I440FX_PCI_DEVICE(d);
     f = *pi440fx_state;
     f->system_memory = address_space_mem;
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 69d9cf8..755d6a7 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -244,7 +244,11 @@  extern int no_hpet;
 struct PCII440FXState;
 typedef struct PCII440FXState PCII440FXState;
 
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn,
+#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
+#define TYPE_I440FX_PCI_DEVICE "i440FX"
+
+PCIBus *i440fx_init(const char *host_type, const char *pci_type,
+                    PCII440FXState **pi440fx_state, int *piix_devfn,
                     ISABus **isa_bus, qemu_irq *pic,
                     MemoryRegion *address_space_mem,
                     MemoryRegion *address_space_io,