Re: [PATCH 11/12] rust/hpet: return errors from realize if properties are incorrect

2025-05-29 Thread Paolo Bonzini
On Thu, May 29, 2025 at 10:54 AM Zhao Liu  wrote:
> >  if self.int_route_cap == 0 {
> > -// TODO: Add error binding: warn_report()
> > -println!("Hpet's hpet-intcap property not initialized");
> > +Err("hpet.hpet-intcap property not initialized")?;
> >  }
>
> Though here we don't need print warning...do we still need to provide
> the warn_report() binding? Or println!() is enough in Rust side?

I think it will be enough to have Error ** and
LOG_GUEST_ERROR/LOG_UNIMP... but we'll see.

Paolo




Re: [PATCH 11/12] rust/hpet: return errors from realize if properties are incorrect

2025-05-29 Thread Zhao Liu
On Mon, May 26, 2025 at 04:24:54PM +0200, Paolo Bonzini wrote:
> Date: Mon, 26 May 2025 16:24:54 +0200
> From: Paolo Bonzini 
> Subject: [PATCH 11/12] rust/hpet: return errors from realize if properties
>  are incorrect
> X-Mailer: git-send-email 2.49.0
> 
> Match the code in hpet.c; this also allows removing the
> BqlCell from the num_timers field.
> 
> Signed-off-by: Paolo Bonzini 
> ---
>  rust/hw/timer/hpet/src/fw_cfg.rs |  7 +++
>  rust/hw/timer/hpet/src/hpet.rs   | 16 +++-
>  2 files changed, 10 insertions(+), 13 deletions(-)

Patch is fine for me,

Reviewed-by: Zhao Liu 


>  if self.int_route_cap == 0 {
> -// TODO: Add error binding: warn_report()
> -println!("Hpet's hpet-intcap property not initialized");
> +Err("hpet.hpet-intcap property not initialized")?;
>  }

Though here we don't need print warning...do we still need to provide
the warn_report() binding? Or println!() is enough in Rust side?

Thanks,
Zhao