aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-11-24 11:06:16 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-11-24 11:06:16 +0000
commit71a732a2b8ea47cf97510bdce0508917769e3ee0 (patch)
tree1672336a19590e725c5f3446f79a1ae3c93bf6f3 /tools
parent39bef5bcf02a72fc5552dd20c61ec7ea65c85054 (diff)
downloadxen-71a732a2b8ea47cf97510bdce0508917769e3ee0.tar.gz
xen-71a732a2b8ea47cf97510bdce0508917769e3ee0.tar.bz2
xen-71a732a2b8ea47cf97510bdce0508917769e3ee0.zip
PCI interface changes for PCIE-AER enabling
This patch reflects some pci interface changes in pciif.h in XEN head file. And also add domain shutdown support in xend for shutting domain from DOM0 kernel when non-recoverable uncorrected pci error happens. Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com> Signed-off-by: Ke Liping <liping.ke@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/python/xen/xend/server/pciif.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/tools/python/xen/xend/server/pciif.py b/tools/python/xen/xend/server/pciif.py
index c5fa86ed95..1051450a08 100644
--- a/tools/python/xen/xend/server/pciif.py
+++ b/tools/python/xen/xend/server/pciif.py
@@ -35,6 +35,8 @@ import resource
import re
from xen.xend.server.pciquirk import *
+from xen.xend.xenstore.xstransact import xstransact
+from xen.xend.xenstore.xswatch import xswatch
xc = xen.lowlevel.xc.xc()
@@ -58,6 +60,7 @@ def parse_hex(val):
class PciController(DevController):
def __init__(self, vm):
+ self.aerStateWatch = None
DevController.__init__(self, vm)
@@ -431,9 +434,23 @@ class PciController(DevController):
for (domain, bus, slot, func) in pci_dev_list:
self.setupOneDevice(domain, bus, slot, func)
-
+ wPath = '/local/domain/0/backend/pci/%u/0/aerState' % (self.getDomid())
+ self.aerStatePath = xswatch(wPath, self._handleAerStateWatch)
+ log.debug('pci: register aer watch %s', wPath)
return
+ def _handleAerStateWatch(self, _):
+ log.debug('XendDomainInfo.handleAerStateWatch')
+ if self.getDomid() == 0:
+ raise XendError('Domain 0 cannot be shutdown')
+ readPath = '/local/domain/0/backend/pci/%u/0/aerState' % (self.getDomid())
+ action = xstransact.Read(readPath)
+ if action and action=='aerfail':
+ log.debug('shutdown domain because of aer handle error')
+ self.vm.shutdown('poweroff')
+ return True
+
+
def cleanupOneDevice(self, domain, bus, slot, func):
""" Detach I/O resources for device from frontend domain
"""
@@ -545,6 +562,22 @@ class PciController(DevController):
return new_num_devs
+ def destroyDevice(self, devid, force):
+ DevController.destroyDevice(self, devid, True)
+ log.debug('pci: unregister aer watch')
+ self.unwatchAerState
+
+ def unwatchAerState(self):
+ """Remove the watch on the domain's aerState node, if any."""
+ try:
+ try:
+ if self.aerStateWatch:
+ self.aerStateWatch.unwatch()
+ finally:
+ self.aerStateWatch = None
+ except:
+ log.exception("Unwatching aerState failed.")
+
def waitForBackend(self,devid):
return (0, "ok - no hotplug")