Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] iommufd: Fail replace if device has not been attached" failed to apply to 6.14-stable tree
@ 2025-04-17 11:42 gregkh
  2025-04-17 12:52 ` Yi Liu
  0 siblings, 1 reply; 6+ messages in thread
From: gregkh @ 2025-04-17 11:42 UTC (permalink / raw)
  To: yi.l.liu, jgg, kevin.tian; +Cc: stable


The patch below does not apply to the 6.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.14.y
git checkout FETCH_HEAD
git cherry-pick -x 55c85fa7579dc2e3f5399ef5bad67a44257c1a48
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025041759-knee-unearned-530e@gregkh' --subject-prefix 'PATCH 6.14.y' HEAD^..

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 55c85fa7579dc2e3f5399ef5bad67a44257c1a48 Mon Sep 17 00:00:00 2001
From: Yi Liu <yi.l.liu@intel.com>
Date: Wed, 5 Mar 2025 19:48:42 -0800
Subject: [PATCH] iommufd: Fail replace if device has not been attached

The current implementation of iommufd_device_do_replace() implicitly
assumes that the input device has already been attached. However, there
is no explicit check to verify this assumption. If another device within
the same group has been attached, the replace operation might succeed,
but the input device itself may not have been attached yet.

As a result, the input device might not be tracked in the
igroup->device_list, and its reserved IOVA might not be added. Despite
this, the caller might incorrectly assume that the device has been
successfully replaced, which could lead to unexpected behavior or errors.

To address this issue, add a check to ensure that the input device has
been attached before proceeding with the replace operation. This check
will help maintain the integrity of the device tracking system and prevent
potential issues arising from incorrect assumptions about the device's
attachment status.

Fixes: e88d4ec154a8 ("iommufd: Add iommufd_device_replace()")
Link: https://patch.msgid.link/r/20250306034842.5950-1-yi.l.liu@intel.com
Cc: stable@vger.kernel.org
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index b2f0cb909e6d..bd50146e2ad0 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -471,6 +471,17 @@ iommufd_device_attach_reserved_iova(struct iommufd_device *idev,
 
 /* The device attach/detach/replace helpers for attach_handle */
 
+/* Check if idev is attached to igroup->hwpt */
+static bool iommufd_device_is_attached(struct iommufd_device *idev)
+{
+	struct iommufd_device *cur;
+
+	list_for_each_entry(cur, &idev->igroup->device_list, group_item)
+		if (cur == idev)
+			return true;
+	return false;
+}
+
 static int iommufd_hwpt_attach_device(struct iommufd_hw_pagetable *hwpt,
 				      struct iommufd_device *idev)
 {
@@ -710,6 +721,11 @@ iommufd_device_do_replace(struct iommufd_device *idev,
 		goto err_unlock;
 	}
 
+	if (!iommufd_device_is_attached(idev)) {
+		rc = -EINVAL;
+		goto err_unlock;
+	}
+
 	if (hwpt == igroup->hwpt) {
 		mutex_unlock(&idev->igroup->lock);
 		return NULL;


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: FAILED: patch "[PATCH] iommufd: Fail replace if device has not been attached" failed to apply to 6.14-stable tree
  2025-04-17 11:42 FAILED: patch "[PATCH] iommufd: Fail replace if device has not been attached" failed to apply to 6.14-stable tree gregkh
@ 2025-04-17 12:52 ` Yi Liu
  2025-04-17 14:12   ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Yi Liu @ 2025-04-17 12:52 UTC (permalink / raw)
  To: gregkh, jgg, kevin.tian; +Cc: stable

On 2025/4/17 19:42, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 6.14-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
> 
> To reproduce the conflict and resubmit, you may use the following commands:
> 
> git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.14.y
> git checkout FETCH_HEAD
> git cherry-pick -x 55c85fa7579dc2e3f5399ef5bad67a44257c1a48
> # <resolve conflicts, build, test, etc.>
> git commit -s
> git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025041759-knee-unearned-530e@gregkh' --subject-prefix 'PATCH 6.14.y' HEAD^..
> 
> Possible dependencies:

I think the possible dependency is the below commit. This patch adds a
helper before iommufd_hwpt_attach_device() which is added by below commit.

commit fb21b1568adaa76af7a8c853f37c60fba8b28661
Author: Nicolin Chen <nicolinc@nvidia.com>
Date:   Mon Feb 3 21:00:54 2025 -0800

     iommufd: Make attach_handle generic than fault specific

     "attach_handle" was added exclusively for the iommufd_fault_iopf_handler()
     used by IOPF/PRI use cases. Now, both the MSI and PASID series require to
     reuse the attach_handle for non-fault cases.

     Add a set of new attach/detach/replace helpers that does the attach_handle
     allocation/releasing/replacement in the common path and also handles those
     fault specific routines such as iopf enabling/disabling and auto response.

     This covers both non-fault and fault cases in a clean way, replacing those
     inline helpers in the header. The following patch will clean up those old
     helpers in the fault.c file.

     Link: 
https://patch.msgid.link/r/32687df01c02291d89986a9fca897bbbe2b10987.1738645017.git.nicolinc@nvidia.com
     Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
     Reviewed-by: Yi Liu <yi.l.liu@intel.com>
     Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index dfd0898fb6c1..0786290b4056 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -352,6 +352,111 @@ iommufd_device_attach_reserved_iova(struct 
iommufd_device *idev,
         return 0;
  }

+/* The device attach/detach/replace helpers for attach_handle */
+
+static int iommufd_hwpt_attach_device(struct iommufd_hw_pagetable *hwpt,
+                                     struct iommufd_device *idev)
+{
+       struct iommufd_attach_handle *handle;
+       int rc;
+
+       lockdep_assert_held(&idev->igroup->lock);


@Greg, anything I need to do here?

Regards,
Yi Liu

> 
> 
> thanks,
> 
> greg k-h
> 
> ------------------ original commit in Linus's tree ------------------
> 
>  From 55c85fa7579dc2e3f5399ef5bad67a44257c1a48 Mon Sep 17 00:00:00 2001
> From: Yi Liu <yi.l.liu@intel.com>
> Date: Wed, 5 Mar 2025 19:48:42 -0800
> Subject: [PATCH] iommufd: Fail replace if device has not been attached
> 
> The current implementation of iommufd_device_do_replace() implicitly
> assumes that the input device has already been attached. However, there
> is no explicit check to verify this assumption. If another device within
> the same group has been attached, the replace operation might succeed,
> but the input device itself may not have been attached yet.
> 
> As a result, the input device might not be tracked in the
> igroup->device_list, and its reserved IOVA might not be added. Despite
> this, the caller might incorrectly assume that the device has been
> successfully replaced, which could lead to unexpected behavior or errors.
> 
> To address this issue, add a check to ensure that the input device has
> been attached before proceeding with the replace operation. This check
> will help maintain the integrity of the device tracking system and prevent
> potential issues arising from incorrect assumptions about the device's
> attachment status.
> 
> Fixes: e88d4ec154a8 ("iommufd: Add iommufd_device_replace()")
> Link: https://patch.msgid.link/r/20250306034842.5950-1-yi.l.liu@intel.com
> Cc: stable@vger.kernel.org
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> 
> diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> index b2f0cb909e6d..bd50146e2ad0 100644
> --- a/drivers/iommu/iommufd/device.c
> +++ b/drivers/iommu/iommufd/device.c
> @@ -471,6 +471,17 @@ iommufd_device_attach_reserved_iova(struct iommufd_device *idev,
>   
>   /* The device attach/detach/replace helpers for attach_handle */
>   
> +/* Check if idev is attached to igroup->hwpt */
> +static bool iommufd_device_is_attached(struct iommufd_device *idev)
> +{
> +	struct iommufd_device *cur;
> +
> +	list_for_each_entry(cur, &idev->igroup->device_list, group_item)
> +		if (cur == idev)
> +			return true;
> +	return false;
> +}
> +
>   static int iommufd_hwpt_attach_device(struct iommufd_hw_pagetable *hwpt,
>   				      struct iommufd_device *idev)
>   {
> @@ -710,6 +721,11 @@ iommufd_device_do_replace(struct iommufd_device *idev,
>   		goto err_unlock;
>   	}
>   
> +	if (!iommufd_device_is_attached(idev)) {
> +		rc = -EINVAL;
> +		goto err_unlock;
> +	}
> +
>   	if (hwpt == igroup->hwpt) {
>   		mutex_unlock(&idev->igroup->lock);
>   		return NULL;
> 

-- 
Regards,
Yi Liu

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: FAILED: patch "[PATCH] iommufd: Fail replace if device has not been attached" failed to apply to 6.14-stable tree
  2025-04-17 12:52 ` Yi Liu
@ 2025-04-17 14:12   ` Greg KH
  2025-04-17 14:21     ` Yi Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2025-04-17 14:12 UTC (permalink / raw)
  To: Yi Liu; +Cc: jgg, kevin.tian, stable

On Thu, Apr 17, 2025 at 08:52:16PM +0800, Yi Liu wrote:
> On 2025/4/17 19:42, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 6.14-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> > 
> > To reproduce the conflict and resubmit, you may use the following commands:
> > 
> > git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.14.y
> > git checkout FETCH_HEAD
> > git cherry-pick -x 55c85fa7579dc2e3f5399ef5bad67a44257c1a48
> > # <resolve conflicts, build, test, etc.>
> > git commit -s
> > git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025041759-knee-unearned-530e@gregkh' --subject-prefix 'PATCH 6.14.y' HEAD^..
> > 
> > Possible dependencies:
> 
> I think the possible dependency is the below commit. This patch adds a
> helper before iommufd_hwpt_attach_device() which is added by below commit.
> 
> commit fb21b1568adaa76af7a8c853f37c60fba8b28661
> Author: Nicolin Chen <nicolinc@nvidia.com>
> Date:   Mon Feb 3 21:00:54 2025 -0800
> 
>     iommufd: Make attach_handle generic than fault specific
> 
>     "attach_handle" was added exclusively for the iommufd_fault_iopf_handler()
>     used by IOPF/PRI use cases. Now, both the MSI and PASID series require to
>     reuse the attach_handle for non-fault cases.
> 
>     Add a set of new attach/detach/replace helpers that does the attach_handle
>     allocation/releasing/replacement in the common path and also handles those
>     fault specific routines such as iopf enabling/disabling and auto response.
> 
>     This covers both non-fault and fault cases in a clean way, replacing those
>     inline helpers in the header. The following patch will clean up those old
>     helpers in the fault.c file.
> 
>     Link: https://patch.msgid.link/r/32687df01c02291d89986a9fca897bbbe2b10987.1738645017.git.nicolinc@nvidia.com
>     Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
>     Reviewed-by: Yi Liu <yi.l.liu@intel.com>
>     Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> 
> diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> index dfd0898fb6c1..0786290b4056 100644
> --- a/drivers/iommu/iommufd/device.c
> +++ b/drivers/iommu/iommufd/device.c
> @@ -352,6 +352,111 @@ iommufd_device_attach_reserved_iova(struct
> iommufd_device *idev,
>         return 0;
>  }
> 
> +/* The device attach/detach/replace helpers for attach_handle */
> +
> +static int iommufd_hwpt_attach_device(struct iommufd_hw_pagetable *hwpt,
> +                                     struct iommufd_device *idev)
> +{
> +       struct iommufd_attach_handle *handle;
> +       int rc;
> +
> +       lockdep_assert_held(&idev->igroup->lock);
> 
> 
> @Greg, anything I need to do here?

That should be it, thanks!

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: FAILED: patch "[PATCH] iommufd: Fail replace if device has not been attached" failed to apply to 6.14-stable tree
  2025-04-17 14:12   ` Greg KH
@ 2025-04-17 14:21     ` Yi Liu
  2025-04-17 14:29       ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Yi Liu @ 2025-04-17 14:21 UTC (permalink / raw)
  To: Greg KH; +Cc: jgg, kevin.tian, stable

On 2025/4/17 22:12, Greg KH wrote:
> On Thu, Apr 17, 2025 at 08:52:16PM +0800, Yi Liu wrote:
>> On 2025/4/17 19:42, gregkh@linuxfoundation.org wrote:
>>>
>>> The patch below does not apply to the 6.14-stable tree.
>>> If someone wants it applied there, or to any other stable or longterm
>>> tree, then please email the backport, including the original git commit
>>> id to <stable@vger.kernel.org>.
>>>
>>> To reproduce the conflict and resubmit, you may use the following commands:
>>>
>>> git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.14.y
>>> git checkout FETCH_HEAD
>>> git cherry-pick -x 55c85fa7579dc2e3f5399ef5bad67a44257c1a48
>>> # <resolve conflicts, build, test, etc.>
>>> git commit -s
>>> git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025041759-knee-unearned-530e@gregkh' --subject-prefix 'PATCH 6.14.y' HEAD^..
>>>
>>> Possible dependencies:
>>
>> I think the possible dependency is the below commit. This patch adds a
>> helper before iommufd_hwpt_attach_device() which is added by below commit.
>>
>> commit fb21b1568adaa76af7a8c853f37c60fba8b28661
>> Author: Nicolin Chen <nicolinc@nvidia.com>
>> Date:   Mon Feb 3 21:00:54 2025 -0800
>>
>>      iommufd: Make attach_handle generic than fault specific
>>
>>      "attach_handle" was added exclusively for the iommufd_fault_iopf_handler()
>>      used by IOPF/PRI use cases. Now, both the MSI and PASID series require to
>>      reuse the attach_handle for non-fault cases.
>>
>>      Add a set of new attach/detach/replace helpers that does the attach_handle
>>      allocation/releasing/replacement in the common path and also handles those
>>      fault specific routines such as iopf enabling/disabling and auto response.
>>
>>      This covers both non-fault and fault cases in a clean way, replacing those
>>      inline helpers in the header. The following patch will clean up those old
>>      helpers in the fault.c file.
>>
>>      Link: https://patch.msgid.link/r/32687df01c02291d89986a9fca897bbbe2b10987.1738645017.git.nicolinc@nvidia.com
>>      Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
>>      Reviewed-by: Yi Liu <yi.l.liu@intel.com>
>>      Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
>>
>> diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
>> index dfd0898fb6c1..0786290b4056 100644
>> --- a/drivers/iommu/iommufd/device.c
>> +++ b/drivers/iommu/iommufd/device.c
>> @@ -352,6 +352,111 @@ iommufd_device_attach_reserved_iova(struct
>> iommufd_device *idev,
>>          return 0;
>>   }
>>
>> +/* The device attach/detach/replace helpers for attach_handle */
>> +
>> +static int iommufd_hwpt_attach_device(struct iommufd_hw_pagetable *hwpt,
>> +                                     struct iommufd_device *idev)
>> +{
>> +       struct iommufd_attach_handle *handle;
>> +       int rc;
>> +
>> +       lockdep_assert_held(&idev->igroup->lock);
>>
>>
>> @Greg, anything I need to do here?
> 
> That should be it, thanks!
> 


you are welcome. For 6.6, it might be difficult to apply all dependencies.
I've posted a patch based on 6.6. Please let me know if it is not preferred.

-- 
Regards,
Yi Liu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: FAILED: patch "[PATCH] iommufd: Fail replace if device has not been attached" failed to apply to 6.14-stable tree
  2025-04-17 14:21     ` Yi Liu
@ 2025-04-17 14:29       ` Greg KH
  2025-04-17 14:54         ` Yi Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2025-04-17 14:29 UTC (permalink / raw)
  To: Yi Liu; +Cc: jgg, kevin.tian, stable

On Thu, Apr 17, 2025 at 10:21:51PM +0800, Yi Liu wrote:
> On 2025/4/17 22:12, Greg KH wrote:
> > On Thu, Apr 17, 2025 at 08:52:16PM +0800, Yi Liu wrote:
> > > On 2025/4/17 19:42, gregkh@linuxfoundation.org wrote:
> > > > 
> > > > The patch below does not apply to the 6.14-stable tree.
> > > > If someone wants it applied there, or to any other stable or longterm
> > > > tree, then please email the backport, including the original git commit
> > > > id to <stable@vger.kernel.org>.
> > > > 
> > > > To reproduce the conflict and resubmit, you may use the following commands:
> > > > 
> > > > git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.14.y
> > > > git checkout FETCH_HEAD
> > > > git cherry-pick -x 55c85fa7579dc2e3f5399ef5bad67a44257c1a48
> > > > # <resolve conflicts, build, test, etc.>
> > > > git commit -s
> > > > git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025041759-knee-unearned-530e@gregkh' --subject-prefix 'PATCH 6.14.y' HEAD^..
> > > > 
> > > > Possible dependencies:
> > > 
> > > I think the possible dependency is the below commit. This patch adds a
> > > helper before iommufd_hwpt_attach_device() which is added by below commit.
> > > 
> > > commit fb21b1568adaa76af7a8c853f37c60fba8b28661
> > > Author: Nicolin Chen <nicolinc@nvidia.com>
> > > Date:   Mon Feb 3 21:00:54 2025 -0800
> > > 
> > >      iommufd: Make attach_handle generic than fault specific
> > > 
> > >      "attach_handle" was added exclusively for the iommufd_fault_iopf_handler()
> > >      used by IOPF/PRI use cases. Now, both the MSI and PASID series require to
> > >      reuse the attach_handle for non-fault cases.
> > > 
> > >      Add a set of new attach/detach/replace helpers that does the attach_handle
> > >      allocation/releasing/replacement in the common path and also handles those
> > >      fault specific routines such as iopf enabling/disabling and auto response.
> > > 
> > >      This covers both non-fault and fault cases in a clean way, replacing those
> > >      inline helpers in the header. The following patch will clean up those old
> > >      helpers in the fault.c file.
> > > 
> > >      Link: https://patch.msgid.link/r/32687df01c02291d89986a9fca897bbbe2b10987.1738645017.git.nicolinc@nvidia.com
> > >      Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> > >      Reviewed-by: Yi Liu <yi.l.liu@intel.com>
> > >      Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > > 
> > > diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> > > index dfd0898fb6c1..0786290b4056 100644
> > > --- a/drivers/iommu/iommufd/device.c
> > > +++ b/drivers/iommu/iommufd/device.c
> > > @@ -352,6 +352,111 @@ iommufd_device_attach_reserved_iova(struct
> > > iommufd_device *idev,
> > >          return 0;
> > >   }
> > > 
> > > +/* The device attach/detach/replace helpers for attach_handle */
> > > +
> > > +static int iommufd_hwpt_attach_device(struct iommufd_hw_pagetable *hwpt,
> > > +                                     struct iommufd_device *idev)
> > > +{
> > > +       struct iommufd_attach_handle *handle;
> > > +       int rc;
> > > +
> > > +       lockdep_assert_held(&idev->igroup->lock);
> > > 
> > > 
> > > @Greg, anything I need to do here?
> > 
> > That should be it, thanks!
> > 
> 
> 
> you are welcome. For 6.6, it might be difficult to apply all dependencies.
> I've posted a patch based on 6.6. Please let me know if it is not preferred.

You forgot the git id in that commit :(

I fixed it up and took it now, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: FAILED: patch "[PATCH] iommufd: Fail replace if device has not been attached" failed to apply to 6.14-stable tree
  2025-04-17 14:29       ` Greg KH
@ 2025-04-17 14:54         ` Yi Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Yi Liu @ 2025-04-17 14:54 UTC (permalink / raw)
  To: Greg KH; +Cc: jgg, kevin.tian, stable

On 2025/4/17 22:29, Greg KH wrote:
> On Thu, Apr 17, 2025 at 10:21:51PM +0800, Yi Liu wrote:
>> On 2025/4/17 22:12, Greg KH wrote:
>>> On Thu, Apr 17, 2025 at 08:52:16PM +0800, Yi Liu wrote:
>>>> On 2025/4/17 19:42, gregkh@linuxfoundation.org wrote:
>>>>>
>>>>> The patch below does not apply to the 6.14-stable tree.
>>>>> If someone wants it applied there, or to any other stable or longterm
>>>>> tree, then please email the backport, including the original git commit
>>>>> id to <stable@vger.kernel.org>.
>>>>>
>>>>> To reproduce the conflict and resubmit, you may use the following commands:
>>>>>
>>>>> git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.14.y
>>>>> git checkout FETCH_HEAD
>>>>> git cherry-pick -x 55c85fa7579dc2e3f5399ef5bad67a44257c1a48
>>>>> # <resolve conflicts, build, test, etc.>
>>>>> git commit -s
>>>>> git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025041759-knee-unearned-530e@gregkh' --subject-prefix 'PATCH 6.14.y' HEAD^..
>>>>>
>>>>> Possible dependencies:
>>>>
>>>> I think the possible dependency is the below commit. This patch adds a
>>>> helper before iommufd_hwpt_attach_device() which is added by below commit.
>>>>
>>>> commit fb21b1568adaa76af7a8c853f37c60fba8b28661
>>>> Author: Nicolin Chen <nicolinc@nvidia.com>
>>>> Date:   Mon Feb 3 21:00:54 2025 -0800
>>>>
>>>>       iommufd: Make attach_handle generic than fault specific
>>>>
>>>>       "attach_handle" was added exclusively for the iommufd_fault_iopf_handler()
>>>>       used by IOPF/PRI use cases. Now, both the MSI and PASID series require to
>>>>       reuse the attach_handle for non-fault cases.
>>>>
>>>>       Add a set of new attach/detach/replace helpers that does the attach_handle
>>>>       allocation/releasing/replacement in the common path and also handles those
>>>>       fault specific routines such as iopf enabling/disabling and auto response.
>>>>
>>>>       This covers both non-fault and fault cases in a clean way, replacing those
>>>>       inline helpers in the header. The following patch will clean up those old
>>>>       helpers in the fault.c file.
>>>>
>>>>       Link: https://patch.msgid.link/r/32687df01c02291d89986a9fca897bbbe2b10987.1738645017.git.nicolinc@nvidia.com
>>>>       Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
>>>>       Reviewed-by: Yi Liu <yi.l.liu@intel.com>
>>>>       Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
>>>>
>>>> diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
>>>> index dfd0898fb6c1..0786290b4056 100644
>>>> --- a/drivers/iommu/iommufd/device.c
>>>> +++ b/drivers/iommu/iommufd/device.c
>>>> @@ -352,6 +352,111 @@ iommufd_device_attach_reserved_iova(struct
>>>> iommufd_device *idev,
>>>>           return 0;
>>>>    }
>>>>
>>>> +/* The device attach/detach/replace helpers for attach_handle */
>>>> +
>>>> +static int iommufd_hwpt_attach_device(struct iommufd_hw_pagetable *hwpt,
>>>> +                                     struct iommufd_device *idev)
>>>> +{
>>>> +       struct iommufd_attach_handle *handle;
>>>> +       int rc;
>>>> +
>>>> +       lockdep_assert_held(&idev->igroup->lock);
>>>>
>>>>
>>>> @Greg, anything I need to do here?
>>>
>>> That should be it, thanks!
>>>
>>
>>
>> you are welcome. For 6.6, it might be difficult to apply all dependencies.
>> I've posted a patch based on 6.6. Please let me know if it is not preferred.
> 
> You forgot the git id in that commit :(
> 
> I fixed it up and took it now, thanks.

oops, yes. I missed it. Thanks. Let me be careful next time. :)

-- 
Regards,
Yi Liu

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-17 14:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-17 11:42 FAILED: patch "[PATCH] iommufd: Fail replace if device has not been attached" failed to apply to 6.14-stable tree gregkh
2025-04-17 12:52 ` Yi Liu
2025-04-17 14:12   ` Greg KH
2025-04-17 14:21     ` Yi Liu
2025-04-17 14:29       ` Greg KH
2025-04-17 14:54         ` Yi Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox