IOMMU Archive mirror
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	"Wang, Zhenyu Z" <zhenyu.z.wang@intel.com>
Cc: baolu.lu@linux.intel.com,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] iommu/vt-d: Decouple igfx_off from graphic identity mapping
Date: Sun, 28 Apr 2024 20:12:56 +0800	[thread overview]
Message-ID: <850146ff-ce6f-44b3-9326-d44d29550b34@linux.intel.com> (raw)
In-Reply-To: <BN9PR11MB5276AF4C9A57C3B8D3A25E8E8C142@BN9PR11MB5276.namprd11.prod.outlook.com>

On 2024/4/28 14:45, Tian, Kevin wrote:
>> From: Lu Baolu<baolu.lu@linux.intel.com>
>> Sent: Sunday, April 28, 2024 11:20 AM
>>
>> A kernel command called igfx_off was introduced in commit <ba39592764ed>
>> ("Intel IOMMU: Intel IOMMU driver"). This command allows the user to
>> disable the IOMMU dedicated to SOC-integrated graphic devices.
>>
>> Commit <9452618e7462> ("iommu/intel: disable DMAR for g4x integrated
>> gfx")
>> used this mechanism to disable the graphic-dedicated IOMMU for some
>> problematic devices. Later, more problematic graphic devices were added
>> to the list by commit <1f76249cc3beb> ("iommu/vt-d: Declare Broadwell igfx
>> dmar support snafu").
>>
>> On the other hand, commit <19943b0e30b05> ("intel-iommu: Unify
>> hardware
>> and software passthrough support") uses the identity domain for graphic
>> devices if CONFIG_DMAR_BROKEN_GFX_WA is selected.
>>
>> +       if (iommu_pass_through)
>> +               iommu_identity_mapping = 1;
>> +#ifdef CONFIG_DMAR_BROKEN_GFX_WA
>> +       else
>> +               iommu_identity_mapping = 2;
>> +#endif
>> ...
>>
>> static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
>> {
>> +        if (iommu_identity_mapping == 2)
>> +                return IS_GFX_DEVICE(pdev);
>> ...
>>
>> In the following driver evolution, CONFIG_DMAR_BROKEN_GFX_WA and
>> quirk_iommu_igfx() are mixed together, causing confusion in the driver's
>> device_def_domain_type callback. On one hand, dmar_map_gfx is used to
>> turn
>> off the graphic-dedicated IOMMU as a workaround for some buggy
>> hardware;
>> on the other hand, for those graphic devices, IDENTITY mapping is required
>> for the IOMMU core.
>>
>> Commit <4b8d18c0c986> "iommu/vt-d: Remove
>> INTEL_IOMMU_BROKEN_GFX_WA" has
>> removed the CONFIG_DMAR_BROKEN_GFX_WA option, so the
>> IDENTITY_DOMAIN
>> requirement for graphic devices is no longer needed. Therefore, this
>> requirement can be removed from device_def_domain_type() and igfx_off
>> can
>> be made independent.
>>
>> Fixes: 4b8d18c0c986 ("iommu/vt-d: Remove
>> INTEL_IOMMU_BROKEN_GFX_WA")
>> Signed-off-by: Lu Baolu<baolu.lu@linux.intel.com>
>> ---
>>   drivers/iommu/intel/iommu.c | 19 ++++++-------------
>>   1 file changed, 6 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
>> index fbbf8fda22f3..57a986524502 100644
>> --- a/drivers/iommu/intel/iommu.c
>> +++ b/drivers/iommu/intel/iommu.c
>> @@ -217,12 +217,11 @@ int intel_iommu_sm =
>> IS_ENABLED(CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON);
>>   int intel_iommu_enabled = 0;
>>   EXPORT_SYMBOL_GPL(intel_iommu_enabled);
>>
>> -static int dmar_map_gfx = 1;
>>   static int intel_iommu_superpage = 1;
>>   static int iommu_identity_mapping;
>>   static int iommu_skip_te_disable;
>> +static int disable_igfx_dedicated_iommu;
>>
> what about 'no_igfx_iommu"? dedicated is implied for igfx
> so a shorter name might be slightly better.

I like disable_igfx_iommu more. :-)

Best regards,
baolu

  reply	other threads:[~2024-04-28 12:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28  3:20 [PATCH 1/1] iommu/vt-d: Decouple igfx_off from graphic identity mapping Lu Baolu
2024-04-28  6:45 ` Tian, Kevin
2024-04-28 12:12   ` Baolu Lu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-03 13:36 [PATCH 0/1][PULL REQUEST] iommu/vt-d: Fixes for intel iommu Lu Baolu
2024-05-03 13:36 ` [PATCH 1/1] iommu/vt-d: Decouple igfx_off from graphic identity mapping Lu Baolu

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=850146ff-ce6f-44b3-9326-d44d29550b34@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=zhenyu.z.wang@intel.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).