Citrix PV Bus device
PATCH 1/1 Citrix PV Bus device
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.
--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++ include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.c
hw/i386/Makefile.objs +1 -0
@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o obj-y += kvmvapic.o +obj-y += citrix_pv_bus.o
hw/i386/citrix_pv_bus.c new file +122 -0
122 lines not on this page · raw message
include/hw/pci/pci_ids.h +3 -0
@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853 +#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
Signature · 1 line
1.7.10.4
include/hw/pci/pci_ids.h line 154
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Paul Durrant
include/hw/pci/pci_ids.h +1
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853
Is that really the right way to do things, considering that the same value is elsewhere used for PCI_VENDOR_ID_XEN?
Jan
Quoted 3 lines
include/hw/pci/pci_ids.h +2
-0+#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
include/hw/pci/pci_ids.h line 154
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Paul Durrant
include/hw/pci/pci_ids.h +1
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853
Is that really the right way to do things, considering that the same value is elsewhere used for PCI_VENDOR_ID_XEN?
Jan
Quoted 3 lines
include/hw/pci/pci_ids.h +2
-0+#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
Quoted 19 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 02 July 2013 09:46
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceinclude/hw/pci/pci_ids.h line 154
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Paul Durrant
include/hw/pci/pci_ids.h +1
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853Is that really the right way to do things, considering that the same value is elsewhere used for
PCI_VENDOR_ID_XEN?
Quoted 6 lines
Jan
include/hw/pci/pci_ids.h line 157
Quoted 3 lines
include/hw/pci/pci_ids.h +2
-0+#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
I opted to do this for clarity. The fact that the Xen platform device uses Citrix's vendor ID is historical; I wanted to be clear that this device was distinct.
Paul
Quoted 19 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 02 July 2013 09:46
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceinclude/hw/pci/pci_ids.h line 154
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Paul Durrant
include/hw/pci/pci_ids.h +1
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853Is that really the right way to do things, considering that the same value is elsewhere used for
PCI_VENDOR_ID_XEN?
Quoted 6 lines
Jan
include/hw/pci/pci_ids.h line 157
Quoted 3 lines
include/hw/pci/pci_ids.h +2
-0+#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
I opted to do this for clarity. The fact that the Xen platform device uses Citrix's vendor ID is historical; I wanted to be clear that this device was distinct.
Paul
Quoted 21 lines · Paul Durrant
Quoted 21 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 02 July 2013 09:46
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceinclude/hw/pci/pci_ids.h line 154
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Paul Durrant
include/hw/pci/pci_ids.h +1
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853Is that really the right way to do things, considering that the same value is elsewhere used for
PCI_VENDOR_ID_XEN?Jan
Quoted 7 lines
Quoted 4 lines
include/hw/pci/pci_ids.h line 157
Quoted 3 lines
include/hw/pci/pci_ids.h +2
-0+#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif I opted to do this for clarity. The fact that the Xen platform device uses Citrix's vendor ID is historical;
AFAIR this was XenSource's vendor ID (it is "XS" in ASCII) which was donated to the Xen community. I'll clarify this internally though.
Quoted 1 line
I wanted to be clear that this device was distinct.
I think giving two names to the same ID serves only to obfuscate.
Ian.
Quoted 21 lines · Paul Durrant
Quoted 21 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 02 July 2013 09:46
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceinclude/hw/pci/pci_ids.h line 154
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Paul Durrant
include/hw/pci/pci_ids.h +1
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853Is that really the right way to do things, considering that the same value is elsewhere used for
PCI_VENDOR_ID_XEN?Jan
Quoted 7 lines
Quoted 4 lines
include/hw/pci/pci_ids.h line 157
Quoted 3 lines
include/hw/pci/pci_ids.h +2
-0+#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif I opted to do this for clarity. The fact that the Xen platform device uses Citrix's vendor ID is historical;
AFAIR this was XenSource's vendor ID (it is "XS" in ASCII) which was donated to the Xen community. I'll clarify this internally though.
Quoted 1 line
I wanted to be clear that this device was distinct.
I think giving two names to the same ID serves only to obfuscate.
Ian.
Quoted 34 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 10:02
To: Paul Durrant
Cc: Jan Beulich; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 26 lines · Paul Durrant
Quoted 25 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 02 July 2013 09:46
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceinclude/hw/pci/pci_ids.h line 154
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Paul Durrant
include/hw/pci/pci_ids.h +1
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853Is that really the right way to do things, considering that the same value is elsewhere used for
PCI_VENDOR_ID_XEN?Jan
Quoted 3 lines
include/hw/pci/pci_ids.h +2
-0+#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
Quoted 6 lines
Quoted 2 lines
I opted to do this for clarity. The fact that the Xen platform device uses Citrix's vendor ID is historical;
AFAIR this was XenSource's vendor ID (it is "XS" in ASCII) which was donated to the Xen community. I'll clarify this internally though.
The PCI SIG has it registered to Citrix.
Quoted 4 lines
Quoted 1 line
I wanted to be clear that this device was distinct.
I think giving two names to the same ID serves only to obfuscate.
Ok. I don't mind dropping the definition if that's generally preferred.
Paul
Quoted 34 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 10:02
To: Paul Durrant
Cc: Jan Beulich; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 26 lines · Paul Durrant
Quoted 25 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 02 July 2013 09:46
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceinclude/hw/pci/pci_ids.h line 154
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Paul Durrant
include/hw/pci/pci_ids.h +1
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853Is that really the right way to do things, considering that the same value is elsewhere used for
PCI_VENDOR_ID_XEN?Jan
Quoted 3 lines
include/hw/pci/pci_ids.h +2
-0+#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
Quoted 6 lines
Quoted 2 lines
I opted to do this for clarity. The fact that the Xen platform device uses Citrix's vendor ID is historical;
AFAIR this was XenSource's vendor ID (it is "XS" in ASCII) which was donated to the Xen community. I'll clarify this internally though.
The PCI SIG has it registered to Citrix.
Quoted 4 lines
Quoted 1 line
I wanted to be clear that this device was distinct.
I think giving two names to the same ID serves only to obfuscate.
Ok. I don't mind dropping the definition if that's generally preferred.
Paul
Quoted 35 lines · Paul Durrant
Quoted 16 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 10:02
To: Paul Durrant
Cc: Jan Beulich; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 8 lines · Paul Durrant
Quoted 8 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 02 July 2013 09:46
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 1 line
Quoted 1 line
Quoted 1 line
On 02.07.13 at 10:39, Paul Durrant <[email protected]>
Quoted 18 lines · wrote:
Quoted 18 lines
Quoted 17 lines
include/hw/pci/pci_ids.h line 154
Quoted 7 lines
include/hw/pci/pci_ids.h +1
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853Is that really the right way to do things, considering that the same value is elsewhere used for
PCI_VENDOR_ID_XEN?Jan
Quoted 3 lines
include/hw/pci/pci_ids.h +2
-0+#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I opted to do this for clarity. The fact that the Xen platform device uses Citrix's vendor ID is historical;
AFAIR this was XenSource's vendor ID (it is "XS" in ASCII) which was donated to the Xen community. I'll clarify this internally though.
The PCI SIG has it registered to Citrix.
To be clear: the Xen PCI vendor ID (0x5853) is currently registered by Citrix on behalf of the Xen community. The ID is widely used in the community including within Linux and various vendor and community drivers for other OSs. Citrix has no intention to change this and will continue to fund this community resource through its PCI-SIG membership.
Cheers,
James (registered primary contact for Citrix's PCI-SIG membership)
--
James Bulpin
Senior Director, Technology, XenServer
Citrix
Quoted 8 lines · Paul Durrant
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin.
What about <[email protected]> ?
Quoted 8 lines · Paul Durrant
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin.
What about <[email protected]> ?
Quoted 15 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 09:57
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 7 lines · Paul Durrant
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may
Quoted 7 lines
not be
Quoted 1 line
desired by either the host or guest admin.
What about <[email protected]> ?
I had actually coded up a solution based on the existing Xen platform device, by having it synthesize a device ID based on the Xen version to which we could then host the xenbus driver, to allow us to deploy multiple versions of xenbus should compatibility (with things such as the shared info interface) become an issue. The co-installer for this driver could also spot existing PV driver installations and make sure they don't get trashed.
This idea was rejected by Citrix product teams though, because we would not be able to prevent any Windows guest without some known PV drivers from downloading our new driver from Windows Update and this was seen as undesirable.
Paul
Quoted 15 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 09:57
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 7 lines · Paul Durrant
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may
Quoted 7 lines
not be
Quoted 1 line
desired by either the host or guest admin.
What about <[email protected]> ?
I had actually coded up a solution based on the existing Xen platform device, by having it synthesize a device ID based on the Xen version to which we could then host the xenbus driver, to allow us to deploy multiple versions of xenbus should compatibility (with things such as the shared info interface) become an issue. The co-installer for this driver could also spot existing PV driver installations and make sure they don't get trashed.
This idea was rejected by Citrix product teams though, because we would not be able to prevent any Windows guest without some known PV drivers from downloading our new driver from Windows Update and this was seen as undesirable.
Paul
Quoted 23 lines · Paul Durrant
Quoted 15 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 09:57
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 7 lines · Paul Durrant
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this mayQuoted 7 lines
not be
Quoted 1 line
desired by either the host or guest admin.
What about <[email protected]> ?
Quoted 7 lines
I had actually coded up a solution based on the existing Xen platform device, by having it synthesize a device ID based on the Xen version to which we could then host the xenbus driver, to allow us to deploy multiple versions of xenbus should compatibility (with things such as the shared info interface) become an issue. The co-installer for this driver could also spot existing PV driver installations and make sure they don't get trashed.
I think only this last bit of functionality is critical here, and it allows us to avoid having to carry multiple platform devices in upstream, doesn't it?
Quoted 4 lines
This idea was rejected by Citrix product teams though, because we would not be able to prevent any Windows guest without some known PV drivers from downloading our new driver from Windows Update and this was seen as undesirable.
Well, if your product requirements are at odds with doing the right thing upstream then I think it would be best for you to just carry patches to make XS behave how you want. I hope we can find a suitable compromise though.
Ian.
Quoted 13 lines · Ian Campbell
Quoted 7 lines · Paul Durrant
I had actually coded up a solution based on the existing Xen platform device, by having it synthesize a device ID based on the Xen version to which we could then host the xenbus driver, to allow us to deploy multiple versions of xenbus should compatibility (with things such as the shared info interface) become an issue. The co-installer for this driver could also spot existing PV driver installations and make sure they don't get trashed.
I think only this last bit of functionality is critical here, and it allows us to avoid having to carry multiple platform devices in upstream, doesn't it?
Quoted 8 lines
Quoted 4 lines
This idea was rejected by Citrix product teams though, because we would not be able to prevent any Windows guest without some known PV drivers from downloading our new driver from Windows Update and this was seen as undesirable.
Well, if your product requirements are at odds with doing the right thing upstream then I think it would be best for you to just carry patches to make XS behave how you want.
I think it's a reasonable aim to have the WU drivers not spontaneously appear on VMs (on all Xen hosts, remember) where the admin has chosen not to install PV drivers.
Generally, the more I think about this the more I'm convinced that _not_ installing the drivers on any existing systems without explicit permission is the most important thing.
Quoted 1 line
I hope we can find a suitable compromise though.
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get automatic updates after that.
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Tim.
Quoted 13 lines · Ian Campbell
Quoted 7 lines · Paul Durrant
I had actually coded up a solution based on the existing Xen platform device, by having it synthesize a device ID based on the Xen version to which we could then host the xenbus driver, to allow us to deploy multiple versions of xenbus should compatibility (with things such as the shared info interface) become an issue. The co-installer for this driver could also spot existing PV driver installations and make sure they don't get trashed.
I think only this last bit of functionality is critical here, and it allows us to avoid having to carry multiple platform devices in upstream, doesn't it?
Quoted 8 lines
Quoted 4 lines
This idea was rejected by Citrix product teams though, because we would not be able to prevent any Windows guest without some known PV drivers from downloading our new driver from Windows Update and this was seen as undesirable.
Well, if your product requirements are at odds with doing the right thing upstream then I think it would be best for you to just carry patches to make XS behave how you want.
I think it's a reasonable aim to have the WU drivers not spontaneously appear on VMs (on all Xen hosts, remember) where the admin has chosen not to install PV drivers.
Generally, the more I think about this the more I'm convinced that _not_ installing the drivers on any existing systems without explicit permission is the most important thing.
Quoted 1 line
I hope we can find a suitable compromise though.
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get automatic updates after that.
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Tim.
Quoted 23 lines · Tim Deegan
Quoted 13 lines · Ian Campbell
Quoted 7 lines · Paul Durrant
I had actually coded up a solution based on the existing Xen platform device, by having it synthesize a device ID based on the Xen version to which we could then host the xenbus driver, to allow us to deploy multiple versions of xenbus should compatibility (with things such as the shared info interface) become an issue. The co-installer for this driver could also spot existing PV driver installations and make sure they don't get trashed.
I think only this last bit of functionality is critical here, and it allows us to avoid having to carry multiple platform devices in upstream, doesn't it?
Quoted 8 lines
Quoted 4 lines
This idea was rejected by Citrix product teams though, because we would not be able to prevent any Windows guest without some known PV drivers from downloading our new driver from Windows Update and this was seen as undesirable.
Well, if your product requirements are at odds with doing the right thing upstream then I think it would be best for you to just carry patches to make XS behave how you want.
Quoted 7 lines
I think it's a reasonable aim to have the WU drivers not spontaneously appear on VMs (on all Xen hosts, remember) where the admin has chosen not to install PV drivers.
Generally, the more I think about this the more I'm convinced that _not_ installing the drivers on any existing systems without explicit permission is the most important thing.
Will WU install a completely fresh driver for a new (or indeed old) bit of hardware on native entirely without prompting?
I'd have expected the old "Windows has found a driver for your device" dance.
Quoted 7 lines
Quoted 1 line
I hope we can find a suitable compromise though.
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get automatic updates after that.
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Quoted 23 lines · Tim Deegan
Quoted 13 lines · Ian Campbell
Quoted 7 lines · Paul Durrant
I had actually coded up a solution based on the existing Xen platform device, by having it synthesize a device ID based on the Xen version to which we could then host the xenbus driver, to allow us to deploy multiple versions of xenbus should compatibility (with things such as the shared info interface) become an issue. The co-installer for this driver could also spot existing PV driver installations and make sure they don't get trashed.
I think only this last bit of functionality is critical here, and it allows us to avoid having to carry multiple platform devices in upstream, doesn't it?
Quoted 8 lines
Quoted 4 lines
This idea was rejected by Citrix product teams though, because we would not be able to prevent any Windows guest without some known PV drivers from downloading our new driver from Windows Update and this was seen as undesirable.
Well, if your product requirements are at odds with doing the right thing upstream then I think it would be best for you to just carry patches to make XS behave how you want.
Quoted 7 lines
I think it's a reasonable aim to have the WU drivers not spontaneously appear on VMs (on all Xen hosts, remember) where the admin has chosen not to install PV drivers.
Generally, the more I think about this the more I'm convinced that _not_ installing the drivers on any existing systems without explicit permission is the most important thing.
Will WU install a completely fresh driver for a new (or indeed old) bit of hardware on native entirely without prompting?
I'd have expected the old "Windows has found a driver for your device" dance.
Quoted 7 lines
Quoted 1 line
I hope we can find a suitable compromise though.
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get automatic updates after that.
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Quoted 55 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 11:24
To: Tim (Xen.org)
Cc: Paul Durrant; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 10 lines · Tim Deegan
Quoted 9 lines · Ian Campbell
Quoted 7 lines · Paul Durrant
I had actually coded up a solution based on the existing Xen platform device, by having it synthesize a device ID based on the Xen version to which we could then host the xenbus driver, to allow us to deploy multiple versions of xenbus should compatibility (with things such as the shared info interface) become an issue. The co-installer for this driver could also spot existing PV driver installations and make sure they don't get trashed.
Quoted 6 lines
Quoted 6 lines
I think only this last bit of functionality is critical here, and it allows us to avoid having to carry multiple platform devices in upstream, doesn't it?
Quoted 2 lines
This idea was rejected by Citrix product teams though, because we would not be able to prevent any Windows guest without some known
PV
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers from downloading our new driver from Windows Update and
this
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
was seen as undesirable.
Well, if your product requirements are at odds with doing the right thing upstream then I think it would be best for you to just carry patches to make XS behave how you want.
Quoted 7 lines
I think it's a reasonable aim to have the WU drivers not spontaneously appear on VMs (on all Xen hosts, remember) where the admin has chosen not to install PV drivers.
Generally, the more I think about this the more I'm convinced that _not_ installing the drivers on any existing systems without explicit permission is the most important thing.
Will WU install a completely fresh driver for a new (or indeed old) bit of hardware on native entirely without prompting?
I'd have expected the old "Windows has found a driver for your device" dance.
Quoted 7 lines
Quoted 1 line
I hope we can find a suitable compromise though.
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get automatic updates after that.
Quoted 5 lines
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in? Note that I'm not proposing the new device displaces the existing platform device in any way.
Paul
Quoted 10 lines · Paul Durrant
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in? Note that I'm not proposing the new device displaces the existing platform device in any way.
A dislike for having to coordinate guest internal and guest external configuration changes in this way has been expressed by several people.
However if you only intend to support your drivers on XenServer (and it is starting to seem like your constraints may end up forcing this option upon you) then you can equally well carry that new device in your patches too and manage it however your PMs require.
Ian.
Quoted 10 lines · Paul Durrant
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in? Note that I'm not proposing the new device displaces the existing platform device in any way.
A dislike for having to coordinate guest internal and guest external configuration changes in this way has been expressed by several people.
However if you only intend to support your drivers on XenServer (and it is starting to seem like your constraints may end up forcing this option upon you) then you can equally well carry that new device in your patches too and manage it however your PMs require.
Ian.
Quoted 12 lines · Ian Campbell
Quoted 10 lines · Paul Durrant
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in? Note that I'm not proposing the new device displaces the existing platform device in any way.
Quoted 8 lines
A dislike for having to coordinate guest internal and guest external configuration changes in this way has been expressed by several people.
However if you only intend to support your drivers on XenServer (and it is starting to seem like your constraints may end up forcing this option upon you) then you can equally well carry that new device in your patches too and manage it however your PMs require.
It's also good to remember the Citrix XenServer Windows PV drivers are now opensource, and (more) easily usable on non-XenServer environments aswell.
I hope they'd work on upstream Xen aswell.
-- Pasi
Quoted 6 lines · Paul Durrant
Quoted 6 lines
Quoted 5 lines
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get automatic updates after that.
Quoted 8 lines
Quoted 5 lines
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Well, you can have them install by default on platforms that want it, or on new enough Xen versions. Or, even better, on new enough _windows_ versions.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in?
Only if it's OK that the _host_ admin has to be involved (which was the original objection). Upgrade-only but hooked to the existing ID lets a guest admin install the drivers manually without plumbing it through $CLOUDPROVIDER's toolstack, and without having it appear suddenly on existing VMs in the dead of night.
If you could have it bind to either device then I guess a second PCI ID is another way of signalling that policy, but we should probably use one of the many other channels we have from the tools to the guest.
Tim.
Quoted 6 lines · Paul Durrant
Quoted 6 lines
Quoted 5 lines
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get automatic updates after that.
Quoted 8 lines
Quoted 5 lines
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Well, you can have them install by default on platforms that want it, or on new enough Xen versions. Or, even better, on new enough _windows_ versions.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in?
Only if it's OK that the _host_ admin has to be involved (which was the original objection). Upgrade-only but hooked to the existing ID lets a guest admin install the drivers manually without plumbing it through $CLOUDPROVIDER's toolstack, and without having it appear suddenly on existing VMs in the dead of night.
If you could have it bind to either device then I guess a second PCI ID is another way of signalling that policy, but we should probably use one of the many other channels we have from the tools to the guest.
Tim.
Quoted 27 lines · Tim Deegan
Quoted 6 lines · Paul Durrant
Quoted 6 lines
Quoted 5 lines
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get automatic updates after that.
Quoted 8 lines
Quoted 5 lines
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Well, you can have them install by default on platforms that want it, or on new enough Xen versions. Or, even better, on new enough _windows_ versions.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Quoted 8 lines
Quoted 2 lines
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in?
Only if it's OK that the _host_ admin has to be involved (which was the original objection). Upgrade-only but hooked to the existing ID lets a guest admin install the drivers manually without plumbing it through $CLOUDPROVIDER's toolstack, and without having it appear suddenly on existing VMs in the dead of night.
I think part of the problem here is that it is unclear who the target audience for these drivers are.
Paul, are you intending that these drivers be only for XenServer users or are you intending for them to be used by the broader community on a variety of different Xen platforms?
Ian.
Quoted 45 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 11:57
To: Tim (Xen.org)
Cc: Paul Durrant; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 5 lines · Tim Deegan
Quoted 4 lines · Paul Durrant
Quoted 4 lines
Quoted 4 lines
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get
automatic
Quoted 22 lines
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
updates after that.
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Well, you can have them install by default on platforms that want it, or on new enough Xen versions. Or, even better, on new enough _windows_ versions.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Quoted 8 lines
Quoted 2 lines
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in?
Only if it's OK that the _host_ admin has to be involved (which was the original objection). Upgrade-only but hooked to the existing ID lets a guest admin install the drivers manually without plumbing it through $CLOUDPROVIDER's toolstack, and without having it appear suddenly on existing VMs in the dead of night.
Quoted 7 lines
I think part of the problem here is that it is unclear who the target audience for these drivers are.
Paul, are you intending that these drivers be only for XenServer users or are you intending for them to be used by the broader community on a variety of different Xen platforms?
My intention is that the drivers are widely available to all who want them, but the key word there is 'want'. No-one should get a surprise when we publish to Windows Update so having the drivers bind to a new device which can then be added to the VM config seems like the cleanest solution. I realise that this involves the VM provider having to do something to enable a VM to get drivers from Windows Update rather that the guest admin, but I think that's actually the right way to do it. Adding this device into a VM is essentially enabling new functionality in the same way that adding a new network device or storage device would be.
Paul
Quoted 45 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 11:57
To: Tim (Xen.org)
Cc: Paul Durrant; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 5 lines · Tim Deegan
Quoted 4 lines · Paul Durrant
Quoted 4 lines
Quoted 4 lines
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get
automatic
Quoted 22 lines
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
updates after that.
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Well, you can have them install by default on platforms that want it, or on new enough Xen versions. Or, even better, on new enough _windows_ versions.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Quoted 8 lines
Quoted 2 lines
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in?
Only if it's OK that the _host_ admin has to be involved (which was the original objection). Upgrade-only but hooked to the existing ID lets a guest admin install the drivers manually without plumbing it through $CLOUDPROVIDER's toolstack, and without having it appear suddenly on existing VMs in the dead of night.
Quoted 7 lines
I think part of the problem here is that it is unclear who the target audience for these drivers are.
Paul, are you intending that these drivers be only for XenServer users or are you intending for them to be used by the broader community on a variety of different Xen platforms?
My intention is that the drivers are widely available to all who want them, but the key word there is 'want'. No-one should get a surprise when we publish to Windows Update so having the drivers bind to a new device which can then be added to the VM config seems like the cleanest solution. I realise that this involves the VM provider having to do something to enable a VM to get drivers from Windows Update rather that the guest admin, but I think that's actually the right way to do it. Adding this device into a VM is essentially enabling new functionality in the same way that adding a new network device or storage device would be.
Paul
Quoted 53 lines · Paul Durrant
Quoted 45 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 11:57
To: Tim (Xen.org)
Cc: Paul Durrant; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 5 lines · Tim Deegan
Quoted 4 lines · Paul Durrant
Quoted 4 lines
Quoted 4 lines
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get
automatic
Quoted 22 lines
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
updates after that.
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Well, you can have them install by default on platforms that want it, or on new enough Xen versions. Or, even better, on new enough _windows_ versions.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Quoted 8 lines
Quoted 2 lines
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in?
Only if it's OK that the _host_ admin has to be involved (which was the original objection). Upgrade-only but hooked to the existing ID lets a guest admin install the drivers manually without plumbing it through $CLOUDPROVIDER's toolstack, and without having it appear suddenly on existing VMs in the dead of night.
Quoted 7 lines
I think part of the problem here is that it is unclear who the target audience for these drivers are.
Paul, are you intending that these drivers be only for XenServer users or are you intending for them to be used by the broader community on a variety of different Xen platforms?
Quoted 5 lines
My intention is that the drivers are widely available to all who want them, but the key word there is 'want'. No-one should get a surprise when we publish to Windows Update so having the drivers bind to a new device which can then be added to the VM config seems like the cleanest solution.
Actually, it occurs to me now (and I have a feeling Tim was trying to say this and I didn't get it): It's not really appropriate for any individual vendor to upload a driver to Windows Update which binds to the default platform device ID anyway.
There are several other sets of Xen PV drivers out there (including the GPL PV drivers and various companies commercial/proprietary drivers) and having one particular set of drivers in WU puts all of them at a disadvantage. Before doing that we would need consensus behind the particular set of drivers, which I don't think any of them currently have.
All of which means that you do need your own device ID, for which you can upload support to WU. However I don't think it therefore follows that you need that device ID to be supported by upstream.
Does this work:
We assign a device ID to your drivers (and we would do the same for any vendor). You can then upload drivers supporting that ID to WU and arrange within your product to create the appropriate device.
At the same time you produce a setup.exe installer which will install those same drivers but also sets up (or includes) the binding to the existing device IDs.
So anyone running on XenServer gets the driver direct from WU and you can define your own policies around what that means and what the upgrade path and ties to the platform mean etc. People who want to use your drivers on non-XenServer platforms can choose to do so by manually installing from within the guest, with no need to modify their guest configuration.
Does that make sense?
Ian.
Quoted 53 lines · Paul Durrant
Quoted 45 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 11:57
To: Tim (Xen.org)
Cc: Paul Durrant; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 5 lines · Tim Deegan
Quoted 4 lines · Paul Durrant
Quoted 4 lines
Quoted 4 lines
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get
automatic
Quoted 22 lines
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
updates after that.
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Well, you can have them install by default on platforms that want it, or on new enough Xen versions. Or, even better, on new enough _windows_ versions.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Quoted 8 lines
Quoted 2 lines
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in?
Only if it's OK that the _host_ admin has to be involved (which was the original objection). Upgrade-only but hooked to the existing ID lets a guest admin install the drivers manually without plumbing it through $CLOUDPROVIDER's toolstack, and without having it appear suddenly on existing VMs in the dead of night.
Quoted 7 lines
I think part of the problem here is that it is unclear who the target audience for these drivers are.
Paul, are you intending that these drivers be only for XenServer users or are you intending for them to be used by the broader community on a variety of different Xen platforms?
Quoted 5 lines
My intention is that the drivers are widely available to all who want them, but the key word there is 'want'. No-one should get a surprise when we publish to Windows Update so having the drivers bind to a new device which can then be added to the VM config seems like the cleanest solution.
Actually, it occurs to me now (and I have a feeling Tim was trying to say this and I didn't get it): It's not really appropriate for any individual vendor to upload a driver to Windows Update which binds to the default platform device ID anyway.
There are several other sets of Xen PV drivers out there (including the GPL PV drivers and various companies commercial/proprietary drivers) and having one particular set of drivers in WU puts all of them at a disadvantage. Before doing that we would need consensus behind the particular set of drivers, which I don't think any of them currently have.
All of which means that you do need your own device ID, for which you can upload support to WU. However I don't think it therefore follows that you need that device ID to be supported by upstream.
Does this work:
We assign a device ID to your drivers (and we would do the same for any vendor). You can then upload drivers supporting that ID to WU and arrange within your product to create the appropriate device.
At the same time you produce a setup.exe installer which will install those same drivers but also sets up (or includes) the binding to the existing device IDs.
So anyone running on XenServer gets the driver direct from WU and you can define your own policies around what that means and what the upgrade path and ties to the platform mean etc. People who want to use your drivers on non-XenServer platforms can choose to do so by manually installing from within the guest, with no need to modify their guest configuration.
Does that make sense?
Ian.
Quoted 100 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 13:44
To: Paul Durrant
Cc: Tim (Xen.org); [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 11 lines · Paul Durrant
Quoted 11 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 11:57
To: Tim (Xen.org)
Cc: Paul Durrant; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 3 lines · Tim Deegan
Quoted 2 lines · Paul Durrant
Quoted 2 lines
Quoted 2 lines
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the
xen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
platform device, and also fail if there's _no_ driver bound). Then
the
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
guest admin can choose to install the drivers by hand and get
automatic
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
updates after that.
That sounds reasonable. However I thought part of the point of
getting
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
things into WU was then that they could be "inbox" (either
figuratively
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Well, you can have them install by default on platforms that want it, or on new enough Xen versions. Or, even better, on new enough
_windows_
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
versions.
Quoted 1 line
Quoted 1 line
Quoted 1 line
XS, XC and anyone else who chooses could carry a separate patch
that
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in?
Only if it's OK that the _host_ admin has to be involved (which was the original objection). Upgrade-only but hooked to the existing ID lets a guest admin install the drivers manually without plumbing it through $CLOUDPROVIDER's toolstack, and without having it appear suddenly
on
Quoted 10 lines
Quoted 9 lines
Quoted 1 line
existing VMs in the dead of night.
I think part of the problem here is that it is unclear who the target audience for these drivers are.
Paul, are you intending that these drivers be only for XenServer users or are you intending for them to be used by the broader community on a variety of different Xen platforms?
Quoted 5 lines
My intention is that the drivers are widely available to all who want them, but the key word there is 'want'. No-one should get a surprise when we publish to Windows Update so having the drivers bind to a new device which can then be added to the VM config seems like the cleanest solution.
Actually, it occurs to me now (and I have a feeling Tim was trying to say this and I didn't get it): It's not really appropriate for any individual vendor to upload a driver to Windows Update which binds to the default platform device ID anyway.
There are several other sets of Xen PV drivers out there (including the GPL PV drivers and various companies commercial/proprietary drivers) and having one particular set of drivers in WU puts all of them at a disadvantage. Before doing that we would need consensus behind the particular set of drivers, which I don't think any of them currently have.
All of which means that you do need your own device ID, for which you can upload support to WU. However I don't think it therefore follows that you need that device ID to be supported by upstream.
Does this work:
We assign a device ID to your drivers (and we would do the same for any vendor). You can then upload drivers supporting that ID to WU and arrange within your product to create the appropriate device.
At the same time you produce a setup.exe installer which will install those same drivers but also sets up (or includes) the binding to the existing device IDs.
Quoted 9 lines
So anyone running on XenServer gets the driver direct from WU and you can define your own policies around what that means and what the upgrade path and ties to the platform mean etc. People who want to use your drivers on non-XenServer platforms can choose to do so by manually installing from within the guest, with no need to modify their guest configuration.
Does that make sense?
Yes, that makes sense *but* I would still like to avoid carrying a private patch to QEMU (and potentially have to keep rebasing it), hence my posting the patch the qemu-devel. Having the code in QEMU does no harm, clearly reserves the device id, and any VM provider (with a suitable version of QEMU on their host) can then enable the device should they wish. Am I missing something?
Paul
Quoted 2 lines · Paul Durrant
Yes, that makes sense *but* I would still like to avoid carrying a private patch to QEMU (and potentially have to keep rebasing it),
It's small and pretty self contained I think.
Someone (Anthony?) recommended making it subclass the existing one, which ought to reduce the size of the patch to be maintained even further I think.
Quoted 2 lines
hence my posting the patch the qemu-devel. Having the code in QEMU
does no harm, clearly reserves the device id,
FWIW I don't think QEMU should be the registry of these device IDs. Can you create a file somewhere in the Xen source base to serve as the registry, probably somewhere under xen/include/public.
We should probably have some sort of scheme. How about we declare the topmost available bit of the device id to be the "vendor specific" bit? We could split the dev id into N-bits of "vendor" and M-bits of device, or add a "locally administered" bit, but that might be overkill?
Quoted 2 lines
and any VM provider (with a suitable version of QEMU on their host)
can then enable the device should they wish.
I imagine they would be worried about you pushing new drivers which depend on new XenServer features. So unless they also intend to implement (and track) your version compatibility xenstore keys (or whatever mechanism) I'm not sure why they would want to do such a thing. Or are you proposing to maintain forward and backward compatibility? i.e. based on feature flags and negotiation with backends rather than versioned platform devices or other XenServer specific mechanisms?
In any case they could also apply the patch. If it turns out that lots of people are doing so then maybe that is the time to consider it for upstream.
But in the meantime this avoids anyone other than XenServer having to think about policy and/or mechanism WRT multiple platform devices.
Quoted 3 lines
Am I missing something?
Paul
Quoted 7 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 14:43
To: Paul Durrant
Cc: Tim (Xen.org); [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus device
Quoted 6 lines
Quoted 2 lines · Paul Durrant
Yes, that makes sense *but* I would still like to avoid carrying a private patch to QEMU (and potentially have to keep rebasing it),
It's small and pretty self contained I think.
It still has external interfaces, to tracing, QOM, etc that may change.
Quoted 3 lines
FWIW I don't think QEMU should be the registry of these device IDs. Can you create a file somewhere in the Xen source base to serve as the registry, probably somewhere under xen/include/public.
I'll look at how best to do this.
Quoted 6 lines
We should probably have some sort of scheme. How about we declare the topmost available bit of the device id to be the "vendor specific" bit? We could split the dev id into N-bits of "vendor" and M-bits of device, or add a "locally administered" bit, but that might be overkill?
Quoted 7 lines
Quoted 2 lines
and any VM provider (with a suitable version of QEMU on their host)
can then enable the device should they wish.I imagine they would be worried about you pushing new drivers which depend on new XenServer features. So unless they also intend to implement (and track) your version compatibility xenstore keys (or whatever mechanism) I'm not sure why they would want to do such a thing.
We already have people interested in doing this and we would look to QA in those non-XenServer environments, to ensure compatibility.
Quoted 4 lines
Or are you proposing to maintain forward and backward compatibility? i.e. based on feature flags and negotiation with backends rather than versioned platform devices or other XenServer specific mechanisms?
In general yes. Modifying the platform device revision is a mechanism of last resort (because of the inconvenience it causes) but one that we may still need at some point.
Quoted 4 lines
In any case they could also apply the patch. If it turns out that lots of people are doing so then maybe that is the time to consider it for upstream.
We already have interested parties and the device not being available upstream is an inconvenience.
Paul
Quoted 7 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 14:43
To: Paul Durrant
Cc: Tim (Xen.org); [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus device
Quoted 6 lines
Quoted 2 lines · Paul Durrant
Yes, that makes sense *but* I would still like to avoid carrying a private patch to QEMU (and potentially have to keep rebasing it),
It's small and pretty self contained I think.
It still has external interfaces, to tracing, QOM, etc that may change.
Quoted 3 lines
FWIW I don't think QEMU should be the registry of these device IDs. Can you create a file somewhere in the Xen source base to serve as the registry, probably somewhere under xen/include/public.
I'll look at how best to do this.
Quoted 6 lines
We should probably have some sort of scheme. How about we declare the topmost available bit of the device id to be the "vendor specific" bit? We could split the dev id into N-bits of "vendor" and M-bits of device, or add a "locally administered" bit, but that might be overkill?
Quoted 7 lines
Quoted 2 lines
and any VM provider (with a suitable version of QEMU on their host)
can then enable the device should they wish.I imagine they would be worried about you pushing new drivers which depend on new XenServer features. So unless they also intend to implement (and track) your version compatibility xenstore keys (or whatever mechanism) I'm not sure why they would want to do such a thing.
We already have people interested in doing this and we would look to QA in those non-XenServer environments, to ensure compatibility.
Quoted 4 lines
Or are you proposing to maintain forward and backward compatibility? i.e. based on feature flags and negotiation with backends rather than versioned platform devices or other XenServer specific mechanisms?
In general yes. Modifying the platform device revision is a mechanism of last resort (because of the inconvenience it causes) but one that we may still need at some point.
Quoted 4 lines
In any case they could also apply the patch. If it turns out that lots of people are doing so then maybe that is the time to consider it for upstream.
We already have interested parties and the device not being available upstream is an inconvenience.
Paul
Quoted 6 lines
-----Original Message-----
FWIW I don't think QEMU should be the registry of these device IDs. Can you create a file somewhere in the Xen source base to serve as the registry, probably somewhere under xen/include/public.
Is the Xen source base actually the right place? The vendor ID belongs to Citrix. Does the PCI SIG hold a list of known device IDs for each vendor? If not then I guess we need some canonical place within Citrix to make sure device ids do not get re-used.
Paul
Quoted 6 lines
-----Original Message-----
FWIW I don't think QEMU should be the registry of these device IDs. Can you create a file somewhere in the Xen source base to serve as the registry, probably somewhere under xen/include/public.
Is the Xen source base actually the right place? The vendor ID belongs to Citrix. Does the PCI SIG hold a list of known device IDs for each vendor? If not then I guess we need some canonical place within Citrix to make sure device ids do not get re-used.
Paul
Quoted 9 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
FWIW I don't think QEMU should be the registry of these device IDs. Can you create a file somewhere in the Xen source base to serve as the registry, probably somewhere under xen/include/public.
Is the Xen source base actually the right place? The vendor ID belongs to Citrix.
So far as I know XenSource gave this ID over for use by the Xen project and nothing about the acquisition will have changed that.
So although the ID may technically be owned by Citrix it is in effect managed by the Xen project and "belongs" to Xen.
We need to clarify this internally.
Quoted 5 lines
Does the PCI SIG hold a list of known device IDs for each vendor? If
not then I guess we need some canonical place within Citrix to make sure device ids do not get re-used.Paul
Quoted 9 lines · Paul Durrant
Quoted 6 lines
-----Original Message-----
FWIW I don't think QEMU should be the registry of these device IDs. Can you create a file somewhere in the Xen source base to serve as the registry, probably somewhere under xen/include/public.
Is the Xen source base actually the right place? The vendor ID belongs to Citrix.
So far as I know XenSource gave this ID over for use by the Xen project and nothing about the acquisition will have changed that.
So although the ID may technically be owned by Citrix it is in effect managed by the Xen project and "belongs" to Xen.
We need to clarify this internally.
Quoted 5 lines
Does the PCI SIG hold a list of known device IDs for each vendor? If
not then I guess we need some canonical place within Citrix to make sure device ids do not get re-used.Paul
Quoted 3 lines · --On 2 July 2013 13:43:38 +0100 Ian Campbell <[email protected]> wrote:
We assign a device ID to your drivers (and we would do the same for any vendor). You can then upload drivers supporting that ID to WU and arrange within your product to create the appropriate device.
Let's say we do this, then Xirtic also produce PV drivers, and get assigned their own device ID. Will both of them be visible with a different device ID for the same device? Will windows cope with that? Or do we need to mediate which device IDs are exposed?
Signature · 1 line
Alex Bligh
Quoted 3 lines · --On 2 July 2013 13:43:38 +0100 Ian Campbell <[email protected]> wrote:
We assign a device ID to your drivers (and we would do the same for any vendor). You can then upload drivers supporting that ID to WU and arrange within your product to create the appropriate device.
Let's say we do this, then Xirtic also produce PV drivers, and get assigned their own device ID. Will both of them be visible with a different device ID for the same device? Will windows cope with that? Or do we need to mediate which device IDs are exposed?
Signature · 1 line
Alex Bligh
Quoted 11 lines · Alex Bligh
--On 2 July 2013 13:43:38 +0100 Ian Campbell <[email protected]>
Quoted 3 lines · wrote:
We assign a device ID to your drivers (and we would do the same for any vendor). You can then upload drivers supporting that ID to WU and arrange within your product to create the appropriate device.
Let's say we do this, then Xirtic also produce PV drivers, and get assigned their own device ID. Will both of them be visible with a different device ID for the same device?
Different device ID for the same device isn't possible, a device has exactly one device ID. I assume you mean two devices visible one with each ID?
Quoted 2 lines
Will windows cope with that?
Or do we need to mediate which device IDs are exposed?
I'd expect that only Xirtic products would provide a device with that device ID. They may choose to make it mutually exclusive with the standard device, or they may choose to allow it to co-exist. In the latter case it is down to them what the behaviour of their drivers is. In any case this is all down to the people who make that product and their requirements etc.
For people running Xirtic drivers on non-Xirtic products the rest of my mail applies -- IOW those users would use a setup.exe which binds those drivers to the normal device, there is no Xirtic device ID present anywhere in this scenario.
Ian.
Quoted 11 lines · Alex Bligh
--On 2 July 2013 13:43:38 +0100 Ian Campbell <[email protected]>
Quoted 3 lines · wrote:
We assign a device ID to your drivers (and we would do the same for any vendor). You can then upload drivers supporting that ID to WU and arrange within your product to create the appropriate device.
Let's say we do this, then Xirtic also produce PV drivers, and get assigned their own device ID. Will both of them be visible with a different device ID for the same device?
Different device ID for the same device isn't possible, a device has exactly one device ID. I assume you mean two devices visible one with each ID?
Quoted 2 lines
Will windows cope with that?
Or do we need to mediate which device IDs are exposed?
I'd expect that only Xirtic products would provide a device with that device ID. They may choose to make it mutually exclusive with the standard device, or they may choose to allow it to co-exist. In the latter case it is down to them what the behaviour of their drivers is. In any case this is all down to the people who make that product and their requirements etc.
For people running Xirtic drivers on non-Xirtic products the rest of my mail applies -- IOW those users would use a setup.exe which binds those drivers to the normal device, there is no Xirtic device ID present anywhere in this scenario.
Ian.
Ian,
Quoted 7 lines · --On 2 July 2013 14:42:41 +0100 Ian Campbell <[email protected]> wrote:
Quoted 3 lines
Let's say we do this, then Xirtic also produce PV drivers, and get assigned their own device ID. Will both of them be visible with a different device ID for the same device?
Different device ID for the same device isn't possible, a device has exactly one device ID. I assume you mean two devices visible one with each ID?
Yes. Two PCI devices talking to the same underlying thing.
Quoted 10 lines
Quoted 2 lines
Will windows cope with that?
Or do we need to mediate which device IDs are exposed?I'd expect that only Xirtic products would provide a device with that device ID. They may choose to make it mutually exclusive with the standard device, or they may choose to allow it to co-exist. In the latter case it is down to them what the behaviour of their drivers is. In any case this is all down to the people who make that product and their requirements etc.
Quoted 4 lines
For people running Xirtic drivers on non-Xirtic products the rest of my mail applies -- IOW those users would use a setup.exe which binds those drivers to the normal device, there is no Xirtic device ID present anywhere in this scenario.
OK. The thing I was suggesting we try to avoid was Citrix drivers binding to PCI-ID A and Xirtic drivers binding to PCI-ID B, and them both trying to work at once.
Perhaps I should stop worrying about this as I'm finding it really hard to resist typing 'so don't use Windows' :-)
Signature · 1 line
Alex Bligh
Ian,
Quoted 7 lines · --On 2 July 2013 14:42:41 +0100 Ian Campbell <[email protected]> wrote:
Quoted 3 lines
Let's say we do this, then Xirtic also produce PV drivers, and get assigned their own device ID. Will both of them be visible with a different device ID for the same device?
Different device ID for the same device isn't possible, a device has exactly one device ID. I assume you mean two devices visible one with each ID?
Yes. Two PCI devices talking to the same underlying thing.
Quoted 10 lines
Quoted 2 lines
Will windows cope with that?
Or do we need to mediate which device IDs are exposed?I'd expect that only Xirtic products would provide a device with that device ID. They may choose to make it mutually exclusive with the standard device, or they may choose to allow it to co-exist. In the latter case it is down to them what the behaviour of their drivers is. In any case this is all down to the people who make that product and their requirements etc.
Quoted 4 lines
For people running Xirtic drivers on non-Xirtic products the rest of my mail applies -- IOW those users would use a setup.exe which binds those drivers to the normal device, there is no Xirtic device ID present anywhere in this scenario.
OK. The thing I was suggesting we try to avoid was Citrix drivers binding to PCI-ID A and Xirtic drivers binding to PCI-ID B, and them both trying to work at once.
Perhaps I should stop worrying about this as I'm finding it really hard to resist typing 'so don't use Windows' :-)
Signature · 1 line
Alex Bligh
Quoted 34 lines
-----Original Message-----
From: Tim Deegan [mailto:[email protected]]
Sent: 02 July 2013 11:50
To: Paul Durrant
Cc: Ian Campbell; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 6 lines · Paul Durrant
Quoted 6 lines
Quoted 5 lines
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get automatic updates after that.
Quoted 8 lines
Quoted 5 lines
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Well, you can have them install by default on platforms that want it, or on new enough Xen versions. Or, even better, on new enough _windows_ versions.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Quoted 9 lines
Quoted 2 lines
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in?
Only if it's OK that the _host_ admin has to be involved (which was the original objection). Upgrade-only but hooked to the existing ID lets a guest admin install the drivers manually without plumbing it through $CLOUDPROVIDER's toolstack, and without having it appear suddenly on existing VMs in the dead of night.
But for new VMs we *want* the drivers to download and install automatically; we just don't want them to do that for existing VMs.
Paul
Quoted 34 lines
-----Original Message-----
From: Tim Deegan [mailto:[email protected]]
Sent: 02 July 2013 11:50
To: Paul Durrant
Cc: Ian Campbell; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 6 lines · Paul Durrant
Quoted 6 lines
Quoted 5 lines
Well, the WU drivers could refuse to install except as upgrade to themselves (i.e. fail if there's any unknown driver bound to the xen platform device, and also fail if there's _no_ driver bound). Then the guest admin can choose to install the drivers by hand and get automatic updates after that.
Quoted 8 lines
Quoted 5 lines
That sounds reasonable. However I thought part of the point of getting things into WU was then that they could be "inbox" (either figuratively or literally) such that they would be installed by the Windows installer. Perhaps that's a separate thing though.
No, that is the eventual aim so I don't think the 'upgrade only' options is really future-proof.
Well, you can have them install by default on platforms that want it, or on new enough Xen versions. Or, even better, on new enough _windows_ versions.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
XS, XC and anyone else who chooses could carry a separate patch that changes the default to 'install if there are no drivers', signalling over xenstore, or ACPI, or a Windows domain policy, or whatever.
Right.
Quoted 9 lines
Quoted 2 lines
Surely having a new device for the purposes of hosting Citrix PV drivers is a cleaner option for opting in?
Only if it's OK that the _host_ admin has to be involved (which was the original objection). Upgrade-only but hooked to the existing ID lets a guest admin install the drivers manually without plumbing it through $CLOUDPROVIDER's toolstack, and without having it appear suddenly on existing VMs in the dead of night.
But for new VMs we *want* the drivers to download and install automatically; we just don't want them to do that for existing VMs.
Paul
Quoted 37 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 11:24
To: Tim (Xen.org)
Cc: Paul Durrant; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 10 lines · Tim Deegan
Quoted 9 lines · Ian Campbell
Quoted 7 lines · Paul Durrant
I had actually coded up a solution based on the existing Xen platform device, by having it synthesize a device ID based on the Xen version to which we could then host the xenbus driver, to allow us to deploy multiple versions of xenbus should compatibility (with things such as the shared info interface) become an issue. The co-installer for this driver could also spot existing PV driver installations and make sure they don't get trashed.
Quoted 6 lines
Quoted 6 lines
I think only this last bit of functionality is critical here, and it allows us to avoid having to carry multiple platform devices in upstream, doesn't it?
Quoted 2 lines
This idea was rejected by Citrix product teams though, because we would not be able to prevent any Windows guest without some known
PV
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers from downloading our new driver from Windows Update and
this
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
was seen as undesirable.
Well, if your product requirements are at odds with doing the right thing upstream then I think it would be best for you to just carry patches to make XS behave how you want.
I think it's a reasonable aim to have the WU drivers not spontaneously appear on VMs (on all Xen hosts, remember) where the admin has chosen not to install PV drivers.
Quoted 7 lines
Quoted 3 lines
Generally, the more I think about this the more I'm convinced that _not_ installing the drivers on any existing systems without explicit permission is the most important thing.
Will WU install a completely fresh driver for a new (or indeed old) bit of hardware on native entirely without prompting?
I believe it can be configured to do so.
Quoted 5 lines
I'd have expected the old "Windows has found a driver for your device" dance.
Quoted 2 lines
Quoted 1 line
I hope we can find a suitable compromise though.
I still think the extra device is the cleanest solution, and I have gone through all the alternatives I can think of.
Paul
Quoted 37 lines
-----Original Message-----
From: Ian Campbell
Sent: 02 July 2013 11:24
To: Tim (Xen.org)
Cc: Paul Durrant; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH] Citrix PV Bus deviceQuoted 10 lines · Tim Deegan
Quoted 9 lines · Ian Campbell
Quoted 7 lines · Paul Durrant
I had actually coded up a solution based on the existing Xen platform device, by having it synthesize a device ID based on the Xen version to which we could then host the xenbus driver, to allow us to deploy multiple versions of xenbus should compatibility (with things such as the shared info interface) become an issue. The co-installer for this driver could also spot existing PV driver installations and make sure they don't get trashed.
Quoted 6 lines
Quoted 6 lines
I think only this last bit of functionality is critical here, and it allows us to avoid having to carry multiple platform devices in upstream, doesn't it?
Quoted 2 lines
This idea was rejected by Citrix product teams though, because we would not be able to prevent any Windows guest without some known
PV
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers from downloading our new driver from Windows Update and
this
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
was seen as undesirable.
Well, if your product requirements are at odds with doing the right thing upstream then I think it would be best for you to just carry patches to make XS behave how you want.
I think it's a reasonable aim to have the WU drivers not spontaneously appear on VMs (on all Xen hosts, remember) where the admin has chosen not to install PV drivers.
Quoted 7 lines
Quoted 3 lines
Generally, the more I think about this the more I'm convinced that _not_ installing the drivers on any existing systems without explicit permission is the most important thing.
Will WU install a completely fresh driver for a new (or indeed old) bit of hardware on native entirely without prompting?
I believe it can be configured to do so.
Quoted 5 lines
I'd have expected the old "Windows has found a driver for your device" dance.
Quoted 2 lines
Quoted 1 line
I hope we can find a suitable compromise though.
I still think the extra device is the cleanest solution, and I have gone through all the alternatives I can think of.
Paul
Am 02.07.2013 10:39, schrieb Paul Durrant:
Quoted 23 lines
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++ include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +0
-0
hw/i386/Makefile.objs obj-y += pc.o pc_piix.o pc_q35.o · line 7
Quoted 4 lines
hw/i386/Makefile.objs +1
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o obj-y += kvmvapic.o +obj-y += citrix_pv_bus.o
So the reason to place the device here is TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my TODO list. :/
Quoted 31 lines
hw/i386/citrix_pv_bus.c new file +25
-0@@ -0,0 +1,122 @@ +/* Copyright (c) Citrix Systems Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, +* with or without modification, are permitted provided +* that the following conditions are met: +* +* * Redistributions of source code must retain the above +* copyright notice, this list of conditions and the +* following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the +* following disclaimer in the documentation and/or other +* materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
hw/i386/citrix_pv_bus.c line 35
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ + +#include "hw/hw.h" +#include "hw/pci/pci.h" + +typedef struct _CitrixPVBusDevice {
Identifiers starting with underscore are supposedly reserved by POSIX/C99, you can just use the same name as for the typedef.
hw/i386/citrix_pv_bus.c line 36
Quoted 1 line
hw/i386/citrix_pv_bus.c new file +1
-0+PCIDevice dev;
/*< private >*/
PCIDevice parent_obj;
/*< public >*/please. More although still incomplete guidelines at:
hw/i386/citrix_pv_bus.c line 46
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+uint8_t revision; +uint32_t pages; +MemoryRegion mmio; +} CitrixPVBusDevice; + +static uint64_t citrix_pv_bus_mmio_read (void *opaque,hwaddr addr, +unsigned size) +{ +fprintf (stderr,"WARNING: read from address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr);
Possibly use the qemu_log() macros or a tracepoint?
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ +return ~(uint64_t )0 ; +} + +static void citrix_pv_bus_mmio_write (void *opaque,hwaddr addr, +uint64_t val,unsigned size) +{ +fprintf (stderr,"WARNING: write to address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); +}
hw/i386/citrix_pv_bus.c line 66
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ +static const MemoryRegionOps citrix_pv_bus_mmio_ops = { + .read = &citrix_pv_bus_mmio_read, + .write = &citrix_pv_bus_mmio_write, + .endianness =DEVICE_NATIVE_ENDIAN , +}; + +static int citrix_pv_bus_init (PCIDevice *pci_dev) +{ +CitrixPVBusDevice *d =DO_UPCAST (CitrixPVBusDevice, dev, pci_dev);
Please don't use DO_UPCAST() with QOM objects. Please introduce a CITRIX_PV_BUS_DEVICE(obj) macro as described above and/or in include/qom/object.h to avoid using the parent field's name in code.
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+uint8_t *pci_conf; +uint64_t size; + + pci_conf = pci_dev->config; +
hw/i386/citrix_pv_bus.c line 81
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+pci_set_word (pci_conf +PCI_COMMAND ,PCI_COMMAND_MEMORY ); +pci_set_byte (pci_conf +PCI_REVISION_ID , d->revision); + +pci_config_set_prog_interface (pci_conf,0 ); + + pci_conf[PCI_INTERRUPT_PIN ] =1 ; + + size = d->pages *TARGET_PAGE_SIZE ; +memory_region_init_io (&d->mmio, &citrix_pv_bus_mmio_ops, d, +"citrix-bus-mmio" , size);
FYI Paolo will shortly merge a series that adds an owner as second argument, i.e. pci_dev here.
hw/i386/citrix_pv_bus.c line 86
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+ +pci_register_bar (pci_dev,1 ,PCI_BASE_ADDRESS_MEM_PREFETCH , + &d->mmio); + +return 0 ;
Otherwise thanks for using pci_dev rather than d->dev, that'll make converting this to QOM realize easier later.
Quoted 15 lines
hw/i386/citrix_pv_bus.c new file +15
-0+} + +static Property citrix_pv_bus_props[] = { +DEFINE_PROP_UINT8 ("revision" , CitrixPVBusDevice, revision,0x01 ), +DEFINE_PROP_UINT32 ("pages" , CitrixPVBusDevice, pages,128 ), +DEFINE_PROP_END_OF_LIST () +}; + +static void citrix_pv_bus_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); + + k->init = citrix_pv_bus_init; + k->vendor_id =PCI_VENDOR_ID_CITRIX ;
hw/i386/citrix_pv_bus.c line 111
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ k->device_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + k->class_id =PCI_CLASS_SYSTEM_OTHER ; + k->subsystem_vendor_id =PCI_VENDOR_ID_CITRIX ; + k->subsystem_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + dc->desc ="Citrix PV Bus" ; + dc->props = citrix_pv_bus_props; +} + +static const TypeInfo citrix_pv_bus_type_info = { + .name ="citrix-pv-bus" ,
As part of the requested cast macro, please use a TYPE_... constant for the string. I would suggest to not let a device type name end in -bus to distinguish from actual QEMU busses (PCIBus, etc.).
What exactly do you intend to do with this device? Are you planning to derive further specialized devices? Having a bar that prints errors on each access surely doesn't seem like the final goal?
Regards,
Andreas
Quoted 24 lines
hw/i386/citrix_pv_bus.c new file +11
-0+ .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(CitrixPVBusDevice), + .class_init = citrix_pv_bus_class_init, +}; + +static void citrix_pv_bus_register_types (void ) +{ +type_register_static (&citrix_pv_bus_type_info); +} + +type_init (citrix_pv_bus_register_types)include/hw/pci/pci_ids.h +3
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853 +#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 80 lines
-----Original Message-----
From: Andreas Färber [mailto:[email protected]]
Sent: 02 July 2013 11:46
To: Paul Durrant
Cc: [email protected]; [email protected]; Paolo Bonzini; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH] Citrix PV Bus deviceAm 02.07.2013 10:39, schrieb Paul Durrant:
Quoted 7 lines
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this maynot be
Quoted 7 lines
desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.
Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122++++++++++++++++++++++++++++++++++++++++++++++
hw/i386/Makefile.objs obj-y += pc.o pc_piix.o pc_q35.o · line 7
Quoted 13 lines
include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +1
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o obj-y += kvmvapic.o +obj-y += citrix_pv_bus.oSo the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my TODO
list. :/Quoted 36 lines
hw/i386/citrix_pv_bus.c new file +30
-0@@ -0,0 +1,122 @@ +/* Copyright (c) Citrix Systems Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, +* with or without modification, are permitted provided +* that the following conditions are met: +* +* * Redistributions of source code must retain the above +* copyright notice, this list of conditions and the +* following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the +* following disclaimer in the documentation and/or other +* materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 35
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+ +#include "hw/hw.h" +#include "hw/pci/pci.h" + +typedef struct _CitrixPVBusDevice {Identifiers starting with underscore are supposedly reserved by POSIX/C99, you can just use the same name as for the typedef.
Andreas,
Thanks for the review. I'll modify that name as you suggest.
Quoted 10 lines
hw/i386/citrix_pv_bus.c line 36
Quoted 1 line
hw/i386/citrix_pv_bus.c new file +1
-0+PCIDevice dev;/*< private >*/ PCIDevice parent_obj; /*< public >*/please. More although still incomplete guidelines at:
Thanks for the pointer.
Quoted 4 lines
Quoted 4 lines
hw/i386/citrix_pv_bus.c new file +4
-0+uint8_t revision; +uint32_t pages; +MemoryRegion mmio; +} CitrixPVBusDevice;
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 46
Quoted 6 lines
hw/i386/citrix_pv_bus.c new file +6
-0+ +static uint64_t citrix_pv_bus_mmio_read (void *opaque,hwaddr addr, +unsigned size) +{ +fprintf (stderr,"WARNING: read from address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr);Possibly use the
qemu_log()macros or a tracepoint?
I'm just looking at tracepoints now. That does seem like a cleaner approach.
Quoted 16 lines
Quoted 16 lines
hw/i386/citrix_pv_bus.c new file +16
-0+ +return ~(uint64_t )0 ; +} + +static void citrix_pv_bus_mmio_write (void *opaque,hwaddr addr, +uint64_t val,unsigned size) +{ +fprintf (stderr,"WARNING: write to address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); +} + +static const MemoryRegionOps citrix_pv_bus_mmio_ops = { + .read = &citrix_pv_bus_mmio_read, + .write = &citrix_pv_bus_mmio_write, + .endianness =DEVICE_NATIVE_ENDIAN , +};
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 66
Quoted 4 lines
hw/i386/citrix_pv_bus.c new file +4
-0+ +static int citrix_pv_bus_init (PCIDevice *pci_dev) +{ +CitrixPVBusDevice *d =DO_UPCAST (CitrixPVBusDevice, dev, pci_dev);Please don't use
DO_UPCAST()with QOM objects. Please introduce aCITRIX_PV_BUS_DEVICE(obj)macro as described above and/or ininclude/qom/object.hto avoid using the parent field's name in code.
Ok.
Quoted 58 lines
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+uint8_t *pci_conf; +uint64_t size; + + pci_conf = pci_dev->config; +hw/i386/citrix_pv_bus.c line 81
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+pci_set_word (pci_conf +PCI_COMMAND ,PCI_COMMAND_MEMORY ); +pci_set_byte (pci_conf +PCI_REVISION_ID , d->revision); + +pci_config_set_prog_interface (pci_conf,0 ); + + pci_conf[PCI_INTERRUPT_PIN ] =1 ; + + size = d->pages *TARGET_PAGE_SIZE ; +memory_region_init_io (&d->mmio, &citrix_pv_bus_mmio_ops, d, +"citrix-bus-mmio" , size);FYI Paolo will shortly merge a series that adds an owner as second argument, i.e.
pci_devhere.hw/i386/citrix_pv_bus.c line 86
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+ +pci_register_bar (pci_dev,1 ,PCI_BASE_ADDRESS_MEM_PREFETCH , + &d->mmio); + +return 0 ;Otherwise thanks for using
pci_devrather thand->dev, that'll make converting this to QOM realize easier later.Quoted 15 lines
hw/i386/citrix_pv_bus.c new file +15
-0+} + +static Property citrix_pv_bus_props[] = { +DEFINE_PROP_UINT8 ("revision" , CitrixPVBusDevice, revision,0x01 ), +DEFINE_PROP_UINT32 ("pages" , CitrixPVBusDevice, pages,128 ), +DEFINE_PROP_END_OF_LIST () +}; + +static void citrix_pv_bus_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); + + k->init = citrix_pv_bus_init; + k->vendor_id =PCI_VENDOR_ID_CITRIX ;hw/i386/citrix_pv_bus.c line 111
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ k->device_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + k->class_id =PCI_CLASS_SYSTEM_OTHER ; + k->subsystem_vendor_id =PCI_VENDOR_ID_CITRIX ; + k->subsystem_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + dc->desc ="Citrix PV Bus" ; + dc->props = citrix_pv_bus_props; +} + +static const TypeInfo citrix_pv_bus_type_info = { + .name ="citrix-pv-bus" ,As part of the requested cast macro, please use a
TYPE_... constant for the string. I would suggest to not let a device type name end in -bus to distinguish from actual QEMU busses (PCIBus, etc.).
Quoted 4 lines
What exactly do you intend to do with this device? Are you planning to derive further specialized devices? Having a bar that prints errors on each access surely doesn't seem like the final goal?
Yes, further devices will be enumerated by the driver that binds to the device in Xen HVM domains. The MMIO region is there to reserve address space for 'special' pages such as the Xen grant table so any access to the region that makes it through to the device emulation code is actually a bug in the guest - hence the warning.
Paul
Quoted 80 lines
-----Original Message-----
From: Andreas Färber [mailto:[email protected]]
Sent: 02 July 2013 11:46
To: Paul Durrant
Cc: [email protected]; [email protected]; Paolo Bonzini; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH] Citrix PV Bus deviceAm 02.07.2013 10:39, schrieb Paul Durrant:
Quoted 7 lines
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this maynot be
Quoted 7 lines
desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.
Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122++++++++++++++++++++++++++++++++++++++++++++++
hw/i386/Makefile.objs obj-y += pc.o pc_piix.o pc_q35.o · line 7
Quoted 13 lines
include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +1
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o obj-y += kvmvapic.o +obj-y += citrix_pv_bus.oSo the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my TODO
list. :/Quoted 36 lines
hw/i386/citrix_pv_bus.c new file +30
-0@@ -0,0 +1,122 @@ +/* Copyright (c) Citrix Systems Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, +* with or without modification, are permitted provided +* that the following conditions are met: +* +* * Redistributions of source code must retain the above +* copyright notice, this list of conditions and the +* following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the +* following disclaimer in the documentation and/or other +* materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 35
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+ +#include "hw/hw.h" +#include "hw/pci/pci.h" + +typedef struct _CitrixPVBusDevice {Identifiers starting with underscore are supposedly reserved by POSIX/C99, you can just use the same name as for the typedef.
Andreas,
Thanks for the review. I'll modify that name as you suggest.
Quoted 10 lines
hw/i386/citrix_pv_bus.c line 36
Quoted 1 line
hw/i386/citrix_pv_bus.c new file +1
-0+PCIDevice dev;/*< private >*/ PCIDevice parent_obj; /*< public >*/please. More although still incomplete guidelines at:
Thanks for the pointer.
Quoted 4 lines
Quoted 4 lines
hw/i386/citrix_pv_bus.c new file +4
-0+uint8_t revision; +uint32_t pages; +MemoryRegion mmio; +} CitrixPVBusDevice;
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 46
Quoted 6 lines
hw/i386/citrix_pv_bus.c new file +6
-0+ +static uint64_t citrix_pv_bus_mmio_read (void *opaque,hwaddr addr, +unsigned size) +{ +fprintf (stderr,"WARNING: read from address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr);Possibly use the
qemu_log()macros or a tracepoint?
I'm just looking at tracepoints now. That does seem like a cleaner approach.
Quoted 16 lines
Quoted 16 lines
hw/i386/citrix_pv_bus.c new file +16
-0+ +return ~(uint64_t )0 ; +} + +static void citrix_pv_bus_mmio_write (void *opaque,hwaddr addr, +uint64_t val,unsigned size) +{ +fprintf (stderr,"WARNING: write to address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); +} + +static const MemoryRegionOps citrix_pv_bus_mmio_ops = { + .read = &citrix_pv_bus_mmio_read, + .write = &citrix_pv_bus_mmio_write, + .endianness =DEVICE_NATIVE_ENDIAN , +};
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 66
Quoted 4 lines
hw/i386/citrix_pv_bus.c new file +4
-0+ +static int citrix_pv_bus_init (PCIDevice *pci_dev) +{ +CitrixPVBusDevice *d =DO_UPCAST (CitrixPVBusDevice, dev, pci_dev);Please don't use
DO_UPCAST()with QOM objects. Please introduce aCITRIX_PV_BUS_DEVICE(obj)macro as described above and/or ininclude/qom/object.hto avoid using the parent field's name in code.
Ok.
Quoted 58 lines
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+uint8_t *pci_conf; +uint64_t size; + + pci_conf = pci_dev->config; +hw/i386/citrix_pv_bus.c line 81
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+pci_set_word (pci_conf +PCI_COMMAND ,PCI_COMMAND_MEMORY ); +pci_set_byte (pci_conf +PCI_REVISION_ID , d->revision); + +pci_config_set_prog_interface (pci_conf,0 ); + + pci_conf[PCI_INTERRUPT_PIN ] =1 ; + + size = d->pages *TARGET_PAGE_SIZE ; +memory_region_init_io (&d->mmio, &citrix_pv_bus_mmio_ops, d, +"citrix-bus-mmio" , size);FYI Paolo will shortly merge a series that adds an owner as second argument, i.e.
pci_devhere.hw/i386/citrix_pv_bus.c line 86
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+ +pci_register_bar (pci_dev,1 ,PCI_BASE_ADDRESS_MEM_PREFETCH , + &d->mmio); + +return 0 ;Otherwise thanks for using
pci_devrather thand->dev, that'll make converting this to QOM realize easier later.Quoted 15 lines
hw/i386/citrix_pv_bus.c new file +15
-0+} + +static Property citrix_pv_bus_props[] = { +DEFINE_PROP_UINT8 ("revision" , CitrixPVBusDevice, revision,0x01 ), +DEFINE_PROP_UINT32 ("pages" , CitrixPVBusDevice, pages,128 ), +DEFINE_PROP_END_OF_LIST () +}; + +static void citrix_pv_bus_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); + + k->init = citrix_pv_bus_init; + k->vendor_id =PCI_VENDOR_ID_CITRIX ;hw/i386/citrix_pv_bus.c line 111
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ k->device_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + k->class_id =PCI_CLASS_SYSTEM_OTHER ; + k->subsystem_vendor_id =PCI_VENDOR_ID_CITRIX ; + k->subsystem_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + dc->desc ="Citrix PV Bus" ; + dc->props = citrix_pv_bus_props; +} + +static const TypeInfo citrix_pv_bus_type_info = { + .name ="citrix-pv-bus" ,As part of the requested cast macro, please use a
TYPE_... constant for the string. I would suggest to not let a device type name end in -bus to distinguish from actual QEMU busses (PCIBus, etc.).
Quoted 4 lines
What exactly do you intend to do with this device? Are you planning to derive further specialized devices? Having a bar that prints errors on each access surely doesn't seem like the final goal?
Yes, further devices will be enumerated by the driver that binds to the device in Xen HVM domains. The MMIO region is there to reserve address space for 'special' pages such as the Xen grant table so any access to the region that makes it through to the device emulation code is actually a bug in the guest - hence the warning.
Paul
Il 02/07/2013 12:45, Andreas Färber ha scritto:
Quoted 26 lines
Am 02.07.2013 10:39, schrieb Paul Durrant:
Quoted 25 lines
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++ include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +0
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
Quoted 6 lines
hw/i386/Makefile.objs obj-y += pc.o pc_piix.o pc_q35.o · line 7
Quoted 2 lines
hw/i386/Makefile.objs +1
-0obj-y += kvmvapic.o +obj-y += citrix_pv_bus.oSo the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my TODO list. :/
Why does it need to be in pages rather than bytes?
Paolo
Quoted 184 lines
Quoted 31 lines
hw/i386/citrix_pv_bus.c new file +25
-0@@ -0,0 +1,122 @@ +/* Copyright (c) Citrix Systems Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, +* with or without modification, are permitted provided +* that the following conditions are met: +* +* * Redistributions of source code must retain the above +* copyright notice, this list of conditions and the +* following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the +* following disclaimer in the documentation and/or other +* materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, hw/i386/citrix_pv_bus.c line 35
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ + +#include "hw/hw.h" +#include "hw/pci/pci.h" + +typedef struct _CitrixPVBusDevice {Identifiers starting with underscore are supposedly reserved by POSIX/C99, you can just use the same name as for the typedef.
hw/i386/citrix_pv_bus.c line 36
Quoted 1 line
hw/i386/citrix_pv_bus.c new file +1
-0+PCIDevice dev;/*< private >*/ PCIDevice parent_obj; /*< public >*/please. More although still incomplete guidelines at:
hw/i386/citrix_pv_bus.c line 46
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+uint8_t revision; +uint32_t pages; +MemoryRegion mmio; +} CitrixPVBusDevice; + +static uint64_t citrix_pv_bus_mmio_read (void *opaque,hwaddr addr, +unsigned size) +{ +fprintf (stderr,"WARNING: read from address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr);Possibly use the
qemu_log()macros or a tracepoint?Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ +return ~(uint64_t )0 ; +} + +static void citrix_pv_bus_mmio_write (void *opaque,hwaddr addr, +uint64_t val,unsigned size) +{ +fprintf (stderr,"WARNING: write to address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); +}hw/i386/citrix_pv_bus.c line 66
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ +static const MemoryRegionOps citrix_pv_bus_mmio_ops = { + .read = &citrix_pv_bus_mmio_read, + .write = &citrix_pv_bus_mmio_write, + .endianness =DEVICE_NATIVE_ENDIAN , +}; + +static int citrix_pv_bus_init (PCIDevice *pci_dev) +{ +CitrixPVBusDevice *d =DO_UPCAST (CitrixPVBusDevice, dev, pci_dev);Please don't use
DO_UPCAST()with QOM objects. Please introduce aCITRIX_PV_BUS_DEVICE(obj)macro as described above and/or ininclude/qom/object.hto avoid using the parent field's name in code.Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+uint8_t *pci_conf; +uint64_t size; + + pci_conf = pci_dev->config; +hw/i386/citrix_pv_bus.c line 81
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+pci_set_word (pci_conf +PCI_COMMAND ,PCI_COMMAND_MEMORY ); +pci_set_byte (pci_conf +PCI_REVISION_ID , d->revision); + +pci_config_set_prog_interface (pci_conf,0 ); + + pci_conf[PCI_INTERRUPT_PIN ] =1 ; + + size = d->pages *TARGET_PAGE_SIZE ; +memory_region_init_io (&d->mmio, &citrix_pv_bus_mmio_ops, d, +"citrix-bus-mmio" , size);FYI Paolo will shortly merge a series that adds an owner as second argument, i.e.
pci_devhere.hw/i386/citrix_pv_bus.c line 86
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+ +pci_register_bar (pci_dev,1 ,PCI_BASE_ADDRESS_MEM_PREFETCH , + &d->mmio); + +return 0 ;Otherwise thanks for using
pci_devrather thand->dev, that'll make converting this to QOM realize easier later.Quoted 15 lines
hw/i386/citrix_pv_bus.c new file +15
-0+} + +static Property citrix_pv_bus_props[] = { +DEFINE_PROP_UINT8 ("revision" , CitrixPVBusDevice, revision,0x01 ), +DEFINE_PROP_UINT32 ("pages" , CitrixPVBusDevice, pages,128 ), +DEFINE_PROP_END_OF_LIST () +}; + +static void citrix_pv_bus_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); + + k->init = citrix_pv_bus_init; + k->vendor_id =PCI_VENDOR_ID_CITRIX ;hw/i386/citrix_pv_bus.c line 111
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ k->device_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + k->class_id =PCI_CLASS_SYSTEM_OTHER ; + k->subsystem_vendor_id =PCI_VENDOR_ID_CITRIX ; + k->subsystem_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + dc->desc ="Citrix PV Bus" ; + dc->props = citrix_pv_bus_props; +} + +static const TypeInfo citrix_pv_bus_type_info = { + .name ="citrix-pv-bus" ,As part of the requested cast macro, please use a
TYPE_... constant for the string. I would suggest to not let a device type name end in -bus to distinguish from actual QEMU busses (PCIBus, etc.).What exactly do you intend to do with this device? Are you planning to derive further specialized devices? Having a bar that prints errors on each access surely doesn't seem like the final goal?
Regards,
AndreasQuoted 24 lines
hw/i386/citrix_pv_bus.c new file +11
-0+ .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(CitrixPVBusDevice), + .class_init = citrix_pv_bus_class_init, +}; + +static void citrix_pv_bus_register_types (void ) +{ +type_register_static (&citrix_pv_bus_type_info); +} + +type_init (citrix_pv_bus_register_types)include/hw/pci/pci_ids.h +3
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853 +#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
Il 02/07/2013 12:45, Andreas Färber ha scritto:
Quoted 26 lines
Am 02.07.2013 10:39, schrieb Paul Durrant:
Quoted 25 lines
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++ include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +0
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
Quoted 6 lines
hw/i386/Makefile.objs obj-y += pc.o pc_piix.o pc_q35.o · line 7
Quoted 2 lines
hw/i386/Makefile.objs +1
-0obj-y += kvmvapic.o +obj-y += citrix_pv_bus.oSo the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my TODO list. :/
Why does it need to be in pages rather than bytes?
Paolo
Quoted 184 lines
Quoted 31 lines
hw/i386/citrix_pv_bus.c new file +25
-0@@ -0,0 +1,122 @@ +/* Copyright (c) Citrix Systems Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, +* with or without modification, are permitted provided +* that the following conditions are met: +* +* * Redistributions of source code must retain the above +* copyright notice, this list of conditions and the +* following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the +* following disclaimer in the documentation and/or other +* materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, hw/i386/citrix_pv_bus.c line 35
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ + +#include "hw/hw.h" +#include "hw/pci/pci.h" + +typedef struct _CitrixPVBusDevice {Identifiers starting with underscore are supposedly reserved by POSIX/C99, you can just use the same name as for the typedef.
hw/i386/citrix_pv_bus.c line 36
Quoted 1 line
hw/i386/citrix_pv_bus.c new file +1
-0+PCIDevice dev;/*< private >*/ PCIDevice parent_obj; /*< public >*/please. More although still incomplete guidelines at:
hw/i386/citrix_pv_bus.c line 46
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+uint8_t revision; +uint32_t pages; +MemoryRegion mmio; +} CitrixPVBusDevice; + +static uint64_t citrix_pv_bus_mmio_read (void *opaque,hwaddr addr, +unsigned size) +{ +fprintf (stderr,"WARNING: read from address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr);Possibly use the
qemu_log()macros or a tracepoint?Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ +return ~(uint64_t )0 ; +} + +static void citrix_pv_bus_mmio_write (void *opaque,hwaddr addr, +uint64_t val,unsigned size) +{ +fprintf (stderr,"WARNING: write to address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); +}hw/i386/citrix_pv_bus.c line 66
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ +static const MemoryRegionOps citrix_pv_bus_mmio_ops = { + .read = &citrix_pv_bus_mmio_read, + .write = &citrix_pv_bus_mmio_write, + .endianness =DEVICE_NATIVE_ENDIAN , +}; + +static int citrix_pv_bus_init (PCIDevice *pci_dev) +{ +CitrixPVBusDevice *d =DO_UPCAST (CitrixPVBusDevice, dev, pci_dev);Please don't use
DO_UPCAST()with QOM objects. Please introduce aCITRIX_PV_BUS_DEVICE(obj)macro as described above and/or ininclude/qom/object.hto avoid using the parent field's name in code.Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+uint8_t *pci_conf; +uint64_t size; + + pci_conf = pci_dev->config; +hw/i386/citrix_pv_bus.c line 81
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+pci_set_word (pci_conf +PCI_COMMAND ,PCI_COMMAND_MEMORY ); +pci_set_byte (pci_conf +PCI_REVISION_ID , d->revision); + +pci_config_set_prog_interface (pci_conf,0 ); + + pci_conf[PCI_INTERRUPT_PIN ] =1 ; + + size = d->pages *TARGET_PAGE_SIZE ; +memory_region_init_io (&d->mmio, &citrix_pv_bus_mmio_ops, d, +"citrix-bus-mmio" , size);FYI Paolo will shortly merge a series that adds an owner as second argument, i.e.
pci_devhere.hw/i386/citrix_pv_bus.c line 86
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+ +pci_register_bar (pci_dev,1 ,PCI_BASE_ADDRESS_MEM_PREFETCH , + &d->mmio); + +return 0 ;Otherwise thanks for using
pci_devrather thand->dev, that'll make converting this to QOM realize easier later.Quoted 15 lines
hw/i386/citrix_pv_bus.c new file +15
-0+} + +static Property citrix_pv_bus_props[] = { +DEFINE_PROP_UINT8 ("revision" , CitrixPVBusDevice, revision,0x01 ), +DEFINE_PROP_UINT32 ("pages" , CitrixPVBusDevice, pages,128 ), +DEFINE_PROP_END_OF_LIST () +}; + +static void citrix_pv_bus_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); + + k->init = citrix_pv_bus_init; + k->vendor_id =PCI_VENDOR_ID_CITRIX ;hw/i386/citrix_pv_bus.c line 111
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ k->device_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + k->class_id =PCI_CLASS_SYSTEM_OTHER ; + k->subsystem_vendor_id =PCI_VENDOR_ID_CITRIX ; + k->subsystem_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + dc->desc ="Citrix PV Bus" ; + dc->props = citrix_pv_bus_props; +} + +static const TypeInfo citrix_pv_bus_type_info = { + .name ="citrix-pv-bus" ,As part of the requested cast macro, please use a
TYPE_... constant for the string. I would suggest to not let a device type name end in -bus to distinguish from actual QEMU busses (PCIBus, etc.).What exactly do you intend to do with this device? Are you planning to derive further specialized devices? Having a bar that prints errors on each access surely doesn't seem like the final goal?
Regards,
AndreasQuoted 24 lines
hw/i386/citrix_pv_bus.c new file +11
-0+ .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(CitrixPVBusDevice), + .class_init = citrix_pv_bus_class_init, +}; + +static void citrix_pv_bus_register_types (void ) +{ +type_register_static (&citrix_pv_bus_type_info); +} + +type_init (citrix_pv_bus_register_types)include/hw/pci/pci_ids.h +3
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853 +#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif
Quoted 44 lines
-----Original Message-----
From: Paolo Bonzini [mailto:[email protected]]
Sent: 02 July 2013 11:54
To: Andreas Färber
Cc: Paul Durrant; [email protected]; [email protected]; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH] Citrix PV Bus deviceIl 02/07/2013 12:45, Andreas Färber ha scritto:
Quoted 4 lines
Am 02.07.2013 10:39, schrieb Paul Durrant:
Quoted 3 lines
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available onWindows
Quoted 2 lines
Quoted 2 lines
Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests
for
Quoted 2 lines
Quoted 2 lines
a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may
not be
Quoted 7 lines
Quoted 7 lines
desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.
Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122++++++++++++++++++++++++++++++++++++++++++++++
Quoted 11 lines
Quoted 11 lines
include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +0
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.oQuoted 5 lines
hw/i386/Makefile.objs obj-y += pc.o pc_piix.o pc_q35.o · line 7
Quoted 2 lines
hw/i386/Makefile.objs +1
-0obj-y += kvmvapic.o +obj-y += citrix_pv_bus.oSo the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my
Quoted 5 lines
TODO
Quoted 1 line
list. :/
Why does it need to be in pages rather than bytes?
It doesn't necessarily need to be in pages; it's just a more convenient quantity than bytes. Since it needs to be a power of 2 I could perhaps use an 'order' parameter instead?
Paul
Quoted 44 lines
-----Original Message-----
From: Paolo Bonzini [mailto:[email protected]]
Sent: 02 July 2013 11:54
To: Andreas Färber
Cc: Paul Durrant; [email protected]; [email protected]; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH] Citrix PV Bus deviceIl 02/07/2013 12:45, Andreas Färber ha scritto:
Quoted 4 lines
Am 02.07.2013 10:39, schrieb Paul Durrant:
Quoted 3 lines
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available onWindows
Quoted 2 lines
Quoted 2 lines
Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests
for
Quoted 2 lines
Quoted 2 lines
a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may
not be
Quoted 7 lines
Quoted 7 lines
desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.
Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122++++++++++++++++++++++++++++++++++++++++++++++
Quoted 11 lines
Quoted 11 lines
include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +0
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.oQuoted 5 lines
hw/i386/Makefile.objs obj-y += pc.o pc_piix.o pc_q35.o · line 7
Quoted 2 lines
hw/i386/Makefile.objs +1
-0obj-y += kvmvapic.o +obj-y += citrix_pv_bus.oSo the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my
Quoted 5 lines
TODO
Quoted 1 line
list. :/
Why does it need to be in pages rather than bytes?
It doesn't necessarily need to be in pages; it's just a more convenient quantity than bytes. Since it needs to be a power of 2 I could perhaps use an 'order' parameter instead?
Paul
Il 02/07/2013 12:57, Paul Durrant ha scritto:
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
So the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my TODO list. :/Why does it need to be in pages rather than bytes?
It doesn't necessarily need to be in pages; it's just a more convenient quantity than bytes. Since it needs to be a power of 2 I could perhaps use an 'order' parameter instead?
I would just use bytes, the power-of-2 requirement can be checked in the init function (actually it would just be caught by pci_register_bar).
Paolo
Il 02/07/2013 12:57, Paul Durrant ha scritto:
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
So the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my TODO list. :/Why does it need to be in pages rather than bytes?
It doesn't necessarily need to be in pages; it's just a more convenient quantity than bytes. Since it needs to be a power of 2 I could perhaps use an 'order' parameter instead?
I would just use bytes, the power-of-2 requirement can be checked in the init function (actually it would just be caught by pci_register_bar).
Paolo
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Paolo Bonzini [mailto:[email protected]]Quoted 3 lines
So the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my TODO list. :/
We probably don't, because it generally doesn't mean what you think it does. It's the smallest possible page size the guest CPU supports, which may not be the same as the actual page size the guest OS is using.
Quoted 4 lines
Quoted 1 line
Why does it need to be in pages rather than bytes?
It doesn't necessarily need to be in pages; it's just a more convenient quantity than bytes.
It isn't really more convienient, because the guest would have to tell QEMU what the page size was. (I'm told that virtio is planning to move to a simple "just use a byte count" approach.)
thanks
-- PMM
Quoted 17 lines · Peter Maydell
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Paolo Bonzini [mailto:[email protected]]Quoted 3 lines
So the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my TODO list. :/We probably don't, because it generally doesn't mean what you think it does. It's the smallest possible page size the guest CPU supports, which may not be the same as the actual page size the guest OS is using.
Quoted 4 lines
Quoted 1 line
Why does it need to be in pages rather than bytes?
It doesn't necessarily need to be in pages; it's just a more convenient quantity than bytes.
Quoted 6 lines
It isn't really more convienient, because the guest would have to tell QEMU what the page size was. (I'm told that virtio is planning to move to a simple "just use a byte count" approach.)
thanks
-- PMM
Yes, sometime in a distant future ...
Quoted 17 lines · Peter Maydell
Quoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Paolo Bonzini [mailto:[email protected]]Quoted 3 lines
So the reason to place the device here is
TARGET_PAGE_SIZE... We really need a way to access that value from common code, somewhere down my TODO list. :/We probably don't, because it generally doesn't mean what you think it does. It's the smallest possible page size the guest CPU supports, which may not be the same as the actual page size the guest OS is using.
Quoted 4 lines
Quoted 1 line
Why does it need to be in pages rather than bytes?
It doesn't necessarily need to be in pages; it's just a more convenient quantity than bytes.
Quoted 6 lines
It isn't really more convienient, because the guest would have to tell QEMU what the page size was. (I'm told that virtio is planning to move to a simple "just use a byte count" approach.)
thanks
-- PMM
Yes, sometime in a distant future ...
Quoted 33 lines · Paul Durrant
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++ include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +1
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o obj-y += kvmvapic.o +obj-y += citrix_pv_bus.ohw/i386/citrix_pv_bus.c new file +0
-0
hw/i386/citrix_pv_bus.c line 2
Quoted 2 lines
hw/i386/citrix_pv_bus.c new file +2
-0@@ -0,0 +1,122 @@ +/* Copyright (c) Citrix Systems Inc. +* All rights reserved.
All rights reserved contradicts the grant of rights below. Obviously the later one is the one that wins but having the above statement is a little silly IMHO.
Quoted 23 lines
hw/i386/citrix_pv_bus.c new file +23
-0+* +* Redistribution and use in source and binary forms, +* with or without modification, are permitted provided +* that the following conditions are met: +* +* * Redistributions of source code must retain the above +* copyright notice, this list of conditions and the +* following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the +* following disclaimer in the documentation and/or other +* materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
hw/i386/citrix_pv_bus.c line 35
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ + +#include "hw/hw.h" +#include "hw/pci/pci.h" + +typedef struct _CitrixPVBusDevice {
Drop the '_' please.
Quoted 11 lines
hw/i386/citrix_pv_bus.c new file +11
-0+PCIDevice dev; +uint8_t revision; +uint32_t pages; +MemoryRegion mmio; +} CitrixPVBusDevice; + +static uint64_t citrix_pv_bus_mmio_read (void *opaque,hwaddr addr, +unsigned size) +{ +fprintf (stderr,"WARNING: read from address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr);
hw/i386/citrix_pv_bus.c line 56
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ +return ~(uint64_t )0 ; +} + +static void citrix_pv_bus_mmio_write (void *opaque,hwaddr addr, +uint64_t val,unsigned size) +{ +fprintf (stderr,"WARNING: write to address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); +}
Don't let guests trigger unconditional output to stdio. If a management tool logs stdio (libvirt does for instance), this can allow a guest to mount a DoS attack on the host.
hw/i386/citrix_pv_bus.c line 62
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+static const MemoryRegionOps citrix_pv_bus_mmio_ops = { + .read = &citrix_pv_bus_mmio_read, + .write = &citrix_pv_bus_mmio_write, + .endianness =DEVICE_NATIVE_ENDIAN , +};
Please use DEVICE_LITTLE_ENDIAN. Native endian shouldn't exist and is there to deal with a few edge cases only.
Quoted 8 lines
hw/i386/citrix_pv_bus.c new file +8
-0+static int citrix_pv_bus_init (PCIDevice *pci_dev) +{ +CitrixPVBusDevice *d =DO_UPCAST (CitrixPVBusDevice, dev, pci_dev); +uint8_t *pci_conf; +uint64_t size; + + pci_conf = pci_dev->config; +
hw/i386/citrix_pv_bus.c line 81
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+pci_set_word (pci_conf +PCI_COMMAND ,PCI_COMMAND_MEMORY ); +pci_set_byte (pci_conf +PCI_REVISION_ID , d->revision); + +pci_config_set_prog_interface (pci_conf,0 ); + + pci_conf[PCI_INTERRUPT_PIN ] =1 ; + + size = d->pages *TARGET_PAGE_SIZE ; +memory_region_init_io (&d->mmio, &citrix_pv_bus_mmio_ops, d, +"citrix-bus-mmio" , size);
:-/
This is a really bad interface. Does this device support anything other than x86?
On PPC, for instance, it's pretty normal to build a kernel with PAGE_SIZE=4k, 16k, 64k, etc.
The page size that the kernel was compiled is a property of the kernel, not anything architectural. So what QEMU treats as TARGET_PAGE_SIZE does not necessarily match the guest's PAGE_SIZE.
If this device only works on x86 today, you should fix the ABI at a PAGE_SIZE=4096 or something like that.
Even hard coding 4096 here in QEMU would be better than using TARGET_PAGE_SIZE.
Regards,
Anthony Liguori
Quoted 55 lines
hw/i386/citrix_pv_bus.c new file +41
-0+ +pci_register_bar (pci_dev,1 ,PCI_BASE_ADDRESS_MEM_PREFETCH , + &d->mmio); + +return 0 ; +} + +static Property citrix_pv_bus_props[] = { +DEFINE_PROP_UINT8 ("revision" , CitrixPVBusDevice, revision,0x01 ), +DEFINE_PROP_UINT32 ("pages" , CitrixPVBusDevice, pages,128 ), +DEFINE_PROP_END_OF_LIST () +}; + +static void citrix_pv_bus_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); + + k->init = citrix_pv_bus_init; + k->vendor_id =PCI_VENDOR_ID_CITRIX ; + k->device_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + k->class_id =PCI_CLASS_SYSTEM_OTHER ; + k->subsystem_vendor_id =PCI_VENDOR_ID_CITRIX ; + k->subsystem_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + dc->desc ="Citrix PV Bus" ; + dc->props = citrix_pv_bus_props; +} + +static const TypeInfo citrix_pv_bus_type_info = { + .name ="citrix-pv-bus" , + .parent =TYPE_PCI_DEVICE , + .instance_size =sizeof (CitrixPVBusDevice), + .class_init = citrix_pv_bus_class_init, +}; + +static void citrix_pv_bus_register_types (void ) +{ +type_register_static (&citrix_pv_bus_type_info); +} + +type_init (citrix_pv_bus_register_types)include/hw/pci/pci_ids.h +3
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853 +#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif Signature · 1 line
1.7.10.4
Quoted 33 lines · Paul Durrant
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this may not be desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++ include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +1
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o obj-y += kvmvapic.o +obj-y += citrix_pv_bus.ohw/i386/citrix_pv_bus.c new file +0
-0
hw/i386/citrix_pv_bus.c line 2
Quoted 2 lines
hw/i386/citrix_pv_bus.c new file +2
-0@@ -0,0 +1,122 @@ +/* Copyright (c) Citrix Systems Inc. +* All rights reserved.
All rights reserved contradicts the grant of rights below. Obviously the later one is the one that wins but having the above statement is a little silly IMHO.
Quoted 23 lines
hw/i386/citrix_pv_bus.c new file +23
-0+* +* Redistribution and use in source and binary forms, +* with or without modification, are permitted provided +* that the following conditions are met: +* +* * Redistributions of source code must retain the above +* copyright notice, this list of conditions and the +* following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the +* following disclaimer in the documentation and/or other +* materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
hw/i386/citrix_pv_bus.c line 35
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ + +#include "hw/hw.h" +#include "hw/pci/pci.h" + +typedef struct _CitrixPVBusDevice {
Drop the '_' please.
Quoted 11 lines
hw/i386/citrix_pv_bus.c new file +11
-0+PCIDevice dev; +uint8_t revision; +uint32_t pages; +MemoryRegion mmio; +} CitrixPVBusDevice; + +static uint64_t citrix_pv_bus_mmio_read (void *opaque,hwaddr addr, +unsigned size) +{ +fprintf (stderr,"WARNING: read from address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr);
hw/i386/citrix_pv_bus.c line 56
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+ +return ~(uint64_t )0 ; +} + +static void citrix_pv_bus_mmio_write (void *opaque,hwaddr addr, +uint64_t val,unsigned size) +{ +fprintf (stderr,"WARNING: write to address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); +}
Don't let guests trigger unconditional output to stdio. If a management tool logs stdio (libvirt does for instance), this can allow a guest to mount a DoS attack on the host.
hw/i386/citrix_pv_bus.c line 62
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+static const MemoryRegionOps citrix_pv_bus_mmio_ops = { + .read = &citrix_pv_bus_mmio_read, + .write = &citrix_pv_bus_mmio_write, + .endianness =DEVICE_NATIVE_ENDIAN , +};
Please use DEVICE_LITTLE_ENDIAN. Native endian shouldn't exist and is there to deal with a few edge cases only.
Quoted 8 lines
hw/i386/citrix_pv_bus.c new file +8
-0+static int citrix_pv_bus_init (PCIDevice *pci_dev) +{ +CitrixPVBusDevice *d =DO_UPCAST (CitrixPVBusDevice, dev, pci_dev); +uint8_t *pci_conf; +uint64_t size; + + pci_conf = pci_dev->config; +
hw/i386/citrix_pv_bus.c line 81
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+pci_set_word (pci_conf +PCI_COMMAND ,PCI_COMMAND_MEMORY ); +pci_set_byte (pci_conf +PCI_REVISION_ID , d->revision); + +pci_config_set_prog_interface (pci_conf,0 ); + + pci_conf[PCI_INTERRUPT_PIN ] =1 ; + + size = d->pages *TARGET_PAGE_SIZE ; +memory_region_init_io (&d->mmio, &citrix_pv_bus_mmio_ops, d, +"citrix-bus-mmio" , size);
:-/
This is a really bad interface. Does this device support anything other than x86?
On PPC, for instance, it's pretty normal to build a kernel with PAGE_SIZE=4k, 16k, 64k, etc.
The page size that the kernel was compiled is a property of the kernel, not anything architectural. So what QEMU treats as TARGET_PAGE_SIZE does not necessarily match the guest's PAGE_SIZE.
If this device only works on x86 today, you should fix the ABI at a PAGE_SIZE=4096 or something like that.
Even hard coding 4096 here in QEMU would be better than using TARGET_PAGE_SIZE.
Regards,
Anthony Liguori
Quoted 55 lines
hw/i386/citrix_pv_bus.c new file +41
-0+ +pci_register_bar (pci_dev,1 ,PCI_BASE_ADDRESS_MEM_PREFETCH , + &d->mmio); + +return 0 ; +} + +static Property citrix_pv_bus_props[] = { +DEFINE_PROP_UINT8 ("revision" , CitrixPVBusDevice, revision,0x01 ), +DEFINE_PROP_UINT32 ("pages" , CitrixPVBusDevice, pages,128 ), +DEFINE_PROP_END_OF_LIST () +}; + +static void citrix_pv_bus_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); + + k->init = citrix_pv_bus_init; + k->vendor_id =PCI_VENDOR_ID_CITRIX ; + k->device_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + k->class_id =PCI_CLASS_SYSTEM_OTHER ; + k->subsystem_vendor_id =PCI_VENDOR_ID_CITRIX ; + k->subsystem_id =PCI_DEVICE_ID_CITRIX_PV_BUS ; + dc->desc ="Citrix PV Bus" ; + dc->props = citrix_pv_bus_props; +} + +static const TypeInfo citrix_pv_bus_type_info = { + .name ="citrix-pv-bus" , + .parent =TYPE_PCI_DEVICE , + .instance_size =sizeof (CitrixPVBusDevice), + .class_init = citrix_pv_bus_class_init, +}; + +static void citrix_pv_bus_register_types (void ) +{ +type_register_static (&citrix_pv_bus_type_info); +} + +type_init (citrix_pv_bus_register_types)include/hw/pci/pci_ids.h +3
-0@@ -151,4 +151,7 @@#define PCI_VENDOR_ID_TEWS 0x1498#define PCI_DEVICE_ID_TEWS_TPCI200 0x30C8 +#define PCI_VENDOR_ID_CITRIX 0x5853 +#define PCI_DEVICE_ID_CITRIX_PV_BUS 0x0002 +#endif Signature · 1 line
1.7.10.4
Quoted 36 lines
-----Original Message-----
From: Anthony Liguori [mailto:[email protected]]
Sent: 02 July 2013 15:43
To: Paul Durrant; [email protected]; [email protected]
Cc: Paul Durrant
Subject: Re: [Qemu-devel] [PATCH] Citrix PV Bus deviceQuoted 7 lines · Paul Durrant
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this maynot be
Quoted 7 lines
desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.
Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122++++++++++++++++++++++++++++++++++++++++++++++
Quoted 11 lines
include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +0
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
Quoted 15 lines
hw/i386/citrix_pv_bus.c line 2
Quoted 10 lines
hw/i386/Makefile.objs +1
-0obj-y += kvmvapic.o +obj-y += citrix_pv_bus.ohw/i386/citrix_pv_bus.c new file +2
-0@@ -0,0 +1,122 @@ +/* Copyright (c) Citrix Systems Inc. +* All rights reserved. All rights reserved contradicts the grant of rights below. Obviously the later one is the one that wins but having the above statement is a little silly IMHO.
I lifted the license verbatim from the BSD 2-clause template at http://opensource.org/licenses/BSD-2-Clause
Quoted 27 lines
Quoted 27 lines
hw/i386/citrix_pv_bus.c new file +27
-0+* +* Redistribution and use in source and binary forms, +* with or without modification, are permitted provided +* that the following conditions are met: +* +* * Redistributions of source code must retain the above +* copyright notice, this list of conditions and the +* following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the +* following disclaimer in the documentation and/or other +* materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE.
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 35
Quoted 6 lines
hw/i386/citrix_pv_bus.c new file +6
-0+*/ + +#include "hw/hw.h" +#include "hw/pci/pci.h" + +typedef struct _CitrixPVBusDevice {Drop the '_' please.
Done in the latest patch.
Quoted 17 lines
Quoted 17 lines
hw/i386/citrix_pv_bus.c new file +17
-0+PCIDevice dev; +uint8_t revision; +uint32_t pages; +MemoryRegion mmio; +} CitrixPVBusDevice; + +static uint64_t citrix_pv_bus_mmio_read (void *opaque,hwaddr addr, +unsigned size) +{ +fprintf (stderr,"WARNING: read from address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); + +return ~(uint64_t )0 ; +} + +static void citrix_pv_bus_mmio_write (void *opaque,hwaddr addr, +uint64_t val,unsigned size)
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 56
Quoted 4 lines
hw/i386/citrix_pv_bus.c new file +4
-0+{ +fprintf (stderr,"WARNING: write to address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); +}Don't let guests trigger unconditional output to stdio. If a management tool logs stdio (libvirt does for instance), this can allow a guest to mount a DoS attack on the host.
I went for trace points in the latest patch.
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 62
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+static const MemoryRegionOps citrix_pv_bus_mmio_ops = { + .read = &citrix_pv_bus_mmio_read, + .write = &citrix_pv_bus_mmio_write, + .endianness =DEVICE_NATIVE_ENDIAN , +};Please use
DEVICE_LITTLE_ENDIAN. Native endian shouldn't exist and is there to deal with a few edge cases only.
Ok. I'll fix and re-post.
Quoted 31 lines
Quoted 8 lines
hw/i386/citrix_pv_bus.c new file +8
-0+static int citrix_pv_bus_init (PCIDevice *pci_dev) +{ +CitrixPVBusDevice *d =DO_UPCAST (CitrixPVBusDevice, dev, pci_dev); +uint8_t *pci_conf; +uint64_t size; + + pci_conf = pci_dev->config; +hw/i386/citrix_pv_bus.c line 81
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+pci_set_word (pci_conf +PCI_COMMAND ,PCI_COMMAND_MEMORY ); +pci_set_byte (pci_conf +PCI_REVISION_ID , d->revision); + +pci_config_set_prog_interface (pci_conf,0 ); + + pci_conf[PCI_INTERRUPT_PIN ] =1 ; + + size = d->pages *TARGET_PAGE_SIZE ; +memory_region_init_io (&d->mmio, &citrix_pv_bus_mmio_ops, d, +"citrix-bus-mmio" , size);:-/
This is a really bad interface. Does this device support anything other than x86?
On PPC, for instance, it's pretty normal to build a kernel with PAGE_SIZE=4k, 16k, 64k, etc.
The page size that the kernel was compiled is a property of the kernel, not anything architectural. So what QEMU treats as
TARGET_PAGE_SIZEdoes not necessarily match the guest'sPAGE_SIZE.
Quoted 6 lines
If this device only works on x86 today, you should fix the ABI at a PAGE_SIZE=4096 or something like that.
Even hard coding 4096 here in QEMU would be better than using
TARGET_PAGE_SIZE.
I opted for a size parameter in the newer patch instead. I'll mark the next post v3 for clarity.
Paul
Quoted 36 lines
-----Original Message-----
From: Anthony Liguori [mailto:[email protected]]
Sent: 02 July 2013 15:43
To: Paul Durrant; [email protected]; [email protected]
Cc: Paul Durrant
Subject: Re: [Qemu-devel] [PATCH] Citrix PV Bus deviceQuoted 7 lines · Paul Durrant
This patch introduces a new PCI device which will act as the binding point for Citrix branded PV drivers for Xen.
The intention is that Citrix Windows PV drivers will be available on Windows Update and thus using the existing Xen platform PCI device as an anchor point is not desirable as that device has been ubiquitous in HVM guests for a long time and thus existing HVM guests running Windows would start automatically downloading drivers from Windows Update when this maynot be
Quoted 7 lines
desired by either the host or guest admin. This device therefore acts as an opt-in for those wishing to deploy Citrix PV drivers.
Signed-off-by Paul Durrant <[email protected]>--- hw/i386/Makefile.objs | 1 + hw/i386/citrix_pv_bus.c | 122++++++++++++++++++++++++++++++++++++++++++++++
Quoted 11 lines
include/hw/pci/pci_ids.h | 3 ++ 3 files changed, 126 insertions(+) create mode 100644 hw/i386/citrix_pv_bus.chw/i386/Makefile.objs +0
-0@@ -4,3 +4,4 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
Quoted 15 lines
hw/i386/citrix_pv_bus.c line 2
Quoted 10 lines
hw/i386/Makefile.objs +1
-0obj-y += kvmvapic.o +obj-y += citrix_pv_bus.ohw/i386/citrix_pv_bus.c new file +2
-0@@ -0,0 +1,122 @@ +/* Copyright (c) Citrix Systems Inc. +* All rights reserved. All rights reserved contradicts the grant of rights below. Obviously the later one is the one that wins but having the above statement is a little silly IMHO.
I lifted the license verbatim from the BSD 2-clause template at http://opensource.org/licenses/BSD-2-Clause
Quoted 27 lines
Quoted 27 lines
hw/i386/citrix_pv_bus.c new file +27
-0+* +* Redistribution and use in source and binary forms, +* with or without modification, are permitted provided +* that the following conditions are met: +* +* * Redistributions of source code must retain the above +* copyright notice, this list of conditions and the +* following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the +* following disclaimer in the documentation and/or other +* materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE.
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 35
Quoted 6 lines
hw/i386/citrix_pv_bus.c new file +6
-0+*/ + +#include "hw/hw.h" +#include "hw/pci/pci.h" + +typedef struct _CitrixPVBusDevice {Drop the '_' please.
Done in the latest patch.
Quoted 17 lines
Quoted 17 lines
hw/i386/citrix_pv_bus.c new file +17
-0+PCIDevice dev; +uint8_t revision; +uint32_t pages; +MemoryRegion mmio; +} CitrixPVBusDevice; + +static uint64_t citrix_pv_bus_mmio_read (void *opaque,hwaddr addr, +unsigned size) +{ +fprintf (stderr,"WARNING: read from address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); + +return ~(uint64_t )0 ; +} + +static void citrix_pv_bus_mmio_write (void *opaque,hwaddr addr, +uint64_t val,unsigned size)
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 56
Quoted 4 lines
hw/i386/citrix_pv_bus.c new file +4
-0+{ +fprintf (stderr,"WARNING: write to address 0x" TARGET_FMT_plx +" in Citrix PV Bus MMIO BAR\n" , addr); +}Don't let guests trigger unconditional output to stdio. If a management tool logs stdio (libvirt does for instance), this can allow a guest to mount a DoS attack on the host.
I went for trace points in the latest patch.
Quoted 9 lines
hw/i386/citrix_pv_bus.c line 62
Quoted 5 lines
hw/i386/citrix_pv_bus.c new file +5
-0+static const MemoryRegionOps citrix_pv_bus_mmio_ops = { + .read = &citrix_pv_bus_mmio_read, + .write = &citrix_pv_bus_mmio_write, + .endianness =DEVICE_NATIVE_ENDIAN , +};Please use
DEVICE_LITTLE_ENDIAN. Native endian shouldn't exist and is there to deal with a few edge cases only.
Ok. I'll fix and re-post.
Quoted 31 lines
Quoted 8 lines
hw/i386/citrix_pv_bus.c new file +8
-0+static int citrix_pv_bus_init (PCIDevice *pci_dev) +{ +CitrixPVBusDevice *d =DO_UPCAST (CitrixPVBusDevice, dev, pci_dev); +uint8_t *pci_conf; +uint64_t size; + + pci_conf = pci_dev->config; +hw/i386/citrix_pv_bus.c line 81
Quoted 10 lines
hw/i386/citrix_pv_bus.c new file +10
-0+pci_set_word (pci_conf +PCI_COMMAND ,PCI_COMMAND_MEMORY ); +pci_set_byte (pci_conf +PCI_REVISION_ID , d->revision); + +pci_config_set_prog_interface (pci_conf,0 ); + + pci_conf[PCI_INTERRUPT_PIN ] =1 ; + + size = d->pages *TARGET_PAGE_SIZE ; +memory_region_init_io (&d->mmio, &citrix_pv_bus_mmio_ops, d, +"citrix-bus-mmio" , size);:-/
This is a really bad interface. Does this device support anything other than x86?
On PPC, for instance, it's pretty normal to build a kernel with PAGE_SIZE=4k, 16k, 64k, etc.
The page size that the kernel was compiled is a property of the kernel, not anything architectural. So what QEMU treats as
TARGET_PAGE_SIZEdoes not necessarily match the guest'sPAGE_SIZE.
Quoted 6 lines
If this device only works on x86 today, you should fix the ABI at a PAGE_SIZE=4096 or something like that.
Even hard coding 4096 here in QEMU would be better than using
TARGET_PAGE_SIZE.
I opted for a size parameter in the newer patch instead. I'll mark the next post v3 for clarity.
Paul