Commit Graph
23167 Commits
Author SHA1 Message Date
cegger 3a1ef3c33f Implement SVM specific interrupt handling
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-03-09 12:36:17 +01:00
cegger 9a779e4fc1 Implement SVM specific part for Nested Virtualization
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-03-09 12:36:05 +01:00
cegger 5120a76fad Handle interrupts (generic part)
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-02-28 12:21:57 +01:00
cegger bd9b262d9a Allow guest to enable SVM in EFER
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-02-28 12:21:54 +01:00
cegger b3677ee4e0 When injecting an exception into L2 guest,
inject a #VMEXIT if L1 guest intercepts the exception

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-02-28 12:21:52 +01:00
cegger 69d563c720 Allow paged real mode during vmrun emulation.
Emulate cr0 and cr4 when guest does not intercept them.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-02-28 12:21:49 +01:00
cegger 67bb195fe2 Nested Virtualization core implementation
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-02-28 12:21:46 +01:00
cegger 5ad20e41a8 add nestedhvm function hooks for svm/vmx specific code
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-02-28 12:21:44 +01:00
cegger a64a1801e8 Data structures for Nested Virtualization
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-02-28 12:21:41 +01:00
cegger 567ab9ef56 tools: Add nestedhvm guest config option
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-02-28 12:21:38 +01:00
Keir Fraser 347f553668 Remove __init specifier from function declarations in header files.
The specifier only needs to be added to the function's definition.

At the same time, fix init_cpu_to_node() to be __init rather than
__devinit (it is only called at boot time).

Signed-off-by: Keir Fraser <keir@xen.org>
2011-04-06 09:20:40 +01:00
Allen Kay 03e3614ae6 [VTD] Fixes to ACPI DMAR flag checks.
* platform_supports_{intremap,x2apic} should not be marked __init as
   they are used during S3 resume.
 * DMAR flags should be taken from the table passed to
   acpi_parse_dmar() -- this is the trusted copy of the DMAR, when
   running in TXT mode.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
2011-04-06 09:11:02 +01:00
Wei Huang ca7690b505 x86, amd, MTRR: remove k8_enable_fixed_iorrs()
AMD64 defines two special bits (bit 3 and 4) RdMem and WrMem in fixed
MTRR type. Their values are supposed to be 0 after BIOS hands the
control to OS according to AMD BKDG. Unless OS specificially turn them
on, they are kept 0 all the time. As a result, k8_enable_fixed_iorrs()
is unnecessary and removed from upstream kernel (see
https://patchwork.kernel.org/patch/11425/). This patch does the same
thing.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
2011-04-06 09:02:13 +01:00
Wei Huang 2af33c2220 x86, amd, MTRR: correct DramModEn bit of SYS_CFG MSR
Some buggy BIOS might set SYS_CFG DramModEn bit to 1, which can cause
unexpected behavior on AMD platforms. This patch clears DramModEn bit
if it is 1.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
2011-04-06 09:01:31 +01:00
Ian Campbell d7bef197f6 libxl: Drop unnecessary \n from log message
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-04-05 18:23:54 +01:00
Ian Campbell 5804239646 libxl: specific explicit disk image format to new qemu
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-04-05 18:17:55 +01:00
Ian Campbell d93b35f89b libxl: specify disks using supported command line syntax for new qemu
The -hdX syntax is only retained for compatibility reasons and the
-sdX syntax doesn't even exist.

Additionally convert the first four non-SCSI disks to hd[a-d] and
ignore any further non-SCSI disks (since qemu only supports 4 IDE
devices).

SCSI disks are passed through as is. qemu-xen was limited to 7 SCSI
devices but upstream qemu supports 256, therefore do not limit the
number of disks on the libxl side.

qemu-xen did all this itself internally.

Fixes "qemu: -xvda: invalid option" and allows PVHVM to work with
upstream qemu.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-04-05 17:34:48 +01:00
Ian Campbell 55ccba217d libxl: pass list of disks to libxl__build_device_model_args
Given that we have the information available this is preferable to
picking it out of xenstore instead. We already do this for VIFs.

Only the qemu upstream version makes use of it since old qemu-xen
actually parses xenstore itself.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-04-05 17:27:49 +01:00
Ian Campbell 678b0c42eb libxl: return raw disk and partition number from libxl__device_disk_dev_number
Optional parameters, caller to follow.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-04-05 17:23:51 +01:00
Ian Campbell e628b19167 libxl: explicitly set disk format in libxl__append_disk_list_of_type
Ideally we should be able to infer the format from something stashed
in xenstore but this is better than letting users see garbage values.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-04-05 17:21:36 +01:00
Jan Beulich 02fea4b6ac passthrough: use domain pirq as index of struct hvm_irq_dpci's hvm_timer array
Since d->nr_pirqs is guaranteed to be not larger than nr_irqs,
indexing arrays by the former ought to be preferred. In the case
given, the indices so far had to be computed specially in a number of
cases, whereas the indexes use now are all readily available.

This opens the possibility to fold the ->mirq[] and ->hvm_timer[]
members of struct hvm_irq_dpci into a single array, possibly with some
members overlayed in a union to reduce size (see
http://lists.xensource.com/archives/html/xen-devel/2011-03/msg02006.html).
Such space saving wouldn't, however, suffice to generally get the
respective allocation sizes here to below PAGE_SIZE, not even when
converting the array of structures into an array of pointers to
structures. Whether a multi-level lookup mechanism would make sense
here is questionable, as it can be expected that for other than Dom0
(which isn't hvm, and hence shouldn't use these data structures - see
http://lists.xensource.com/archives/html/xen-devel/2011-03/msg02004.html)
only very few entries would commonly be used here. An obvious
alternative would be to use rb or radix trees (both currently only
used in tmem).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-05 13:05:05 +01:00
Jan Beulich 2037f2adbf x86: introduce alloc_vcpu_guest_context()
This is necessary because on x86-64 struct vcpu_guest_context is
larger than PAGE_SIZE, and hence not suitable for a general purpose
runtime allocation. On x86-32, FIX_PAE_HIGHMEM_* fixmap entries are
being re-used, whiule on x86-64 new per-CPU fixmap entries get
introduced.  The implication of using per-CPU fixmaps is that these
allocations have to happen from non-preemptable hypercall context
(which they all do).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-05 13:03:29 +01:00
Jan Beulich 1dd3a56b43 x86: split struct domain
This is accomplished by converting a couple of embedded arrays (in one
case a structure containing an array) into separately allocated
pointers, and (just as for struct arch_vcpu in a prior patch)
overlaying some PV-only fields with HVM-only ones.

One particularly noteworthy change in the opposite direction is that
of PITState - this field so far lived in the HVM-only portion, but is
being used by PV guests too, and hence needed to be moved out of
struct hvm_domain.

The change to XENMEM_set_memory_map (and hence libxl__build_pre() and
the movement of the E820 related pieces to struct pv_domain) are
subject to a positive response to a query sent to xen-devel regarding
the need for this to happen for HVM guests (see
http://lists.xensource.com/archives/html/xen-devel/2011-03/msg01848.html).

The protection of arch.hvm_domain.irq.dpci accesses by is_hvm_domain()
is subject to confirmation that the field is used for HVM guests only
(see
http://lists.xensource.com/archives/html/xen-devel/2011-03/msg02004.html).

In the absence of any reply to these queries, and given the early
state of 4.2 development, I think it should be acceptable to take the
risk of having to later undo/redo some of this.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-05 13:02:57 +01:00
Jan Beulich 6b063a4a6f x86: move pv-only members of struct vcpu to struct pv_vcpu
... thus further shrinking overall size of struct arch_vcpu.

This has a minor effect on XEN_DOMCTL_{get,set}_ext_vcpucontext - for
HVM guests, some meaningless fields will no longer get stored or
retrieved: reads will now return zero, and writes are required to be
(mostly) zero (the same as was already done on x86-32).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-05 13:02:00 +01:00
Jan Beulich 9a70856bb2 x86: split struct vcpu
This is accomplished by splitting the guest_context member, which by
itself is larger than a page on x86-64. Quite a number of fields of
this structure is completely meaningless for HVM guests, and thus a
new struct pv_vcpu gets introduced, which is being overlaid with
struct hvm_vcpu in struct arch_vcpu. The one member that is mostly
responsible for the large size is trap_ctxt, which now gets allocated
separately (unless fitting on the same page as struct arch_vcpu, as is
currently the case for x86-32), and only for non-hvm, non-idle
domains.

This change pointed out a latent problem in arch_set_info_guest(),
which is permitted to be called on already initialized vCPU-s, but
so far copied the new state into struct arch_vcpu without (in this
case) actually going through all the necessary accounting/validation
steps. The logic gets changed so that the pieces that bypass
accounting
will at least be verified to be no different from the currently active
bits, and the whole change will fail in case they are. The logic does
*not* get adjusted here to do full error recovery, that is, partially
modified state continues to not get unrolled in case of failure.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-05 13:01:25 +01:00
Jan Beulich 4551775df5 Remove direct cpumask_t members from struct vcpu and struct domain
The CPU masks embedded in these structures prevent NR_CPUS-independent
sizing of these structures.

Basic concept (in xen/include/cpumask.h) taken from recent Linux.

For scalability purposes, many other uses of cpumask_t should be
replaced by cpumask_var_t, particularly local variables of functions.
This implies that no functions should have by-value cpumask_t
parameters, and that the whole old cpumask interface (cpus_...())
should go away in favor of the new (cpumask_...()) one.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-05 13:00:54 +01:00
Machon Gregory 2bbb3d0fe9 xsm: Error code consistency
Signed-off-by: Machon Gregory <mbgrego@tycho.ncsc.mil>
2011-04-04 15:54:45 +01:00
Ian Jackson 8afc46b70c libxl: add CODING_STYLE
libxenlight and xl grew enough to need a CODING_STYLE, that I blatantly
copied from qemu and linux, just adding few specific modifications.
The result should be as less controversial as possible, mostly
documenting what we are already doing.

[ Message and document originally posted to xen-devel on 2010-09-01 ]

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-04-04 14:54:46 +01:00
Tim Deegan 6d972a6195 x86/mm: fix PSE alignment checks in pagetable walker.
The PSE handling doesn't check bits 1...8 (or 1...9 for non-PAE guests)
being zero, thus allowing bad (not 2Mb/4Mb aligned) large pages to be
handled.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
2011-04-04 10:38:27 +01:00
Jan Beulich e1c2ec41bb x86: cleanup bogus CONFIG_ACPI_PCI uses
We're building for one case (CONFIG_ACPI_PCI defined) only, yet still
had the other case's code in there. Additionally there was quite a bit
of pseudo-duplication between disabled(!) DMI scan and ACPI boot code.

acpi_pci_disabled had only a single reader, which is off by default
(i.e. must be enable on the command line), so it seems pointless to
keep it.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-02 15:58:54 +01:00
Jan Beulich 7deb539e74 x86/ACPI: __init-annotate
xen/arch/x86/acpi/boot.c consists of almost only code/data in .init.*,
so move the few bits that aren't into a new file and then use the
recently introduced .init.o mechanism to move all the literal strings
into .init.rodata.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-02 15:58:22 +01:00
Jan Beulich 6e59f30cbd amd-iommu: __init-annotate
Besides marking a few more items __init/__initdata, use the recently
introduced .init.o mechanism to move all the literal strings into
.init.rodata in those files that consist of only contributions to
.init.*.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-02 15:57:35 +01:00
Jan Beulich d5298187b3 move register_cpu_notifier() into .init.text
With no modular drivers, all CPU notifier setup is supposed to happen
during boot. There also is a respective comment in the function.=20

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-02 15:57:03 +01:00
Jan Beulich 06490f4325 move setup_irq() into .init.text
With no modular drivers, all interrupt setup is supposed to happen
during boot.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-02 15:56:32 +01:00
Jan Beulich e1fe30b87d move request_irq() into .init.text
With no modular drivers, all interrupt setup is supposed to happen
during boot.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-02 15:56:07 +01:00
Jan Beulich 252aa352b8 x86: eliminate old-CPU support bits
Some pieces can be removed altogether, others are only of possible use
in 32-bit builds.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2011-04-02 15:55:36 +01:00
Christoph Egger fb22c75f16 xen: fix reloc.S generation for non-gnu toolchain
The output of AT&T UNIX and GNU od(1) are different.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2011-04-02 15:53:35 +01:00
Olaf Hering 7122101c35 xentrace: remove unneeded debug printk
The pointer value in case of an allocation failure is rather
uninteresting.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
2011-04-02 15:50:47 +01:00
Olaf Hering fbf96e6725 xentrace: correct formula to calculate t_info_pages
The current formula to calculate t_info_pages, based on the initial
code, is slightly incorrect. It may allocate more than needed.
Each cpu has some pages/mfns stored as uint32_t.
That list is stored with an offset at tinfo.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
2011-04-02 15:50:19 +01:00
Allen Kay 0be477c900 [VTD] check BIOS settings before enabling interrupt remapping or x2apic
Check flags field in ACPI DMAR structure before enabling interrupt
remapping or x2apic.  This allows platform vendors to disable
interrupt remapping or x2apic features if on board BIOS does not
support them.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
2011-04-02 15:49:25 +01:00
Ian Campbell 9da48f2428 libxl: typedef libxl_action_on_shutdown
This is the libxl convention. By using the "typedef enum foo { } foo;"
syntax we can retain backwards compatibility with existing users.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:39:30 +01:00
Ian Campbell 8bcc02e02a tools: remove some .o and binary files on clean
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:35:27 +01:00
Ian Campbell 9ac650d825 tools: remove pattern matched linking rules
Most subdirs only build a single tool to start with and those which
build multiple tools often have different linkage requirements.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:34:56 +01:00
Ian Campbell 61d0fe74c6 tools: Remove $(CFLAGS) from links lines.
The relevant variable in these circumstances is called $(LDFLAGS).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:32:18 +01:00
Ian Campbell 75c300588b tools: ocaml: drop redefinition of xen_mb
This is always available to the in-tree build.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:31:06 +01:00
Ian Campbell 13b78f330b tools: ocaml: drop some commented out build rules.
These are covered by tools/ocaml/Makefile.rules now

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:30:42 +01:00
Ian Campbell d9a50d2603 tools: ocaml: push CFLAGS usage down into the specific bindings
So each binding only builds against what it requires.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:30:15 +01:00
Juergen Gross 825bc99c9d tools: xenstored: make usage info of xenstored accurate
The usage printed for xenstored was not in sync with the parameters
defined in the code.

Signed-off-by: juergen.gross@ts.fujitsu.com
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:27:40 +01:00
David Scott 0021f2b8d6 libxl: fix memory management in "xl network-attach"
The libxl_device_nic struct has strings which are initially strdup()ed
and then free()ed in libxl_device_nic_destroy(). In the
"network-attach" parser we need to free() the existing string and
strdup((*argv) + N), rather than just copying the pointer.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:19:16 +01:00
Ian Campbell bce637c6e4 tools: ocaml: do not try to link dynamic objects into .a libraries
lib<foo>_stubs.a was linking against $(LIBS_<foo>) which only includes
dynamic linkage information which is not useful for a static library.

$(LIBS_<foo>) is still used when linking <foo>.cmxa

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
2011-03-31 19:07:06 +01:00