[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 5/8] pci/arm: Use iommu_add_dt_pci_device()


  • To: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 15 May 2023 09:30:48 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eDofIGobZV3ZfZtNUodE5fycUG4IC6S48IzkCYA1KAY=; b=FiIRiunyfnuxm5XX8q74pIetpzY3+kzMewRjHDZ1I+kOTxpdCyi797S/jHUF61DCtSJfQ8chYT8n8EorTxTK1EfLi3ykOecnFmRJrQ1l+7byC+wzUgsiv9budY6LOuDMQkL8bnsOtydNxOXm2nj5zFEHGKubj58ciGtEuAzKhnasxwAXFwjQZigIApWRUwNMhLLW/RN93cpFWNGy+EfBqcMlqc6Xgs9075g2IqGv816WfXwKyp+/MvpZ+HUvO9T/qJXw1BPO32s6+hs+jRdtkjcDlvD7+ZFZPXKCpGYazy/2mkFTXgzDgzOLUJ1BasNHdU0qYi3JT0PCbl2vHVCT+w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fCeaeO4oWmINosBRzuxAyCfJI6uEjqgk03fAwabFsDENaRKQ1En7DRY6bPWVa0QVtIY7R/w/uQCrbg8rY8sFv3JVDjnNI849IVTSOGsIg33K5Cso04PbLv+WVkhNj2WFQ9hhIJvcP9rdGJWoXmz/2yHIIiQT4x9oZfL5bpIt0Y4yZOKuaQlTLwfvKLMz12c9w7WFnP1jOKqLsY0ud/yI3XDWOq4V2IHqO/pEMGtzrP5VTs+ic5tfoZ3Fk1NSwsbtv1D5aglLxYZMlA5cFHtdTRXbdpkoNZu7vI/hztxiE+ad5ug9Q94rq7AZkXaJdAV+KJtSYNji30o5jKso+/eAzw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 15 May 2023 07:30:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.05.2023 23:03, Stewart Hildebrand wrote:
> On 5/12/23 03:25, Jan Beulich wrote:
>> On 11.05.2023 21:16, Stewart Hildebrand wrote:
>>> @@ -762,9 +767,20 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
>>>              pdev->domain = NULL;
>>>              goto out;
>>>          }
>>> +#ifdef CONFIG_HAS_DEVICE_TREE
>>> +        ret = iommu_add_dt_pci_device(pdev);
>>> +        if ( ret < 0 )
>>> +        {
>>> +            printk(XENLOG_ERR "pci-iommu translation failed: %d\n", ret);
>>> +            goto out;
>>> +        }
>>> +#endif
>>>          ret = iommu_add_device(pdev);
>>
>> Hmm, am I misremembering that in the earlier patch you had #else to
>> invoke the alternative behavior?
> 
> You are remembering correctly. v1 had an #else, v2 does not.
> 
>> Now you end up calling both functions;
>> if that's indeed intended,
> 
> Yes, this is intentional.
> 
>> this may still want doing differently.
>> Looking at the earlier patch introducing the function, I can't infer
>> though whether that's intended: iommu_add_dt_pci_device() checks that
>> the add_device hook is present, but then I didn't find any use of this
>> hook. The revlog there suggests the check might be stale.
> 
> Ah, right, the ops->add_device check is stale in the other patch. Good catch, 
> I'll remove it there.
> 
>> If indeed the function does only preparatory work, I don't see why it
>> would need naming "iommu_..."; I'd rather consider pci_add_dt_device()
>> then.
> 
> The function has now been reduced to reading SMMU configuration data from DT 
> and mapping RID/BDF -> AXI stream ID. However, it is still SMMU related, and 
> it is still invoking another iommu_ops hook function, dt_xlate (which is yet 
> another AXI stream ID translation, separate from what is being discussed 
> here). Does this justify keeping "iommu_..." in the name? I'm not convinced 
> pci_add_dt_device() is a good name for it either (more on this below).

The function being SMMU-related pretty strongly suggests it wants to be
invoked via a hook. If the add_device() one isn't suitable, perhaps we
need a new (optional) prepare_device() one? With pci_add_device() then
calling iommu_prepare_device(), wrapping the hook invocation?

But just to be clear: A new hook would need enough justification as to
the existing one being unsuitable.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.