lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <558c3038-11b4-4afe-b441-fe62b646a192@linux.intel.com>
Date:   Wed, 11 Oct 2023 11:18:44 +0800
From:   Baolu Lu <baolu.lu@...ux.intel.com>
To:     Jason Gunthorpe <jgg@...dia.com>, Yi Liu <yi.l.liu@...el.com>
Cc:     baolu.lu@...ux.intel.com, joro@...tes.org,
        alex.williamson@...hat.com, kevin.tian@...el.com,
        robin.murphy@....com, cohuck@...hat.com, eric.auger@...hat.com,
        nicolinc@...dia.com, kvm@...r.kernel.org, mjrosato@...ux.ibm.com,
        chao.p.peng@...ux.intel.com, yi.y.sun@...ux.intel.com,
        peterx@...hat.com, jasowang@...hat.com,
        shameerali.kolothum.thodi@...wei.com, lulu@...hat.com,
        suravee.suthikulpanit@....com, iommu@...ts.linux.dev,
        linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
        zhenzhong.duan@...el.com, joao.m.martins@...cle.com
Subject: Re: [PATCH v2 6/6] iommu/vt-d: Add domain_alloc_user op

On 10/11/23 12:43 AM, Jason Gunthorpe wrote:
> On Thu, Sep 28, 2023 at 12:15:28AM -0700, Yi Liu wrote:
>> This adds the domain_alloc_user op implementation. It supports allocating
>> domains to be used as parent under nested translation.
>>
>> Signed-off-by: Yi Liu<yi.l.liu@...el.com>
>> ---
>>   drivers/iommu/intel/iommu.c | 28 ++++++++++++++++++++++++++++
>>   1 file changed, 28 insertions(+)
>>
>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
>> index 5db283c17e0d..017aed5813d8 100644
>> --- a/drivers/iommu/intel/iommu.c
>> +++ b/drivers/iommu/intel/iommu.c
>> @@ -4074,6 +4074,33 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)
>>   	return NULL;
>>   }
>>   
>> +static struct iommu_domain *
>> +intel_iommu_domain_alloc_user(struct device *dev, u32 flags)
>> +{
>> +	struct iommu_domain *domain;
>> +	struct intel_iommu *iommu;
>> +
>> +	if (flags & (~IOMMU_HWPT_ALLOC_NEST_PARENT))
>> +		return ERR_PTR(-EOPNOTSUPP);
>> +
>> +	iommu = device_to_iommu(dev, NULL, NULL);
>> +	if (!iommu)
>> +		return ERR_PTR(-ENODEV);
> Why isn't this just
> 
> 	struct device_domain_info *info = dev_iommu_priv_get(dev)
> 	struct intel_iommu *iommu = info->iommu
> 
> ???
> 
> Same question for almost all other calls to this function! The one in
> probe is reasonable, but I don't think it should be ever called again.
> 
> I'm going to leave this, but please make a series cleaning all the
> device_to_iommu() stuff next cycle..

Sure. I also have a plan to do this. device_to_iommu() is only needed in
the probe path. For runtime callbacks, we can just retrieve it from the
device's iommu private data.

Best regards,
baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ