[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassI
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<> |
Date: |
Tue, 7 Jan 2025 17:43:01 +0100 |
User-agent: |
Mozilla Thunderbird |
On 7/1/25 17:29, Paolo Bonzini wrote:
On Tue, Jan 7, 2025 at 5:24 PM Philippe Mathieu-Daudé <philmd@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.
OK, thanks for explaining.
So currently we can not implement any device requiring one of
these interfaces:
$ git grep -hwA1 INTERFACE_CHECK
31: INTERFACE_CHECK(void, obj, TYPE_RESETTABLE_INTERFACE);
--
12: INTERFACE_CHECK(AcpiDevAmlIf, (obj), TYPE_ACPI_DEV_AML_IF)
--
24: INTERFACE_CHECK(AcpiDeviceIf, (obj), \
25- TYPE_ACPI_DEVICE_IF)
--
16: INTERFACE_CHECK(ARMLinuxBootIf, (obj), TYPE_ARM_LINUX_BOOT_IF)
--
29: INTERFACE_CHECK(FWPathProvider, (obj), TYPE_FW_PATH_PROVIDER)
--
23: INTERFACE_CHECK(HotplugHandler, (obj), TYPE_HOTPLUG_HANDLER)
--
12: INTERFACE_CHECK(InterruptStatsProvider, (obj), \
13- TYPE_INTERRUPT_STATS_PROVIDER)
--
113: INTERFACE_CHECK(IPMIInterface, (obj), TYPE_IPMI_INTERFACE)
--
25: INTERFACE_CHECK(IsaDma, (obj), TYPE_ISADMA)
--
26: INTERFACE_CHECK(MemoryDeviceState, (obj), TYPE_MEMORY_DEVICE)
--
21: INTERFACE_CHECK(XlnxCfiIf, (obj), TYPE_XLNX_CFI_IF)
--
33: INTERFACE_CHECK(NMIState, (obj), TYPE_NMI)
--
30: INTERFACE_CHECK(PnvXScomInterface, (obj), TYPE_PNV_XSCOM_INTERFACE)
--
50: INTERFACE_CHECK(SpaprInterruptController, (obj), TYPE_SPAPR_INTC)
--
141: INTERFACE_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC)
--
156: INTERFACE_CHECK(XiveNotifier, (obj), TYPE_XIVE_NOTIFIER)
--
431: INTERFACE_CHECK(XivePresenter, (obj), TYPE_XIVE_PRESENTER)
--
463: INTERFACE_CHECK(XiveFabric, (obj), TYPE_XIVE_FABRIC)
--
38: INTERFACE_CHECK(Nvram, (obj), TYPE_NVRAM)
--
12: INTERFACE_CHECK(StreamSink, (obj), TYPE_STREAM_SINK)
--
20: INTERFACE_CHECK(VMStateIf, (obj), TYPE_VMSTATE_IF)
--
14: INTERFACE_CHECK(UserCreatable, (obj), \
15- TYPE_USER_CREATABLE)
--
35: INTERFACE_CHECK(TPMIf, (obj), TYPE_TPM_IF)
--
35: INTERFACE_CHECK(IDAUInterface, (obj), TYPE_IDAU_INTERFACE)
--
23: INTERFACE_CHECK(TestIf, (obj), TYPE_TEST_IF)
Not a big deal at this point, but just to keep it in mind.
Regards,
Phil.
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, (continued)
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, Zhao Liu, 2025/01/03
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, Paolo Bonzini, 2025/01/06
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, Peter Maydell, 2025/01/06
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, Paolo Bonzini, 2025/01/06
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, Zhao Liu, 2025/01/07
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, Philippe Mathieu-Daudé, 2025/01/07
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, Paolo Bonzini, 2025/01/07
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, Philippe Mathieu-Daudé, 2025/01/07
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>, Paolo Bonzini, 2025/01/07
- Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>,
Philippe Mathieu-Daudé <=