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: <441f6537-dde0-885a-3cc2-089b3ed4f4df@linux.intel.com>
Date:   Mon, 25 Jul 2022 18:11:13 +0800
From:   Baolu Lu <baolu.lu@...ux.intel.com>
To:     "Tian, Kevin" <kevin.tian@...el.com>,
        Jason Gunthorpe <jgg@...dia.com>
Cc:     baolu.lu@...ux.intel.com, Joerg Roedel <joro@...tes.org>,
        Christoph Hellwig <hch@...radead.org>,
        "Raj, Ashok" <ashok.raj@...el.com>, Will Deacon <will@...nel.org>,
        Robin Murphy <robin.murphy@....com>,
        Jean-Philippe Brucker <jean-philippe@...aro.com>,
        "Jiang, Dave" <dave.jiang@...el.com>,
        Vinod Koul <vkoul@...nel.org>,
        Eric Auger <eric.auger@...hat.com>,
        "Liu, Yi L" <yi.l.liu@...el.com>,
        "Pan, Jacob jun" <jacob.jun.pan@...el.com>,
        Zhangfei Gao <zhangfei.gao@...aro.org>,
        "Zhu, Tony" <tony.zhu@...el.com>,
        "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Jean-Philippe Brucker <jean-philippe@...aro.org>
Subject: Re: [PATCH v10 04/12] iommu: Add attach/detach_dev_pasid iommu
 interface

On 2022/7/25 15:46, Tian, Kevin wrote:
>> From: Baolu Lu <baolu.lu@...ux.intel.com>
>> Sent: Sunday, July 24, 2022 5:14 PM
>>
>> On 2022/7/23 22:11, Jason Gunthorpe wrote:
>>>> +void iommu_detach_device_pasid(struct iommu_domain *domain,
>> struct device *dev,
>>>> +			       ioasid_t pasid)
>>>> +{
>>>> +	struct iommu_group *group = iommu_group_get(dev);
>>>> +
>>>> +	mutex_lock(&group->mutex);
>>>> +	domain->ops->block_dev_pasid(domain, dev, pasid);
>>> I still really this OP, it is nonsense to invoke 'block_dev_pasid' on
>>> a domain, it should be on the iommu ops and it should not take in a
>>> domain parameter. This is why I prefer we write it as
>>>
>>> domain->ops->set_dev_pasid(group->blocking_domain, dev, pasid);
>>>
>>
>> I originally plan to refactor this after both Intel and ARM SMMUv3
>> drivers have real blocking domain supports. After revisiting this, it
>> seems that the only difficulty is how to check whether a domain is a
>> blocking domain. I am going to use below checking code:
>>
>> +	/*
>> +	 * Detach the domain if a blocking domain is set. Check the
>> +	 * right domain type once the IOMMU driver supports a real
>> +	 * blocking domain.
>> +	 */
>> +	if (!domain || domain->type == IOMMU_DOMAIN_UNMANAGED) {
>>
>> Does this work for you?
>>
> 
> Or you can call __iommu_group_alloc_blocking_domain() in the sva
> path and then just check whether the domain is equal to
> group->blocking_domain here.

Above check is in the IOMMU driver where group->blocking_domain is not
viable. I ever thought about have something like

struct iommu_domain *iommu_group_blocking_domain(struct iommu_group
*group)

to return group->blocking_domain. But it looks redundant.

Best regards,
baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ