Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aarch32 vm install #115

Closed
wants to merge 44 commits into from
Closed

Conversation

josecm
Copy link
Member

@josecm josecm commented Dec 10, 2023

The level of page table where entries are shared for aarch32 is lvl 1. By resharing the lvl 0 pte, this was causing erroneous mappings on secondary cores.

Depends on #114

Signed-off-by: Jose Martins <josemartins90@gmail.com>
Signed-off-by: Jose Martins <josemartins90@gmail.com>
@josecm josecm mentioned this pull request Dec 10, 2023
2 tasks
@danielRep danielRep self-assigned this Jan 5, 2024
@danielRep danielRep self-requested a review January 5, 2024 11:13
Signed-off-by: Jose Martins <josemartins90@gmail.com>
@danielRep danielRep force-pushed the fix/aarch32_vm_install branch from d043ba8 to f84b327 Compare January 5, 2024 11:38
josecm and others added 3 commits January 5, 2024 12:37
Signed-off-by: Jose Martins <josemartins90@gmail.com>
Add missing uart_putc function prototype to 8250_uart.h and nxp_uart.h files.

Signed-off-by: joaopeixoto13 <joaopeixotooficial@gmail.com>
Signed-off-by: Jose Martins <josemartins90@gmail.com>
@josecm josecm force-pushed the fix/aarch32_vm_install branch from f84b327 to 7189a89 Compare April 15, 2024 10:35
@josecm josecm requested a review from sandro2pinto as a code owner April 15, 2024 10:35
xioliu and others added 15 commits May 10, 2024 16:08
Signed-off-by: Xiongfei Liu <95175997+xioliu@users.noreply.github.com>
First a fence was required to enforce the dependency on
`install_info_ready` being set calling vmm_vm_install as there is no
real data dependency.

Second, we move the write fence which ensures the write to the page
table is visible to within the install function. It is it responsibility
to ensure it returns with its effects visible.

Signed-off-by: Jose Martins <josemartins90@gmail.com>
Signed-off-by: Diogo Costa <diogoandreveigacosta@gmail.com>
Initial commit for the process of adapting bao to the standard C11.
Modified the makefile to compile according to C11 and reject the use of any
extension.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
The asm keyword is a GNU extension. Changed all instances to the C11
counterpart __asm__

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
The use of binary constants (e.g., 0b0101) is a GCC extension.
Refactor all binary constants to hex (e.g., 0x5).

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
GCC issues an error ("initializer element is not constant") when
SPINLOCK_INITVAL was defined in a macro.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Most macros expand to functions. C11 does not allow the use of ;
at the end of non-statements.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
sgi_base[0] was used for better legibility while ensuring the the next
registers were aligned properly. C11 does not allow these declarations.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Using an expression in return statement is illegal in C11.
In this case, the function has a void return type.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
__VA_OPT__ is only available as a GNU extension or in C23.
The error issued by gcc is "error: __VA_OPT__ is not available until C2X"

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
C11 does not allow arithmetic operations on void* ptrs.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Add a dummy uint8_t to the structs page_table_arch and iommu_vm_arch since
C11 does not allow structs to be declared without members.
This was the best solution available avoiding majors modifications to bao.
Considering both structs are only used in a small number of ocasions, the
increase in memory usage is acceptable.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
The macro DEFINED evaluates if a given macro was defined or not. Its expansion
ends in a variadic macro that was not receiving the correct number of arguments
if the evaluated macro was not defined. It was fixed by added a dummy argument
that is ignored.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
ISO C forbids zero-size arrays.
From our understanding, that declaration does not achieve anything.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
miguelafsilva5 and others added 23 commits May 22, 2024 14:52
ISO C forbids braced-groups within expressions which was used in the
CSRR macro. We use the same strategy as in arm code, by generating
static functions accessors for each CSR

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Pedantic C does not allow for the initialization of flexible array members.
The presented solution follows the same pattern as other attributes in structs
used in the configuration (e.g., shmemlist or regions).

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
With the changes to the type of vmlist, the system fails to build to
generate the headers without adding an entry to the new vmlist array.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Signed-off-by: Jose Martins <josemartins90@gmail.com>
Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Pedantic C does not allow unused arguments, generating compile time
errors.
The portable way to circumvent this is to cast it to void which
we do using the introduce UNUSED_ARG macro;

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Pedantic C does not allow partial initialization of struct elements.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Pedantic C forces the 'static' and 'register' keywords to be in the beginning
of declarations. Additionally, the 'const' keyword is not need in static
inline functions.
These errors are issued by the flag -Werror=old-style-declaration

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
emul_write and emul_read used comparision between elements with different
signedness, which is not permitted by C11. Since these are unused, we opted
to remove them.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
The flag -wextra forces comparisons and other operations to have elements
with the same signedness. In the commit, we change some variables types to
match the operations they are used, or cast them to the correct type.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
start type is unsigned therefore it won't ever be less than 0.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
This commit adds warning flags that are not included in -wall and -wextra.
These flags will help dealing with some MISRA directives (e.g., forcing
explicit casts, adding missing prototypes, etc.)

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
With the additional compiler flags, most implicit casts are not allowed.
This commit achieves this by forcing explicit casts, refactoring some variable
types and fixing literal values.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
The missing prototype error was being triggered due to one of the
following:

- the prototype was effectively missing;
- the prototype was ill defined (mainly, no paramter function prototypes
  missed 'void' as paramter list;
- the function did not have a prototype but did not require it. Mostly,
  because it was only used in the compilation unit - in this case to avoid,
  the error it must be defined as static;
  In some other cases these functions had a prototype defined which was
  not necessary and was thus removed.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Switch statements without a default case cause errors with the
-Wswitch-default flag.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
The flag -Wcast-qual issues errors when a qualifier (e.g., const) is removed
through a cast.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
The Wshadow flag warns whenever a local variable or type declaration
shadows another variable (e.g., global variables)

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
The compiler issues errors when trying to get the reference of elements of
packed structs since it might result in unaligned pointer values.
As such we forced the elements in question to be aligned inside the struct.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
The level of page table where entries are shared for aarch32 is lvl 1.
By resharing the lvl 0 pte, this was causing erroneous mappings on
secondary cores.

Signed-off-by: Jose Martins <josemartins90@gmail.com>
@josecm josecm force-pushed the fix/aarch32_vm_install branch from 7189a89 to 2603780 Compare May 23, 2024 14:39
@josecm josecm requested a review from AfonsoSantos96 as a code owner May 23, 2024 14:39
@josecm josecm deleted the branch fix/fences_vm_install May 23, 2024 14:42
@josecm josecm closed this May 23, 2024
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.

6 participants