Commit Graph
18967 Commits
Author SHA1 Message Date
Keir Fraser 8005ca26cb Cpufreq: remove redundant fragments
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
2009-01-05 11:15:40 +00:00
Keir Fraser dca0b1a805 vtd hotplug: check if a device can be hot-plugged.
When we statically assign a pci device (the pci=3D['xx:xx.x'] string
in guest config file) to guest, we make many checkings (for instance,
if the device is specified in 'pciback.hide', if it has
non-page-aligned MMIO BARs, if it has a proper FLR capability, if the
related devices should be co-assigned). However, with respect to the
guest hotplug, we only check if the device exists and not assigned yet
-- this is not enough, for instance, now xend allows us to assign an
in-use device (being used by Dom0) to an HVM guest (because
xc.test_assigned() returns OK) -- this will cause disaster... The
patch adds some necessary checkings.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-01-05 11:14:18 +00:00
Keir Fraser 19e94db949 vtd: avoid redundant context mapping
After changeset 18934 (VT-d: Fix PCI-X device assignment), my assigned
PCI E1000 NIC doesn't work in guest.

The NIC is 03:00.0. Its parent bridge is: 00:1e.0.
In domain_context_mapping():
   case DEV_TYPE_PCI:
   After we domain_context_mapping_one() 03:00.0 and 00:1e.0, the
   'secbus' is 3 and 'bus' is 0,  so we domain_context_mapping_one()
   03:00.0 again -- this redundant invocation returns -EINVAL because
   we have created the mapping but haven't changed pdev->domain from
   Dom0 to a new domain at this time and eventually the
   XEN_DOMCTL_assign_device hypercall returns a failure.

The attached patch detects this case and avoids the redundant
invocation.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-01-05 11:13:22 +00:00
Keir Fraser 1d6e30c679 xenctx: compat-mode/HVM support
Add support to xenctx for guests that have a different word size
to the tools (x86 only, but shouldn't break ia64).  Again, only 32-bit
HVM guests are supported until EFER.LMA is easier to get at.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2009-01-05 11:08:53 +00:00
Keir Fraser 446b916ca1 Make xc_translate_foreign_address aware of compat-mode guests and
(32-bit) HVM guests.  64-bit HVM guests are still not supported for
now, pending a sensible way of getting at the guest's EFER.LMA.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2009-01-05 11:08:25 +00:00
Keir Fraser fcb1a7ac2f p2m: Small audit fixes.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:47:51 +00:00
Keir Fraser 5bbed21d17 PoD memory 9/9: xend integration
Xend integration for PoD functionality.
* Add python bindings for xc_hvm_domain_build() and
xc_domain_memory_set_pod_target()
* Always call xc_hvm_domain_build(), with memsize = memory_static_max
and target=memory_dynamic_max
* When setting a new memory target:
 + First make sure we actually have enough free memory for the target
setting to succeed
 + Call set_pod_target() with the new target, to Xen can do the Right
 Thing.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:47:03 +00:00
Keir Fraser f5fec95647 PoD memory 8/9: libxc interface
Implement libxc interface to PoD functionality:
* Add xc_hvm_build_target_mem(), which takes both memsize and target.
Memsize is the total memory, allocated in PoD pages and reported in
the e820; target is the size of the cache.  If these are the same, the
normal funcitonality is called.  (So you can use the same function to
build always, and it will decide whether to use PoD or not.)
* Add xc_domain_memory_[gs]et_pod_target(), which sets and/or returns
information about the PoD cache and p2m entries.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:46:37 +00:00
Keir Fraser 36e3044132 PoD memory 7/9: Xen interface
Implement Xen interface to PoD functionality.
* Increase the number of MEMOP bits from 4 to 6 (increasing the number
of available memory operations from 16 to 64).
* Introduce XENMEMF_populate_on_demand, which will cause
populate_physmap() to fill a range with PoD entries rather than
backing it with ram
* Introduce XENMEM_[sg]et_pod_target operation to the memory
hypercall, to get and set PoD cache size.  set_pod_target() should be
called during domain creation, as well as after modifying the memory
target of any domain which may have outstanding PoD entries.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:45:48 +00:00
Keir Fraser f25ed554f0 PoD memory 6/9: superpage splintering
Deal with splintering superpages in the PoD cache, and with
splintering superpage PoD entries in the p2m table.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:45:09 +00:00
Keir Fraser 9ad9a1609f PoD memory 5/9: emergency scan
Implement "emergency scan" for zero pages, to deal with start-of-day
page scrubbers.

If the cache is running out, scan through memory looking for "zero
pages" that we can reclaim for the cache.  This is necessary for
operating systems which have a start-of-day page scrubber which runs
before the balloon driver can balloon down to the target.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:44:39 +00:00
Keir Fraser 41aa0b6269 PoD memory 4/9: Decrease reservation
Handle balloon driver's calls to decrease_reservation properly.
* Replace PoD entries with p2m_none
* Steal memory for the cache instead of freeing, if need be

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:43:50 +00:00
Keir Fraser a589ff6c17 PoD memory 3/9: PoD core
X-BeenThere: xen-devel@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Xen developer discussion <xen-devel.lists.xensource.com>
List-Unsubscribe:
<http://lists.xensource.com/mailman/listinfo/xen-devel>,
        <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-devel@lists.xensource.com>
List-Help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-Subscribe:
<http://lists.xensource.com/mailman/listinfo/xen-devel>,
        <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
Sender: xen-devel-bounces@lists.xensource.com
Errors-To: xen-devel-bounces@lists.xensource.com
Return-Path: xen-devel-bounces@lists.xensource.com
X-OriginalArrivalTime: 23 Dec 2008 13:47:03.0625 (UTC)
FILETIME=[EFEBC390:01C96504]

Core of populate-on-demand functionality:
* Introduce a populate-on-demand type
* Call p2m_demand_populate() when gfn_to_mfn() encounters PoD entries
* Return p2m memory to the domain list for freeing during domain destruction
* Audit p2m checks our PoD-entry reference-counting
* Add PoD information to the 'q' debug key

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:43:19 +00:00
Keir Fraser e748f25403 PoD memory 2/9: calls to gfn_to_mfn_query()
Shadow code, and other important places, call gfn_to_mfn_query().  In
particular, any place that holds the shadow lock must make a query
call.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:42:39 +00:00
Keir Fraser 74e14a7867 PoD (populate-on-demand) memory 1/9: Add a p2m query type.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-01-05 10:41:48 +00:00
Keir Fraser 9976adf65a acpi: Reserve IO ports used by hotplug
In DSDT, reserve the IO port ranges: [0x10c0, 0x10c2] and [0xb044,
0xb047] that are used by the virtual PCI hotplug.
Or else, for a hotplugged-in device, the port IO BAR assigned by guest
OS may conflict with the ranges here.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2008-12-29 14:13:07 +00:00
Keir Fraser 119a6a6e07 cpufreq: xen is default cpufreq, userspace is default governor (override on cmdline)
Set userspace governor as default, which stays same effect
as when cpufreq in xen is not enabled. As a result, enable cpufreq
in xen by default to avoid reboot to activate cpufreq. Now it's
always on but w/o performance impact if user doesn't attempt
to change governor.

Add governor option at cmdline, add some warning info for debug.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
2008-12-29 14:08:46 +00:00
Keir Fraser bbdcb2fd41 x86, vmx: Fix single step on debugger
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2008-12-29 14:05:26 +00:00
Keir Fraser 846d032508 x86, mce: Fix x86_mcinfo_getptr is called when no error found
The machine_check_poll() is called with mi which is set by
x86_mcinfo_getptr() everytime. But, I think it should not be called
when there is no error, because error_idx and fetch_idx cannot work
together.

Signed-off-by: Kazuhiro Suzuki <kaz@jp.fujitsu.com>
2008-12-29 14:03:26 +00:00
Keir Fraser bb53d1d5fd rombios: disable DEBUG_ROMBIOS by default.
Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
2008-12-29 14:00:45 +00:00
Keir Fraser d47fd604d0 rombios: pass BDF correctly during option ROM scan
Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2008-12-29 14:00:15 +00:00
Keir Fraser 72d281ae08 rombios: enabling option ROM write access during initialisation.
Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
2008-12-29 13:55:59 +00:00
Keir Fraser 754ad39249 cpufreq: Fix a cpufreq cmdline parse bug, and change sample_rate unit
Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
2008-12-29 13:37:46 +00:00
Keir Fraser 723c9ab167 x86: Do not restrict 32-bit EPT to 4GB.
Signed-off-by: Xin, Xiaohui <xiaohui.xin@intel.com>
2008-12-29 13:32:32 +00:00
Keir Fraser cfbcb394f9 x86, intel: Clear Error counter field when set new cmci owner
Since cmci might happened when cpu is taking down (cpu hotplug) before
setting new cmci owner while old owner is down. We need to clear the
corrected error counter field to make sure CMCI could be triggered on
the new owner.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Liping Ke <liping.ke@intel.com>
2008-12-29 13:30:14 +00:00
Keir Fraser f99dc195cc i386: Fix the build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-22 13:48:40 +00:00
Keir Fraser 1f95053ea5 shadow: Remove warnings about writes to read-only BIOS area. These
attempts can be legitimate.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-22 13:43:13 +00:00
Keir Fraser 1b3c590b6c Cleanup Intel CMCI support.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-22 12:07:20 +00:00
Keir Fraser 8c9a4d8e4c Enable CMCI for Intel CPUs
Signed-off-by Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by Liping Ke <liping.ke@intel.com>
2008-12-22 08:12:33 +00:00
Keir Fraser 9913ea3300 Support S3 for MSI interrupt
From: "Jiang, Yunhong" <yunhong.jiang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-19 14:56:36 +00:00
Keir Fraser 8afd0f1132 Change the pcidevs_lock from rw_lock to spin_lock
As pcidevs_lock is changed from protecting only the alldevs_list to
more than that, it doesn't benifit too much from the rw_lock. Also the
previous patch 18906:2941b1a97c60 is wrong to use read_lock to protect some
sensitive data (thanks Espen pointed out that).

Also two minor fix in this patch:
a) deassign_device will deadlock when try to get the pcidevs_lock if
called by pci_release_devices, remove the lock to the caller.
b) The iommu_domain_teardown should not ASSERT for the pcidevs_lock
because it just update the domain's vt-d mapping.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
2008-12-19 14:52:32 +00:00
Keir Fraser 7784d17ecd CPUIDLE: adjust cstate statistic interface
1. change unit of residency, PM ticks -> ns.
2. output C0 usage & residency.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-19 14:44:40 +00:00
Keir Fraser 8c13de5687 VT-d: Fix PCI-X device assignment
When assign PCI device, current code just map its bridge and its
secondary bus number and devfn 0. It doesn't work for PCI-x device
assignment, because the request may be the source-id in the original
PCI-X transaction or the source-id provided by the bridge. It needs to
map the device itself, and its upstream bridges till PCIe-to-PCI/PCI-x
bridge.

In addition, add description for DEV_TYPE_PCIe_BRIDGE and
DEV_TYPE_PCI_BRIDGE for understandability.

Signed-off-by: Weidong Han <weidong.han@intel.com>
2008-12-19 13:42:04 +00:00
Keir Fraser 1e5e52220f xend: Actually restrict a domU's access to xenstore when we mean to --
this means that in some cases it cannot be owner of its own xenstore
nodes.

This bug was pointed out by Daniel Berrange at Red Hat. This patch is
my own more generic fix that automatically covers a range of callers
(albeit the patch is arguably a bit of a hack ;-).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-18 17:18:28 +00:00
Keir Fraser 68e3bd7b77 x86: Quieten tracing in msi startup/shutdown handlers.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-18 17:14:27 +00:00
Keir Fraser e8a33bc38f rombios: Update to Bochs latest
Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
2008-12-18 14:52:53 +00:00
Keir Fraser dce021d06a xenoprof: Add support for Intel Dunnington cores.
Signed-off-by: Xiaowei Yang <Xiaowei.yang@intel.com>
Signed-off-by: Ting Zhou <ting.g.zhou@intel.com>
2008-12-18 11:29:33 +00:00
Keir Fraser 2f0f4ad09f x86, shadow: Avoid duplicates in fixup tables.
Avoid entering duplicates in fixup tables, reducing fixup evictions.

Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
2008-12-18 11:28:25 +00:00
Keir Fraser cea7a6cd7b Fix mini-os ia64 compilation
- Avoid nested function to avoid a trampoline.
- Do not link mini-os_app.o when it is empty.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2008-12-18 11:27:37 +00:00
Keir Fraser 6840dfbbd0 x86, hvm: Don't ever call the shadow code to fix a page fault in an
external-mode guest if the fault came from Xen; it would be making
changes to the wrong pagetables, potentially causing a pagefault loop
in Xen.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2008-12-17 11:36:22 +00:00
Keir Fraser 75e06d089d xenpm: add cpu frequency control interface, through which user can
tune the parameters manually.

Now, xenpm can be invoked with the following options:
Usage:
       xenpm get-cpuidle-states [cpuid]: list cpu idle information on
       CPU cpuid or all CPUs.
       xenpm get-cpufreq-states [cpuid]: list cpu frequency
       information on CPU cpuid or all CPUs.
       xenpm get-cpufreq-para [cpuid]: list cpu frequency information
       on CPU cpuid or all CPUs.
       xenpm set-scaling-maxfreq <cpuid> <HZ>: set max cpu frequency
       <HZ> on CPU <cpuid>.
       xenpm set-scaling-minfreq <cpuid> <HZ>: set min cpu frequency
       <HZ> on CPU <cpuid>.
       xenpm set-scaling-governor <cpuid> <name>: set scaling governor
       on CPU <cpuid>.
       xenpm set-scaling-speed <cpuid> <num>: set scaling speed on CPU
       <cpuid>.
       xenpm set-sampling-rate <cpuid> <num>: set sampling rate on CPU
       <cpuid>.
       xenpm set-up-threshold <cpuid> <num>: set up threshold on CPU
       <cpuid>.

To ease the use of this tool, the shortcut option is supported,
i.e. `xenpm get-cpui' is equal to `xenpm get-cpuidle-states'.

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
2008-12-16 13:14:25 +00:00
Keir Fraser f771f7ffce x86: Update xen-detect utility to scan for Xen signature in CPUID space.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-16 12:04:13 +00:00
Keir Fraser c32ea44041 mini-os: Make utility function get_self_id() in fs-front.c public.
Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
2008-12-16 12:00:25 +00:00
Keir Fraser 1b6a99892d x86: Simpler time handling when TSC is constant across all power saving states.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Signed-off-by: Gang Wei <gang.wei@intel.com>
2008-12-16 11:59:22 +00:00
Keir Fraser 25c2bce46a vmx: Do not disable real EFER.NXE even when disabled by guest.
We must not disable EFER.NXE in host mode since shadow code relies on
accessing shadow mappings with NX set.

We do not want to write EFER on every vmentry/vmexit if we can avoid
it, since it will be somewhat slow.

Finally, we don't believe that any guest relies on NX really being
disabled when EFER.NXE is cleared.

This given, it makes sense to ignore the guest's setting of EFER.NXE.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-16 11:54:11 +00:00
Keir Fraser 74d59a59e2 x86: Enable MTF for HVM guest single step in gdb
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-16 11:49:20 +00:00
Keir Fraser 53e5cd08ef x86: Decode CPUID for TSC guarantees.
Signed-off-by: Wei Gang <gang.wei@intel.com>
2008-12-15 11:37:14 +00:00
Keir Fraser a0c46b435d rombios: fix references to EBDA
Extended Bios Data Area (EBDA) can be relocated by the initialization
of PCI option ROM. The IPL boot table is also.
EBDA must be accessed via 0x40E after the initialization.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2008-12-15 11:23:22 +00:00
Keir Fraser f2f78ed2c8 x86: Small cleanups to time handling.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-15 11:17:14 +00:00
Keir Fraser 158b608e1d xenpmd: Fix bogus fgets() size parameter.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-12-13 17:44:20 +00:00