Skip to content

feat(virtio): add virtqueue interrupt methods#527

Merged
veqcc merged 3 commits intomainfrom
fea/virtio_vq_intr
Jun 24, 2025
Merged

feat(virtio): add virtqueue interrupt methods#527
veqcc merged 3 commits intomainfrom
fea/virtio_vq_intr

Conversation

@veqcc
Copy link
Copy Markdown
Contributor

@veqcc veqcc commented Jun 23, 2025

Description

Added virtqueue interrupt methods

  • virtio_stop_vq_intr
  • virtio_start_vq_intr

Related links

OpenBSD virtio_stop_vq_intr
https://github.com/openbsd/src/blob/9cb2b01c8c81819efa339598dd45ff164e968f48/sys/dev/pv/virtio.c#L960

OpenBSD virtio_start_vq_intr
https://github.com/openbsd/src/blob/9cb2b01c8c81819efa339598dd45ff164e968f48/sys/dev/pv/virtio.c#L980

How was this PR tested?

Tested in #465

Notes for reviewers

We currently don't support VIRTIO_F_RING_EVENT_IDX or VIRTIO_F_EVENT_IDX

@veqcc veqcc marked this pull request as ready for review June 24, 2025 00:24
@veqcc veqcc self-assigned this Jun 24, 2025
@veqcc veqcc requested review from Koichi98 and ytakano June 24, 2025 00:24
Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>
@Koichi98
Copy link
Copy Markdown
Contributor

Koichi98 commented Jun 24, 2025

https://github.com/openbsd/src/blob/9cb2b01c8c81819efa339598dd45ff164e968f48/sys/dev/pv/virtio.c#L997
It seems that vq_queued was incremented but not used for anything other than debugging purposes, so it was deleted?

@veqcc
Copy link
Copy Markdown
Contributor Author

veqcc commented Jun 24, 2025

@Koichi98

https://github.com/openbsd/src/blob/9cb2b01c8c81819efa339598dd45ff164e968f48/sys/dev/pv/virtio.c#L997
It seems that vq_queued was incremented but not used for anything other than debugging purposes, so it was deleted?

Partially yes. vq_queued in OpenBSD is used for two purposes. Both are unnecessary for Awkernel for now.

  1. debugging
  2. DMA synchronization to make all changes visible to device: https://github.com/openbsd/src/blob/59c04fd1110661898186153cace43603c87b800e/sys/dev/pv/virtio.c#L291-L294

@Koichi98
Copy link
Copy Markdown
Contributor

@veqcc

DMA synchronization to make all changes visible to device:

True.
So are we not implementing this virtio_check_vq()?

@veqcc
Copy link
Copy Markdown
Contributor Author

veqcc commented Jun 24, 2025

@Koichi98

So are we not implementing this virtio_check_vq()?

Yes, I'm implementing similar functionality as interrupt as NetDevice trait.

fn interrupt(&self, irq: u16) -> Result<(), NetDevError { ... }

However, we do not care about cache in DMA yet, which means the following procedure can be skipped

	if (vq->vq_queued) {
		vq->vq_queued = 0;
		vq_sync_aring(sc, vq, BUS_DMASYNC_POSTWRITE);
	}

@veqcc veqcc merged commit 099ffc8 into main Jun 24, 2025
1 check passed
@veqcc veqcc deleted the fea/virtio_vq_intr branch June 24, 2025 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants