diff mbox series

[RFC,13/13] i386: enable rust hpet for pc when rust is enabled

Message ID 20241205060714.256270-14-zhao1.liu@intel.com (mailing list archive)
State New
Headers show
Series rust: Reinvent the wheel for HPET timer in Rust | expand

Commit Message

Zhao Liu Dec. 5, 2024, 6:07 a.m. UTC
Add HPET configuration in PC's Kconfig options, and select HPET device
(Rust version) if Rust is supported.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 hw/i386/Kconfig       | 2 ++
 hw/timer/Kconfig      | 1 -
 rust/hw/Kconfig       | 1 +
 rust/hw/timer/Kconfig | 2 ++
 4 files changed, 5 insertions(+), 1 deletion(-)
 create mode 100644 rust/hw/timer/Kconfig

Comments

Paolo Bonzini Dec. 5, 2024, 3:20 p.m. UTC | #1
On 12/5/24 07:07, Zhao Liu wrote:
> Add HPET configuration in PC's Kconfig options, and select HPET device
> (Rust version) if Rust is supported.
> 
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
>   hw/i386/Kconfig       | 2 ++
>   hw/timer/Kconfig      | 1 -
>   rust/hw/Kconfig       | 1 +
>   rust/hw/timer/Kconfig | 2 ++
>   4 files changed, 5 insertions(+), 1 deletion(-)
>   create mode 100644 rust/hw/timer/Kconfig
> 
> diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
> index 32818480d263..83ab3222c4f0 100644
> --- a/hw/i386/Kconfig
> +++ b/hw/i386/Kconfig
> @@ -39,6 +39,8 @@ config PC
>       select PCSPK
>       select I8257
>       select MC146818RTC
> +    select HPET if !HAVE_RUST
> +    select X_HPET_RUST if HAVE_RUST

HPET is optional, so you need to have...

>   config HPET
>       bool
> -    default y if PC
>   

+default y if PC && !HAVE_RUST

with a matching "default y if PC && HAVE_RUST" for X_HPET_RUST.

Paolo

>   config I8254
>       bool
> diff --git a/rust/hw/Kconfig b/rust/hw/Kconfig
> index 4d934f30afe1..36f92ec02874 100644
> --- a/rust/hw/Kconfig
> +++ b/rust/hw/Kconfig
> @@ -1,2 +1,3 @@
>   # devices Kconfig
>   source char/Kconfig
> +source timer/Kconfig
> diff --git a/rust/hw/timer/Kconfig b/rust/hw/timer/Kconfig
> new file mode 100644
> index 000000000000..afd980335037
> --- /dev/null
> +++ b/rust/hw/timer/Kconfig
> @@ -0,0 +1,2 @@
> +config X_HPET_RUST
> +    bool
Zhao Liu Dec. 6, 2024, 9:06 a.m. UTC | #2
On Thu, Dec 05, 2024 at 04:20:44PM +0100, Paolo Bonzini wrote:
> Date: Thu, 5 Dec 2024 16:20:44 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: Re: [RFC 13/13] i386: enable rust hpet for pc when rust is enabled
> 
> On 12/5/24 07:07, Zhao Liu wrote:
> > Add HPET configuration in PC's Kconfig options, and select HPET device
> > (Rust version) if Rust is supported.
> > 
> > Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> > ---
> >   hw/i386/Kconfig       | 2 ++
> >   hw/timer/Kconfig      | 1 -
> >   rust/hw/Kconfig       | 1 +
> >   rust/hw/timer/Kconfig | 2 ++
> >   4 files changed, 5 insertions(+), 1 deletion(-)
> >   create mode 100644 rust/hw/timer/Kconfig
> > 
> > diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
> > index 32818480d263..83ab3222c4f0 100644
> > --- a/hw/i386/Kconfig
> > +++ b/hw/i386/Kconfig
> > @@ -39,6 +39,8 @@ config PC
> >       select PCSPK
> >       select I8257
> >       select MC146818RTC
> > +    select HPET if !HAVE_RUST
> > +    select X_HPET_RUST if HAVE_RUST
> 
> HPET is optional, so you need to have...

Oops, I didn't realize that.

> >   config HPET
> >       bool
> > -    default y if PC
> 
> +default y if PC && !HAVE_RUST
> 
> with a matching "default y if PC && HAVE_RUST" for X_HPET_RUST.

Thank you!

-Zhao
diff mbox series

Patch

diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
index 32818480d263..83ab3222c4f0 100644
--- a/hw/i386/Kconfig
+++ b/hw/i386/Kconfig
@@ -39,6 +39,8 @@  config PC
     select PCSPK
     select I8257
     select MC146818RTC
+    select HPET if !HAVE_RUST
+    select X_HPET_RUST if HAVE_RUST
     # For ACPI builder:
     select SERIAL_ISA
     select ACPI_PCI
diff --git a/hw/timer/Kconfig b/hw/timer/Kconfig
index c96fd5d97ae8..645d7531f40e 100644
--- a/hw/timer/Kconfig
+++ b/hw/timer/Kconfig
@@ -11,7 +11,6 @@  config A9_GTIMER
 
 config HPET
     bool
-    default y if PC
 
 config I8254
     bool
diff --git a/rust/hw/Kconfig b/rust/hw/Kconfig
index 4d934f30afe1..36f92ec02874 100644
--- a/rust/hw/Kconfig
+++ b/rust/hw/Kconfig
@@ -1,2 +1,3 @@ 
 # devices Kconfig
 source char/Kconfig
+source timer/Kconfig
diff --git a/rust/hw/timer/Kconfig b/rust/hw/timer/Kconfig
new file mode 100644
index 000000000000..afd980335037
--- /dev/null
+++ b/rust/hw/timer/Kconfig
@@ -0,0 +1,2 @@ 
+config X_HPET_RUST
+    bool