RE: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-12 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Sunday, September 11, 2022 7:36 AM > > On Thu, Sep 08, 2022 at 09:08:38AM -0300, Jason Gunthorpe wrote: > > On Thu, Sep 08, 2022 at 09:30:57AM +, Tian, Kevin wrote: > > > > There are also cases where common kAPIs are called in the attach > > > path which may

RE: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-12 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Friday, September 9, 2022 8:08 PM > > > > As discussed in a side thread a note might be added to exempt calling > > kAPI outside of the iommu driver. > > Sadly, not really.. The driver is responsible to santize this if it is > relevant. It is the main downside

RE: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-08 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Friday, September 9, 2022 11:17 AM > > On Thu, Sep 08, 2022 at 01:14:42PM -0300, Jason Gunthorpe wrote: > > > > I am wondering if this can be solved by better defining what the return > > > codes mean and adjust the call-back functions to match the definition. > > >

Re: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-08 Thread Joerg Roedel
On Wed, Sep 07, 2022 at 02:10:33PM -0300, Jason Gunthorpe wrote: > Sure, rust has all sorts of nice things. But the kernel doesn't follow > rust idioms, and I don't think this is a great place to start > experimenting with them. It is actually a great place to start experimenting. The IOMMU

Re: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-08 Thread Robin Murphy
On 2022-09-08 01:43, Jason Gunthorpe wrote: On Wed, Sep 07, 2022 at 08:41:13PM +0100, Robin Murphy wrote: FWIW, we're now very close to being able to validate dev->iommu against where the domain came from in core code, and so short-circuit ->attach_dev entirely if they don't match. I don't

RE: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-08 Thread Tian, Kevin
> From: Tian, Kevin > Sent: Thursday, September 8, 2022 5:31 PM > > This mixture of error codes is the basic reason why a new code was > > used, because none of the existing codes are used with any > > consistency. > > btw I saw the policy for -EBUSY is also not consistent in this series. > >

RE: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-08 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Thursday, September 8, 2022 8:43 AM > > On Wed, Sep 07, 2022 at 08:41:13PM +0100, Robin Murphy wrote: > > > Again, not what I was suggesting. In fact the nature of > iommu_attach_group() > > already rules out bogus devices getting this far, so all a driver

Re: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-07 Thread Robin Murphy
On 2022-09-07 18:00, Jason Gunthorpe wrote: On Wed, Sep 07, 2022 at 03:23:09PM +0100, Robin Murphy wrote: On 2022-09-07 14:47, Jason Gunthorpe wrote: On Wed, Sep 07, 2022 at 02:41:54PM +0200, Joerg Roedel wrote: On Mon, Aug 15, 2022 at 11:14:33AM -0700, Nicolin Chen wrote: Provide a

Re: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-07 Thread Robin Murphy
On 2022-09-07 14:47, Jason Gunthorpe wrote: On Wed, Sep 07, 2022 at 02:41:54PM +0200, Joerg Roedel wrote: On Mon, Aug 15, 2022 at 11:14:33AM -0700, Nicolin Chen wrote: Provide a dedicated errno from the IOMMU driver during attach that the reason attached failed is because of domain

Re: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-07 Thread Joerg Roedel
On Wed, Sep 07, 2022 at 10:47:39AM -0300, Jason Gunthorpe wrote: > Would you be happier if we wrote it like > > #define IOMMU_EINCOMPATIBLE_DEVICE xx > > Which tells "which of the function parameters is actually invalid" ? Having done some Rust hacking in the last months, I have to say I like

Re: [PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-09-07 Thread Joerg Roedel
On Mon, Aug 15, 2022 at 11:14:33AM -0700, Nicolin Chen wrote: > Provide a dedicated errno from the IOMMU driver during attach that the > reason attached failed is because of domain incompatability. EMEDIUMTYPE > is chosen because it is never used within the iommu subsystem today and > evokes a