- 07 Jul, 2021 1 commit
-
-
Jan Beulich authored
Containing still in flight DMA was introduced to work around certain devices / systems hanging hard upon hitting a "not-present" IOMMU fault. Passing through (such) devices (on such systems) is inherently insecure (as guests could easily arrange for IOMMU faults of any kind to occur). Defaulting to a mode where admins may not even become aware of issues with devices can be considered undesirable. Therefore convert this mode of operation to an optional one, not one enabled by default. This involves resurrecting code commit ea388678 ("x86 / iommu: set up a scratch page in the quarantine domain") did remove, in a slightly extended and abstracted fashion. Here, instead of reintroducing a pretty pointless use of "goto" in domain_context_unmap(), and instead of making the function (at least temporarily) inconsistent, take the opportunity and replace the other similarly pointless "goto" as well. In order to key the re-instated bypasses off of there (not) being a root page table this further requires moving the allocate_domain_resources() invocation from reassign_device() to amd_iommu_setup_domain_device() (or else reassign_device() would allocate a root page table anyway); this is benign to the second caller of the latter function. In VT-d's domain_context_unmap(), instead of adding yet another "goto out" when all that's wanted is a "return", eliminate the "out" label at the same time. Take the opportunity and also limit the control to builds supporting PCI. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Reviewed-by:
Paul Durrant <paul@xen.org> Reviewed-by:
Kevin Tian <kevin.tian@intel.com>
-
- 06 Jul, 2021 9 commits
-
-
Olaf Hering authored
Introduce a helper which decides if a given pfn type has data in the migration stream. No change in behaviour intended, except for invalid page types which now have a safer default. Signed-off-by:
Olaf Hering <olaf@aepfle.de> Reviewed-by:
Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by:
Juergen Gross <jgross@suse.com>
-
Olaf Hering authored
Introduce a helper which decides if a given pfn in the migration stream is backed by memory. This highlights more clearly that type XEN_DOMCTL_PFINFO_XALLOC (a synthetic toolstack-only type used between Xen 4.2 to 4.5 which indicated a dirty page on the sending side for which no data will be send in the initial iteration) does get populated in the VM. No change in behaviour intended, except for invalid page types which now have a safer default. Signed-off-by:
Olaf Hering <olaf@aepfle.de> Reviewed-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Olaf Hering authored
Users of xc_get_pfn_type_batch may want to sanity check the data returned by Xen. Add helpers for this purpose: is_known_page_type verifies the type returned by Xen on the saving side, or the incoming type for a page on the restoring side, is known by the save/restore code. Signed-off-by:
Olaf Hering <olaf@aepfle.de> Reviewed-by:
Juergen Gross <jgross@suse.com> Reviewed-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Olaf Hering authored
Using the first element of a tuple for a format specifier fails with python3.4 as included in SLE12: b = b"string/%x" % (i, ) TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple' It happens to work with python 2.7 and 3.6. To support older Py3, format as strings and explicitly encode as ASCII. Signed-off-by:
Olaf Hering <olaf@aepfle.de> Reviewed-by:
Andrew Cooper <andrew.cooper3@citrix.com> Acked-by:
Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
-
Olaf Hering authored
The trailing member name[] in libxl__physmap_info is written as a cstring into the stream. The current code does a sanity check if the last byte is zero. This attempt fails with python3 because name[-1] returns a type int. As a result the comparison with byte(\00) fails: File "/usr/lib/xen/bin/convert-legacy-stream", line 347, in read_libxl_toolstack raise StreamError("physmap name not NUL terminated") StreamError: physmap name not NUL terminated To handle both python variants, cast to bytearray(). Signed-off-by:
Olaf Hering <olaf@aepfle.de> Reviewed-by:
Andrew Cooper <andrew.cooper3@citrix.com> Acked-by:
Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
-
Michal Orzel authored
AArch64 registers are 64bit whereas AArch32 registers are 32bit or 64bit. MSR/MRS are expecting 64bit values thus we should get rid of helpers READ/WRITE_SYSREG32 in favour of using READ/WRITE_SYSREG. We should also use register_t type when reading sysregs which can correspond to uint64_t or uint32_t. Even though many AArch64 registers have upper 32bit reserved it does not mean that they can't be widen in the future. Modify type of hsr, cpsr, spsr_el1 to uint64_t. Previously we relied on the padding after spsr_el1. As we removed the padding, modify the union to be 64bit so we don't corrupt spsr_fiq. No need to modify the assembly code because the accesses were based on 64bit registers as there was a 32bit padding after spsr_el1. Remove 32bit padding in cpu_user_regs before spsr_fiq as it is no longer needed due to upper union being 64bit now. Add 64bit padding in cpu_user_regs before spsr_el1 because the kernel frame should be 16-byte aligned. Change type of cpsr to uint64_t in the public outside interface "public/arch-arm.h" to allow ABI compatibility between 32bit and 64bit. Increment XEN_DOMCTL_INTERFACE_VERSION. Change type of cpsr to uint64_t in the public outside interface "public/vm_event.h" to allow ABI compatibility between 32bit and 64bit. Signed-off-by:
Michal Orzel <michal.orzel@arm.com> Reviewed-by:
Bertrand Marquis <bertrand.marquis@arm.com> Reviewed-by:
Julien Grall <jgrall@amazon.com>
-
Oleksandr Tyshchenko authored
At the moment, Xen on Arm64 expects the memory banks to be ordered. Unfortunately, there may be a case when updated by firmware device tree contains unordered banks. This means Xen will panic when setting xenheap mappings for the subsequent bank with start address being less than xenheap_mfn_start (start address of the first bank). As there is no clear requirement regarding ordering in the device tree, update code to be able to deal with by sorting memory banks. There is only one heap region on Arm32, so the sorting is fine to be done in the common code. Suggested-by:
Julien Grall <jgrall@amazon.com> Signed-off-by:
Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> Reviewed-by:
Stefano Stabellini <sstabellini@kernel.org> Reviewed-by:
Bertrand Marquis <bertrand.marquis@arm.com> Acked-by:
Julien Grall <jgrall@amazon.com>
-
Julien Grall authored
When Live-Updating with some load, Xenstored may hit the assert req->in == lu_status->in in do_lu_start(). This is happening because the request is stashed when Live-Update begins. This happens in a different request (see call lu_begin() when select the new binary) from the one performing Live-Update. To avoid the problem, stash the request in lu_start(). Fixes: 65f19ed6 ("tools/xenstore: Don't assume conn->in points to the LU request") Reported-by:
Michael Kurth <mku@amazon.com> Signed-off-by:
Julien Grall <jgrall@amazon.com> Reviewed-by: luca.fancellu@arm.com Reviewed-by:
Juergen Gross <jgross@suse.com>
-
Sergiy Kibrik authored
Pass 128 bytes of random seed via FDT, so that guests' CRNGs are better seeded early at boot. This is larger than ChaCha20 key size of 32, so each byte of CRNG state will be mixed 4 times using this seed. There does not seem to be advantage in larger seed though. Depending on its configuration Linux can use the seed as device randomness or to just quickly initialize CRNG. In either case this will provide extra randomness to further harden CRNG. Signed-off-by:
Sergiy Kibrik <Sergiy_Kibrik@epam.com> Reviewed-by:
Julien Grall <julien@xen.org> Reviewed-by:
Michal Orzel <michal.orzel@arm.com>
-
- 05 Jul, 2021 5 commits
-
-
Anthony PERARD authored
The LIBS section doesn't mention the headers associated with the libraries, same for LIBXENLIGHT section. They aren't any ':' in other section names, so remove it. Fixes: 4664034c ("tools/libs: move official headers to common directory") Fixes: f7079d7e ("MAINTAINERS: add myself as tools/libs reviewer") Signed-off-by:
Anthony PERARD <anthony.perard@citrix.com> Reviewed-by:
Juergen Gross <jgross@suse.com>
-
Anthony PERARD authored
Fixes: e321576f ("xen/build: start using if_changed") Signed-off-by:
Anthony PERARD <anthony.perard@citrix.com> Reviewed-by:
Jan Beulich <jbeulich@suse.com>
-
Jan Beulich authored
In commit 90629587 ("x86/shadow: replace stale literal numbers in hash_{vcpu,domain}_foreach()") I had to work around Clang not following gcc in certain relaxed requirements as to the expressions usable with _Static_assert() (gcc tolerates static const variables in otherwise integer constant expressions). Roberto suggests that we'd better not rely on such behavior. Drop the involved static const-s, using their "expansions" in both of the prior use sites each. This then allows dropping the short-circuiting of the check for clang. Requested-by:
Roberto Bagnara <roberto.bagnara@bugseng.com> Signed-off-by:
Jan Beulich <jbeulich@suse.com> Acked-by:
Andrew Cooper <andrew.cooper3@citrix.com> Acked-by:
Tim Deegan <tim@xen.org>
-
Andrew Cooper authored
The code has gone through many refactors, but the first refactor was the one which broke it by inverting the check with respect to checkpointed streams. Fixes: 7449fb36 ("migration/save: pass checkpointed_stream from libxl to libxc") Reported-by:
Olaf Hering <olaf@aepfle.de> Signed-off-by:
Andrew Cooper <andrew.cooper3@citrix.com> Acked-by:
Olaf Hering <olaf@aepfle.de> Reviewed-by:
Jan Beulich <jbeulich@suse.com>
-
Andrew Cooper authored
0x1c is lower than any value which will actually be observed in p->extd.max_leaf, but higher than the logical 9 leaves worth of extended data on Intel systems, causing x86_cpuid_copy_to_buffer() to fail with -ENOBUFS. Correct the calculation. The problem was first noticed in c/s 34990446 "libxl: don't ignore the return value from xc_cpuid_apply_policy" but introduced earlier. Fixes: 111c8c33 ("x86/cpuid: do not expand max leaves on restore") Reported-by:
Olaf Hering <olaf@aepfle.de> Signed-off-by:
Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by:
Jan Beulich <jbeulich@suse.com>
-
- 02 Jul, 2021 5 commits
-
-
Olaf Hering authored
A single slash gives a float, a double slash gives an int. bitmap = unpack_exact("Q" * ((max_id/64) + 1)) TypeError: can't multiply sequence by non-int of type 'float' Use future division to remain compatible with python 2. Signed-off-by:
Olaf Hering <olaf@aepfle.de> Reviewed-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Olaf Hering authored
Replace emualted with emulated. Signed-off-by:
Olaf Hering <olaf@aepfle.de> Acked-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Anthony PERARD authored
Usage of 'scsi-disk' device is deprecated and removed from QEMU, instead we need to use 'scsi-hd' for hard drives. See QEMU 879be3af49 (hw/scsi: remove 'scsi-disk' device) Signed-off-by:
Anthony PERARD <anthony.perard@citrix.com> Reviewed-by:
Jason Andryuk <jandryuk@gmail.com>
-
Anthony PERARD authored
f3f778c8 forgot one boolean parameter. Fixes: f3f778c8 ("libxl: Replace QEMU's command line short-form boolean option") Signed-off-by:
Anthony PERARD <anthony.perard@citrix.com> Reviewed-by:
Jason Andryuk <jandryuk@gmail.com>
-
Anthony PERARD authored
qemu-xen tree have a osstest gate and doesn't need to be pinned. On the other hand, OVMF's xen repository doesn't have a gate and needs to be pinned. The "master" branch correspond now to the tag "edk2-stable202105", so pin to that commit. Fixes: a04509d3 ("Branching: Update version files etc. for newly unstable") Signed-off-by:
Anthony PERARD <anthony.perard@citrix.com> Acked-by:
Ian Jackson <iwj@xenproject.org>
-
- 29 Jun, 2021 6 commits
-
-
Jan Beulich authored
It appears unhelpful to me for flush_command_buffer() to block all progress elsewhere for the given IOMMU by holding its lock while waiting for command completion. There's no real need for callers of that function or of send_iommu_command() to hold the lock. Contain all command sending related locking to the latter function. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Reviewed-by:
Paul Durrant <paul@xen.org>
-
Jan Beulich authored
The present abuse of the completion interrupt does not only stand in the way of, down the road, using it for its actual purpose, but also requires holding the IOMMU lock while waiting for command completion, limiting parallelism and keeping interrupts off for non-negligible periods of time. Have the IOMMU do an ordinary memory write instead of signaling an otherwise disabled interrupt (by just updating a status register bit). Since IOMMU_COMP_WAIT_I_FLAG_SHIFT is now unused and IOMMU_COMP_WAIT_[FS]_FLAG_SHIFT already were, drop all three of them while at it. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Reviewed-by:
Paul Durrant <paul@xen.org>
-
Jan Beulich authored
The macro expanding to quite a few insns, replace its use by simply clearing the status flags when the to be executed insn doesn't depend on their initial state, in cases where this is easily possible. (There are more cases where the uses are hidden inside macros, and where some of the users of the macros want guest flags put in place before running the insn, i.e. the macros can't be updated as easily.) Signed-off-by:
Jan Beulich <jbeulich@suse.com> Reviewed-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Jan Beulich authored
We should try to limit the failure reasons after we've started making changes. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Acked-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Jan Beulich authored
While the precise values are unlikely of interest once they exceed 4 billion (allowing us to leave alone the domctl struct), we still shouldn't wrap or truncate the actual values. It is in particular problematic if the truncated values were zero (causing libxenguest to skip an iteration altogether) or a very small value (leading to premature exiting of the pre-copy phase). Change the internal fields to unsigned long, and suitably saturate for copying to guest context. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Acked-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Jan Beulich authored
Convert the two remaining uses as well as Arm's stub to the properly named and type-safe mfn_to_gfn(), dropping x86's definition (where we already have mfn_to_gfn()). Signed-off-by:
Jan Beulich <jbeulich@suse.com> Acked-by:
Julien Grall <julien@xen.org> Acked-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
- 28 Jun, 2021 1 commit
-
-
Andrew Cooper authored
As recommended in http://www.gnu.org/licenses/gpl-howto.en.html. Exactly as per changeset 443701ef - Some errors have crept back in in the past 6 years. Signed-off-by:
Andrew Cooper <andrew.cooper3@citrix.com> Acked-by:
Julien Grall <jgrall@amazon.com>
-
- 25 Jun, 2021 5 commits
-
-
Rahul Singh authored
Backport commit e19898077cfb642fe151ba22981e795c74d9e114 "iommu/arm-smmu: Set privileged attribute to 'default' instead of 'unprivileged'" Original commit message: Currently the driver sets all the device transactions privileges to UNPRIVILEGED, but there are cases where the iommu masters wants to isolate privileged supervisor and unprivileged user. So don't override the privileged setting to unprivileged, instead set it to default as incoming and let it be controlled by the pagetable settings. Acked-by:
Will Deacon <will.deacon@arm.com> Signed-off-by:
Sricharan R <sricharan@codeaurora.org> Signed-off-by:
Will Deacon <will.deacon@arm.com> Signed-off-by:
Rahul Singh <rahul.singh@arm.com> Acked-by:
Stefano Stabellini <sstabellini@kernel.org> Tested-by:
Stefano Stabellini <sstabellini@kernel.org>
-
Rahul Singh authored
SMR allocation should be based on the number of supported stream matching register for each SMMU device. Issue introduced by commit 5e08586a when backported the patches from Linux to XEN to fix the stream match conflict issue when two devices have the same stream-id. Acked-by:
Stefano Stabellini <sstabellini@kernel.org> Tested-by:
Stefano Stabellini <sstabellini@kernel.org> Signed-off-by:
Rahul Singh <rahul.singh@arm.com>
-
Jan Beulich authored
Failure here could in principle mean the device may still be issuing DMA requests, which would continue to be translated by the page tables the device entry currently points at. With this we cannot allow the subsequent cleanup step of freeing the page tables to occur, to prevent use-after-free issues. We would need to accept, for the time being, that in such a case the remaining domain resources will all be leaked, and the domain will continue to exist as a zombie. However, with flushes no longer timing out (and with proper timeout detection for device I/O TLB flushing yet to be implemented), there's no way anymore for failures to occur, except due to bugs elsewhere. Hence the change here is merely a "just in case" one. In order to continue the loop in spite of an error, we can't use pci_get_pdev_by_domain() anymore. I have no idea why it was used here in the first place, instead of the cheaper list iteration. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Reviewed-by:
Paul Durrant <paul@xen.org>
-
Andrew Cooper authored
Fixes: bef64f2c ("libxencall: introduce variant of xencall2() returning long") Signed-off-by:
Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by:
Ian Jackson <iwj@xenproject.org>
-
Julien Grall authored
Commit c0fe360f ("tools/xenstored: Extend restore code to handle multiple input buffer") extend the read_buffered_state() to support multiple input buffers. Unfortunately, the commit didn't go far enough and still used sc->data (start of the buffers) for retrieving the header. This would lead to read the wrong headers for second and follow-up commands. Use data in place for sc->data for the source of the memcpy()s. Fixes: c0fe360f ("tools/xenstored: Extend restore code to handle multiple input buffer") Reported-by:
Raphael Ning <raphning@amazon.com> Signed-off-by:
Julien Grall <jgrall@amazon.com> Reviewed-by:
Juergen Gross <jgross@suse.com>
-
- 24 Jun, 2021 8 commits
-
-
Julien Grall authored
Commit 3adfb503 ("tools/xenstored: Introduce a wrapper for conn->funcs->can_{read, write}") consolidated the check !conn->is_ignored in two new wrappers. This means the check in socket_can_process() is now redundant. In fact it should have been removed in orignal commit (as it was done for the domain helpers). Reported-by: Raphael Ning <raphning@amazon.com Signed-off-by:
Julien Grall <jgrall@amazon.com> Reviewed-by:
Juergen Gross <jgross@suse.com>
-
Jan Beulich authored
libxc generally uses uint32_t to represent domain IDs. This is fine as long as addresses of such variables aren't taken, to then pass into hypercalls: To the hypervisor, a domain ID is a 16-bit value. Introduce a wrapper struct to deal with the issue. (On architectures with arguments passed in registers, an intermediate variable would have been created by the compiler already anyway, just one of the wrong type.) The public interface change is both source and binary compatible for the architectures we currently support. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Acked-by:
Ian Jackson <iwj@xenproject.org> Reviewed-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Jan Beulich authored
There's no xencall6(), so the version script also shouldn't mention it. If such a function would ever appear, it shouldn't land in version 1.0. No change to the generated binary, nor abi-dumper's view of the object. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Acked-by:
Ian Jackson <iwj@xenproject.org> Reviewed-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Jan Beulich authored
Some sub-functions, XENMEM_maximum_gpfn and XENMEM_maximum_ram_page in particular, can return values requiring more than 31 bits to represent. Hence we cannot issue the hypercall directly when the return value of ioctl() is used to propagate this value. This is the case for Linux and Solaris (and hence needs changing), while the BSDs avoid using the return value for dual purposes altogether, and MiniOS already wraps all hypercalls in a multicall. Suggested-by:
Jürgen Groß <jgross@suse.com> Signed-off-by:
Jan Beulich <jbeulich@suse.com> Acked-by:
Ian Jackson <iwj@xenproject.org> Acked-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Jan Beulich authored
Some hypercalls, memory-op in particular, can return values requiring more than 31 bits to represent. Hence the underlying layers need to make sure they won't truncate such values. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Acked-by:
Ian Jackson <iwj@xenproject.org> Acked-by:
Andrew Cooper <andrew.cooper3@citrix.com>
-
Jan Beulich authored
Some hypercalls, memory-op in particular, can return values requiring more than 31 bits to represent. Hence the underlying layers need to make sure they won't truncate such values. (Note that for Solaris the function also gets renamed, to match the other OSes.) Due to them merely propagating ioctl()'s return value, this change is benign on Linux and Solaris. IOW there's an actual effect here only for the BSDs and MiniOS, but even then further adjustments are needed at the xencall<N>() level. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Acked-by:
Andrew Cooper <andrew.cooper3@citrix.com> Acked-by:
Ian Jackson <iwj@xenproject.org>
-
Jan Beulich authored
To be able to use them from, in particular, the tool stack, they need to be supported for all guest types. Note that xc_resource_op() already does, so would not work without this on PVH Dom0. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Begrudingly acked-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by:
Ian Jackson <iwj@xenproject.org>
-
Jan Beulich authored
Replace uses of QINVAL_ENTRY_ORDER and QINVAL_INDEX_SHIFT, such that the constants can be dropped. Move the remaining QINVAL_* ones to the single source file using them. Signed-off-by:
Jan Beulich <jbeulich@suse.com> Reviewed-by:
Kevin Tian <kevin.tian@intel.com>
-