Re: [RFC] /dev/ioasid uAPI proposal

From: Jason Wang
Date: Tue Jun 01 2021 - 01:10:48 EST



在 2021/6/1 下午12:27, Shenming Lu 写道:
On 2021/6/1 10:36, Jason Wang wrote:
在 2021/5/31 下�4:41, Liu Yi L 写�:
I guess VFIO_ATTACH_IOASID will fail if the underlayer doesn't support
hardware nesting. Or is there way to detect the capability before?
I think it could fail in the IOASID_CREATE_NESTING. If the gpa_ioasid
is not able to support nesting, then should fail it.

I think GET_INFO only works after the ATTACH.
yes. After attaching to gpa_ioasid, userspace could GET_INFO on the
gpa_ioasid and check if nesting is supported or not. right?

Some more questions:

1) Is the handle returned by IOASID_ALLOC an fd?
2) If yes, what's the reason for not simply use the fd opened from /dev/ioas. (This is the question that is not answered) and what happens if we call GET_INFO for the ioasid_fd?
3) If not, how GET_INFO work?
It seems that the return value from IOASID_ALLOC is an IOASID number in the
ioasid_data struct, then when calling GET_INFO, we should convey this IOASID
number to get the associated I/O address space attributes (depend on the
physical IOMMU, which could be discovered when attaching a device to the
IOASID fd or number), right?


Right, but the question is why need such indirection? Unless there's a case that you need to create multiple IOASIDs per ioasid fd. It's more simpler to attach the metadata into the ioasid fd itself.

Thanks



Thanks,
Shenming