]> xenbits.xensource.com Git - people/royger/xen.git/log
people/royger/xen.git
9 years agolibxl: add support for migrating HVM guests without a device model hvm_without_dm_v7.2 gitlab/hvm_without_dm_v7.2
Roger Pau Monne [Tue, 29 Sep 2015 14:25:37 +0000 (16:25 +0200)]
libxl: add support for migrating HVM guests without a device model

Only some minor libxl changes are needed in order to be able to migrate HVM
guests without a device model, no hypervisor changes are needed.

This change prevents sending the emulator context if the device model
version is set to none.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v7:
 - Prevent sending the emulator context and xenstore record in
   write_emulator_context_record and write_emulator_xenstore_record.
 - Error out if an emulator record is received for a no-dm guest.

9 years agolibxl: allow the creation of HVM domains without a device model.
Roger Pau Monne [Fri, 4 Sep 2015 11:06:50 +0000 (13:06 +0200)]
libxl: allow the creation of HVM domains without a device model.

Replace the firmware loaded into HVM guests with an OS kernel. Since the HVM
builder now uses the PV xc_dom_* set of functions this kernel will be parsed
and loaded inside the guest like on PV, but the container is a pure HVM
guest.

Also, if device_model_version is set to none or a device model for the
specified domain is not present unconditinally set the nic type to
LIBXL_NIC_TYPE_VIF.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v7:
 - Add LIBXL_HAVE_DEVICE_MODEL_VERSION_NONE.

Changes since v5:
 - Add Wei Liu Acked-by.

Changes since v4:
 - Set dom->mmio_size to match the size of the special pages if there's no
   device model for the guest. This implies moving NR_SPECIAL_PAGES and
   X86_HVM_END_SPECIAL_REGION to a public header so they can be known by
   libxl when creating the memory map.
 - Reword the xl.cfg man page description of the "none" device model option.
 - Use libxl__device_model_version_running instead of creating a new
   function.

Changes since v3:
 - Add explicit /* fall through */ comments.
 - Expand libxl__device_nic_setdefault so that it sets the right nic type
   for HVMlite guests.
 - Remove stray space in hvm_build_set_params.
 - Fix the error paths of libxl__domain_firmware.

9 years agolibxc: switch xc_dom_elfloader to be used with HVMlite domains
Roger Pau Monne [Fri, 4 Sep 2015 11:06:50 +0000 (13:06 +0200)]
libxc: switch xc_dom_elfloader to be used with HVMlite domains

Allow xc_dom_elfloader to report a guest type as hvm-3.0-x86_32 if it's
running inside of a HVM container and has the PHYS32_ENTRY elfnote set.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Only xc_dom_elfloader has been switched to support HVMlite, other loaders
should also be switched once we have a HVMlite compatible kernel that uses
them.
---
Changes since v5:
 - Add Wei Liu Ack.

Changes since v4:
 - Add Andrew Cooper Reviewed-by.

9 years agolibxc/xen: introduce a start info structure for HVMlite guests
Roger Pau Monne [Fri, 4 Sep 2015 11:06:50 +0000 (13:06 +0200)]
libxc/xen: introduce a start info structure for HVMlite guests

This structure contains the physical address of the command line, as well as
the physical address of the list of loaded modules. The physical address of
this structure is passed to the guest at boot time in the %ebx register.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v7:
 - Add a comment to clarify that nothing will be loaded at physical address
   0.
 - Add Andrew Cooper Reviewed-by.
 - Add Wei Liu Ack.

Changes since v6:
 - Add a check to make sure the start info data is placed below 4GB.
 - Make sure byte addresses are treated as uintptr_t.
 - Fix single-line comment.

Changes since v5:
 - Change some of the calculations performed to get the total size of the
   start_info region.
 - Replace the mention of HVMlite in a comment with PVH.
 - Don't use 64bit integers in hvm_modlist_entry.

9 years agoxen/x86: allow HVM guests to use hypercalls to bring up vCPUs
Roger Pau Monne [Fri, 4 Sep 2015 11:06:49 +0000 (13:06 +0200)]
xen/x86: allow HVM guests to use hypercalls to bring up vCPUs

Allow the usage of the VCPUOP_initialise, VCPUOP_up, VCPUOP_down and
VCPUOP_is_up hypercalls from HVM guests.

This patch introduces a new structure (vcpu_hvm_context) that should be used
in conjuction with the VCPUOP_initialise hypercall in order to initialize
vCPUs for HVM guests.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@citrix.com>
---
Changes since v7:
 - Improved error messages.
 - Set EFER.LMA if EFER.LME is set by the user.
 - Fix calculation of CS limit.
 - Add more checks to segment registers.
 - Add checks to make sure padding fields are 0.
 - Remove ugly arch ifdefs from common domain.c.
 - Add the implicit padding of vcpu_hvm_x86_32 explicitly in the structure.
 - Simplify the compat vcpu code since it's only used on x86.

Changes since v6:
 - Add comments to clarify some initializations.
 - Introduce a generic default_initialize_vcpu that's used to initialize a
   ARM vCPU or a x86 PV vCPU.
 - Move the undef of the SEG macro.
 - Fix the size of the eflags register, it should be 32bits.
 - Add a comment regarding the value of the 12-15 bits of the _ar fields.
 - Remove the 16bit strucutre, the 32bit one can be used to start the cpu in
   real mode.
 - Add some sanity checks to the values passed in.
 - Add paddings to vcpu_hvm_context so the layout on 32/64bits is the same.
 - Add support for the compat version of VCPUOP_initialise.

Changes since v5:
 - Fix a coding style issue.
 - Merge the code from wip-dmlite-v5-refactor by Andrew in order to reduce
   bloat.
 - Print the offending %cr3 in case of error when using shadow.
 - Reduce the scope of local variables in arch_initialize_vcpu.
 - s/current->domain/v->domain/g in arch_initialize_vcpu.
 - Expand the comment in public/vcpu.h to document the usage of
   vcpu_hvm_context for HVM guests.
 - Add myself as the copyright holder for the public hvm_vcpu.h header.

Changes since v4:
 - Don't assume mode is 64B, add an explicit check.
 - Don't set TF_kernel_mode, it is only needed for PV guests.
 - Don't set CR0_ET unconditionally.

9 years agolibxc: allow creating domains without emulated devices.
Roger Pau Monne [Fri, 4 Sep 2015 11:06:49 +0000 (13:06 +0200)]
libxc: allow creating domains without emulated devices.

Introduce a new flag in xc_dom_image that turns on and off the emulated
devices. This prevents creating the VGA hole, the hvm_info page and the
ioreq server pages. libxl unconditionally sets it to true for all HVM
domains at the moment.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v5:
 - Add Andrew Cooper Reviewed-by.

Changes since v4:
 - Store the size of the VGA hole inside of the xc_dom_image struct and set
   it from libxl.
 - Rename dom->emulation to dom->device_model (no functional change).
 - Add Wei Liu Acked-by.

Changes since v3:
 - Explain the meaning of the "emulation" xc_dom_image field.

9 years agoelfnotes: intorduce a new PHYS_ENTRY elfnote
Roger Pau Monne [Fri, 4 Sep 2015 11:06:49 +0000 (13:06 +0200)]
elfnotes: intorduce a new PHYS_ENTRY elfnote

This new elfnote contains the 32bit entry point into the kernel. Xen will
use this entry point in order to launch the guest kernel in 32bit protected
mode with paging disabled.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v6:
 - Reword a comment.

Changes since v4:
 - Add Andrew Cooper Reviewed-by and Wei Liu Acked-by.

9 years agoxen/x86: allow disabling all emulated devices inside of Xen
Roger Pau Monne [Fri, 4 Sep 2015 11:06:48 +0000 (13:06 +0200)]
xen/x86: allow disabling all emulated devices inside of Xen

Only allow enabling or disabling all the emulated devices inside of Xen,
right now Xen doesn't support enabling specific emulated devices only.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v7:
 - Rework if condition.

Changes since v5:
 - Add Andrew Cooper Reviewed-by.

9 years agoxen/x86: make sure the HVM callback vector is correctly set
Roger Pau Monne [Fri, 25 Sep 2015 16:42:06 +0000 (18:42 +0200)]
xen/x86: make sure the HVM callback vector is correctly set

If certain devices (like the local or the io apic) are disabled some modes
of operation of the HVM event channel callback cannot be used. Make sure Xen
doesn't try to setup them.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoxen/x86: allow disabling the emulated PIT
Roger Pau Monne [Fri, 30 Oct 2015 15:15:26 +0000 (16:15 +0100)]
xen/x86: allow disabling the emulated PIT

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reported by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v7:
 - Patch added.

9 years agoxen/x86: allow disabling the emulated IOMMU
Roger Pau Monne [Fri, 4 Sep 2015 11:06:48 +0000 (13:06 +0200)]
xen/x86: allow disabling the emulated IOMMU

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
---
Changes since v4:
 - Add Andrew Cooper Acked-by.

9 years agoxen/x86: allow disabling the emulated VGA
Roger Pau Monne [Fri, 4 Sep 2015 11:06:48 +0000 (13:06 +0200)]
xen/x86: allow disabling the emulated VGA

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v4:
 - Add Andrew Cooper Acked-by.

9 years agoxen/x86: set the vPMU interface based on the presence of a lapic
Roger Pau Monne [Fri, 4 Sep 2015 11:06:47 +0000 (13:06 +0200)]
xen/x86: set the vPMU interface based on the presence of a lapic

Instead of choosing the interface to expose to guests based on the guest
type, do it based on whether the guest has an emulated local apic or not.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v7:
 - Merge vpmu work from Boris.

Changes since v6:
 - Major rework of the approach.
 - Drop Andrew Cooper Acked-by.

Changes since v4:
 - Add Andrew Cooper Acked-by.

9 years agoxen/x86: allow disabling the emulated PIC
Roger Pau Monne [Fri, 4 Sep 2015 11:06:47 +0000 (13:06 +0200)]
xen/x86: allow disabling the emulated PIC

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v6:
 - Return ENODEV in vpic_load if the vpic is disabled.
 - Add asserts to vpic_irq_{negative/positive}_edge and vpic_ack_pending_irq
   to make sure they are not called when the vpic is disabled.
 - Add a check to vpic_reset in order to prevent calling it with the vpic
   disabled.

Changes since v4:
 - Add Andrew Cooper Acked-by.

9 years agoxen/x86: allow disabling the emulated IO APIC
Roger Pau Monne [Fri, 4 Sep 2015 11:06:47 +0000 (13:06 +0200)]
xen/x86: allow disabling the emulated IO APIC

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v6:
 - Return ENODEV in ioapic_load if the ioapic is disabled.
 - Add an assert to make sure vioapic_update_EOI and
   vioapic_irq_positive_edge is only called when the vioapic is enabled.

Changes since v4:
 - Add Andrew Cooper Acked-by.

9 years agoxen/x86: allow disabling the emulated RTC
Roger Pau Monne [Fri, 4 Sep 2015 11:06:47 +0000 (13:06 +0200)]
xen/x86: allow disabling the emulated RTC

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v6:
 - Return ENODEV in rtc_load if rtc is disabled.
 - Add checks to rtc_reset and rtc_update_clock to prevent calling them if
   rtc is disabled.

Changes since v4:
 - Add Andrew Cooper Acked-by.

9 years agoxen/x86: allow disabling power management
Roger Pau Monne [Fri, 4 Sep 2015 11:06:46 +0000 (13:06 +0200)]
xen/x86: allow disabling power management

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v7:
 - Add Andrew Cooper Reviewed-by.
 - Apply renaming from earlier patch (s/PMTIMER/PM/).

Changes since v6:
 - Return ENODEV in pmtimer_load if the timer is disabled.
 - hvm_acpi_power_button and hvm_acpi_sleep_button become noops if the
   pmtimer is disabled.
 - Return ENODEV if pmtimer_change_ioport is called with the pmtimer
   disabled.
 - Add a check for disabled pmtimer in pmtimer_reset. Although it's safe to
   execute this function now, it might change in the future.
 - Drop Andrew's Ack due to the changes.

Changes since v4:
 - Add Andrew Cooper Acked-by.

9 years agoxen/x86: allow disabling the emulated HPET
Roger Pau Monne [Fri, 4 Sep 2015 11:06:46 +0000 (13:06 +0200)]
xen/x86: allow disabling the emulated HPET

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v6:
 - Return ENODEV in hpet_load if the vhpet is disabled.

Changes since v4:
 - Add Andrew Cooper Acked-by.

9 years agoxen/x86: allow disabling the emulated local apic
Roger Pau Monne [Fri, 4 Sep 2015 11:06:46 +0000 (13:06 +0200)]
xen/x86: allow disabling the emulated local apic

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
Cc: Eddie Dong <eddie.dong@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
---
Changes since v7:
 - Return 0 on vlapic_msr_set to note an error if the vlapic is disabled.
 - Add Andrew Cooper Reviewed-by.

Changes since v6:
 - Remove stall comments.
 - Adds checks for has_vlapic in the msixtbl_pt_{un}register functions.
 - Simplify the is_pvh_domain(d) || !has_vlapic(d) to !has_vlapic(d) when
   appropriate.
 - Split parts of this patch that can be considered bug fixes to a
   pre-patch.
 - Removed Acks since the patch changed substantially.

Changes since v5:
 - Add Boris Ostrovsky Reviewed-by.

Changes since v4:
 - Split the is_pvh_domain check into two, so part of the code can be shared
   with the !has_lapic case.
 - Add Andrew Cooper Acked-by.

9 years agoxen/vlapic: fixes for HVM code when running without a vlapic
Roger Pau Monne [Fri, 25 Sep 2015 09:18:40 +0000 (11:18 +0200)]
xen/vlapic: fixes for HVM code when running without a vlapic

The HVM related code (SVM, VMX) generally assumed that a local apic is
always present. With the introduction of a HVM mode were the local apic can
be removed, some of this broken code paths arised.

The SVM exit/resume paths unconditionally checked the state of the lapic,
which is wrong if it's been disabled by hardware, fix this by adding the
necessary checks. On the VMX side, make sure we don't add mappings for a
local apic if it's disabled.

In the generic vlapic code, add checks to prevent setting the TSC deadline
timer if the lapic is disabled, and also prevent trying to inject interrupts
from the PIC is the lapic is also disabled.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
Cc: Eddie Dong <eddie.dong@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
---
Changes since v7:
 - Only check apic_access_mfn in vmx_install_vlapic_mapping, and add an
   assert.
 - Return 0 (instead of -ENODEV) in vlapic_accept_pic_intr if the vlapic is
   disabled.
 - Add Boris Ostrovsky Reviewed-by tag.

9 years agoxen/x86: add bitmap of enabled emulated devices
Roger Pau Monne [Fri, 4 Sep 2015 11:06:45 +0000 (13:06 +0200)]
xen/x86: add bitmap of enabled emulated devices

Introduce a bitmap in x86 xen_arch_domainconfig that allows enabling or
disabling specific devices emulated inside of Xen for HVM guests.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>
---
Changes since v7:
 - Make the has_* macros actual booleans.
 - Allow the idle domain to be created without an arch specific config.
 - Check that PVH guests don't try to enable any emulated devices.
 - Add a flag for disabling the PIT.
 - Rename XEN_X86_EMU_PMTIMER into XEN_X86_EMU_PM and also rename the
   related macro.

Changes since v6:
 - Define XEN_X86_EMU_ALL to contain all the possible emulated devices.
 - Remove full stops form the printks added to arch_domain_create.
 - Add Wei Liu Acked-by.
 - Added a check to x86 arch_domain_create in order to make sure a non-null
   config is always provided.
 - Check that emulation_flags is always 0 for PV guests.
 - Fix x86 callers of domain_create in order to make sure a non-null arch
   config is always provided.
 - Removed XEN_X86_EMU_PMU.
 - Removed Andrew Cooper's Reviewed-by, since the hypervisor side code has
   changed substantially.

Changes since v4:
 - Add a check to make sure the emulation bitmap is sane (undefined bits are
   all 0s).
 - Add Andrew Cooper Reviewed-by.

Changes since v3:
 - Return EOPNOTSUPP instead of ENOPERM if an invalid emulation mask is
   used.
 - Fix error messages (prefix them with d%d and use %#x instead of 0x%x).
 - Clearly state in the public header that emulation_flags should only be
   used with HVM guests.
 - Add a XEN_X86 prefix to the emulation flags defines.
 - Properly parenthese the has_* marcos.

9 years agolibxl: adjust PoD target by memory fudge, too
Ian Jackson [Wed, 21 Oct 2015 15:18:30 +0000 (16:18 +0100)]
libxl: adjust PoD target by memory fudge, too

PoD guests need to balloon at least as far as required by PoD, or risk
crashing.  Currently they don't necessarily know what the right value
is, because our memory accounting is (at the very least) confusing.

Apply the memory limit fudge factor to the in-hypervisor PoD memory
target, too.  This will increase the size of the guest's PoD cache by
the fudge factor LIBXL_MAXMEM_CONSTANT (currently 1Mby).  This ensures
that even with a slightly-off balloon driver, the guest will be
stable even under memory pressure.

There are two call sites of xc_domain_set_pod_target that need fixing:

The one in libxl_set_memory_target is straightforward.

The one in xc_hvm_build_x86.c:setup_guest is more awkward.  Simply
setting the PoD target differently does not work because the various
amounts of memory during domain construction no longer match up.
Instead, we adjust the guest memory target in xenstore (but only for
PoD guests).

This introduces a 1Mby discrepancy between the balloon target of a PoD
guest at boot, and the target set by an apparently-equivalent `xl
mem-set' (or similar) later.  This approach is low-risk for a security
fix but we need to fix this up properly in xen.git#staging and
probably also in stable trees.

This is XSA-153.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
(cherry picked from commit 56fb5fd62320eb40a7517206f9706aa9188d6f7b)

9 years agox86: rate-limit logging in do_xen{oprof,pmu}_op()
Jan Beulich [Thu, 29 Oct 2015 12:37:19 +0000 (13:37 +0100)]
x86: rate-limit logging in do_xen{oprof,pmu}_op()

Some of the sub-ops are acessible to all guests, and hence should be
rate-limited. In the xenoprof case, just like for XSA-146, include them
only in debug builds. Since the vPMU code is rather new, allow them to
be always present, but downgrade them to (rate limited) guest messages.

This is CVE-2015-7971 / XSA-152.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Ian Campbell <ian.campbell@citrix.com>
9 years agoxenoprof: free domain's vcpu array
Jan Beulich [Thu, 29 Oct 2015 12:36:52 +0000 (13:36 +0100)]
xenoprof: free domain's vcpu array

This was overlooked in fb442e2171 ("x86_64: allow more vCPU-s per
guest").

This is CVE-2015-7969 / XSA-151.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Ian Campbell <ian.campbell@citrix.com>
9 years agox86/PoD: Eager sweep for zeroed pages
Andrew Cooper [Thu, 29 Oct 2015 12:36:25 +0000 (13:36 +0100)]
x86/PoD: Eager sweep for zeroed pages

Based on the contents of a guests physical address space,
p2m_pod_emergency_sweep() could degrade into a linear memcmp() from 0 to
max_gfn, which runs non-preemptibly.

As p2m_pod_emergency_sweep() runs behind the scenes in a number of contexts,
making it preemptible is not feasible.

Instead, a different approach is taken.  Recently-populated pages are eagerly
checked for reclaimation, which amortises the p2m_pod_emergency_sweep()
operation across each p2m_pod_demand_populate() operation.

Note that in the case that a 2M superpage can't be reclaimed as a superpage,
it is shattered if 4K pages of zeros can be reclaimed.  This is unfortunate
but matches the previous behaviour, and is required to avoid regressions
(domain crash from PoD exhaustion) with VMs configured close to the limit.

This is CVE-2015-7970 / XSA-150.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
9 years agofree domain's vcpu array
Jan Beulich [Thu, 29 Oct 2015 12:35:40 +0000 (13:35 +0100)]
free domain's vcpu array

This was overlooked in fb442e2171 ("x86_64: allow more vCPU-s per
guest").

This is CVE-2015-7969 / XSA-149.

Reported-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Ian Campbell <ian.campbell@citrix.com>
9 years agox86: guard against undue super page PTE creation
Jan Beulich [Thu, 29 Oct 2015 12:35:07 +0000 (13:35 +0100)]
x86: guard against undue super page PTE creation

When optional super page support got added (commit bd1cd81d64 "x86: PV
support for hugepages"), two adjustments were missed: mod_l2_entry()
needs to consider the PSE and RW bits when deciding whether to use the
fast path, and the PSE bit must not be removed from L2_DISALLOW_MASK
unconditionally.

This is CVE-2015-7835 / XSA-148.

Reported-by: "栾尚聪(好风)" <shangcong.lsc@alibaba-inc.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
9 years agoarm: handle races between relinquish_memory and free_domheap_pages
Ian Campbell [Thu, 29 Oct 2015 12:34:17 +0000 (13:34 +0100)]
arm: handle races between relinquish_memory and free_domheap_pages

Primarily this means XENMEM_decrease_reservation from a toolstack
domain.

Unlike x86 we have no requirement right now to queue such pages onto
a separate list, if we hit this race then the other code has already
fully accepted responsibility for freeing this page and therefore
there is no more for relinquish_memory to do.

This is CVE-2015-7814 / XSA-147.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agoarm: rate-limit logging from unimplemented PHYSDEVOP and HVMOP.
Ian Campbell [Thu, 29 Oct 2015 12:33:38 +0000 (13:33 +0100)]
arm: rate-limit logging from unimplemented PHYSDEVOP and HVMOP.

These are guest accessible and should therefore be rate-limited.
Moreover, include them only in debug builds.

This is CVE-2015-7813 / XSA-146.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agoarm: Support hypercall_create_continuation for multicall
Julien Grall [Thu, 29 Oct 2015 12:31:10 +0000 (13:31 +0100)]
arm: Support hypercall_create_continuation for multicall

Multicall for ARM has been supported since commit f0dbdc6 "xen: arm: fully
implement multicall interface.". Although, if an hypercall in multicall
requires preemption, it will crash the host:

(XEN) Xen BUG at domain.c:347
(XEN) ----[ Xen-4.7-unstable  arm64  debug=y  Tainted:    C ]----
[...]
(XEN) Xen call trace:
(XEN)    [<00000000002420cc>] hypercall_create_continuation+0x64/0x380 (PC)
(XEN)    [<0000000000217274>] do_memory_op+0x1b00/0x2334 (LR)
(XEN)    [<0000000000250d2c>] do_multicall_call+0x114/0x124
(XEN)    [<0000000000217ff0>] do_multicall+0x17c/0x23c
(XEN)    [<000000000024f97c>] do_trap_hypercall+0x90/0x12c
(XEN)    [<0000000000251ca8>] do_trap_hypervisor+0xd2c/0x1ba4
(XEN)    [<00000000002582cc>] guest_sync+0x88/0xb8
(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 5:
(XEN) Xen BUG at domain.c:347
(XEN) ****************************************
(XEN)
(XEN) Manual reset required ('noreboot' specified)

Looking to the code, the support of multicall looks valid to me, as we only
need to fill call.args[...]. So drop the BUG();

This is CVE-2015-7812 / XSA-145.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agosched-rt: avoid to shadow the variable "svc" in rt_dom_cntl
Julien Grall [Thu, 29 Oct 2015 11:24:13 +0000 (12:24 +0100)]
sched-rt: avoid to shadow the variable "svc" in rt_dom_cntl

The variable "svc" is declared twice within rt_dom_cntl. However, the
top declaration could be re-used avoiding re-declaring another time the
variable.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
9 years agocredit2: avoid to shadow the variable "cur" in runq_tickle
Julien Grall [Thu, 29 Oct 2015 11:23:53 +0000 (12:23 +0100)]
credit2: avoid to shadow the variable "cur" in runq_tickle

The variable "cur" is declared twice within "cur". However the top
declaration could be re-used avoiding re-declaring another time the
variable.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agocommon/memory: avoid to shadow the variable "d" in do_memory_op
Julien Grall [Thu, 29 Oct 2015 11:23:34 +0000 (12:23 +0100)]
common/memory: avoid to shadow the variable "d" in do_memory_op

The variable "d" is declared multiple times within do_memory_op.

The subsequent declaration are not useful because the top one is never
used. So drop them.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agogrant_table: avoid to shadow "frame" in __gnttab_map_grant_ref
Julien Grall [Thu, 29 Oct 2015 11:20:38 +0000 (12:20 +0100)]
grant_table: avoid to shadow "frame" in __gnttab_map_grant_ref

The variable "frame" is declared twice within the function
__gntab_map_grant_ref.  This makes the code quite confusing to read.

The second definition is not useful as the first one is never used
until then. So drop it.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agocommon/domain: avoid to shadow the variable "d" in do_vcpu_op
Julien Grall [Thu, 29 Oct 2015 11:19:23 +0000 (12:19 +0100)]
common/domain: avoid to shadow the variable "d" in do_vcpu_op

The variable "d" is defined twice. However, the second one is not
necessary as the vCPU as already been deduced from the first "d".

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agotools/python: Further pruning of the defuct xl bindings
Andrew Cooper [Wed, 28 Oct 2015 15:55:43 +0000 (15:55 +0000)]
tools/python: Further pruning of the defuct xl bindings

No need to generate xen/lowlevel/xl/_pyxl_types.{h,c}, following c/s
598e97f "tools/python: remove broken xl binding"

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agox86/mm: don't call HVM-only function for PV guests
Jan Beulich [Tue, 27 Oct 2015 15:34:29 +0000 (16:34 +0100)]
x86/mm: don't call HVM-only function for PV guests

Somehow I managed to drop the HVM dependency from v2 to v3 of what
became commit 5c23c760a8 ("x86/HVM: correct page dirty marking in
hvm_map_guest_frame_rw()"), obviously breaking migration of PV guests.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agomm: improve message in populate physmap when the domain is direct mapped
Julien Grall [Tue, 27 Oct 2015 13:47:33 +0000 (14:47 +0100)]
mm: improve message in populate physmap when the domain is direct mapped

The current domain and the domain pointed by the variable "d" are not
the same.

However, when it's not possible to get a reference on the page, the
target domain ID is not printed. This makes the message difficult to
understand.

Improve the message by printing the target domain ID.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agomm: unmap page for direct mapped domain on decrease reservation
Julien Grall [Tue, 27 Oct 2015 13:47:01 +0000 (14:47 +0100)]
mm: unmap page for direct mapped domain on decrease reservation

Direct mapped domain needs to retrieve the exact same underlying
physical page when the region is re-populated.

Currently, when the memory reservation for this domain is decreased, the
request is just ignored and the page stayed mapped in the P2M. However,
this make more difficult to spot issue when the domain has not yet mapped
foreign page but trying to access the region.

What we really care for direct mapped domain is to not give back the
page to the allocator. So we can re-enable to direct mapped when the guest
memory region is re-populated.

The rest of the process to remove a page can be safely done. This
also ensures us to stay close to the normal domain memory handling.

At the same time, drop the trailing whitespaces around the code
modified.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agox86/PV: don't zero-map LDT
Jan Beulich [Tue, 27 Oct 2015 13:46:12 +0000 (14:46 +0100)]
x86/PV: don't zero-map LDT

This effectvely reverts the LDT related part of commit cf6d39f819
("x86/PV: properly populate descriptor tables"), which broke demand
paged LDT handling in guests.

Reported-by: David Vrabel <david.vrabel@citrix.com>
Diagnosed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/mm: only a single instance of gw_page_flags[] is needed
Jan Beulich [Tue, 27 Oct 2015 10:46:35 +0000 (11:46 +0100)]
x86/mm: only a single instance of gw_page_flags[] is needed

None of its elements depends on GUEST_PAGING_LEVELS.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
9 years agox86/mm: build map_domain_gfn() just once
Jan Beulich [Tue, 27 Oct 2015 10:46:05 +0000 (11:46 +0100)]
x86/mm: build map_domain_gfn() just once

It doesn't depend on GUEST_PAGING_LEVELS. Moving the function to p2m.c
at once allows a bogus #define/#include pair to be removed from
hap/nested_ept.c.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
9 years agox86/mm: override stored file names for multiply built sources
Jan Beulich [Tue, 27 Oct 2015 10:44:52 +0000 (11:44 +0100)]
x86/mm: override stored file names for multiply built sources

To make it possible to tell apart the static symbols therein, use their
object file names instead of their source ones.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
9 years agouse clear_domain_page() instead of open coding it
Jan Beulich [Tue, 27 Oct 2015 10:44:20 +0000 (11:44 +0100)]
use clear_domain_page() instead of open coding it

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
9 years agox86/xsaves: add basic definitions/helpers to support xsaves
Shuai Ruan [Tue, 27 Oct 2015 10:42:57 +0000 (11:42 +0100)]
x86/xsaves: add basic definitions/helpers to support xsaves

This patch add basic definitions/helpers which will be used in
later patches.

Signed-off-by: Shuai Ruan <shuai.ruan@linux.intel.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/HVM: correct page dirty marking in hvm_map_guest_frame_rw()
Jan Beulich [Tue, 27 Oct 2015 10:42:04 +0000 (11:42 +0100)]
x86/HVM: correct page dirty marking in hvm_map_guest_frame_rw()

Rather than dirtying a page when establishing a (permanent) mapping,
dirty it when the page gets unmapped, or - if still mapped - on the
final iteration of a save operation (or in other cases where the guest
is paused or already shut down). (Transient mappings continue to get
dirtied upon getting mapped, to avoid the overhead of tracking.)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agox86: remove assumptions about the layout of x86_capabilities
Andrew Cooper [Mon, 26 Oct 2015 13:02:30 +0000 (14:02 +0100)]
x86: remove assumptions about the layout of x86_capabilities

Future work will rearange it, invalidating these assumptions.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agox86: helpers for cpu feature manipulation
Andrew Cooper [Mon, 26 Oct 2015 13:01:50 +0000 (14:01 +0100)]
x86: helpers for cpu feature manipulation

Expose them to assembly code, and replace open-coded versions.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
9 years agox86/mm: pod: use the correct memory flags for alloc_domheap_page{,s}
Julien Grall [Mon, 26 Oct 2015 12:58:35 +0000 (13:58 +0100)]
x86/mm: pod: use the correct memory flags for alloc_domheap_page{,s}

The last parameter of alloc_domheap_page{s,} contain the memory flags and
not the order of the allocation.

Use 0 for the call in p2m_pod_set_cache_target as it was before
1069d63c5ef2510d08b83b2171af660e5bb18c63 "x86/mm/p2m: use defines for
page sizes". Note that PAGE_ORDER_4K is also equal to 0 so the behavior
stays the same.

For the call in p2m_pod_offline_or_broken_replace we want to allocate
the new page on the same numa node as the previous page. So retrieve the
numa node and pass it in the memory flags.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Tested-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
9 years agoarm: don't build core parking code
Jan Beulich [Mon, 26 Oct 2015 12:56:39 +0000 (13:56 +0100)]
arm: don't build core parking code

It's wired up on x86 only.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agolibxl: Do not call assert() in signal handlers
Ian Jackson [Thu, 22 Oct 2015 15:39:12 +0000 (16:39 +0100)]
libxl: Do not call assert() in signal handlers

assert is not async-signal-safe.

In practice the effect of calling assert there is that if the
assertion fails we might get a secondary crash, or other undesirable
behaviour from stdio (which is how assert usually reports failures).

Mention in a comment in libxl__self_pipe_wakeup that it has to be
async-signal-safe.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agoxen/arm: Replace XEN_PSCI_* by PSCI_VERSION(major, minor)
Julien Grall [Mon, 12 Oct 2015 15:39:12 +0000 (16:39 +0100)]
xen/arm: Replace XEN_PSCI_* by PSCI_VERSION(major, minor)

It will avoid to introduce a new XEN_PSCI_* define every time we support
a new version of PSCI in Xen.

Also fix the coding style in modified place.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agoxen/arm: Add support of PSCI v1.0 for the host
Julien Grall [Mon, 12 Oct 2015 15:39:11 +0000 (16:39 +0100)]
xen/arm: Add support of PSCI v1.0 for the host

From Xen's point of view, PSCI v0.2 and PSCI v1.0 are very similar. All
the PSCI calls used within Xen (PSCI_VERSION, CPU_ON, SYSTEM_OFF and
SYSTEM_RESET) behave exactly the same.

Furthermore, based on the spec (5.3.1 DEN0022C), any 1.y version must be
compatible with 1.x when y > x for any functions existing in 1.x.

So check the presence of the new compatible string [1] and allow Xen to
boot on any platform using PSCI 1.x.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/374547.html

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agoxen/arm: platform: Drop the quirks callback
Julien Grall [Thu, 8 Oct 2015 18:23:54 +0000 (19:23 +0100)]
xen/arm: platform: Drop the quirks callback

All the quirks have been replaced by proper detection. Lets drop the
callback and hope that no one will need new quirks.

At the same time, remove the definition of platform_dom0_evtchn_ppi
which is not used any more.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- typos ]

9 years agoxen/arm: gic-v2: Automatically detect aliased GIC400
Julien Grall [Thu, 8 Oct 2015 18:23:53 +0000 (19:23 +0100)]
xen/arm: gic-v2: Automatically detect aliased GIC400

We are currently using a per-platform quirk to know if the 2 4KB region of
the GIC CPU interface are each aligned to 64KB. Although, it may be
possible to have different layout on a same platform (depending on the
firmware version).

Rather than having a quirk it's possible to detect by reading the GIC
memory. This patch is based from the Linux commit "irqchip/GIC: Add workaround
for aliased GIC400" [1].

Take the opportunity to clean up the GICv2 of code which was only
required because of the quirk.

Note that none of the platform using the gic-hip04 were actually using
the quirk, so the code has been dropped. I will let the maintainers
decide whether it's relevant or not to add proper detection for aliased
GIC for this hardware.

[1] commit 12e14066f4835f5ee1ca795f0309415b54c067a9
    Author: Marc Zyngier <marc.zyngier@arm.com>
    Date:   Sun Sep 13 12:14:31 2015 +0100

    irqchip/GIC: Add workaround for aliased GIC400

    The GICv2 architecture mandates that the two 4kB GIC regions are
    contiguous, and on two separate physical pages (so that access to
    the second page can be trapped by a hypervisor). This doesn't work
    very well when PAGE_SIZE is 64kB.

    A relatively common hack^Wway to work around this is to alias each
    4kB region over its own 64kB page. Of course in this case, the base
    address you want to use is not really the begining of the region,
    but base + 60kB (so that you get a contiguous 8kB region over two
    distinct pages).

    Normally, this would be described in DT with a new property, but
    some HW is already out there, and the firmware makes sure that
    it will override whatever you put in the GIC node. Duh. And of course,
    said firmware source code is not available, despite being based
    on u-boot.

    The workaround is to detect the case where the CPU interface size
    is set to 128kB, and verify the aliasing by checking that the ID
    register for GIC400 (which is the only GIC wired this way so far)
    is the same at base and base + 0xF000. In this case, we update
    the GIC base address and let it roll.

    And if you feel slightly sick by looking at this, rest assured that
    I do too...

Reported-by: Julien Grall <julien.grall@citrix.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Stuart Yoder <stuart.yoder@freescale.com>
Cc: Pavel Fedin <p.fedin@samsung.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Link: http://lkml.kernel.org/r/1442142873-20213-2-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agoxen/arm: gic: Check the size of the CPU and vCPU interface retrieved from DT
Julien Grall [Thu, 8 Oct 2015 18:23:52 +0000 (19:23 +0100)]
xen/arm: gic: Check the size of the CPU and vCPU interface retrieved from DT

The size of the CPU interface will be used in a follow-up patch to map the
region in Xen memory.

Based on GICv2 spec, the CPU interface should at least be 8KB, although
most of the platform we are supporting use incorrectly the GICv1 size
(i.e 4KB) in their DT. Only warn and update the size to avoid any
breakage on these platforms.

Furthermore, Xen is relying on the fact that the Virtual CPU interface
is at least 8KB. As in reality the Virtual CPU interface matches the CPU
interface, check that the 2 interfaces have the same size.

For GICv3, vGICv2 is only available for guest. So we only need to check
that the GICV is at least 8KB.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- typos ]

9 years agoxen/arm: vgic-v2: Report the correct GICC size to the guest
Julien Grall [Thu, 8 Oct 2015 18:23:51 +0000 (19:23 +0100)]
xen/arm: vgic-v2: Report the correct GICC size to the guest

The GICv2 DT node is usually used by the guest to know the address/size
of the regions (GICD, GICC...) to map into their virtual memory.

While the GICv2 spec requires the size of the GICC to be 8KB, we
correctly do an 8KB stage-2 mapping but erroneously report 256 in the
device tree (based on GUEST_GICC_SIZE).

I bet we didn't see any issue so far because all the registers except
GICC_DIR lives in the first 256 bytes of the GICC region and all the
guests I have seen so far are driving the GIC with GICC_CTLR.EIOmode =
0.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- fixed some typos in commit message ]

9 years agotools/python: remove broken xl binding
Wei Liu [Tue, 6 Oct 2015 16:57:26 +0000 (17:57 +0100)]
tools/python: remove broken xl binding

Various people say this binding doesn't compile or doesn't work. Remove
it for the benefit of xl feature development -- so that new features
won't need to worry about making this broken binding happy.

This isn't going to expose any user visible changes because that module
is not built by default.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agoxen/device-tree: Print the DT path on error in dt_for_each_range
Julien Grall [Mon, 19 Oct 2015 12:58:00 +0000 (13:58 +0100)]
xen/device-tree: Print the DT path on error in dt_for_each_range

With the current log is not possible for the user to understand
properly the error:

(XEN) Grant table range: 0x0000007fc00000-0x0000007fc72000
(XEN) DT: no ranges; cannot enumerate
(XEN) Device tree generation failed (-22).
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Could not set up DOM0 guest OS
(XEN) ****************************************
(XEN)

The other error message within the function already print the DT path.
Do the same here.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
9 years agolibxc: remove superpages option for pv domains
Juergen Gross [Thu, 8 Oct 2015 15:23:47 +0000 (17:23 +0200)]
libxc: remove superpages option for pv domains

The pv domain builder currently supports the additional flag
"superpages" to build a pv domain with 2MB pages. This feature isn't
being used by any component other than the python xc bindings.

Remove the flag and its support from the xc bindings and the domain
builder

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
9 years agotools & docs: add tools and docs support for Intel CDP
He Chen [Mon, 19 Oct 2015 07:31:55 +0000 (15:31 +0800)]
tools & docs: add tools and docs support for Intel CDP

This is the xl/xc changes to support Intel Code/Data Prioritization.
CAT xl commands to set/get CBMs are extended to support CDP.
Add new CDP options with CAT commands in xl interface man page.
Add description of CDP in xl-psr.markdown.

Signed-off-by: He Chen <he.chen@linux.intel.com>
Reviewed-by: Chao Peng <chao.p.peng@linux.intel.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
9 years agoConfig.mk: update OVMF changeset
Wei Liu [Wed, 14 Oct 2015 11:41:13 +0000 (12:41 +0100)]
Config.mk: update OVMF changeset

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agolibxl: No emulated disk driver for xvdX disk
Anthony PERARD [Wed, 14 Oct 2015 11:05:17 +0000 (12:05 +0100)]
libxl: No emulated disk driver for xvdX disk

When a guest configuration list xvdX for its disks, there is no need to
provide an emulated driver for the same target.

Such configuration can work with the OVMF firmware, as it supports PV
disk.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agotools: libxl: CODING_STYLE: GC* cannot be used with NOGC
Ian Campbell [Fri, 16 Oct 2015 10:33:12 +0000 (11:33 +0100)]
tools: libxl: CODING_STYLE: GC* cannot be used with NOGC

GC* assume an existing gc in scope, which means they can't be passed
NOGC. Instead recommend the use of the underlying functions with NOGC,
noting that this is excepitonal.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
[ ijc -- refer to libxl__calloc not (nonexistent) libxl__alloc ]

9 years agotools: Update libxl flex outputs to Flex from Jessie.
Ian Campbell [Wed, 15 Jul 2015 10:21:17 +0000 (11:21 +0100)]
tools: Update libxl flex outputs to Flex from Jessie.

This is the result of
  $ find -name \*.l -exec touch {} \;
  $ find -name \*.y -exec touch {} \;

and then rebuilding.

This avoids churn on the machine I use for committing which has been
updated, causing flex to go from 2.5.35-10.1 to 2.5.39-8.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agoConfig: Switch to unified qemu trees.
Ian Campbell [Thu, 10 Sep 2015 13:31:34 +0000 (14:31 +0100)]
Config: Switch to unified qemu trees.

Upstream qemu is now in qemu-xen.git and the trad fork is in
qemu-xen-traditional.git.

QEMU_UPSTREAM_REVISION is currently a tag and
QEMU_TRADITIONAL_REVISION is a specific revision, so no changes are
required to those.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
9 years agox86/shadow: drop stray name tags from sh_{guest_get,map}_eff_l1e()
Jan Beulich [Wed, 21 Oct 2015 08:56:31 +0000 (10:56 +0200)]
x86/shadow: drop stray name tags from sh_{guest_get,map}_eff_l1e()

They (as a now being removed comment validly says) depend only on Xen's
number of page table levels, and hence their tags didn't serve any
useful purpose (there could only ever be one instance in a single
binary, even back in the x86-32 days).

Further conditionalize the inclusion of PV-specific hook pointers, at
once making sure that PV guests can't ever get other than 4-level mode
enabled for them.

For consistency reasons shadow_{write,cmpxchg}_guest_entry() also get
moved next to the other PV-only actors, allowing them to become static
just like the $subject ones do.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
9 years agox86/shadow: adjust sh_{make,destroy}_monitor_table() name tags
Jan Beulich [Wed, 21 Oct 2015 08:55:54 +0000 (10:55 +0200)]
x86/shadow: adjust sh_{make,destroy}_monitor_table() name tags

Instead of the misleading _guest_<level> ones use _sh_<level>,
expressing their sole dependency on the number of shadow levels.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
9 years agox86/shadow: only a single instance of fetch_type_names[] is needed
Jan Beulich [Wed, 21 Oct 2015 08:55:17 +0000 (10:55 +0200)]
x86/shadow: only a single instance of fetch_type_names[] is needed

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
9 years agox86/HVM: prefix both instances of enable_intr_window()
Jan Beulich [Wed, 21 Oct 2015 08:53:35 +0000 (10:53 +0200)]
x86/HVM: prefix both instances of enable_intr_window()

... to tell them apart by their names even without further context.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Aravind Gopalakrishnan<Aravind.Gopalakrishnan@amd.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
9 years agox86: don't build platform hypercall helpers multiple times
Jan Beulich [Wed, 21 Oct 2015 08:52:28 +0000 (10:52 +0200)]
x86: don't build platform hypercall helpers multiple times

... to eliminate the resulting duplicate symbols. This includes
dropping an odd per-CPU variable left from 32-bit days: Now that we
only care about 64-bit builds, converting the uint64_t needing
passing to a void pointer is no problem anymore.

Since the COMPAT handling section needs to be re-organized for this
anyway, also adjust a few other shortcomings (like declarations not
being visible at the point of the respective definition, risking both
to get out of sync).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/vmx: fix coding style of PML functions
Kai Huang [Wed, 21 Oct 2015 08:49:54 +0000 (10:49 +0200)]
x86/vmx: fix coding style of PML functions

According to Jan's comments, also fix the coding style of for_each_vcpu in
existing PML functions.

Signed-off-by: Kai Huang <kai.huang@linux.intel.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
9 years agox86/ept: defer enabling of EPT A/D bit until PML get enabled
Kai Huang [Wed, 21 Oct 2015 08:49:16 +0000 (10:49 +0200)]
x86/ept: defer enabling of EPT A/D bit until PML get enabled

Existing PML implementation turns on EPT A/D bit unconditionally if PML is
supported by hardware. This works but enabling of EPT A/D bit can be deferred
until PML get enabled. There's no point in enabling the extra feature for every
domain when we're not meaning to use it (yet).

Also added ASSERT of domain having been paused to ept_flush_pml_buffers to make
it consistent with ept_enable{disable}_pml.

Sanity live migration and GUI display were tested on Broadwell Machine.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Kai Huang <kai.huang@linux.intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
9 years agoVMX: re-order definitions
Jan Beulich [Wed, 21 Oct 2015 08:47:54 +0000 (10:47 +0200)]
VMX: re-order definitions

... so they end up reasonably sorted, easing lookup.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
9 years agoQEMU_TAG update
Ian Jackson [Tue, 20 Oct 2015 14:46:26 +0000 (15:46 +0100)]
QEMU_TAG update

9 years agox86/Centaur: drop __init annotations
Jan Beulich [Fri, 16 Oct 2015 15:49:51 +0000 (17:49 +0200)]
x86/Centaur: drop __init annotations

Commit 6f8f53cc64 ("x86 cpu: Fix bug: unify cpu_dev attr as
__cpuinitdata") fixed centaur_cpu_dev's annotation without also fixing
the pointers hanging off of it. Even if CPU hotplig support may be
purely theoretical for Centaur, we should still not leave this as is.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/capabilities: set/clear them using non-locked bitops
Jan Beulich [Fri, 16 Oct 2015 15:47:45 +0000 (17:47 +0200)]
x86/capabilities: set/clear them using non-locked bitops

Their initialization happens without races, so there's no point in
using atomic (locked) operations to update the respective flags.
(There's one case where the clear_bit() was completely pointless.)

Also drop a neighboring stale comment from AMD code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86: drop further constant cpu_has_* predicates
Jan Beulich [Fri, 16 Oct 2015 15:46:47 +0000 (17:46 +0200)]
x86: drop further constant cpu_has_* predicates

EFER and SYSCALL are required on x86-64, and I think there's no point
in assuming there might be no TSC. A few other predicates are simply
unused. Of the ones left but constant I'm not convinced we should drop
them; for some of them we may actually better make them non-constant
(see also next patch in this series).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86: remove unused x87 remnants of 32-bit days
Jan Beulich [Fri, 16 Oct 2015 15:44:35 +0000 (17:44 +0200)]
x86: remove unused x87 remnants of 32-bit days

x86-64 requires FXSR, XMM, and XMM2, so there's no point in hiding
respective code behind conditionals.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/PSR: fix compilation error after 44f126d
He Chen [Fri, 16 Oct 2015 15:43:19 +0000 (17:43 +0200)]
x86/PSR: fix compilation error after 44f126d

In non-debug build ASSERT_UNREACHABLE is nop and some compilers will
complain that cbm_code/cbm_data may be used uninitialized in function
psr_set_l3_cbm. Add return after ASSERT_UNREACHABLE to fix it.

Signed-off-by: He Chen <he.chen@linux.intel.com>
9 years agolibxc: fix the types used in xc_dom_image to build HVM guests
Roger Pau Monne [Thu, 15 Oct 2015 17:23:57 +0000 (19:23 +0200)]
libxc: fix the types used in xc_dom_image to build HVM guests

Fix the types used to store the memory parameters of an HVM guest,
previously they defaulted to unsigned long on 32bit toolstack builds, which
is wrong because a 32bit value cannot hold a 64bit memory address that
crosses the 4GB boundary.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agolibxc: Initialize vcpu context for 64-bit PVH VCPUs
Boris Ostrovsky [Thu, 15 Oct 2015 14:44:26 +0000 (10:44 -0400)]
libxc: Initialize vcpu context for 64-bit PVH VCPUs

Commit 5b921b49f08 ("libxc: rework BSP initialization") forgot to call
xc_vcpu_setcontext() for 64-bit PVH VCPUs.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
9 years agox86/traps: don't use 16bit reads of segment registers
Andrew Cooper [Wed, 14 Oct 2015 10:48:36 +0000 (12:48 +0200)]
x86/traps: don't use 16bit reads of segment registers

When executing `mov %sreg, %r32`, older Intel processors would leave the
upper 16 bits of %r32 undefined.  P4 processors and newer, as well as
all AMD processors will zero extend the segment selector.

As Xen only supports 64bit these days, there is no need to use the
operand-size override prefix and suffer the resulting pipeline overhead.

Rename read_segment_register() to read_sreg() and drop the existing
read_sreg() wrapper which took a regs parameter and did nothing with it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoMerge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging
Jan Beulich [Wed, 14 Oct 2015 10:48:22 +0000 (12:48 +0200)]
Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging

9 years agox86/boot: use mnemonics rather than magic numbers
Andrew Cooper [Wed, 14 Oct 2015 10:48:00 +0000 (12:48 +0200)]
x86/boot: use mnemonics rather than magic numbers

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/NUMA: cleanup
Jan Beulich [Wed, 14 Oct 2015 10:47:08 +0000 (12:47 +0200)]
x86/NUMA: cleanup

- constification
- prefer container_of() over casts
- check original pointer against NULL instead of the container_of()
  result

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/NUMA: fix SRAT table processor entry parsing and consumption
Jan Beulich [Wed, 14 Oct 2015 10:46:27 +0000 (12:46 +0200)]
x86/NUMA: fix SRAT table processor entry parsing and consumption

- don't overrun apicid_to_node[] (possible in the x2APIC case)
- don't limit number of processor related SRAT entries we can consume
- make acpi_numa_{processor,x2apic}_affinity_init() as similar to one
  another as possible
- print APIC IDs in hex (to ease matching with other log messages), at
  once making legacy and x2APIC ones distinguishable (by width)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86: add domctl cmd to set/get CDP code/data CBM
He Chen [Wed, 14 Oct 2015 10:45:34 +0000 (12:45 +0200)]
x86: add domctl cmd to set/get CDP code/data CBM

CDP extends CAT and provides the capacity to control L3 code & data
cache. With CDP, one COS corresponds to two CMBs(code & data). cbm_type
is added to distinguish different CBM operations. Besides, new domctl
cmds are introdunced to support set/get CDP CBM. Some CAT functions to
operation CBMs are extended to support CDP.

Signed-off-by: He Chen <he.chen@linux.intel.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Chao Peng <chao.p.peng@linux.intel.com>
9 years agox86: support enable CDP by boot parameter and add get CDP status
He Chen [Wed, 14 Oct 2015 10:44:40 +0000 (12:44 +0200)]
x86: support enable CDP by boot parameter and add get CDP status

Add boot parameter `psr=cdp` to enable CDP at boot time.
Intel Code/Data Prioritization (CDP) feature is based on CAT. Note that
cos_max would be half when CDP is on. struct psr_cat_cbm is extended to
support CDP operation. Extend psr_get_cat_l3_info sysctl to get CDP
status.

Signed-off-by: He Chen <he.chen@linux.intel.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Chao Peng <chao.p.peng@linux.intel.com>
9 years agoxen/arm: ctxt_switch: Document the erratum #852523 related to Cortex A57
Julien Grall [Thu, 8 Oct 2015 19:22:37 +0000 (20:22 +0100)]
xen/arm: ctxt_switch: Document the erratum #852523 related to Cortex A57

When restoring the system register state for an AArch32 guest at EL2,
writes to DACR32_EL2 may not be correctly synchronised by Cortex-A57,
which can lead to the guest effectively running into unexpected domain
faults.

Thankfully, we don't hit this erratum in Xen. Nonetheless, document the
code to prevent any introduction of the erratum if the context switch
code is re-ordered.

Link: http://lists.xen.org/archives/html/xen-devel/2015-09/msg01746.html
Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- comment nits ]

9 years agocxenstored: avoid using hardcoded paths
Wei Liu [Tue, 13 Oct 2015 13:40:28 +0000 (14:40 +0100)]
cxenstored: avoid using hardcoded paths

Use library functions which return socket paths instead.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agoxen/arm: domain_build: Removed unused variable in write_properties
Julien Grall [Wed, 14 Oct 2015 09:34:32 +0000 (10:34 +0100)]
xen/arm: domain_build: Removed unused variable in write_properties

The variable new_data is initialized to NULL and free but never
allocated neither used.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agolibxc: create an initial FPU state for HVM guests
Roger Pau Monne [Tue, 13 Oct 2015 16:27:20 +0000 (18:27 +0200)]
libxc: create an initial FPU state for HVM guests

Xen always set the FPU as initialized when loading a HVM context, so libxc
has to provide a valid FPU context when setting the CPU registers.

This is a stop-gap measure in order to unblock OSSTest Windows 7 failures
while a proper fix for the HVM CPU save/restore is being worked on.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Suggested-by: Jan Beulich <jbeulich@suse.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
9 years agox86: drop unused declarations from processor.h
Andrew Cooper [Tue, 13 Oct 2015 15:19:07 +0000 (17:19 +0200)]
x86: drop unused declarations from processor.h

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86/time: slightly streamline __update_vcpu_system_time()
Jan Beulich [Tue, 13 Oct 2015 15:18:34 +0000 (17:18 +0200)]
x86/time: slightly streamline __update_vcpu_system_time()

Fold two if()-s using the same condition, converting the memset() so
far separating them to a simple initializer. Move common assignments
out of the conditional. Drop an unnecessary initializer.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agox86: hide MWAITX from PV domains
Jan Beulich [Tue, 13 Oct 2015 15:17:52 +0000 (17:17 +0200)]
x86: hide MWAITX from PV domains

Since MWAIT is hidden too. (Linux starting with 4.3 is making use of
that feature, and is checking for it without looking at the MWAIT one.)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
9 years agoVT-d: section placement and type adjustments
Jan Beulich [Tue, 13 Oct 2015 15:17:16 +0000 (17:17 +0200)]
VT-d: section placement and type adjustments

With x2APIC requiring iommu_supports_eim() to return true, we can
adjust a few conditonals such that both it and
platform_supports_x2apic() can be marked __init. For the latter as
well as for platform_supports_intremap() also change the return types
to bool_t.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Yang Zhang <yang.z.zhang@intel.com>
9 years agoVT-d: use proper error codes in iommu_enable_x2apic_IR()
Jan Beulich [Tue, 13 Oct 2015 15:16:22 +0000 (17:16 +0200)]
VT-d: use proper error codes in iommu_enable_x2apic_IR()

... allowing to suppress a confusing message combination: When
ACPI_DMAR_X2APIC_OPT_OUT is set, so far we first logged a message
that IR could not be enabled (hence not using x2APIC), followed by
one indicating successful initialization of IR (if no other problems
prevented that).

Also adjust the return type of iommu_supports_eim() and fix some
broken indentation in the function.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Yang Zhang <yang.z.zhang@intel.com>
9 years agocpufreq: fix notifier block double registration
Dario Faggioli [Mon, 12 Oct 2015 15:22:02 +0000 (17:22 +0200)]
cpufreq: fix notifier block double registration

As a consequence of commit 49388f11d512bb92706ce
("x86/cpufreq: relocate the driver register function")
the cpufreq CPU notifier was being registered twice.
That resulted in bugs when trying to offline a
CPU, as reported here:

 https://www.mail-archive.com/xen-devel@lists.xen.org/msg41618.html

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
9 years agobuild: don't shadow debug with "@debug@" in tools build
Wei Liu [Mon, 12 Oct 2015 14:02:53 +0000 (16:02 +0200)]
build: don't shadow debug with "@debug@" in tools build

In 16181cbb (tools: Honor Config.mk debug value, rather than setting our
own), configure doesn't set debug variable anymore. There is, however,
one place that was missed. The file config/Tools.mk.in was still
expecting a @debug@ value from configure. After 16181cbb that value
remained "debug := @debug@" all the time because configure didn't
substitute it.

The consequence was that we couldn't get a debug build even if debug was
set to "y" in Config.mk.

Fix this by removing the stray line "debug := @debug@" in Tools.mk.in.

Reported-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Tested-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Acked-by: George Dunlap <george.dunlap@citrix.com>