On Tue, Jan 7, 2025 at 5:24 PM Philippe Mathieu-Daudé <phi...@linaro.org> wrote: > > but I don't really like the two parameters and also I don't like that > > class_init is called differently for classes and interfaces. It's > > probably possible to design a better API, but I didn't spend too much > > time on it because it may require rethinking how classes are declared > > (not a huge deal, as we have only four of them). > > Are you saying this is not a problem related to QDev Reset, but > a limitation with any QOM interface, and we can not instantiate > any type implementing TYPE_INTERFACE? As in: > > .interfaces = (InterfaceInfo[]) { > ... > },
So far there was no need for that, so it is not implemented. There are three parts: 1) adding interfaces to the TypeInfo 2) filling in vtables for the interfaces 3) filling in the ResettableClass vtable based on a trait None of these is supported by Rust code right now, but only (2) and (3) are needed for qdev reset. That's because the Resettable interface is declared in DeviceState rather than in the individual devices. (2) boils down to wrapping object_class_dynamic_cast into a nice-enough API. The commit that I added to rust-next covers that and it should work, but the API is a bit unorthogonal. Paolo