From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Wilson Subject: [PATCH] xend: handle extended PCI configuration space when saving state Date: Fri, 30 Aug 2013 16:40:42 -0700 Message-ID: <1377906042-12816-1-git-send-email-msw@linux.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VFYJd-0007XK-5z for xen-devel@lists.xenproject.org; Fri, 30 Aug 2013 23:41:21 +0000 Received: by mail-pa0-f42.google.com with SMTP id lj1so2926084pab.29 for ; Fri, 30 Aug 2013 16:41:17 -0700 (PDT) List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Steven Noonan , Ian Jackson , Ian Campbell , Matt Wilson , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org From: Steven Noonan Newer PCI standards (e.g., PCI-X 2.0 and PCIe) introduce extended configuration space which is larger than 256 bytes. This patch uses stat() to determine the amount of space used to correctly save all of the PCI configuration space. Resets handled by the xen-pciback driver don't have this problem, as that code correctly handles saving extended configuration space. Signed-off-by: Steven Noonan Reviewed-by: Matt Wilson [msw: adjusted commit message] Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell Signed-off-by: Matt Wilson --- tools/python/xen/util/pci.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/python/xen/util/pci.py b/tools/python/xen/util/pci.py index 792fb69..adeca4b 100644 --- a/tools/python/xen/util/pci.py +++ b/tools/python/xen/util/pci.py @@ -521,8 +521,9 @@ def save_pci_conf_space(devs_string): pci_path = sysfs_mnt + SYSFS_PCI_DEVS_PATH + '/' + pci_str + \ SYSFS_PCI_DEV_CONFIG_PATH fd = os.open(pci_path, os.O_RDONLY) + size = os.fstat(fd).st_size configs = [] - for i in range(0, 256, 4): + for i in range(0, size, 4): configs = configs + [os.read(fd,4)] os.close(fd) pci_list = pci_list + [pci_path] -- 1.7.9.5