virtio-devices: Report no config space for configless devices

The watchdog, rng, and rtc devices expose no device specific
configuration fields. Each now reports a config size of zero so the
transport omits the device configuration capability instead of
advertising an unbacked region that the device cannot service.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-06-29 19:15:07 +02:00
committed by Bo Chen
parent d1dd6b13d5
commit 3c90f91491
3 changed files with 12 additions and 0 deletions

View File

@@ -230,6 +230,10 @@ impl Rng {
}
impl VirtioDevice for Rng {
fn config_size(&self) -> Option<u64> {
Some(0)
}
fn device_type(&self) -> u32 {
self.common.device_type
}

View File

@@ -601,6 +601,10 @@ impl Rtc {
}
impl VirtioDevice for Rtc {
fn config_size(&self) -> Option<u64> {
Some(0)
}
fn device_type(&self) -> u32 {
self.common.device_type
}

View File

@@ -310,6 +310,10 @@ fn timerfd_setup(timer: &File, secs: i64) -> Result<(), io::Error> {
}
impl VirtioDevice for Watchdog {
fn config_size(&self) -> Option<u64> {
Some(0)
}
fn device_type(&self) -> u32 {
self.common.device_type
}