Port-xen archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
NetBSD 5.99.22 Dom0 + xentools33 + pci export + linux domu
Hi,
I've been playing recently with pci exporting feature in current netbsd
dom0 kernel. I've quick-and-dirty-adjusted xentools33 according to
Manuel's suggestion here:
http://mail-index.netbsd.org/port-xen/2009/10/26/msg005504.html
and whole thing seems to work. Sort of, actually... Here's what I did:
- booted dom0 kernel with "pciback.hide=(00:1d.0)" => usb controller
- adjusted pci.py and pciquirks.py from xentools33 - see attached diffs
- started linux domu (2.6.31.9 with xen stuff enabled) and
"pci = [ '0000:00:1d.0' ]" thing in domu configuration file
So far, so good, linux domu worked perfectly, usb controller was found
and when I connected webcam to it, it was recognized and worked well.
Real troubles started when I shutdown linux domu. My network interface
in dom0 started to get watchdog timeouts and I experienced a crash once.
"xm list" showed an "Domain-Unnamed" in "--ps--" state. The unnamed
domain couldn't be killed with "xm destroy". Only reboot helped to get
rid of it.
Any enlightenment idea what goes wrong during domu shutdown?
Thanks,
Juraj
PS: Warning, attached diffs are in "devel" quality, just to get the domu
booting, no polishing done - and maybe the quick-and-dirty state of it
is responsible for the trouble...
--- pci.py 2009-12-20 15:10:30.000000000 +0100
+++ /usr/pkg/lib/python2.5/site-packages/xen/util/pci.py 2009-12-21
17:31:44.000000000 +0100
@@ -362,8 +362,8 @@
self.slot = slot
self.func = func
self.name = PCI_DEV_FORMAT_STR % (domain, bus, slot, func)
- self.cfg_space_path = find_sysfs_mnt()+SYSFS_PCI_DEVS_PATH+'/'+ \
- self.name + SYSFS_PCI_DEV_CONFIG_PATH
+ #self.cfg_space_path = find_sysfs_mnt()+SYSFS_PCI_DEVS_PATH+'/'+ \
+ # self.name + SYSFS_PCI_DEV_CONFIG_PATH
self.irq = 0
self.iomem = []
self.ioports = []
@@ -385,9 +385,10 @@
self.has_non_page_aligned_bar = False
self.pcie_flr = False
self.pci_af_flr = False
- self.detect_dev_info()
- self.get_info_from_sysfs()
- self.get_info_from_lspci()
+ #self.detect_dev_info()
+ #self.get_info_from_sysfs()
+ #self.get_info_from_lspci()
+ self.get_info_from_kern()
def find_parent(self):
# i.e., /sys/bus/pci/devices/0000:00:19.0 or
@@ -810,6 +811,37 @@
pba_end = (pba_end + PAGE_SIZE) & PAGE_MASK
self.msix_iomem.append((pba_start, pba_end-pba_start))
+ def get_info_from_kern(self):
+ path = '/kern/xen/pci/' + self.name
+ self.driver = 'pciback'
+ try:
+ resource_file = open(path,'r')
+ for line in resource_file.readlines():
+ k, v = line.strip().split(':')
+ if k == 'vendor':
+ self.vendor = int(v.strip(), 16)
+ elif k == 'product':
+ self.device = int(v.strip(), 16)
+ elif k == 'subsys_vendor':
+ self.subvendor = int(v.strip(), 16)
+ elif k == 'subsys_product':
+ self.subdevice = int(v.strip(),16)
+ elif k in ('I/O', 'mem'):
+ sline = map(str.strip, v.split('-'))
+ start = int(sline[0], 16)
+ end = int(sline[1], 16)
+ size = end - start + 1
+ if k == 'I/O':
+ self.ioports.append((start, size))
+ else:
+ self.iomem.append( (start,size) )
+ elif k == 'irq':
+ self.irq = int(v.strip())
+ except IOError, (errno, strerr):
+ raise PciDeviceParseError(('Failed to open & read %s: %s (%d)' %
+ (path, strerr, errno)))
+ return True
+
def get_info_from_sysfs(self):
self.find_capability(0x11)
sysfs_mnt = find_sysfs_mnt()
--- pciquirk.py 2009-12-20 15:38:38.000000000 +0100
+++ /usr/pkg/lib/python2.5/site-packages/xen/xend/server/pciquirk.py
2009-12-20 15:39:24.000000000 +0100
@@ -115,14 +115,14 @@
pci_perm_dev_config = ['']
else:
pci_perm_dev_config.insert(0, '')
- self.pci_perm_dev_config = pci_perm_dev_config
except Exception, ex:
raise XendError("Reading config file %s: %s" %
(PERMISSIVE_CONFIG_FILE,str(ex)))
else:
log.info("Config file does not exist: %s" % PERMISSIVE_CONFIG_FILE)
- self.pci_perm_dev_config = ['xend-pci-perm-devs']
+ pci_perm_dev_config = ['xend-pci-perm-devs']
+ self.pci_perm_dev_config = pci_perm_dev_config
devices = child_at(child(self.pci_perm_dev_config,
'unconstrained_dev_ids'),0)
if self.__matchPCIdev( devices ):
Home |
Main Index |
Thread Index |
Old Index