38 Commits

Author SHA1 Message Date
Travis Geiselbrecht
e50948bf06 [dev][virtio-block] fix a printf formatting warning on 32bit
ssize_t is annoying with formatting, since %zd doesn't really know how
to match it, so the usual strategy is to use %ld, since ssize_t is
always defined as a signed long on LK.
2025-08-31 12:41:30 -07:00
Kelvin Zhang
af1f19a2cc [lib][uefi] Add interrupt based async IO support
Add a new API to bio layer(read_async) where function will
return immediately, and a callback function will be called from
interrupt context, when block driver completes the IO request.
2025-08-13 16:13:38 -04:00
Cody Wong
2b02c8a046 [virtio][v9p] Add the VirtIO 9p device driver
This commit adds the VirtIO 9p device driver based on the VirtIO driver
stack in LK, `dev/virtio`. The driver supports a subset of 9P2000.L
protocol (https://github.com/chaos/diod/blob/master/protocol.md), which
is able to perform basic file operations (fread, fwrite, dirread, etc.).
The primary interface for sending and receiving the 9p messages is
`virtio_9p_rpc`, which is handy and scalable.

The driver is limited to communicate to the host with only one
outstanding 9p message per device due to the simplified driver design.
Basically that is enough for embedded environments when there is no
massive file IO.

Signed-off-by: Cody Wong <codycswong@google.com>
2024-04-01 23:09:30 -07:00
Travis Geiselbrecht
3288b15a39 [dev][virtio-net] sync feature bits with virtio v1.3
Add new feature bits for the net device
Since the new feature bits are >= 32, add support for reading higher
than 32bit feature words from the virtio mmio interface.
2024-03-20 00:26:58 -07:00
Travis Geiselbrecht
c3cf81a8d8 [dev][virtio-block] update defs to virtio v1.3
No real functional change, just update the list of features to v1.3 of
the spec.
2024-03-19 23:40:57 -07:00
Alex Richardson
99bf8f9c41 [clang] Fix -Wformat warnings
Use %hx for uint16_t instead of %hhx.
2023-04-23 17:23:31 -07:00
Travis Geiselbrecht
914c9c2a2f [dev][virtio-blk] update to newer version of the device
Nothing fundamentally changed, just update to new feature bits and print
them at device detection time.
Try to negotiate the guest feature set as well, though nothing
fundamentally changes at this time.
2022-04-26 00:40:03 -07:00
Travis Geiselbrecht
b834181637 [dev][virtio-block] fix bug when not using paging
In the non VM path the existing routine wouldn't subtract from len, so
the function would (properly) return bytes transferred instead of zero.

The wrapping code was written to assume 0 and not bytes transferred,
which seemed like a workaround for broken code. Change the inner routine
to always return bytes transferred and adjust wrapper routines
accordingly.
2022-04-25 23:37:39 -07:00
Travis Geiselbrecht
6ad3643165 [lib][minip] add an arg to the ethernet transmit callback
Already had the registration hook for it, but was never used.
2022-03-19 15:06:57 -07:00
Travis Geiselbrecht
fcb65c9a88 [dev/lib][warnings] fix -Wmissing-declarations warnings in dev/ and lib/ 2021-10-21 23:16:20 -07:00
Travis Geiselbrecht
1272d037aa [dev][virtio] remove some extraneous __PACKED attributes
From working with -Wpacked its clear that some of the virtio
structures are overly packed and result in bad codegen on particular
architectures such as riscv. Roll back from using packed but
statically assert that the sizes are correct for some future arch
where things naturally pack differently.
2020-07-25 20:04:21 -07:00
Travis Geiselbrecht
0ec24d0b29 [dev][virtio] add no kernel VM workaround
Also add stride to the mmio detect routine. Not all virtio apertures are
tightly packed as they are on arm.
2020-01-19 16:15:58 -08:00
Travis Geiselbrecht
cba9e47987 [license] replace the longer full MIT license with a shorter one
Used scripts/replacelic. Everything seems to build fine.
2019-07-05 17:22:23 -07:00
Travis Geiselbrecht
d8fa82cb91 [formatting] run everything through codestyle
Almost nothing changes here except moving braces to the same line as the
function declaration. Everything else is largely whitespace changes and
a few dangling files with tab indents.

See scripts/codestyle
2019-06-19 21:02:24 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
cstout
0f0b4959ad Stub display_present
R=gkalsi@google.com

Review URL: https://codereview.chromium.org/1951403002 .
2016-05-05 12:54:06 -07:00
cstout
c1255f7f47 [display] Refactor to avoid implicit framebuffer allocation.
Preparation to allow other images to be presented to the display.
Separate definitions of display and image formats.
display_get_info no longer provides a framebuffer.
display_get_framebuffer allocates a framebuffer for convenience.

Review URL: https://codereview.chromium.org/1777783003 .
2016-03-10 09:49:22 -08:00
Travis Geiselbrecht
a4ca0a6e00 [vmm] move most users of arch_mmu_query directly to vaddr_to_paddr() 2016-02-14 12:45:53 -08:00
Travis Geiselbrecht
2eb32a4369 [style] mass reformat all the non external code to 4 space indents
Ran everything through scripts/codestyle.space, which uses astyle
to generally follow K&R style.

Biggest non whitespace change is pulling brackets down on function
declarations, which I'm pretty ambivalent about, but astyle insists
on taking a stance
2016-02-14 12:24:01 -08:00
Gurjant Kalsi
3ec7c378c8 [virtio] Virtio read/write block return 0 on success instead of number of bytes transferred 2015-11-05 11:00:53 -08:00
Gurjant Kalsi
7e0a4d3f90 [bio] Add a flag that allows devices to declare that they only deal with cache aligned blocks of memory 2015-11-04 17:18:15 -08:00
Travis Geiselbrecht
c2a28f8c39 [dev][virtio] fix warning in virtio-block code 2015-10-28 11:04:39 -07:00
Travis Geiselbrecht
3b2d7a268b [make] remove the need for a module to manually add $(LOCAL_DIR)/include to the global include path
Pretty much every module in the system was already doing it, so do it
automatically.
2015-10-19 19:07:16 -07:00
Travis Geiselbrecht
4e0b62745c [dev][virtio-gpu] fail if cannot allocate enough memory for framebuffer
Also print framebuffer location and size.
2015-10-16 16:09:08 -07:00
Travis Geiselbrecht
c7ce0b9361 [lib][display] update display_get_info to return success/failure
Update all the users to check for error.
2015-10-08 15:54:40 -07:00
Travis Geiselbrecht
555f16c5c7 [dev][virtio][gpu] add default implementation of virtio-gpu driver
Exports a simple single buffered framebuffer.
2015-10-07 15:44:00 -07:00
Travis Geiselbrecht
c17ed4295b [dev][virtio][block] handle scatter gathered reads/writes 2015-09-21 20:21:16 -07:00
Travis Geiselbrecht
215b5ed07f [64bit] fix a few more 64bit warnings in newer code 2015-09-20 13:11:51 -07:00
Travis Geiselbrecht
cff470ffdd [dev][virtio][net] update to new pktbuf structure 2015-09-16 19:41:11 -07:00
Travis Geiselbrecht
ba3d7ce316 [dev][virtio] remove arm specific header 2015-09-11 17:41:29 -07:00
Travis Geiselbrecht
3d31579fe0 [dev][virtio][net] dump feature bits on detection 2015-09-10 13:59:56 -07:00
Travis Geiselbrecht
ddb7e7f72f [dev][virtio][net] avoid copy in send path, deal with rx size violations better 2015-09-10 13:43:35 -07:00
Travis Geiselbrecht
193a57d5d5 [dev][virtio][net] add working implementation of a virtio network interface
-Not optimized yet, but should be pretty complete. Tested against qemu.
-Add switches to qemu script to allow running with a tap interface.
-Enable minip by default on vexpress-a9 platform
2015-09-09 15:41:32 -07:00
Travis Geiselbrecht
e0bca35bd3 [dev][virtio] handle multiple rings (up to 4 currently) per device 2015-09-08 17:59:10 -07:00
Travis Geiselbrecht
579b3314e7 [virtio][block] get the virtio block device driver fully working
Wire up to the bio layer properly.
2015-09-08 16:15:01 -07:00
Travis Geiselbrecht
b1ccb192cf [dev][virtio] update memory allocations to match VM alignment api 2014-08-18 14:56:43 -07:00
Travis Geiselbrecht
3b3ca0e27a [dev][virtio] patch up to work in the post-vm world
Need to translate virtual to physical in a few places
2014-07-24 01:55:05 -07:00
Travis Geiselbrecht
8cdf762391 [dev][virtio] initial stab at getting a generic virtio layer with block device support 2014-07-21 00:43:41 -07:00