From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Zhao Liu" <zhao1.liu@intel.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
qemu-devel <qemu-devel@nongnu.org>,
qemu-rust@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>
Date: Tue, 7 Jan 2025 17:43:01 +0100 [thread overview]
Message-ID: <9dff9882-01a0-43a2-987d-eea210e8cdbe@linaro.org> (raw)
In-Reply-To: <CABgObfaMja+D5NcCBp-AKUGgOgTR=uju93dyj57ZFAO+mUGUDA@mail.gmail.com>
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.
next prev parent reply other threads:[~2025-01-07 16:43 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 8:31 [PULL 00/41] Rust, qdev, target/i386 changes for 2024-12-19 Paolo Bonzini
2024-12-19 8:31 ` [PULL 01/41] migration: Constify migration_properties Paolo Bonzini
2024-12-19 8:31 ` [PULL 02/41] hw/ide: Constify sysbus_ahci_properties Paolo Bonzini
2024-12-19 8:31 ` [PULL 03/41] target/ppc: Remove empty property list Paolo Bonzini
2024-12-19 8:31 ` [PULL 04/41] target/s390x: Use s390x_cpu_properties for system mode only Paolo Bonzini
2024-12-19 8:31 ` [PULL 05/41] hw/pci-host/astro: Remove empty Property list Paolo Bonzini
2024-12-19 8:31 ` [PULL 06/41] hw/ppc: Only register spapr_nvdimm_properties if CONFIG_LIBPMEM Paolo Bonzini
2024-12-19 8:31 ` [PULL 07/41] hw/tricore: Remove empty Property lists Paolo Bonzini
2024-12-19 8:31 ` [PULL 08/41] hw/s390x: " Paolo Bonzini
2024-12-19 8:31 ` [PULL 09/41] hw/xen: " Paolo Bonzini
2024-12-19 8:31 ` [PULL 10/41] hw/sparc: " Paolo Bonzini
2024-12-19 8:31 ` [PULL 11/41] hw/virtio: " Paolo Bonzini
2024-12-19 8:31 ` [PULL 12/41] include/hw/qdev-core: Detect most empty Property lists at compile time Paolo Bonzini
2024-12-19 8:32 ` [PULL 13/41] hw/core: Introduce device_class_set_props_n Paolo Bonzini
2024-12-19 8:32 ` [PULL 14/41] migration: Use device_class_set_props_n Paolo Bonzini
2024-12-19 8:32 ` [PULL 15/41] hw/scsi/megasas: " Paolo Bonzini
2024-12-19 8:32 ` [PULL 16/41] hw/arm/armsse: " Paolo Bonzini
2024-12-19 8:32 ` [PULL 17/41] rust/qemu-api: " Paolo Bonzini
2024-12-19 8:32 ` [PULL 18/41] hw/core: Replace device_class_set_props with a macro Paolo Bonzini
2024-12-19 8:32 ` [PULL 19/41] target/riscv: Do not abuse DEFINE_PROP_END_OF_LIST Paolo Bonzini
2024-12-19 8:32 ` [PULL 20/41] include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST Paolo Bonzini
2024-12-19 8:32 ` [PULL 21/41] include/hw/qdev-properties: Shrink struct Property Paolo Bonzini
2024-12-19 8:32 ` [PULL 22/41] hw/core/qdev-properties: Constify Property argument to object_field_prop_ptr Paolo Bonzini
2024-12-19 8:32 ` [PULL 23/41] hw/core/qdev-properties: Constify Property argument to PropertyInfo.print Paolo Bonzini
2024-12-19 8:32 ` [PULL 24/41] Constify all opaque Property pointers Paolo Bonzini
2024-12-19 8:32 ` [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<> Paolo Bonzini
2025-01-02 17:04 ` Philippe Mathieu-Daudé
2025-01-03 9:02 ` Zhao Liu
2025-01-03 8:48 ` Philippe Mathieu-Daudé
2025-01-06 11:53 ` Paolo Bonzini
2025-01-06 13:32 ` Peter Maydell
2025-01-06 15:21 ` Paolo Bonzini
2025-01-07 15:55 ` Zhao Liu
2025-01-07 15:50 ` Philippe Mathieu-Daudé
2025-01-07 16:03 ` Paolo Bonzini
2025-01-07 16:24 ` Philippe Mathieu-Daudé
2025-01-07 16:29 ` Paolo Bonzini
2025-01-07 16:43 ` Philippe Mathieu-Daudé [this message]
2024-12-19 8:32 ` [PULL 26/41] rust: qom: add possibility of overriding unparent Paolo Bonzini
2024-12-19 8:32 ` [PULL 27/41] rust: rename qemu-api modules to follow C code a bit more Paolo Bonzini
2024-12-19 8:32 ` [PULL 28/41] rust: re-export C types from qemu-api submodules Paolo Bonzini
2024-12-19 8:32 ` [PULL 29/41] rust: tests: allow writing more than one test Paolo Bonzini
2024-12-19 8:32 ` [PULL 30/41] rust: qom: add casting functionality Paolo Bonzini
2024-12-19 8:32 ` [PULL 31/41] rust: qom: add initial subset of methods on Object Paolo Bonzini
2024-12-19 8:32 ` [PULL 32/41] rust: qemu-api: add a module to wrap functions and zero-sized closures Paolo Bonzini
2024-12-19 8:32 ` [PULL 33/41] kvm: consistently return 0/-errno from kvm_convert_memory Paolo Bonzini
2024-12-19 8:32 ` [PULL 34/41] target/i386: Reset TSCs of parked vCPUs too on VM reset Paolo Bonzini
2024-12-19 8:32 ` [PULL 35/41] rust: pl011: fix declaration of LineControl bits Paolo Bonzini
2024-12-19 8:32 ` [PULL 36/41] rust: pl011: match break logic of C version Paolo Bonzini
2024-12-19 8:32 ` [PULL 37/41] rust: pl011: always use reset() method on registers Paolo Bonzini
2024-12-19 8:32 ` [PULL 38/41] rust: pl011: fix break errors and definition of Data struct Paolo Bonzini
2024-12-19 8:32 ` [PULL 39/41] rust: pl011: extend registers to 32 bits Paolo Bonzini
2024-12-19 8:32 ` [PULL 40/41] rust: pl011: fix migration stream Paolo Bonzini
2024-12-19 8:32 ` [PULL 41/41] rust: pl011: simplify handling of the FIFO enabled bit in LCR Paolo Bonzini
2024-12-19 15:12 ` [PULL 00/41] Rust, qdev, target/i386 changes for 2024-12-19 Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9dff9882-01a0-43a2-987d-eea210e8cdbe@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).