[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZxachACC51yHqDme@Asurada-Nvidia>
Date: Mon, 21 Oct 2024 11:25:08 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Alexey Kardashevskiy <aik@....com>
CC: <jgg@...dia.com>, <kevin.tian@...el.com>, <will@...nel.org>,
<joro@...tes.org>, <suravee.suthikulpanit@....com>, <robin.murphy@....com>,
<dwmw2@...radead.org>, <baolu.lu@...ux.intel.com>, <shuah@...nel.org>,
<linux-kernel@...r.kernel.org>, <iommu@...ts.linux.dev>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kselftest@...r.kernel.org>,
<eric.auger@...hat.com>, <jean-philippe@...aro.org>, <mdf@...nel.org>,
<mshavit@...gle.com>, <shameerali.kolothum.thodi@...wei.com>,
<smostafa@...gle.com>, <yi.l.liu@...el.com>, <patches@...ts.linux.dev>
Subject: Re: [PATCH v3 09/11] iommufd/selftest: Add IOMMU_VIOMMU_ALLOC test
coverage
On Mon, Oct 21, 2024 at 07:30:57PM +1100, Alexey Kardashevskiy wrote:
> On 10/10/24 03:38, Nicolin Chen wrote:
> > Add a new iommufd_viommu FIXTURE and setup it up with a vIOMMU object.
> >
> > Any new vIOMMU feature will be added as a TEST_F under that.
> >
> > Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
> > ---
> > tools/testing/selftests/iommu/iommufd_utils.h | 28 +++++++
> > tools/testing/selftests/iommu/iommufd.c | 84 +++++++++++++++++++
> > 2 files changed, 112 insertions(+)
> >
> > diff --git a/tools/testing/selftests/iommu/iommufd_utils.h b/tools/testing/selftests/iommu/iommufd_utils.h
> > index 40f6f14ce136..307d097db9dd 100644
> > --- a/tools/testing/selftests/iommu/iommufd_utils.h
> > +++ b/tools/testing/selftests/iommu/iommufd_utils.h
> > @@ -762,3 +762,31 @@ static int _test_cmd_trigger_iopf(int fd, __u32 device_id, __u32 fault_fd)
> >
> > #define test_cmd_trigger_iopf(device_id, fault_fd) \
> > ASSERT_EQ(0, _test_cmd_trigger_iopf(self->fd, device_id, fault_fd))
> > +
> > +static int _test_cmd_viommu_alloc(int fd, __u32 device_id, __u32 hwpt_id,
> > + __u32 type, __u32 flags, __u32 *viommu_id)
> > +{
> > + struct iommu_viommu_alloc cmd = {
> > + .size = sizeof(cmd),
> > + .flags = flags,
> > + .type = type,
> > + .dev_id = device_id,
> > + .hwpt_id = hwpt_id,
> > + };
> > + int ret;
> > +
> > + ret = ioctl(fd, IOMMU_VIOMMU_ALLOC, &cmd);
> > + if (ret)
> > + return ret;
> > + if (viommu_id)
>
> "if" can be dropped as viommu_id is always non-null in this test. Thanks,
I will change those negative tests to pass in NULL then..
Thanks
Nicolin
Powered by blists - more mailing lists