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

Re: [PATCH v4 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Fri, 7 Mar 2025 11:23:48 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=wpSCct9tGiW8zIHM1IfWMzCfJ7Bem16VzZ8Bs9ayW7U=; b=hfltGZRURXTfbVUuAMMFwWndTZr0EYreWfQiJzqA4rvHnGLCO7oQwYbQFyBjXOFI5nLBFgLtlf4+KuOx1A7uz3pnMNZ8reMjhQYLabEwFh/SMJtQx11kWRRG1iyOlyp6Jk/Ve9vLaWRd61OFBIO8rFAz3QubHvdShifFY2i90pvQcvXOzV19dj7u+Zy3IRiv3AUANjHLFhtXh7OhUog+2yPkroHZfhwChuawbo2GpfncRj5FLOxo8qb1J6U/0hCernp3yT93m2ojlFc4SWaYDZtoDnwsMsRSn8Q+VFX+HQ1BJQawc55Ye4o4VerUjyX1oH7BgXj0USyDSoXh+Eg1Cw==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=wpSCct9tGiW8zIHM1IfWMzCfJ7Bem16VzZ8Bs9ayW7U=; b=Fzw2pW1NDH8U50EAnzVHcHaRJv8p2jmmkgZ37sCeE21LslRtsZGnr80OO8/APUK+Uw+/UodIBflmVDFz8LAgercq2kNK2wPeM+kNzGgQDuVNoRuh3DAIRbvb0iEpmbj3icVIzGT6HxM+4N0+ZwGgatZltjGM+J7b+S7XtX+d+3i7SLcxkF9qiiOwTH9cwAHS/Xoq9wOoSV1QQ3tnXQQTJcRFhL4gVD0qTbTVw+mPvMiqcz5Z8eckOGc8iYjyg6LKXNNpSeLnbocreZtul9sI+kLTl2kKKinEiTIsSSWllTJyOGEGsuB75htwJfrUkiS29RQEibB/YzUz59lK3N153Q==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=azXQHDeLT3IQhhaM7354u3btLbHUYqX32De3yiYpcvxhpPykZcnhfHCbJDyXGQHFY6zNfx80tQE6MuCZ/ZN3T/iqb+RwP2x27LZ7T2rmNkC7i/y79PCqJGmAxssGBqqhS73n29FRWP6OehM0/X9V72eDTiMt1IIjvHIUSXLC6cV+ej8BWswis5pypt4clEY5kbuyd4b4EaT2dfUoLMmyoXlcUOUvCIlEl59RqJlibW/NXs26iWwFbWp/GJBJBMc3Ze7x5QLLwo27dhMugTnWayjcG0bcjOlqjZfDaTYE4iwmdJLURypx9oSOhJb3ZZIE0NKIt/Mlr6EH4LheagauFw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QDszsQx0DlIJhXd03bade6ElWyYBffFN7Ljt4Hn/VT/JObvS4STYAWOqlHPTGElvRatPen6StARMEh55d6h3uNRLRvom1rXyW9Fa5YTKRvJ2/B9aWLi6KtnqLAmrsE2moyKUYibfjtidxvaOLvbe45GgJjd7tjOpj4Lg3KSJqdqF/sDBg30ZkdiGaXWeUWrKYvDcc8D7kSamwR87bWI6kYyNNsbP48F9pSEi3ZbtlZwJgnDRofPH3F7S68RjAZmKxyl39Z2uzS5XYAbzaUVbe/5SA8k1571p5HYiMbuiw+/Q8nzVsZlJvRoXl87JRyaTQEURVdoWaYkCLIz0qymL7Q==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 07 Mar 2025 11:24:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHbjzbI53lezYd1hUSXD4RbGtfICrNnYsoAgAAC7ICAAAdSgIAAGzEA
  • Thread-topic: [PATCH v4 1/2] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH

Hi Jan,

>>>> +
>>>> +static inline int iommu_domain_init(struct domain *d, unsigned int opts)
>>>> +{
>>>> +    /*
>>>> +     * Return as the real iommu_domain_init() would: Success when
>>>> +     * !is_iommu_enabled(), following from !iommu_enabled when 
>>>> !HAS_PASSTHROUGH
>>>> +     */
>>>> +    return 0;
>>>> +}
>>>> +
>>>> +static inline void iommu_hwdom_init(struct domain *d) {}
>>>> +
>>>> +static inline void iommu_domain_destroy(struct domain *d) {}
>>>> +
>>>> +#endif /* HAS_PASSTHROUGH */
>>>> +
>>>> /*
>>>>  * The following flags are passed to map (applicable ones also to unmap)
>>>>  * operations, while some are passed back by lookup operations.
>>>> @@ -209,6 +233,8 @@ struct msi_msg;
>>>> #ifdef CONFIG_HAS_DEVICE_TREE
>>>> #include <xen/device_tree.h>
>>>> +#ifdef CONFIG_HAS_PASSTHROUGH
>>>> +
>>>> int iommu_assign_dt_device(struct domain *d, struct dt_device_node *dev);
>>>> int iommu_deassign_dt_device(struct domain *d, struct dt_device_node *dev);
>>>> int iommu_dt_domain_init(struct domain *d);
>>>> @@ -238,6 +264,26 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, 
>>>> struct domain *d,
>>>>  */
>>>> int iommu_remove_dt_device(struct dt_device_node *np);
>>>> +#else
>>>> +
>>>> +static inline int iommu_assign_dt_device(struct domain *d,
>>>> +                                         struct dt_device_node *dev)
>>>> +{
>>>> +    return -EINVAL;
>>>> +}
>>>> +
>>>> +static inline int iommu_add_dt_device(struct dt_device_node *np)
>>>> +{
>>>> +    return 1;
>>> 
>>> I would suggest to add a comment explain what 1 means. IIRC, this means "no 
>>> iommu" present.
>> 
>> Would it be ok something like in iommu_domain_init:
>> 
>> /*
>> * Returns as the real iommu_add_dt_device() would: Error “no iommu" because
>> * !iommu_enabled due to the fact that !HAS_PASSTHROUGH
>> */
> 
> We had been there before, hadn't we? Personally I find the suggested text
> hard to follow.

well, I’ve taken your suggestion for iommu_domain_init and adapted here, 
maybe the adaptation didn’t meet your criteria then :)

But ...

> How about
> 
>    /*
>     * !HAS_PASSTHROUGH => !iommu_enabled (see the non-stub
>     * iommu_add_dt_device())
>     */
> 
> If that's too terse, adding a few words should be fine.

as long as you are happy with that, I’m happy as well, please let me know
if you want a v5 with this or if you would do the modificaiton on commit.

Cheers,
Luca


 


Rackspace

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