]> xenbits.xensource.com Git - people/liuw/xen.git/log
people/liuw/xen.git
9 years agoMAINTAINERS: add myself as stubdom maintainer master wip.split-stubdom-v2
Wei Liu [Tue, 15 Mar 2016 17:40:56 +0000 (17:40 +0000)]
MAINTAINERS: add myself as stubdom maintainer

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agoMAINTAINERS: point stubdom entries to external tree
Wei Liu [Tue, 15 Mar 2016 17:40:05 +0000 (17:40 +0000)]
MAINTAINERS: point stubdom entries to external tree

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agoINSTALL: remove reference to stubdom
Wei Liu [Tue, 15 Mar 2016 17:38:22 +0000 (17:38 +0000)]
INSTALL: remove reference to stubdom

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agohgignore: remove stubdom entries
Wei Liu [Tue, 15 Mar 2016 17:36:17 +0000 (17:36 +0000)]
hgignore: remove stubdom entries

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agodocs: remove stubdom.txt
Wei Liu [Tue, 15 Mar 2016 17:34:30 +0000 (17:34 +0000)]
docs: remove stubdom.txt

It has been merged to stubdom git tree.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agogitignore: remove stubdom entries
Wei Liu [Tue, 15 Mar 2016 17:30:32 +0000 (17:30 +0000)]
gitignore: remove stubdom entries

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agoRemove stubdom directory
Wei Liu [Wed, 9 Mar 2016 17:41:06 +0000 (17:41 +0000)]
Remove stubdom directory

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Wei Liu <liuw@liuw.name>
9 years agoUnhook stubdom from build system
Wei Liu [Wed, 9 Mar 2016 17:43:52 +0000 (17:43 +0000)]
Unhook stubdom from build system

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
I've run autogen.sh and commit configure change as well.

9 years agolibxl: generate and install stubdompath.sh
Wei Liu [Wed, 9 Mar 2016 20:23:10 +0000 (20:23 +0000)]
libxl: generate and install stubdompath.sh

It's a script used by libxl to launch stubdom. This is split off from
stubdom build system.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxc: use $XEN_ROOT to reference libelf in xen
Wei Liu [Wed, 9 Mar 2016 19:18:41 +0000 (19:18 +0000)]
libxc: use $XEN_ROOT to reference libelf in xen

Stubdom needs to compile and link libelf in xen. Using relative path
breaks that.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agotools: use "?=" to set XEN_ROOT in Makefile
Wei Liu [Thu, 10 Mar 2016 15:47:59 +0000 (15:47 +0000)]
tools: use "?=" to set XEN_ROOT in Makefile

This is because when doing a stubdom build using $(CURDIR) to refer to
XEN_ROOT is wrong. Instead, when make enters directories of interest,
XEN_ROOT is already. So use "?=" is the right choice.

While in theory I can only fix up the places needed (a few libraries),
do this for all Makefiles under tools to keep things consistent.

Done by:
find tools -name Makefile -exec sed -i 's/^\(.*XEN_ROOT\s*\)=\(.*\)$/\1 ?= \2/g' {} \;

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agoconfig: don't hard-code mini-os path
Wei Liu [Wed, 9 Mar 2016 18:51:55 +0000 (18:51 +0000)]
config: don't hard-code mini-os path

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agomm: fix page_list_* helpers to evaluate all their arguments
Andrew Cooper [Wed, 9 Mar 2016 15:52:31 +0000 (16:52 +0100)]
mm: fix page_list_* helpers to evaluate all their arguments

If an architecture does not provide a custom page_list_entry, default
page_list_* helpers are provided, wrapping list_head as an underlying type for
page_list_head.

The two declarations of the page_list_* helpers differ between defines and
static inline functions, where the defines discard some of their parameters.

This causes a compilation failure if CONFIG_BIGMEM and debug=n in p2m-pod.c:

  p2m-pod.c: In function \91p2m_pod_cache_add\92:
  p2m-pod.c:72:20: error: unused variable \91d\92 [-Werror=unused-variable]
       struct domain *d = p2m->domain;
                      ^
  cc1: all warnings being treated as errors

because the use of d outside of the !NDEBUG section doesn't get evaluated as a
parameter by page_list_del().

Fix this by turning all #defines into static inline functions, so all
parameters are evaluated even if they are not used.

While editing this area, correct the return type of page_list_empty from int
to bool_t.

No functional change.

Reported-by: Doug Goldstein <cardoe@cardoe.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agomm: introduce arch_free_heap_page()
Andrew Cooper [Wed, 9 Mar 2016 15:51:50 +0000 (16:51 +0100)]
mm: introduce arch_free_heap_page()

common/page_alloc.c references d->arch.relmem_list, which only exists on x86.
This only compiles on ARM because page_list_del2() discards its second
argument.

Introduce a new common arch_free_heap_page() which only uses common lists in
struct domain, and allow an architecture to override this with a custom
alternative.  x86 then provides a custom arch_free_heap_page() which takes
care of managing d->arch.relmem_list.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agox86/alternatives: correct near branch check
Jan Beulich [Wed, 9 Mar 2016 15:51:16 +0000 (16:51 +0100)]
x86/alternatives: correct near branch check

Make sure the near JMP/CALL check doesn't consume uninitialized
data, not even in a benign way. And relax the length check at once.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agodomctl: add force flag to xen_domctl_vcpuaffinity for undoing pin override
Juergen Gross [Wed, 9 Mar 2016 15:50:29 +0000 (16:50 +0100)]
domctl: add force flag to xen_domctl_vcpuaffinity for undoing pin override

Add a XEN_VCPUAFFINITY_FORCE flag to xen_domctl_vcpuaffinity structure
which will allow to undo a SCHEDOP_pin_override in case of a driver
error of the hardware domain which didn't do the expected
SCHEDOP_pin_override with cpu < 0 which would have done the undo
operation.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agosched: add hypercall option to override and restore vcpu affinity
Juergen Gross [Wed, 9 Mar 2016 15:49:59 +0000 (16:49 +0100)]
sched: add hypercall option to override and restore vcpu affinity

Some hardware (e.g. Dell studio 1555 laptops) require SMIs to be
called on physical cpu 0 only. Linux drivers like dcdbas or i8k try
to achieve this by pinning the running thread to cpu 0, but in Dom0
this is not enough: the vcpu must be pinned to physical cpu 0 via
Xen, too.

Add a stable hypercall option SCHEDOP_pin_override to the sched_op
hypercall to achieve this. It is taking a physical cpu number as
parameter. If pinning is possible (the calling domain has the
privilege to make the call and the cpu is available in the domain's
cpupool) the calling vcpu is pinned to the specified cpu. The old
cpu affinity is saved. To undo the override pinning a negative cpu
value is specified. This will restore the original cpu affinity of
the vcpu.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agocpupool: correct error handling when removing cpu from cpupool
Juergen Gross [Wed, 9 Mar 2016 15:44:04 +0000 (16:44 +0100)]
cpupool: correct error handling when removing cpu from cpupool

When schedule_cpu_switch() called from cpupool_unassign_cpu_helper()
returns an error, the domlist_read_lock isn't released again.

As cpu_disable_scheduler() might have changed affinity of some
domains domain_update_node_affinity() must be called for all domains
in the cpupool even in error case.

Even if looking weird it is okay to let the to be removed cpu set in
cpupool_free_cpus in case of an error returned by
cpu_disable_scheduler(). Add a comment explaining the reason for this.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
9 years agox86/vPMU: do not clobber IA32_MISC_ENABLE
Andrew Cooper [Mon, 7 Mar 2016 16:46:25 +0000 (17:46 +0100)]
x86/vPMU: do not clobber IA32_MISC_ENABLE

The VMX RDMSR intercept for MSR_IA32_MISC_ENABLE falls through into
vpmu_do_rdmsr(), so that core2_vpmu_do_rdmsr() may play with the PTS and PEBS
UNAVAIL bits.

Some 64bit Windows include IA32_MISC_ENABLE in the set of items checked by
PatchGuard, and will suffer a BSOD 0x109 CRITICAL_STRUCTURE_CORRUPTION if the
contents change on migrate.

The vPMU infrastructure should not clobber IA32_MISC_ENABLE at all.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
9 years agohvmloader: use xen/errno.h rather than the host systems errno.h
Andrew Cooper [Mon, 7 Mar 2016 16:46:03 +0000 (17:46 +0100)]
hvmloader: use xen/errno.h rather than the host systems errno.h

hvmloader is unhosted, and shouldn't use the system errno.h.  It already has
to use Xen's errno.h for other hypercalls.  The use of public/io/xs_wire.h
requires the use of un-prefixed errno values.

This fixes the build on stricter toolchains where requesting -fno-builtin does
reduce the include path as much as it can.

Reported-by: Doug Goldstein <cardoe@cardoe.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agopublic/errno: Reduce complexity of inclusion
Andrew Cooper [Mon, 7 Mar 2016 16:45:13 +0000 (17:45 +0100)]
public/errno: Reduce complexity of inclusion

The inclusion rules conditions for errno.h were unnecesserily complicated, and
required the includer to jump through hoops if they wished to avoid getting
multiple namespaces worth of constants.

Simply the logic, and document what is going on.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agotravis: actually disable debug for non-debug
Doug Goldstein [Fri, 4 Mar 2016 20:09:48 +0000 (14:09 -0600)]
travis: actually disable debug for non-debug

Non-debug builds need to explicitly disable debug due to debug being
defaulted to y in Config.mk

(Xen keeps debug=y in the staging branch. When Xen is in rc-X stage
the debug is altered so that the builds don't have the debug
option enabled by default).

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
9 years agotravis: use matching C++ for GCC version
Doug Goldstein [Fri, 4 Mar 2016 20:09:47 +0000 (14:09 -0600)]
travis: use matching C++ for GCC version

When we use GCC 5.x, we need to install the C++ compiler and the C
compiler together because QEMU tests for feature flags against the C
compiler and assumes the C++ compiler has them. We also have to
ensure that GCC C++ is used. Have to do the modification of the CXX variable
in two steps to ensure we support older versions of bash in use by the
test machines. While we're at it simply how we select our compiler.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
9 years agotravis: skip building coverity, smoke, and master
Doug Goldstein [Fri, 4 Mar 2016 20:09:46 +0000 (14:09 -0600)]
travis: skip building coverity, smoke, and master

Skip building of the coverity, smoke, stable, and master branches since
they just fast forward from staging.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
9 years agoxenalyze: handle Credit2 scheduler events
Dario Faggioli [Sat, 6 Feb 2016 01:26:04 +0000 (02:26 +0100)]
xenalyze: handle Credit2 scheduler events

so the trace will show properly decoded info,
rather than just a bunch of hex codes.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Changes from v1:
 * '} * r =' turned into '} *r =', as requested
   during review.

9 years agoxenalyze: handle Credit1 scheduler events
Dario Faggioli [Sat, 6 Feb 2016 01:25:56 +0000 (02:25 +0100)]
xenalyze: handle Credit1 scheduler events

so the trace will show properly decoded info,
rather than just a bunch of hex codes.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
---
Changes from v1:
 * '} * r =' turned into '} *r =', as requested
   during review.

9 years agoxenalyze: handle scheduling events
Dario Faggioli [Sat, 6 Feb 2016 01:25:45 +0000 (02:25 +0100)]
xenalyze: handle scheduling events

so the trace will show properly decoded info,
rather than just a bunch of hex codes.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
---
Changes from v1:
 * SCHED_DOM_{ADD,REM} handling slightly changed, to avoid
   confusion with DOM0_DOM_{ADD,REM} (introduced later in
   the series);
 * '} * r =' turned into '} *r =', as requested
   during review.

9 years agoxentrace: formats: add domain create and destroy events.
Dario Faggioli [Tue, 16 Feb 2016 12:13:47 +0000 (13:13 +0100)]
xentrace: formats: add domain create and destroy events.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Changes from v2:
 * new patch in the series.

9 years agoxentrace: formats: add events from RTDS scheduler
Dario Faggioli [Sat, 6 Feb 2016 01:25:32 +0000 (02:25 +0100)]
xentrace: formats: add events from RTDS scheduler

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Meng Xu <xumengpanda@gmail.com>
Cc: Tianyang Chen <tiche@seas.upenn.edu>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
9 years agoxentrace: formats: add events from Credit2 scheduler
Dario Faggioli [Sat, 6 Feb 2016 01:25:16 +0000 (02:25 +0100)]
xentrace: formats: add events from Credit2 scheduler

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
---
Changes from v1:
 * fix typo in two events (rq_idx/rq_id)., as requested during
   review.

9 years agoxentrace: formats: add events from Credit scheduler
Dario Faggioli [Sat, 6 Feb 2016 01:25:04 +0000 (02:25 +0100)]
xentrace: formats: add events from Credit scheduler

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
9 years agoxentrace: formats: update format of scheduling events
Dario Faggioli [Sat, 6 Feb 2016 01:24:52 +0000 (02:24 +0100)]
xentrace: formats: update format of scheduling events

to include the vcpu IDs, in a way that matches
how the "dom:vcpu" couple is displayed in other
events (runstate changes).

Also add the trace for TRC_SCHED_SHUTDOWN_CODE which
was missing and was done via SCHEDOP_shutdown_code hypercall.
(TRC_SCHED_SHUTDOWN trace was present).

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Olaf Hering <olaf@aepfle.de>
---
Changes from v1:
 * enhanced changelog, as suggested during review.

9 years agoarm/timer: fix panic when booting with DT
Shannon Zhao [Fri, 4 Mar 2016 15:45:52 +0000 (16:45 +0100)]
arm/timer: fix panic when booting with DT

While to support ACPI, patch "arm/acpi: Parse GTDT to initialize timer"
refactors the functions preinit_xen_time and init_xen_time. But it
wrongly moves the platform_get_irq from init_xen_time to
preinit_dt_xen_time and this will cause booting failure.

So move platform_get_irq back to init_xen_time to fix it.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agox86/HVM: re-format cache attribute pinning code
Jan Beulich [Fri, 4 Mar 2016 13:16:48 +0000 (14:16 +0100)]
x86/HVM: re-format cache attribute pinning code

No intended functional change, albeit it includes ditching a redundant
is_hvm_domain().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/HVM: adjust hvm_get_mem_pinned_cacheattr() GFN parameter
Jan Beulich [Fri, 4 Mar 2016 13:16:18 +0000 (14:16 +0100)]
x86/HVM: adjust hvm_get_mem_pinned_cacheattr() GFN parameter

Make it gfn_t and rename it accordingly.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
9 years agox86/HVM: limit flushing on cache attribute pinning adjustments
Jan Beulich [Fri, 4 Mar 2016 13:15:53 +0000 (14:15 +0100)]
x86/HVM: limit flushing on cache attribute pinning adjustments

Avoid cache flush on EPT when removing a UC- range, since when used
this type gets converted to UC anyway (there's no UC- among the types
valid in MTRRs and hence EPT's emt field).

We might further wwant to consider only forcing write buffer flushes
when removing WC ranges.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/HVM: adjust hvm_set_mem_pinned_cacheattr() error indications
Jan Beulich [Fri, 4 Mar 2016 13:15:26 +0000 (14:15 +0100)]
x86/HVM: adjust hvm_set_mem_pinned_cacheattr() error indications

Make it return an error on bad domain kind or obviously bad GFN range.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/HVM: remove unnecessary indirection from hvm_get_mem_pinned_cacheattr()
Jan Beulich [Fri, 4 Mar 2016 13:14:25 +0000 (14:14 +0100)]
x86/HVM: remove unnecessary indirection from hvm_get_mem_pinned_cacheattr()

Its return value can easily serve the purpose. We cannot, however,
return unspecific "success" anymore for a domain of the wrong type -
since no caller exists that would call this for PV domains, simply add
an ASSERT().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
9 years agox86/HVM: honor cache attribute pinning for RAM only
Jan Beulich [Fri, 4 Mar 2016 13:12:11 +0000 (14:12 +0100)]
x86/HVM: honor cache attribute pinning for RAM only

Call hvm_get_mem_pinned_cacheattr() for RAM ranges only, and only when
the guest has a physical device assigned: XEN_DOMCTL_pin_mem_cacheattr
is documented to be intended for RAM only.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
9 years agox86: use "unsigned int" for cache attribute values
Jan Beulich [Fri, 4 Mar 2016 13:09:04 +0000 (14:09 +0100)]
x86: use "unsigned int" for cache attribute values

... where suitable. But note that the type of "cacheattr" in
get_page_from_l1e() specifically needs to remain "unsigned long".

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agopublic/io/netif.h: make control ring hash protocol more general
Paul Durrant [Fri, 4 Mar 2016 13:08:38 +0000 (14:08 +0100)]
public/io/netif.h: make control ring hash protocol more general

This patch modified the control ring protocol (of which there is
not yet an implementation) to make it more general. Most of the
concepts are not limited to toeplitz hashing so it's best not to
make them unnecessarily specific.

Apart from changing the names of various definitions and modifying
comments, this patch:

- Adds a new control message type to select a hash algorithm.
- Adds a reference implementation of the toeplitz hash.
- Changes the 'toeplitz' extra info fragment into a 'hash' extra
  info fragment and replaces the octet of padding with the index of
  the algorithm that was used to create the hash value.
- Relaxes the restriction that the mapping table has to be
  power-of-2 sized.

The patch also fixes a few spelling typos noticed along the way.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agoerrno: declare aliases using XEN_ERRNO()
Andrew Cooper [Thu, 3 Mar 2016 08:50:11 +0000 (09:50 +0100)]
errno: declare aliases using XEN_ERRNO()

Otherwise a custom XEN_ERRNO definition will not end up creating appropriately
namespaced constants for the aliases.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agoAMD, maintainers: remove myself from list
Aravind Gopalakrishnan [Thu, 3 Mar 2016 08:12:38 +0000 (09:12 +0100)]
AMD, maintainers: remove myself from list

I will not be looking at AMD related Xen code now.
So, removing myself.

Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Acked-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
9 years agoarm/acpi: Add acpi parameter to enable/disable acpi
Shannon Zhao [Wed, 2 Mar 2016 07:38:00 +0000 (08:38 +0100)]
arm/acpi: Add acpi parameter to enable/disable acpi

Define new command line parameter "acpi" to enable/disable acpi.
This implements the following policy to decide whether ACPI should be
used to boot the system:
- acpi=off: ACPI will not be used to boot the system, even if there is
  no alternative available (e.g., device tree is empty)
- acpi=force: only ACPI will be used to boot the system; if that fails,
  there will be no fallback to alternative methods (such as device tree)
- otherwise, ACPI will be used as a fallback if the device tree turns
  out to lack a platform description; the heuristic to decide this is
  whether /chosen is the only node present at depth 1

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/fdt: Export device_tree_for_each_node
Shannon Zhao [Wed, 2 Mar 2016 07:37:00 +0000 (08:37 +0100)]
arm/fdt: Export device_tree_for_each_node

This function will be used by ACPI booting. Export it so that it can be
used by other files.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/acpi: Add a new ACPI initialized function for UART
Shannon Zhao [Wed, 2 Mar 2016 07:38:00 +0000 (08:38 +0100)]
arm/acpi: Add a new ACPI initialized function for UART

This adds a new function to initialize UART for ACPI on ARM.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/acpi: Parse GTDT to initialize timer
Shannon Zhao [Wed, 2 Mar 2016 07:40:00 +0000 (08:40 +0100)]
arm/acpi: Parse GTDT to initialize timer

Parse GTDT (Generic Timer Descriptor Table) to initialize timer. Using
the information presented by GTDT to initialize the arch timer (not
memory-mapped).

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/irq: Add helper function for setting interrupt type
Parth Dixit [Wed, 2 Mar 2016 07:37:00 +0000 (08:37 +0100)]
arm/irq: Add helper function for setting interrupt type

Add a helper function to set edge/level type information for an
interrupt.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/gic: Add ACPI support for GIC preinit
Shannon Zhao [Wed, 2 Mar 2016 07:37:00 +0000 (08:37 +0100)]
arm/gic: Add ACPI support for GIC preinit

Since ACPI 6.0 defines that GIC Distributor Structure contains the GIC
version filed, it could get GIC version from that. Then call acpi device
initializing function to preinit GIC device.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/gic-v3: Add ACPI boot support for GICv3
Shannon Zhao [Wed, 2 Mar 2016 07:37:00 +0000 (08:37 +0100)]
arm/gic-v3: Add ACPI boot support for GICv3

Like GICv2, ACPI on Xen hypervisor uses MADT table for proper GICv3
initialization. Parse GIC distributor subtable, redistributor subtable
and interrupt subtable.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/gic-v2: Add ACPI boot support for GICv2
Parth Dixit [Wed, 2 Mar 2016 07:37:00 +0000 (08:37 +0100)]
arm/gic-v2: Add ACPI boot support for GICv2

ACPI on Xen hypervisor uses MADT table for proper GIC initialization.
First get the GIC version from GIC Distributor. Then parse GIC related
subtables, collect CPU interface and distributor addresses and call
driver initialization function (which is hardware abstraction agnostic).
In a similar way, FDT initialize GICv2.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/irq: Drop the DT prefix of the irq line type
Shannon Zhao [Wed, 2 Mar 2016 07:38:00 +0000 (08:38 +0100)]
arm/irq: Drop the DT prefix of the irq line type

Make these types generic to DT and ACPI. So they are can be used in ACPI
codes.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm: Introduce a generic way to use a device from acpi
Parth Dixit [Wed, 2 Mar 2016 07:38:00 +0000 (08:38 +0100)]
arm: Introduce a generic way to use a device from acpi

Add generic way to use device from acpi similar to the way it is
supported in device tree.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoacpi/table: Introduce acpi_table_get_entry_madt to get specified entry
Shannon Zhao [Wed, 2 Mar 2016 07:35:00 +0000 (08:35 +0100)]
acpi/table: Introduce acpi_table_get_entry_madt to get specified entry

This function could get the specified index entry of MADT table. This
would be useful when it needs to get the contens of the entry.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agoarm/acpi: Add ACPI support for SMP initialization
Shannon Zhao [Wed, 2 Mar 2016 07:39:00 +0000 (08:39 +0100)]
arm/acpi: Add ACPI support for SMP initialization

ACPI 5.1 only has two explicit methods to boot up SMP, PSCI and Parking
protocol, but the Parking protocol is only specified for ARMv7 now, so
make PSCI as the only way for the SMP boot protocol before some updates
for the ACPI spec or the Parking protocol spec.

ACPI only supports PSCI 0.2+, since prior to PSCI 0.2 function IDs are
not well-defined.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/acpi: Parse MADT to map logical cpu to MPIDR and get cpu_possible_map
Parth Dixit [Wed, 2 Mar 2016 07:35:00 +0000 (08:35 +0100)]
arm/acpi: Parse MADT to map logical cpu to MPIDR and get cpu_possible_map

MADT contains the information for MPIDR which is essential for SMP
initialization, parse the GIC cpu interface structures to get the MPIDR
value and map it to cpu_logical_map(), and add enabled cpu with valid
MPIDR into cpu_possible_map.

Move BAD_MADT_ENTRY to common place, parenthesize its parameters and
drop the pointer cast.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Naresh Bhat <naresh.bhat@linaro.org>
Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agoarm/acpi: Parse FADT table and get PSCI flags
Shannon Zhao [Wed, 2 Mar 2016 07:43:00 +0000 (08:43 +0100)]
arm/acpi: Parse FADT table and get PSCI flags

There are two flags: PSCI_COMPLIANT and PSCI_USE_HVC. When set, the
former signals to the OS that the hardware is PSCI compliant. The latter
selects the appropriate conduit for PSCI calls by toggling between
Hypervisor Calls (HVC) and Secure Monitor Calls (SMC). FADT table
contains such information, parse FADT to get the flags for furture
usage.

Since STAO table and the GIC version are introduced by ACPI 6.0, we will
check the version and only parse FADT table with version >= 6.0. If
firmware provides ACPI tables with ACPI version less than 6.0, OS will
be messed up with those information, so disable ACPI if we get an FADT
table with version less than 6.0.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Naresh Bhat <naresh.bhat@linaro.org>
Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/acpi: Move end_boot_allocator after acpi_boot_table_init
Shannon Zhao [Wed, 2 Mar 2016 07:38:00 +0000 (08:38 +0100)]
arm/acpi: Move end_boot_allocator after acpi_boot_table_init

To support ACPI NUMA, it needs to make the ACPI initialization done
before boot_end_allocator. Also, x86 does this by the same way.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/acpi: Add basic ACPI initialization
Shannon Zhao [Wed, 2 Mar 2016 07:37:00 +0000 (08:37 +0100)]
arm/acpi: Add basic ACPI initialization

acpi_boot_table_init() will be called in start_xen to get the RSDP and
all the table pointers. With this patch, we can get ACPI boot-time
tables from firmware on ARM64.

Signed-off-by: Naresh Bhat <naresh.bhat@linaro.org>
Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/acpi: Add __acpi_map_table function for ARM
Shannon Zhao [Wed, 2 Mar 2016 07:35:00 +0000 (08:35 +0100)]
arm/acpi: Add __acpi_map_table function for ARM

Implement __acpi_map_table function for ARM. Move FIX_ACPI_PAGES to
common place and rename it to NUM_FIXMAP_ACPI_PAGES.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agoerrno: introduce EISDIR/EROFS/ENOTEMPTY to the ABI
Andrew Cooper [Thu, 3 Mar 2016 07:56:48 +0000 (08:56 +0100)]
errno: introduce EISDIR/EROFS/ENOTEMPTY to the ABI

These POSIX errnos are expected by other areas of the Xen public interface,
specifically public/io/xs_wire.h

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agoarm: remove unneeded ifdef CONFIG_ARM in efi-boot.h
Stefano Stabellini [Thu, 3 Mar 2016 07:56:06 +0000 (08:56 +0100)]
arm: remove unneeded ifdef CONFIG_ARM in efi-boot.h

Ifdef'ing CONFIG_ARM in xen/arch/arm/efi/efi-boot.h is redundant, remove
the condition and simplify the ifdef's.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agosilence affinity messages on suspend/resume
Juergen Gross [Thu, 3 Mar 2016 07:55:30 +0000 (08:55 +0100)]
silence affinity messages on suspend/resume

When taking cpus offline for suspend or bringing them online on resume
again the scheduler might issue debug messages when temporarily
breaking vcpu affinity or restoring the original affinity settings.

The resume message can be removed completely, while the message when
breaking affinity should only be issued if the breakage is permanent.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
9 years agoRemus: update email address in MAINTAINERS file
Yang Hongyang [Wed, 2 Mar 2016 03:44:50 +0000 (11:44 +0800)]
Remus: update email address in MAINTAINERS file

Signed-off-by: Yang Hongyang <imhy.yang@gmail.com>
Cc: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
9 years agotravis: add IRC notifications
Doug Goldstein [Fri, 19 Feb 2016 15:13:17 +0000 (09:13 -0600)]
travis: add IRC notifications

This will cause failed builds and when the build flips back to success
to be reported to #xentest on FreeNode. The syntax of the message will
be:
<travis-ci> xen-project/xen#BUILDID (BRANCH - REVISION : COMMITTER)
<travis-ci> Change view :
https://github.com/xen-project/xen/compare/RANGE
<travis-ci> Build details :
https://travis-ci.org/xen-project/xen/builds/BUILDID

The blob was generated with the following command:
travis encrypt -r xen-project/xen 'chat.freenode.net#xentest'

The reason it is encrypted is to prevent people that fork the repo to
spam #xentest. This value will only properly decrypt when running within
the xen-project/xen space.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agom4/python: fix checks for Python library support
Doug Goldstein [Fri, 19 Feb 2016 02:57:04 +0000 (20:57 -0600)]
m4/python: fix checks for Python library support

AC_CHECK_LIB() was running gcc -Llib -lm -lutils conftest.c which on
platforms that do as needed operations by default will result in
underlinking. Instead AC_CHECK_LIB() suggests supplying the extra
libraries necessary in a 5th argument.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agolibxc: Expose the MPX cpuid flag to guest
Liang Li [Mon, 11 Jan 2016 08:52:10 +0000 (16:52 +0800)]
libxc: Expose the MPX cpuid flag to guest

If hardware support memory protect externsion, expose this feature
to guest by default. Users don't have to use a 'cpuid= ' option in
config file to turn it on.

Signed-off-by: Liang Li <liang.z.li@intel.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agotools/python/xs: fix two comments
Wei Liu [Mon, 29 Feb 2016 16:01:24 +0000 (16:01 +0000)]
tools/python/xs: fix two comments

These two functions require transaction handle as the first argument.

Reported-by: Sergei Lebedev <sergei.a.lebedev@gmail.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxl: fix comment LIBXL__EGC_INIT -> LIBXL_EGC_INIT
Wei Liu [Thu, 25 Feb 2016 12:10:40 +0000 (12:10 +0000)]
libxl: fix comment LIBXL__EGC_INIT -> LIBXL_EGC_INIT

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agotools/configure: only require bcc/ld86/as86 when needed
Doug Goldstein [Wed, 24 Feb 2016 15:03:29 +0000 (09:03 -0600)]
tools/configure: only require bcc/ld86/as86 when needed

bcc/ld86/as86 are necessary when we build ROMBIOS. However if we do not
build it (and are not building qemu-trad), the build requirements are
overly strict and can lead to failures.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
9 years agolibxl: qmp: ensure qmp read buffer is NULL terminated
Ian Campbell [Wed, 17 Feb 2016 11:02:20 +0000 (11:02 +0000)]
libxl: qmp: ensure qmp read buffer is NULL terminated

Coverity rightly points out that qmp->buffer may not be NULL
terminated when passed to strncat.

Make the actual buffer a byte bigger than QMP_RECEIVE_BUFFER_SIZE and
always append a NULL byte.

I suspect that in practice we have not yet seen QMP messages
approaching the buffer size (4K).

Compile tested only.

CID: 1055989

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agoxl: NULL terminate buf when reading dom0 /proc/uptime
Ian Campbell [Wed, 17 Feb 2016 10:34:24 +0000 (10:34 +0000)]
xl: NULL terminate buf when reading dom0 /proc/uptime

The contents of /proc/uptime is typically something like "80164.57
640617.58", so the existing 512 byte buffer is more than large enoguh,
so reduce its effective size to 511 bytes and ensure we include a
NULL.

Otherwise Coverity points out that we pass a potentially unterminated
string to strtok. In practice this likely doesn't actually cause
issues (at least on Linux) because the
string should always contain a space so we will stop parsing.

CID: 105590

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agoxl: uptime: skip dom0 when calling print_domU_uptime
Ian Campbell [Wed, 17 Feb 2016 10:34:23 +0000 (10:34 +0000)]
xl: uptime: skip dom0 when calling print_domU_uptime

Dom0 is handled separately (via print_dom0_uptime) and the domU
variant doesn't work for dom0 since libxl_vm_get_start_time() doesn't.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agodocs: Add descriptions of TSC scaling in xl.cfg and tscmode.txt
Haozhong Zhang [Sun, 28 Feb 2016 12:54:54 +0000 (20:54 +0800)]
docs: Add descriptions of TSC scaling in xl.cfg and tscmode.txt

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
9 years agoremove unused EXPORT_SYMBOL_GPL
Doug Goldstein [Tue, 1 Mar 2016 13:43:12 +0000 (14:43 +0100)]
remove unused EXPORT_SYMBOL_GPL

EXPORT_SYMBOL_GPL is unused in the source tree so just remove it. If
something gets imported that needs it, it can be added back then.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agoVT-d: add a command line parameter for posted-interrupts
Feng Wu [Tue, 1 Mar 2016 13:42:52 +0000 (14:42 +0100)]
VT-d: add a command line parameter for posted-interrupts

Enable VT-d Posted-Interrupts and add a command line
parameter for it.

Signed-off-by: Feng Wu <feng.wu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agovmx: VT-d posted-interrupt core logic handling
Feng Wu [Tue, 1 Mar 2016 13:42:13 +0000 (14:42 +0100)]
vmx: VT-d posted-interrupt core logic handling

This is the core logic handling for VT-d posted-interrupts. Basically it
deals with how and when to update posted-interrupts during the following
scenarios:
- vCPU is preempted
- vCPU is slept
- vCPU is blocked

When vCPU is preempted/slept, we update the posted-interrupts during
scheduling by introducing two new architecutral scheduler hooks:
vmx_pi_switch_from() and vmx_pi_switch_to(). When vCPU is blocked, we
introduce a new architectural hook: arch_vcpu_block() to update
posted-interrupts descriptor.

Besides that, before VM-entry, we will make sure the 'NV' filed is set
to 'posted_intr_vector' and the vCPU is not in any blocking lists, which
is needed when vCPU is running in non-root mode. The reason we do this check
is because we change the posted-interrupts descriptor in vcpu_block(),
however, we don't change it back in vcpu_unblock() or when vcpu_block()
directly returns due to event delivery (in fact, we don't need to do it
in the two places, that is why we do it before VM-Entry).

When we handle the lazy context switch for the following two scenarios:
- Preempted by a tasklet, which uses in an idle context.
- the prev vcpu is in offline and no new available vcpus in run queue.
We don't change the 'SN' bit in posted-interrupt descriptor, this
may incur spurious PI notification events, but since PI notification
event is only sent when 'ON' is clear, and once the PI notificatoin
is sent, ON is set by hardware, hence no more notification events
before 'ON' is clear. Besides that, spurious PI notification events are
going to happen from time to time in Xen hypervisor, such as, when
guests trap to Xen and PI notification event happens, there is
nothing Xen actually needs to do about it, the interrupts will be
delivered to guest atht the next time we do a VMENTRY.

Suggested-by: Yang Zhang <yang.z.zhang@intel.com>
Suggested-by: Dario Faggioli <dario.faggioli@citrix.com>
Suggested-by: George Dunlap <george.dunlap@citrix.com>
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Feng Wu <feng.wu@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
9 years agovmx: add VMX RDTSC(P) scaling support
Haozhong Zhang [Tue, 1 Mar 2016 13:39:08 +0000 (14:39 +0100)]
vmx: add VMX RDTSC(P) scaling support

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
9 years agoxl: close nullfd after dup2'ing it to stdin
Ian Campbell [Wed, 17 Feb 2016 10:39:40 +0000 (10:39 +0000)]
xl: close nullfd after dup2'ing it to stdin

We assert that nullfd if not std{in,out,err} since that would result
in closing one of the just dup2'd fds. For this to happen
std{in,out,err} would have needed to be closed, at which point all
sorts of other things could go wrong.

CID: 1130519

It was previously hypothesised[0] that fixing 1130516 would solve this
too, but that appears to not have been the case.

Compile tested only.

[0] http://lists.xenproject.org/archives/html/xen-devel/2013-11/msg02931.html

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: andrew.cooper3@citrix.com
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agox86/hvm: move saving/loading vcpu's TSC to common code
Haozhong Zhang [Tue, 1 Mar 2016 13:38:22 +0000 (14:38 +0100)]
x86/hvm: move saving/loading vcpu's TSC to common code

Both VMX and SVM save/load vcpu's TSC when saving/loading vcpu's
context, so this patch moves saving/loading vcpu's TSC to the common
functions hvm_[save|load]_cpu_ctxt().

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
9 years agox86/hvm: replace architecture TSC scaling by a common function
Haozhong Zhang [Tue, 1 Mar 2016 13:37:53 +0000 (14:37 +0100)]
x86/hvm: replace architecture TSC scaling by a common function

This patch implements a common function hvm_scale_tsc() to scale TSC by
using TSC scaling information collected by architecture code.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Acked-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> for SVM bits
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agotools/xenalyze: Actually handle case where number of ipi vectors exceeds static max
George Dunlap [Thu, 25 Feb 2016 14:49:03 +0000 (14:49 +0000)]
tools/xenalyze: Actually handle case where number of ipi vectors exceeds static max

find_vec() is supposed to find the vector in the list if it exists,
choose an empty slot if it doesn't exist, and return null if all slots
are full.

However, coverity noticed that although the callers of find_vec() handle
the last condition, find_vec() itself didn't.

Check to see if we actually found an empty slot before attempting to
initialize it.

CID 1306864

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agotools/xenalyze: Fix check for error return value
George Dunlap [Thu, 25 Feb 2016 14:49:00 +0000 (14:49 +0000)]
tools/xenalyze: Fix check for error return value

fdopen returns NULL on failure, not a negative integer.

CID 1306863
CID 1306858

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agotools/xenalyze: Avoid redundant check
George Dunlap [Thu, 25 Feb 2016 14:48:57 +0000 (14:48 +0000)]
tools/xenalyze: Avoid redundant check

Coverity notices that if !head is true, that !N can never be true.

Don't bother checking N, since we know it has to be at least one.

CID 1354243

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agotools/xenalyze: Close symbol_file after reading it
George Dunlap [Thu, 25 Feb 2016 14:48:56 +0000 (14:48 +0000)]
tools/xenalyze: Close symbol_file after reading it

...to avoid leaking the FD and associated memory.

CID 1306872

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agoloadpolicy: only close polFd if it is valid
Ian Campbell [Wed, 10 Feb 2016 16:32:39 +0000 (16:32 +0000)]
loadpolicy: only close polFd if it is valid

It can be -1 at this point.

CID 1055562
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agoMAINTAINERS: remove myself from ARM (incl DT), seabios, tools and The Rest
Ian Campbell [Mon, 29 Feb 2016 15:11:31 +0000 (16:11 +0100)]
MAINTAINERS: remove myself from ARM (incl DT), seabios, tools and The Rest

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agobuild: consolidate CONFIG_HAS_VIDEO and CONFIG_VIDEO
Doug Goldstein [Mon, 29 Feb 2016 15:09:09 +0000 (16:09 +0100)]
build: consolidate CONFIG_HAS_VIDEO and CONFIG_VIDEO

No real advantage to keeping these separate. The use case of this from
Linux is when the platform or target board has support for something but
the user wants to be given the option to disable it.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agobuild: consolidate CONFIG_HAS_VGA and CONFIG_VGA
Doug Goldstein [Mon, 29 Feb 2016 15:08:43 +0000 (16:08 +0100)]
build: consolidate CONFIG_HAS_VGA and CONFIG_VGA

No real advantage to keeping these separate. The use case of this from
Linux is when the platform or target board has support for something but
the user wants to be given the option to disable it.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
9 years agoarm/monitor vm-events: implement guest-request support
Corneliu ZUZU [Mon, 29 Feb 2016 15:07:49 +0000 (16:07 +0100)]
arm/monitor vm-events: implement guest-request support

This patch adds ARM support for guest-request monitor vm-events.
Note: on ARM hypercall instruction skipping must be done manually
by the caller. This will probably be changed in a future patch.

Summary of changes:
== Moved to common-side:
  * XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST handling (moved from X86
      arch_monitor_domctl_event to common monitor_domctl)
  * hvm_event_guest_request->vm_event_monitor_guest_request
  * hvm_event_traps->vm_event_monitor_traps (also added target vcpu as param)
  * guest-request bits from X86 'struct arch_domain' (to common 'struct domain')
== ARM implementations:
  * do_hvm_op now handling of HVMOP_guest_request_vm_event => calls
      vm_event_monitor_guest_request (as on X86)
  * arch_monitor_get_capabilities->vm_event_monitor_get_capabilities,
    updated to reflect support for XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST
  * vm_event_init_domain (does nothing), vm_event_cleanup_domain
== Misc:
  * vm_event_fill_regs, no longer X86-specific. ARM-side implementation of this
      function currently does nothing, that will be added in a separate patch.

Signed-off-by: Corneliu ZUZU <czuzu@bitdefender.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
9 years agox86/hvm: setup TSC scaling ratio
Haozhong Zhang [Mon, 29 Feb 2016 15:06:40 +0000 (16:06 +0100)]
x86/hvm: setup TSC scaling ratio

This patch adds a field tsc_scaling_ratio in struct hvm_domain to record
the per-domain TSC scaling ratio, and sets it in tsc_set_info().

Before setting the per-domain TSC scaling ratio, we check its validity
in tsc_set_info(). If an invalid ratio is given, we will leave the
default value in tsc_scaling_ratio (i.e. ratio = 1) and setup guest TSC
as if no TSC scaling is used:
* For TSC_MODE_DEFAULT,
  - if a user-specified TSC frequency is given, we will set the guest
    TSC frequency to it; otherwise, we set it to the host TSC frequency.
  - if guest TSC frequency does not equal to host TSC frequency, we will
    emulate guest TSC (i.e. d->arch.vtsc is set to 1). In both cases,
    guest TSC runs in the guest TSC frequency.
* For TSC_MODE_PVRDTSCP,
  - we set the guest TSC frequency to the host TSC frequency.
  - guest rdtsc is executed natively in the host TSC frequency as
    before.
  - if rdtscp is not available to guest, it will be emulated; otherwise,
    it will be executed natively. In both cases, guest rdtscp gets TSC
    in the host TSC frequency as before.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
9 years agoarm/acpi: read acpi memory info from uefi
Parth Dixit [Mon, 29 Feb 2016 15:06:07 +0000 (16:06 +0100)]
arm/acpi: read acpi memory info from uefi

ACPI memory is seperate from conventional memory and should be marked
as reserved while passing to DOM0. Create a new meminfo structure to
store all the acpi tables listed in uefi.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/acpi: add placeholder for efi and acpi load address
Shannon Zhao [Mon, 29 Feb 2016 15:05:32 +0000 (16:05 +0100)]
arm/acpi: add placeholder for efi and acpi load address

We will create EFI table, memory description table and some of acpi
tables and we're going to map them to kinfo->gnttab_start of Dom0.
Add placeholder for the starting address for loading in DOM0 and the
size of new added tables. Also add a placeholder to store the new
created tables.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/acpi: define a enum for reserved tables
Shannon Zhao [Mon, 29 Feb 2016 15:04:41 +0000 (16:04 +0100)]
arm/acpi: define a enum for reserved tables

It needs to copy and change the contents of some ACPI and EFI tables for
Dom0. Here define a enum for those tables.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/acpi: add arm specific acpi header file
Shannon Zhao [Mon, 29 Feb 2016 15:02:57 +0000 (16:02 +0100)]
arm/acpi: add arm specific acpi header file

From: Shannon Zhao <shannon.zhao@linaro.org>

Add architecture specific definitions and calls required for acpi in new
header file.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agoarm/acpi: emulate io ports for arm
Shannon Zhao [Mon, 29 Feb 2016 15:01:21 +0000 (16:01 +0100)]
arm/acpi: emulate io ports for arm

Add macros to emulate x86 style ports for arm. This avoids modification in
common code for acpi. Here just print a warning on ARM.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
9 years agodocs: spell out limits of security support for qemu-xen
Stefano Stabellini [Mon, 29 Feb 2016 15:00:48 +0000 (16:00 +0100)]
docs: spell out limits of security support for qemu-xen

Write down what emulated hardware is supported in qemu-xen. Add a way
for users to ask for a change in the list.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agocredit1: avoid boosting vCPUs being "just" migrated
Dario Faggioli [Mon, 29 Feb 2016 14:58:49 +0000 (15:58 +0100)]
credit1: avoid boosting vCPUs being "just" migrated

Moving a vCPU to a different pCPU means offlining it and
then waking it up, on the new pCPU. Credit1 grants BOOST
priority to vCPUs that wakes up, with the aim of improving
I/O latency. The net effect of this all is that vCPUs get
boosted when migrating, which shouldn't happen.

For instance, this causes scheduling anomalies and,
potentially, performance problems, as reported here:
  http://lists.xen.org/archives/html/xen-devel/2015-10/msg02851.html

This patch fixes this by noting down (by means of a flag)
the fact that the vCPU is about to undergo a migration.
This way we can tell, later, during a wakeup, whether the
vCPU is migrating or unblocking, and decide whether or
not to apply the boosting.

Note that it is important that atomic-safe bit operations
are used when manipulating vCPUs' flags. Take the chance
and add a comment about this.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
9 years agolibxl: initialise rc in libxl__domain_save error path
Wei Liu [Sun, 28 Feb 2016 21:03:51 +0000 (16:03 -0500)]
libxl: initialise rc in libxl__domain_save error path

Commit 7449fb36 ("migration/save: pass checkpointed_stream from libxl to
libxc ") failed to initialise rc in the error path.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
9 years agoConfig.mk: Update SEABIOS_UPSTREAM_TAG to rel-1.9.1
Doug Goldstein [Mon, 15 Feb 2016 14:38:02 +0000 (08:38 -0600)]
Config.mk: Update SEABIOS_UPSTREAM_TAG to rel-1.9.1

Switch from tracking a commit post 1.9.0 to the 1.9.1 release.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>