]> xenbits.xensource.com Git - people/liuw/xtf.git/log
people/liuw/xtf.git
8 years agoDO NOT APPLY a test that always returns error master
Wei Liu [Thu, 4 Aug 2016 07:05:55 +0000 (08:05 +0100)]
DO NOT APPLY a test that always returns error

8 years agoxtf-runner: Introduce logfile mode for obtaining results
Wei Liu [Mon, 15 Aug 2016 14:55:22 +0000 (15:55 +0100)]
xtf-runner: Introduce logfile mode for obtaining results

Add --results-mode=logfile as an alternative method of obtaining test results.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoUpdate XSA-173 to use newer helpers
Andrew Cooper [Fri, 2 Sep 2016 12:26:00 +0000 (13:26 +0100)]
Update XSA-173 to use newer helpers

Use pte_from_*() and PF_SYM() rather than opencoding them.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd helpers to fold and unfold a pv32pae guest cr3
Andrew Cooper [Tue, 30 Aug 2016 16:29:51 +0000 (17:29 +0100)]
Add helpers to fold and unfold a pv32pae guest cr3

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoUpdate the documentation to point at XTF's canonical location
Andrew Cooper [Thu, 18 Aug 2016 16:19:23 +0000 (17:19 +0100)]
Update the documentation to point at XTF's canonical location

Add a note concerning OSSTest, pointing elsewhere

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoFix Clang build following c/s 9f35dbe0
Andrew Cooper [Fri, 12 Aug 2016 12:32:01 +0000 (13:32 +0100)]
Fix Clang build following c/s 9f35dbe0

Clang objects to macros altering the prototypes in string.c, and redefining
the __builtin_*() varients.  Reduce the include to just <xen/types.h>.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce a binary representation of the Force Emulation Prefix
Andrew Cooper [Fri, 5 Aug 2016 17:20:16 +0000 (17:20 +0000)]
Introduce a binary representation of the Force Emulation Prefix

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce xtf_set_idte() to allow tests to add extra IDT entries
Andrew Cooper [Fri, 15 Jul 2016 16:02:56 +0000 (16:02 +0000)]
Introduce xtf_set_idte() to allow tests to add extra IDT entries

Add an extra entry to the selftests.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIDT Vector allocation and infrastructure
Andrew Cooper [Fri, 15 Jul 2016 15:31:58 +0000 (15:31 +0000)]
IDT Vector allocation and infrastructure

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd `./xtf-runner --list --environments` to obtain the full environment list
Andrew Cooper [Wed, 3 Aug 2016 14:28:41 +0000 (15:28 +0100)]
Add `./xtf-runner --list --environments` to obtain the full environment list

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd CONFIG_{32,64}BIT to config.h
Andrew Cooper [Wed, 3 Aug 2016 14:20:45 +0000 (15:20 +0100)]
Add CONFIG_{32,64}BIT to config.h

To allow the use of IS_DEFINED() in preference to #ifdef __x86_64__/__i386__
to reduce the likelihood of bitrot.

In turn, modify page.h and pagetable.h sufficiently to compile for unpaged
enviroments. This leaves a link error if dead-code-elimination doesn't manage
to elide the reference.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAudit the use of the skip result
Andrew Cooper [Wed, 3 Aug 2016 11:48:39 +0000 (12:48 +0100)]
Audit the use of the skip result

Report a skip for swint-emulation if the main purpose of the test is unable to
be performed.  However, run the first half of the tests against real hardware
to confirm that the algorithm is correct

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce test_needs_fep to help uniform handling of fep being unavailable
Andrew Cooper [Wed, 3 Aug 2016 11:33:52 +0000 (12:33 +0100)]
Introduce test_needs_fep to help uniform handling of fep being unavailable

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agobuild: Fix the install rule for configuration files
Andrew Cooper [Tue, 2 Aug 2016 18:43:12 +0000 (19:43 +0100)]
build: Fix the install rule for configuration files

install-$(env) should only depend on the $(env) subset of all configuration
files, and all configuration files should be installed, rather than just the
first listed.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agomkinfo: Fix JSON damage from splitting an empty string
Andrew Cooper [Tue, 2 Aug 2016 18:08:43 +0000 (19:08 +0100)]
mkinfo: Fix JSON damage from splitting an empty string

In python, splitting an empty string results in a single-entry list containing
an empty string.  This causes the variations list to be wrong when no
variations are in use.

It is only by chance that doesn't cause an issue for ./xtf-runner

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoRework the pv-iopl test using variations
Andrew Cooper [Tue, 2 Aug 2016 16:30:41 +0000 (17:30 +0100)]
Rework the pv-iopl test using variations

The hypercall and vmassist tests are logically separate, and while the
hypercall version has been around for a very long time, vmassist was only
introduced in Xen 4.7.

To be able to sensibly test the hypercall part on older versions of Xen, they
should be treated separately, so the skip from vmassist detection doesn't
influence the results from the hypercall test.

To test them independently, introduce variations which alter the cmdline
passed to the guest.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd an implementation of strcmp()
Andrew Cooper [Tue, 2 Aug 2016 17:07:18 +0000 (18:07 +0100)]
Add an implementation of strcmp()

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-183 PoC
Andrew Cooper [Thu, 14 Jul 2016 12:07:16 +0000 (13:07 +0100)]
XSA-183 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce GFN terminology to memory management
Andrew Cooper [Tue, 2 Aug 2016 15:09:00 +0000 (16:09 +0100)]
Introduce GFN terminology to memory management

which allows for common code to use gfn_to_virt()/virt_to_gfn() without
needing to worry whether it is a PV or HVM guest.

Add a pte_from_virt() helper to construct a pagetable entry pointing at a data
item linked into the test microkernel.  To avoid inclusion problems, split the
independent pagetable modification functions out into a separate header file.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agorunner: Add --all and --non-default options to help with category selection
Andrew Cooper [Tue, 2 Aug 2016 09:46:45 +0000 (10:46 +0100)]
runner: Add --all and --non-default options to help with category selection

This allows calling software to easily find all tests to run without needing
to name categories, environments or tests specifically.

--all is expected to cover the usual case, while --non-default is provided
just in case.  It is not expected to be running the non-default category tests
in bulk.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoMisc documentation improvements
Andrew Cooper [Fri, 29 Jul 2016 16:22:13 +0000 (16:22 +0000)]
Misc documentation improvements

 * Update the test running examples to use ./xtf-runner
 * Correct two descriptions of issues fixed in Xen 4.7

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce 'hap' and 'shadow' variations
Andrew Cooper [Wed, 27 Jul 2016 12:24:01 +0000 (13:24 +0100)]
Introduce 'hap' and 'shadow' variations

Used for HVM-based tests pertaining to pagetable behaviour, which want running
both against both paging modes.

Modify the invlpg tests to run in both shadow and hap paging modes.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce test variations
Andrew Cooper [Wed, 27 Jul 2016 12:23:29 +0000 (13:23 +0100)]
Introduce test variations

In certain cases it will be useful to run the same test binary with different
configurations, providing logically separate results.

Introduce the concept of a test variation, which generates a different set of
configuraiton files referring to the same binary.  xtf-runner is updated to
understand variations.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agorunner: Rework test selection logic
Andrew Cooper [Fri, 29 Jul 2016 16:28:49 +0000 (16:28 +0000)]
runner: Rework test selection logic

The existing logic for test selection was awkward to use and somewhat
non-intuitive.  It also had an annoying habit of accidentially running the msr
utility and causing excessive logspam.

First of all, switch the all_{categories,environments} tuples to sets, which
allows for cleaner logic during selection.  Split all_categories into default
and non-default subsets, where the non-default subset is not available unless
explicitly referenced.

Introduce interpret_selection() with the purpse of interpreting a collection
of string parameter, and returning the commplete list of TestInstances covered
by the selection.

interpret_selection() is now called before action selection, and replaces the
existing ad-hoc logic in the list and run calls.  As a result, selections are
now identical for the list and run paths.

The --help documentation is also updated to reflect the new behaviour.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agorunner: Introduce TestInstance to wrap an individual test
Andrew Cooper [Mon, 1 Aug 2016 10:20:02 +0000 (11:20 +0100)]
runner: Introduce TestInstance to wrap an individual test

Implement vm_name() and cfg_path() methods to move those details out of the
test running logic.

Introduce parse_test_instance_string() as a single location tasked with
parsing the string representation of a test instance, and verifying the
provided information.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agorunner: Introduce TestInfo to wrap the raw test json
Andrew Cooper [Fri, 29 Jul 2016 15:31:26 +0000 (15:31 +0000)]
runner: Introduce TestInfo to wrap the raw test json

The constructor now performs appropriate verification on the json
configuration, rather than open-coding it in get_all_test_info().  Users of
the dictionary-like json are altered to use attributes.

An all_instances() method is added to return test instances for all suitable
environments, optionally with a subset filter.  This is used in preference to
three open-coded loops, generating instance names.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agorunner: Cache the combined test json
Andrew Cooper [Thu, 28 Jul 2016 11:54:26 +0000 (11:54 +0000)]
runner: Cache the combined test json

To avoid rereading the same data from the disk.  Later it will be needed on
several paths.  Additionally, rename 'test_info' to 'info_file' to make its
use more clear.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agorunner: Switch --host to being a real parameter
Andrew Cooper [Thu, 28 Jul 2016 11:47:00 +0000 (11:47 +0000)]
runner: Switch --host to being a real parameter

This avoids having extra magic parameters in the mix of categories,
environments and test names

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce .gitattributes
Andrew Cooper [Fri, 29 Jul 2016 13:02:42 +0000 (13:02 +0000)]
Introduce .gitattributes

This allows `git diff` and friends to be slightly more clever about generating
hunks for specific files.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agobuild: Generate xl configurations with a python script rather than by hand
Andrew Cooper [Tue, 26 Jul 2016 18:55:26 +0000 (19:55 +0100)]
build: Generate xl configurations with a python script rather than by hand

It is about to get more complicated.  Additionally, specify a dependency on
$(TEST-EXTRA-CFG) if specified by a test.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agomkinfo: Assign names to command line parameters
Andrew Cooper [Tue, 26 Jul 2016 18:53:18 +0000 (19:53 +0100)]
mkinfo: Assign names to command line parameters

This is easier to read, and has a side effect of bailing with a hard error if
the wrong number of parameters are passed.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoRename test-info.json to just info.json
Andrew Cooper [Mon, 25 Jul 2016 16:37:09 +0000 (17:37 +0100)]
Rename test-info.json to just info.json

There are enough files starting with test.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agobuild: Add move-if-changed helper
Andrew Cooper [Tue, 26 Jul 2016 15:33:43 +0000 (15:33 +0000)]
build: Add move-if-changed helper

And use it in preference to repeated opencoding

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCorrect the usage of $(DESTDIR) and $(PREFIX)
Andrew Cooper [Wed, 20 Jul 2016 17:43:13 +0000 (18:43 +0100)]
Correct the usage of $(DESTDIR) and $(PREFIX)

The GNU coding standards expect $(DESTDIR) to be the root of everything
installed, and for $(PREFIX) to then be added to the path.  This is not how
XTF previously behaved.

XTF is not a typical package, and doesn't meet the usual semantics; it expects
to arrange all files under a single directory.  Drop the use of $(PREFIX)
entirely (to avoid the expectation that it behaves as $(prefix) usually
behaves) and introduce $(xtfdir) instead.

$(DESTDIR) now works as intended for staged installes, and $(xtfdir) is the
single selected directy containing all installed content.

The intended way to install XTF now:

  $ make install DESTDIR=/path/to/staging/area xtfdir=/local/scratch/xtf

Reported-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
8 years agoIntroduce $(INSTALL_DIR) and use it in preference to mkdir
Andrew Cooper [Thu, 21 Jul 2016 11:37:15 +0000 (12:37 +0100)]
Introduce $(INSTALL_DIR) and use it in preference to mkdir

Include the -p parameters by default for $(INSTALL*) variables rather than
opencoding them everywhere.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce zeroptr[] for accessing virtual address 0
Andrew Cooper [Mon, 25 Jul 2016 15:29:03 +0000 (16:29 +0100)]
Introduce zeroptr[] for accessing virtual address 0

There are some times when access to 0 is really needed.  Use the linker to
work around NULL pointer logic in the compiler.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoxtf-runner: regularise runner exit code
Wei Liu [Mon, 13 Jun 2016 14:06:48 +0000 (15:06 +0100)]
xtf-runner: regularise runner exit code

The script now returns the most severe result. Document the exit code in
help string.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoxtf-runner: provide a set of exit codes for different results
Wei Liu [Thu, 21 Jul 2016 15:06:19 +0000 (16:06 +0100)]
xtf-runner: provide a set of exit codes for different results

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoxtf-runner: sync all test results
Wei Liu [Mon, 13 Jun 2016 14:30:10 +0000 (15:30 +0100)]
xtf-runner: sync all test results

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agogitignore: ignore vim swp file
Wei Liu [Fri, 22 Jul 2016 09:17:29 +0000 (10:17 +0100)]
gitignore: ignore vim swp file

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoExport ROOT, DESTDIR and PREFIX to all makefiles
Andrew Cooper [Wed, 20 Jul 2016 17:05:45 +0000 (18:05 +0100)]
Export ROOT, DESTDIR and PREFIX to all makefiles

Rather than regenerating them from defaults each time.  Drop the MAKEFLAGS
lines, as MAKEFLAGS are automatically inherited by sub-makes.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce makefile variable for commands in use per the GNU coding standards
Andrew Cooper [Wed, 20 Jul 2016 15:26:33 +0000 (16:26 +0100)]
Introduce makefile variable for commands in use per the GNU coding standards

Use the suggested defaults, and replace all open-coded examples.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoFix the handling of errors in the all/build targets
Andrew Cooper [Wed, 20 Jul 2016 15:26:33 +0000 (16:26 +0100)]
Fix the handling of errors in the all/build targets

Currently a build error will be eaten by the shell for loop, causing the
makefile not to stop.  Use `set -e;` to prevent this behaviour

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agopv32pae: Probe for leaked SMEP/SMAP before switching to user mappings
Andrew Cooper [Sun, 17 Jul 2016 16:45:33 +0000 (17:45 +0100)]
pv32pae: Probe for leaked SMEP/SMAP before switching to user mappings

This allows XTF to panic() with a useful error message, rather than crashing
with an obscure error on the hypervisor console because of Xen failing to
create a bounce frame on the (now-user) stack.

Update the documentation, as Xen 4.7 no longer leaks SMEP/SMAP into guests.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce more pagetable helpers
Andrew Cooper [Tue, 19 Jul 2016 15:05:23 +0000 (16:05 +0100)]
Introduce more pagetable helpers

Symbolic constants for expressing pte flags in a short way, and helpers to
construct a pagetable entry from a frame and flags.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agohvm: Honour test_wants_user_mappings
Andrew Cooper [Tue, 19 Jul 2016 13:51:30 +0000 (14:51 +0100)]
hvm: Honour test_wants_user_mappings

Fewer tests overall need user mappings, so construct the identity pagetables
without _PAGE_USER set in leaf entries by default.

Before loading paging settings, check whether a test has opted-in to user
mappings, and re-add _PAGE_USER to the l1 and l2 pagetable entries.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoProvide PTE_SIZE and PTE_ORDER appropriate for the in-use paging mode
Andrew Cooper [Tue, 19 Jul 2016 12:38:01 +0000 (13:38 +0100)]
Provide PTE_SIZE and PTE_ORDER appropriate for the in-use paging mode

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agopv: Honour test_wants_user_mappings
Andrew Cooper [Tue, 19 Jul 2016 13:58:46 +0000 (14:58 +0100)]
pv: Honour test_wants_user_mappings

32bit PV guests start on supervisor mappings, and previously unilaterally
switched to user mappings.  Now, only switch to user mappings if a test has
opted in.

64bit PV guests run at cpl3, must use user mappings and architecturally have
no choice in the matter.

This change is best reviewed with `git show --ignore-all-space`

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce a per-test opt-in for using user mappings
Andrew Cooper [Tue, 19 Jul 2016 13:51:04 +0000 (14:51 +0100)]
Introduce a per-test opt-in for using user mappings

The choice of user or supervisor mappings is currently chosen for the
test, and is inflexible for a test needing to run in situations where
Xen leaks SMEP/SMAP into the guest, or where the test specifically wants
to use SMEP/SMAP itself.

As it turns out, fewer tests require user mappings than not.  For the
tests which don't require user mappings, allowing them to run on
supervisor mappings is quicker to set up, and allows the test to run
even if Xen leaks paging state.

Introduce test_wants_user_mappings and default it to false.  Tests which
want user mappings can opt-in by overriding the weak reference to true.
Explicit set the opt-in for the three tests which currently require
them.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce more memory management helpers
Andrew Cooper [Tue, 19 Jul 2016 12:36:27 +0000 (13:36 +0100)]
Introduce more memory management helpers

These are still simply, relying on identity mappings and state provided by the
domain builder for PV guests.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd Xen ABI for update_va_mapping flags, and replace opencoded constants
Andrew Cooper [Fri, 15 Jul 2016 09:02:29 +0000 (10:02 +0100)]
Add Xen ABI for update_va_mapping flags, and replace opencoded constants

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoReplace @sa with @see in all documentation
Andrew Cooper [Fri, 15 Jul 2016 13:02:37 +0000 (14:02 +0100)]
Replace @sa with @see in all documentation

They are identical as far as Doxygen is concerned, but more intuitive when
reading the raw text.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce invlpg() helper
Andrew Cooper [Wed, 1 Jun 2016 13:40:21 +0000 (14:40 +0100)]
Introduce invlpg() helper

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoHelpers to pack and unpack a frame in a PSE36 superpage
Andrew Cooper [Wed, 1 Jun 2016 13:34:41 +0000 (14:34 +0100)]
Helpers to pack and unpack a frame in a PSE36 superpage

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCreate aliases of the live L1 and L2 pagetables
Andrew Cooper [Sun, 5 Jun 2016 17:18:35 +0000 (18:18 +0100)]
Create aliases of the live L1 and L2 pagetables

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce paddr_t
Andrew Cooper [Sun, 5 Jun 2016 12:42:08 +0000 (13:42 +0100)]
Introduce paddr_t

rather than just using uint64_t.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce PRI helper definitions for PTEs
Andrew Cooper [Sun, 5 Jun 2016 12:28:00 +0000 (13:28 +0100)]
Introduce PRI helper definitions for PTEs

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoMore pagetable order and entries information
Andrew Cooper [Sun, 5 Jun 2016 11:22:57 +0000 (12:22 +0100)]
More pagetable order and entries information

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoMore space for static inline pagetable helpers
Andrew Cooper [Sun, 5 Jun 2016 11:18:35 +0000 (12:18 +0100)]
More space for static inline pagetable helpers

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce typesafe min()/max() helpers
Andrew Cooper [Fri, 27 May 2016 09:42:53 +0000 (10:42 +0100)]
Introduce typesafe min()/max() helpers

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce mmu_update() hypercall infrastructure
Andrew Cooper [Mon, 11 Jul 2016 12:46:53 +0000 (13:46 +0100)]
Introduce mmu_update() hypercall infrastructure

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCollect CPU family/model/stepping information on boot
Andrew Cooper [Fri, 27 May 2016 13:34:41 +0000 (14:34 +0100)]
Collect CPU family/model/stepping information on boot

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd FEP utility
Wei Liu [Mon, 20 Jun 2016 14:44:38 +0000 (15:44 +0100)]
Add FEP utility

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoHelpers to retrieve %ss and %esp from cpu_regs
Andrew Cooper [Fri, 27 May 2016 07:53:53 +0000 (08:53 +0100)]
Helpers to retrieve %ss and %esp from cpu_regs

In 32bit, if not stack switch occurs, this information isn't present in an
exception frame.  As a result, regs->sp and regs->ss may actually alias the
interrupted stack frame.  To avoid accidental incorrect use, prefix the names
in cpu_regs with an underscore.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce ASSERT() and BUILD_BUG_ON()
Andrew Cooper [Thu, 16 Jun 2016 12:05:01 +0000 (12:05 +0000)]
Introduce ASSERT() and BUILD_BUG_ON()

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoxtf-runner: Extend test selection to run multiple tests at once
Andrew Cooper [Tue, 7 Jun 2016 17:08:10 +0000 (18:08 +0100)]
xtf-runner: Extend test selection to run multiple tests at once

A caller may now specify a test name (in which case all environments will be
run), an environment (in which case every test supporting that environment
will be run), or a category (in which case all tests in that category will be
run).

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoxtf-runner: Support listing tests
Andrew Cooper [Tue, 7 Jun 2016 13:25:38 +0000 (14:25 +0100)]
xtf-runner: Support listing tests

Without parameters, all tests will be returned.

Alternatively, specific environments or categories can be specified, to filter
the results.  A special input of "host" will query Xen for the available
environments, and filter accordingly.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoxtf-runner: Basic test runner
Andrew Cooper [Mon, 22 Feb 2016 12:43:54 +0000 (12:43 +0000)]
xtf-runner: Basic test runner

Currently just accepts a list of full test-$ENV-$NAME, runs them in order, and
provides a results summary at the end.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce a pylint configuration file
Andrew Cooper [Mon, 22 Feb 2016 12:43:52 +0000 (12:43 +0000)]
Introduce a pylint configuration file

Also ignore python intermediate files.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoConstants for all EFER bits
Andrew Cooper [Sun, 29 May 2016 14:58:04 +0000 (15:58 +0100)]
Constants for all EFER bits

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoFix _ASM_EXTABLE_HANDLER() to expand preprocessor tokens in its parameters
Andrew Cooper [Mon, 6 Jun 2016 11:54:40 +0000 (11:54 +0000)]
Fix _ASM_EXTABLE_HANDLER() to expand preprocessor tokens in its parameters

Currently it stringises the literal parameter, which can result in a
non-expanded token ending up in at the assembler, causing a build failure.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce _PAGE_* constants for all pagetable entry bits
Andrew Cooper [Tue, 31 May 2016 17:20:39 +0000 (17:20 +0000)]
Introduce _PAGE_* constants for all pagetable entry bits

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoProvide cpu_has_* helper predicates for common features
Andrew Cooper [Tue, 31 May 2016 17:17:14 +0000 (17:17 +0000)]
Provide cpu_has_* helper predicates for common features

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCollect the CPU vendor on boot, and make it available for tests
Andrew Cooper [Mon, 23 May 2016 18:21:06 +0000 (19:21 +0100)]
Collect the CPU vendor on boot, and make it available for tests

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoProvide {BITS,BYTES}_PER_LONG
Andrew Cooper [Mon, 23 May 2016 13:39:26 +0000 (13:39 +0000)]
Provide {BITS,BYTES}_PER_LONG

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAdd cpuid_e[abcd]x() helper wrappers
Andrew Cooper [Fri, 20 May 2016 10:22:49 +0000 (11:22 +0100)]
Add cpuid_e[abcd]x() helper wrappers

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoHelper script to create new tests, and high level tests documentation
Andrew Cooper [Thu, 19 May 2016 18:22:24 +0000 (19:22 +0100)]
Helper script to create new tests, and high level tests documentation

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoDisable implicit makefile rules
Andrew Cooper [Thu, 19 May 2016 17:09:27 +0000 (18:09 +0100)]
Disable implicit makefile rules

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoRemove setting ROOT path in common.mk
Roger Pau Monne [Thu, 19 May 2016 13:43:30 +0000 (15:43 +0200)]
Remove setting ROOT path in common.mk

Since it might be included from different paths that have different levels
of nestedness. Also all makefiles that include common.mk already define ROOT
on their own.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoProvide _PAGE_AD as shorthand, and simplify the invlpg test
Andrew Cooper [Tue, 17 May 2016 18:37:54 +0000 (19:37 +0100)]
Provide _PAGE_AD as shorthand, and simplify the invlpg test

Pass _PAGE_AD as parameter to the asm block, to reduce the use of magic
constants.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoCollect feature information from cpuid
Andrew Cooper [Wed, 11 May 2016 13:57:58 +0000 (14:57 +0100)]
Collect feature information from cpuid

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoUse IS_DEFINED() in preference to #ifdef
Andrew Cooper [Wed, 11 May 2016 12:56:33 +0000 (13:56 +0100)]
Use IS_DEFINED() in preference to #ifdef

By exposing more code and having the compiler optimise it out, there is less
chance of bitrot.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce IS_DEFINED() for use in C code
Andrew Cooper [Wed, 9 Mar 2016 19:41:59 +0000 (19:41 +0000)]
Introduce IS_DEFINED() for use in C code

Alter CONFIG_{PV,HVM} to be explicitly defined as 1.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoProvide function pointer abstractions for cpuid() and cpuid_count()
Andrew Cooper [Wed, 11 May 2016 12:38:14 +0000 (13:38 +0100)]
Provide function pointer abstractions for cpuid() and cpuid_count()

Code common between PV and HVM using cpuid() needs to use different cpuid()
implementations, as PV guests need to use the Xen forced emulation prefix.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoIntroduce an architecture specific convenience header
Andrew Cooper [Wed, 11 May 2016 11:43:03 +0000 (12:43 +0100)]
Introduce an architecture specific convenience header

Avoid introducing arch/x86/lib.h implicitly via xtf/lib.h

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoXSA-173 PoC
Andrew Cooper [Fri, 18 Mar 2016 21:18:49 +0000 (21:18 +0000)]
XSA-173 PoC

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoMake the tables from hvm/pagetables.S available to C code
Andrew Cooper [Tue, 10 May 2016 16:09:55 +0000 (17:09 +0100)]
Make the tables from hvm/pagetables.S available to C code

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoAllow selecting objcopy binary to use
Roger Pau Monne [Tue, 10 May 2016 12:00:27 +0000 (14:00 +0200)]
Allow selecting objcopy binary to use

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoOnly set CC if it's not set
Roger Pau Monne [Tue, 10 May 2016 11:58:39 +0000 (13:58 +0200)]
Only set CC if it's not set

This prevents overwriting CC if it's already set on the environment.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
8 years agoInvlpg handling test
Andrew Cooper [Wed, 4 May 2016 14:41:48 +0000 (15:41 +0100)]
Invlpg handling test

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoExtend exception table support to include custom handlers
Andrew Cooper [Fri, 6 May 2016 16:40:02 +0000 (17:40 +0100)]
Extend exception table support to include custom handlers

Provide additional documentation, and a selftest.  Introduce __used to
indicate to the compiler that an object is referenced, even if the reference
isn't visible.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAvoid shifting a negative value
Roger Pau Monne [Fri, 6 May 2016 09:17:46 +0000 (11:17 +0200)]
Avoid shifting a negative value

Because it's undefined behaviour.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoFix usage of "-executable" with find
Roger Pau Monne [Fri, 6 May 2016 11:07:30 +0000 (13:07 +0200)]
Fix usage of "-executable" with find

"-executable" is a GNU only extension to find. Instead replace it with a
POSIX compatible one.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoDon't re-define __noinline
Roger Pau Monne [Fri, 6 May 2016 09:15:49 +0000 (11:15 +0200)]
Don't re-define __noinline

On FreeBSD __noinline is already defined in cdefs.h

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoProvide all {read,write}_cr[02348]() stub functions
Andrew Cooper [Thu, 5 May 2016 15:12:17 +0000 (16:12 +0100)]
Provide all {read,write}_cr[02348]() stub functions

Both GCC and Clang correctly encode %cr8 accesses using the lock
instruction prefix in 32bit mode.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoAdd 64bit segment base MSRs to the index
Andrew Cooper [Thu, 5 May 2016 11:44:42 +0000 (12:44 +0100)]
Add 64bit segment base MSRs to the index

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoReserve space in the GDT for test use
Andrew Cooper [Thu, 5 May 2016 09:29:48 +0000 (10:29 +0100)]
Reserve space in the GDT for test use

Currently four entries, although this is an arbitrary choice.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoPrint more information when dumping exceptions
Andrew Cooper [Fri, 29 Apr 2016 12:08:20 +0000 (13:08 +0100)]
Print more information when dumping exceptions

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoHelper routines for decoding x86 architectural state
Andrew Cooper [Thu, 28 Apr 2016 13:24:06 +0000 (14:24 +0100)]
Helper routines for decoding x86 architectural state

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoIntroduce snprintf() and give vsnprintf() an appropriate __printf() attribute
Andrew Cooper [Thu, 28 Apr 2016 12:04:51 +0000 (13:04 +0100)]
Introduce snprintf() and give vsnprintf() an appropriate __printf() attribute

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>