core: Reduce the page usage of in page_map_get_foreign_page

Use the same virtual address for intermediate mappings while walking the
guest page table pages. There is nothing to gain by spreading this over
a larger address range.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Optimize page mapping of mmio_parse

While we are parsing an instruction triggering a MMIO request, we
typically stay on the same code page and, thus, can reuse a preexisting
mapping.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Map MMIO code pages read-only

We don't want to write to them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Drop page_map_release_foreign_page

There is nothing to gain by destroying an inherent temporary foreign
page mapping. Rather we will have to ensure that each virtual address in
the foreign mapping range is remappable without allocations for the page
table itself.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Do not unmap the foreign mapping regions in cell_create

We rely on the page table structure being present all the time, which
page_map_destroy defeats.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Prepare foreign mapping range to support allocation-free remappings

Force all page table levels into existence that are required to address
the complete foreign mapping range. This is done by marking the
corresponding page table entries non-present.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Clean up paging_init

page_map_create supports mapping of multiple pages, so make use of this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Change error code for too large cell configurations

E2BIG is more appropriate and helps differentiating this error from
real out-of-memory situations.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Only use per-cpu mapping region during cell creation

We must not assume that all foreign mapping regions are available during
cell creation. There might be already running cell that trigger MMIO
etc. and, thus, use their own mapping region. So pick the one asigned to
the CPU that invokes cell_create. We therefore also have to reduce the
maximum support size for configurations.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>