Stefano Stabellini
2009-Nov-03 11:30 UTC
[Xen-devel] [PATCH] xen passthrough: fix recent regressions
Hi all, this patch fixes the recent regressions pointed out by Dexuan, keeping pci passthrough working with stubdom too. In particular calling device_create when pci_state == ''Initialising'' is a mistake because the state is always Initialising when attaching a devicem while device_create has too be called only when the pci backend is missing. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- diff -r 47136dbb972d tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Oct 28 10:59:55 2009 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Nov 03 11:06:16 2009 +0000 @@ -597,6 +597,7 @@ return devid = ''0'' + first = True dev_info = self._getDeviceInfo_pci(devid) if dev_info is None: return @@ -619,7 +620,8 @@ head_dev = dev.pop() dev_sxp = pci_convert_dict_to_sxp(head_dev, ''Initialising'', ''Booting'') - self.pci_device_configure(dev_sxp) + self.pci_device_configure(dev_sxp, first_dev = first) + first = False # That is all for single-function virtual devices if len(dev) == 0: @@ -829,7 +831,7 @@ return self.getDeviceController(dev_type).sxpr(devid) - def pci_device_configure(self, dev_sxp, devid = 0): + def pci_device_configure(self, dev_sxp, devid = 0, first_dev = False): """Configure an existing pci device. @param dev_sxp: device configuration @@ -859,13 +861,13 @@ dev = dev_config[''devs''][0] stubdomid = self.getStubdomDomid() - if stubdomid is not None : - from xen.xend import XendDomain - XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) - # Do HVM specific processing if self.info.is_hvm(): + from xen.xend import XendDomain if pci_state == ''Initialising'': + if stubdomid is not None : + XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) + # HVM PCI device attachment if pci_sub_state == ''Booting'': vdevfn = self.hvm_pci_device_insert(dev_config) @@ -896,6 +898,8 @@ # same vslot. if (PCI_FUNC(int(new_dev[''vdevfn''], 16)) == 0): self.hvm_destroyPCIDevice(new_dev) + if stubdomid is not None : + XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) # Update vdevfn dev[''vdevfn''] = new_dev[''vdevfn''] for n in sxp.children(pci_dev): @@ -908,15 +912,22 @@ self.pci_device_check_attachability(dev) # If pci platform does not exist, create and exit. - if pci_state == ''Initialising'' : + if existing_dev_info is None : self.device_create(dev_sxp) + return True + + if first_dev is True : + existing_dev_uuid = sxp.child_value(existing_dev_info, ''uuid'') + existing_pci_conf = self.info[''devices''][existing_dev_uuid][1] + devid = self._createDevice(''pci'', existing_pci_conf) + self.info[''devices''][existing_dev_uuid][1][''devid''] = devid return True if self.domid is not None: # use DevController.reconfigureDevice to change device config dev_control = self.getDeviceController(dev_class) dev_uuid = dev_control.reconfigureDevice(devid, dev_config) - if not self.info.is_hvm(): + if not self.info.is_hvm() and not self.info.is_stubdom(): # in PV case, wait until backend state becomes connected. dev_control.waitForDevice_reconfigure(devid) num_devs = dev_control.cleanupDevice(devid) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Simon Horman
2009-Nov-03 21:39 UTC
Re: [Xen-devel] [PATCH] xen passthrough: fix recent regressions
On Tue, Nov 03, 2009 at 11:30:38AM +0000, Stefano Stabellini wrote:> Hi all, > this patch fixes the recent regressions pointed out by Dexuan, keeping > pci passthrough working with stubdom too. > In particular calling device_create when pci_state == ''Initialising'' is > a mistake because the state is always Initialising when attaching a > devicem while device_create has too be called only when the pci backend > is missing. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > > --- > > > diff -r 47136dbb972d tools/python/xen/xend/XendDomainInfo.py > --- a/tools/python/xen/xend/XendDomainInfo.py Wed Oct 28 10:59:55 2009 +0000 > +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Nov 03 11:06:16 2009 +0000 > @@ -597,6 +597,7 @@ > return > > devid = ''0'' > + first = True > dev_info = self._getDeviceInfo_pci(devid) > if dev_info is None: > return > @@ -619,7 +620,8 @@ > head_dev = dev.pop() > dev_sxp = pci_convert_dict_to_sxp(head_dev, ''Initialising'', > ''Booting'') > - self.pci_device_configure(dev_sxp) > + self.pci_device_configure(dev_sxp, first_dev = first) > + first = False > > # That is all for single-function virtual devices > if len(dev) == 0: > @@ -829,7 +831,7 @@ > return self.getDeviceController(dev_type).sxpr(devid) > > > - def pci_device_configure(self, dev_sxp, devid = 0): > + def pci_device_configure(self, dev_sxp, devid = 0, first_dev = False): > """Configure an existing pci device. > > @param dev_sxp: device configuration > @@ -859,13 +861,13 @@ > dev = dev_config[''devs''][0] > > stubdomid = self.getStubdomDomid() > - if stubdomid is not None : > - from xen.xend import XendDomain > - XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) > - > # Do HVM specific processing > if self.info.is_hvm(): > + from xen.xend import XendDomainCould this import go at the top of the .py file?> if pci_state == ''Initialising'': > + if stubdomid is not None :Could the above two lines be the following? It seems a bit clearer to me. if pci_state == ''Initialising'' and stubdomid is not None:> + XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) > + > # HVM PCI device attachment > if pci_sub_state == ''Booting'': > vdevfn = self.hvm_pci_device_insert(dev_config) > @@ -896,6 +898,8 @@ > # same vslot. > if (PCI_FUNC(int(new_dev[''vdevfn''], 16)) == 0): > self.hvm_destroyPCIDevice(new_dev) > + if stubdomid is not None : > + XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) > # Update vdevfn > dev[''vdevfn''] = new_dev[''vdevfn''] > for n in sxp.children(pci_dev): > @@ -908,15 +912,22 @@ > self.pci_device_check_attachability(dev) > > # If pci platform does not exist, create and exit. > - if pci_state == ''Initialising'' : > + if existing_dev_info is None : > self.device_create(dev_sxp) > + return True > + > + if first_dev is True : > + existing_dev_uuid = sxp.child_value(existing_dev_info, ''uuid'') > + existing_pci_conf = self.info[''devices''][existing_dev_uuid][1] > + devid = self._createDevice(''pci'', existing_pci_conf) > + self.info[''devices''][existing_dev_uuid][1][''devid''] = devid > return TrueIs the logic immediately above present elsewhere? If so could it be broken out into a function into a function and shared?> if self.domid is not None: > # use DevController.reconfigureDevice to change device config > dev_control = self.getDeviceController(dev_class) > dev_uuid = dev_control.reconfigureDevice(devid, dev_config) > - if not self.info.is_hvm(): > + if not self.info.is_hvm() and not self.info.is_stubdom(): > # in PV case, wait until backend state becomes connected. > dev_control.waitForDevice_reconfigure(devid) > num_devs = dev_control.cleanupDevice(devid)_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Cui, Dexuan
2009-Nov-04 07:42 UTC
RE: [Xen-devel] [PATCH] xen passthrough: fix recent regressions
Hi Stefano, Your patch has been checked in as changeset 20397: bd60c77071eb with which the issues I mentioned disappear. However, 2 new issues arise (for ioemu, I''m using the latest 3140780e451d3919ef2c81f91ae0ebe3f286eb06; I only tried the non-stubdomain case): 1) After assigning 2 devices to an hvm guest, # xm pci-list my_domain_id VSlt VFn domain bus slot func 0x05 0x0 0x0000 0x01 0x00 0x0 - - 0x0000 0x07 0x00 0x0 ===> the VSlt and VFn don''t show properly. 2) # xm pci-attach my_domain_id 01:00.0 # xm pci-attach my_domain_id 07:00.0 # xm pci-list my_domain_id VSlt VFn domain bus slot func 0x04 0x0 0x0000 0x01 0x00 0x0 0x05 0x0 0x0000 0x07 0x00 0x0 # xm pci-detach my_domain_id 01:00.0 # xm pci-detach my_domain_id 07:00.0 Error: Failed to deassign device from IOMMU (0000:07:00.0) Can you try the 2 cases? BTW, in xend/XendDomainInfo.py: device_configure() -> pci_device_configure(), the usage of ''first_dev'' is suspicious, e.g., after we create hvm guest without any device assigned, we can try to ''xm pci-attach'' a device to the guest -- at this time, ''first_dev'' is False in pci_device_configure. I guess it''s not ok. Thanks, -- Dexuan -----Original Message----- From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Stefano Stabellini Sent: 2009?11?3? 19:31 To: xen-devel@lists.xensource.com Subject: [Xen-devel] [PATCH] xen passthrough: fix recent regressions Hi all, this patch fixes the recent regressions pointed out by Dexuan, keeping pci passthrough working with stubdom too. In particular calling device_create when pci_state == ''Initialising'' is a mistake because the state is always Initialising when attaching a devicem while device_create has too be called only when the pci backend is missing. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- diff -r 47136dbb972d tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Oct 28 10:59:55 2009 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Nov 03 11:06:16 2009 +0000 @@ -597,6 +597,7 @@ return devid = ''0'' + first = True dev_info = self._getDeviceInfo_pci(devid) if dev_info is None: return @@ -619,7 +620,8 @@ head_dev = dev.pop() dev_sxp = pci_convert_dict_to_sxp(head_dev, ''Initialising'', ''Booting'') - self.pci_device_configure(dev_sxp) + self.pci_device_configure(dev_sxp, first_dev = first) + first = False # That is all for single-function virtual devices if len(dev) == 0: @@ -829,7 +831,7 @@ return self.getDeviceController(dev_type).sxpr(devid) - def pci_device_configure(self, dev_sxp, devid = 0): + def pci_device_configure(self, dev_sxp, devid = 0, first_dev = False): """Configure an existing pci device. @param dev_sxp: device configuration @@ -859,13 +861,13 @@ dev = dev_config[''devs''][0] stubdomid = self.getStubdomDomid() - if stubdomid is not None : - from xen.xend import XendDomain - XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) - # Do HVM specific processing if self.info.is_hvm(): + from xen.xend import XendDomain if pci_state == ''Initialising'': + if stubdomid is not None : + XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) + # HVM PCI device attachment if pci_sub_state == ''Booting'': vdevfn = self.hvm_pci_device_insert(dev_config) @@ -896,6 +898,8 @@ # same vslot. if (PCI_FUNC(int(new_dev[''vdevfn''], 16)) == 0): self.hvm_destroyPCIDevice(new_dev) + if stubdomid is not None : + XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) # Update vdevfn dev[''vdevfn''] = new_dev[''vdevfn''] for n in sxp.children(pci_dev): @@ -908,15 +912,22 @@ self.pci_device_check_attachability(dev) # If pci platform does not exist, create and exit. - if pci_state == ''Initialising'' : + if existing_dev_info is None : self.device_create(dev_sxp) + return True + + if first_dev is True : + existing_dev_uuid = sxp.child_value(existing_dev_info, ''uuid'') + existing_pci_conf = self.info[''devices''][existing_dev_uuid][1] + devid = self._createDevice(''pci'', existing_pci_conf) + self.info[''devices''][existing_dev_uuid][1][''devid''] = devid return True if self.domid is not None: # use DevController.reconfigureDevice to change device config dev_control = self.getDeviceController(dev_class) dev_uuid = dev_control.reconfigureDevice(devid, dev_config) - if not self.info.is_hvm(): + if not self.info.is_hvm() and not self.info.is_stubdom(): # in PV case, wait until backend state becomes connected. dev_control.waitForDevice_reconfigure(devid) num_devs = dev_control.cleanupDevice(devid) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Cui, Dexuan
2009-Nov-04 08:29 UTC
RE: [Xen-devel] [PATCH] xen passthrough: fix recent regressions
BTW, please update or remove the block of comment in xend/server/pciif.py: setupDevice(). I think it is out of date after your patchset. Thanks, -- Dexuan -----Original Message----- From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Cui, Dexuan Sent: 2009?11?4? 15:42 To: Stefano Stabellini; xen-devel@lists.xensource.com Subject: RE: [Xen-devel] [PATCH] xen passthrough: fix recent regressions Hi Stefano, Your patch has been checked in as changeset 20397: bd60c77071eb with which the issues I mentioned disappear. However, 2 new issues arise (for ioemu, I''m using the latest 3140780e451d3919ef2c81f91ae0ebe3f286eb06; I only tried the non-stubdomain case): 1) After assigning 2 devices to an hvm guest, # xm pci-list my_domain_id VSlt VFn domain bus slot func 0x05 0x0 0x0000 0x01 0x00 0x0 - - 0x0000 0x07 0x00 0x0 ===> the VSlt and VFn don''t show properly. 2) # xm pci-attach my_domain_id 01:00.0 # xm pci-attach my_domain_id 07:00.0 # xm pci-list my_domain_id VSlt VFn domain bus slot func 0x04 0x0 0x0000 0x01 0x00 0x0 0x05 0x0 0x0000 0x07 0x00 0x0 # xm pci-detach my_domain_id 01:00.0 # xm pci-detach my_domain_id 07:00.0 Error: Failed to deassign device from IOMMU (0000:07:00.0) Can you try the 2 cases? BTW, in xend/XendDomainInfo.py: device_configure() -> pci_device_configure(), the usage of ''first_dev'' is suspicious, e.g., after we create hvm guest without any device assigned, we can try to ''xm pci-attach'' a device to the guest -- at this time, ''first_dev'' is False in pci_device_configure. I guess it''s not ok. Thanks, -- Dexuan -----Original Message----- From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Stefano Stabellini Sent: 2009?11?3? 19:31 To: xen-devel@lists.xensource.com Subject: [Xen-devel] [PATCH] xen passthrough: fix recent regressions Hi all, this patch fixes the recent regressions pointed out by Dexuan, keeping pci passthrough working with stubdom too. In particular calling device_create when pci_state == ''Initialising'' is a mistake because the state is always Initialising when attaching a devicem while device_create has too be called only when the pci backend is missing. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- diff -r 47136dbb972d tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Oct 28 10:59:55 2009 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Nov 03 11:06:16 2009 +0000 @@ -597,6 +597,7 @@ return devid = ''0'' + first = True dev_info = self._getDeviceInfo_pci(devid) if dev_info is None: return @@ -619,7 +620,8 @@ head_dev = dev.pop() dev_sxp = pci_convert_dict_to_sxp(head_dev, ''Initialising'', ''Booting'') - self.pci_device_configure(dev_sxp) + self.pci_device_configure(dev_sxp, first_dev = first) + first = False # That is all for single-function virtual devices if len(dev) == 0: @@ -829,7 +831,7 @@ return self.getDeviceController(dev_type).sxpr(devid) - def pci_device_configure(self, dev_sxp, devid = 0): + def pci_device_configure(self, dev_sxp, devid = 0, first_dev = False): """Configure an existing pci device. @param dev_sxp: device configuration @@ -859,13 +861,13 @@ dev = dev_config[''devs''][0] stubdomid = self.getStubdomDomid() - if stubdomid is not None : - from xen.xend import XendDomain - XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) - # Do HVM specific processing if self.info.is_hvm(): + from xen.xend import XendDomain if pci_state == ''Initialising'': + if stubdomid is not None : + XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) + # HVM PCI device attachment if pci_sub_state == ''Booting'': vdevfn = self.hvm_pci_device_insert(dev_config) @@ -896,6 +898,8 @@ # same vslot. if (PCI_FUNC(int(new_dev[''vdevfn''], 16)) == 0): self.hvm_destroyPCIDevice(new_dev) + if stubdomid is not None : + XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) # Update vdevfn dev[''vdevfn''] = new_dev[''vdevfn''] for n in sxp.children(pci_dev): @@ -908,15 +912,22 @@ self.pci_device_check_attachability(dev) # If pci platform does not exist, create and exit. - if pci_state == ''Initialising'' : + if existing_dev_info is None : self.device_create(dev_sxp) + return True + + if first_dev is True : + existing_dev_uuid = sxp.child_value(existing_dev_info, ''uuid'') + existing_pci_conf = self.info[''devices''][existing_dev_uuid][1] + devid = self._createDevice(''pci'', existing_pci_conf) + self.info[''devices''][existing_dev_uuid][1][''devid''] = devid return True if self.domid is not None: # use DevController.reconfigureDevice to change device config dev_control = self.getDeviceController(dev_class) dev_uuid = dev_control.reconfigureDevice(devid, dev_config) - if not self.info.is_hvm(): + if not self.info.is_hvm() and not self.info.is_stubdom(): # in PV case, wait until backend state becomes connected. dev_control.waitForDevice_reconfigure(devid) num_devs = dev_control.cleanupDevice(devid) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Cui, Dexuan
2009-Nov-06 09:31 UTC
RE: [Xen-devel] [PATCH] xen passthrough: fix recent regressions
Hi Stefano, can you reproduce the issues I meet with? Thanks, -- Dexuan -----Original Message----- From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Cui, Dexuan Sent: 2009?11?4? 16:29 To: Stefano Stabellini; xen-devel@lists.xensource.com Subject: RE: [Xen-devel] [PATCH] xen passthrough: fix recent regressions BTW, please update or remove the block of comment in xend/server/pciif.py: setupDevice(). I think it is out of date after your patchset. Thanks, -- Dexuan -----Original Message----- From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Cui, Dexuan Sent: 2009?11?4? 15:42 To: Stefano Stabellini; xen-devel@lists.xensource.com Subject: RE: [Xen-devel] [PATCH] xen passthrough: fix recent regressions Hi Stefano, Your patch has been checked in as changeset 20397: bd60c77071eb with which the issues I mentioned disappear. However, 2 new issues arise (for ioemu, I''m using the latest 3140780e451d3919ef2c81f91ae0ebe3f286eb06; I only tried the non-stubdomain case): 1) After assigning 2 devices to an hvm guest, # xm pci-list my_domain_id VSlt VFn domain bus slot func 0x05 0x0 0x0000 0x01 0x00 0x0 - - 0x0000 0x07 0x00 0x0 ===> the VSlt and VFn don''t show properly. 2) # xm pci-attach my_domain_id 01:00.0 # xm pci-attach my_domain_id 07:00.0 # xm pci-list my_domain_id VSlt VFn domain bus slot func 0x04 0x0 0x0000 0x01 0x00 0x0 0x05 0x0 0x0000 0x07 0x00 0x0 # xm pci-detach my_domain_id 01:00.0 # xm pci-detach my_domain_id 07:00.0 Error: Failed to deassign device from IOMMU (0000:07:00.0) Can you try the 2 cases? BTW, in xend/XendDomainInfo.py: device_configure() -> pci_device_configure(), the usage of ''first_dev'' is suspicious, e.g., after we create hvm guest without any device assigned, we can try to ''xm pci-attach'' a device to the guest -- at this time, ''first_dev'' is False in pci_device_configure. I guess it''s not ok. Thanks, -- Dexuan -----Original Message----- From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Stefano Stabellini Sent: 2009?11?3? 19:31 To: xen-devel@lists.xensource.com Subject: [Xen-devel] [PATCH] xen passthrough: fix recent regressions Hi all, this patch fixes the recent regressions pointed out by Dexuan, keeping pci passthrough working with stubdom too. In particular calling device_create when pci_state == ''Initialising'' is a mistake because the state is always Initialising when attaching a devicem while device_create has too be called only when the pci backend is missing. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- diff -r 47136dbb972d tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Oct 28 10:59:55 2009 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Nov 03 11:06:16 2009 +0000 @@ -597,6 +597,7 @@ return devid = ''0'' + first = True dev_info = self._getDeviceInfo_pci(devid) if dev_info is None: return @@ -619,7 +620,8 @@ head_dev = dev.pop() dev_sxp = pci_convert_dict_to_sxp(head_dev, ''Initialising'', ''Booting'') - self.pci_device_configure(dev_sxp) + self.pci_device_configure(dev_sxp, first_dev = first) + first = False # That is all for single-function virtual devices if len(dev) == 0: @@ -829,7 +831,7 @@ return self.getDeviceController(dev_type).sxpr(devid) - def pci_device_configure(self, dev_sxp, devid = 0): + def pci_device_configure(self, dev_sxp, devid = 0, first_dev = False): """Configure an existing pci device. @param dev_sxp: device configuration @@ -859,13 +861,13 @@ dev = dev_config[''devs''][0] stubdomid = self.getStubdomDomid() - if stubdomid is not None : - from xen.xend import XendDomain - XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) - # Do HVM specific processing if self.info.is_hvm(): + from xen.xend import XendDomain if pci_state == ''Initialising'': + if stubdomid is not None : + XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) + # HVM PCI device attachment if pci_sub_state == ''Booting'': vdevfn = self.hvm_pci_device_insert(dev_config) @@ -896,6 +898,8 @@ # same vslot. if (PCI_FUNC(int(new_dev[''vdevfn''], 16)) == 0): self.hvm_destroyPCIDevice(new_dev) + if stubdomid is not None : + XendDomain.instance().domain_lookup(stubdomid).pci_device_configure(dev_sxp[:]) # Update vdevfn dev[''vdevfn''] = new_dev[''vdevfn''] for n in sxp.children(pci_dev): @@ -908,15 +912,22 @@ self.pci_device_check_attachability(dev) # If pci platform does not exist, create and exit. - if pci_state == ''Initialising'' : + if existing_dev_info is None : self.device_create(dev_sxp) + return True + + if first_dev is True : + existing_dev_uuid = sxp.child_value(existing_dev_info, ''uuid'') + existing_pci_conf = self.info[''devices''][existing_dev_uuid][1] + devid = self._createDevice(''pci'', existing_pci_conf) + self.info[''devices''][existing_dev_uuid][1][''devid''] = devid return True if self.domid is not None: # use DevController.reconfigureDevice to change device config dev_control = self.getDeviceController(dev_class) dev_uuid = dev_control.reconfigureDevice(devid, dev_config) - if not self.info.is_hvm(): + if not self.info.is_hvm() and not self.info.is_stubdom(): # in PV case, wait until backend state becomes connected. dev_control.waitForDevice_reconfigure(devid) num_devs = dev_control.cleanupDevice(devid) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stefano Stabellini
2009-Nov-06 10:25 UTC
RE: [Xen-devel] [PATCH] xen passthrough: fix recent regressions
On Fri, 6 Nov 2009, Cui, Dexuan wrote:> Hi Stefano, can you reproduce the issues I meet with? >Yes, I am working on them. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stefano Stabellini
2009-Nov-06 14:26 UTC
RE: [Xen-devel] [PATCH] xen passthrough: fix recent regressions
On Fri, 6 Nov 2009, Cui, Dexuan wrote:> Hi Stefano, can you reproduce the issues I meet with? >this patch fixes the problem for me, does it work for you too? --- diff -r 1cc49eb917bc tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu Nov 05 18:02:28 2009 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu Nov 05 18:05:55 2009 +0000 @@ -921,7 +921,6 @@ existing_pci_conf = self.info[''devices''][existing_dev_uuid][1] devid = self._createDevice(''pci'', existing_pci_conf) self.info[''devices''][existing_dev_uuid][1][''devid''] = devid - return True if self.domid is not None: # use DevController.reconfigureDevice to change device config diff -r 1cc49eb917bc tools/python/xen/xend/server/pciif.py --- a/tools/python/xen/xend/server/pciif.py Thu Nov 05 18:02:28 2009 +0000 +++ b/tools/python/xen/xend/server/pciif.py Thu Nov 05 18:05:55 2009 +0000 @@ -306,7 +306,7 @@ if dev.driver == ''pciback'': PCIQuirk(dev) - if not self.vm.info.is_hvm() and not self.vm.info.is_stubdom() : + if not self.vm.info.is_stubdom() : # Setup IOMMU device assignment bdf = xc.assign_device(fe_domid, pci_dict_to_xc_str(pci_dev)) pci_str = pci_dict_to_bdf_str(pci_dev) @@ -443,16 +443,8 @@ # # For hvm guest, (from c/s 19679 on) assigning device statically and # dynamically both go through reconfigureDevice(), so HERE the - # setupOneDevice() is not necessary. - if self.vm.info.is_hvm(): - for pci_dev in pci_dev_list: - # Setup IOMMU device assignment - bdf = xc.assign_device(self.getDomid(), pci_dict_to_xc_str(pci_dev)) - pci_str = pci_dict_to_bdf_str(pci_dev) - if bdf > 0: - raise VmError("Failed to assign device to IOMMU (%s)" % pci_str) - log.debug("pci: assign device %s" % pci_str) - else : + # setupOneDevice() or calling xc.assign_device is not necessary. + if not self.vm.info.is_hvm(): for d in pci_dev_list: self.setupOneDevice(d) wPath = ''/local/domain/0/backend/pci/%u/0/aerState'' % (self.getDomid()) @@ -492,11 +484,12 @@ dev.do_FLR(self.vm.info.is_hvm(), xoptions.get_pci_dev_assign_strict_check()) - bdf = xc.deassign_device(fe_domid, pci_dict_to_xc_str(pci_dev)) - pci_str = pci_dict_to_bdf_str(pci_dev) - if bdf > 0: - raise VmError("Failed to deassign device from IOMMU (%s)" % pci_str) - log.debug("pci: Deassign device %s" % pci_str) + if not self.vm.info.is_stubdom() : + bdf = xc.deassign_device(fe_domid, pci_dict_to_xc_str(pci_dev)) + pci_str = pci_dict_to_bdf_str(pci_dev) + if bdf > 0: + raise VmError("Failed to deassign device from IOMMU (%s)" % pci_str) + log.debug("pci: Deassign device %s" % pci_str) for (start, size) in dev.ioports: log.debug(''pci: disabling ioport 0x%x/0x%x''%(start,size)) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel