Re: [RFC PATCH 05/13] iommufd: Serialise persisted iommufds and ioas

Jacob Pan
2024-10-16T22:20:56Z

Hi James,

On Mon, 16 Sep 2024 13:30:54 +0200
James Gowans <jgowans@amazon.com> wrote:

> +static int serialise_iommufd(void *fdt, struct iommufd_ctx *ictx)
> +{
> + int err = 0;
> + char name[24];
> + struct iommufd_object *obj;
> + unsigned long obj_idx;
> +
> + snprintf(name, sizeof(name), "%lu", ictx->persistent_id);
> + err |= fdt_begin_node(fdt, name);
> + err |= fdt_begin_node(fdt, "ioases");
> + xa_for_each(&ictx->objects, obj_idx, obj) {
> + struct iommufd_ioas *ioas;
> + struct iopt_area *area;
> + int area_idx = 0;
> +
> + if (obj->type != IOMMUFD_OBJ_IOAS)
> + continue;
I was wondering how device state persistency is managed here. Is it
correct to assume that all devices bound to an iommufd context should
be persistent? If so, should we be serializing IOMMUFD_OBJ_DEVICE as
well?

I'm considering this from the perspective of user mode drivers,
including those that use noiommu mode (need to be added to iommufd
cdev). In this scenario, we only need to maintain the device states
persistently without IOAS.