mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
To: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org
Cc: joro@8bytes.org, Jon.Grimm@amd.com, Wei.Huang2@amd.com,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: [RFC PATCH 3/7] iommu/amd: Decouple the logic to enable PPR and GT
Date: Fri, 12 Mar 2021 03:04:07 -0600	[thread overview]
Message-ID: <20210312090411.6030-4-suravee.suthikulpanit@amd.com> (raw)
In-Reply-To: <20210312090411.6030-1-suravee.suthikulpanit@amd.com>

Currently, the function to enable iommu v2 (GT) assumes PPR log
must also be enabled. This is no longer the case since the IOMMU
v2 page table can be enabled without PRR support (for DMA-API
use case).

Therefore, separate the enabling logic for PPR and GT.
There is no functional change.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/init.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 9126efcbaf2c..5def566de6f6 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -898,14 +898,6 @@ static void iommu_enable_xt(struct amd_iommu *iommu)
 #endif /* CONFIG_IRQ_REMAP */
 }
 
-static void iommu_enable_gt(struct amd_iommu *iommu)
-{
-	if (!iommu_feature(iommu, FEATURE_GT))
-		return;
-
-	iommu_feature_enable(iommu, CONTROL_GT_EN);
-}
-
 /* sets a specific bit in the device table entry. */
 static void set_dev_entry_bit(u16 devid, u8 bit)
 {
@@ -1882,6 +1874,7 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)
 			amd_iommu_max_glx_val = glxval;
 		else
 			amd_iommu_max_glx_val = min(amd_iommu_max_glx_val, glxval);
+		iommu_feature_enable(iommu, CONTROL_GT_EN);
 	}
 
 	if (iommu_feature(iommu, FEATURE_GT) &&
@@ -2530,21 +2523,19 @@ static void early_enable_iommus(void)
 #endif
 }
 
-static void enable_iommus_v2(void)
+static void enable_iommus_ppr(void)
 {
 	struct amd_iommu *iommu;
 
-	for_each_iommu(iommu) {
+	for_each_iommu(iommu)
 		iommu_enable_ppr_log(iommu);
-		iommu_enable_gt(iommu);
-	}
 }
 
 static void enable_iommus(void)
 {
 	early_enable_iommus();
 
-	enable_iommus_v2();
+	enable_iommus_ppr();
 }
 
 static void disable_iommus(void)
@@ -2935,7 +2926,7 @@ static int __init state_next(void)
 		register_syscore_ops(&amd_iommu_syscore_ops);
 		ret = amd_iommu_init_pci();
 		init_state = ret ? IOMMU_INIT_ERROR : IOMMU_PCI_INIT;
-		enable_iommus_v2();
+		enable_iommus_ppr();
 		break;
 	case IOMMU_PCI_INIT:
 		ret = amd_iommu_enable_interrupts();
-- 
2.17.1


  parent reply	other threads:[~2021-03-12  8:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  9:04 [RFC PATCH 0/7] iommu/amd: Add Generic IO Page Table Framework Support for v2 Page Table Suravee Suthikulpanit
2021-03-12  9:04 ` [RFC PATCH 1/7] iommu/amd: Refactor amd_iommu_domain_enable_v2 Suravee Suthikulpanit
2021-03-12  9:04 ` [RFC PATCH 2/7] iommu/amd: Update sanity check when enable PRI/ATS Suravee Suthikulpanit
2021-03-12  9:04 ` Suravee Suthikulpanit [this message]
2021-03-12  9:04 ` [RFC PATCH 4/7] iommu/amd: Initial support for AMD IOMMU v2 page table Suravee Suthikulpanit
2021-03-18 15:28   ` Joerg Roedel
2021-03-12  9:04 ` [RFC PATCH 5/7] iommu/amd: Add support for Guest IO protection Suravee Suthikulpanit
2021-03-18 15:31   ` Joerg Roedel
2021-03-25 13:06     ` Suravee Suthikulpanit
2021-03-12  9:04 ` [RFC PATCH 6/7] iommu/amd: Introduce amd_iommu_pgtable command-line option Suravee Suthikulpanit
2021-03-18 15:33   ` Joerg Roedel
2021-03-22  4:24     ` Suravee Suthikulpanit
2021-03-12  9:04 ` [RFC PATCH 7/7] iommu/amd: Add support for using AMD IOMMU v2 page table for DMA-API Suravee Suthikulpanit
2021-03-18 15:44   ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210312090411.6030-4-suravee.suthikulpanit@amd.com \
    --to=suravee.suthikulpanit@amd.com \
    --cc=Jon.Grimm@amd.com \
    --cc=Wei.Huang2@amd.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®