From: Baolu Lu <baolu.lu@linux.intel.com>
To: Yi Liu <yi.l.liu@intel.com>, "Tian, Kevin" <kevin.tian@intel.com>,
"joro@8bytes.org" <joro@8bytes.org>,
"alex.williamson@redhat.com" <alex.williamson@redhat.com>,
"jgg@nvidia.com" <jgg@nvidia.com>,
"robin.murphy@arm.com" <robin.murphy@arm.com>
Cc: baolu.lu@linux.intel.com, "cohuck@redhat.com" <cohuck@redhat.com>,
"eric.auger@redhat.com" <eric.auger@redhat.com>,
"nicolinc@nvidia.com" <nicolinc@nvidia.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"mjrosato@linux.ibm.com" <mjrosato@linux.ibm.com>,
"chao.p.peng@linux.intel.com" <chao.p.peng@linux.intel.com>,
"yi.y.sun@linux.intel.com" <yi.y.sun@linux.intel.com>,
"peterx@redhat.com" <peterx@redhat.com>,
"jasowang@redhat.com" <jasowang@redhat.com>,
"shameerali.kolothum.thodi@huawei.com"
<shameerali.kolothum.thodi@huawei.com>,
"lulu@redhat.com" <lulu@redhat.com>,
"suravee.suthikulpanit@amd.com" <suravee.suthikulpanit@amd.com>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-kselftest@vger.kernel.org"
<linux-kselftest@vger.kernel.org>,
"Duan, Zhenzhong" <zhenzhong.duan@intel.com>,
"Martins, Joao" <joao.m.martins@oracle.com>,
Jacob Pan <jacob.jun.pan@linux.intel.com>
Subject: Re: [PATCH v5 04/11] iommu/vt-d: Add helper to setup pasid nested translation
Date: Fri, 13 Oct 2023 20:48:19 +0800 [thread overview]
Message-ID: <a4c2402f-fc81-ff54-7c5b-606fa14405e2@linux.intel.com> (raw)
In-Reply-To: <8974035d-9f9c-e209-79d6-8e3c6402e516@intel.com>
On 2023/10/13 20:40, Yi Liu wrote:
>>
>>> + return -EINVAL;
>>> + }
>>> +
>>> + if ((s1_cfg->flags & IOMMU_VTD_S1_SRE) && !ecap_srs(iommu-
>>>> ecap)) {
>>> + pr_err_ratelimited("No supervisor request support on %s\n",
>>> + iommu->name);
>>> + return -EINVAL;
>>> + }
>>> +
>>> + if ((s1_cfg->flags & IOMMU_VTD_S1_EAFE) && !ecap_eafs(iommu-
>>>> ecap)) {
>>> + pr_err_ratelimited("No extended access flag support
>>> on %s\n",
>>> + iommu->name);
>>> + return -EINVAL;
>>> + }
>>> +
>>> + spin_lock(&iommu->lock);
>>> + pte = intel_pasid_get_entry(dev, pasid);
>>> + if (!pte) {
>>> + spin_unlock(&iommu->lock);
>>> + return -ENODEV;
>>> + }
>>> + if (pasid_pte_is_present(pte)) {
>>> + spin_unlock(&iommu->lock);
>>> + return -EBUSY;
>>> + }
>>> +
>>> + pasid_clear_entry(pte);
>>> +
>>> + if (s1_cfg->addr_width == ADDR_WIDTH_5LEVEL)
>>> + pasid_set_flpm(pte, 1);
>>> +
>>> + pasid_set_flptr(pte, (uintptr_t)s1_gpgd);
>>> +
>>> + if (s1_cfg->flags & IOMMU_VTD_S1_SRE) {
>>> + pasid_set_sre(pte);
>>> + if (s1_cfg->flags & IOMMU_VTD_S1_WPE)
>>> + pasid_set_wpe(pte);
>>> + }
>>> +
>>> + if (s1_cfg->flags & IOMMU_VTD_S1_EAFE)
>>> + pasid_set_eafe(pte);
>>> +
>>> + if (s2_domain->force_snooping)
>>> + pasid_set_pgsnp(pte);
>>> +
>>> + pasid_set_slptr(pte, virt_to_phys(pgd));
>>> + pasid_set_fault_enable(pte);
>>> + pasid_set_domain_id(pte, did);
>>> + pasid_set_address_width(pte, s2_domain->agaw);
>>> + pasid_set_page_snoop(pte, !!ecap_smpwc(iommu->ecap));
>>> + pasid_set_translation_type(pte, PASID_ENTRY_PGTT_NESTED);
>>> + pasid_set_present(pte);
>>> + spin_unlock(&iommu->lock);
>>
>> All changes within iommu->lock are specific to the device specific
>> PASID entry. Probably this is one potential cleanup TODO to
>> use a per-device lock instead.
>
> yeah, a separate cleanup. is it, @Baolu?
Sure. I'd like to take some time to consider this further. Please keep
it as-is for the time being.
Best regards,
baolu
next prev parent reply other threads:[~2023-10-13 12:48 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 7:54 [PATCH v5 00/11] Add Intel VT-d " Yi Liu
2023-09-21 7:54 ` [PATCH v5 01/11] iommufd: Add data structure for Intel VT-d stage-1 domain allocation Yi Liu
2023-09-27 6:18 ` Tian, Kevin
2023-09-21 7:54 ` [PATCH v5 02/11] iommu/vt-d: Extend dmar_domain to support nested domain Yi Liu
2023-09-21 7:54 ` [PATCH v5 03/11] iommu/vt-d: Add helper for nested domain allocation Yi Liu
2023-09-21 7:54 ` [PATCH v5 04/11] iommu/vt-d: Add helper to setup pasid nested translation Yi Liu
2023-09-27 6:37 ` Tian, Kevin
2023-10-13 12:40 ` Yi Liu
2023-10-13 12:48 ` Baolu Lu [this message]
2023-10-16 8:30 ` Tian, Kevin
2023-09-21 7:54 ` [PATCH v5 05/11] iommu/vt-d: Make domain attach helpers to be extern Yi Liu
2023-09-21 7:54 ` [PATCH v5 06/11] iommu/vt-d: Set the nested domain to a device Yi Liu
2023-09-27 6:40 ` Tian, Kevin
2023-09-21 7:54 ` [PATCH v5 07/11] iommufd: Add data structure for Intel VT-d stage-1 cache invalidation Yi Liu
2023-09-21 13:33 ` Baolu Lu
2023-09-25 6:56 ` Yi Liu
2023-09-27 6:46 ` Tian, Kevin
2023-09-21 7:54 ` [PATCH v5 08/11] iommu/vt-d: Make iotlb flush helpers to be extern Yi Liu
2023-09-21 7:54 ` [PATCH v5 09/11] iommu/vt-d: Add iotlb flush for nested domain Yi Liu
2023-09-27 6:53 ` Tian, Kevin
2023-10-13 12:56 ` Yi Liu
2023-09-21 7:54 ` [PATCH v5 10/11] iommu/vt-d: Add nested domain allocation Yi Liu
2023-09-27 6:56 ` Tian, Kevin
2023-10-13 13:41 ` Yi Liu
2023-09-21 7:54 ` [PATCH v5 11/11] iommu/vt-d: Disallow read-only mappings to nest parent domain Yi Liu
2023-09-27 7:04 ` Tian, Kevin
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=a4c2402f-fc81-ff54-7c5b-606fa14405e2@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=alex.williamson@redhat.com \
--cc=chao.p.peng@linux.intel.com \
--cc=cohuck@redhat.com \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jacob.jun.pan@linux.intel.com \
--cc=jasowang@redhat.com \
--cc=jgg@nvidia.com \
--cc=joao.m.martins@oracle.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lulu@redhat.com \
--cc=mjrosato@linux.ibm.com \
--cc=nicolinc@nvidia.com \
--cc=peterx@redhat.com \
--cc=robin.murphy@arm.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=yi.l.liu@intel.com \
--cc=yi.y.sun@linux.intel.com \
--cc=zhenzhong.duan@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
all inboxes | Powered by JetHome®