linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Pranjal Shrivastava <praan@google.com>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: jgg@nvidia.com, kevin.tian@intel.com, will@kernel.org,
	robin.murphy@arm.com, joro@8bytes.org, yi.l.liu@intel.com,
	peterz@infradead.org, jsnitsel@redhat.com,
	linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, patches@lists.linux.dev,
	baolu.lu@linux.intel.com
Subject: Re: [PATCH v2 05/14] iommufd: Return EOPNOTSUPP for failures due to driver bugs
Date: Mon, 16 Jun 2025 21:49:53 +0000	[thread overview]
Message-ID: <aFCRgUeP8NJ_f-Q9@google.com> (raw)
In-Reply-To: <623bb6f0e8fdd7b9c5745a2f99f280163f9f1f5a.1749882255.git.nicolinc@nvidia.com>

On Fri, Jun 13, 2025 at 11:35:17PM -0700, Nicolin Chen wrote:
> It's more accurate to report EOPNOTSUPP when an ioctl failed due to driver
> bug, since there is nothing wrong with the user space side.
> 
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
>  drivers/iommu/iommufd/device.c       | 2 +-
>  drivers/iommu/iommufd/hw_pagetable.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> index ed0dc539d490..e9b6ca47095c 100644
> --- a/drivers/iommu/iommufd/device.c
> +++ b/drivers/iommu/iommufd/device.c
> @@ -1483,7 +1483,7 @@ int iommufd_get_hw_info(struct iommufd_ucmd *ucmd)
>  		 */
>  		if (WARN_ON_ONCE(cmd->out_data_type ==
>  				 IOMMU_HW_INFO_TYPE_NONE)) {
> -			rc = -ENODEV;
> +			rc = -EOPNOTSUPP;
>  			goto out_free;
>  		}
>  	} else {
> diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c
> index 8565a6f596b2..fe789c2dc0c9 100644
> --- a/drivers/iommu/iommufd/hw_pagetable.c
> +++ b/drivers/iommu/iommufd/hw_pagetable.c
> @@ -264,7 +264,7 @@ iommufd_hwpt_nested_alloc(struct iommufd_ctx *ictx,
>  	hwpt->domain->cookie_type = IOMMU_COOKIE_IOMMUFD;
>  
>  	if (WARN_ON_ONCE(hwpt->domain->type != IOMMU_DOMAIN_NESTED)) {
> -		rc = -EINVAL;
> +		rc = -EOPNOTSUPP;
>  		goto out_abort;
>  	}
>  	return hwpt_nested;
> @@ -321,7 +321,7 @@ iommufd_viommu_alloc_hwpt_nested(struct iommufd_viommu *viommu, u32 flags,
>  	hwpt->domain->cookie_type = IOMMU_COOKIE_IOMMUFD;
>  
>  	if (WARN_ON_ONCE(hwpt->domain->type != IOMMU_DOMAIN_NESTED)) {
> -		rc = -EINVAL;
> +		rc = -EOPNOTSUPP;
>  		goto out_abort;
>  	}
>  	return hwpt_nested;

Much clearer retvals.
Reviewed-by: Pranjal Shrivastava <praan@google.com>

> -- 
> 2.43.0
> 


  parent reply	other threads:[~2025-06-16 21:59 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-14  6:35 [PATCH v2 00/14] iommufd: Prepare for IOMMUFD_OBJ_HW_QUEUE Nicolin Chen
2025-06-14  6:35 ` [PATCH v2 01/14] iommufd: Apply obvious cosmetic fixes Nicolin Chen
2025-06-16  3:23   ` Baolu Lu
2025-06-14  6:35 ` [PATCH v2 02/14] iommufd: Drop unused ictx in struct iommufd_vdevice Nicolin Chen
2025-06-16  3:23   ` Baolu Lu
2025-06-14  6:35 ` [PATCH v2 03/14] iommufd: Use enum iommu_viommu_type for type in struct iommufd_viommu Nicolin Chen
2025-06-16  3:24   ` Baolu Lu
2025-06-16 21:45   ` Pranjal Shrivastava
2025-06-14  6:35 ` [PATCH v2 04/14] iommufd: Use enum iommu_veventq_type for type in struct iommufd_veventq Nicolin Chen
2025-06-16  3:24   ` Baolu Lu
2025-06-16 21:47   ` Pranjal Shrivastava
2025-06-14  6:35 ` [PATCH v2 05/14] iommufd: Return EOPNOTSUPP for failures due to driver bugs Nicolin Chen
2025-06-16  3:25   ` Baolu Lu
2025-06-16 12:28   ` Jason Gunthorpe
2025-06-16 21:49   ` Pranjal Shrivastava [this message]
2025-06-19  5:40   ` Tian, Kevin
2025-06-14  6:35 ` [PATCH v2 06/14] iommu: Introduce get_viommu_size and viommu_init ops Nicolin Chen
2025-06-16  3:25   ` Baolu Lu
2025-06-16 12:43   ` Jason Gunthorpe
2025-06-16 22:10   ` Pranjal Shrivastava
2025-06-19  5:42   ` Tian, Kevin
2025-06-14  6:35 ` [PATCH v2 07/14] iommufd/viommu: Support " Nicolin Chen
2025-06-16  3:26   ` Baolu Lu
2025-06-16 12:45   ` Jason Gunthorpe
2025-06-19  5:45   ` Tian, Kevin
2025-06-14  6:35 ` [PATCH v2 08/14] iommufd/selftest: Drop parent domain from mock_iommu_domain_nested Nicolin Chen
2025-06-16 12:46   ` Jason Gunthorpe
2025-06-19  5:46   ` Tian, Kevin
2025-06-14  6:35 ` [PATCH v2 09/14] iommufd/selftest: Replace mock_viommu_alloc with mock_viommu_init Nicolin Chen
2025-06-16 12:46   ` Jason Gunthorpe
2025-06-14  6:35 ` [PATCH v2 10/14] iommu/arm-smmu-v3: Replace arm_vsmmu_alloc with arm_vsmmu_init Nicolin Chen
2025-06-16 10:03   ` Will Deacon
2025-06-16 12:49   ` Jason Gunthorpe
2025-06-16 22:43   ` Pranjal Shrivastava
2025-06-17  2:15     ` Nicolin Chen
2025-06-17  5:43       ` Pranjal Shrivastava
2025-06-14  6:35 ` [PATCH v2 11/14] iommu: Deprecate viommu_alloc op Nicolin Chen
2025-06-16  3:26   ` Baolu Lu
2025-06-16 12:49   ` Jason Gunthorpe
2025-06-16 22:46   ` Pranjal Shrivastava
2025-06-14  6:35 ` [PATCH v2 12/14] iommufd: Move _iommufd_object_alloc out of driver.c Nicolin Chen
2025-06-16  3:26   ` Baolu Lu
2025-06-14  6:35 ` [PATCH v2 13/14] iommufd: Introduce iommufd_object_alloc_ucmd helper Nicolin Chen
2025-06-16  3:27   ` Baolu Lu
2025-06-16 22:52   ` [PATCH v2 13/14] iommufd: Introduce iommufd_object_alloc_ucmd helpery Pranjal Shrivastava
2025-07-09  5:31   ` [PATCH v2 13/14] iommufd: Introduce iommufd_object_alloc_ucmd helper Xu Yilun
2025-07-10  5:32     ` Tian, Kevin
2025-07-10 18:21       ` Nicolin Chen
2025-06-14  6:35 ` [PATCH v2 14/14] iommufd: Apply the new " Nicolin Chen
2025-06-16  3:27   ` Baolu Lu
2025-06-19  5:49   ` Tian, Kevin
2025-06-19 18:46 ` [PATCH v2 00/14] iommufd: Prepare for IOMMUFD_OBJ_HW_QUEUE Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aFCRgUeP8NJ_f-Q9@google.com \
    --to=praan@google.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=jsnitsel@redhat.com \
    --cc=kevin.tian@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolinc@nvidia.com \
    --cc=patches@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).