From: Olaf Hering Subject: [PATCH] xen: enable platform-pci only in a Xen guest Date: Tue, 10 Jul 2012 15:31:39 +0200 Message-ID: <1341927099-22367-1-git-send-email-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jeremy Fitzhardinge , Konrad Rzeszutek Wilk Cc: Olaf Hering , xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org List-Id: xen-devel@lists.xenproject.org While debugging kexec issues in a PVonHVM guest I modified xen_hvm_platform() to return false to disable all PV drivers. This caused a crash in platform_pci_init() because it expects certain data structures to be initialized properly. To avoid such a crash make sure the driver is initialized only if running in a Xen guest. Signed-off-by: Olaf Hering --- drivers/xen/platform-pci.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c index 2389e58..97ca359 100644 --- a/drivers/xen/platform-pci.c +++ b/drivers/xen/platform-pci.c @@ -109,6 +109,9 @@ static int __devinit platform_pci_init(struct pci_dev *pdev, long mmio_addr, mmio_len; unsigned int max_nr_gframes; + if (!xen_domain()) + return -ENODEV; + i = pci_enable_device(pdev); if (i) return i; -- 1.7.3.4