iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] AMD Family15h Model10-1Fh erratum 746 Workaround
@ 2013-01-22 23:19 suravee.suthikulpanit
       [not found] ` <1358896750-5199-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: suravee.suthikulpanit @ 2013-01-22 23:19 UTC (permalink / raw)
  To: iommu, joro
  Cc: bp, linux-kernel, udovdh, ssg.sos.patches, Suravee Suthikulpanit

From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>

This patch implements workaround for the AMD Family15h Model10-1Fh erratum 746.

(http://support.amd.com/us/Processor_TechDocs/48931_15h_Mod_10h-1Fh_Rev_Guide.pdf)

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 81837b0..26c0448 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -975,6 +975,30 @@ static void __init free_iommu_all(void)
 }
 
 /*
+ * AMD family15h Model 10h-1fh  erratum 746 (IOMMU Logging May Stall Translations)
+ * Workaround:
+ *     BIOS should disable L2B micellaneous clock gating by setting
+ *     L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b
+ */
+static void __init amd_iommu_apply_erratum_746(struct amd_iommu *iommu)
+{
+	u32 value;
+
+	if ((boot_cpu_data.x86 != 0x15) || !(boot_cpu_data.x86_model & 0x10))
+		return;
+	
+	/* Select Northbridge indirect register 0x90 and enable writing */
+	pci_write_config_dword(iommu->dev, 0xf0, 0x90 | (1 << 8));
+	pci_read_config_dword(iommu->dev, 0xf4, &value); 
+
+	if (!(value & 0x4)) {
+		pci_write_config_dword(iommu->dev, 0xf4, value | 0x4);
+		pr_info("AMD-Vi: Applying erratum 746 for IOMMU at %s\n",
+		 dev_name(&iommu->dev->dev));
+	}
+}
+
+/*
  * This function clues the initialization function for one IOMMU
  * together and also allocates the command buffer and programs the
  * hardware. It does NOT enable the IOMMU. This is done afterwards.
@@ -1171,6 +1195,8 @@ static int iommu_init_pci(struct amd_iommu *iommu)
 		for (i = 0; i < 0x83; i++)
 			iommu->stored_l2[i] = iommu_read_l2(iommu, i);
 	}
+	
+	amd_iommu_apply_erratum_746(iommu);
 
 	return pci_enable_device(iommu->dev);
 }
-- 
1.7.10.4

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

* Re: [PATCH 1/1] AMD Family15h Model10-1Fh erratum 746 Workaround
       [not found] ` <1358896750-5199-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
@ 2013-01-23  7:06   ` Joerg Roedel
       [not found]     ` <20130123070604.GT25591-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Joerg Roedel @ 2013-01-23  7:06 UTC (permalink / raw)
  To: suravee.suthikulpanit-5C7GfCeVMHo
  Cc: bp-aTezCOEuUpuzQB+pC5nmwQ,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, ssg.sos.patches-5C7GfCeVMHo,
	udovdh-qWit8jRvyhVmR6Xm/wNWPw

On Tue, Jan 22, 2013 at 05:19:10PM -0600, Suthikulpanit, Suravee wrote:
> From: Suravee Suthikulpanit <suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
> @@ -1171,6 +1195,8 @@ static int iommu_init_pci(struct amd_iommu *iommu)
>  		for (i = 0; i < 0x83; i++)
>  			iommu->stored_l2[i] = iommu_read_l2(iommu, i);
>  	}
> +	
> +	amd_iommu_apply_erratum_746(iommu);

This will also be applied to RD890 IOMMUs, right? This workaround should
be limited to Trinity IOMMUs.

Udo, can you please test if you can trigger the erratum again with this
patch?


	Joerg

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

* Re: [PATCH 1/1] AMD Family15h Model10-1Fh erratum 746 Workaround
       [not found]     ` <20130123070604.GT25591-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
@ 2013-01-23 15:07       ` Suravee Suthikulpanit
  0 siblings, 0 replies; 3+ messages in thread
From: Suravee Suthikulpanit @ 2013-01-23 15:07 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: ssg.sos.staff-v4o/RmcJZDMz7H3ftjWMJQC/G2K4zDHf,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Borislav Petkov, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Udo van den Heuvel

On 1/23/2013 1:06 AM, Joerg Roedel wrote:

> On Tue, Jan 22, 2013 at 05:19:10PM -0600, Suthikulpanit, Suravee wrote:
>> From: Suravee Suthikulpanit <suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
>> @@ -1171,6 +1195,8 @@ static int iommu_init_pci(struct amd_iommu *iommu)
>>   		for (i = 0; i < 0x83; i++)
>>   			iommu->stored_l2[i] = iommu_read_l2(iommu, i);
>>   	}
>> +	
>> +	amd_iommu_apply_erratum_746(iommu);
> This will also be applied to RD890 IOMMUs, right? This workaround should
> be limited to Trinity IOMMUs.

Inside the function, it checks the family and model number.  Only Trinitiy is affected.

Suravee

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

end of thread, other threads:[~2013-01-23 15:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-22 23:19 [PATCH 1/1] AMD Family15h Model10-1Fh erratum 746 Workaround suravee.suthikulpanit
     [not found] ` <1358896750-5199-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
2013-01-23  7:06   ` Joerg Roedel
     [not found]     ` <20130123070604.GT25591-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-01-23 15:07       ` Suravee Suthikulpanit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).