qemu-rust
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC 09/13] i386/fw_cfg: move hpet_cfg definition to hpet.c


From: Philippe Mathieu-Daudé
Subject: Re: [RFC 09/13] i386/fw_cfg: move hpet_cfg definition to hpet.c
Date: Thu, 5 Dec 2024 22:17:58 +0100
User-agent: Mozilla Thunderbird

On 5/12/24 13:46, Zhao Liu wrote:
Hi Philippe,

On Thu, Dec 05, 2024 at 01:04:58PM +0100, Philippe Mathieu-Daudé wrote:
Date: Thu, 5 Dec 2024 13:04:58 +0100
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Subject: Re: [RFC 09/13] i386/fw_cfg: move hpet_cfg definition to hpet.c

On 5/12/24 07:07, Zhao Liu wrote:
HPET device needs to access and update hpet_cfg variable, but now it is
defined in hw/i386/fw_cfg.c and Rust code can't access it.

Move hpet_cfg definition to hpet.c (and rename it to hpet_fw_cfg). This
allows Rust HPET device implements its own global hpet_fw_cfg variable,
and will further reduce the use of unsafe C code access and calls in the
Rust HPET implementation.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
   hw/i386/fw_cfg.c        |  4 +---
   hw/timer/hpet.c         | 16 +++++++++-------
   include/hw/timer/hpet.h |  2 +-
   3 files changed, 11 insertions(+), 11 deletions(-)


diff --git a/include/hw/timer/hpet.h b/include/hw/timer/hpet.h
index d17a8d43199e..dbf709251a8f 100644
--- a/include/hw/timer/hpet.h
+++ b/include/hw/timer/hpet.h
@@ -74,7 +74,7 @@ struct hpet_fw_config
       struct hpet_fw_entry hpet[8];
   } QEMU_PACKED;
-extern struct hpet_fw_config hpet_cfg;
+extern struct hpet_fw_config hpet_fw_cfg;

Could this field belong to the (yet unexisting) HPETClass?

Several instances would share the same class, so HPETClass could manage
multiple HPETState info.

But in fw_cfg.c, do you have idea about how to get the HPETClass?

Have hpet_find() return an Object and call object_get_class()?

Regards,
Zhao





reply via email to

[Prev in Thread] Current Thread [Next in Thread]