From 4b057cd11f289d87d6c70c3ef205118ce1610361 Mon Sep 17 00:00:00 2001 From: Diogo Costa Date: Wed, 17 Jan 2024 16:28:51 +0000 Subject: [PATCH] update(guest_img): update separately_loaded description Signed-off-by: Diogo Costa --- source/bao_hyp/config.rst | 24 ++++++++++++++++-------- source/bao_hyp/img/guest-image.svg | 4 ++++ 2 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 source/bao_hyp/img/guest-image.svg diff --git a/source/bao_hyp/config.rst b/source/bao_hyp/config.rst index e6a42bb..db80f0e 100644 --- a/source/bao_hyp/config.rst +++ b/source/bao_hyp/config.rst @@ -128,8 +128,8 @@ guest side. It encompasses the following options: where: - **base_addr** [mandatory] - corresponds to the ``image`` load address in the VM's address space; -- **load_addr** [mandatory] - corresponds to the ``image`` load address in the hypervisor address - space. This value can be defined using the macro VM_IMAGE_OFFSET(img_name); +- **load_addr** [mandatory] - corresponds to the ``image`` load address in physical memory/physical + address space. This value can be defined using the macro VM_IMAGE_OFFSET(img_name); - **size** [mandatory] - corresponds to the image size. For builtin images declared using `VM_IMAGE`, this value can be defined using the macro VM_IMAGE_SIZE(img_name); - **separately_loaded** [optional] - informs the hypervisor if the VM image is to be loaded @@ -137,12 +137,7 @@ where: - **inplace** [optional]- use the image inplace and don’t copy the image. By default, inplace is set as false; -.. figure:: img/vm-image.svg - :align: center - :name: vm-image-fig - -To ease the process of configuring the image running on each VM, the configuration of Bao allows -the use of two different macros: +To simplify the image configuration process for each VM, Bao allows the use of two macros: 1. **VM_IMAGE_BUILTIN** - This macro simplifies image configuration by requiring only the ``img_name`` and the image ``base_addr``. This macro specifies both the base address and image @@ -151,6 +146,19 @@ the use of two different macros: 2. **VM_IMAGE_LOADED** - This macro requires additional configurations. It requires the definition of image ``base_addr``, the image ``load_addr``, and the image ``size``. +If the ``separately_loaded`` parameter is configured as false, the hypervisor interprets this +setting as the offset of the built-in guest image within its own image, denoted as +``VM_IMAGE_OFFSET``. During run-time, the hypervisor adjusts this value to be subsequently +interpreted as a physical address. This adjustment involves adding the address at which the +hypervisor itself was loaded. However, if the ``separately_loaded`` parameter is configured as true, +the guest image is not embedded in the hypervisor image; instead, it is loaded independently. For +more details, refer to the figure below. + +.. figure:: img/guest-image.svg + :align: center + :name: vm-image-fig + + Virtual Machine Configuration ***************************** diff --git a/source/bao_hyp/img/guest-image.svg b/source/bao_hyp/img/guest-image.svg new file mode 100644 index 0000000..86e82c2 --- /dev/null +++ b/source/bao_hyp/img/guest-image.svg @@ -0,0 +1,4 @@ + + + +
Guest config
Guest config
struct vm_image image {
        .base_addr = img_base_addr,
.load_addr = VM_IMAGE_OFFSET(img_name),
.size = VM_IMAGE_SIZE(img_name), 
.separately_loaded = false,
};
struct vm_image image {...
struct vm_image image = VM_IMAGE_BUILTIN(img_name, img_base_addr)
struct vm_image image = VM_IMAGE_BUILTIN(img_name, img_base_addr)
0x0000
0x0000
0x4000
0x4000
Guest
img
Guest...
0x2000
0x2000
0x6000
0x6000
Bao img
Bao img
 VM_IMAGE_OFFSET 
 VM_IMAGE_OFFSET 
Guest config
Guest config
struct vm_image image {
        .base_addr = img_base_addr,
.load_addr = img_load_addr,
.size = img_size, 
.separately_loaded = true,
};
struct vm_image image {...
struct vm_image image = VM_IMAGE_LOADED(img_base_addr,       img_load_addr, img_size) 
struct vm_image image = VM_IMAGE_LOADED(img_base_addr,...
0x0000
0x0000
0x4000
0x4000
Guest
img
Guest...
0x2000
0x2000
0x6000
0x6000
Bao img
Bao img
Text is not SVG - cannot display
\ No newline at end of file