mmu: check ParentLevel before checking if pte is large.

If pte is large ParentLevel is always greater than zero.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: drop the need for hw_ptep<-1>

Specialize map_range(hw_ptep<0> ptep...) instead of map_level<-1>.
Removes the need to dubious hw_ptep<-1> class.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: replace static arch_pt_element functions by class inheritance

Instead of implementing arch dependant pt_element functionality as static
functions of arch_pt_element class, implement common functionality in
pt_element_common class and let each architecture extend it to make
fully functional pt_element class.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: make user()/accessed() functions arch independent interface.

They are implemented by both x64 and aarch64.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: make pt_element class to be a template parametrized on pte level

Utilize c++ type system to make it harder to pass wrong level ptes to
functions that expect certain pte level. It will also allow us utilize
the fact that different pte levels have slightly different format.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: remove unused make_large_pte function

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: make pt_element::large() check pt level

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: drop 'large' parameter from pt_element::addr()

pt_element knows if it is large or not.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: hide 'large' property from pte instantiation code

Pte creator should only care if the pte is leaf or non leaf. Low level code
can figure out itself if 'large' settings is needed.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: provide pt_level_traits class

Instead of coding the meaning of different pte levels in may places
provide pt_level_traits class that provide an information about each
level and use it instead.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mmu: assert if dirty() is called on wrong pte

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Merge branch 'mmu'

"pt_element templificatoin is here."

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
build: make boost-lib-dir more robust

'find' can find more than one library due to leftover junk, make it more
robust.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mgmt: update

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
pvclock-abi: respect the TSC_STABLE_BIT flag

According to the ABI we should not assume the clock is monotonic
unless TSC_STABLE_BIT is set. When it's not, we use a global variable
to prevent clock backwards jumps.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mgmt: update

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
merge