xen.git
12 years agoxen/arm: print the location of the Xen heap on 32 bit
Ian Campbell [Thu, 26 Sep 2013 11:35:41 +0000 (12:35 +0100)]
xen/arm: print the location of the Xen heap on 32 bit

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Tim Deegan <tim@xen.org>
12 years agoxen/arm: rename boot misc region to boot reloc now it has a single purpose
Ian Campbell [Thu, 26 Sep 2013 11:35:40 +0000 (12:35 +0100)]
xen/arm: rename boot misc region to boot reloc now it has a single purpose

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Tim Deegan <tim@xen.org>
12 years agoxen/arm: Support dtb /memreserve/ regions
Ian Campbell [Thu, 26 Sep 2013 11:35:39 +0000 (12:35 +0100)]
xen/arm: Support dtb /memreserve/ regions

This requires a mapping of the DTB during setup_mm. Previously this was in
the BOOT_MISC slot, which is clobbered by setup_pagetables. Split it out
into its own slot which can be preserved.

Also handle these regions as part of consider_modules() and when adding pages
to the heaps to ensure we do not locate any part of Xen or the heaps over
them.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
12 years agoxen/arm: cope with modules outside of "visible" RAM
Ian Campbell [Thu, 26 Sep 2013 11:35:38 +0000 (12:35 +0100)]
xen/arm: cope with modules outside of "visible" RAM

This can happen if modules are in a bank which we can't cope with e.g. due to
being non-contiguous.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Tim Deegan <tim@xen.org>
12 years agoxen/arm: do not relocate Xen outside of visible RAM
Ian Campbell [Thu, 26 Sep 2013 11:35:37 +0000 (12:35 +0100)]
xen/arm: do not relocate Xen outside of visible RAM

Since we do not handle non-contiguous banks of memory lets avoid relocating
Xen into such a bank. Avoids issues such as free_init_memory releasing pages
which are outside of the frametable.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
12 years agoxen/arm: Reserve FDT via early module mechanism
Ian Campbell [Thu, 26 Sep 2013 11:35:36 +0000 (12:35 +0100)]
xen/arm: Reserve FDT via early module mechanism

This will stop us putting any heaps or relocating Xen itself over the FDT.

The devicetree will be copied to allocated memory in setup_mm and the
original copy will be freed by discard_initial_modules.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
12 years agoxen/arm: DOMHEAP_SECOND_PAGES is arm32 specific
Ian Campbell [Thu, 26 Sep 2013 11:35:35 +0000 (12:35 +0100)]
xen/arm: DOMHEAP_SECOND_PAGES is arm32 specific

since 5263507b1b4a "xen: arm: Use a direct mapping of RAM on arm64"

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Tim Deegan <tim@xen.org>
12 years agoxen/arm: ensure the xenheap is 32MB aligned
Ian Campbell [Thu, 26 Sep 2013 11:35:34 +0000 (12:35 +0100)]
xen/arm: ensure the xenheap is 32MB aligned

My patch 08693f5948d8 "xen: arm: reduce the size of the xen heap to max 1/8
RAM size" unintentionally violated the constraint that the xenheap must be
32MB aligned, since we only explicitly align the end of the heap and
xenheap_pages was not a multiple of 32 pages.

Round xenheap pages up to a 32MB boundary.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
12 years agoxen/arm: Don't dump stack when the VCPU is offline
Julien Grall [Wed, 25 Sep 2013 12:12:47 +0000 (13:12 +0100)]
xen/arm: Don't dump stack when the VCPU is offline

When a VCPU is not yet online, the registers contain garbagge. This will
result to call randomly BUG() in show_guest_stack.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen: arm: use new 64-bit zImage magic numbers for Xen binary
Ian Campbell [Wed, 25 Sep 2013 11:21:51 +0000 (12:21 +0100)]
xen: arm: use new 64-bit zImage magic numbers for Xen binary

Upstream commit 4370eec05a88 "arm64: Expand arm64 image header" ended up
changing the zImage magic (which was actually the initial branch instructio
encoding!). The new header has a proper magic number at a fixed location.

Switch Xen itself to using this format. Neither the bootwrapper nor the
models care about this header themselves and real bootloaders are not widely
used, so now is as good a time as any to switch (as upstream have proven)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
12 years agoxen: arm: handle new 64-bit zImage magic numbers
Ian Campbell [Wed, 25 Sep 2013 11:21:35 +0000 (12:21 +0100)]
xen: arm: handle new 64-bit zImage magic numbers

Upstream commit 4370eec05a88 "arm64: Expand arm64 image header" ended up
changing the zImage magic (which was actually the initial branch instruction
encoding!). The new header has a proper magic number at a fixed location. Support that as well as the original magic.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
12 years agodocs: fix syntax error in xl.cfg.pod
Olaf Hering [Wed, 25 Sep 2013 21:10:09 +0000 (23:10 +0200)]
docs: fix syntax error in xl.cfg.pod

man/xl.cfg.pod.5 around line 1193: '=item' outside of any '=over'
POD document had syntax errors at /usr/bin/pod2man line 71.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Use the hardware ID to boot correctly secondary cpus
Julien Grall [Thu, 26 Sep 2013 11:09:41 +0000 (12:09 +0100)]
xen/arm: Use the hardware ID to boot correctly secondary cpus

Secondary CPUs will spin in head.S until their MPIDR[23:0] correspond to
the smp_up_cpu. Actually Xen will set the value with the logical CPU ID
which is wrong. Use the cpu_logical_map to get the correct CPU ID.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Dissociate logical and hardware CPU ID
Julien Grall [Thu, 26 Sep 2013 11:09:40 +0000 (12:09 +0100)]
xen/arm: Dissociate logical and hardware CPU ID

Introduce cpu_logical_map to associate a logical CPU ID to an hardware CPU ID.
This map will be filled during Xen boot via the device tree. Each CPU node
contains a "reg" property which contains the hardware ID (ie MPIDR[0:23]).

Also move /cpus parsing later so we can use the dt_* API.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Fix assert in send_SGI_one
Julien Grall [Thu, 26 Sep 2013 11:09:39 +0000 (12:09 +0100)]
xen/arm: Fix assert in send_SGI_one

The GIC can handle maximum 8 cpus (0...7). The CPU id 7 is still valid.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: gic: Use the correct CPU ID
Julien Grall [Thu, 26 Sep 2013 11:09:38 +0000 (12:09 +0100)]
xen/arm: gic: Use the correct CPU ID

The GIC mapping of CPU interfaces does not necessarily match the logical
CPU numbering.

When Xen wants to send an SGI to specific CPU, it needs to use the GIC CPU
ID.  It can be retrieved from ITARGETSR0, in fact when this field is read,
the GIC will return a value that corresponds only to the processor reading
the register.  So Xen can use the PPI 0 to initialize the mapping.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Initialize correctly IRQ routing
Julien Grall [Thu, 26 Sep 2013 11:09:37 +0000 (12:09 +0100)]
xen/arm: Initialize correctly IRQ routing

When Xen initialize the GIC distributor, we need to route all the IRQs to
the boot CPU. The CPU ID can differ between Xen and the GIC.

When ITARGETSR0 is read, each field will return a value that corresponds
only to the processor reading the register. So Xen can use the PPI 0 to
initialize correctly the routing.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: use cpumask_t to describe cpu mask in gic_route_dt_irq
Julien Grall [Thu, 26 Sep 2013 11:09:36 +0000 (12:09 +0100)]
xen/arm: use cpumask_t to describe cpu mask in gic_route_dt_irq

Replace by cpumask_t to take advantage of cpumask_* helpers.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Introduce init_info structure
Julien Grall [Thu, 26 Sep 2013 11:09:35 +0000 (12:09 +0100)]
xen/arm: Introduce init_info structure

This structure will gather all information to boot a secondary cpus.
For now it just contains the initial stack.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86: fix compat guest handling of XENPF_enter_acpi_sleep
Jan Beulich [Thu, 26 Sep 2013 08:23:39 +0000 (10:23 +0200)]
x86: fix compat guest handling of XENPF_enter_acpi_sleep

Rather than blindly defining the native name to the compat one, when
we want to pass the compat structure to a native function we ought to
verify that their layouts match. With a respective xlat.lst entry
there's then also no need anymore to do such aliasing.

While cleaaning up that file I also noticed that the Cx and Px
interface handling here has quite a few unnecessary #define-s - delete
them.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
12 years agofix DOMID_IO mapping permission checks (try 2)
Daniel De Graaf [Thu, 26 Sep 2013 08:15:47 +0000 (10:15 +0200)]
fix DOMID_IO mapping permission checks (try 2)

When the permission checks for memory mapping were moved from
get_pg_owner to xsm_mmu_update in aaba7a677, the exception for DOMID_IO
was not taken into account. This will cause IO memory mappings by PV
domains (mini-os in particular) to fail when XSM/FLASK is not being
used. This patch reintroduces the exception for DOMID_IO; the actual
restrictions on IO memory mappings have always been checked separately
using iomem_access_permitted, so this change should not break existing
access control.

Reported-by: Eduardo Peixoto Macedo <epm@cin.ufpe.br>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
12 years agox86/crash: Indicate how well nmi_shootdown_cpus() managed to do
Andrew Cooper [Thu, 26 Sep 2013 08:14:51 +0000 (10:14 +0200)]
x86/crash: Indicate how well nmi_shootdown_cpus() managed to do

Having nmi_shootdown_cpus() report which pcpus failed to be shot down is a
useful debugging hint as to what possibly went wrong (especially when the
crash logs seem to indicate that an NMI timeout occurred while waiting for one
of the problematic pcpus to perform an action).

This is achieved by swapping an atomic_t count of unreported pcpus with a
cpumask.  In the case that the 1 second timeout occurs, use the cpumask to
identify the problematic pcpus.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86: fix rdrand asm()
Jan Beulich [Thu, 26 Sep 2013 08:11:00 +0000 (10:11 +0200)]
x86: fix rdrand asm()

Just learned the hard way that at least for non-volatile asm()s gcc
indeed does what the documentation says: It may move it across jumps
(i.e. ahead of the cpu_has() check). While the documentation claims
that this can also happen for volatile asm()s, if that was the case
we'd have many more problems in our code (and e,g, Linux would too).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoRevert "fix DOMID_IO mapping permission checks"
Jan Beulich [Wed, 25 Sep 2013 16:13:06 +0000 (18:13 +0200)]
Revert "fix DOMID_IO mapping permission checks"

This reverts commit 145ae98bfab8280744ad5e800cc036e1c84c0486.

12 years agoxm-test: add a missing %s
Zhu Yanhai [Mon, 23 Sep 2013 10:02:33 +0000 (18:02 +0800)]
xm-test: add a missing %s

Obviously we need a %s here.

Signed-off-by: Zhu Yanhai <gaoyang.zyh@taobao.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxenstore: check socket path length before copying it
Matthew Daley [Wed, 18 Sep 2013 03:37:56 +0000 (15:37 +1200)]
xenstore: check socket path length before copying it

Coverity-ID: 1055997
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxenstored: fix faulty check for bad handle in domain_init
Matthew Daley [Wed, 18 Sep 2013 03:37:55 +0000 (15:37 +1200)]
xenstored: fix faulty check for bad handle in domain_init

Coverity-ID: 1054975
Coverity-ID: 1055196
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxenstored: handle unlikely failure better in ask_parents
Matthew Daley [Wed, 18 Sep 2013 03:37:54 +0000 (15:37 +1200)]
xenstored: handle unlikely failure better in ask_parents

Coverity-ID: 1055277
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix file open failure check in libxl__file_reference_map
Matthew Daley [Wed, 18 Sep 2013 03:37:52 +0000 (15:37 +1200)]
libxl: fix file open failure check in libxl__file_reference_map

Coverity-ID: 1055567
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix typo in libxl__hotplug_nic error checking
Matthew Daley [Wed, 18 Sep 2013 03:37:51 +0000 (15:37 +1200)]
libxl: fix typo in libxl__hotplug_nic error checking

Coverity-ID: 1055945
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: only free console reader if it was allocated in main_dmesg
Matthew Daley [Wed, 18 Sep 2013 03:37:50 +0000 (15:37 +1200)]
libxl: only free console reader if it was allocated in main_dmesg

Coverity-ID: 1055304
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix out-of-memory check in parse_global_config
Matthew Daley [Wed, 18 Sep 2013 03:37:45 +0000 (15:37 +1200)]
libxl: fix out-of-memory check in parse_global_config

Coverity-ID: 1055174
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix leak of rune in main_remus
Matthew Daley [Wed, 18 Sep 2013 03:37:44 +0000 (15:37 +1200)]
libxl: fix leak of rune in main_remus

Coverity-ID: 1087194
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix leak of config_data in main_cpupoolcreate
Matthew Daley [Wed, 18 Sep 2013 03:37:43 +0000 (15:37 +1200)]
libxl: fix leak of config_data in main_cpupoolcreate

Coverity-ID: 1087193
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix leak of corename in handle_domain_death
Matthew Daley [Wed, 18 Sep 2013 03:37:42 +0000 (15:37 +1200)]
libxl: fix leak of corename in handle_domain_death

Coverity-ID: 1087192
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix dispose without init of disk in cd_insert
Matthew Daley [Wed, 18 Sep 2013 03:37:41 +0000 (15:37 +1200)]
libxl: fix dispose without init of disk in cd_insert

Coverity-ID: 1056078
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxl: fix libxl_string_list_length and its only caller
Matthew Daley [Wed, 18 Sep 2013 03:37:40 +0000 (15:37 +1200)]
libxl: fix libxl_string_list_length and its only caller

The wrong amount of indirections were being taken in
libxl_string_list_length, and its only caller was miscounting the amount
of initial non-list arguments, seemingly since the initial commit
(599c784).

This has been seen and reported in the wild (##xen):
< Trixboxer> Hi, any idea why would I get
< Trixboxer> xl: libxl_bootloader.c:42: bootloader_arg: Assertion `bl->nargs < bl->argsspace' failed.
< Trixboxer> 4.2.2-23.el6

Coverity-ID: 1054954
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agolibxc: fix memory leak in load_p2m_frame_list error handling
Matthew Daley [Wed, 18 Sep 2013 03:37:38 +0000 (15:37 +1200)]
libxc: fix memory leak in load_p2m_frame_list error handling

Coverity-ID: 1055885
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agofix DOMID_IO mapping permission checks
Daniel De Graaf [Wed, 25 Sep 2013 08:48:20 +0000 (10:48 +0200)]
fix DOMID_IO mapping permission checks

When the permission checks for memory mapping were moved from
get_pg_owner to xsm_mmu_update in aaba7a677, the exception for DOMID_IO
was not taken into account. This will cause IO memory mappings by PV
domains (mini-os in particular) to fail when XSM/FLASK is not being
used. This patch reintroduces the exception for DOMID_IO; the actual
restrictions on IO memory mappings have always been checked separately
using iomem_access_permitted, so this change should not break existing
access control.

Reported-by: Eduardo Peixoto Macedo <epm@cin.ufpe.br>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
12 years agox86/hap: Remove bogus assertion in hap_free_p2m_page()
Andrew Cooper [Wed, 25 Sep 2013 08:45:53 +0000 (10:45 +0200)]
x86/hap: Remove bogus assertion in hap_free_p2m_page()

Coverity ID: 1055622

Coverity correctly points out that this ASSERT() is unconditionally true as an
unsigned integer is always >= 0.

Judging from the shadow counterpart and p2m callsites, there is nothing
invalid about freeing the final p2m page.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
12 years agons16550: Use correct #define symbol for HAS_IOPORTS
Andrew Cooper [Wed, 25 Sep 2013 08:44:21 +0000 (10:44 +0200)]
ns16550: Use correct #define symbol for HAS_IOPORTS

CID 1091471, Regression caused by 7c1de0038895cbc75ebd0caffc5b0f3f03c5ad51

This appears to be a typo which causes check_existence() to unconditionally
return 1 in all cases.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86/xsave: initialize extended register state when guests enable it
Jan Beulich [Wed, 25 Sep 2013 08:41:25 +0000 (10:41 +0200)]
x86/xsave: initialize extended register state when guests enable it

Till now, when setting previously unset bits in XCR0 we wouldn't touch
the active register state, thus leaving in the newly enabled registers
whatever a prior user of it left there, i.e. potentially leaking
information between guests.

This is CVE-2013-1442 / XSA-62.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
12 years agoVMX: drop memory clobbers from vmread/vmwrite wrappers
Jan Beulich [Mon, 23 Sep 2013 15:37:50 +0000 (17:37 +0200)]
VMX: drop memory clobbers from vmread/vmwrite wrappers

All effects are properly being described by the asm() constraints.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jun Nakajima <jun.nakajima@intel.com>
12 years agoVMX: also use proper instruction mnemonic for VMREAD
Jan Beulich [Mon, 23 Sep 2013 15:37:00 +0000 (17:37 +0200)]
VMX: also use proper instruction mnemonic for VMREAD

... when assembler supports it, following commit cfd54835 ("VMX: use
proper instruction mnemonics if assembler supports them"). This merely
got split off from the earlier change becase of the significant number
of call sites needing to be changed.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jun Nakajima <jun.nakajima@intel.com>
12 years agox86/HVM: refuse doing string operations in certain situations
Jan Beulich [Mon, 23 Sep 2013 07:55:14 +0000 (09:55 +0200)]
x86/HVM: refuse doing string operations in certain situations

We shouldn't do any acceleration for
- "rep movs" when either side is passed through MMIO or when both sides
  are handled by qemu
- "rep ins" and "rep outs" when the memory operand is any kind of MMIO

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/HVM: linear address must be canonical for the whole accessed range
Jan Beulich [Mon, 23 Sep 2013 07:53:55 +0000 (09:53 +0200)]
x86/HVM: linear address must be canonical for the whole accessed range

... rather than just for the first byte.

While at it, also
- make the real mode case at least dpo a wrap around check
- drop the mis-named "gpf" label (we're not generating faults here)
  and use in-place returns instead

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86_emulate: fix wrap around handling for repeated string instructions
Jan Beulich [Mon, 23 Sep 2013 07:52:29 +0000 (09:52 +0200)]
x86_emulate: fix wrap around handling for repeated string instructions

For one, repeat count clipping for MOVS must be done taking into
consideration both source and destination addresses.

And then we should allow a wrap on the final iteration only if either
the wrap is a precise one (i.e. the access itself doesn't wrap, just
the resulting index register value would) or if there is just one
iteration. In all other cases we should do a bulk operation first
without hitting the wrap, and then issue an individual iteration. If
we don't do it that way,
- the last iteration not completing successfully will cause the whole
  operation to fail (i.e. registers not get updated to the failure
  point)
- hvmemul_virtual_to_linear() may needlessly enforce non-repeated
  operation

Additionally with the prior implementation there was a case
(df=1, ea=~0, reps=~0, bytes_per_rep=1) where we'd end up passing zero
reps back to the caller, yet various places assume that there's at
least on iteration.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agogdbsx: clear sockaddr before using it
Matthew Daley [Wed, 18 Sep 2013 03:38:04 +0000 (15:38 +1200)]
gdbsx: clear sockaddr before using it

...so that sin_zero is actually zero.

Coverity-ID: 1056070
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agomini-os: fix various memory leaks in various locations
Matthew Daley [Wed, 18 Sep 2013 03:38:03 +0000 (15:38 +1200)]
mini-os: fix various memory leaks in various locations

Coverity-ID: 1055827
Coverity-ID: 1055828
Coverity-ID: 1055829
Coverity-ID: 1055830
Coverity-ID: 1055831
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os: fix various memory leaks in consfront
Matthew Daley [Wed, 18 Sep 2013 03:38:02 +0000 (15:38 +1200)]
mini-os: fix various memory leaks in consfront

Coverity-ID: 1055816
Coverity-ID: 1055817
Coverity-ID: 1055818
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os: fix various memory leaks in pcifront
Matthew Daley [Wed, 18 Sep 2013 03:38:01 +0000 (15:38 +1200)]
mini-os: fix various memory leaks in pcifront

Coverity-ID: 1055834-1055840
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os: fix various memory leaks in netfront
Matthew Daley [Wed, 18 Sep 2013 03:38:00 +0000 (15:38 +1200)]
mini-os: fix various memory leaks in netfront

Coverity-ID: 1055832
Coverity-ID: 1055833
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os: fix various memory leaks in {fb, kbd}front
Matthew Daley [Wed, 18 Sep 2013 03:37:59 +0000 (15:37 +1200)]
mini-os: fix various memory leaks in {fb, kbd}front

Coverity-ID: 1055819-1055826
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os: fix various memory leaks in blkfront
Matthew Daley [Wed, 18 Sep 2013 03:37:58 +0000 (15:37 +1200)]
mini-os: fix various memory leaks in blkfront

Coverity-ID: 1055814
Coverity-ID: 1055815
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os: fix nodename generation in init_netfront
Matthew Daley [Wed, 18 Sep 2013 03:37:57 +0000 (15:37 +1200)]
mini-os: fix nodename generation in init_netfront

Using strlen here makes no sense.

Coverity-ID: 1056053
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agoxen/arm: Support Cortex-A7 GIC
Ian Campbell [Fri, 20 Sep 2013 16:18:36 +0000 (17:18 +0100)]
xen/arm: Support Cortex-A7 GIC

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
12 years agons16550: support DesignWare 8250
Ian Campbell [Fri, 20 Sep 2013 16:18:35 +0000 (17:18 +0100)]
ns16550: support DesignWare 8250

This hardware has an additional feature which signals an error if you try to
write LCR while the UART is busy. We need to clear this error during setup,
otherwise LCR.DLAB doesn't get set and we cannot read/write the divisor.

This has been tested on the cubieboard2

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Cc: jbeulich@suse.com
12 years agons16550: make usable on ARM
Ian Campbell [Fri, 20 Sep 2013 16:18:34 +0000 (17:18 +0100)]
ns16550: make usable on ARM

There are several aspects to this:
- Correctly conditionalise use of PCI
- Correctly conditionalise use of IO ports
- Add discovery via device tree
- Support different registers shift/stride and widths
- Add vuart hooks.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Frser <keir@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Cc: PranavkumarSawargaonkar<pranavkumar@linaro.org>
12 years agoxen/arm: replace io{read,write}{l,b} with {read,write}{l,b}
Ian Campbell [Mon, 9 Sep 2013 16:45:51 +0000 (17:45 +0100)]
xen/arm: replace io{read,write}{l,b} with {read,write}{l,b}

We appear to have invented the io versions ourselves for Xen on ARM, while x86
has the plain read/write. (and so does Linux FWIW)

read/write are used in common driver code (specifically ns16550) so instead of
keeping our own variant around lets replace it with the more standard ones.

At the same time resync with Linux making the "based on" comment in both sets of
io.h somewhat true (they don't look to have been very based on before...). Our
io.h is now consistent with Linux v3.11.

Note that iowrite and write take their arguments in the opposite order.

Also make asm-arm/io.h useful and include it where necessary instead of picking
up the include from mm.h. Remove the include from mm.h

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
12 years agoxen/arm: Implement ioremap.
Ian Campbell [Fri, 20 Sep 2013 16:18:32 +0000 (17:18 +0100)]
xen/arm: Implement ioremap.

Common code uses this, it expects an uncached mapping.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Julien Grall <julien.grall@linaro.org>
12 years agoxen: arm: rework placement of fdt in initial dom0 memory map
Ian Campbell [Tue, 17 Sep 2013 15:28:12 +0000 (16:28 +0100)]
xen: arm: rework placement of fdt in initial dom0 memory map

The 32-bit Linux kernel uses its lowmem direct mapping to access the FDT. The
lowmem mapping is around 0.75GiB but varies depending on the kernel's .config.
Our current scheme of loading the FDT as high as 4GB therefore fails with
larger amounts of dom0 RAM.

The upstream documentation has recently been update to provide more guidance
<http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7824/1>. In
accordance with this load the kernel just below 128MiB (aligned to 2MB) and
the FDT just above, or if there is less RAM available then as high as
possible.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
12 years agoxen: arm: improve VMID allocation.
Ian Campbell [Tue, 17 Sep 2013 15:56:28 +0000 (16:56 +0100)]
xen: arm: improve VMID allocation.

The VMID field is 8 bits. Rather than allowing only up to 256 VMs per host
reboot before things start "acting strange" instead maintain a simple bitmap
of used VMIDs and allocate them statically to guests upon creation.

This limits us to 256 concurrent VMs which is a reasonable improvement.
Eventually we will want a proper scheme to allocate VMIDs on context switch.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
12 years agounmodified_drivers: enable unplug per default
Olaf Hering [Fri, 20 Sep 2013 09:41:08 +0000 (11:41 +0200)]
unmodified_drivers: enable unplug per default

Since xen-3.3 an official unplug protocol for emulated hardware is
available in the toolstack. The pvops kernel does the unplug per
default, so it is safe to do it also in the drivers for forward ported
xenlinux.
Currently its required to load xen-platform-pci with the module
parameter dev_unplug=all, which is cumbersome.
Also recognize the dev_unplug=never parameter, which provides the
default before this patch.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
12 years agognttab: remove unused shared header lookup
Matthew Daley [Fri, 20 Sep 2013 09:40:00 +0000 (11:40 +0200)]
gnttab: remove unused shared header lookup

Coverity-ID: 1056171

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
12 years agosched_credit: filter node-affinity mask against online cpus
Dario Faggioli [Fri, 20 Sep 2013 09:37:28 +0000 (11:37 +0200)]
sched_credit: filter node-affinity mask against online cpus

in _csched_cpu_pick(), as not doing so may result in the domain's
node-affinity mask (as retrieved by csched_balance_cpumask() )
and online mask (as retrieved by cpupool_scheduler_cpumask() )
having an empty intersection.

Therefore, when attempting a node-affinity load balancing step
and running this:

    ...
    /* Pick an online CPU from the proper affinity mask */
    csched_balance_cpumask(vc, balance_step, &cpus);
    cpumask_and(&cpus, &cpus, online);
    ...

we end up with an empty cpumask (in cpus). At this point, in
the following code:

    ....
    /* If present, prefer vc's current processor */
    cpu = cpumask_test_cpu(vc->processor, &cpus)
            ? vc->processor
            : cpumask_cycle(vc->processor, &cpus);
    ....

an ASSERT (from inside cpumask_cycle() ) triggers like this:

(XEN) Xen call trace:
(XEN)    [<ffff82d08011b124>] _csched_cpu_pick+0x1d2/0x652
(XEN)    [<ffff82d08011b5b2>] csched_cpu_pick+0xe/0x10
(XEN)    [<ffff82d0801232de>] vcpu_migrate+0x167/0x31e
(XEN)    [<ffff82d0801238cc>] cpu_disable_scheduler+0x1c8/0x287
(XEN)    [<ffff82d080101b3f>] cpupool_unassign_cpu_helper+0x20/0xb4
(XEN)    [<ffff82d08010544f>] continue_hypercall_tasklet_handler+0x4a/0xb1
(XEN)    [<ffff82d080127793>] do_tasklet_work+0x78/0xab
(XEN)    [<ffff82d080127a70>] do_tasklet+0x5f/0x8b
(XEN)    [<ffff82d080158985>] idle_loop+0x57/0x5e
(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 1:
(XEN) Assertion 'cpu < nr_cpu_ids' failed at /home/dario/Sources/xen/xen/xen.git/xen/include/xe:16481

It is for example sufficient to have a domain with node-affinity
to NUMA node 1 running, and issueing a `xl cpupool-numa-split'
would make the above happen. That is because, by default, all
the existing domains remain assigned to the first cpupool, and
it now (after the cpupool-numa-split) only includes NUMA node 0.

This change prevents that by generalizing the function used
for figuring out whether a node-affinity load balancing step
is legit or not. This way we can, in _csched_cpu_pick(),
figure out early enough that the mask would end up empty,
skip the step all together and avoid the splat.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
12 years agox86_emulate: fold wide reads
Jan Beulich [Fri, 20 Sep 2013 09:05:28 +0000 (11:05 +0200)]
x86_emulate: fold wide reads

With HVM's MMIO operand handling now being capable of splitting large
reads, there's no need to issue at most machine word size reads when
we really need wider operands.

Not that this is not done everywhere - there are a couple of cases
where keeping the reads separate is more natural (and folding them
would complicate the code rather than simplifying it).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86_emulate: fix flag setting for 8-bit signed multiplication
Jan Beulich [Fri, 20 Sep 2013 09:04:52 +0000 (11:04 +0200)]
x86_emulate: fix flag setting for 8-bit signed multiplication

We really need to check for a signed overflow of 8 bits, while the
previous check compared the sign-extended 8-bit result with the
zero-extended 16-bit one (which was wrong for all negative results).

Once at it
- also adjust the 16-bit comparison for symmetry
- improve the 8-bit multiplication (no need to zero-extend to 32-bits
  the sign-extended to 16 bits original 8-bit value)
- fold both signed multiplication variants

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86_emulate: PUSH <mem> must read source operand just once
Jan Beulich [Fri, 20 Sep 2013 09:03:53 +0000 (11:03 +0200)]
x86_emulate: PUSH <mem> must read source operand just once

... for the case of accessing MMIO.

Rather than doing the early operand type adjustment for just for that
case, do it for all of the 0xF6, 0xF7, and 0xFF groups (allowing some
other code to be dropped instead).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86_emulate: MOVSXD must read source operand just once
Jan Beulich [Fri, 20 Sep 2013 09:03:12 +0000 (11:03 +0200)]
x86_emulate: MOVSXD must read source operand just once

... for the case of accessing MMIO.

Also streamline the ARPL emulation a little, and add tests for both
instructions (the MOVSXD one requires a few other adjustments, as we
now need to run in a mode where the emulator's mode_64bit() returns
true).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86: fix dependencies of emulator test
Jan Beulich [Fri, 20 Sep 2013 09:02:47 +0000 (11:02 +0200)]
x86: fix dependencies of emulator test

Rather than mentioning the (linked) directory, mention the files thus
making sure things get rebuild as needed when the core emulator files
change.

Also enable debug info generation unconditionally, as this is testing
stuff only anyway.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agox86/HVM: properly handle MMIO reads and writes wider than a machine word
Jan Beulich [Fri, 20 Sep 2013 09:01:08 +0000 (11:01 +0200)]
x86/HVM: properly handle MMIO reads and writes wider than a machine word

Just like real hardware we ought to split such accesses transparently
to the caller. With little extra effort we can at once even handle page
crossing accesses correctly.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
12 years agotools: print xm deprecation warning to stderr
Ian Campbell [Wed, 18 Sep 2013 20:27:19 +0000 (21:27 +0100)]
tools: print xm deprecation warning to stderr

To avoid confusing anything which is parsing the output.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
12 years agox86: mark BUG()s and assertion failures as terminal.
Tim Deegan [Thu, 19 Sep 2013 14:38:09 +0000 (15:38 +0100)]
x86: mark BUG()s and assertion failures as terminal.

This helps avoid static analysis false-positives, and might lead to
better code density as the compiler knows it doesn't have to restore
spilled state &c.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
12 years agoVMX: fix failure path in construct_vmcs
George Dunlap [Wed, 18 Sep 2013 12:45:42 +0000 (14:45 +0200)]
VMX: fix failure path in construct_vmcs

If the allocation fails, make sure to call vmx_vmcs_exit().

This is a candidate for backport.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
12 years agox86/HVM: fix failure path in hvm_vcpu_initialise
George Dunlap [Wed, 18 Sep 2013 12:45:24 +0000 (14:45 +0200)]
x86/HVM: fix failure path in hvm_vcpu_initialise

It looks like one of the failure cases in hvm_vcpu_initialise jumps to
the wrong label; this could lead to slow leaks if something isn't
cleaned up properly.

I will probably change these labels in a future patch, but I figured
it was better to have this fix separately.

This is also a candidate for backport.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
12 years agotools: disable xend build by default
Ian Campbell [Thu, 12 Sep 2013 10:34:12 +0000 (11:34 +0100)]
tools: disable xend build by default

Add big warnings to configure, xend initscript and xm.

The big xm warning is displayed once (per boot, or per tmpreaper clean),
afterwards a single line warning is displayed.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
12 years agodocs: fix documentation index for hypercalls
Ian Campbell [Wed, 11 Sep 2013 09:48:19 +0000 (10:48 +0100)]
docs: fix documentation index for hypercalls

This was broken by 118104e5eaf2 "docs: Build docs for ARM as well as x86_64".

Move docs to hypercall/ARCH instead of hypercall-ARCH.

Support mulitple levels of subdirectories in gen-html-index tool.

This removes the need for a symlink hypercall->hypercall-x86_64 since there is
now a proper index at hypercall/index.html.

Update INDEX to human readable names for the architecture specific hypercalls.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
12 years agopassthrough/amd: Shuffle declaration.
Tim Deegan [Thu, 12 Sep 2013 11:05:18 +0000 (12:05 +0100)]
passthrough/amd: Shuffle declaration.

Coverity's parser chokes on seeing __section() before the type.

Coverity CID 1087190

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
12 years agopassthrough/amd: Missing 'break'
Tim Deegan [Thu, 12 Sep 2013 10:57:01 +0000 (11:57 +0100)]
passthrough/amd: Missing 'break'

Coverity CID 1055502

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
12 years agopassthrough/amd: Drop unnecessary lock lookup.
Tim Deegan [Thu, 12 Sep 2013 10:45:13 +0000 (11:45 +0100)]
passthrough/amd: Drop unnecessary lock lookup.

The lock's not used for anything, and AFAICT no locking is needed
since the IVRS tables are static after boot.

Coverity CID 1087199

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
12 years agoARM: parse separate DT properties for different commandlines
Andre Przywara [Fri, 13 Sep 2013 12:49:34 +0000 (13:49 +0100)]
ARM: parse separate DT properties for different commandlines

Currently we use the chosen/bootargs property as the Xen commandline
and rely on xen,dom0-bootargs for Dom0. However this brings issues
with bootloaders, which usually build bootargs by bootscripts for a
Linux kernel - and not for the entirely different Xen hypervisor.

Introduce a new possible device tree property "xen,xen-bootargs"
explicitly for the Xen hypervisor and make the selection of which to
use more fine grained:
- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is,
  bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing,
  bootargs will be used for Dom0.

The aim is to allow common bootscripts to boot both Xen and native
Linux with the same device tree blob. If needed, one could hard-code
the Xen commandline into the DTB, leaving bootargs for Dom0 to be set
by the (non Xen-aware) bootloader.

I will send out a appropriate u-boot patch, which writes the content
of the "xen_bootargs" environment variable into the xen,xen-bootargs
dtb property.

Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Check if the device is available before using it
Julien Grall [Fri, 13 Sep 2013 12:49:33 +0000 (13:49 +0100)]
xen/arm: Check if the device is available before using it

It's possible to have a device description in the DTS but the device is not
wired.

device_init must check if the device is available before doing anything with
it.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/dts: replace get_val by dt_next_cell
Julien Grall [Fri, 13 Sep 2013 12:49:32 +0000 (13:49 +0100)]
xen/dts: replace get_val by dt_next_cell

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/dts: device_get_reg: cells are 32-bit big endian value
Julien Grall [Fri, 13 Sep 2013 12:49:31 +0000 (13:49 +0100)]
xen/dts: device_get_reg: cells are 32-bit big endian value

Device tree cells are 32-bit big endian value. Use __be32 to avoid confusion
later.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/dts: Clean up the exported API for device tree
Julien Grall [Fri, 13 Sep 2013 12:49:30 +0000 (13:49 +0100)]
xen/dts: Clean up the exported API for device tree

All Xen code has been converted to the new device tree API that uses a tree
structure to describe the DTS.

The Flat Device tree is still used by Xen during early boot stage, but only in
internal. Remove entirely unneeded functions or move to a static function.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: exynos5: Blacklist MCT device
Julien Grall [Fri, 13 Sep 2013 12:49:29 +0000 (13:49 +0100)]
xen/arm: exynos5: Blacklist MCT device

The Multi Core Timer (MCT) is a Samsung specific device.
This device tries to route IRQ in non-boot CPU which is not yet handled by Xen.

The user will see randomly dom0 hang, but I'm not sure that is the real reason.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: vexpress: Blacklist a list of board specific devices
Julien Grall [Fri, 13 Sep 2013 12:49:28 +0000 (13:49 +0100)]
xen/arm: vexpress: Blacklist a list of board specific devices

On Versatile there are a bunch of devices which must not be pass-through to any
guest (power management and cache coherency devices).

This commit also blacklists the HDLCD device because Xen is unable to correctly
map the framebuffer into dom0. Therefore, when Linux will try to access to the
framebuffer, Xen will receive a non-handled data access.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Remove devices used by Xen from dom0 device tree
Julien Grall [Fri, 13 Sep 2013 12:49:27 +0000 (13:49 +0100)]
xen/arm: Remove devices used by Xen from dom0 device tree

Devices used by Xen should not be pass-through to dom0. If the device is really
usefull for dom0 (for instance the timer and the GIC), it will recreate the
node.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Add new platform specific callback device_is_blacklist
Julien Grall [Fri, 13 Sep 2013 12:49:26 +0000 (13:49 +0100)]
xen/arm: Add new platform specific callback device_is_blacklist

Each platform code will list the device that must not pass-through to a guest.
Theses devices are used for: power management, timer,...

When theses devices are given to DOM0, it can controls the hardware and then
break the whole platform.

This callback is enough until we will start to care about power performance.
For this purpose, we may need to extend this interface to implement per-device
MMIO filtering to allow dom0 to continue to control devices which it owns which
happen to share e.g. a clock controller with Xen.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Create a fake timer node in dom0 device tree
Julien Grall [Fri, 13 Sep 2013 12:49:25 +0000 (13:49 +0100)]
xen/arm: Create a fake timer node in dom0 device tree

Recreate the timer node and remove hypervisor specific interrupt.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Create a fake GIC node in dom0 device tree
Julien Grall [Fri, 13 Sep 2013 12:49:24 +0000 (13:49 +0100)]
xen/arm: Create a fake GIC node in dom0 device tree

Recreate the GIC node and remove hypervisor specific ranges (vgic and hypervisor
controls).

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Create a fake cpus node in dom0 device tree
Julien Grall [Fri, 13 Sep 2013 12:49:23 +0000 (13:49 +0100)]
xen/arm: Create a fake cpus node in dom0 device tree

The number of cpus in dom0 can be different compare to the real number of
physical cpus.

For the moment, Xen assumes that the cpus are identical.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Create a fake PSCI node in dom0 device tree
Julien Grall [Fri, 13 Sep 2013 12:49:22 +0000 (13:49 +0100)]
xen/arm: Create a fake PSCI node in dom0 device tree

Xen uses PSCI to bring up secondary cpus for the guest.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Don't map disabled device in DOM0
Julien Grall [Fri, 13 Sep 2013 12:49:21 +0000 (13:49 +0100)]
xen/arm: Don't map disabled device in DOM0

Linux should cope with 'status = "disabled"' in the Device Tree.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Build DOM0 FDT by browsing the device tree structure
Julien Grall [Fri, 13 Sep 2013 12:49:20 +0000 (13:49 +0100)]
xen/arm: Build DOM0 FDT by browsing the device tree structure

Remove the usage of the FDT in benefit of the device tree structure.
The latter is easier to use and can embedded meta-data for Xen (ie: is the
device is used by Xen...).

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/dts: dt_find_interrupt_controller: accept multiple compatible strings
Julien Grall [Fri, 13 Sep 2013 12:49:19 +0000 (13:49 +0100)]
xen/dts: dt_find_interrupt_controller: accept multiple compatible strings

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/arm: Use dt_device_match to avoid multiple if conditions
Julien Grall [Fri, 13 Sep 2013 12:49:18 +0000 (13:49 +0100)]
xen/arm: Use dt_device_match to avoid multiple if conditions

There is some place in Xen ARM code where multiple if conditions is used
check the presence of a node or find a node.
These pieces of code can be replace by an array and using proper device tree
helpers.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/video: hdlcd: Use early_printk instead of printk
Julien Grall [Fri, 13 Sep 2013 12:49:17 +0000 (13:49 +0100)]
xen/video: hdlcd: Use early_printk instead of printk

The video driver is initialized before the console is correctly set up.
Therefore, printk will never output if there is no serial configured.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
12 years agoxen/video: hdlcd: Convert the driver to the new device tree API
Julien Grall [Fri, 13 Sep 2013 12:49:16 +0000 (13:49 +0100)]
xen/video: hdlcd: Convert the driver to the new device tree API

Avoid to use FDT API which will be removed soon

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian campbell <ian.campbell@citrix.com>
12 years agoxen/dts: Check the CPU ID is not greater than NR_CPUS
Julien Grall [Fri, 13 Sep 2013 12:49:15 +0000 (13:49 +0100)]
xen/dts: Check the CPU ID is not greater than NR_CPUS

On some board CPU IDs are not contiguous (for instance the Versatile Express
with big.LITTLE supports). If the CPU ID is greater than NR_CPUS Xen will hang
without any message. This is because console driver is not yet initialized and
hypervisor data abort uses printk.

For the moment check the CPU ID and print an warning if an error occured.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>