Skip to content

Commit

Permalink
remove commented out serial from blk driver vm
Browse files Browse the repository at this point in the history
  • Loading branch information
erichchan999 committed Feb 9, 2024
1 parent 8a2c448 commit 8aaa9f6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 105 deletions.
72 changes: 0 additions & 72 deletions examples/virtio/blk_driver_vmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,6 @@ void uio_ack(size_t vcpu_id, int irq, void *cookie) {
microkit_notify(get_uio_ch(irq));
}

/* Virtio Console */
#define SERIAL_MUX_TX_CH 1
#define SERIAL_MUX_RX_CH 2

#define VIRTIO_CONSOLE_IRQ (74)
#define VIRTIO_CONSOLE_BASE (0x130000)
#define VIRTIO_CONSOLE_SIZE (0x1000)

uintptr_t serial_rx_free;
uintptr_t serial_rx_used;
uintptr_t serial_tx_free;
uintptr_t serial_tx_used;

uintptr_t serial_rx_data;
uintptr_t serial_tx_data;

size_t serial_ch[SDDF_SERIAL_NUM_CH];

ring_handle_t serial_rx_ring_handle;
ring_handle_t serial_tx_ring_handle;

static ring_handle_t *serial_ring_handles[SDDF_SERIAL_NUM_HANDLES];

static struct virtio_device virtio_console;

void init(void) {
/* Initialise the VMM, the VCPU(s), and start the guest */
LOG_VMM("starting \"%s\"\n", microkit_name);
Expand Down Expand Up @@ -159,47 +134,6 @@ void init(void) {
LOG_VMM_ERR("Failed to initialise emulated interrupt controller\n");
return;
}

/* Initialise our sDDF ring buffers for the serial device */
ring_init(&serial_rx_ring_handle,
(ring_buffer_t *)serial_rx_free,
(ring_buffer_t *)serial_rx_used,
true,
NUM_BUFFERS,
NUM_BUFFERS);
for (int i = 0; i < NUM_BUFFERS - 1; i++) {
int ret = enqueue_free(&serial_rx_ring_handle, serial_rx_data + (i * BUFFER_SIZE), BUFFER_SIZE, NULL);
if (ret != 0) {
microkit_dbg_puts(microkit_name);
microkit_dbg_puts(": server rx buffer population, unable to enqueue buffer\n");
}
}
ring_init(&serial_tx_ring_handle,
(ring_buffer_t *)serial_tx_free,
(ring_buffer_t *)serial_tx_used,
true,
NUM_BUFFERS,
NUM_BUFFERS);
for (int i = 0; i < NUM_BUFFERS - 1; i++) {
// Have to start at the memory region left of by the rx ring
int ret = enqueue_free(&serial_tx_ring_handle, serial_tx_data + ((i + NUM_BUFFERS) * BUFFER_SIZE), BUFFER_SIZE, NULL);
assert(ret == 0);
if (ret != 0) {
microkit_dbg_puts(microkit_name);
microkit_dbg_puts(": server tx buffer population, unable to enqueue buffer\n");
}
}
serial_ring_handles[SDDF_SERIAL_RX_RING] = &serial_rx_ring_handle;
serial_ring_handles[SDDF_SERIAL_TX_RING] = &serial_tx_ring_handle;
/* Neither ring should be plugged and hence all buffers we send should actually end up at the driver. */
assert(!ring_plugged(serial_tx_ring_handle.free_ring));
assert(!ring_plugged(serial_tx_ring_handle.used_ring));
/* Initialise channel */
serial_ch[SDDF_SERIAL_TX_CH_INDEX] = SERIAL_MUX_TX_CH;
/* Initialise virtIO console device */
success = virtio_mmio_device_init(&virtio_console, CONSOLE, VIRTIO_CONSOLE_BASE, VIRTIO_CONSOLE_SIZE, VIRTIO_CONSOLE_IRQ,
NULL, NULL, (void **)serial_ring_handles, serial_ch);
assert(success);

/* Register UIO irq */
for (int i = 0; i < NUM_UIO_DEVICE; i++) {
Expand All @@ -219,12 +153,6 @@ void notified(microkit_channel ch) {
}

switch (ch) {
case SERIAL_MUX_RX_CH: {
/* We have received an event from the serial multipelxor, so we
* call the virtIO console handling */
virtio_console_handle_rx(&virtio_console);
break;
}
default:
LOG_VMM_ERR("Unexpected channel, ch: 0x%lx\n", ch);
}
Expand Down
6 changes: 0 additions & 6 deletions examples/virtio/board/qemu_arm_virt/blk_driver_vm/dts/uio.dts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,4 @@
interrupts = <0x00 19 0x04>;
// IRQ = 51
};

virtio-console@0130000 {
compatible = "virtio,mmio";
reg = <0x00 0x130000 0x00 0x200>;
interrupts = <0x00 42 0x04>;
};
};
27 changes: 0 additions & 27 deletions examples/virtio/board/qemu_arm_virt/virtio.system
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
<memory_region name="rx_data_serial_vmm_1" size="0x200_000" page_size="0x200_000" />
<memory_region name="tx_data_serial_vmm_2" size="0x200_000" page_size="0x200_000" />
<memory_region name="rx_data_serial_vmm_2" size="0x200_000" page_size="0x200_000" />
<memory_region name="tx_data_serial_vmm_3" size="0x200_000" page_size="0x200_000" />
<memory_region name="rx_data_serial_vmm_3" size="0x200_000" page_size="0x200_000" />
<!-- Regions for the shared ring buffers used by the driver and multiplexor -->
<memory_region name="rx_free_serial_driver" size="0x200_000" page_size="0x200_000"/>
<memory_region name="rx_used_serial_driver" size="0x200_000" page_size="0x200_000"/>
Expand All @@ -98,11 +96,6 @@
<memory_region name="rx_free_serial_vmm_2" size="0x200_000" page_size="0x200_000"/>
<memory_region name="rx_used_serial_vmm_2" size="0x200_000" page_size="0x200_000"/>

<memory_region name="tx_free_serial_vmm_3" size="0x200_000" page_size="0x200_000"/>
<memory_region name="tx_used_serial_vmm_3" size="0x200_000" page_size="0x200_000"/>
<memory_region name="rx_free_serial_vmm_3" size="0x200_000" page_size="0x200_000"/>
<memory_region name="rx_used_serial_vmm_3" size="0x200_000" page_size="0x200_000"/>

<!-- Multiplexor for transmit (TX) serial data -->
<protection_domain name="serial_mux_tx" priority="100" pp="true">
<program_image path="serial_mux_tx.elf" />
Expand All @@ -115,17 +108,12 @@
<map mr="tx_used_serial_vmm_1" vaddr="0x103_600_000" perms="rw" cached="true" setvar_vaddr="tx_used_client" />
<map mr="tx_free_serial_vmm_2" vaddr="0x5_200_000" perms="rw" cached="true" setvar_vaddr="tx_free_client2" />
<map mr="tx_used_serial_vmm_2" vaddr="0x5_400_000" perms="rw" cached="true" setvar_vaddr="tx_used_client2" />
<!-- BLK DRIVER -->
<!-- <map mr="tx_free_serial_vmm_3" vaddr="0x5_600_000" perms="rw" cached="true" setvar_vaddr="tx_free_client3" />
<map mr="tx_used_serial_vmm_3" vaddr="0x5_800_000" perms="rw" cached="true" setvar_vaddr="tx_used_client3" /> -->
<!-- Data regions between multiplexor/driver and vmm/mulitplexor -->
<map mr="tx_data_driver" vaddr="0x2_200_000" perms="rw" cached="true" setvar_vaddr="tx_data_driver" />
<!-- @ivanv: the virtual address of the data region needs to match what it is in the client as well,
this is very fragile and should be fixed. -->
<map mr="tx_data_serial_vmm_1" vaddr="0x8_400_000" perms="rw" cached="true" setvar_vaddr="tx_data_client" />
<map mr="tx_data_serial_vmm_2" vaddr="0x8_800_000" perms="rw" cached="true" setvar_vaddr="tx_data_client2" />
<!-- BLK DRIVER -->
<!-- <map mr="tx_data_serial_vmm_3" vaddr="0x8_c00_000" perms="rw" cached="true" setvar_vaddr="tx_data_client3" /> -->
</protection_domain>
<!-- Multiplexor for receive (RX) serial data -->
<protection_domain name="serial_mux_rx" priority="100" pp="true">
Expand All @@ -138,15 +126,10 @@
<map mr="rx_used_serial_vmm_1" vaddr="0x5_000_000" perms="rw" cached="true" setvar_vaddr="rx_used_client" />
<map mr="rx_free_serial_vmm_2" vaddr="0x5_200_000" perms="rw" cached="true" setvar_vaddr="rx_free_client2" />
<map mr="rx_used_serial_vmm_2" vaddr="0x5_400_000" perms="rw" cached="true" setvar_vaddr="rx_used_client2" />
<!-- BLK DRIVER -->
<!-- <map mr="rx_free_serial_vmm_3" vaddr="0x5_600_000" perms="rw" cached="true" setvar_vaddr="rx_free_client3" />
<map mr="rx_used_serial_vmm_3" vaddr="0x5_800_000" perms="rw" cached="true" setvar_vaddr="rx_used_client3" /> -->

<map mr="rx_data_driver" vaddr="0x2_600_000" perms="rw" cached="true" setvar_vaddr="rx_data_driver" />
<map mr="rx_data_serial_vmm_1" vaddr="0x8_600_000" perms="rw" cached="true" setvar_vaddr="rx_data_client" />
<map mr="rx_data_serial_vmm_2" vaddr="0x8_a00_000" perms="rw" cached="true" setvar_vaddr="rx_data_client2" />
<!-- BLK DRIVER -->
<!-- <map mr="rx_data_serial_vmm_3" vaddr="0x8_e00_000" perms="rw" cached="true" setvar_vaddr="rx_data_client3" /> -->
</protection_domain>

<!-- The driver for talking to the hardware serial device, in this case UART -->
Expand Down Expand Up @@ -224,16 +207,6 @@
<program_image path="blk_driver_vmm.elf" />
<map mr="blk_driver_vm_ram" vaddr="0x40000000" perms="rw" setvar_vaddr="guest_ram_vaddr" />

<!-- sDDF related regions for virtIO console -->
<!-- shared memory for ring buffer mechanism -->
<map mr="rx_free_serial_vmm_3" vaddr="0x6_000_000" perms="rw" cached="true" setvar_vaddr="serial_rx_free" />
<map mr="rx_used_serial_vmm_3" vaddr="0x6_200_000" perms="rw" cached="true" setvar_vaddr="serial_rx_used" />
<map mr="tx_free_serial_vmm_3" vaddr="0x103_400_000" perms="rw" cached="true" setvar_vaddr="serial_tx_free" />
<map mr="tx_used_serial_vmm_3" vaddr="0x103_600_000" perms="rw" cached="true" setvar_vaddr="serial_tx_used" />
<!-- sDDF data region -->
<map mr="tx_data_serial_vmm_3" vaddr="0x8_c00_000" perms="rw" cached="true" setvar_vaddr="serial_tx_data" />
<map mr="rx_data_serial_vmm_3" vaddr="0x8_e00_000" perms="rw" cached="true" setvar_vaddr="serial_rx_data" />

<!-- sDDF block -->
<virtual_machine name="blk_driver_linux" id="0" priority="200">
<map mr="blk_driver_vm_ram" vaddr="0x40000000" perms="rwx" />
Expand Down

0 comments on commit 8aaa9f6

Please sign in to comment.