All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3.2-stable] iommu/amd: Make sure IOMMU interrupts are re-enabled on resume
@ 2012-04-11 16:25 Joerg Roedel
  2012-04-11 16:29 ` Joerg Roedel
  2012-04-11 16:40 ` Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Joerg Roedel @ 2012-04-11 16:25 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, Joerg Roedel, stable

commit 9ddd592a191b32f2ee6c4b6ed2bd52665c3a49f5 upstream

Unfortunatly the interrupts for the event log and the
peripheral page-faults are only enabled at boot but not
re-enabled at resume. Fix that for 3.2.

Cc: stable@vger.kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 drivers/iommu/amd_iommu_init.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 5c74179..c90a709 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1033,8 +1033,9 @@ static int iommu_setup_msi(struct amd_iommu *iommu)
 {
 	int r;
 
-	if (pci_enable_msi(iommu->dev))
-		return 1;
+	r = pci_enable_msi(iommu->dev);
+	if (r)
+		return r;
 
 	r = request_threaded_irq(iommu->dev->irq,
 				 amd_iommu_int_handler,
@@ -1044,24 +1045,36 @@ static int iommu_setup_msi(struct amd_iommu *iommu)
 
 	if (r) {
 		pci_disable_msi(iommu->dev);
-		return 1;
+		return r;
 	}
 
 	iommu->int_enabled = true;
-	iommu_feature_enable(iommu, CONTROL_EVT_INT_EN);
 
 	return 0;
 }
 
 static int iommu_init_msi(struct amd_iommu *iommu)
 {
+	int ret;
+
 	if (iommu->int_enabled)
-		return 0;
+		goto enable_faults;
 
 	if (pci_find_capability(iommu->dev, PCI_CAP_ID_MSI))
-		return iommu_setup_msi(iommu);
+		ret = iommu_setup_msi(iommu);
+	else
+		ret = -ENODEV;
 
-	return 1;
+	if (ret)
+		return ret;
+
+enable_faults:
+	iommu_feature_enable(iommu, CONTROL_EVT_INT_EN);
+
+	if (iommu->ppr_log != NULL)
+		iommu_feature_enable(iommu, CONTROL_PPFINT_EN);
+
+	return 0;
 }
 
 /****************************************************************************
-- 
1.7.5.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3.2-stable] iommu/amd: Make sure IOMMU interrupts are re-enabled on resume
  2012-04-11 16:25 [PATCH 3.2-stable] iommu/amd: Make sure IOMMU interrupts are re-enabled on resume Joerg Roedel
@ 2012-04-11 16:29 ` Joerg Roedel
  2012-04-11 16:40 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2012-04-11 16:29 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, stable

On Wed, Apr 11, 2012 at 06:25:46PM +0200, Joerg Roedel wrote:
> commit 9ddd592a191b32f2ee6c4b6ed2bd52665c3a49f5 upstream
> 
> Unfortunatly the interrupts for the event log and the
> peripheral page-faults are only enabled at boot but not
> re-enabled at resume. Fix that for 3.2.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>

Argh, please ignore this one, this patch does a little bit too much.

> ---
>  drivers/iommu/amd_iommu_init.c |   27 ++++++++++++++++++++-------
>  1 files changed, 20 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
> index 5c74179..c90a709 100644
> --- a/drivers/iommu/amd_iommu_init.c
> +++ b/drivers/iommu/amd_iommu_init.c
> @@ -1033,8 +1033,9 @@ static int iommu_setup_msi(struct amd_iommu *iommu)
>  {
>  	int r;
>  
> -	if (pci_enable_msi(iommu->dev))
> -		return 1;
> +	r = pci_enable_msi(iommu->dev);
> +	if (r)
> +		return r;
>  
>  	r = request_threaded_irq(iommu->dev->irq,
>  				 amd_iommu_int_handler,
> @@ -1044,24 +1045,36 @@ static int iommu_setup_msi(struct amd_iommu *iommu)
>  
>  	if (r) {
>  		pci_disable_msi(iommu->dev);
> -		return 1;
> +		return r;
>  	}
>  
>  	iommu->int_enabled = true;
> -	iommu_feature_enable(iommu, CONTROL_EVT_INT_EN);
>  
>  	return 0;
>  }
>  
>  static int iommu_init_msi(struct amd_iommu *iommu)
>  {
> +	int ret;
> +
>  	if (iommu->int_enabled)
> -		return 0;
> +		goto enable_faults;
>  
>  	if (pci_find_capability(iommu->dev, PCI_CAP_ID_MSI))
> -		return iommu_setup_msi(iommu);
> +		ret = iommu_setup_msi(iommu);
> +	else
> +		ret = -ENODEV;
>  
> -	return 1;
> +	if (ret)
> +		return ret;
> +
> +enable_faults:
> +	iommu_feature_enable(iommu, CONTROL_EVT_INT_EN);
> +
> +	if (iommu->ppr_log != NULL)
> +		iommu_feature_enable(iommu, CONTROL_PPFINT_EN);
> +
> +	return 0;
>  }
>  
>  /****************************************************************************
> -- 
> 1.7.5.4

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3.2-stable] iommu/amd: Make sure IOMMU interrupts are re-enabled on resume
  2012-04-11 16:25 [PATCH 3.2-stable] iommu/amd: Make sure IOMMU interrupts are re-enabled on resume Joerg Roedel
  2012-04-11 16:29 ` Joerg Roedel
@ 2012-04-11 16:40 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2012-04-11 16:40 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, stable

On Wed, Apr 11, 2012 at 06:25:46PM +0200, Joerg Roedel wrote:
> commit 9ddd592a191b32f2ee6c4b6ed2bd52665c3a49f5 upstream
> 
> Unfortunatly the interrupts for the event log and the
> peripheral page-faults are only enabled at boot but not
> re-enabled at resume. Fix that for 3.2.

This is the correct fix for Linux 3.2:


>From 2ff71db30bc4c1f46823a27f9d77bd2a19a9d238 Mon Sep 17 00:00:00 2001
From: Joerg Roedel <joerg.roedel@amd.com>
Date: Thu, 15 Mar 2012 16:29:47 +0100
Subject: [PATCH v3.2-stable] iommu/amd: Make sure IOMMU interrupts are re-enabled on resume

commit 9ddd592a191b32f2ee6c4b6ed2bd52665c3a49f5 upstream

Unfortunatly the interrupts for the event log and the
peripheral page-faults are only enabled at boot but not
re-enabled at resume. Fix that for 3.2.

Cc: stable@vger.kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 drivers/iommu/amd_iommu_init.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 5c74179..20d5852 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1033,8 +1033,9 @@ static int iommu_setup_msi(struct amd_iommu *iommu)
 {
 	int r;
 
-	if (pci_enable_msi(iommu->dev))
-		return 1;
+	r = pci_enable_msi(iommu->dev);
+	if (r)
+		return r;
 
 	r = request_threaded_irq(iommu->dev->irq,
 				 amd_iommu_int_handler,
@@ -1044,24 +1045,33 @@ static int iommu_setup_msi(struct amd_iommu *iommu)
 
 	if (r) {
 		pci_disable_msi(iommu->dev);
-		return 1;
+		return r;
 	}
 
 	iommu->int_enabled = true;
-	iommu_feature_enable(iommu, CONTROL_EVT_INT_EN);
 
 	return 0;
 }
 
 static int iommu_init_msi(struct amd_iommu *iommu)
 {
+	int ret;
+
 	if (iommu->int_enabled)
-		return 0;
+		goto enable_faults;
 
 	if (pci_find_capability(iommu->dev, PCI_CAP_ID_MSI))
-		return iommu_setup_msi(iommu);
+		ret = iommu_setup_msi(iommu);
+	else
+		ret = -ENODEV;
 
-	return 1;
+	if (ret)
+		return ret;
+
+enable_faults:
+	iommu_feature_enable(iommu, CONTROL_EVT_INT_EN);
+
+	return 0;
 }
 
 /****************************************************************************
-- 
1.7.5.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-11 16:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 16:25 [PATCH 3.2-stable] iommu/amd: Make sure IOMMU interrupts are re-enabled on resume Joerg Roedel
2012-04-11 16:29 ` Joerg Roedel
2012-04-11 16:40 ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.