Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/viona-api/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ pub struct vioc_ring_state {
pub vrs_qaddr_desc: u64,
pub vrs_qaddr_avail: u64,
pub vrs_qaddr_used: u64,
pub vrs_last_chk_uidx: u16,
}

pub const VIONA_PROMISC_NONE: i32 = 0;
Expand Down Expand Up @@ -154,7 +155,7 @@ pub struct vioc_set_params {
/// This is the viona interface version which viona_api expects to operate
/// against. All constants and structs defined by the crate are done so in
/// terms of that specific version.
pub const VIONA_CURRENT_INTERFACE_VERSION: u32 = 6;
pub const VIONA_CURRENT_INTERFACE_VERSION: u32 = 7;

/// Maximum size of packed nvlists used in viona parameter ioctls
pub const VIONA_MAX_PARAM_NVLIST_SZ: usize = 4096;
3 changes: 3 additions & 0 deletions lib/propolis/src/hw/virtio/bits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

// device-independent features
pub const VIRTIO_F_EVENT_IDX: u64 = 1 << 29;

// virtio-net feature bits
pub const VIRTIO_NET_F_CSUM: u64 = 1 << 0;
pub const VIRTIO_NET_F_GUEST_CSUM: u64 = 1 << 1;
Expand Down
49 changes: 49 additions & 0 deletions lib/propolis/src/hw/virtio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,28 @@ use crate::common::RWOp;
use crate::hw::pci as pci_hw;
use crate::lifecycle::Lifecycle;
use queue::VirtQueue;
use serde::{Deserialize, Serialize};

pub use block::PciVirtioBlock;
pub use viona::PciVirtioViona;
pub use vsock::PciVirtioSock;

#[cfg(target_os = "illumos")]

mod os {
unsafe extern "C" {
pub fn membar_enter();
}
}

#[inline(always)]
pub fn membar_enter() {
#[cfg(target_os = "illumos")]
unsafe {
os::membar_enter();
}
}

bitflags! {
pub struct LegacyFeatures: u64 {
const NOTIFY_ON_EMPTY = 1 << 24;
Expand Down Expand Up @@ -246,6 +263,7 @@ pub enum VqChange {
IntrCfg,
}

#[derive(Debug)]
pub enum VqIntr {
/// Pin (lintr) interrupt
Pin,
Expand All @@ -254,12 +272,43 @@ pub enum VqIntr {
Msi(u64, u32, bool),
}

#[derive(Copy, Clone, Default, Deserialize, Serialize)]
pub struct VqNeedsIntrProbeInfo {
used_event: u16,
last_chk_uidx: u16,
uidx: u16,
needed: bool,
}

#[usdt::provider(provider = "propolis")]
mod probes {
fn virtio_vq_notify(virtio_dev_addr: u64, virtqueue_id: u16) {}
fn virtio_vq_pop(vq_addr: u64, desc_idx: u16, avail_idx: u16) {}
fn virtio_vq_push(vq_addr: u64, used_idx: u16, used_len: u32) {}

fn virtio_vq_needs_intr(
vq_addr: u64,
vq_id: u16,
f_event_idx: u64,
info: crate::hw::virtio::VqNeedsIntrProbeInfo,
) {
}
fn virtio_vq_send_intr(vq_addr: u64, vq_id: u16, sent: u64) {}
fn virtio_vq_enable_intr(
vq_addr: u64,
vq_id: u16,
f_event_idx: u64,
avail_event: u16,
) {
}
fn virtio_vq_disable_intr(
vq_addr: u64,
vq_id: u16,
f_event_idx: u64,
avail_event: u16,
) {
}

fn virtio_viona_mq_set_use_pairs(cause: u8, npairs: u16) {}

fn virtio_device_needs_reset() {}
Expand Down
Loading
Loading