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>
Cc: baolu.lu@linux.intel.com,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH v4 6/7] iommu/vt-d: Add support for static identity domain
Date: Sat, 10 Aug 2024 16:01:40 +0800 [thread overview]
Message-ID: <8f5ee898-162a-49f6-9044-7e3ef6dafe1e@linux.intel.com> (raw)
In-Reply-To: <BN9PR11MB5276BCEC41AA08D80CE985F18CBA2@BN9PR11MB5276.namprd11.prod.outlook.com>
On 2024/8/9 16:29, Tian, Kevin wrote:
>> From: Lu Baolu <baolu.lu@linux.intel.com>
>> Sent: Friday, August 9, 2024 1:55 PM
>>
>> +static int context_setup_pass_through(struct device *dev, u8 bus, u8 devfn)
>> +{
>> + struct device_domain_info *info = dev_iommu_priv_get(dev);
>> + struct intel_iommu *iommu = info->iommu;
>> + struct context_entry *context;
>> +
>> + spin_lock(&iommu->lock);
>> + context = iommu_context_addr(iommu, bus, devfn, 1);
>> + if (!context) {
>> + spin_unlock(&iommu->lock);
>> + return -ENOMEM;
>> + }
>> +
>> + if (context_present(context) && !context_copied(iommu, bus, devfn))
>> {
>> + spin_unlock(&iommu->lock);
>> + return 0;
>> + }
>
> Is it a valid case to setup passthrough on a present entry?
It's valid but unnecessary.
Since the context is present, it indicates that the configuration has
already been setup by a PCI aliased device. The iommu group mandates
that all PCI aliased devices must be attached to the same iommu domain.
Consequently, there's no need for additional configuration.
While it's feasible to remove this line of code due to the check in the
pci_for_each_dma_alias() callback:
static int context_setup_pass_through_cb(struct pci_dev *pdev, u16
alias, void *data)
{
struct device *dev = data;
if (dev != &pdev->dev)
return 0;
return context_setup_pass_through(dev, PCI_BUS_NUM(alias),
alias & 0xff);
}
But it's in the original code, I've retained it to prevent any potential
regression.
Thanks,
baolu
next prev parent reply other threads:[~2024-08-10 8:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 5:54 [PATCH v4 0/7] iommu/vt-d: Convert to use " Lu Baolu
2024-08-09 5:54 ` [PATCH v4 1/7] iommu/vt-d: Require DMA domain if hardware not support passthrough Lu Baolu
2024-08-09 8:22 ` Tian, Kevin
2024-08-09 5:54 ` [PATCH v4 2/7] iommu/vt-d: Remove identity mappings from si_domain Lu Baolu
2024-08-09 8:23 ` Tian, Kevin
2024-08-09 5:54 ` [PATCH v4 3/7] iommu/vt-d: Always reserve a domain ID for identity setup Lu Baolu
2024-08-09 8:24 ` Tian, Kevin
2024-08-09 5:54 ` [PATCH v4 4/7] iommu/vt-d: Remove has_iotlb_device flag Lu Baolu
2024-08-09 8:25 ` Tian, Kevin
2024-08-09 5:54 ` [PATCH v4 5/7] iommu/vt-d: Factor out helpers from domain_context_mapping_one() Lu Baolu
2024-08-09 8:28 ` Tian, Kevin
2024-08-09 5:54 ` [PATCH v4 6/7] iommu/vt-d: Add support for static identity domain Lu Baolu
2024-08-09 8:29 ` Tian, Kevin
2024-08-10 8:01 ` Baolu Lu [this message]
2024-08-12 0:19 ` Tian, Kevin
2024-08-09 5:54 ` [PATCH v4 7/7] iommu/vt-d: Cleanup si_domain Lu Baolu
2024-08-09 8:29 ` Tian, Kevin
2024-09-02 2:34 ` [PATCH v4 0/7] iommu/vt-d: Convert to use static identity domain Baolu Lu
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=8f5ee898-162a-49f6-9044-7e3ef6dafe1e@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--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 \
/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®