ia64/linux-2.6.18-xen.hg

changeset 898:ca12928cdafe

pci: fix pcie-aer recovery mechanism defects.

When aer error happening, if the device is not hided or assigned,
exit. If the device is assigned yet not connected by PV guest or is
owned by HVM guest, kill the guest. [sh_info is NULL]

Signed-Off-By: Liping Ke <liping.ke@intel.com>
Signed-Off-By: Yunhong Jiang <yunhong.jiang@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 08 12:23:24 2009 +0100 (2009-06-08)
parents 329ea0ccb344
children 214ff2a7c990
files drivers/xen/pciback/pci_stub.c
line diff
     1.1 --- a/drivers/xen/pciback/pci_stub.c	Fri Jun 05 14:01:20 2009 +0100
     1.2 +++ b/drivers/xen/pciback/pci_stub.c	Mon Jun 08 12:23:24 2009 +0100
     1.3 @@ -629,12 +629,22 @@ static pci_ers_result_t pciback_slot_res
     1.4  				dev->bus->number,
     1.5  				PCI_SLOT(dev->devfn),
     1.6  				PCI_FUNC(dev->devfn));
     1.7 -	if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info )
     1.8 +
     1.9 +	if ( !psdev || !psdev->pdev )
    1.10  	{
    1.11  		dev_err(&dev->dev, 
    1.12 -			"pciback device is not found/in use/connected!\n");
    1.13 +			"pciback device is not found/assigned\n");
    1.14  		goto end;
    1.15  	}
    1.16 +
    1.17 +	if ( !psdev->pdev->sh_info )
    1.18 +	{
    1.19 +		dev_err(&dev->dev, "pciback device is not connected or owned"
    1.20 +			" by HVM, kill it\n");
    1.21 +		kill_domain_by_device(psdev);
    1.22 +		goto release;
    1.23 +	}
    1.24 +
    1.25  	if ( !test_bit(_XEN_PCIB_AERHANDLER, 
    1.26  		(unsigned long *)&psdev->pdev->sh_info->flags) ) {
    1.27  		dev_err(&dev->dev, 
    1.28 @@ -679,12 +689,22 @@ static pci_ers_result_t pciback_mmio_ena
    1.29  				dev->bus->number,
    1.30  				PCI_SLOT(dev->devfn),
    1.31  				PCI_FUNC(dev->devfn));
    1.32 -	if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info)
    1.33 +
    1.34 +	if ( !psdev || !psdev->pdev )
    1.35  	{
    1.36  		dev_err(&dev->dev, 
    1.37 -			"pciback device is not found/in use/connected!\n");
    1.38 +			"pciback device is not found/assigned\n");
    1.39  		goto end;
    1.40  	}
    1.41 +
    1.42 +	if ( !psdev->pdev->sh_info )
    1.43 +	{
    1.44 +		dev_err(&dev->dev, "pciback device is not connected or owned"
    1.45 +			" by HVM, kill it\n");
    1.46 +		kill_domain_by_device(psdev);
    1.47 +		goto release;
    1.48 +	}
    1.49 +
    1.50  	if ( !test_bit(_XEN_PCIB_AERHANDLER, 
    1.51  		(unsigned long *)&psdev->pdev->sh_info->flags) ) {
    1.52  		dev_err(&dev->dev, 
    1.53 @@ -729,12 +749,22 @@ static pci_ers_result_t pciback_error_de
    1.54  				dev->bus->number,
    1.55  				PCI_SLOT(dev->devfn),
    1.56  				PCI_FUNC(dev->devfn));
    1.57 -	if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info)
    1.58 +
    1.59 +	if ( !psdev || !psdev->pdev )
    1.60  	{
    1.61  		dev_err(&dev->dev, 
    1.62 -			"pciback device is not found/in use/connected!\n");
    1.63 +			"pciback device is not found/assigned\n");
    1.64  		goto end;
    1.65  	}
    1.66 +
    1.67 +	if ( !psdev->pdev->sh_info )
    1.68 +	{
    1.69 +		dev_err(&dev->dev, "pciback device is not connected or owned"
    1.70 +			" by HVM, kill it\n");
    1.71 +		kill_domain_by_device(psdev);
    1.72 +		goto release;
    1.73 +	}
    1.74 +
    1.75  	/*Guest owns the device yet no aer handler regiested, kill guest*/
    1.76  	if ( !test_bit(_XEN_PCIB_AERHANDLER, 
    1.77  		(unsigned long *)&psdev->pdev->sh_info->flags) ) {
    1.78 @@ -775,13 +805,22 @@ static void pciback_error_resume(struct 
    1.79  				dev->bus->number,
    1.80  				PCI_SLOT(dev->devfn),
    1.81  				PCI_FUNC(dev->devfn));
    1.82 -	if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info)
    1.83 +
    1.84 +	if ( !psdev || !psdev->pdev )
    1.85  	{
    1.86  		dev_err(&dev->dev, 
    1.87 -			"pciback device is not found/in use/connected!\n");
    1.88 +			"pciback device is not found/assigned\n");
    1.89  		goto end;
    1.90  	}
    1.91  
    1.92 +	if ( !psdev->pdev->sh_info )
    1.93 +	{
    1.94 +		dev_err(&dev->dev, "pciback device is not connected or owned"
    1.95 +			" by HVM, kill it\n");
    1.96 +		kill_domain_by_device(psdev);
    1.97 +		goto release;
    1.98 +	}
    1.99 +
   1.100  	if ( !test_bit(_XEN_PCIB_AERHANDLER, 
   1.101  		(unsigned long *)&psdev->pdev->sh_info->flags) ) {
   1.102  		dev_err(&dev->dev,