Commit Graph
18537 Commits
Author SHA1 Message Date
Keir Fraser 3129d6f2ea xsm, flask: sample flask policy
- The patch includes a policy for xen that can be booted into
  enforcing mode and supports creation and management of
  paravirtualized guests.  The policy follows the dom0/domU usage
  model, extension to other models or the addition of management or IO
  permissions should be much more straightforward now. The option
  flask_enforcing=1 can be passed on the xen line in grub to boot
  into enforcing mode.

- The policy provides a basic policy for booting the platform and
  creating a domU with the label system_u:object_r:domU_t.  The policy
  can be easily extended to support new types by modifying the xen.te
  source file.

- The policy includes some basic macros which may be helpful in
  extending the policy.

- The policy is compatible with and requires the most recent XSM
  patch, xsm-flask-io-sysctl-hooks-090308.diff.

- The policy is not built as part of the make all as it requires the
  SELinux policy compiler which may/may not be installed on all
  systems.  Users must go into the tools/flask/policy directory and
  explicitly compile the policy.

Signed-off-by: George Coker <gscoker@alpha.ncsc.mil>
2008-09-04 11:26:25 +01:00
Keir Fraser aff2988ad5 xsm: refactor IO hooks/sysctl hooks
- The patch refactors the IO resource checks into the rangeset add/del
  code. This produces a much more architecture friendly implementation and
  ensures that HVM and paravirtualized guests are checked consistently.

- The patch removes the following hooks in support of the refactoring
  of the IO resource checks:
    - xsm_irq_permission
    - xsm_iomem_permission
    - xsm_ioport_permission

- The patch adds the following hooks in support of the refactoring of
  the IO resource checks:
    - xsm_add_range
    - xsm_remove_range

- These IO refactoring changes are transparent to any pre-existing
  Flask policies.

- The patch adds also adds hooks for sysctl functionality that was
  added since the last major XSM patch.  The following hooks were added:
    - xsm_set_target
    - xsm_debug_keys
    - xsm_getcpuinfo
    - xsm_availheap
    - xsm_firmware_info
    - xsm_acpi_sleep
    - xsm_change_freq
    - xsm_getidletime
    - xsm_sendtrigger
    - xsm_test_assign_device
    - xsm_assign_device
    - xsm_deassign_device
    - xsm_bind_pt_irq
    - xsm_pin_mem_cacheattr
    - xsm_ext_vcpucontext

Signed-off-by: George Coker <gscoker@alpha.ncsc.mil>
2008-09-04 11:25:09 +01:00
Keir Fraser 06cfe5df7b xsm, python tools: remove autogenerated xsm.py
- The patch does away with the autogenerated xsm.py file and
introduces a config parameter in xend-config.sxp to determine the
security module. The parameter is (xsm_module_name {acm, dummy,
flask}).  The default setting/option is dummy.  .hgignore is also
updated to stop ignoring xsm.py on commits.

- The patch has created an xsconstant for XS_POLICY_FLASK and updated
  the toolchain to check the instance of XS_POLICY_USE.  XS_POLICY_USE
  evalauates to XS_POLICY_FLASK or XS_POLICY_ACM or XS_POLICY_DUMMY
  depending on configuration.

- Flask relies on the current value of ssidref returned by dominfo to
  ensure that the label to sid mapping is consistent.  ssidref had
  been pop'ed from the dominfo object.  The patch addresses this
  issue.

- Flask python module style cleanups.

Signed-off-by: George Coker <gscoker@alpha.ncsc.mil>
2008-09-04 11:23:08 +01:00
Keir Fraser e4e909d6e2 CPUIDLE: Write to ARB_DISABLE conditionally to reduce some idle overheads.
By protecting entry/exit with a spinlock we can safely determine
precisely when it is required that we assert/deassert ARB_DISABLE.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-04 11:19:17 +01:00
Keir Fraser 88c6403475 x86: Fix interpretation of get_l*e_linear_pagetable().
Broken by get_page_type() preemption patch (c/s 18412).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-03 14:56:08 +01:00
Keir Fraser ad2a1f8b66 x86: Fix guest_handle_okay/guest_handle_subrange_okay
The guest handle checks should use paging_* predicates, not shadow_*.
Also tidy up a few places where p2m definitions were being imported
via asm/guest_access.h -> asm/shadow.h -> asm/p2m.h

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2008-09-03 14:16:35 +01:00
Keir Fraser d2733e1598 Remove guest_physmap_max_mem_pages(), which is no longer usefully
defined in any architecture.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2008-09-03 14:14:18 +01:00
Keir Fraser e28712c338 ACPI: Remove a redundant call to acpi_hw_register_read().
Signed-off-by: Wei Gang <gang.wei@intel.com>
2008-09-03 12:45:59 +01:00
Keir Fraser 04250df046 Fix for VCPU periodic timer.
Idle vcpu periodic timer is useless. It increased the lapic timer
interrupt number, which decreased the cpu idle residency. This patch
disables idle vcpu periodic timer via keeping v->periodic_period = 0.

The vcpu periodic timer may be expired 50us before expected time
because there is a 50us TIMER_SLOP used for soft timer (xen/common/timer.c,
timer_softirq_action()). This will cause vcpu_periodic_timer_work() be
continuously called tens of times in a single call of
timer_softirq_action() until (now > periodic_next_event). It brings
unnecessary overhead. This patch adds a similar time slop in vcpu
periodic timer to eliminate this overhead.

Signed-off-by: Wei Gang <gang.wei@intel.com>
2008-09-03 11:02:57 +01:00
Keir Fraser 87fd15ceee xend: move the call to XendDevices.destroy_device_state()
This patch moves the call to XendDevices.destroy_device_state() to the
function _remove_domain. Previously only Xen-API calls were calling
the destroy_device_state() function.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2008-09-03 10:38:33 +01:00
Keir Fraser c93d35a368 xend: Fix Bug 1336
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-09-02 12:06:56 +01:00
Keir Fraser ab2d69651e x86: allow Dom0 to control a few more MSR bits
Linux 2.6.27 adds code to enable extended config space accesses in the
Northbridge Configuration MSR; Xen should allow Dom0 to control the
respective bit.

Likewise, 2.6.26 added support to enable the MMIO config space access
method for certain Sun systems, so similarly Xen should allow Dom0 to
control the respective fields of the MMIO Configuration Base Address
Register.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2008-09-01 11:29:01 +01:00
Keir Fraser 76596d0d07 x86: make {get,put}_page_type() preemptible
This is only a first step - more call sites need to be hooked up.

Most of this is really Keir's work, I just took what he handed me and
fixed a few remaining issues.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-09-01 10:52:05 +01:00
Keir Fraser 3e5c069367 [IA64] use ioemu-remote as default on ia64.
Now ioemu-remote compiles for ia64 so that make it default.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2008-09-01 10:49:00 +01:00
Keir Fraser a06cb3d8d8 ioemu: fix multiple pci-attach/pci-detach by removing the meaningless irq_index
For HVM guest, we can't do pci-attach/pci-detach for >64 times due to
the meaningless checking in pci_register_device(). I made a test of
300 times of attach/detach and everything now works well.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2008-09-01 10:48:09 +01:00
Isaku Yamahata dd60c6ffea merge with xen-unstable.hg 2008-09-01 16:59:43 +09:00
Keir Fraser f1a381df9c cross-install: Only apply in tools directory, and automatically wrap $INSTALL.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-30 08:36:02 +01:00
Keir Fraser c1c6c2ac90 stubdom: Absolute path for XEN_ROOT.
It may be used in subdirectories indirectly (e.g., as path component
of $(INSTALL)).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-30 08:11:09 +01:00
Keir Fraser 47bdb3b05f vtd: fix Dom0 S3 when VT-d is enabled.
Now if VT-d is enabled, when Dom0 does S3, Xen doesn't suspend/resume
the IOMMU states.

The patch adds the missing invocations of
iommu_suspend()/iommu_resume() and makes some nesessary fixes:
1) In iommu_set_root_entry(), we should not re-allocate the root-entry
when Xen returns from S3;
2) Define the array iommu_state correctly (u8 -> u32);
3) Only save/restore the necessary IOMMU registers.

The patch was tested on Weybridge.

NOTE: if we have some HVM guests which have assigned devices, and we
want to do Dom S3, we MUST do HVM S3 for each HVM guest first.
Namely, the steps are:
1) Use HVM S3 in guest to suspend the guest (for example, in Linux HVM
guest, this is "echo mem > /sys/power/state");
2) Use Dom0 S3 to suspend Dom0: "echo mem > /sys/power/state";
3) At some point, Dom0 resumes from S3 (for example, by pressing the
power button or using the acpi alarm);
4) Use "xm trigger HVM_DOM_ID s3resume" to resume every HVM guest
which were suspended previously.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2008-08-29 16:16:33 +01:00
Keir Fraser 8565e53aba x86: constify microcode hypercall argument
Linux 2.6.27 marks the data pointer in its firmware struct 'const',
and hence, to avoid a compiler warning, Xen's microcode update
interface should be properly properly constified too.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2008-08-29 16:11:05 +01:00
Keir Fraser 65c1f4b9ec docs: A small update in the vtpm documentation file.
Signed-off-by: Stefan Berger <stefanB@us.ibm.com>
2008-08-29 16:08:09 +01:00
Keir Fraser d6c3ce8cb9 Update the URL for the ACPI compiler sources.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2008-08-29 16:07:36 +01:00
Keir Fraser 309459216a Run cross-compilation-aware install wrapper script.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-29 16:06:41 +01:00
Keir Fraser 2c9b12c9e4 amd: Extended migration support
This patch adds support for AMD's extended migration, aka CPUID
features and extended features masking.

Signed-off-by: Travis Betak <travis.betak@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-29 11:13:41 +01:00
Keir Fraser fb7998a2e2 docs: Fix datamodel-graph of XenAPI
"VTPM" is forgotten.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-08-29 10:46:46 +01:00
Keir Fraser ec6869dadc pv-grub: fix example file
Apparently 64MB is too short for the domain builder.
No kernel option should be passed, as they are provided by menu.lst,
and would only confuse grub.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-29 10:45:09 +01:00
Keir Fraser 1d534660ad x86: time_calibration_rendezvous must be invoked with @wait=1.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-28 13:31:49 +01:00
Keir Fraser e388539d78 stubdom: fix munmap's update_va_mapping flag passing, thus fixing
INVLPG passing

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-28 13:09:02 +01:00
Keir Fraser c07e22cf60 softirq: Add sanity assertion about NR_SOFTIRQS.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-28 11:38:57 +01:00
Keir Fraser 26141b3e26 x86: There are now two x86-specific softirqs.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-28 11:38:02 +01:00
Keir Fraser 389f440998 Update Xen version for 3.4-unstable development phase 2008-08-28 11:31:16 +01:00
Keir Fraser 1ceec08ea2 hvmloader: skip upper field of 64 bit base address register.
Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
2008-08-28 09:59:49 +01:00
Keir Fraser bf1bb3fa7e ioemu, passthru: make upper field of 64 bit bar writable.
Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
2008-08-28 09:58:01 +01:00
Keir Fraser f78e4ead53 stubdom: add LANG=C for 'gcc -print-search-dirs'
Prevents unwanted localisation of pretty-printing.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
2008-08-28 09:55:40 +01:00
Keir Fraser 85a8576217 docs: Update user manual for 3.3.
From: Stephen Spector <stephen.spector@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-28 09:49:52 +01:00
Keir Fraser 309af15419 xend: Cleanup destroy and destroyDomain methods
When domains are destroyed, _prepare_phantom_paths() method
and _cleanup_phantom_devs() method are called twice as follows.

destroy()@XendDomainInfo.py
    _prepare_phantom_paths() --------------- 1
    _cleanupVm()
    destroyDomain()
        _prepare_phantom_paths() ----------- 2
        xc.domain_destroy_hook()
        xc.domain_pause()
        do_FLR()
        xc.domain_destroy()
        XendDomain.remove_domain()
        cleanupDomain()
        _cleanup_phantom_devs() ------------ 1
    _cleanup_phantom_devs() ---------------- 2
    XendDomain.domain_delete_by_dominfo()

This is a cleanup patch.  It combines destroyDomain() method
into destroy() method, then _prepare_phantom_paths() method and
_cleanup_phantom_devs() method are called only once.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2008-08-28 09:44:13 +01:00
Keir Fraser 2e8459a4fc stubdom: make xc_map_foreign_ranges use malloc instead of stack space
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-28 09:40:10 +01:00
Keir Fraser 8a68b82ff1 libxc: Use vcpu_guest_context_any_t instead of two pages
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 16:23:10 +01:00
Keir Fraser f844c8910a hvmloader: Fix e820_malloc() after bug I introduced in c/s 18383
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 15:16:13 +01:00
Keir Fraser 86e881097c tools/xenmon/Makefile: Move LDFLAGS after $<
gcc expects libraries needed for object files to be specified after
the object. Linking usually does not fail, unless it is optimized (for
instance, using -Wl,-as-needed).

The related Gentoo bug is 135145 [ https://bugs.gentoo.org/135145 ].

From: Robert Buchholz <rbu@gentoo.org>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 15:02:38 +01:00
Keir Fraser 7e0fe5d8f4 stubdom: add v?errx? and v?warnx? functions
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 14:57:51 +01:00
Keir Fraser 86cf63d6f4 ioemu: Add SEEK_STAT in all non-error cases except sleep request,
since our seek times are virtually 0.  Although this flag is
deprecated by newer ATA standards, Linux at least checks it for CD
drives, and would timeout in some cases if we do not set it.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 14:57:23 +01:00
Keir Fraser d818f3cb7c hvm: Use main memory for video memory.
When creating an HVM domain, if e.g. another domain is created before
qemu allocates video memory, the extra 8MB memory ballooning is not
available any more, because it got consumed by the other domain.

This fixes it by taking video memory from the main memory:

- make hvmloader use e820_malloc to reserve some of the main memory
  and notify ioemu of its address through the Xen platform PCI card.
- add XENMAPSPACE_mfn to the xen_add_to_physmap memory op, to allow
  ioemu to move the MFNs between the original position and the PCI
  mapping, when LFB acceleration is disabled/enabled
- add a remove_from_physmap memory op, to allow ioemu to unmap it
  completely for the case of old guests with acceleration disabled.
- add xc_domain_memory_translate_gpfn_list to libxc to allow ioemu to
  get the MFNs of the video memory.
- have xend save the PCI memory space instead of ioemu: if a memory
  page is there, the guest can access it like usual memory, so xend
  can safely be responsible to save it.  The extra benefit is that
  live migration will apply the logdirty optimization there too.
- handle old saved images, populating the video memory from ioemu if
  really needed.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 14:53:39 +01:00
Keir Fraser 1583e7e448 mini-os: Fix build failure with void* arithmetic.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 13:31:01 +01:00
Keir Fraser dafd59dde6 Fall back to a timer linked list when the timer heap overflows.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 13:24:35 +01:00
Keir Fraser d1ef21b1cc Use 'gcc -v 2>&1 | tail -1' to extract gcc version.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 11:47:02 +01:00
Keir Fraser 6fc80aed0d xmalloc: Cannot be called in IRQ context so doesn't need IRQ-safe locking.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 10:26:50 +01:00
Keir Fraser b35a75abcd x86: Signal softirq-context calibration with an actual first-class
softirq handle rather than kludging it with set_timer().

Should be faster and is definitely clearer. Also avoids us using
set_timer() in IRQ context (which is currently broken but soon won't
be).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 10:12:49 +01:00
Keir Fraser bb2f3a7002 x86: Assert in_irq() while processing guest-bound interrupts.
Actually a fair amount of infrastructure is onvolved these days, and
we'd like subsystems we call into know that we're in IRQ context so
they can handle that or BUG/ASSERT if appropriate.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 10:11:33 +01:00
Keir Fraser b1813844dc More precise regexp to extract version line from 'gcc -v'.
Reported by Robert Buchholz <rbu@gentoo.org>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-08-27 09:57:53 +01:00