hpet, rust: miscellaneous cleanup
cover hpet, rust: miscellaneous cleanup
Hi,
This series is very miscellaneous:
It contains both the follow-up cleanup for HPET and a collection of tiny patches that were previously missed.
Of this, I think Patch 3's commit message needs to be given a bit of attention, where I attached my understanding (based on [*]) in detail, in the hope that it can be confirmed or corrected. :-)
[*]: https://lore.kernel.org/qemu-devel/[email protected]/
Thanks and Best Regards,
Zhao
--
Zhao Liu (5):
hw/timer/hpet: Reorganize register decoding
hw/timer/hpet: Adjust num_timers in hpet_init()
rust/hpet: Drop BalCell wrapper for num_timers
rust: Fix Zhao's email address
rust: Fix the typos in doc
hw/timer/hpet.c | 177 ++++++++++++++------------- rust/hw/char/pl011/src/device.rs | 4 +- rust/hw/timer/hpet/src/fw_cfg.rs | 2 +- rust/hw/timer/hpet/src/hpet.rs | 39 +++--- rust/hw/timer/hpet/src/lib.rs | 2 +- rust/qemu-api/src/bitops.rs | 2 +- rust/qemu-api/src/qom.rs | 4 +- rust/qemu-api/src/timer.rs | 2 +- rust/qemu-api/src/vmstate.rs | 2 +- rust/qemu-api/tests/vmstate_tests.rs | 2 +- 10 files changed, 117 insertions(+), 119 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/5 hw/timer/hpet: Reorganize register decoding
For Rust HPET, since the commit 519088b7cf6d ("rust: hpet: decode HPET registers into enums"), it decodes register address by checking if the register belongs to global register space. And for C HPET, it checks timer register space first.
While both approaches are fine, it's best to be as consistent as possible.
Synchronize changes from the rust side to C side.
---
Picked from <[email protected]>. But because of Rust code base change, it's enough to just sync the changes.
--- hw/timer/hpet.c | 166 ++++++++++++++++++++++++------------------------ 1 file changed, 84 insertions(+), 82 deletions(-)
hw/timer/hpet.c +84 -82
@@ -426,30 +426,11 @@ static uint64_t hpet_ram_read(void *opaque, hwaddr addr,uint64_t cur_tick;trace_hpet_ram_read (addr); + addr &= ~4 ; -/*address range of all TN regs*/ -if (addr >=0x100 && addr <=0x3ff ) { -uint8_t timer_id = (addr -0x100 ) /0x20 ; -HPETTimer *timer = &s->timer[timer_id]; - -if (timer_id > s->num_timers) { -trace_hpet_timer_id_out_of_range (timer_id); -return 0 ; - } - -switch (addr &0x18 ) { -case HPET_TN_CFG :// including interrupt capabilities -return timer->config >> shift; -case HPET_TN_CMP :// comparator register -return timer->cmp >> shift; -case HPET_TN_ROUTE : -return timer->fsb >> shift; -default : -trace_hpet_ram_read_invalid (); -break ; - } - }else { -switch (addr & ~4 ) { +/*address range of all global regs*/ +if (addr <=0xff ) { +switch (addr) {case HPET_ID :// including HPET_PERIOD return s->capability >> shift;case HPET_CFG :
@@ -468,6 +449,26 @@ static uint64_t hpet_ram_read(void *opaque, hwaddr addr,trace_hpet_ram_read_invalid ();break ; } + }else { +uint8_t timer_id = (addr -0x100 ) /0x20 ; +HPETTimer *timer = &s->timer[timer_id]; + +if (timer_id > s->num_timers) { +trace_hpet_timer_id_out_of_range (timer_id); +return 0 ; + } + +switch (addr &0x1f ) { +case HPET_TN_CFG :// including interrupt capabilities +return timer->config >> shift; +case HPET_TN_CMP :// comparator register +return timer->cmp >> shift; +case HPET_TN_ROUTE : +return timer->fsb >> shift; +default : +trace_hpet_ram_read_invalid (); +break ; + } }return 0 ; }
@@ -482,9 +483,67 @@ static void hpet_ram_write(void *opaque, hwaddr addr,uint64_t old_val, new_val, cleared;trace_hpet_ram_write (addr, value); + addr &= ~4 ; -/*address range of all TN regs*/ -if (addr >=0x100 && addr <=0x3ff ) { +/*address range of all global regs*/ +if (addr <=0xff ) { +switch (addr) { +case HPET_ID : +return ; +case HPET_CFG : + old_val = s->config; + new_val =deposit64 (old_val, shift, len, value); + new_val =hpet_fixup_reg (new_val, old_val,HPET_CFG_WRITE_MASK ); + s->config = new_val; +if (activating_bit (old_val, new_val,HPET_CFG_ENABLE )) { +/* Enable main counter and interrupt generation. */ + s->hpet_offset = +ticks_to_ns (s->hpet_counter) -qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); +for (i =0 ; i < s->num_timers; i++) { +if (timer_enabled (&s->timer[i]) && (s->isr & (1 << i))) { +update_irq (&s->timer[i],1 ); + } +hpet_set_timer (&s->timer[i]); + } + }else if (deactivating_bit (old_val, new_val,HPET_CFG_ENABLE )) { +/* Halt main counter and disable interrupt generation. */ + s->hpet_counter =hpet_get_ticks (s); +for (i =0 ; i < s->num_timers; i++) { +hpet_del_timer (&s->timer[i]); + } + } +/* i8254 and RTC output pins are disabled +* when HPET is in legacy mode */ +if (activating_bit (old_val, new_val,HPET_CFG_LEGACY )) { +qemu_set_irq (s->pit_enabled,0 ); +qemu_irq_lower (s->irqs[0 ]); +qemu_irq_lower (s->irqs[RTC_ISA_IRQ ]); + }else if (deactivating_bit (old_val, new_val,HPET_CFG_LEGACY )) { +qemu_irq_lower (s->irqs[0 ]); +qemu_set_irq (s->pit_enabled,1 ); +qemu_set_irq (s->irqs[RTC_ISA_IRQ ], s->rtc_irq_level); + } +break ; +case HPET_STATUS : + new_val = value << shift; + cleared = new_val & s->isr; +for (i =0 ; i < s->num_timers; i++) { +if (cleared & (1 << i)) { +update_irq (&s->timer[i],0 ); + } + } +break ; +case HPET_COUNTER : +if (hpet_enabled (s)) { +trace_hpet_ram_write_counter_write_while_enabled (); + } + s->hpet_counter =deposit64 (s->hpet_counter, shift, len, value); +break ; +default : +trace_hpet_ram_write_invalid (); +break ; + } + }else {uint8_t timer_id = (addr -0x100 ) /0x20 ;HPETTimer *timer = &s->timer[timer_id];
@@ -550,63 +609,6 @@ static void hpet_ram_write(void *opaque, hwaddr addr,break ; }return ; - }else { -switch (addr & ~4 ) { -case HPET_ID : -return ; -case HPET_CFG : - old_val = s->config; - new_val =deposit64 (old_val, shift, len, value); - new_val =hpet_fixup_reg (new_val, old_val,HPET_CFG_WRITE_MASK ); - s->config = new_val; -if (activating_bit (old_val, new_val,HPET_CFG_ENABLE )) { -/* Enable main counter and interrupt generation. */ - s->hpet_offset = -ticks_to_ns (s->hpet_counter) -qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); -for (i =0 ; i < s->num_timers; i++) { -if (timer_enabled (&s->timer[i]) && (s->isr & (1 << i))) { -update_irq (&s->timer[i],1 ); - } -hpet_set_timer (&s->timer[i]); - } - }else if (deactivating_bit (old_val, new_val,HPET_CFG_ENABLE )) { -/* Halt main counter and disable interrupt generation. */ - s->hpet_counter =hpet_get_ticks (s); -for (i =0 ; i < s->num_timers; i++) { -hpet_del_timer (&s->timer[i]); - } - } -/* i8254 and RTC output pins are disabled -* when HPET is in legacy mode */ -if (activating_bit (old_val, new_val,HPET_CFG_LEGACY )) { -qemu_set_irq (s->pit_enabled,0 ); -qemu_irq_lower (s->irqs[0 ]); -qemu_irq_lower (s->irqs[RTC_ISA_IRQ ]); - }else if (deactivating_bit (old_val, new_val,HPET_CFG_LEGACY )) { -qemu_irq_lower (s->irqs[0 ]); -qemu_set_irq (s->pit_enabled,1 ); -qemu_set_irq (s->irqs[RTC_ISA_IRQ ], s->rtc_irq_level); - } -break ; -case HPET_STATUS : - new_val = value << shift; - cleared = new_val & s->isr; -for (i =0 ; i < s->num_timers; i++) { -if (cleared & (1 << i)) { -update_irq (&s->timer[i],0 ); - } - } -break ; -case HPET_COUNTER : -if (hpet_enabled (s)) { -trace_hpet_ram_write_counter_write_while_enabled (); - } - s->hpet_counter =deposit64 (s->hpet_counter, shift, len, value); -break ; -default : -trace_hpet_ram_write_invalid (); -break ; - } } }
Signature · 1 line
2.34.1
PATCH 2/5 hw/timer/hpet: Adjust num_timers in hpet_init()
In reply to Zhao LiuCurrently, HPET adjusts num_timers in hpet_realize(), and doesn't change it in any other place. And this field is initialized as a property.
Therefore, it's possible to move such adjustments to hept_init(), so that Rust side can synchronize this change.
Adjust num_timers in hpet_init().
--- hw/timer/hpet.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
hw/timer/hpet.c +6 -5
@@ -682,6 +682,12 @@ static void hpet_init(Object *obj)/* HPET Area */ memory_region_init_io (&s->iomem, obj, &hpet_ram_ops, s,"hpet" ,HPET_LEN );sysbus_init_mmio (sbd, &s->iomem); + +if (s->num_timers <HPET_MIN_TIMERS ) { + s->num_timers =HPET_MIN_TIMERS ; + }else if (s->num_timers >HPET_MAX_TIMERS ) { + s->num_timers =HPET_MAX_TIMERS ; + } }static void hpet_realize (DeviceState *dev,Error **errp)
@@ -710,11 +716,6 @@ static void hpet_realize(DeviceState *dev, Error **errp)sysbus_init_irq (sbd, &s->irqs[i]); } -if (s->num_timers <HPET_MIN_TIMERS ) { - s->num_timers =HPET_MIN_TIMERS ; - }else if (s->num_timers >HPET_MAX_TIMERS ) { - s->num_timers =HPET_MAX_TIMERS ; - }for (i =0 ; i <HPET_MAX_TIMERS ; i++) { timer = &s->timer[i]; timer->qemu_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , hpet_timer, timer);
Signature · 1 line
2.34.1
Re: [PATCH 2/5] hw/timer/hpet: Adjust num_timers in hpet_init()
Quoted 2 lines · Zhao Liu
Currently, HPET adjusts
num_timersinhpet_realize(), and doesn't change it in any other place. And this field is initialized as a property.
Properties are initialized *after* hpet_init. For hw/timer/hpet you can check s->num_timers and return an error if it's out of bounds, but for the Rust version we don't have Error** support yet. :(
Queued 1-4-5 for now.
Paolo
Quoted 39 lines
Therefore, it's possible to move such adjustments to
hept_init(), so that Rust side can synchronize this change.Adjust
num_timersinhpet_init().Signed-off-by Zhao Liu <[email protected]>--- hw/timer/hpet.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)hw/timer/hpet.c +6
-5@@ -682,6 +682,12 @@ static void hpet_init(Object *obj)/* HPET Area */ memory_region_init_io (&s->iomem, obj, &hpet_ram_ops, s,"hpet" ,HPET_LEN );sysbus_init_mmio (sbd, &s->iomem); + +if (s->num_timers <HPET_MIN_TIMERS ) { + s->num_timers =HPET_MIN_TIMERS ; + }else if (s->num_timers >HPET_MAX_TIMERS ) { + s->num_timers =HPET_MAX_TIMERS ; + } }static void hpet_realize (DeviceState *dev,Error **errp)@@ -710,11 +716,6 @@ static void hpet_realize(DeviceState *dev, Error **errp)sysbus_init_irq (sbd, &s->irqs[i]); } -if (s->num_timers <HPET_MIN_TIMERS ) { - s->num_timers =HPET_MIN_TIMERS ; - }else if (s->num_timers >HPET_MAX_TIMERS ) { - s->num_timers =HPET_MAX_TIMERS ; - }for (i =0 ; i <HPET_MAX_TIMERS ; i++) { timer = &s->timer[i]; timer->qemu_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , hpet_timer, timer);
Re: [PATCH 2/5] hw/timer/hpet: Adjust num_timers in hpet_init()
Quoted 11 lines · Paolo Bonzini
Date: Tue, 20 May 2025 17:16:22 +0200
From: Paolo Bonzini <[email protected]>
Subject: Re: [PATCH 2/5] hw/timer/hpet: Adjustnum_timersinhpet_init()Quoted 2 lines · Zhao Liu
Currently, HPET adjusts
num_timersinhpet_realize(), and doesn't change it in any other place. And this field is initialized as a property.Properties are initialized *after*
hpet_init. For hw/timer/hpet you can checks->num_timersand return an error if it's out of bounds, but for the Rust version we don't have Error** support yet. :(
Oops, yes.
(Note for myself,) the default property value is set before hpet_init(), but the subsequent adjustments to property (via object_property_set_uint8()) need to take boundaries into account, which is why the num_timers adjustment is placed in realize().
Quoted 1 line
Queued 1-4-5 for now.
Thanks!
Zhao
PATCH 3/5 rust/hpet: Drop BalCell wrapper for num_timers
In reply to Zhao LiuCurrently, HPET adjusts num_timers in HPETState::realize(), and doesn't change it in any other method. And this field is initialized as a property.
Meanwhile, please note that as a property, someone may change its default value in the future using qdev_prop_set_uint8() binding on either the C side or Rust side after HPET object creation. However, since this depends on QOM core code (on the C side) and all subsequent processes occur on the C side, there's no need for additional safety considerations as it doesn't cross FFI boundaries.
Therefore, this field could be immutable after init() so as not to be necessary to have a BqlCell wrapper.
Adjust num_timers in HPETState::init() and drop the BqlCell wrapper.
Note, when num_timers came out of BqlCell, the capability field doesn't need BqlCell as well since it's read-only. But from the view of readability, it's best to keep consistent with the other registers.
--- rust/hw/timer/hpet/src/hpet.rs | 37 +++++++++++++++------------------- 1 file changed, 16 insertions(+), 21 deletions(-)
rust/hw/timer/hpet/src/hpet.rs +16 -21
@@ -562,7 +562,7 @@ pub struct HPETState {/// HPET timer array managed by this timer block. #[doc(alias = "timer" )] timers: [BqlRefCell<HPETTimer>; HPET_MAX_TIMERS as usize], - num_timers: BqlCell<u8>, + num_timers: u8, num_timers_save: BqlCell<u8>,/// Instance id (HPET timer block ID).
@@ -570,11 +570,6 @@ pub struct HPETState { }impl HPETState { -// Get num_timers with `usize` type, which is useful to play with array index. -fn get_num_timers (&self) ->usize { - self.num_timers.get ().into () - } -const fn has_msi_flag (&self) ->bool { self.flags & (1 <<HPET_FLAG_MSI_SUPPORT_SHIFT ) !=0 }
@@ -636,7 +631,7 @@ fn set_cfg_reg(&self, shift: u32, len: u32, val: u64) { self.hpet_offset .set (ticks_to_ns (self.counter.get ()) -CLOCK_VIRTUAL .get_ns ()); -for timerin self.timers.iter ().take (self.get_num_timers ()) { +for timerin self.timers.iter ().take (self.num_timers.into ()) {let mut t = timer.borrow_mut ();if t.is_int_enabled () && t.is_int_active () {
@@ -648,7 +643,7 @@ fn set_cfg_reg(&self, shift: u32, len: u32, val: u64) {// Halt main counter and disable interrupt generation. self.counter.set (self.get_ticks ()); -for timerin self.timers.iter ().take (self.get_num_timers ()) { +for timerin self.timers.iter ().take (self.num_timers.into ()) { timer.borrow_mut ().del_timer (); } }
@@ -671,7 +666,7 @@ fn set_int_status_reg(&self, shift: u32, _len: u32, val: u64) {let new_val = val << shift;let cleared = new_val & self.int_status.get (); -for (index, timer)in self.timers.iter ().take (self.get_num_timers ()).enumerate () { +for (index, timer)in self.timers.iter ().take (self.num_timers.into ()).enumerate () {if cleared & (1 << index) !=0 { timer.borrow_mut ().update_irq (false ); }
@@ -715,6 +710,12 @@ unsafe fn init(&mut self) { "hpet", HPET_REG_SPACE_LEN, ); + +if self.num_timers <HPET_MIN_TIMERS { + self.num_timers =HPET_MIN_TIMERS ; + }else if self.num_timers >HPET_MAX_TIMERS { + self.num_timers =HPET_MAX_TIMERS ; + } }fn post_init (&self) {
@@ -732,12 +733,6 @@ fn realize(&self) { self.hpet_id.set (HPETFwConfig ::assign_hpet_id ()); -if self.num_timers.get () <HPET_MIN_TIMERS { - self.num_timers.set (HPET_MIN_TIMERS ); - }else if self.num_timers.get () >HPET_MAX_TIMERS { - self.num_timers.set (HPET_MAX_TIMERS ); - } - self.init_timer ();// 64-bit General Capabilities and ID Register; LegacyReplacementRoute. self.capability.set(
@@ -745,7 +740,7 @@ fn realize(&self) {1 <<HPET_CAP_COUNT_SIZE_CAP_SHIFT |1 <<HPET_CAP_LEG_RT_CAP_SHIFT |HPET_CAP_VENDER_ID_VALUE <<HPET_CAP_VENDER_ID_SHIFT | - ((self.get_num_timers () -1 )as u64 ) <<HPET_CAP_NUM_TIM_SHIFT |// indicate the last timer + ((self.num_timers -1 )as u64 ) <<HPET_CAP_NUM_TIM_SHIFT |// indicate the last timer (HPET_CLK_PERIOD * FS_PER_NS) << HPET_CAP_CNT_CLK_PERIOD_SHIFT, // 10 ns );
@@ -754,7 +749,7 @@ fn realize(&self) { }fn reset_hold (&self, _type:ResetType ) { -for timerin self.timers.iter ().take (self.get_num_timers ()) { +for timerin self.timers.iter ().take (self.num_timers.into ()) { timer.borrow_mut ().reset (); }
@@ -782,7 +777,7 @@ fn decode(&self, mut addr: hwaddr, size: u32) -> HPETAddrDecode {GlobalRegister ::try_from (addr).map (HPETRegister ::Global ) }else {let timer_id:usize = ((addr -0x100 ) /0x20 )as usize ; -if timer_id <= self.get_num_timers () { +if timer_id <= self.num_timers.into () {// TODO: Add trace point - trace_hpet_ram_[read|write]_timer_id(timer_id) TimerRegister ::try_from (addr &0x18 ) .map (|reg|HPETRegister ::Timer (&self.timers[timer_id], reg))
@@ -853,12 +848,12 @@ fn pre_save(&self) -> i32 { * also added to the migration stream. Check that it matches the value * that was configured. */ - self.num_timers_save.set (self.num_timers.get ()); + self.num_timers_save.set (self.num_timers);0 }fn post_load (&self, _version_id:u8 ) ->i32 { -for timerin self.timers.iter ().take (self.get_num_timers ()) { +for timerin self.timers.iter ().take (self.num_timers.into ()) {let mut t = timer.borrow_mut (); t.cmp64 = t.calculate_cmp64 (t.get_state ().counter.get (), t.cmp);
@@ -883,7 +878,7 @@ fn is_offset_needed(&self) -> bool { }fn validate_num_timers (&self, _version_id:u8 ) ->bool { - self.num_timers.get () == self.num_timers_save.get () + self.num_timers == self.num_timers_save.get () } }
Signature · 1 line
2.34.1
PATCH 4/5 rust: Fix Zhao's email address
In reply to Zhao LiuNo one could find Zhao Liu via [email protected].
--- rust/hw/timer/hpet/src/fw_cfg.rs | 2 +- rust/hw/timer/hpet/src/hpet.rs | 2 +- rust/hw/timer/hpet/src/lib.rs | 2 +- rust/qemu-api/src/bitops.rs | 2 +- rust/qemu-api/src/timer.rs | 2 +- rust/qemu-api/tests/vmstate_tests.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
rust/hw/timer/hpet/src/fw_cfg.rs +1 -1
@@ -1,5 +1,5 @@// Copyright (C) 2024 Intel Corporation. -// Author(s): Zhao Liu <[email protected]> +// Author(s): Zhao Liu <[email protected]> // SPDX-License-Identifier: GPL-2.0-or-later use std::ptr::addr_of_mut;
rust/hw/timer/hpet/src/hpet.rs +1 -1
@@ -1,5 +1,5 @@// Copyright (C) 2024 Intel Corporation. -// Author(s): Zhao Liu <[email protected]> +// Author(s): Zhao Liu <[email protected]> // SPDX-License-Identifier: GPL-2.0-or-later use std::{
rust/hw/timer/hpet/src/lib.rs +1 -1
@@ -1,5 +1,5 @@// Copyright (C) 2024 Intel Corporation. -// Author(s): Zhao Liu <[email protected]> +// Author(s): Zhao Liu <[email protected]> // SPDX-License-Identifier: GPL-2.0-or-later //! # HPET QEMU Device Model
rust/qemu-api/src/bitops.rs +1 -1
@@ -1,5 +1,5 @@// Copyright (C) 2024 Intel Corporation. -// Author(s): Zhao Liu <[email protected]> +// Author(s): Zhao Liu <[email protected]> // SPDX-License-Identifier: GPL-2.0-or-later //! This module provides bit operation extensions to integer types.
rust/qemu-api/src/timer.rs +1 -1
@@ -1,5 +1,5 @@// Copyright (C) 2024 Intel Corporation. -// Author(s): Zhao Liu <[email protected]> +// Author(s): Zhao Liu <[email protected]> // SPDX-License-Identifier: GPL-2.0-or-later use std::{
rust/qemu-api/tests/vmstate_tests.rs +1 -1
@@ -1,5 +1,5 @@// Copyright (C) 2025 Intel Corporation. -// Author(s): Zhao Liu <[email protected]> +// Author(s): Zhao Liu <[email protected]> // SPDX-License-Identifier: GPL-2.0-or-later use std::{
Signature · 1 line
2.34.1
Re: [PATCH 4/5] rust: Fix Zhao's email address
Quoted 4 lines · Zhao Liu
No one could find Zhao Liu via [email protected].
Signed-off-by Zhao Liu <[email protected]>
thanks
-- PMM
PATCH 5/5 rust: Fix the typos in doc
In reply to Zhao LiuThese typos are found by "cargo spellcheck". Though it outputs a lot of noise and false positives, there still are some real typos.
---
Note: But I have to admit, cargo spellcheck isn't a great tool.
Picked from <[email protected]> with checking again.
--- rust/hw/char/pl011/src/device.rs | 4 ++-- rust/qemu-api/src/qom.rs | 4 ++-- rust/qemu-api/src/vmstate.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
rust/hw/char/pl011/src/device.rs +2 -2
@@ -480,13 +480,13 @@ pub fn post_load(&mut self) -> Result<(), ()> { }impl PL011State { -/// Initializes a pre-allocated, unitialized instance of `PL011State`. +/// Initializes a pre-allocated, uninitialized instance of `PL011State`. /// /// # Safety /// /// `self` must point to a correctly sized and aligned location for the /// `PL011State` type. It must not be called more than once on the same -/// location/instance. All its fields are expected to hold unitialized +/// location/instance. All its fields are expected to hold uninitialized /// values with the sole exception of `parent_obj`. unsafe fn init (&mut self) {static PL011_OPS :MemoryRegionOps <PL011State > =MemoryRegionOpsBuilder ::<PL011State >::new ()
rust/qemu-api/src/qom.rs +2 -2
@@ -291,7 +291,7 @@ fn as_object(&self) -> &Object { }/// Return the receiver as a const raw pointer to Object. -/// This is preferrable to `as_object_mut_ptr()` if a C +/// This is preferable to `as_object_mut_ptr()` if a C /// function only needs a `const Object *`. fn as_object_ptr (&self) -> *const bindings::Object { self.as_object ().as_ptr ()
@@ -485,7 +485,7 @@ pub trait ObjectImpl: ObjectType + IsA<Object> {/// `INSTANCE_INIT` functions have been called. const INSTANCE_POST_INIT :Option <fn (&Self )> =None ; -/// Called on descendent classes after all parent class initialization +/// Called on descendant classes after all parent class initialization /// has occurred, but before the class itself is initialized. This /// is only useful if a class is not a leaf, and can be used to undo /// the effects of copying the contents of the parent's class struct
rust/qemu-api/src/vmstate.rs +1 -1
@@ -9,7 +9,7 @@//! * [`vmstate_unused!`](crate::vmstate_unused) and //! [`vmstate_of!`](crate::vmstate_of), which are used to express the //! migration format for a struct. This is based on the [`VMState`] trait, -//! which is defined by all migrateable types. +//! which is defined by all migratable types. //! //! * [`impl_vmstate_forward`](crate::impl_vmstate_forward) and //! [`impl_vmstate_bitsized`](crate::impl_vmstate_bitsized), which help with
Signature · 1 line
2.34.1
Re: [PATCH 5/5] rust: Fix the typos in doc
Quoted 11 lines · Zhao Liu
These typos are found by "cargo spellcheck". Though it outputs a lot of noise and false positives, there still are some real typos.
Signed-off-by Zhao Liu <[email protected]>---
Note: But I have to admit, cargo spellcheck isn't a great tool.Picked from <[email protected]> with checking again.
---
thanks
-- PMM