* [Qemu-devel] [v3][PATCH 0/5] xen: introduce new machine for IGD passthrough
@ 2014-07-31 12:09 ` Tiejun Chen
0 siblings, 0 replies; 28+ messages in thread
From: Tiejun Chen @ 2014-07-31 12:09 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
v3:
* Drop patch #4
* Add one patch #1 from Michael
* Rebase
v2:
* Fix some coding style
* New patch to separate i440fx_init
* Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
* Based on patch #2 to regenerate
* Unify prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough like patch #3
* Test: boot with a preinstalled ubuntu 14.04
./i386-softmmu/qemu-system-i386 -hda test.img -m 2560 -boot c -machine pc
As we discussed we need to create a separate machine to support current
IGD passthrough.
----------------------------------------------------------------
Tiejun Chen (4):
i440fx: make types configurable at run-time
hw:i386:pc_piix: split pc_init1()
xen:hw:pci-host:piix: create host bridge to passthrough
xen:hw:i386:pc_piix: introduce new machine for IGD passthrough
hw/i386/pc_piix.c | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
hw/pci-host/piix.c | 50 ++++++++++++++++++++++++++++++++++----
include/hw/i386/pc.h | 8 ++++++-
3 files changed, 254 insertions(+), 31 deletions(-)
Thanks
Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* [v3][PATCH 0/5] xen: introduce new machine for IGD passthrough
@ 2014-07-31 12:09 ` Tiejun Chen
0 siblings, 0 replies; 28+ messages in thread
From: Tiejun Chen @ 2014-07-31 12:09 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
v3:
* Drop patch #4
* Add one patch #1 from Michael
* Rebase
v2:
* Fix some coding style
* New patch to separate i440fx_init
* Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
* Based on patch #2 to regenerate
* Unify prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough like patch #3
* Test: boot with a preinstalled ubuntu 14.04
./i386-softmmu/qemu-system-i386 -hda test.img -m 2560 -boot c -machine pc
As we discussed we need to create a separate machine to support current
IGD passthrough.
----------------------------------------------------------------
Tiejun Chen (4):
i440fx: make types configurable at run-time
hw:i386:pc_piix: split pc_init1()
xen:hw:pci-host:piix: create host bridge to passthrough
xen:hw:i386:pc_piix: introduce new machine for IGD passthrough
hw/i386/pc_piix.c | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
hw/pci-host/piix.c | 50 ++++++++++++++++++++++++++++++++++----
include/hw/i386/pc.h | 8 ++++++-
3 files changed, 254 insertions(+), 31 deletions(-)
Thanks
Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* [Qemu-devel] [v3][PATCH 1/4] i440fx: make types configurable at run-time
2014-07-31 12:09 ` Tiejun Chen
@ 2014-07-31 12:09 ` Tiejun Chen
-1 siblings, 0 replies; 28+ messages in thread
From: Tiejun Chen @ 2014-07-31 12:09 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
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(-)
v3:
* New patch from Michael
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 9694f88..928c12c 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -194,7 +194,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 e0e0946..0cd82b8 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 f4b9b2b..9778a71 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -230,7 +230,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,
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [v3][PATCH 1/4] i440fx: make types configurable at run-time
@ 2014-07-31 12:09 ` Tiejun Chen
0 siblings, 0 replies; 28+ messages in thread
From: Tiejun Chen @ 2014-07-31 12:09 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
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(-)
v3:
* New patch from Michael
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 9694f88..928c12c 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -194,7 +194,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 e0e0946..0cd82b8 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 f4b9b2b..9778a71 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -230,7 +230,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,
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [v3][PATCH 2/4] hw:i386:pc_piix: split pc_init1()
2014-07-31 12:09 ` Tiejun Chen
@ 2014-07-31 12:09 ` Tiejun Chen
-1 siblings, 0 replies; 28+ messages in thread
From: Tiejun Chen @ 2014-07-31 12:09 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
We'd like to split pc_init1 and then we can share something
with other stuff.
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
hw/i386/pc_piix.c | 117 +++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 93 insertions(+), 24 deletions(-)
v3:
* Rebase
v2:
* Fix some coding style
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 928c12c..0c40b06 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -71,36 +71,29 @@ static bool smbios_legacy_mode;
static bool gigabyte_align = true;
static bool has_reserved_memory = true;
-/* PC hardware initialisation */
-static void pc_init1(MachineState *machine,
- int pci_enabled,
- int kvmclock_enabled)
+static ram_addr_t below_4g_mem_size;
+static ram_addr_t above_4g_mem_size;
+static void pc_machine_base_init(MachineState *machine,
+ int pci_enabled,
+ int kvmclock_enabled,
+ DeviceState **pc_icc_bridge,
+ MemoryRegion **pc_ram_memory,
+ MemoryRegion **pc_pci_memory,
+ qemu_irq **pc_gsi,
+ GSIState **pc_gsi_state,
+ FWCfgState **pc_fw_cfg)
{
PCMachineState *pc_machine = PC_MACHINE(machine);
MemoryRegion *system_memory = get_system_memory();
- MemoryRegion *system_io = get_system_io();
- int i;
- ram_addr_t below_4g_mem_size, above_4g_mem_size;
- PCIBus *pci_bus;
- ISABus *isa_bus;
- PCII440FXState *i440fx_state;
- int piix3_devfn = -1;
- qemu_irq *cpu_irq;
- qemu_irq *gsi;
- qemu_irq *i8259;
- qemu_irq *smi_irq;
- GSIState *gsi_state;
- DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
- BusState *idebus[MAX_IDE_BUS];
- ISADevice *rtc_state;
- ISADevice *floppy;
- MemoryRegion *ram_memory;
- MemoryRegion *pci_memory;
MemoryRegion *rom_memory;
- DeviceState *icc_bridge;
- FWCfgState *fw_cfg = NULL;
PcGuestInfo *guest_info;
ram_addr_t lowmem;
+ DeviceState *icc_bridge;
+ MemoryRegion *ram_memory;
+ MemoryRegion *pci_memory;
+ qemu_irq *gsi;
+ GSIState *gsi_state;
+ FWCfgState *fw_cfg;
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
* If it doesn't, we need to split it in chunks below and above 4G.
@@ -193,6 +186,31 @@ static void pc_init1(MachineState *machine,
gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
}
+ *pc_icc_bridge = icc_bridge;
+ *pc_ram_memory = ram_memory;
+ *pc_pci_memory = pci_memory;
+ *pc_gsi = gsi;
+ *pc_gsi_state = gsi_state;
+ *pc_fw_cfg = fw_cfg;
+}
+
+static void pc_machine_pci_bus_init(MachineState *machine,
+ int pci_enabled,
+ PCII440FXState **pc_i440fx_state,
+ int *pc_piix3_devfn,
+ PCIBus **pc_pci_bus,
+ ISABus **pc_isa_bus,
+ qemu_irq *gsi,
+ MemoryRegion *pci_memory,
+ MemoryRegion *ram_memory)
+{
+ MemoryRegion *system_memory = get_system_memory();
+ MemoryRegion *system_io = get_system_io();
+ PCII440FXState *i440fx_state;
+ int piix3_devfn;
+ PCIBus *pci_bus;
+ ISABus *isa_bus;
+
if (pci_enabled) {
pci_bus = i440fx_init(TYPE_I440FX_PCI_HOST_BRIDGE,
TYPE_I440FX_PCI_DEVICE,
@@ -207,6 +225,33 @@ static void pc_init1(MachineState *machine,
isa_bus = isa_bus_new(NULL, system_io);
no_hpet = 1;
}
+
+ *pc_i440fx_state = i440fx_state;
+ *pc_piix3_devfn = piix3_devfn;
+ *pc_pci_bus = pci_bus;
+ *pc_isa_bus = isa_bus;
+}
+
+static void pc_machine_device_init(MachineState *machine,
+ int pci_enabled,
+ GSIState *gsi_state,
+ DeviceState *icc_bridge,
+ int piix3_devfn,
+ FWCfgState *fw_cfg,
+ PCIBus *pci_bus,
+ ISABus *isa_bus,
+ qemu_irq *gsi)
+{
+ int i;
+ DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
+ BusState *idebus[MAX_IDE_BUS];
+ qemu_irq *smi_irq;
+ PCMachineState *pc_machine = PC_MACHINE(machine);
+ qemu_irq *cpu_irq;
+ qemu_irq *i8259;
+ ISADevice *rtc_state;
+ ISADevice *floppy;
+
isa_bus_irqs(isa_bus, gsi);
if (kvm_irqchip_in_kernel()) {
@@ -294,6 +339,30 @@ static void pc_init1(MachineState *machine,
}
}
+/* PC hardware initialisation */
+static void pc_init1(MachineState *machine,
+ int pci_enabled,
+ int kvmclock_enabled)
+{
+ PCIBus *pci_bus = NULL;
+ ISABus *isa_bus = NULL;
+ PCII440FXState *i440fx_state = NULL;
+ int piix3_devfn = -1;
+ qemu_irq *gsi = NULL;
+ GSIState *gsi_state = NULL;
+ MemoryRegion *ram_memory = NULL;
+ MemoryRegion *pci_memory = NULL;
+ DeviceState *icc_bridge = NULL;
+ FWCfgState *fw_cfg = NULL;
+
+ pc_machine_base_init(machine, pci_enabled, kvmclock_enabled, &icc_bridge,
+ &ram_memory, &pci_memory, &gsi, &gsi_state, &fw_cfg);
+ pc_machine_pci_bus_init(machine, pci_enabled, &i440fx_state, &piix3_devfn,
+ &pci_bus, &isa_bus, gsi, pci_memory, ram_memory);
+ pc_machine_device_init(machine, pci_enabled, gsi_state, icc_bridge,
+ piix3_devfn, fw_cfg, pci_bus, isa_bus, gsi);
+}
+
static void pc_init_pci(MachineState *machine)
{
pc_init1(machine, 1, 1);
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [v3][PATCH 2/4] hw:i386:pc_piix: split pc_init1()
@ 2014-07-31 12:09 ` Tiejun Chen
0 siblings, 0 replies; 28+ messages in thread
From: Tiejun Chen @ 2014-07-31 12:09 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
We'd like to split pc_init1 and then we can share something
with other stuff.
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
hw/i386/pc_piix.c | 117 +++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 93 insertions(+), 24 deletions(-)
v3:
* Rebase
v2:
* Fix some coding style
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 928c12c..0c40b06 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -71,36 +71,29 @@ static bool smbios_legacy_mode;
static bool gigabyte_align = true;
static bool has_reserved_memory = true;
-/* PC hardware initialisation */
-static void pc_init1(MachineState *machine,
- int pci_enabled,
- int kvmclock_enabled)
+static ram_addr_t below_4g_mem_size;
+static ram_addr_t above_4g_mem_size;
+static void pc_machine_base_init(MachineState *machine,
+ int pci_enabled,
+ int kvmclock_enabled,
+ DeviceState **pc_icc_bridge,
+ MemoryRegion **pc_ram_memory,
+ MemoryRegion **pc_pci_memory,
+ qemu_irq **pc_gsi,
+ GSIState **pc_gsi_state,
+ FWCfgState **pc_fw_cfg)
{
PCMachineState *pc_machine = PC_MACHINE(machine);
MemoryRegion *system_memory = get_system_memory();
- MemoryRegion *system_io = get_system_io();
- int i;
- ram_addr_t below_4g_mem_size, above_4g_mem_size;
- PCIBus *pci_bus;
- ISABus *isa_bus;
- PCII440FXState *i440fx_state;
- int piix3_devfn = -1;
- qemu_irq *cpu_irq;
- qemu_irq *gsi;
- qemu_irq *i8259;
- qemu_irq *smi_irq;
- GSIState *gsi_state;
- DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
- BusState *idebus[MAX_IDE_BUS];
- ISADevice *rtc_state;
- ISADevice *floppy;
- MemoryRegion *ram_memory;
- MemoryRegion *pci_memory;
MemoryRegion *rom_memory;
- DeviceState *icc_bridge;
- FWCfgState *fw_cfg = NULL;
PcGuestInfo *guest_info;
ram_addr_t lowmem;
+ DeviceState *icc_bridge;
+ MemoryRegion *ram_memory;
+ MemoryRegion *pci_memory;
+ qemu_irq *gsi;
+ GSIState *gsi_state;
+ FWCfgState *fw_cfg;
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
* If it doesn't, we need to split it in chunks below and above 4G.
@@ -193,6 +186,31 @@ static void pc_init1(MachineState *machine,
gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
}
+ *pc_icc_bridge = icc_bridge;
+ *pc_ram_memory = ram_memory;
+ *pc_pci_memory = pci_memory;
+ *pc_gsi = gsi;
+ *pc_gsi_state = gsi_state;
+ *pc_fw_cfg = fw_cfg;
+}
+
+static void pc_machine_pci_bus_init(MachineState *machine,
+ int pci_enabled,
+ PCII440FXState **pc_i440fx_state,
+ int *pc_piix3_devfn,
+ PCIBus **pc_pci_bus,
+ ISABus **pc_isa_bus,
+ qemu_irq *gsi,
+ MemoryRegion *pci_memory,
+ MemoryRegion *ram_memory)
+{
+ MemoryRegion *system_memory = get_system_memory();
+ MemoryRegion *system_io = get_system_io();
+ PCII440FXState *i440fx_state;
+ int piix3_devfn;
+ PCIBus *pci_bus;
+ ISABus *isa_bus;
+
if (pci_enabled) {
pci_bus = i440fx_init(TYPE_I440FX_PCI_HOST_BRIDGE,
TYPE_I440FX_PCI_DEVICE,
@@ -207,6 +225,33 @@ static void pc_init1(MachineState *machine,
isa_bus = isa_bus_new(NULL, system_io);
no_hpet = 1;
}
+
+ *pc_i440fx_state = i440fx_state;
+ *pc_piix3_devfn = piix3_devfn;
+ *pc_pci_bus = pci_bus;
+ *pc_isa_bus = isa_bus;
+}
+
+static void pc_machine_device_init(MachineState *machine,
+ int pci_enabled,
+ GSIState *gsi_state,
+ DeviceState *icc_bridge,
+ int piix3_devfn,
+ FWCfgState *fw_cfg,
+ PCIBus *pci_bus,
+ ISABus *isa_bus,
+ qemu_irq *gsi)
+{
+ int i;
+ DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
+ BusState *idebus[MAX_IDE_BUS];
+ qemu_irq *smi_irq;
+ PCMachineState *pc_machine = PC_MACHINE(machine);
+ qemu_irq *cpu_irq;
+ qemu_irq *i8259;
+ ISADevice *rtc_state;
+ ISADevice *floppy;
+
isa_bus_irqs(isa_bus, gsi);
if (kvm_irqchip_in_kernel()) {
@@ -294,6 +339,30 @@ static void pc_init1(MachineState *machine,
}
}
+/* PC hardware initialisation */
+static void pc_init1(MachineState *machine,
+ int pci_enabled,
+ int kvmclock_enabled)
+{
+ PCIBus *pci_bus = NULL;
+ ISABus *isa_bus = NULL;
+ PCII440FXState *i440fx_state = NULL;
+ int piix3_devfn = -1;
+ qemu_irq *gsi = NULL;
+ GSIState *gsi_state = NULL;
+ MemoryRegion *ram_memory = NULL;
+ MemoryRegion *pci_memory = NULL;
+ DeviceState *icc_bridge = NULL;
+ FWCfgState *fw_cfg = NULL;
+
+ pc_machine_base_init(machine, pci_enabled, kvmclock_enabled, &icc_bridge,
+ &ram_memory, &pci_memory, &gsi, &gsi_state, &fw_cfg);
+ pc_machine_pci_bus_init(machine, pci_enabled, &i440fx_state, &piix3_devfn,
+ &pci_bus, &isa_bus, gsi, pci_memory, ram_memory);
+ pc_machine_device_init(machine, pci_enabled, gsi_state, icc_bridge,
+ piix3_devfn, fw_cfg, pci_bus, isa_bus, gsi);
+}
+
static void pc_init_pci(MachineState *machine)
{
pc_init1(machine, 1, 1);
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [v3][PATCH 3/4] xen:hw:pci-host:piix: create host bridge to passthrough
2014-07-31 12:09 ` Tiejun Chen
@ 2014-07-31 12:09 ` Tiejun Chen
-1 siblings, 0 replies; 28+ messages in thread
From: Tiejun Chen @ 2014-07-31 12:09 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
Implement a pci host bridge specific to passthrough. Actually
this just inherits the standard one.
This is based on http://patchwork.ozlabs.org/patch/363810/.
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
hw/pci-host/piix.c | 41 +++++++++++++++++++++++++++++++++++++++++
include/hw/i386/pc.h | 2 ++
2 files changed, 43 insertions(+)
v3:
* Rebase
v2:
* Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 0cd82b8..26ba1e5 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -93,6 +93,9 @@ typedef struct PIIX3State {
#define I440FX_PCI_DEVICE(obj) \
OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
+#define XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(obj) \
+ OBJECT_CHECK(PCII440FXState, (obj), TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE)
+
struct PCII440FXState {
/*< private >*/
PCIDevice parent_obj;
@@ -303,6 +306,16 @@ static int i440fx_initfn(PCIDevice *dev)
return 0;
}
+static int xen_igd_passthrough_i440fx_initfn(PCIDevice *dev)
+{
+ PCII440FXState *d = XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(dev);
+
+ dev->config[I440FX_SMRAM] = 0x02;
+
+ cpu_smm_register(&i440fx_set_smm, d);
+ return 0;
+}
+
PCIBus *i440fx_init(const char *host_type, const char *pci_type,
PCII440FXState **pi440fx_state,
int *piix3_devfn,
@@ -703,6 +716,33 @@ static const TypeInfo i440fx_info = {
.class_init = i440fx_class_init,
};
+static void xen_igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+ k->init = xen_igd_passthrough_i440fx_initfn;
+ k->vendor_id = PCI_VENDOR_ID_INTEL;
+ k->device_id = PCI_DEVICE_ID_INTEL_82441;
+ k->revision = 0x02;
+ k->class_id = PCI_CLASS_BRIDGE_HOST;
+ dc->desc = "IGD PT XEN Host bridge";
+ dc->vmsd = &vmstate_i440fx;
+ /*
+ * PCI-facing part of the host bridge, not usable without the
+ * host-facing part, which can't be device_add'ed, yet.
+ */
+ dc->cannot_instantiate_with_device_add_yet = true;
+ dc->hotpluggable = false;
+}
+
+static const TypeInfo xen_igd_passthrough_i440fx_info = {
+ .name = TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE,
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCII440FXState),
+ .class_init = xen_igd_passthrough_i440fx_class_init,
+};
+
static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
PCIBus *rootbus)
{
@@ -744,6 +784,7 @@ static const TypeInfo i440fx_pcihost_info = {
static void i440fx_register_types(void)
{
type_register_static(&i440fx_info);
+ type_register_static(&xen_igd_passthrough_i440fx_info);
type_register_static(&piix3_info);
type_register_static(&piix3_xen_info);
type_register_static(&i440fx_pcihost_info);
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 9778a71..98ae1a3 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -233,6 +233,8 @@ typedef struct PCII440FXState PCII440FXState;
#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
#define TYPE_I440FX_PCI_DEVICE "i440FX"
+#define TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "xen-igd-passthrough-i440FX"
+
PCIBus *i440fx_init(const char *host_type, const char *pci_type,
PCII440FXState **pi440fx_state, int *piix_devfn,
ISABus **isa_bus, qemu_irq *pic,
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [v3][PATCH 3/4] xen:hw:pci-host:piix: create host bridge to passthrough
@ 2014-07-31 12:09 ` Tiejun Chen
0 siblings, 0 replies; 28+ messages in thread
From: Tiejun Chen @ 2014-07-31 12:09 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
Implement a pci host bridge specific to passthrough. Actually
this just inherits the standard one.
This is based on http://patchwork.ozlabs.org/patch/363810/.
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
hw/pci-host/piix.c | 41 +++++++++++++++++++++++++++++++++++++++++
include/hw/i386/pc.h | 2 ++
2 files changed, 43 insertions(+)
v3:
* Rebase
v2:
* Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 0cd82b8..26ba1e5 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -93,6 +93,9 @@ typedef struct PIIX3State {
#define I440FX_PCI_DEVICE(obj) \
OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
+#define XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(obj) \
+ OBJECT_CHECK(PCII440FXState, (obj), TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE)
+
struct PCII440FXState {
/*< private >*/
PCIDevice parent_obj;
@@ -303,6 +306,16 @@ static int i440fx_initfn(PCIDevice *dev)
return 0;
}
+static int xen_igd_passthrough_i440fx_initfn(PCIDevice *dev)
+{
+ PCII440FXState *d = XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(dev);
+
+ dev->config[I440FX_SMRAM] = 0x02;
+
+ cpu_smm_register(&i440fx_set_smm, d);
+ return 0;
+}
+
PCIBus *i440fx_init(const char *host_type, const char *pci_type,
PCII440FXState **pi440fx_state,
int *piix3_devfn,
@@ -703,6 +716,33 @@ static const TypeInfo i440fx_info = {
.class_init = i440fx_class_init,
};
+static void xen_igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+ k->init = xen_igd_passthrough_i440fx_initfn;
+ k->vendor_id = PCI_VENDOR_ID_INTEL;
+ k->device_id = PCI_DEVICE_ID_INTEL_82441;
+ k->revision = 0x02;
+ k->class_id = PCI_CLASS_BRIDGE_HOST;
+ dc->desc = "IGD PT XEN Host bridge";
+ dc->vmsd = &vmstate_i440fx;
+ /*
+ * PCI-facing part of the host bridge, not usable without the
+ * host-facing part, which can't be device_add'ed, yet.
+ */
+ dc->cannot_instantiate_with_device_add_yet = true;
+ dc->hotpluggable = false;
+}
+
+static const TypeInfo xen_igd_passthrough_i440fx_info = {
+ .name = TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE,
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(PCII440FXState),
+ .class_init = xen_igd_passthrough_i440fx_class_init,
+};
+
static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
PCIBus *rootbus)
{
@@ -744,6 +784,7 @@ static const TypeInfo i440fx_pcihost_info = {
static void i440fx_register_types(void)
{
type_register_static(&i440fx_info);
+ type_register_static(&xen_igd_passthrough_i440fx_info);
type_register_static(&piix3_info);
type_register_static(&piix3_xen_info);
type_register_static(&i440fx_pcihost_info);
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 9778a71..98ae1a3 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -233,6 +233,8 @@ typedef struct PCII440FXState PCII440FXState;
#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
#define TYPE_I440FX_PCI_DEVICE "i440FX"
+#define TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "xen-igd-passthrough-i440FX"
+
PCIBus *i440fx_init(const char *host_type, const char *pci_type,
PCII440FXState **pi440fx_state, int *piix_devfn,
ISABus **isa_bus, qemu_irq *pic,
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [v3][PATCH 4/4] xen:hw:i386:pc_piix: introduce new machine for IGD passthrough
2014-07-31 12:09 ` Tiejun Chen
@ 2014-07-31 12:09 ` Tiejun Chen
-1 siblings, 0 replies; 28+ messages in thread
From: Tiejun Chen @ 2014-07-31 12:09 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
Now we can introduce a new machine, xenigd, specific to IGD
passthrough. This can avoid involving other common codes.
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
hw/i386/pc_piix.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+)
v3:
* Rebase
v2:
* Unify prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough like patch #3
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 0c40b06..cde39d6 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -232,6 +232,46 @@ static void pc_machine_pci_bus_init(MachineState *machine,
*pc_isa_bus = isa_bus;
}
+#ifdef CONFIG_XEN
+static void xen_igd_passthrough_pc_machine_pci_bus_init(MachineState *machine,
+ int pci_enabled,
+ PCII440FXState **pc_i440fx_state,
+ int *pc_piix3_devfn,
+ PCIBus **pc_pci_bus,
+ ISABus **pc_isa_bus,
+ qemu_irq *gsi,
+ MemoryRegion *pci_memory,
+ MemoryRegion *ram_memory)
+{
+ MemoryRegion *system_memory = get_system_memory();
+ MemoryRegion *system_io = get_system_io();
+ PCII440FXState *i440fx_state;
+ int piix3_devfn;
+ PCIBus *pci_bus;
+ ISABus *isa_bus;
+
+ if (pci_enabled) {
+ pci_bus = i440fx_init(TYPE_I440FX_PCI_HOST_BRIDGE,
+ TYPE_XEN_IGD_PASSTHROUGH_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,
+ pci_memory, ram_memory);
+ } else {
+ pci_bus = NULL;
+ i440fx_state = NULL;
+ isa_bus = isa_bus_new(NULL, system_io);
+ no_hpet = 1;
+ }
+
+ *pc_i440fx_state = i440fx_state;
+ *pc_piix3_devfn = piix3_devfn;
+ *pc_pci_bus = pci_bus;
+ *pc_isa_bus = isa_bus;
+}
+#endif
+
static void pc_machine_device_init(MachineState *machine,
int pci_enabled,
GSIState *gsi_state,
@@ -368,6 +408,38 @@ static void pc_init_pci(MachineState *machine)
pc_init1(machine, 1, 1);
}
+#ifdef CONFIG_XEN
+static void xen_igd_passthrough_pc_init1(MachineState *machine,
+ int pci_enabled,
+ int kvmclock_enabled)
+{
+ PCIBus *pci_bus = NULL;
+ ISABus *isa_bus = NULL;
+ PCII440FXState *i440fx_state = NULL;
+ int piix3_devfn = -1;
+ qemu_irq *gsi = NULL;
+ GSIState *gsi_state = NULL;
+ MemoryRegion *ram_memory = NULL;
+ MemoryRegion *pci_memory = NULL;
+ DeviceState *icc_bridge = NULL;
+ FWCfgState *fw_cfg = NULL;
+
+ pc_machine_base_init(machine, pci_enabled, kvmclock_enabled, &icc_bridge,
+ &ram_memory, &pci_memory, &gsi, &gsi_state, &fw_cfg);
+ xen_igd_passthrough_pc_machine_pci_bus_init(machine, pci_enabled,
+ &i440fx_state, &piix3_devfn,
+ &pci_bus, &isa_bus, gsi,
+ pci_memory, ram_memory);
+ pc_machine_device_init(machine, pci_enabled, gsi_state, icc_bridge,
+ piix3_devfn, fw_cfg, pci_bus, isa_bus, gsi);
+}
+
+static void xen_igd_passthrough_pc_init_pci(MachineState *machine)
+{
+ xen_igd_passthrough_pc_init1(machine, 1, 1);
+}
+#endif
+
static void pc_compat_2_0(MachineState *machine)
{
/* This value depends on the actual DSDT and SSDT compiled into
@@ -514,6 +586,18 @@ static void pc_xen_hvm_init(MachineState *machine)
pci_create_simple(bus, -1, "xen-platform");
}
}
+
+static void xen_igd_passthrough_pc_hvm_init(MachineState *machine)
+{
+ PCIBus *bus;
+
+ xen_igd_passthrough_pc_init_pci(machine);
+
+ bus = pci_find_primary_bus();
+ if (bus != NULL) {
+ pci_create_simple(bus, -1, "xen-platform");
+ }
+}
#endif
#define PC_I440FX_MACHINE_OPTIONS \
@@ -963,6 +1047,27 @@ static QEMUMachine xenfv_machine = {
{ /* end of list */ }
},
};
+
+static QEMUMachine xenigd_machine = {
+ PC_COMMON_MACHINE_OPTIONS,
+ .name = "xenigd",
+ .desc = "Xen Fully-virtualized PC specific to IGD",
+ .init = xen_igd_passthrough_pc_hvm_init,
+ .max_cpus = HVM_MAX_VCPUS,
+ .default_machine_opts = "accel=xen",
+ .hot_add_cpu = pc_hot_add_cpu,
+ .compat_props = (GlobalProperty[]) {
+ /* xenfv has no fwcfg and so does not load acpi from QEMU.
+ * as such new acpi features don't work.
+ */
+ {
+ .driver = "PIIX4_PM",
+ .property = "acpi-pci-hotplug-with-bridge-support",
+ .value = "off",
+ },
+ { /* end of list */ }
+ },
+};
#endif
static void pc_machine_init(void)
@@ -986,6 +1091,7 @@ static void pc_machine_init(void)
qemu_register_pc_machine(&isapc_machine);
#ifdef CONFIG_XEN
qemu_register_pc_machine(&xenfv_machine);
+ qemu_register_pc_machine(&xenigd_machine);
#endif
}
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [v3][PATCH 4/4] xen:hw:i386:pc_piix: introduce new machine for IGD passthrough
@ 2014-07-31 12:09 ` Tiejun Chen
0 siblings, 0 replies; 28+ messages in thread
From: Tiejun Chen @ 2014-07-31 12:09 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
Now we can introduce a new machine, xenigd, specific to IGD
passthrough. This can avoid involving other common codes.
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
hw/i386/pc_piix.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+)
v3:
* Rebase
v2:
* Unify prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough like patch #3
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 0c40b06..cde39d6 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -232,6 +232,46 @@ static void pc_machine_pci_bus_init(MachineState *machine,
*pc_isa_bus = isa_bus;
}
+#ifdef CONFIG_XEN
+static void xen_igd_passthrough_pc_machine_pci_bus_init(MachineState *machine,
+ int pci_enabled,
+ PCII440FXState **pc_i440fx_state,
+ int *pc_piix3_devfn,
+ PCIBus **pc_pci_bus,
+ ISABus **pc_isa_bus,
+ qemu_irq *gsi,
+ MemoryRegion *pci_memory,
+ MemoryRegion *ram_memory)
+{
+ MemoryRegion *system_memory = get_system_memory();
+ MemoryRegion *system_io = get_system_io();
+ PCII440FXState *i440fx_state;
+ int piix3_devfn;
+ PCIBus *pci_bus;
+ ISABus *isa_bus;
+
+ if (pci_enabled) {
+ pci_bus = i440fx_init(TYPE_I440FX_PCI_HOST_BRIDGE,
+ TYPE_XEN_IGD_PASSTHROUGH_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,
+ pci_memory, ram_memory);
+ } else {
+ pci_bus = NULL;
+ i440fx_state = NULL;
+ isa_bus = isa_bus_new(NULL, system_io);
+ no_hpet = 1;
+ }
+
+ *pc_i440fx_state = i440fx_state;
+ *pc_piix3_devfn = piix3_devfn;
+ *pc_pci_bus = pci_bus;
+ *pc_isa_bus = isa_bus;
+}
+#endif
+
static void pc_machine_device_init(MachineState *machine,
int pci_enabled,
GSIState *gsi_state,
@@ -368,6 +408,38 @@ static void pc_init_pci(MachineState *machine)
pc_init1(machine, 1, 1);
}
+#ifdef CONFIG_XEN
+static void xen_igd_passthrough_pc_init1(MachineState *machine,
+ int pci_enabled,
+ int kvmclock_enabled)
+{
+ PCIBus *pci_bus = NULL;
+ ISABus *isa_bus = NULL;
+ PCII440FXState *i440fx_state = NULL;
+ int piix3_devfn = -1;
+ qemu_irq *gsi = NULL;
+ GSIState *gsi_state = NULL;
+ MemoryRegion *ram_memory = NULL;
+ MemoryRegion *pci_memory = NULL;
+ DeviceState *icc_bridge = NULL;
+ FWCfgState *fw_cfg = NULL;
+
+ pc_machine_base_init(machine, pci_enabled, kvmclock_enabled, &icc_bridge,
+ &ram_memory, &pci_memory, &gsi, &gsi_state, &fw_cfg);
+ xen_igd_passthrough_pc_machine_pci_bus_init(machine, pci_enabled,
+ &i440fx_state, &piix3_devfn,
+ &pci_bus, &isa_bus, gsi,
+ pci_memory, ram_memory);
+ pc_machine_device_init(machine, pci_enabled, gsi_state, icc_bridge,
+ piix3_devfn, fw_cfg, pci_bus, isa_bus, gsi);
+}
+
+static void xen_igd_passthrough_pc_init_pci(MachineState *machine)
+{
+ xen_igd_passthrough_pc_init1(machine, 1, 1);
+}
+#endif
+
static void pc_compat_2_0(MachineState *machine)
{
/* This value depends on the actual DSDT and SSDT compiled into
@@ -514,6 +586,18 @@ static void pc_xen_hvm_init(MachineState *machine)
pci_create_simple(bus, -1, "xen-platform");
}
}
+
+static void xen_igd_passthrough_pc_hvm_init(MachineState *machine)
+{
+ PCIBus *bus;
+
+ xen_igd_passthrough_pc_init_pci(machine);
+
+ bus = pci_find_primary_bus();
+ if (bus != NULL) {
+ pci_create_simple(bus, -1, "xen-platform");
+ }
+}
#endif
#define PC_I440FX_MACHINE_OPTIONS \
@@ -963,6 +1047,27 @@ static QEMUMachine xenfv_machine = {
{ /* end of list */ }
},
};
+
+static QEMUMachine xenigd_machine = {
+ PC_COMMON_MACHINE_OPTIONS,
+ .name = "xenigd",
+ .desc = "Xen Fully-virtualized PC specific to IGD",
+ .init = xen_igd_passthrough_pc_hvm_init,
+ .max_cpus = HVM_MAX_VCPUS,
+ .default_machine_opts = "accel=xen",
+ .hot_add_cpu = pc_hot_add_cpu,
+ .compat_props = (GlobalProperty[]) {
+ /* xenfv has no fwcfg and so does not load acpi from QEMU.
+ * as such new acpi features don't work.
+ */
+ {
+ .driver = "PIIX4_PM",
+ .property = "acpi-pci-hotplug-with-bridge-support",
+ .value = "off",
+ },
+ { /* end of list */ }
+ },
+};
#endif
static void pc_machine_init(void)
@@ -986,6 +1091,7 @@ static void pc_machine_init(void)
qemu_register_pc_machine(&isapc_machine);
#ifdef CONFIG_XEN
qemu_register_pc_machine(&xenfv_machine);
+ qemu_register_pc_machine(&xenigd_machine);
#endif
}
--
1.9.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [Xen-devel] [v3][PATCH 0/5] xen: introduce new machine for IGD passthrough
2014-07-31 12:09 ` Tiejun Chen
@ 2014-08-04 5:39 ` Chen, Tiejun
-1 siblings, 0 replies; 28+ messages in thread
From: Chen, Tiejun @ 2014-08-04 5:39 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On 2014/7/31 20:09, Tiejun Chen wrote:
> v3:
>
> * Drop patch #4
> * Add one patch #1 from Michael
> * Rebase
>
> v2:
>
> * Fix some coding style
> * New patch to separate i440fx_init
> * Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
> * Based on patch #2 to regenerate
> * Unify prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough like patch #3
> * Test: boot with a preinstalled ubuntu 14.04
> ./i386-softmmu/qemu-system-i386 -hda test.img -m 2560 -boot c -machine pc
In plus, ./i386-softmmu/qemu-system-i386 -hda winxp-32.img -m 2560 -boot
c -machine pc
Thanks
Tiejun
>
> As we discussed we need to create a separate machine to support current
> IGD passthrough.
>
> ----------------------------------------------------------------
> Tiejun Chen (4):
> i440fx: make types configurable at run-time
> hw:i386:pc_piix: split pc_init1()
> xen:hw:pci-host:piix: create host bridge to passthrough
> xen:hw:i386:pc_piix: introduce new machine for IGD passthrough
>
> hw/i386/pc_piix.c | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
> hw/pci-host/piix.c | 50 ++++++++++++++++++++++++++++++++++----
> include/hw/i386/pc.h | 8 ++++++-
> 3 files changed, 254 insertions(+), 31 deletions(-)
>
> Thanks
> Tiejun
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Xen-devel] [v3][PATCH 0/5] xen: introduce new machine for IGD passthrough
@ 2014-08-04 5:39 ` Chen, Tiejun
0 siblings, 0 replies; 28+ messages in thread
From: Chen, Tiejun @ 2014-08-04 5:39 UTC (permalink / raw)
To: mst; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On 2014/7/31 20:09, Tiejun Chen wrote:
> v3:
>
> * Drop patch #4
> * Add one patch #1 from Michael
> * Rebase
>
> v2:
>
> * Fix some coding style
> * New patch to separate i440fx_init
> * Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
> * Based on patch #2 to regenerate
> * Unify prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough like patch #3
> * Test: boot with a preinstalled ubuntu 14.04
> ./i386-softmmu/qemu-system-i386 -hda test.img -m 2560 -boot c -machine pc
In plus, ./i386-softmmu/qemu-system-i386 -hda winxp-32.img -m 2560 -boot
c -machine pc
Thanks
Tiejun
>
> As we discussed we need to create a separate machine to support current
> IGD passthrough.
>
> ----------------------------------------------------------------
> Tiejun Chen (4):
> i440fx: make types configurable at run-time
> hw:i386:pc_piix: split pc_init1()
> xen:hw:pci-host:piix: create host bridge to passthrough
> xen:hw:i386:pc_piix: introduce new machine for IGD passthrough
>
> hw/i386/pc_piix.c | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
> hw/pci-host/piix.c | 50 ++++++++++++++++++++++++++++++++++----
> include/hw/i386/pc.h | 8 ++++++-
> 3 files changed, 254 insertions(+), 31 deletions(-)
>
> Thanks
> Tiejun
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [v3][PATCH 1/4] i440fx: make types configurable at run-time
2014-07-31 12:09 ` Tiejun Chen
@ 2014-08-04 13:48 ` Michael S. Tsirkin
-1 siblings, 0 replies; 28+ messages in thread
From: Michael S. Tsirkin @ 2014-08-04 13:48 UTC (permalink / raw)
To: Tiejun Chen; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On Thu, Jul 31, 2014 at 08:09:31PM +0800, Tiejun Chen wrote:
> 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>
You should have a From: line too, otherwise
git will set the Author field incorrectly.
> ---
> 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(-)
>
> v3:
>
> * New patch from Michael
>
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 9694f88..928c12c 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -194,7 +194,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 e0e0946..0cd82b8 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 f4b9b2b..9778a71 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -230,7 +230,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,
> --
> 1.9.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [v3][PATCH 1/4] i440fx: make types configurable at run-time
@ 2014-08-04 13:48 ` Michael S. Tsirkin
0 siblings, 0 replies; 28+ messages in thread
From: Michael S. Tsirkin @ 2014-08-04 13:48 UTC (permalink / raw)
To: Tiejun Chen; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On Thu, Jul 31, 2014 at 08:09:31PM +0800, Tiejun Chen wrote:
> 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>
You should have a From: line too, otherwise
git will set the Author field incorrectly.
> ---
> 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(-)
>
> v3:
>
> * New patch from Michael
>
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 9694f88..928c12c 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -194,7 +194,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 e0e0946..0cd82b8 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 f4b9b2b..9778a71 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -230,7 +230,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,
> --
> 1.9.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [v3][PATCH 2/4] hw:i386:pc_piix: split pc_init1()
2014-07-31 12:09 ` Tiejun Chen
@ 2014-08-04 13:48 ` Michael S. Tsirkin
-1 siblings, 0 replies; 28+ messages in thread
From: Michael S. Tsirkin @ 2014-08-04 13:48 UTC (permalink / raw)
To: Tiejun Chen; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On Thu, Jul 31, 2014 at 08:09:32PM +0800, Tiejun Chen wrote:
> We'd like to split pc_init1 and then we can share something
> with other stuff.
>
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
With patch 1 in place, this should not be
necessary - just propage the correct types
around.
> ---
> hw/i386/pc_piix.c | 117 +++++++++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 93 insertions(+), 24 deletions(-)
>
> v3:
>
> * Rebase
>
> v2:
>
> * Fix some coding style
>
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 928c12c..0c40b06 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -71,36 +71,29 @@ static bool smbios_legacy_mode;
> static bool gigabyte_align = true;
> static bool has_reserved_memory = true;
>
> -/* PC hardware initialisation */
> -static void pc_init1(MachineState *machine,
> - int pci_enabled,
> - int kvmclock_enabled)
> +static ram_addr_t below_4g_mem_size;
> +static ram_addr_t above_4g_mem_size;
> +static void pc_machine_base_init(MachineState *machine,
> + int pci_enabled,
> + int kvmclock_enabled,
> + DeviceState **pc_icc_bridge,
> + MemoryRegion **pc_ram_memory,
> + MemoryRegion **pc_pci_memory,
> + qemu_irq **pc_gsi,
> + GSIState **pc_gsi_state,
> + FWCfgState **pc_fw_cfg)
> {
> PCMachineState *pc_machine = PC_MACHINE(machine);
> MemoryRegion *system_memory = get_system_memory();
> - MemoryRegion *system_io = get_system_io();
> - int i;
> - ram_addr_t below_4g_mem_size, above_4g_mem_size;
> - PCIBus *pci_bus;
> - ISABus *isa_bus;
> - PCII440FXState *i440fx_state;
> - int piix3_devfn = -1;
> - qemu_irq *cpu_irq;
> - qemu_irq *gsi;
> - qemu_irq *i8259;
> - qemu_irq *smi_irq;
> - GSIState *gsi_state;
> - DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
> - BusState *idebus[MAX_IDE_BUS];
> - ISADevice *rtc_state;
> - ISADevice *floppy;
> - MemoryRegion *ram_memory;
> - MemoryRegion *pci_memory;
> MemoryRegion *rom_memory;
> - DeviceState *icc_bridge;
> - FWCfgState *fw_cfg = NULL;
> PcGuestInfo *guest_info;
> ram_addr_t lowmem;
> + DeviceState *icc_bridge;
> + MemoryRegion *ram_memory;
> + MemoryRegion *pci_memory;
> + qemu_irq *gsi;
> + GSIState *gsi_state;
> + FWCfgState *fw_cfg;
>
> /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
> * If it doesn't, we need to split it in chunks below and above 4G.
> @@ -193,6 +186,31 @@ static void pc_init1(MachineState *machine,
> gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
> }
>
> + *pc_icc_bridge = icc_bridge;
> + *pc_ram_memory = ram_memory;
> + *pc_pci_memory = pci_memory;
> + *pc_gsi = gsi;
> + *pc_gsi_state = gsi_state;
> + *pc_fw_cfg = fw_cfg;
> +}
> +
> +static void pc_machine_pci_bus_init(MachineState *machine,
> + int pci_enabled,
> + PCII440FXState **pc_i440fx_state,
> + int *pc_piix3_devfn,
> + PCIBus **pc_pci_bus,
> + ISABus **pc_isa_bus,
> + qemu_irq *gsi,
> + MemoryRegion *pci_memory,
> + MemoryRegion *ram_memory)
> +{
> + MemoryRegion *system_memory = get_system_memory();
> + MemoryRegion *system_io = get_system_io();
> + PCII440FXState *i440fx_state;
> + int piix3_devfn;
> + PCIBus *pci_bus;
> + ISABus *isa_bus;
> +
> if (pci_enabled) {
> pci_bus = i440fx_init(TYPE_I440FX_PCI_HOST_BRIDGE,
> TYPE_I440FX_PCI_DEVICE,
> @@ -207,6 +225,33 @@ static void pc_init1(MachineState *machine,
> isa_bus = isa_bus_new(NULL, system_io);
> no_hpet = 1;
> }
> +
> + *pc_i440fx_state = i440fx_state;
> + *pc_piix3_devfn = piix3_devfn;
> + *pc_pci_bus = pci_bus;
> + *pc_isa_bus = isa_bus;
> +}
> +
> +static void pc_machine_device_init(MachineState *machine,
> + int pci_enabled,
> + GSIState *gsi_state,
> + DeviceState *icc_bridge,
> + int piix3_devfn,
> + FWCfgState *fw_cfg,
> + PCIBus *pci_bus,
> + ISABus *isa_bus,
> + qemu_irq *gsi)
> +{
> + int i;
> + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
> + BusState *idebus[MAX_IDE_BUS];
> + qemu_irq *smi_irq;
> + PCMachineState *pc_machine = PC_MACHINE(machine);
> + qemu_irq *cpu_irq;
> + qemu_irq *i8259;
> + ISADevice *rtc_state;
> + ISADevice *floppy;
> +
> isa_bus_irqs(isa_bus, gsi);
>
> if (kvm_irqchip_in_kernel()) {
> @@ -294,6 +339,30 @@ static void pc_init1(MachineState *machine,
> }
> }
>
> +/* PC hardware initialisation */
> +static void pc_init1(MachineState *machine,
> + int pci_enabled,
> + int kvmclock_enabled)
> +{
> + PCIBus *pci_bus = NULL;
> + ISABus *isa_bus = NULL;
> + PCII440FXState *i440fx_state = NULL;
> + int piix3_devfn = -1;
> + qemu_irq *gsi = NULL;
> + GSIState *gsi_state = NULL;
> + MemoryRegion *ram_memory = NULL;
> + MemoryRegion *pci_memory = NULL;
> + DeviceState *icc_bridge = NULL;
> + FWCfgState *fw_cfg = NULL;
> +
> + pc_machine_base_init(machine, pci_enabled, kvmclock_enabled, &icc_bridge,
> + &ram_memory, &pci_memory, &gsi, &gsi_state, &fw_cfg);
> + pc_machine_pci_bus_init(machine, pci_enabled, &i440fx_state, &piix3_devfn,
> + &pci_bus, &isa_bus, gsi, pci_memory, ram_memory);
> + pc_machine_device_init(machine, pci_enabled, gsi_state, icc_bridge,
> + piix3_devfn, fw_cfg, pci_bus, isa_bus, gsi);
> +}
> +
> static void pc_init_pci(MachineState *machine)
> {
> pc_init1(machine, 1, 1);
> --
> 1.9.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [v3][PATCH 2/4] hw:i386:pc_piix: split pc_init1()
@ 2014-08-04 13:48 ` Michael S. Tsirkin
0 siblings, 0 replies; 28+ messages in thread
From: Michael S. Tsirkin @ 2014-08-04 13:48 UTC (permalink / raw)
To: Tiejun Chen; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On Thu, Jul 31, 2014 at 08:09:32PM +0800, Tiejun Chen wrote:
> We'd like to split pc_init1 and then we can share something
> with other stuff.
>
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
With patch 1 in place, this should not be
necessary - just propage the correct types
around.
> ---
> hw/i386/pc_piix.c | 117 +++++++++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 93 insertions(+), 24 deletions(-)
>
> v3:
>
> * Rebase
>
> v2:
>
> * Fix some coding style
>
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 928c12c..0c40b06 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -71,36 +71,29 @@ static bool smbios_legacy_mode;
> static bool gigabyte_align = true;
> static bool has_reserved_memory = true;
>
> -/* PC hardware initialisation */
> -static void pc_init1(MachineState *machine,
> - int pci_enabled,
> - int kvmclock_enabled)
> +static ram_addr_t below_4g_mem_size;
> +static ram_addr_t above_4g_mem_size;
> +static void pc_machine_base_init(MachineState *machine,
> + int pci_enabled,
> + int kvmclock_enabled,
> + DeviceState **pc_icc_bridge,
> + MemoryRegion **pc_ram_memory,
> + MemoryRegion **pc_pci_memory,
> + qemu_irq **pc_gsi,
> + GSIState **pc_gsi_state,
> + FWCfgState **pc_fw_cfg)
> {
> PCMachineState *pc_machine = PC_MACHINE(machine);
> MemoryRegion *system_memory = get_system_memory();
> - MemoryRegion *system_io = get_system_io();
> - int i;
> - ram_addr_t below_4g_mem_size, above_4g_mem_size;
> - PCIBus *pci_bus;
> - ISABus *isa_bus;
> - PCII440FXState *i440fx_state;
> - int piix3_devfn = -1;
> - qemu_irq *cpu_irq;
> - qemu_irq *gsi;
> - qemu_irq *i8259;
> - qemu_irq *smi_irq;
> - GSIState *gsi_state;
> - DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
> - BusState *idebus[MAX_IDE_BUS];
> - ISADevice *rtc_state;
> - ISADevice *floppy;
> - MemoryRegion *ram_memory;
> - MemoryRegion *pci_memory;
> MemoryRegion *rom_memory;
> - DeviceState *icc_bridge;
> - FWCfgState *fw_cfg = NULL;
> PcGuestInfo *guest_info;
> ram_addr_t lowmem;
> + DeviceState *icc_bridge;
> + MemoryRegion *ram_memory;
> + MemoryRegion *pci_memory;
> + qemu_irq *gsi;
> + GSIState *gsi_state;
> + FWCfgState *fw_cfg;
>
> /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
> * If it doesn't, we need to split it in chunks below and above 4G.
> @@ -193,6 +186,31 @@ static void pc_init1(MachineState *machine,
> gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
> }
>
> + *pc_icc_bridge = icc_bridge;
> + *pc_ram_memory = ram_memory;
> + *pc_pci_memory = pci_memory;
> + *pc_gsi = gsi;
> + *pc_gsi_state = gsi_state;
> + *pc_fw_cfg = fw_cfg;
> +}
> +
> +static void pc_machine_pci_bus_init(MachineState *machine,
> + int pci_enabled,
> + PCII440FXState **pc_i440fx_state,
> + int *pc_piix3_devfn,
> + PCIBus **pc_pci_bus,
> + ISABus **pc_isa_bus,
> + qemu_irq *gsi,
> + MemoryRegion *pci_memory,
> + MemoryRegion *ram_memory)
> +{
> + MemoryRegion *system_memory = get_system_memory();
> + MemoryRegion *system_io = get_system_io();
> + PCII440FXState *i440fx_state;
> + int piix3_devfn;
> + PCIBus *pci_bus;
> + ISABus *isa_bus;
> +
> if (pci_enabled) {
> pci_bus = i440fx_init(TYPE_I440FX_PCI_HOST_BRIDGE,
> TYPE_I440FX_PCI_DEVICE,
> @@ -207,6 +225,33 @@ static void pc_init1(MachineState *machine,
> isa_bus = isa_bus_new(NULL, system_io);
> no_hpet = 1;
> }
> +
> + *pc_i440fx_state = i440fx_state;
> + *pc_piix3_devfn = piix3_devfn;
> + *pc_pci_bus = pci_bus;
> + *pc_isa_bus = isa_bus;
> +}
> +
> +static void pc_machine_device_init(MachineState *machine,
> + int pci_enabled,
> + GSIState *gsi_state,
> + DeviceState *icc_bridge,
> + int piix3_devfn,
> + FWCfgState *fw_cfg,
> + PCIBus *pci_bus,
> + ISABus *isa_bus,
> + qemu_irq *gsi)
> +{
> + int i;
> + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
> + BusState *idebus[MAX_IDE_BUS];
> + qemu_irq *smi_irq;
> + PCMachineState *pc_machine = PC_MACHINE(machine);
> + qemu_irq *cpu_irq;
> + qemu_irq *i8259;
> + ISADevice *rtc_state;
> + ISADevice *floppy;
> +
> isa_bus_irqs(isa_bus, gsi);
>
> if (kvm_irqchip_in_kernel()) {
> @@ -294,6 +339,30 @@ static void pc_init1(MachineState *machine,
> }
> }
>
> +/* PC hardware initialisation */
> +static void pc_init1(MachineState *machine,
> + int pci_enabled,
> + int kvmclock_enabled)
> +{
> + PCIBus *pci_bus = NULL;
> + ISABus *isa_bus = NULL;
> + PCII440FXState *i440fx_state = NULL;
> + int piix3_devfn = -1;
> + qemu_irq *gsi = NULL;
> + GSIState *gsi_state = NULL;
> + MemoryRegion *ram_memory = NULL;
> + MemoryRegion *pci_memory = NULL;
> + DeviceState *icc_bridge = NULL;
> + FWCfgState *fw_cfg = NULL;
> +
> + pc_machine_base_init(machine, pci_enabled, kvmclock_enabled, &icc_bridge,
> + &ram_memory, &pci_memory, &gsi, &gsi_state, &fw_cfg);
> + pc_machine_pci_bus_init(machine, pci_enabled, &i440fx_state, &piix3_devfn,
> + &pci_bus, &isa_bus, gsi, pci_memory, ram_memory);
> + pc_machine_device_init(machine, pci_enabled, gsi_state, icc_bridge,
> + piix3_devfn, fw_cfg, pci_bus, isa_bus, gsi);
> +}
> +
> static void pc_init_pci(MachineState *machine)
> {
> pc_init1(machine, 1, 1);
> --
> 1.9.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [v3][PATCH 3/4] xen:hw:pci-host:piix: create host bridge to passthrough
2014-07-31 12:09 ` Tiejun Chen
@ 2014-08-04 13:50 ` Michael S. Tsirkin
-1 siblings, 0 replies; 28+ messages in thread
From: Michael S. Tsirkin @ 2014-08-04 13:50 UTC (permalink / raw)
To: Tiejun Chen; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On Thu, Jul 31, 2014 at 08:09:33PM +0800, Tiejun Chen wrote:
> Implement a pci host bridge specific to passthrough. Actually
> this just inherits the standard one.
>
> This is based on http://patchwork.ozlabs.org/patch/363810/.
>
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
> ---
> hw/pci-host/piix.c | 41 +++++++++++++++++++++++++++++++++++++++++
> include/hw/i386/pc.h | 2 ++
> 2 files changed, 43 insertions(+)
>
> v3:
>
> * Rebase
>
> v2:
>
> * Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
>
> diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
> index 0cd82b8..26ba1e5 100644
> --- a/hw/pci-host/piix.c
> +++ b/hw/pci-host/piix.c
> @@ -93,6 +93,9 @@ typedef struct PIIX3State {
> #define I440FX_PCI_DEVICE(obj) \
> OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
>
> +#define XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(obj) \
> + OBJECT_CHECK(PCII440FXState, (obj), TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE)
> +
> struct PCII440FXState {
> /*< private >*/
> PCIDevice parent_obj;
> @@ -303,6 +306,16 @@ static int i440fx_initfn(PCIDevice *dev)
> return 0;
> }
>
> +static int xen_igd_passthrough_i440fx_initfn(PCIDevice *dev)
> +{
> + PCII440FXState *d = XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(dev);
> +
> + dev->config[I440FX_SMRAM] = 0x02;
> +
> + cpu_smm_register(&i440fx_set_smm, d);
> + return 0;
> +}
> +
This is exactly i440fx_initfn.
Don't copy and paste code like this, reuse existing functions.
> PCIBus *i440fx_init(const char *host_type, const char *pci_type,
> PCII440FXState **pi440fx_state,
> int *piix3_devfn,
> @@ -703,6 +716,33 @@ static const TypeInfo i440fx_info = {
> .class_init = i440fx_class_init,
> };
>
> +static void xen_igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(klass);
> + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
> +
> + k->init = xen_igd_passthrough_i440fx_initfn;
> + k->vendor_id = PCI_VENDOR_ID_INTEL;
> + k->device_id = PCI_DEVICE_ID_INTEL_82441;
> + k->revision = 0x02;
> + k->class_id = PCI_CLASS_BRIDGE_HOST;
> + dc->desc = "IGD PT XEN Host bridge";
> + dc->vmsd = &vmstate_i440fx;
> + /*
> + * PCI-facing part of the host bridge, not usable without the
> + * host-facing part, which can't be device_add'ed, yet.
> + */
> + dc->cannot_instantiate_with_device_add_yet = true;
> + dc->hotpluggable = false;
> +}
> +
> +static const TypeInfo xen_igd_passthrough_i440fx_info = {
> + .name = TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE,
> + .parent = TYPE_PCI_DEVICE,
> + .instance_size = sizeof(PCII440FXState),
> + .class_init = xen_igd_passthrough_i440fx_class_init,
> +};
> +
> static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
> PCIBus *rootbus)
> {
> @@ -744,6 +784,7 @@ static const TypeInfo i440fx_pcihost_info = {
> static void i440fx_register_types(void)
> {
> type_register_static(&i440fx_info);
> + type_register_static(&xen_igd_passthrough_i440fx_info);
> type_register_static(&piix3_info);
> type_register_static(&piix3_xen_info);
> type_register_static(&i440fx_pcihost_info);
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 9778a71..98ae1a3 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -233,6 +233,8 @@ typedef struct PCII440FXState PCII440FXState;
> #define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
> #define TYPE_I440FX_PCI_DEVICE "i440FX"
>
> +#define TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "xen-igd-passthrough-i440FX"
> +
> PCIBus *i440fx_init(const char *host_type, const char *pci_type,
> PCII440FXState **pi440fx_state, int *piix_devfn,
> ISABus **isa_bus, qemu_irq *pic,
> --
> 1.9.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [v3][PATCH 3/4] xen:hw:pci-host:piix: create host bridge to passthrough
@ 2014-08-04 13:50 ` Michael S. Tsirkin
0 siblings, 0 replies; 28+ messages in thread
From: Michael S. Tsirkin @ 2014-08-04 13:50 UTC (permalink / raw)
To: Tiejun Chen; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On Thu, Jul 31, 2014 at 08:09:33PM +0800, Tiejun Chen wrote:
> Implement a pci host bridge specific to passthrough. Actually
> this just inherits the standard one.
>
> This is based on http://patchwork.ozlabs.org/patch/363810/.
>
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
> ---
> hw/pci-host/piix.c | 41 +++++++++++++++++++++++++++++++++++++++++
> include/hw/i386/pc.h | 2 ++
> 2 files changed, 43 insertions(+)
>
> v3:
>
> * Rebase
>
> v2:
>
> * Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
>
> diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
> index 0cd82b8..26ba1e5 100644
> --- a/hw/pci-host/piix.c
> +++ b/hw/pci-host/piix.c
> @@ -93,6 +93,9 @@ typedef struct PIIX3State {
> #define I440FX_PCI_DEVICE(obj) \
> OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
>
> +#define XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(obj) \
> + OBJECT_CHECK(PCII440FXState, (obj), TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE)
> +
> struct PCII440FXState {
> /*< private >*/
> PCIDevice parent_obj;
> @@ -303,6 +306,16 @@ static int i440fx_initfn(PCIDevice *dev)
> return 0;
> }
>
> +static int xen_igd_passthrough_i440fx_initfn(PCIDevice *dev)
> +{
> + PCII440FXState *d = XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(dev);
> +
> + dev->config[I440FX_SMRAM] = 0x02;
> +
> + cpu_smm_register(&i440fx_set_smm, d);
> + return 0;
> +}
> +
This is exactly i440fx_initfn.
Don't copy and paste code like this, reuse existing functions.
> PCIBus *i440fx_init(const char *host_type, const char *pci_type,
> PCII440FXState **pi440fx_state,
> int *piix3_devfn,
> @@ -703,6 +716,33 @@ static const TypeInfo i440fx_info = {
> .class_init = i440fx_class_init,
> };
>
> +static void xen_igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(klass);
> + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
> +
> + k->init = xen_igd_passthrough_i440fx_initfn;
> + k->vendor_id = PCI_VENDOR_ID_INTEL;
> + k->device_id = PCI_DEVICE_ID_INTEL_82441;
> + k->revision = 0x02;
> + k->class_id = PCI_CLASS_BRIDGE_HOST;
> + dc->desc = "IGD PT XEN Host bridge";
> + dc->vmsd = &vmstate_i440fx;
> + /*
> + * PCI-facing part of the host bridge, not usable without the
> + * host-facing part, which can't be device_add'ed, yet.
> + */
> + dc->cannot_instantiate_with_device_add_yet = true;
> + dc->hotpluggable = false;
> +}
> +
> +static const TypeInfo xen_igd_passthrough_i440fx_info = {
> + .name = TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE,
> + .parent = TYPE_PCI_DEVICE,
> + .instance_size = sizeof(PCII440FXState),
> + .class_init = xen_igd_passthrough_i440fx_class_init,
> +};
> +
> static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
> PCIBus *rootbus)
> {
> @@ -744,6 +784,7 @@ static const TypeInfo i440fx_pcihost_info = {
> static void i440fx_register_types(void)
> {
> type_register_static(&i440fx_info);
> + type_register_static(&xen_igd_passthrough_i440fx_info);
> type_register_static(&piix3_info);
> type_register_static(&piix3_xen_info);
> type_register_static(&i440fx_pcihost_info);
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 9778a71..98ae1a3 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -233,6 +233,8 @@ typedef struct PCII440FXState PCII440FXState;
> #define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
> #define TYPE_I440FX_PCI_DEVICE "i440FX"
>
> +#define TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "xen-igd-passthrough-i440FX"
> +
> PCIBus *i440fx_init(const char *host_type, const char *pci_type,
> PCII440FXState **pi440fx_state, int *piix_devfn,
> ISABus **isa_bus, qemu_irq *pic,
> --
> 1.9.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [v3][PATCH 0/5] xen: introduce new machine for IGD passthrough
2014-07-31 12:09 ` Tiejun Chen
@ 2014-08-04 13:51 ` Michael S. Tsirkin
-1 siblings, 0 replies; 28+ messages in thread
From: Michael S. Tsirkin @ 2014-08-04 13:51 UTC (permalink / raw)
To: Tiejun Chen; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On Thu, Jul 31, 2014 at 08:09:30PM +0800, Tiejun Chen wrote:
> v3:
>
> * Drop patch #4
> * Add one patch #1 from Michael
> * Rebase
You added my patch but don't use it, so most of
my comment weren't addressed.
Do you plan to send v4 to address them?
> v2:
>
> * Fix some coding style
> * New patch to separate i440fx_init
> * Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
> * Based on patch #2 to regenerate
> * Unify prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough like patch #3
> * Test: boot with a preinstalled ubuntu 14.04
> ./i386-softmmu/qemu-system-i386 -hda test.img -m 2560 -boot c -machine pc
>
> As we discussed we need to create a separate machine to support current
> IGD passthrough.
>
> ----------------------------------------------------------------
> Tiejun Chen (4):
> i440fx: make types configurable at run-time
> hw:i386:pc_piix: split pc_init1()
> xen:hw:pci-host:piix: create host bridge to passthrough
> xen:hw:i386:pc_piix: introduce new machine for IGD passthrough
>
> hw/i386/pc_piix.c | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
> hw/pci-host/piix.c | 50 ++++++++++++++++++++++++++++++++++----
> include/hw/i386/pc.h | 8 ++++++-
> 3 files changed, 254 insertions(+), 31 deletions(-)
>
> Thanks
> Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [v3][PATCH 0/5] xen: introduce new machine for IGD passthrough
@ 2014-08-04 13:51 ` Michael S. Tsirkin
0 siblings, 0 replies; 28+ messages in thread
From: Michael S. Tsirkin @ 2014-08-04 13:51 UTC (permalink / raw)
To: Tiejun Chen; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On Thu, Jul 31, 2014 at 08:09:30PM +0800, Tiejun Chen wrote:
> v3:
>
> * Drop patch #4
> * Add one patch #1 from Michael
> * Rebase
You added my patch but don't use it, so most of
my comment weren't addressed.
Do you plan to send v4 to address them?
> v2:
>
> * Fix some coding style
> * New patch to separate i440fx_init
> * Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
> * Based on patch #2 to regenerate
> * Unify prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough like patch #3
> * Test: boot with a preinstalled ubuntu 14.04
> ./i386-softmmu/qemu-system-i386 -hda test.img -m 2560 -boot c -machine pc
>
> As we discussed we need to create a separate machine to support current
> IGD passthrough.
>
> ----------------------------------------------------------------
> Tiejun Chen (4):
> i440fx: make types configurable at run-time
> hw:i386:pc_piix: split pc_init1()
> xen:hw:pci-host:piix: create host bridge to passthrough
> xen:hw:i386:pc_piix: introduce new machine for IGD passthrough
>
> hw/i386/pc_piix.c | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
> hw/pci-host/piix.c | 50 ++++++++++++++++++++++++++++++++++----
> include/hw/i386/pc.h | 8 ++++++-
> 3 files changed, 254 insertions(+), 31 deletions(-)
>
> Thanks
> Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [v3][PATCH 1/4] i440fx: make types configurable at run-time
2014-08-04 13:48 ` Michael S. Tsirkin
@ 2014-08-06 6:18 ` Chen, Tiejun
-1 siblings, 0 replies; 28+ messages in thread
From: Chen, Tiejun @ 2014-08-06 6:18 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On 2014/8/4 21:48, Michael S. Tsirkin wrote:
> On Thu, Jul 31, 2014 at 08:09:31PM +0800, Tiejun Chen wrote:
>> 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>
>
> You should have a From: line too, otherwise
> git will set the Author field incorrectly.
>
Will update as follows:
From: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
Thanks
Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [v3][PATCH 1/4] i440fx: make types configurable at run-time
@ 2014-08-06 6:18 ` Chen, Tiejun
0 siblings, 0 replies; 28+ messages in thread
From: Chen, Tiejun @ 2014-08-06 6:18 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On 2014/8/4 21:48, Michael S. Tsirkin wrote:
> On Thu, Jul 31, 2014 at 08:09:31PM +0800, Tiejun Chen wrote:
>> 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>
>
> You should have a From: line too, otherwise
> git will set the Author field incorrectly.
>
Will update as follows:
From: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
Thanks
Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [v3][PATCH 2/4] hw:i386:pc_piix: split pc_init1()
2014-08-04 13:48 ` Michael S. Tsirkin
@ 2014-08-06 6:19 ` Chen, Tiejun
-1 siblings, 0 replies; 28+ messages in thread
From: Chen, Tiejun @ 2014-08-06 6:19 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On 2014/8/4 21:48, Michael S. Tsirkin wrote:
> On Thu, Jul 31, 2014 at 08:09:32PM +0800, Tiejun Chen wrote:
>> We'd like to split pc_init1 and then we can share something
>> with other stuff.
>>
>> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
>
> With patch 1 in place, this should not be
> necessary - just propage the correct types
> around.
>
Will rebase this in next version.
Thanks
Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [v3][PATCH 2/4] hw:i386:pc_piix: split pc_init1()
@ 2014-08-06 6:19 ` Chen, Tiejun
0 siblings, 0 replies; 28+ messages in thread
From: Chen, Tiejun @ 2014-08-06 6:19 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On 2014/8/4 21:48, Michael S. Tsirkin wrote:
> On Thu, Jul 31, 2014 at 08:09:32PM +0800, Tiejun Chen wrote:
>> We'd like to split pc_init1 and then we can share something
>> with other stuff.
>>
>> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
>
> With patch 1 in place, this should not be
> necessary - just propage the correct types
> around.
>
Will rebase this in next version.
Thanks
Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [v3][PATCH 3/4] xen:hw:pci-host:piix: create host bridge to passthrough
2014-08-04 13:50 ` Michael S. Tsirkin
@ 2014-08-06 6:22 ` Chen, Tiejun
-1 siblings, 0 replies; 28+ messages in thread
From: Chen, Tiejun @ 2014-08-06 6:22 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On 2014/8/4 21:50, Michael S. Tsirkin wrote:
> On Thu, Jul 31, 2014 at 08:09:33PM +0800, Tiejun Chen wrote:
>> Implement a pci host bridge specific to passthrough. Actually
>> this just inherits the standard one.
>>
>> This is based on http://patchwork.ozlabs.org/patch/363810/.
>>
>> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
>> ---
>> hw/pci-host/piix.c | 41 +++++++++++++++++++++++++++++++++++++++++
>> include/hw/i386/pc.h | 2 ++
>> 2 files changed, 43 insertions(+)
>>
>> v3:
>>
>> * Rebase
>>
>> v2:
>>
>> * Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
>>
>> diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
>> index 0cd82b8..26ba1e5 100644
>> --- a/hw/pci-host/piix.c
>> +++ b/hw/pci-host/piix.c
>> @@ -93,6 +93,9 @@ typedef struct PIIX3State {
>> #define I440FX_PCI_DEVICE(obj) \
>> OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
>>
>> +#define XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(obj) \
>> + OBJECT_CHECK(PCII440FXState, (obj), TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE)
>> +
>> struct PCII440FXState {
>> /*< private >*/
>> PCIDevice parent_obj;
>> @@ -303,6 +306,16 @@ static int i440fx_initfn(PCIDevice *dev)
>> return 0;
>> }
>>
>> +static int xen_igd_passthrough_i440fx_initfn(PCIDevice *dev)
>> +{
>> + PCII440FXState *d = XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(dev);
>> +
>> + dev->config[I440FX_SMRAM] = 0x02;
>> +
>> + cpu_smm_register(&i440fx_set_smm, d);
>> + return 0;
>> +}
>> +
>
> This is exactly i440fx_initfn.
> Don't copy and paste code like this, reuse existing functions.
>
We can't reuse i440fx_initfn() simply after we introduce
XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(). But with a further concern I
think we also pass type into I440FX_PCI_DEVIC() to index different
objects here. Please see next version.
Thanks
Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [v3][PATCH 3/4] xen:hw:pci-host:piix: create host bridge to passthrough
@ 2014-08-06 6:22 ` Chen, Tiejun
0 siblings, 0 replies; 28+ messages in thread
From: Chen, Tiejun @ 2014-08-06 6:22 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On 2014/8/4 21:50, Michael S. Tsirkin wrote:
> On Thu, Jul 31, 2014 at 08:09:33PM +0800, Tiejun Chen wrote:
>> Implement a pci host bridge specific to passthrough. Actually
>> this just inherits the standard one.
>>
>> This is based on http://patchwork.ozlabs.org/patch/363810/.
>>
>> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
>> ---
>> hw/pci-host/piix.c | 41 +++++++++++++++++++++++++++++++++++++++++
>> include/hw/i386/pc.h | 2 ++
>> 2 files changed, 43 insertions(+)
>>
>> v3:
>>
>> * Rebase
>>
>> v2:
>>
>> * Just add prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough
>>
>> diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
>> index 0cd82b8..26ba1e5 100644
>> --- a/hw/pci-host/piix.c
>> +++ b/hw/pci-host/piix.c
>> @@ -93,6 +93,9 @@ typedef struct PIIX3State {
>> #define I440FX_PCI_DEVICE(obj) \
>> OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
>>
>> +#define XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(obj) \
>> + OBJECT_CHECK(PCII440FXState, (obj), TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE)
>> +
>> struct PCII440FXState {
>> /*< private >*/
>> PCIDevice parent_obj;
>> @@ -303,6 +306,16 @@ static int i440fx_initfn(PCIDevice *dev)
>> return 0;
>> }
>>
>> +static int xen_igd_passthrough_i440fx_initfn(PCIDevice *dev)
>> +{
>> + PCII440FXState *d = XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(dev);
>> +
>> + dev->config[I440FX_SMRAM] = 0x02;
>> +
>> + cpu_smm_register(&i440fx_set_smm, d);
>> + return 0;
>> +}
>> +
>
> This is exactly i440fx_initfn.
> Don't copy and paste code like this, reuse existing functions.
>
We can't reuse i440fx_initfn() simply after we introduce
XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE(). But with a further concern I
think we also pass type into I440FX_PCI_DEVIC() to index different
objects here. Please see next version.
Thanks
Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [v3][PATCH 0/5] xen: introduce new machine for IGD passthrough
2014-08-04 13:51 ` Michael S. Tsirkin
@ 2014-08-06 6:26 ` Chen, Tiejun
-1 siblings, 0 replies; 28+ messages in thread
From: Chen, Tiejun @ 2014-08-06 6:26 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On 2014/8/4 21:51, Michael S. Tsirkin wrote:
> On Thu, Jul 31, 2014 at 08:09:30PM +0800, Tiejun Chen wrote:
>> v3:
>>
>> * Drop patch #4
>> * Add one patch #1 from Michael
>> * Rebase
>
> You added my patch but don't use it, so most of
> my comment weren't addressed.
I guess I should cover those comments and posted some reply as well. But
maybe something is confused.
> Do you plan to send v4 to address them?
>
Anyway, I will send v4 to narrow down that gap to your expectoration.
Thanks
Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [v3][PATCH 0/5] xen: introduce new machine for IGD passthrough
@ 2014-08-06 6:26 ` Chen, Tiejun
0 siblings, 0 replies; 28+ messages in thread
From: Chen, Tiejun @ 2014-08-06 6:26 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: pbonzini, xen-devel, qemu-devel, stefano.stabellini
On 2014/8/4 21:51, Michael S. Tsirkin wrote:
> On Thu, Jul 31, 2014 at 08:09:30PM +0800, Tiejun Chen wrote:
>> v3:
>>
>> * Drop patch #4
>> * Add one patch #1 from Michael
>> * Rebase
>
> You added my patch but don't use it, so most of
> my comment weren't addressed.
I guess I should cover those comments and posted some reply as well. But
maybe something is confused.
> Do you plan to send v4 to address them?
>
Anyway, I will send v4 to narrow down that gap to your expectoration.
Thanks
Tiejun
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2014-08-06 6:26 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-31 12:09 [Qemu-devel] [v3][PATCH 0/5] xen: introduce new machine for IGD passthrough Tiejun Chen
2014-07-31 12:09 ` Tiejun Chen
2014-07-31 12:09 ` [Qemu-devel] [v3][PATCH 1/4] i440fx: make types configurable at run-time Tiejun Chen
2014-07-31 12:09 ` Tiejun Chen
2014-08-04 13:48 ` [Qemu-devel] " Michael S. Tsirkin
2014-08-04 13:48 ` Michael S. Tsirkin
2014-08-06 6:18 ` [Qemu-devel] " Chen, Tiejun
2014-08-06 6:18 ` Chen, Tiejun
2014-07-31 12:09 ` [Qemu-devel] [v3][PATCH 2/4] hw:i386:pc_piix: split pc_init1() Tiejun Chen
2014-07-31 12:09 ` Tiejun Chen
2014-08-04 13:48 ` [Qemu-devel] " Michael S. Tsirkin
2014-08-04 13:48 ` Michael S. Tsirkin
2014-08-06 6:19 ` [Qemu-devel] " Chen, Tiejun
2014-08-06 6:19 ` Chen, Tiejun
2014-07-31 12:09 ` [Qemu-devel] [v3][PATCH 3/4] xen:hw:pci-host:piix: create host bridge to passthrough Tiejun Chen
2014-07-31 12:09 ` Tiejun Chen
2014-08-04 13:50 ` [Qemu-devel] " Michael S. Tsirkin
2014-08-04 13:50 ` Michael S. Tsirkin
2014-08-06 6:22 ` [Qemu-devel] " Chen, Tiejun
2014-08-06 6:22 ` Chen, Tiejun
2014-07-31 12:09 ` [Qemu-devel] [v3][PATCH 4/4] xen:hw:i386:pc_piix: introduce new machine for IGD passthrough Tiejun Chen
2014-07-31 12:09 ` Tiejun Chen
2014-08-04 5:39 ` [Qemu-devel] [Xen-devel] [v3][PATCH 0/5] xen: " Chen, Tiejun
2014-08-04 5:39 ` Chen, Tiejun
2014-08-04 13:51 ` [Qemu-devel] " Michael S. Tsirkin
2014-08-04 13:51 ` Michael S. Tsirkin
2014-08-06 6:26 ` [Qemu-devel] " Chen, Tiejun
2014-08-06 6:26 ` Chen, Tiejun
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.