Re: [PATCH v7 3/4] iommufd: Add IOMMU_GET_HW_INFO

From: Nicolin Chen
Date: Tue Aug 15 2023 - 21:08:37 EST


On Tue, Aug 15, 2023 at 11:58:04AM -0700, Nicolin Chen wrote:
> On Tue, Aug 15, 2023 at 03:56:37PM -0300, Jason Gunthorpe wrote:
> > On Tue, Aug 15, 2023 at 11:53:26AM -0700, Nicolin Chen wrote:
> > > > ops = dev_iommu_ops(idev->dev);
> > > > if (!ops->hw_info) {
> > > > data = ops->hw_info(idev->dev, &data_len, &cmd->out_data_type);
> > >
> > > It should be:
> > > if (ops->hw_info) {
> >
> > Hmm, the test suite probably needs some more stuff then too since it
> > passed like that :)
>
> Ack. I will see what I can do.

It actually reports errors when hw_info is defined (and it would
get an IOMMU_HW_INFO_TYPE_NONE.

#ok 62 iommufd_ioas.two_mock_domain.ioas_area_auto_destroy
# # RUN iommufd_ioas.two_mock_domain.get_hw_info ...
# iommufd: iommufd_utils.h:368: _test_cmd_get_hw_info: Assertion `cmd.out_data_type == IOMMU_HW_INFO_TYPE_SELFTEST' failed.
# # get_hw_info: Test terminated by assertion

By removing mock_domain_hw_info() to test the other path, simply
there would be a kernel crash.

So, I think that we are fine.

Thanks
Nicolin