Commit Graph
100 Commits
Author SHA1 Message Date
Wei Liu 47d7556925 x86/traps: Remove lazy FPU support
Remove lazy FPU support from the #NM exception handler used by PV
guests since fully_eager_fpu is now always true.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
2026-03-30 15:48:13 +01:00
Wei Liu e7b62fcfd9 x86: i387.c cleanup
Spelling and formatting; no functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Fouad Hilly <fouad.hilly@cloud.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2024-03-06 10:19:57 +01:00
Wei Liu 2213b5a293 setup: Move vm_init() before acpi calls
After the direct map removal, pages from the boot allocator are not
going to be mapped in the direct map. Although we have map_domain_page,
they are ephemeral and are less helpful for mappings that are more than a
page, so we want a mechanism to globally map a range of pages, which is
what vmap is for. Therefore, we bring vm_init into early boot stage.

To allow vmap to be initialised and used in early boot, we need to
modify vmap to receive pages from the boot allocator during early boot
stage.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David Woodhouse <dwmw2@amazon.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Elias El Yandouzi <eliasely@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
2024-02-06 11:53:04 +01:00
Wei Liu 4f17357b52 xen/arm: add Persistent Map (PMAP) infrastructure
The basic idea is like Persistent Kernel Map (PKMAP) in Linux. We
pre-populate all the relevant page tables before the system is fully
set up.

We will need it on Arm in order to rework the arm64 version of
xenheap_setup_mappings() as we may need to use pages allocated from
the boot allocator before they are effectively mapped.

This infrastructure is not lock-protected therefore can only be used
before smpboot. After smpboot, map_domain_page() has to be used.

This is based on the x86 version [1] that was originally implemented
by Wei Liu.

The PMAP infrastructure is implemented in common code with some
arch helpers to set/clear the page-table entries and convertion
between a fixmap slot to a virtual address...

As mfn_to_xen_entry() now needs to be exported, take the opportunity
to swich the parameter attr from unsigned to unsigned int.

[1] <e92da4ad6015b6089737fcccba3ec1d6424649a5.1588278317.git.hongyxia@amazon.com>

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
[julien: Adapted for Arm]
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Tested-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2022-06-11 12:29:06 +01:00
Wei Liu 3e701a3a83 x86/mm: drop _new suffix for page table APIs
No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:14:52 +02:00
Wei Liu d5f7d3dbdf x86/smpboot: switch clone_mapping() to new APIs
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:14:13 +02:00
Wei Liu 62cd9f9895 x86/smpboot: add exit path for clone_mapping()
We will soon need to clean up page table mappings in the exit path.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:14:03 +02:00
Wei Liu aad7aff5ea efi: switch to new APIs in EFI code
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:13:54 +02:00
Wei Liu a2b4c46b6e efi: use new page table APIs in copy_mapping
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:13:44 +02:00
Wei Liu 7e2fdcdb3e x86_64/mm: switch to new APIs in setup_m2p_table
While doing so, avoid repetitive mapping of l2_ro_mpt by keeping it
across loops, and only unmap and map it when crossing 1G boundaries.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:13:34 +02:00
Wei Liu d87e3ff90d x86_64/mm: switch to new APIs in paging_init
Map and unmap pages instead of relying on the direct map.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:13:24 +02:00
Wei Liu 33a8018d2e x86_64/mm: introduce pl2e in paging_init
We will soon map and unmap pages in paging_init(). Introduce pl2e so
that we can use l2_ro_mpt to point to the page table itself.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:13:13 +02:00
Wei Liu dd68f2e49b x86/mm: switch to new APIs in modify_xen_mappings
Page tables allocated in that function should be mapped and unmapped
now.

Note that pl2e now maybe mapped and unmapped in different iterations, so
we need to add clean-ups for that.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:13:02 +02:00
Wei Liu 4b5b08314e x86/mm: switch to new APIs in map_pages_to_xen
Page tables allocated in that function should be mapped and unmapped
now.

Take the opportunity to avoid a potential double map in
map_pages_to_xen() by initialising pl1e to NULL and only map it if it
was not mapped earlier.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:12:51 +02:00
Wei Liu 4215992594 x86/mm: rewrite virt_to_xen_l*e
Rewrite those functions to use the new APIs. Modify its callers to unmap
the pointer returned. Since alloc_xen_pagetable_new() is almost never
useful unless accompanied by page clearing and a mapping, introduce a
helper alloc_map_clear_xen_pt() for this sequence.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2021-04-22 14:12:31 +02:00
Wei Liu b733f8a8b8 x86/mm: Refactor modify_xen_mappings to have one exit path
We will soon need to perform clean-ups before returning.

No functional change.

This is part of XSA-345.

Reported-by: Hongyan Xia <hongyxia@amazon.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2020-10-20 14:19:55 +02:00
Wei Liu 08e6c6f80b x86/mm: Refactor map_pages_to_xen to have only a single exit path
We will soon need to perform clean-ups before returning.

No functional change.

This is part of XSA-345.

Reported-by: Hongyan Xia <hongyxia@amazon.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2020-10-20 14:19:31 +02:00
Wei Liu d0234b2055 x86/pv: map and unmap page tables in mark_pv_pt_pages_rdonly
Also, clean up the initialisation of plXe.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2020-04-30 10:44:34 +02:00
Wei Liu e558843685 x86/pv: map and unmap page table in dom0_construct_pv
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2020-04-28 17:49:17 +02:00
Wei Liu 9749f78fc8 x86/smpboot: map and unmap page tables in cleanup_cpu_root_pgt
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2020-04-28 17:48:36 +02:00
Wei Liu 7247652607 x86_64/mm: map and unmap page tables in subarch_memory_op
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2020-04-28 17:48:02 +02:00
Wei Liu a4dcb4b47d x86_64/mm: map and unmap page tables in subarch_init_memory
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2020-04-28 17:47:20 +02:00
Wei Liu 93414e42c7 x86_64/mm: map and unmap page tables in cleanup_frame_table
Also fix a weird indentation and use PAGE_{MASK,SIZE} there.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2020-04-28 17:46:29 +02:00
Wei Liu a48e1323f9 x86_64/mm: map and unmap page tables in destroy_m2p_mapping
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2020-04-16 11:05:58 +02:00
Wei Liu 15b7bec578 x86_64/mm: map and unmap page tables in share_hotadd_m2p_table
Fetch lYe by mapping and unmapping lXe instead of using the direct map,
which is now done via the lYe_from_lXe() helpers.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2020-04-16 11:05:28 +02:00
Wei Liu f362f5b5d0 x86_64/mm: map and unmap page tables in m2p_mapped
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2020-04-16 11:04:51 +02:00
Wei Liu 6c8afe5aad x86/shim: map and unmap page tables in replace_va_mapping
Also, introduce lYe_from_lXe() macros which do not rely on the direct
map when walking page tables. Unfortunately, they cannot be inline
functions due to the header dependency on domain_page.h, so keep them as
macros just like map_lYt_from_lXe().

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2020-04-16 11:01:46 +02:00
Wei Liu 109ecb8945 x86/mm: switch to new APIs in arch_init_memory
The function will map and unmap pages on demand.

Since we now map and unmap Xen PTE pages, we would like to track the
lifetime of mappings so that 1) we do not dereference memory through a
variable after it is unmapped, 2) we do not unmap more than once.
Therefore, we introduce the UNMAP_DOMAIN_PAGE macro to nullify the
variable after unmapping, and ignore NULL.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2020-03-05 10:42:18 +01:00
Wei Liu cb6a6e9527 x86: introduce a new set of APIs to manage Xen page tables
We are going to switch to using domheap page for page tables.
A new set of APIs is introduced to allocate and free pages of page
tables based on mfn instead of the xenheap direct map address. The
allocation and deallocation work on mfn_t but not page_info, because
they are required to work even before frame table is set up.

Implement the old functions with the new ones. We will rewrite, site
by site, other mm functions that manipulate page tables to use the new
APIs.

After the allocation, one needs to map and unmap via map_domain_page to
access the PTEs. This does not break xen half way, since the new APIs
still use xenheap pages underneath, and map_domain_page will just use
the directmap for mappings. They will be switched to use domheap and
dynamic mappings when usage of old APIs is eliminated.

No functional change intended in this patch.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Wei Liu <wl@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
2020-02-20 12:45:32 +00:00
Wei Liu 4dde27b6e0 x86/mm: change pl*e to l*t in virt_to_xen_l*e
We will need to have a variable named pl*e when we rewrite
virt_to_xen_l*e. Change pl*e to l*t to reflect better its purpose.
This will make reviewing later patch easier.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2020-01-07 14:02:54 +00:00
Wei Liu f383de87a2 x86/mm: introduce l{1,2}t local variables to modify_xen_mappings
The pl2e and pl1e variables are heavily (ab)used in that function.  It
is fine at the moment because all page tables are always mapped so
there is no need to track the life time of each variable.

We will soon have the requirement to map and unmap page tables. We
need to track the life time of each variable to avoid leakage.

Introduce some l{1,2}t variables with limited scope so that we can
track life time of pointers to xen page tables more easily.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2020-01-07 13:33:19 +00:00
Wei Liu 238a8da06d x86/mm: introduce l{1,2}t local variables to map_pages_to_xen
The pl2e and pl1e variables are heavily (ab)used in that function. It
is fine at the moment because all page tables are always mapped so
there is no need to track the life time of each variable.

We will soon have the requirement to map and unmap page tables. We
need to track the life time of each variable to avoid leakage.

Introduce some l{1,2}t variables with limited scope so that we can
track life time of pointers to xen page tables more easily.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2020-01-07 13:33:19 +00:00
Wei Liu 8c4392063f x86: move some xen mm function declarations
They were put into page.h but mm.h is more appropriate.

The real reason is that I will be adding some new functions which
takes mfn_t. It turns out it is a bit difficult to do in page.h.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2020-01-07 13:33:19 +00:00
Wei Liu 88e798210b MAINTAINERS: update my email address
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
2019-05-24 20:26:43 +01:00
Wei Liu 3c16684d06 Revert "libxl: add helper function to set device_model_version"
This reverts commit 3802ecbaa9.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2019-05-22 09:09:08 +01:00
Wei Liu b36d4fc65a Revert "libxl: fix migration of PV and PVH domUs with and without qemu"
This reverts commit 899433f149.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2019-05-22 09:08:56 +01:00
Wei Liu c44c6ba695 Revert "libxl: fix libxl_domain_need_memory after 899433f149d"
This reverts commit 278c64519c.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2019-05-22 09:08:41 +01:00
Wei Liu 278c64519c libxl: fix libxl_domain_need_memory after 899433f149
After 899433f149 libxl needs to know the content of d_config to
determine which QEMU is used. The code is changed such that
libxl__domain_set_device_model needs to be called before
libxl__domain_build_info_setdefault.

This is fine for libxl code, but it is problematic for
libxl_domain_need_memory, which is the only public API that takes a
build_info. To avoid breaking its users, provide a compatibility
setting inside that function.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2019-05-20 15:14:14 +01:00
Wei Liu e5b7afda94 libxl: fix regression introduced in 5c883cf036
A few lines were erroneously deleted during rebase which caused domain
destruction to fail.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Tested-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2019-05-16 11:11:52 +01:00
Wei Liu 2a556b63a2 Drop blktap2
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2019-05-15 16:19:57 +01:00
Wei Liu 5c883cf036 tools: remove blktap2 related code and documentation
Blktap2 is effectively dead for a few years.

Notable changes in this patch:

0. Unhook blktap2 from build system
1. libxl no longer supports TAP disk backend, with appropriate assertions
   added and some code paths now return ERROR_FAIL
2. Tap is no longer a supported backend
3. Remove blktap2 entry from MAINTAINERS

A patch to remove blktap2 directory will come later.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2019-05-15 16:19:45 +01:00
Wei Liu 03e48b7b2a INSTALL: remove duplicate sentence
The same sentence is repeated in the next paragraph.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
2019-05-15 12:46:01 +01:00
Wei Liu bdd0f3c9b0 README: document requirement about python
Provide information on what is expected from the build system
regarding python.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2019-05-15 12:45:50 +01:00
Wei Liu e911b4e26f gitignore: ignore .vscode directory
The directory is created by Visual Studio Code editor to store its
local state.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
2019-05-15 12:45:37 +01:00
Wei Liu 1d1f161153 gitlab-ci: allow specifying base and tip in build test
We will soon provide this new capability to humans and automated
systems.

The default behaviour is retained: tip and base are passed by Gitlab
CI.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2019-05-15 11:01:06 +01:00
Wei Liu 396ce9ca02 public/tmem.h: fix version number in comment
The version number has been changed above due to rebasing onto 4.13
branch, but the one in the matching comment was left unchanged.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2019-05-13 15:30:57 +01:00
Wei Liu 004299fba4 gitlab-ci: avoid deleting build-each-commit-gcc.log
072a96c490 used `git clean -ffdx` which caused the log to be deleted.

Generate the log in the parent directory then move it back.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2019-05-13 12:45:57 +01:00
Wei Liu 1061631a57 docs: remove tmem related text
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2019-05-13 11:28:27 +01:00
Wei Liu c492e19fdd xen: remove tmem from hypervisor
This patch removes all tmem related code and CONFIG_TMEM from the
hypervisor. Also remove tmem hypercalls from the default XSM policy.

It is written as if tmem is disabled and tmem freeable pages is 0.

We will need to keep public/tmem.h around forever to avoid breaking
guests.  Remove the hypervisor only part and put guest visible part
under a xen version check. Take the chance to remove trailing
whitespaces.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2019-05-13 11:28:27 +01:00
Wei Liu c588c002cc tools: remove tmem code and commands
Remove all tmem related code in libxc.

Leave some stubs in libxl in case anyone has linked to those functions
before the removal.

Remove all tmem related commands in xl, all tmem related code in other
utilities we ship.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2019-05-13 11:28:27 +01:00
Wei Liu e83077a3d1 libxl: don't enable synthetic timers by default
It broke Windows installation. More investigation is needed. Don't
enable this feature by default.

Partially revert 26fba3c855 ("viridian: add implementation of
synthetic timers").

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
2019-05-07 14:41:59 +01:00
Wei Liu 860d6e158d xl: handle PVH type in apply_global_affinity_masks again
A call site in create_domain can call it with PVH type. That site was
missed during the review of 48dab9767.

Reinstate PVH type in the switch.

Reported-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2019-04-12 15:41:43 +01:00
Wei Liu 072a96c490 gitlab-ci: use git clean -ffdx in build each commit test
The build script invoked is designed to run in a pristine checkout.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2019-04-08 13:28:12 +01:00
Wei Liu 7a01cfaeb0 gitlab-ci: log commit range in build test
It is easier to debug stuff when the target range is clearly visible
at the top.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-04-08 11:31:28 +01:00
Wei Liu b3c2939fdd automation: fix "build each commit" test
An error was introduced while rebasing 9b8b3f30. The new test
shouldn't depend on anything, otherwise artefacts will be downloaded
from build stage and cause the script to abort.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2019-04-05 15:40:01 +01:00
Wei Liu 9b8b3f300f automation: introduce a test to build each commit
This is added to the test stage so that its failure won't block other
things.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2019-04-05 11:15:38 +01:00
Wei Liu 1ba432fb73 automation: add a script to build newly pushed commits in Gitlab CI
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2019-04-05 11:15:36 +01:00
Wei Liu 78798fb431 automation: set ret for potential error in build-test.sh
`git rev-list` can fail if the base..tip range contains invalid
commit(s). If that happens ret never gets a chance to be set.

Set ret before hand to fix the issue.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2019-04-05 11:14:57 +01:00
Wei Liu f21a359a30 automation: allow build-test.sh to run in detached HEAD state
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2019-04-05 11:14:57 +01:00
Wei Liu 9f8d606b43 xen: vcpu_migrate_start can be static
It's not used outside of schedule.c.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
2019-04-04 17:22:46 +01:00
Wei Liu 58e1417945 build: don't mandate availability of a fetcher program
It is common that build hosts are isolated from outside world. They
don't necessarily have wget or ftp installed.

Turn the error into warning in configure. And point FETCHER to `false'
command if neither wget nor ftp is available, so any attempt to
download will result in error.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-04-04 15:03:05 +01:00
Wei Liu bcb15f52d7 gitlab-ci: add fedora gcc build jobs
Although the image comes with clang, clang builds don't work yet.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2019-04-04 14:20:27 +01:00
Wei Liu 460837f800 automation: add Fedora image to containerize script
At the same time sort the list alphabetically.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2019-04-04 14:20:25 +01:00
Wei Liu e4c96ef233 automation: add a Fedora image
Use the latest and greatest.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2019-04-04 14:20:13 +01:00
Wei Liu a57a1b26ec tools/ocaml: make python scripts 2 and 3 compatible
1. Explicitly import reduce because that's required in 3.
2. Change print to function.
3. Eliminate invocations of has_key.

Signed-off-by: M A Young <m.a.young@durham.ac.uk>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
2019-04-02 09:50:58 +01:00
Wei Liu ff915c8cac pygrub: encode / decode string in Python 3
String is unicode in 3 but bytes in 2. We need to call encode / decode
function when using Python 3.

Reported-by: M A Young <m.a.young@durham.ac.uk>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-04-02 09:50:41 +01:00
Wei Liu 767ba397d3 pygrub/grub: always use integer for default entry
The original code set the default to either a string or an integer
(0) and relies on a Python 2 specific behaviour to work (integer is
allowed to be compared to string in Python 2 but not 3).

Always use integer. The caller (pygrub) already has code to handle
that.

Reported-by: M A Young <m.a.young@durham.ac.uk>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-04-02 09:47:38 +01:00
Wei Liu 485079e816 pygrub: fix message in grub parser
The code suggests 0 is allowed. Zero is not a positive number.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-04-02 09:47:14 +01:00
Wei Liu d96a4d6c9c tools/xenmon: make xenmon.py compatible with python 2 and 3
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-04-01 13:22:31 +01:00
Wei Liu 59e9783ddf libxc: fix HVM core dump
f969bc9fc9 forbid get_address_size call on HVM guests, because that
didn't make sense. It broke core dump functionality on HVM because
libxc unconditionally asked for guest width.

Force guest_width to a sensible value.

Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2019-03-20 16:52:01 +00:00
Wei Liu a892f81dde x86: decouple xen alignment setting from EFI/ELF build
Introduce a new Kconfig option to pick the alignment for xen binary.
To retain original behaviour, the default pick for EFI build is 2M and
ELF build 4K.

Make the PVHSHIM build use 2M alignment for potentially better
performance.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
2019-03-19 14:39:42 +00:00
Wei Liu 8ac7d80f8d x86: drop "depends on X86" for TBOOT Kconfig option
Given that this file already resides under arch/x86, there is no need
to have the dependency.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2019-03-19 14:39:25 +00:00
Wei Liu 75e383fa93 automation: enable building rombios with clang
Previously it is disabled because the embedded ipxe can't be built
with clang. Now that ipxe is split out we can use --with-system-ipxe
to work around the issue.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2019-03-15 12:40:24 +00:00
Wei Liu f67e6e904c Config.mk: update seabios to 1.12.1
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2019-03-14 15:00:52 +00:00
Wei Liu 7619745071 tools: bump library version numbers
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2019-03-14 12:31:54 +00:00
Wei Liu d2151152dd xen: make grant table support configurable
Introduce CONFIG_GRANT_TABLE. Provide stubs and make sure x86 and arm
hypervisors build with grant table disabled.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <julien.grall@arm.com>
2019-03-13 15:44:52 +00:00
Wei Liu 38a85fe8d9 build/m4: fix python library detection on Ubuntu systems
16cc3362ae doesn't work on Ubuntu with gcc (but it does work with
clang). Work around it by manipulating LIBS.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-03-13 15:01:36 +00:00
Wei Liu 222fb80031 travis: use python-dev instead of python2.7-dev
Xen build should be using default python now.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-03-13 15:01:36 +00:00
Wei Liu 49704b8d23 automation: use python-dev python2.7-dev in Debian and Ubuntu
... instead of python2.7-dev.

We installed python2.7-dev because xen only worked with 2.7.

Installing python2.7-dev only gives python2.7-config, which causes
configure to fail because it wants python-config by default. Now xen
should work with 2.6 and above, we can install python-dev and let
distros pick the default python.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-03-13 15:01:36 +00:00
Wei Liu 85578ea686 Run autogen.sh for 4.13
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2019-03-13 13:40:23 +00:00
Wei Liu 9b0bc91b3b README: remove requirement on Python 2
Now that all python scripts are compatible with Python 2.6 and above,
remove the restriction.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-03-12 14:24:53 +00:00
Wei Liu 83a204e695 pygrub/fsimage: make it work with python 3
With the help of two porting guides and cpython source code:

1. Use PyBytes to replace PyString counterparts.
2. Use PyVarObject_HEAD_INIT.
3. Remove usage of Py_FindMethod.
4. Use new module initialisation routine.

For #3, Py_FindMethod was removed, yet an alternative wasn't
documented.  The code is the result of reverse-engineering cpython
commit 6116d4a1d1

https://docs.python.org/3/howto/cporting.html
http://python3porting.com/cextensions.html

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-03-12 14:24:53 +00:00
Wei Liu 0aabd89dcf pygrub: make python scripts work with 2.6 and up
Run 2to3 and pick the sensible suggestions.

Import print_function and absolute_import so 2.6 can work.

There has never been a curses.wrapper module according to 2.x and 3.x
doc, only a function, so "import curses.wrapper" is not correct. It
happened to work because 2.x implemented a (undocumented) module.

We only need to import curses to make curses.wrapper available to
pygrub.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-03-12 14:24:53 +00:00
Wei Liu 660d2dd863 libxl: make python scripts work with python 2.6 and up
Go through transformations suggested by 2to3 and pick the necessary
ones.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-03-12 14:24:53 +00:00
Wei Liu 16cc3362ae build/m4: make python_devel.m4 work with both python 2 and 3
Do the following:

1. Change the form of "print".
2. Use AC_CHECK_FUNC to avoid the need to generate library name.
3. Remove unused stuff.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
2019-03-12 14:24:52 +00:00
Wei Liu b9e1368af1 pygrub: change tabs into spaces
Not sure why Python 2 never complained, but Python 3 does.

Change tabs to spaces.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-03-12 14:24:52 +00:00
Wei Liu e81209fd4e pygrub/fsimage: drop unused struct
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-03-12 14:24:52 +00:00
Wei Liu 72288c1566 Update Python requirement to 2.6
CentOS 5, which was the reason for the 2.4 restriction, is EOL. CentOS
6 ships 2.6.

Bump the version to 2.6 in README. Update configure.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
2019-03-12 14:24:52 +00:00
Wei Liu 6b6ff07fbd tools: drop obsolete xen-ringwatch
This utility can't possibly work with modern Xen setup: none of the
sysfs path used (under /sys/devices/xen-backend) is documented as
stable ABI in upstream Linux kernel.

Archaeology shows that the path used could have been part of the
xenolinux fork which never got upstreamed.

Its utility is zero nowadays. Drop it.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2019-02-06 12:04:26 +00:00
Wei Liu 755eb6403e automation: introduce a QEMU smoke test for PVH Dom0
Make qemu-smoke-x86-64.sh take a variant argument. Make two new tests
in test.yaml.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
2019-02-01 15:13:25 +00:00
Wei Liu f15ff4d500 x86/pvh-boot: don't mandate validity of RSDP pointer
RSDP is not mandatory according to PVH spec. Remove the BUG_ON. The
guest (xen) will fall back to scanning if necessary.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooepr3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
2019-01-30 14:49:07 +00:00
Wei Liu f50dd67950 libxl: correctly dispose of dominfo list in libxl_name_to_domid
Tamas reported ssid_label was leaked. Use the designated function to
free dominfo list to fix the leakage.

Reported-by: Tamas K Lengyel <tamas@tklengyel.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Tested-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
2019-01-29 14:57:58 +00:00
Wei Liu 1912f1220c libxl: fix error message for unsharing namespaces
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
2019-01-18 14:22:36 +00:00
Wei Liu 68292c94a6 tools: only call git when necessary in OVMF Makefile
Users may choose to export a snapshot of OVMF and build it
with xen.git supplied ovmf-makefile. In that case we don't
need to call `git submodule`.

Fixes b16281870e.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
2019-01-16 14:52:22 +00:00
Wei Liu b16281870e tools/firmware: update OVMF Makefile
OVMF has become dependent on OpenSSL, which is included as a
submodule.  Initialise submodules before building.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
2019-01-09 14:35:50 +00:00
Wei Liu a9c904c5a8 xen: simplify {check,poison}_one_page
Use __map_domain_page macro to deal with page_info directly.

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2018-12-11 17:20:32 +00:00
Wei Liu d887ced5d2 xen: clean up common/page_alloc.c
Remove trailing whitespaces. Turn bool_t into bool. Annotate a section
for CONFIG_SEPARATE_XENHEAP.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2018-12-11 17:20:32 +00:00
Wei Liu 31b5e595c4 x86: remove out label in spurious_interrupt
The out label is followed by a semicolon only. Use return directly.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2018-12-11 13:05:31 +00:00
Wei Liu 4cf5d62642 automation: skip test stage for some branches
We skipped build stage for those branches. We want to skip test state
for those branches too.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2018-12-10 16:31:09 +00:00
Wei Liu 81cfc1b3c7 automation: break .gitlab-yaml into smaller files
Break out files for build jobs and test jobs. Keep the top level
.gitlab-ci.yaml small.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
2018-12-05 22:30:14 +00:00