* [PATCH 0/2] qemu:xen: implement isa bridge specific to IGD passthrough
@ 2014-08-21 1:28 Tiejun Chen
2014-08-21 1:28 ` [PATCH 1/2] hw:xen:xen_pt: register " Tiejun Chen
2014-08-21 1:28 ` [PATCH 2/2] xen:i386:pc_piix: create " Tiejun Chen
0 siblings, 2 replies; 38+ messages in thread
From: Tiejun Chen @ 2014-08-21 1:28 UTC (permalink / raw)
To: mst; +Cc: xen-devel, allen.m.kay, qemu-devel
This is a subset to support IGD passthrough with qemu/xen, and this should be
based on
http://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg02166.html
We will register to create isa bridge specific to IGD passthrough.
----------------------------------------------------------------
Tiejun Chen (2):
hw:xen:xen_pt: register isa bridge specific to IGD passthrough
xen:i386:pc_piix: create isa bridge specific to IGD passthrough
hw/i386/pc_piix.c | 24 +++++++++++++++++++++++-
hw/xen/xen_pt.c | 21 +++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
Thanks
Tiejun
^ permalink raw reply [flat|nested] 38+ messages in thread* [PATCH 1/2] hw:xen:xen_pt: register isa bridge specific to IGD passthrough 2014-08-21 1:28 [PATCH 0/2] qemu:xen: implement isa bridge specific to IGD passthrough Tiejun Chen @ 2014-08-21 1:28 ` Tiejun Chen 2014-08-21 1:28 ` [PATCH 2/2] xen:i386:pc_piix: create " Tiejun Chen 1 sibling, 0 replies; 38+ messages in thread From: Tiejun Chen @ 2014-08-21 1:28 UTC (permalink / raw) To: mst; +Cc: xen-devel, allen.m.kay, qemu-devel We need this instance to passthrough some config fields of PCH. Signed-off-by: Tiejun Chen <tiejun.chen@intel.com> --- hw/xen/xen_pt.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index c1bf357..bf72719 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -829,3 +829,24 @@ static void xen_pci_passthrough_register_types(void) } type_init(xen_pci_passthrough_register_types) + +static void xen_igd_passthrough_isa_bridge_class_init(ObjectClass *klass, + void *data) +{ + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + + k->class_id = PCI_CLASS_BRIDGE_ISA; +}; + +static TypeInfo xen_igd_passthrough_isa_bridge_info = { + .name = "xen-igd-passthrough-isa-bridge", + .parent = TYPE_PCI_DEVICE, + .class_init = xen_igd_passthrough_isa_bridge_class_init, +}; + +static void xen_igd_passthrough_isa_bridge_register_types(void) +{ + type_register_static(&xen_igd_passthrough_isa_bridge_info); +} + +type_init(xen_igd_passthrough_isa_bridge_register_types); -- 1.9.1 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough 2014-08-21 1:28 [PATCH 0/2] qemu:xen: implement isa bridge specific to IGD passthrough Tiejun Chen 2014-08-21 1:28 ` [PATCH 1/2] hw:xen:xen_pt: register " Tiejun Chen @ 2014-08-21 1:28 ` Tiejun Chen 2014-08-21 16:16 ` [Xen-devel] " Konrad Rzeszutek Wilk 2014-08-22 18:23 ` Michael S. Tsirkin 1 sibling, 2 replies; 38+ messages in thread From: Tiejun Chen @ 2014-08-21 1:28 UTC (permalink / raw) To: mst; +Cc: xen-devel, allen.m.kay, qemu-devel Currenjly this ISA bridge should be fixed at 1f.0, and pass the real vendor/device ids as the driver expect. Signed-off-by: Tiejun Chen <tiejun.chen@intel.com> --- hw/i386/pc_piix.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7710724..b131fa3 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -50,7 +50,8 @@ #include "cpu.h" #include "qemu/error-report.h" #ifdef CONFIG_XEN -# include <xen/hvm/hvm_info_table.h> +#include <xen/hvm/hvm_info_table.h> +#include <hw/xen/xen-host-pci-device.h> #endif #define MAX_IDE_BUS 2 @@ -463,6 +464,26 @@ static void pc_xen_hvm_init(MachineState *machine) } } +static void xen_igd_passthrough_isa_bridge_create(PCIBus *bus) +{ + struct PCIDevice *dev; + XenHostPCIDevice hdev; + int r = 0; + + /* This shoudl be fixed at 1f.0 then pass vendor/device ids. + */ + dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), + "xen-igd-passthrough-isa-bridge"); + if (dev) { + r = xen_host_pci_device_get(&hdev, 0, 0, PCI_DEVFN(0x1f, 0), 0); + if (!r) { + pci_config_set_vendor_id(dev->config, hdev.vendor_id); + pci_config_set_device_id(dev->config, hdev.device_id); + } else + fprintf(stderr, "xen set xen-igd-passthrough-isa-bridge failed\n"); + } +} + static void xen_igd_passthrough_pc_hvm_init(MachineState *machine) { PCIBus *bus; @@ -472,6 +493,7 @@ static void xen_igd_passthrough_pc_hvm_init(MachineState *machine) bus = pci_find_primary_bus(); if (bus != NULL) { pci_create_simple(bus, -1, "xen-platform"); + xen_igd_passthrough_isa_bridge_create(bus); } } #endif -- 1.9.1 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [Xen-devel] [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough 2014-08-21 1:28 ` [PATCH 2/2] xen:i386:pc_piix: create " Tiejun Chen @ 2014-08-21 16:16 ` Konrad Rzeszutek Wilk 2014-08-22 1:06 ` Chen, Tiejun 2014-08-22 18:23 ` Michael S. Tsirkin 1 sibling, 1 reply; 38+ messages in thread From: Konrad Rzeszutek Wilk @ 2014-08-21 16:16 UTC (permalink / raw) To: Tiejun Chen; +Cc: xen-devel, allen.m.kay, qemu-devel, mst On Thu, Aug 21, 2014 at 09:28:28AM +0800, Tiejun Chen wrote: > Currenjly this ISA bridge should be fixed at 1f.0, and pass the Currently > real vendor/device ids as the driver expect. Could you add a bit more description to this patch please? Explain the rationale, etc. > > Signed-off-by: Tiejun Chen <tiejun.chen@intel.com> > --- > hw/i386/pc_piix.c | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c > index 7710724..b131fa3 100644 > --- a/hw/i386/pc_piix.c > +++ b/hw/i386/pc_piix.c > @@ -50,7 +50,8 @@ > #include "cpu.h" > #include "qemu/error-report.h" > #ifdef CONFIG_XEN > -# include <xen/hvm/hvm_info_table.h> > +#include <xen/hvm/hvm_info_table.h> > +#include <hw/xen/xen-host-pci-device.h> > #endif > > #define MAX_IDE_BUS 2 > @@ -463,6 +464,26 @@ static void pc_xen_hvm_init(MachineState *machine) > } > } > > +static void xen_igd_passthrough_isa_bridge_create(PCIBus *bus) > +{ > + struct PCIDevice *dev; > + XenHostPCIDevice hdev; > + int r = 0; > + > + /* This shoudl be fixed at 1f.0 then pass vendor/device ids. should However I would remove the comment as it does not add anything extra to the function. It is pretty clear what it is doing. What would help is if you said: Must be fixed at 1f.0 because .. bla blah > + */ > + dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), > + "xen-igd-passthrough-isa-bridge"); > + if (dev) { > + r = xen_host_pci_device_get(&hdev, 0, 0, PCI_DEVFN(0x1f, 0), 0); > + if (!r) { > + pci_config_set_vendor_id(dev->config, hdev.vendor_id); > + pci_config_set_device_id(dev->config, hdev.device_id); > + } else > + fprintf(stderr, "xen set xen-igd-passthrough-isa-bridge failed\n"); > + } > +} > + > static void xen_igd_passthrough_pc_hvm_init(MachineState *machine) > { > PCIBus *bus; > @@ -472,6 +493,7 @@ static void xen_igd_passthrough_pc_hvm_init(MachineState *machine) > bus = pci_find_primary_bus(); > if (bus != NULL) { > pci_create_simple(bus, -1, "xen-platform"); > + xen_igd_passthrough_isa_bridge_create(bus); > } > } > #endif > -- > 1.9.1 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Xen-devel] [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough 2014-08-21 16:16 ` [Xen-devel] " Konrad Rzeszutek Wilk @ 2014-08-22 1:06 ` Chen, Tiejun 2014-08-24 11:12 ` Michael S. Tsirkin 0 siblings, 1 reply; 38+ messages in thread From: Chen, Tiejun @ 2014-08-22 1:06 UTC (permalink / raw) To: Konrad Rzeszutek Wilk; +Cc: xen-devel, allen.m.kay, qemu-devel, mst On 2014/8/22 0:16, Konrad Rzeszutek Wilk wrote: > On Thu, Aug 21, 2014 at 09:28:28AM +0800, Tiejun Chen wrote: >> Currenjly this ISA bridge should be fixed at 1f.0, and pass the > > Currently Fixed. > >> real vendor/device ids as the driver expect. > > Could you add a bit more description to this patch please? Explain > the rationale, etc. So rephrase as follows: xen:i386:pc_piix: create isa bridge specific to IGD passthrough Currently IGD drivers always need to access PCH by 1f.0, and identify PCH type with its own real vendor/device ids. This type value help driver initialize correctly. >> >> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com> >> --- >> hw/i386/pc_piix.c | 24 +++++++++++++++++++++++- >> 1 file changed, 23 insertions(+), 1 deletion(-) >> >> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c >> index 7710724..b131fa3 100644 >> --- a/hw/i386/pc_piix.c >> +++ b/hw/i386/pc_piix.c >> @@ -50,7 +50,8 @@ >> #include "cpu.h" >> #include "qemu/error-report.h" >> #ifdef CONFIG_XEN >> -# include <xen/hvm/hvm_info_table.h> >> +#include <xen/hvm/hvm_info_table.h> >> +#include <hw/xen/xen-host-pci-device.h> >> #endif >> >> #define MAX_IDE_BUS 2 >> @@ -463,6 +464,26 @@ static void pc_xen_hvm_init(MachineState *machine) >> } >> } >> >> +static void xen_igd_passthrough_isa_bridge_create(PCIBus *bus) >> +{ >> + struct PCIDevice *dev; >> + XenHostPCIDevice hdev; >> + int r = 0; >> + >> + /* This shoudl be fixed at 1f.0 then pass vendor/device ids. > > should > > However I would remove the comment as it does not add anything extra > to the function. It is pretty clear what it is doing. > > What would help is if you said: > > Must be fixed at 1f.0 because .. bla blah Like the patch description, so what about this, /* Currently IGD drivers always need to access PCH by 1f.0, and * identify PCH type with its own real vendor/device ids. */ Thanks Tiejun > >> + */ >> + dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), >> + "xen-igd-passthrough-isa-bridge"); >> + if (dev) { >> + r = xen_host_pci_device_get(&hdev, 0, 0, PCI_DEVFN(0x1f, 0), 0); >> + if (!r) { >> + pci_config_set_vendor_id(dev->config, hdev.vendor_id); >> + pci_config_set_device_id(dev->config, hdev.device_id); >> + } else >> + fprintf(stderr, "xen set xen-igd-passthrough-isa-bridge failed\n"); >> + } >> +} >> + >> static void xen_igd_passthrough_pc_hvm_init(MachineState *machine) >> { >> PCIBus *bus; >> @@ -472,6 +493,7 @@ static void xen_igd_passthrough_pc_hvm_init(MachineState *machine) >> bus = pci_find_primary_bus(); >> if (bus != NULL) { >> pci_create_simple(bus, -1, "xen-platform"); >> + xen_igd_passthrough_isa_bridge_create(bus); >> } >> } >> #endif >> -- >> 1.9.1 >> >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xen.org >> http://lists.xen.org/xen-devel > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Xen-devel] [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough 2014-08-22 1:06 ` Chen, Tiejun @ 2014-08-24 11:12 ` Michael S. Tsirkin 2014-08-25 5:18 ` Chen, Tiejun 0 siblings, 1 reply; 38+ messages in thread From: Michael S. Tsirkin @ 2014-08-24 11:12 UTC (permalink / raw) To: Chen, Tiejun; +Cc: xen-devel, allen.m.kay, qemu-devel, Konrad Rzeszutek Wilk On Fri, Aug 22, 2014 at 09:06:20AM +0800, Chen, Tiejun wrote: > On 2014/8/22 0:16, Konrad Rzeszutek Wilk wrote: > >On Thu, Aug 21, 2014 at 09:28:28AM +0800, Tiejun Chen wrote: > >>Currenjly this ISA bridge should be fixed at 1f.0, and pass the > > > >Currently > > Fixed. > > > > >>real vendor/device ids as the driver expect. > > > >Could you add a bit more description to this patch please? Explain > >the rationale, etc. > > So rephrase as follows: > > xen:i386:pc_piix: create isa bridge specific to IGD passthrough > > Currently IGD drivers always need to access PCH by 1f.0, OK > and > identify PCH type with its own real vendor/device ids. This type > value help driver initialize correctly. instead: PCH vendor/device id is used to identify the card. > >> > >>Signed-off-by: Tiejun Chen <tiejun.chen@intel.com> > >>--- > >> hw/i386/pc_piix.c | 24 +++++++++++++++++++++++- > >> 1 file changed, 23 insertions(+), 1 deletion(-) > >> > >>diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c > >>index 7710724..b131fa3 100644 > >>--- a/hw/i386/pc_piix.c > >>+++ b/hw/i386/pc_piix.c > >>@@ -50,7 +50,8 @@ > >> #include "cpu.h" > >> #include "qemu/error-report.h" > >> #ifdef CONFIG_XEN > >>-# include <xen/hvm/hvm_info_table.h> > >>+#include <xen/hvm/hvm_info_table.h> > >>+#include <hw/xen/xen-host-pci-device.h> > >> #endif > >> > >> #define MAX_IDE_BUS 2 > >>@@ -463,6 +464,26 @@ static void pc_xen_hvm_init(MachineState *machine) > >> } > >> } > >> > >>+static void xen_igd_passthrough_isa_bridge_create(PCIBus *bus) > >>+{ > >>+ struct PCIDevice *dev; > >>+ XenHostPCIDevice hdev; > >>+ int r = 0; > >>+ > >>+ /* This shoudl be fixed at 1f.0 then pass vendor/device ids. > > > >should > > > >However I would remove the comment as it does not add anything extra > >to the function. It is pretty clear what it is doing. > > > >What would help is if you said: > > > >Must be fixed at 1f.0 because .. bla blah > > Like the patch description, so what about this, > > /* Currently IGD drivers always need to access PCH by 1f.0, and > * identify PCH type with its own real vendor/device ids. > */ > > Thanks > Tiejun > > > > >>+ */ > >>+ dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), > >>+ "xen-igd-passthrough-isa-bridge"); > >>+ if (dev) { > >>+ r = xen_host_pci_device_get(&hdev, 0, 0, PCI_DEVFN(0x1f, 0), 0); > >>+ if (!r) { > >>+ pci_config_set_vendor_id(dev->config, hdev.vendor_id); > >>+ pci_config_set_device_id(dev->config, hdev.device_id); Can you, instead, implement the reverse logic, probing the card and supplying the correct device id for PCH? > >>+ } else > >>+ fprintf(stderr, "xen set xen-igd-passthrough-isa-bridge failed\n"); > >>+ } > >>+} > >>+ > >> static void xen_igd_passthrough_pc_hvm_init(MachineState *machine) > >> { > >> PCIBus *bus; > >>@@ -472,6 +493,7 @@ static void xen_igd_passthrough_pc_hvm_init(MachineState *machine) > >> bus = pci_find_primary_bus(); > >> if (bus != NULL) { > >> pci_create_simple(bus, -1, "xen-platform"); > >>+ xen_igd_passthrough_isa_bridge_create(bus); > >> } > >> } > >> #endif > >>-- > >>1.9.1 > >> > >> > >>_______________________________________________ > >>Xen-devel mailing list > >>Xen-devel@lists.xen.org > >>http://lists.xen.org/xen-devel > > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Xen-devel] [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough 2014-08-24 11:12 ` Michael S. Tsirkin @ 2014-08-25 5:18 ` Chen, Tiejun 2014-08-26 2:49 ` Chen, Tiejun 0 siblings, 1 reply; 38+ messages in thread From: Chen, Tiejun @ 2014-08-25 5:18 UTC (permalink / raw) To: Michael S. Tsirkin Cc: xen-devel, allen.m.kay, qemu-devel, Konrad Rzeszutek Wilk On 2014/8/24 19:12, Michael S. Tsirkin wrote: > On Fri, Aug 22, 2014 at 09:06:20AM +0800, Chen, Tiejun wrote: >> On 2014/8/22 0:16, Konrad Rzeszutek Wilk wrote: >>> On Thu, Aug 21, 2014 at 09:28:28AM +0800, Tiejun Chen wrote: >>>> Currenjly this ISA bridge should be fixed at 1f.0, and pass the >>> >>> Currently >> >> Fixed. >> >>> >>>> real vendor/device ids as the driver expect. >>> >>> Could you add a bit more description to this patch please? Explain >>> the rationale, etc. >> >> So rephrase as follows: >> >> xen:i386:pc_piix: create isa bridge specific to IGD passthrough >> >> Currently IGD drivers always need to access PCH by 1f.0, > > OK > >> and >> identify PCH type with its own real vendor/device ids. This type >> value help driver initialize correctly. > > instead: PCH vendor/device id is used to identify the card. Okay. > >>>> >>>> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com> >>>> --- >>>> hw/i386/pc_piix.c | 24 +++++++++++++++++++++++- >>>> 1 file changed, 23 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c >>>> index 7710724..b131fa3 100644 >>>> --- a/hw/i386/pc_piix.c >>>> +++ b/hw/i386/pc_piix.c >>>> @@ -50,7 +50,8 @@ >>>> #include "cpu.h" >>>> #include "qemu/error-report.h" >>>> #ifdef CONFIG_XEN >>>> -# include <xen/hvm/hvm_info_table.h> >>>> +#include <xen/hvm/hvm_info_table.h> >>>> +#include <hw/xen/xen-host-pci-device.h> >>>> #endif >>>> >>>> #define MAX_IDE_BUS 2 >>>> @@ -463,6 +464,26 @@ static void pc_xen_hvm_init(MachineState *machine) >>>> } >>>> } >>>> >>>> +static void xen_igd_passthrough_isa_bridge_create(PCIBus *bus) >>>> +{ >>>> + struct PCIDevice *dev; >>>> + XenHostPCIDevice hdev; >>>> + int r = 0; >>>> + >>>> + /* This shoudl be fixed at 1f.0 then pass vendor/device ids. >>> >>> should >>> >>> However I would remove the comment as it does not add anything extra >>> to the function. It is pretty clear what it is doing. >>> >>> What would help is if you said: >>> >>> Must be fixed at 1f.0 because .. bla blah >> >> Like the patch description, so what about this, >> >> /* Currently IGD drivers always need to access PCH by 1f.0, and >> * identify PCH type with its own real vendor/device ids. >> */ >> >> Thanks >> Tiejun >> >>> >>>> + */ >>>> + dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), >>>> + "xen-igd-passthrough-isa-bridge"); >>>> + if (dev) { >>>> + r = xen_host_pci_device_get(&hdev, 0, 0, PCI_DEVFN(0x1f, 0), 0); >>>> + if (!r) { >>>> + pci_config_set_vendor_id(dev->config, hdev.vendor_id); >>>> + pci_config_set_device_id(dev->config, hdev.device_id); > > Can you, instead, implement the reverse logic, probing > the card and supplying the correct device id for PCH? > Here what is your so-called reverse logic as I already asked you previously? Do you mean I should list all PCHs with a combo illustrated with the vendor/device id in advance? Then look up if we can find a matched PCH? If yes, what is that benefit you expect in passthrough case? Shouldn't we pass these info to VM directly in passthrough case? Thanks Tiejun ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Xen-devel] [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough 2014-08-25 5:18 ` Chen, Tiejun @ 2014-08-26 2:49 ` Chen, Tiejun 2014-08-28 0:56 ` Chen, Tiejun 0 siblings, 1 reply; 38+ messages in thread From: Chen, Tiejun @ 2014-08-26 2:49 UTC (permalink / raw) To: Michael S. Tsirkin Cc: xen-devel, allen.m.kay, qemu-devel, Konrad Rzeszutek Wilk On 2014/8/25 13:18, Chen, Tiejun wrote: > On 2014/8/24 19:12, Michael S. Tsirkin wrote: >> On Fri, Aug 22, 2014 at 09:06:20AM +0800, Chen, Tiejun wrote: >>> On 2014/8/22 0:16, Konrad Rzeszutek Wilk wrote: >>>> On Thu, Aug 21, 2014 at 09:28:28AM +0800, Tiejun Chen wrote: >>>>> Currenjly this ISA bridge should be fixed at 1f.0, and pass the >>>> >>>> Currently >>> >>> Fixed. >>> >>>> >>>>> real vendor/device ids as the driver expect. >>>> >>>> Could you add a bit more description to this patch please? Explain >>>> the rationale, etc. >>> >>> So rephrase as follows: >>> >>> xen:i386:pc_piix: create isa bridge specific to IGD passthrough >>> >>> Currently IGD drivers always need to access PCH by 1f.0, >> >> OK >> >>> and >>> identify PCH type with its own real vendor/device ids. This type >>> value help driver initialize correctly. >> >> instead: PCH vendor/device id is used to identify the card. > > Okay. > >> >>>>> >>>>> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com> >>>>> --- >>>>> hw/i386/pc_piix.c | 24 +++++++++++++++++++++++- >>>>> 1 file changed, 23 insertions(+), 1 deletion(-) >>>>> >>>>> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c >>>>> index 7710724..b131fa3 100644 >>>>> --- a/hw/i386/pc_piix.c >>>>> +++ b/hw/i386/pc_piix.c >>>>> @@ -50,7 +50,8 @@ >>>>> #include "cpu.h" >>>>> #include "qemu/error-report.h" >>>>> #ifdef CONFIG_XEN >>>>> -# include <xen/hvm/hvm_info_table.h> >>>>> +#include <xen/hvm/hvm_info_table.h> >>>>> +#include <hw/xen/xen-host-pci-device.h> >>>>> #endif >>>>> >>>>> #define MAX_IDE_BUS 2 >>>>> @@ -463,6 +464,26 @@ static void pc_xen_hvm_init(MachineState >>>>> *machine) >>>>> } >>>>> } >>>>> >>>>> +static void xen_igd_passthrough_isa_bridge_create(PCIBus *bus) >>>>> +{ >>>>> + struct PCIDevice *dev; >>>>> + XenHostPCIDevice hdev; >>>>> + int r = 0; >>>>> + >>>>> + /* This shoudl be fixed at 1f.0 then pass vendor/device ids. >>>> >>>> should >>>> >>>> However I would remove the comment as it does not add anything extra >>>> to the function. It is pretty clear what it is doing. >>>> >>>> What would help is if you said: >>>> >>>> Must be fixed at 1f.0 because .. bla blah >>> >>> Like the patch description, so what about this, >>> >>> /* Currently IGD drivers always need to access PCH by 1f.0, and >>> * identify PCH type with its own real vendor/device ids. >>> */ >>> >>> Thanks >>> Tiejun >>> >>>> >>>>> + */ >>>>> + dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), >>>>> + "xen-igd-passthrough-isa-bridge"); >>>>> + if (dev) { >>>>> + r = xen_host_pci_device_get(&hdev, 0, 0, PCI_DEVFN(0x1f, >>>>> 0), 0); >>>>> + if (!r) { >>>>> + pci_config_set_vendor_id(dev->config, hdev.vendor_id); >>>>> + pci_config_set_device_id(dev->config, hdev.device_id); >> >> Can you, instead, implement the reverse logic, probing >> the card and supplying the correct device id for PCH? >> > > Here what is your so-called reverse logic as I already asked you > previously? Do you mean I should list all PCHs with a combo illustrated > with the vendor/device id in advance? Then look up if we can find a Michael, Could you explain this exactly? Then I can try follow-up your idea ASAP if this is necessary and possible. Thanks Tiejun > matched PCH? If yes, what is that benefit you expect in passthrough > case? Shouldn't we pass these info to VM directly in passthrough case? > > Thanks > Tiejun > > > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Xen-devel] [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough 2014-08-26 2:49 ` Chen, Tiejun @ 2014-08-28 0:56 ` Chen, Tiejun 2014-08-29 1:28 ` Chen, Tiejun 0 siblings, 1 reply; 38+ messages in thread From: Chen, Tiejun @ 2014-08-28 0:56 UTC (permalink / raw) To: Michael S. Tsirkin Cc: xen-devel, allen.m.kay, qemu-devel, Konrad Rzeszutek Wilk >>>>>> + */ >>>>>> + dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), >>>>>> + "xen-igd-passthrough-isa-bridge"); >>>>>> + if (dev) { >>>>>> + r = xen_host_pci_device_get(&hdev, 0, 0, PCI_DEVFN(0x1f, >>>>>> 0), 0); >>>>>> + if (!r) { >>>>>> + pci_config_set_vendor_id(dev->config, hdev.vendor_id); >>>>>> + pci_config_set_device_id(dev->config, hdev.device_id); >>> >>> Can you, instead, implement the reverse logic, probing >>> the card and supplying the correct device id for PCH? >>> >> >> Here what is your so-called reverse logic as I already asked you >> previously? Do you mean I should list all PCHs with a combo illustrated >> with the vendor/device id in advance? Then look up if we can find a > > Michael, > Ping. Thanks Tiejun > Could you explain this exactly? Then I can try follow-up your idea ASAP > if this is necessary and possible. > > Thanks > Tiejun > >> matched PCH? If yes, what is that benefit you expect in passthrough >> case? Shouldn't we pass these info to VM directly in passthrough case? >> >> Thanks >> Tiejun >> >> >> > > > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Xen-devel] [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough 2014-08-28 0:56 ` Chen, Tiejun @ 2014-08-29 1:28 ` Chen, Tiejun 2014-08-31 8:58 ` Michael S. Tsirkin 0 siblings, 1 reply; 38+ messages in thread From: Chen, Tiejun @ 2014-08-29 1:28 UTC (permalink / raw) To: Michael S. Tsirkin Cc: xen-devel, allen.m.kay, qemu-devel, Konrad Rzeszutek Wilk On 2014/8/28 8:56, Chen, Tiejun wrote: >>>>>>> + */ >>>>>>> + dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), >>>>>>> + "xen-igd-passthrough-isa-bridge"); >>>>>>> + if (dev) { >>>>>>> + r = xen_host_pci_device_get(&hdev, 0, 0, PCI_DEVFN(0x1f, >>>>>>> 0), 0); >>>>>>> + if (!r) { >>>>>>> + pci_config_set_vendor_id(dev->config, hdev.vendor_id); >>>>>>> + pci_config_set_device_id(dev->config, hdev.device_id); >>>> >>>> Can you, instead, implement the reverse logic, probing >>>> the card and supplying the correct device id for PCH? >>>> >>> >>> Here what is your so-called reverse logic as I already asked you >>> previously? Do you mean I should list all PCHs with a combo illustrated >>> with the vendor/device id in advance? Then look up if we can find a >> >> Michael, >> > > Ping. > > Thanks > Tiejun > >> Could you explain this exactly? Then I can try follow-up your idea ASAP >> if this is necessary and possible. Michel, Could you give us some explanation for your "reverse logic" when you're free? Thanks Tiejun >> >> Thanks >> Tiejun >> >>> matched PCH? If yes, what is that benefit you expect in passthrough >>> case? Shouldn't we pass these info to VM directly in passthrough case? >>> >>> Thanks >>> Tiejun >>> >>> >>> >> >> >> > > > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Xen-devel] [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough 2014-08-29 1:28 ` Chen, Tiejun @ 2014-08-31 8:58 ` Michael S. Tsirkin 2014-09-01 2:50 ` Chen, Tiejun 0 siblings, 1 reply; 38+ messages in thread From: Michael S. Tsirkin @ 2014-08-31 8:58 UTC (permalink / raw) To: Chen, Tiejun; +Cc: xen-devel, allen.m.kay, qemu-devel, Konrad Rzeszutek Wilk On Fri, Aug 29, 2014 at 09:28:50AM +0800, Chen, Tiejun wrote: > > > On 2014/8/28 8:56, Chen, Tiejun wrote: > >>>>>>>+ */ > >>>>>>>+ dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), > >>>>>>>+ "xen-igd-passthrough-isa-bridge"); > >>>>>>>+ if (dev) { > >>>>>>>+ r = xen_host_pci_device_get(&hdev, 0, 0, PCI_DEVFN(0x1f, > >>>>>>>0), 0); > >>>>>>>+ if (!r) { > >>>>>>>+ pci_config_set_vendor_id(dev->config, hdev.vendor_id); > >>>>>>>+ pci_config_set_device_id(dev->config, hdev.device_id); > >>>> > >>>>Can you, instead, implement the reverse logic, probing > >>>>the card and supplying the correct device id for PCH? > >>>> > >>> > >>>Here what is your so-called reverse logic as I already asked you > >>>previously? Do you mean I should list all PCHs with a combo illustrated > >>>with the vendor/device id in advance? Then look up if we can find a > >> > >>Michael, > >> > > > >Ping. > > > >Thanks > >Tiejun > > > >>Could you explain this exactly? Then I can try follow-up your idea ASAP > >>if this is necessary and possible. > > Michel, > > Could you give us some explanation for your "reverse logic" when you're > free? > > Thanks > Tiejun So future drivers will look at device ID for the card and figure out how things should work from there. Old drivers still poke at device id of the chipset for this, but maybe qemu can do what newer drivers do: look at the card and figure out what guest should do, then present the appropriate chipset id. This is based on what Jesse said: Practically speaking, we could probably assume specific GPU/PCH combos, as I don't think they're generally mixed across generations, though SNB and IVB did have compatible sockets, so there is the possibility of mixing CPT and PPT PCHs, but those are register identical as far as the graphics driver is concerned, so even that should be safe. so the idea is to have a reverse table mapping GPU back to PCH. Present to guest the ID that will let it assume the correct GPU. the problem with these tables is they are hard to keep up to date as new hardware comes out, but as future hardware won't need these hacks, we shall be fine. > >> > >>Thanks > >>Tiejun > >> > >>>matched PCH? If yes, what is that benefit you expect in passthrough > >>>case? Shouldn't we pass these info to VM directly in passthrough case? > >>> > >>>Thanks > >>>Tiejun > >>> > >>> > >>> > >> > >> > >> > > > > > > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Xen-devel] [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough 2014-08-31 8:58 ` Michael S. Tsirkin @ 2014-09-01 2:50 ` Chen, Tiejun 2014-09-01 6:05 ` Michael S. Tsirkin 0 siblings, 1 reply; 38+ messages in thread From: Chen, Tiejun @ 2014-09-01 2:50 UTC (permalink / raw) To: Michael S. Tsirkin Cc: xen-devel, allen.m.kay, qemu-devel, Kon