Skip to content

Commit

Permalink
Update to latest sDDF (block interface changes)
Browse files Browse the repository at this point in the history
Need to fixup the UIO block driver after the error messages
PR gets merged as well.

Signed-off-by: Ivan Velickovic <[email protected]>
  • Loading branch information
Ivan-Velickovic committed Sep 4, 2024
1 parent c637488 commit 014652c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dep/sddf
Submodule sddf updated 76 files
+8 −8 .github/workflows/examples.yaml
+2 −0 .reuse/dep5
+3 −3 README.md
+3 −0 benchmark/benchmark.c
+26 −7 blk/components/virt.c
+92 −14 build.zig
+52 −10 ci/examples.sh
+4 −4 drivers/blk/mmc/imx/README.md
+20 −4 drivers/blk/mmc/imx/include/usdhc.h
+299 −195 drivers/blk/mmc/imx/usdhc.c
+27 −0 drivers/blk/virtio/blk_driver.mk
+420 −0 drivers/blk/virtio/block.c
+170 −0 drivers/blk/virtio/block.h
+117 −37 drivers/i2c/meson/README.md
+24 −24 drivers/i2c/meson/driver.h
+231 −241 drivers/i2c/meson/i2c.c
+2 −2 drivers/i2c/meson/i2c_driver.mk
+1 −1 drivers/network/imx/eth_driver.mk
+1 −1 drivers/network/meson/eth_driver.mk
+1 −1 drivers/network/virtio/eth_driver.mk
+8 −8 drivers/network/virtio/ethernet.c
+1 −1 drivers/serial/meson/uart_driver.mk
+0 −0 drivers/timer/arm/timer.c
+0 −0 drivers/timer/arm/timer_driver.mk
+0 −0 drivers/timer/imx/timer.c
+0 −0 drivers/timer/imx/timer_driver.mk
+0 −0 drivers/timer/meson/timer.c
+0 −0 drivers/timer/meson/timer_driver.mk
+32 −0 examples/blk/Makefile
+82 −0 examples/blk/README.md
+29 −0 examples/blk/basic_data.txt
+113 −0 examples/blk/blk.mk
+103 −0 examples/blk/blk_config.h
+76 −0 examples/blk/board/qemu_virt_aarch64/blk.system
+176 −0 examples/blk/build.zig
+15 −0 examples/blk/build.zig.zon
+142 −0 examples/blk/client.c
+134 −0 examples/blk/mkvirtdisk
+2 −7 examples/echo_server/Makefile
+290 −0 examples/echo_server/board/imx8mp_evk/echo_server.system
+1 −1 examples/echo_server/echo.mk
+3 −0 examples/echo_server/include/ethernet_config/ethernet_config.h
+3 −0 examples/echo_server/lwip.c
+54 −9 examples/i2c/README.md
+47 −16 examples/i2c/board/odroidc4/i2c.system
+46 −28 examples/i2c/build.zig
+150 −0 examples/i2c/client_ds3231.c
+57 −37 examples/i2c/client_pn532.c
+17 −6 examples/i2c/i2c.mk
+1 −1 examples/mmc/Makefile
+0 −0 examples/mmc/README.md
+0 −0 examples/mmc/board/imx8mm_evk/mmc.system
+0 −0 examples/mmc/board/maaxboard/mmc.system
+52 −41 examples/mmc/client.c
+2 −1 examples/mmc/include/configs/blk_config.h
+3 −2 examples/mmc/mmc.mk
+1 −1 examples/timer/timer.mk
+41 −34 i2c/components/virt.c
+9 −0 i2c/devices/ds3231/README.md
+275 −0 i2c/devices/ds3231/ds3231.c
+9 −0 i2c/devices/ds3231/ds3231.mk
+13 −0 i2c/devices/pn532/README.md
+178 −121 i2c/devices/pn532/pn532.c
+9 −0 i2c/devices/pn532/pn532.mk
+7 −21 include/sddf/blk/queue.h
+43 −0 include/sddf/blk/storage_info.h
+77 −0 include/sddf/i2c/devices/ds3231/ds3231.h
+2 −2 include/sddf/i2c/devices/pn532/pn532.h
+5 −3 include/sddf/i2c/queue.h
+1 −1 include/sddf/network/constants.h
+12 −0 include/sddf/util/ialloc.h
+1 −0 include/sddf/virtio/virtio.h
+1 −1 libco/libco.mk
+1 −1 serial/components/serial_components.mk
+1 −0 shell.nix
+3 −3 util/util.mk
2 changes: 1 addition & 1 deletion examples/virtio/client_vmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void init(void)
blk_storage_info_t *storage_info = (blk_storage_info_t *)blk_config;

/* Busy wait until blk device is ready */
while (!__atomic_load_n(&storage_info->ready, __ATOMIC_ACQUIRE));
while (!blk_storage_is_ready(storage_info));

/* Initialise the VMM, the VCPU(s), and start the guest */
LOG_VMM("starting \"%s\"\n", microkit_name);
Expand Down
1 change: 1 addition & 0 deletions examples/virtio/include/blk_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <sddf/util/string.h>
#include <sddf/blk/queue.h>
#include <sddf/blk/storage_info.h>

#define BLK_NUM_CLIENTS 2

Expand Down
1 change: 1 addition & 0 deletions include/libvmm/virtio/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <sddf/util/fsmalloc.h>
#include <sddf/util/ialloc.h>
#include <sddf/blk/queue.h>
#include <sddf/blk/storage_info.h>

/* Feature bits */
#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
Expand Down
12 changes: 6 additions & 6 deletions tools/linux/uio_drivers/blk/blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void driver_notified()
int ret = lseek(storage_fd, (off_t)req_block_number * BLK_TRANSFER_SIZE, SEEK_SET);
if (ret < 0) {
LOG_UIO_BLOCK_ERR("Failed to seek in storage: %s\n", strerror(errno));
status = BLK_RESP_SEEK_ERROR;
status = BLK_RESP_ERR_UNSPEC;
success_count = 0;
break;
}
Expand All @@ -165,7 +165,7 @@ void driver_notified()
LOG_UIO_BLOCK("Read from storage successfully: %d bytes\n", bytes_read);
if (bytes_read < 0) {
LOG_UIO_BLOCK_ERR("Failed to read from storage: %s\n", strerror(errno));
status = BLK_RESP_SEEK_ERROR;
status = BLK_RESP_ERR_UNSPEC;
success_count = 0;
} else {
status = BLK_RESP_OK;
Expand All @@ -177,7 +177,7 @@ void driver_notified()
int ret = lseek(storage_fd, (off_t)req_block_number * BLK_TRANSFER_SIZE, SEEK_SET);
if (ret < 0) {
LOG_UIO_BLOCK_ERR("Failed to seek in storage: %s\n", strerror(errno));
status = BLK_RESP_SEEK_ERROR;
status = BLK_RESP_ERR_UNSPEC;
success_count = 0;
break;
}
Expand All @@ -186,7 +186,7 @@ void driver_notified()
LOG_UIO_BLOCK("Wrote to storage successfully: %d bytes\n", bytes_written);
if (bytes_written < 0) {
LOG_UIO_BLOCK_ERR("Failed to write to storage: %s\n", strerror(errno));
status = BLK_RESP_SEEK_ERROR;
status = BLK_RESP_ERR_UNSPEC;
success_count = 0;
} else {
status = BLK_RESP_OK;
Expand All @@ -198,7 +198,7 @@ void driver_notified()
int ret = fsync(storage_fd);
if (ret != 0) {
LOG_UIO_BLOCK_ERR("Failed to flush storage: %s\n", strerror(errno));
status = BLK_RESP_SEEK_ERROR;
status = BLK_RESP_ERR_UNSPEC;
} else {
status = BLK_RESP_OK;
}
Expand All @@ -208,7 +208,7 @@ void driver_notified()
int ret = fsync(storage_fd);
if (ret != 0) {
LOG_UIO_BLOCK_ERR("Failed to flush storage: %s\n", strerror(errno));
status = BLK_RESP_SEEK_ERROR;
status = BLK_RESP_ERR_UNSPEC;
} else {
status = BLK_RESP_OK;
}
Expand Down

0 comments on commit 014652c

Please sign in to comment.