[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8a47d13c-a555-d88a-8aba-adf11d925446@linux.intel.com>
Date: Fri, 26 May 2023 10:56:02 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: "Tian, Kevin" <kevin.tian@...el.com>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"joro@...tes.org" <joro@...tes.org>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"jgg@...dia.com" <jgg@...dia.com>,
"robin.murphy@....com" <robin.murphy@....com>
Cc: baolu.lu@...ux.intel.com, "cohuck@...hat.com" <cohuck@...hat.com>,
"eric.auger@...hat.com" <eric.auger@...hat.com>,
"nicolinc@...dia.com" <nicolinc@...dia.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"mjrosato@...ux.ibm.com" <mjrosato@...ux.ibm.com>,
"chao.p.peng@...ux.intel.com" <chao.p.peng@...ux.intel.com>,
"yi.y.sun@...ux.intel.com" <yi.y.sun@...ux.intel.com>,
"peterx@...hat.com" <peterx@...hat.com>,
"jasowang@...hat.com" <jasowang@...hat.com>,
"shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>,
"lulu@...hat.com" <lulu@...hat.com>,
"suravee.suthikulpanit@....com" <suravee.suthikulpanit@....com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"Duan, Zhenzhong" <zhenzhong.duan@...el.com>
Subject: Re: [PATCH v3 02/10] iommu/vt-d: Extend dmar_domain to support nested
domain
On 5/24/23 3:02 PM, Tian, Kevin wrote:
>> From: Liu, Yi L<yi.l.liu@...el.com>
>> Sent: Thursday, May 11, 2023 10:51 PM
>>
>> From: Lu Baolu<baolu.lu@...ux.intel.com>
>>
>> The nested domain fields are exclusive to those that used for a DMA
>> remapping domain. Use union to avoid memory waste.
>>
>> Signed-off-by: Lu Baolu<baolu.lu@...ux.intel.com>
>> Signed-off-by: Yi Liu<yi.l.liu@...el.com>
>> ---
>> drivers/iommu/intel/iommu.h | 35 +++++++++++++++++++++++++++++------
>> 1 file changed, 29 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h
>> index 1c5e1d88862b..e818520f4068 100644
>> --- a/drivers/iommu/intel/iommu.h
>> +++ b/drivers/iommu/intel/iommu.h
>> @@ -596,15 +596,38 @@ struct dmar_domain {
>> spinlock_t lock; /* Protect device tracking lists */
>> struct list_head devices; /* all devices' list */
>>
>> - struct dma_pte *pgd; /* virtual address */
>> - int gaw; /* max guest address width */
>> -
>> - /* adjusted guest address width, 0 is level 2 30-bit */
>> - int agaw;
>> int iommu_superpage;/* Level of superpages supported:
>> 0 == 4KiB (no superpages), 1 ==
>> 2MiB,
>> 2 == 1GiB, 3 == 512GiB, 4 == 1TiB */
>> - u64 max_addr; /* maximum mapped address */
>> + union {
>> + /* DMA remapping domain */
>> + struct {
>> + /* virtual address */
>> + struct dma_pte *pgd;
>> + /* max guest address width */
>> + int gaw;
>> + /*
>> + * adjusted guest address width:
>> + * 0: level 2 30-bit
>> + * 1: level 3 39-bit
>> + * 2: level 4 48-bit
>> + * 3: level 5 57-bit
>> + */
>> + int agaw;
>> + /* maximum mapped address */
>> + u64 max_addr;
>> + };
> what about 'nid'?
"nid" represents which NUMA node should we allocate pages from for this
domain. It's updated every time when a domain is attached/detached
to/from a device or pasid.
Generally speaking, "nid" is common for all types of domain. But in this
case, only a DMA remapping domain has a need to allocate pages. I intend
to keep it as it for now. There's more cleanup rooms if we limit it only
for DMA remapping domain.
Best regards,
baolu
Powered by blists - more mailing lists