[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250224192327.GA3696814@ziepe.ca>
Date: Mon, 24 Feb 2025 15:23:27 -0400
From: Jason Gunthorpe <jgg@...pe.ca>
To: Baolu Lu <baolu.lu@...ux.intel.com>
Cc: Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Kevin Tian <kevin.tian@...el.com>,
Dave Jiang <dave.jiang@...el.com>, Vinod Koul <vkoul@...nel.org>,
Zhangfei Gao <zhangfei.gao@...aro.org>,
Zhou Wang <wangzhou1@...ilicon.com>, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 08/12] iommufd/selftest: Put iopf enablement in domain
attach path
On Sat, Feb 22, 2025 at 03:25:43PM +0800, Baolu Lu wrote:
> On 2/21/25 23:04, Jason Gunthorpe wrote:
> > > - return mock_dev_enable_iopf(dev, domain);
> > > + if (mdev->domain)
> > > + mock_dev_disable_iopf(dev, mdev->domain);
> > > +
> > > + ret = mock_dev_enable_iopf(dev, domain);
> > > + if (ret)
> > Though here the domain is disabled but not removed from mdev->domain,
> > is it OK?
>
> That's not okay. I can make it like below:
>
> static int mock_domain_nop_attach(struct iommu_domain *domain,
> struct device *dev)
> {
> struct mock_dev *mdev = to_mock_dev(dev);
> int ret;
>
> if (domain->dirty_ops && (mdev->flags & MOCK_FLAGS_DEVICE_NO_DIRTY))
> return -EINVAL;
>
> ret = mock_dev_enable_iopf(dev, domain);
> if (ret)
> return ret;
>
> mock_dev_disable_iopf(dev, mdev->domain);
> mdev->domain = domain;
>
> return 0;
> }
>
> Both mock_dev_enable/disable_iopf() will be a no-op if domain or
> domain's iopf handler is empty:
>
> if (!domain || !domain->iopf_handler)
> return;
>
> Does it work for you?
Yeah that looks Ok
Jason
Powered by blists - more mailing lists