xen.git
16 years agoxen: Do not assign to CFLAGS/AFLAGS/LDFLAGS with :=.
Keir Fraser [Tue, 13 Jan 2009 08:40:42 +0000 (08:40 +0000)]
xen: Do not assign to CFLAGS/AFLAGS/LDFLAGS with :=.

It's not necessary and prevents using rule patterns in these
variables.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotools: Don't turn CFLAGS into a := (immediate evaluation) variable as
Keir Fraser [Mon, 12 Jan 2009 16:39:07 +0000 (16:39 +0000)]
tools: Don't turn CFLAGS into a := (immediate evaluation) variable as
this breaks 'CFLAGS += -MMD -MF .$(@F).d'

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agohvmloader: Fix SMBIOS memory device length boundary condition.
Keir Fraser [Mon, 12 Jan 2009 10:23:55 +0000 (10:23 +0000)]
hvmloader: Fix SMBIOS memory device length boundary condition.

dev_memsize ends up 0 when it shouldn't be on 16G boundary conditions.

Signed-off-by: Bill Rieske <brieske@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoDo not print `***' when compiling unless we fall over
Keir Fraser [Mon, 12 Jan 2009 10:17:12 +0000 (10:17 +0000)]
Do not print `***' when compiling unless we fall over

This has finally bugged me enough to do something about it:

make prints `***' when it stops due to an error.  With make -j, and/or
with automated build systems, this error marker can be in the middle
of a large logfile.  It is useful to be able to search for it.

Therefore change occurrences of `*' to `=' for information and warning
messages.  `***' is reserved for cases where the build stops.

A corresponding change is being applied to qemu-xen-unstable.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agoUse -MMD -MF in tools/* rather than -Wp,-M...
Keir Fraser [Mon, 12 Jan 2009 10:16:05 +0000 (10:16 +0000)]
Use -MMD -MF in tools/* rather than -Wp,-M...

If you use -MMD -MF then the correct .o filename is written to the
.*.d file as the compiler driver arranges everything.  This was done
in 19010:275abe1c5d24 for the hypervisor.

In this patch we do the same elsewhere in the xen-unstable tree,
particularly tools/.  Specifically:
 * Change tools/Rules.mk to add -MMD -MF ... to CFLAGS and set DEPS.
 * Remove -Wp,-MD... from every other Makefile
 * Remove setting of DEPS from every other Makefile
 * Ensure that every Makefile says -include $(DEPS)
 * Ensure that every Makefile's clean target removes $(DEPS)

Some Makefiles were already halfway there, but often for a different
variable name eg PROG_DEP.  The variable name is now standardised in
Rules.mk as DEPS.

I have done a test build with this change, on Debian etch.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agostubdom: Fix compilation after libelf header changes
Keir Fraser [Fri, 9 Jan 2009 16:56:54 +0000 (16:56 +0000)]
stubdom: Fix compilation after libelf header changes

Changeset 19011:7df072566b8c moved some of the libelf headers.
However, no changes were made to stubdom/Makefile.

stubdom/Makefile unfortunately contains embedded in it knowledge about
the header directory structures, and must therefore typically be
updated if new header directories are created.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agoAMD IOMMU: Allocate I/O pagetable from domheap instead of xenheap
Keir Fraser [Fri, 9 Jan 2009 15:57:57 +0000 (15:57 +0000)]
AMD IOMMU: Allocate I/O pagetable from domheap instead of xenheap

Signed-off-by: Wei Wang <wei.wang2@amd.com>
16 years agohvmloader: MTRR UC type covers the pci regions only.
Keir Fraser [Fri, 9 Jan 2009 13:00:10 +0000 (13:00 +0000)]
hvmloader: MTRR UC type covers the pci regions only.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agohvmloader: Dynamically size the PCI hole.
Keir Fraser [Fri, 9 Jan 2009 12:41:25 +0000 (12:41 +0000)]
hvmloader: Dynamically size the PCI hole.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoNew XENMAPSPACE_gmfn parameter for XENMEM_add_to_physmap.
Keir Fraser [Fri, 9 Jan 2009 11:44:35 +0000 (11:44 +0000)]
New XENMAPSPACE_gmfn parameter for XENMEM_add_to_physmap.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: Fix a ssl migration hang issue
Keir Fraser [Fri, 9 Jan 2009 10:04:24 +0000 (10:04 +0000)]
xend: Fix a ssl migration hang issue

When another VM is started by xend, the spawned qemu process will keep
the p2cwrite file descriptor open.
Thus there will be two open descriptors associated with the write end
of the pipe. The read end of the pipe only sees EOF when the qemu
process has terminated.

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
16 years agohvmloader: Reserve BIOS memory and VGA memory at top of 4GB memory hole.
Keir Fraser [Thu, 8 Jan 2009 16:59:21 +0000 (16:59 +0000)]
hvmloader: Reserve BIOS memory and VGA memory at top of 4GB memory hole.

To make memory management easier in hvmloader, defer building a
generic E820 map until the end of hvmloader bootstrap.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoPrint domain max_pages in 'q' debug output.
Keir Fraser [Thu, 8 Jan 2009 16:53:15 +0000 (16:53 +0000)]
Print domain max_pages in 'q' debug output.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86, hvm: Move E820 table creation into hvmloader, extend
Keir Fraser [Thu, 8 Jan 2009 15:27:20 +0000 (15:27 +0000)]
x86, hvm: Move E820 table creation into hvmloader, extend
hvm_info_table to describe memory parameters in a simpler form from
domain builder to hvmloader.

Also move reserved special page mappings immediately below the 4GB
boundary.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxm: Fix syntax error.
Keir Fraser [Thu, 8 Jan 2009 15:18:30 +0000 (15:18 +0000)]
xm: Fix syntax error.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agohvmloader: Simplify access to hvm_info_table.
Keir Fraser [Thu, 8 Jan 2009 13:49:05 +0000 (13:49 +0000)]
hvmloader: Simplify access to hvm_info_table.

Also require the table to be present.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoFix gcc make-dep cmdline options.
Keir Fraser [Thu, 8 Jan 2009 13:37:16 +0000 (13:37 +0000)]
Fix gcc make-dep cmdline options.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: Re-instate warnings for HVM guest writes to read-only memory.
Keir Fraser [Thu, 8 Jan 2009 13:21:06 +0000 (13:21 +0000)]
x86: Re-instate warnings for HVM guest writes to read-only memory.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoMove libelf headers out of xen public header dir.
Keir Fraser [Thu, 8 Jan 2009 13:15:49 +0000 (13:15 +0000)]
Move libelf headers out of xen public header dir.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
16 years agoAuto-build dependency files in hypervisor build tree.
Keir Fraser [Thu, 8 Jan 2009 13:08:37 +0000 (13:08 +0000)]
Auto-build dependency files in hypervisor build tree.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86-64: guest directed placement of initial p->m map
Keir Fraser [Thu, 8 Jan 2009 11:32:39 +0000 (11:32 +0000)]
x86-64: guest directed placement of initial p->m map

By adding another ELF note, the kernel can now direct the hypervisor
(for Dom0) and in the future also the tools (for DomU-s) to place the
initial phys->mach translation table at other than an address
immediately above the kernel/initrd images. This eliminates the size
restriction imposed on this table by Linux (the kernel loads above the
-2Gb boundary, and hence the entire initial mapping cannot reach or
even exceed 2Gb).

There are a few items in this patch I'm not particularly happy with,
but couldn't think of a better solution:
- there is a hidden assumption that pages allocated for the domain are
  put on the domain's page list sequentially
- the way backward compatibility is maintained is placing requirements
  on the kernel side that make the code somewhat convoluted (because
  it
  needs to check where the map is actually placed in quite a few
  places)
- code is there to use 1Gb mappings for the hypervisor created table,
  but lacking a machine with 512G+ memory for immediate testing I
  can't
  verify this works; I know that 2Mb mappings work, and hence imply
  that 1Gb ones would too (of course, if the kernel replaces the table
  - like Linux does -, it cannot use 2Mb/1Gb mappings or even try to
  re-use the page table entries, but I don't consider this a problem)

Signed-off-by: Jan Beulich <jbeulich@novell.com>
16 years agopassthough: MSI-INTx translation documentation
Keir Fraser [Thu, 8 Jan 2009 11:27:11 +0000 (11:27 +0000)]
passthough: MSI-INTx translation documentation

Signed-off-by: Qing He <qing.he@intel.com>
16 years agopci: add config options for MSI-INTx translation in HVM
Keir Fraser [Thu, 8 Jan 2009 11:26:58 +0000 (11:26 +0000)]
pci: add config options for MSI-INTx translation in HVM

Add a config file option 'pci_msitranslate' to enable MSI-INTx
translation in HVM, and also a per-device option 'msitranslate' to
allow device base to be overridden

Signed-off-by: Qing He <qing.he@intel.com>
16 years agopci: add pci option support for XenAPI sever
Keir Fraser [Thu, 8 Jan 2009 11:26:16 +0000 (11:26 +0000)]
pci: add pci option support for XenAPI sever

Allow the per-device options for passthrough pci devices
This patch is for XenAPI server

A new key-value pair element of 'pci' named 'pci_opt' is added
to xml config file

Signed-off-by: Qing He <qing.he@intel.com>
16 years agopci: add pci option support for XML-RPC server
Keir Fraser [Thu, 8 Jan 2009 11:25:43 +0000 (11:25 +0000)]
pci: add pci option support for XML-RPC server

Allow the per-device options for passthrough pci devices
for exmaple, in domain config file:
    pci = ['01:00.0,opt1=val1,opt2=val2', '01:00.1' ]
or in the PCI hotplug case:
    xm pci-attach -o opt1=val1 --options=opt2=val2 <domid> 01:00.0 6

This patch is for xml-rpc server

Signed-off-by: Qing He <qing.he@intel.com>
16 years agopassthrough: MSI-INTx translation for HVM
Keir Fraser [Thu, 8 Jan 2009 11:25:06 +0000 (11:25 +0000)]
passthrough: MSI-INTx translation for HVM

The patch adds a new type of pt_irq: PT_IRQ_TYPE_MSI_TRANSLATE.
With it, guest dpci irq can now use msi as the underlying pirq
while injected as INTx irq.

Signed-off-by: Qing He <qing.he@intel.com>
16 years agoxenpm tool enhancements
Keir Fraser [Thu, 8 Jan 2009 11:21:23 +0000 (11:21 +0000)]
xenpm tool enhancements

Two enhancements are made in this patch:

1. Make cpuid in command line optional: if user does not provide
cpuid, xenpm will operate on all the CPUs. this will easy the xenpm
usage. e.g. to set the cpufreq governor, user usually want to set the
governor on all CPUs. User can accomplish this easily with this
enhancement.

2. Add another option "xenpm start" to calculate the Cx/Px state
residency percentage during specified period. when user issue "xenpm
start", xenpm will start to record the Cx/Px state residency. when
user issue CTRL-C, xenpm will stop and show the Cx/Px state residency
and percentage of this period. this is helpful to measure the xenpm
effect for speficied workload.

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>Signed-off-by: Ke Yu <ke.yu@intel.com>
16 years agox86: remove pointless dom0 check
Keir Fraser [Thu, 8 Jan 2009 11:19:38 +0000 (11:19 +0000)]
x86: remove pointless dom0 check

This check is redundant with a check a few dozen lines up resulting in
a panic().

Signed-off-by: Jan Beulich <jbeulich@novell.com>
16 years agoEnable debug build by default, for better dev testing.
Keir Fraser [Wed, 7 Jan 2009 11:25:00 +0000 (11:25 +0000)]
Enable debug build by default, for better dev testing.

In particular this may hopefully give better detection of latent
spinlock bugs.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agocpufreq: stats_lock doesn't appear to need to be irq-safe.
Keir Fraser [Wed, 7 Jan 2009 11:21:50 +0000 (11:21 +0000)]
cpufreq: stats_lock doesn't appear to need to be irq-safe.

Changing this fixes some bugchecks (xmalloc() with irqs disabled).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years ago[IA64] stub for XENMEM_[gs]et_pod_target.
Isaku Yamahata [Wed, 7 Jan 2009 05:28:33 +0000 (14:28 +0900)]
[IA64] stub for XENMEM_[gs]et_pod_target.

This patch adds the stub for XENMEM_[gs]et_pod_target.
Without this patch, domain builder aborts on the error.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years ago[IA64] ia64 counter part of 5b44cfde9666.
Isaku Yamahata [Wed, 7 Jan 2009 05:27:03 +0000 (14:27 +0900)]
[IA64] ia64 counter part of 5b44cfde9666.

This patch defines ia64 xc_hvm_build_target_mem() which
is referenced by xc.c.
Without this patch, xend doesn't boot complaining
that symbol, xc_hvm_build_target_mem, is missing.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years ago[IA64] compilation fix of xenctx
Isaku Yamahata [Wed, 7 Jan 2009 03:20:31 +0000 (12:20 +0900)]
[IA64] compilation fix of xenctx

This patch fixes the following compilation error caused by
18963:9cc632cc6d40 of xen-unstable.hg

> xenctx.c: In function 'print_ctx':
> xenctx.c:430: error: request for member 'c' in something not a structure or union
> xenctx.c:431: error: 'vcpu_guest_context_any_t' has no member named 'regs'
> xenctx.c:484: error: 'vcpu_guest_context_any_t' has no member named 'event_callback_ip'

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agomerge with xen-unstable.hg
Isaku Yamahata [Wed, 7 Jan 2009 03:20:18 +0000 (12:20 +0900)]
merge with xen-unstable.hg

16 years ago[IA64] stubs for populate on demand.
Isaku Yamahata [Wed, 7 Jan 2009 03:19:36 +0000 (12:19 +0900)]
[IA64] stubs for populate on demand.

add stub functions of populate on demand to compile.
This patch fixes the following compile error.

> xen/common/built_in.o: In function `populate_physmap':
> xen/common/memory.c:116: undefined reference to `guest_physmap_mark_populate_on_demand'
> xen/common/built_in.o: In function `decrease_reservation':
> xen/common/memory.c:205: undefined reference to `p2m_pod_decrease_reservation'

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agorombios: Get rid of annoying delay at F12 boot menu.
Keir Fraser [Tue, 6 Jan 2009 16:06:13 +0000 (16:06 +0000)]
rombios: Get rid of annoying delay at F12 boot menu.
Instead require the F12 to be pressed before the menu prompt appears.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agorombios: Allow option ROMs to extend up to 0xEA000.
Keir Fraser [Tue, 6 Jan 2009 16:02:10 +0000 (16:02 +0000)]
rombios: Allow option ROMs to extend up to 0xEA000.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: Fix error handling in device_create().
Keir Fraser [Tue, 6 Jan 2009 14:01:39 +0000 (14:01 +0000)]
xend: Fix error handling in device_create().

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
16 years agorombios: Do not initialise PCI devices after hvmloader.
Keir Fraser [Tue, 6 Jan 2009 14:00:58 +0000 (14:00 +0000)]
rombios: Do not initialise PCI devices after hvmloader.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
16 years agohvm: Tell Viridian-enabled OS to relax timer interrupt checks.
Keir Fraser [Tue, 6 Jan 2009 13:58:13 +0000 (13:58 +0000)]
hvm: Tell Viridian-enabled OS to relax timer interrupt checks.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: Disable MSI as it seems to be triggering ASSERT at irq.c:269.
Keir Fraser [Tue, 6 Jan 2009 13:27:55 +0000 (13:27 +0000)]
x86: Disable MSI as it seems to be triggering ASSERT at irq.c:269.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agolibxc: Define xc_ffs{8,16,32,64} functions. Use them.
Keir Fraser [Tue, 6 Jan 2009 09:14:39 +0000 (09:14 +0000)]
libxc: Define xc_ffs{8,16,32,64} functions. Use them.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years ago[IA64] Fix some IPF Xen VT-d bugs.
Isaku Yamahata [Tue, 6 Jan 2009 09:05:32 +0000 (18:05 +0900)]
[IA64] Fix some IPF Xen VT-d bugs.

In arch_domain_create(): when xen creates Dom0, need_iommu(d) is false,
so iommu_domain_init() is not invoked, as a result, eventually iommu is
not enabled properly.
Note: d->need_iommu is set to 1 only by assign_device() which is never
called for dom0. And it is called via XEN_DOMCTL_assign_device hypercall.

In IA64 Xen, physdev_map_pirq()/physdev_unmap_pirq() are kept dummy since
we don't support MSI in IA64 Xen now, but here they shouldn't return
-ENOSYS because xend invokes them (the x86 version of them is necessary
for x86 Xen); in IPF Xen if they return -ENOSYS, xend would disallow us
to create IPF HVM guest with devices assigned. Here They can return 0 instead.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agox86: Poison initmem at end of Xen bootstrap
Keir Fraser [Mon, 5 Jan 2009 11:55:24 +0000 (11:55 +0000)]
x86: Poison initmem at end of Xen bootstrap

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agovmx: Print advanced features during boot
Keir Fraser [Mon, 5 Jan 2009 11:52:34 +0000 (11:52 +0000)]
vmx: Print advanced features during boot
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoDownload external tarballs from xenbits.xensource.com
Keir Fraser [Mon, 5 Jan 2009 11:19:16 +0000 (11:19 +0000)]
Download external tarballs from xenbits.xensource.com

I have copied the tarballs that the xen-unstable build downloads to
xenbits.xensource.com (which also hosts our hg and git).  This patch
changes the download URLs to use that location.

That way the build will depend on only one external machine, under one
administration, rather than many.  Also it means that the build won't
break if these sites become permanently unavailable or are rearranged
and we don't run a risk of having to panic and beg if a file should go
missing.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agoCpufreq: simplify cpufreq_statistic_lock init
Keir Fraser [Mon, 5 Jan 2009 11:16:41 +0000 (11:16 +0000)]
Cpufreq: simplify cpufreq_statistic_lock init

Singed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
16 years agoCpufreq: prevent negative px resident time, add spinlock to avoid race
Keir Fraser [Mon, 5 Jan 2009 11:16:12 +0000 (11:16 +0000)]
Cpufreq: prevent negative px resident time, add spinlock to avoid race

Due to NOW() value may drift between different cpus, we add protection
to prevent negative px resident time.
Due to both cpufreq logic and xenpm may race accessing
cpufreq_statistic_data, we add spinlock to avoid race.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
16 years agoCpufreq: remove redundant fragments
Keir Fraser [Mon, 5 Jan 2009 11:15:40 +0000 (11:15 +0000)]
Cpufreq: remove redundant fragments

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
16 years agovtd hotplug: check if a device can be hot-plugged.
Keir Fraser [Mon, 5 Jan 2009 11:14:18 +0000 (11:14 +0000)]
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>
16 years agovtd: avoid redundant context mapping
Keir Fraser [Mon, 5 Jan 2009 11:13:22 +0000 (11:13 +0000)]
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>
16 years agoxenctx: compat-mode/HVM support
Keir Fraser [Mon, 5 Jan 2009 11:08:53 +0000 (11:08 +0000)]
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>
16 years agoMake xc_translate_foreign_address aware of compat-mode guests and
Keir Fraser [Mon, 5 Jan 2009 11:08:25 +0000 (11:08 +0000)]
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>
16 years agop2m: Small audit fixes.
Keir Fraser [Mon, 5 Jan 2009 10:47:51 +0000 (10:47 +0000)]
p2m: Small audit fixes.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
16 years agoPoD memory 9/9: xend integration
Keir Fraser [Mon, 5 Jan 2009 10:47:03 +0000 (10:47 +0000)]
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>
16 years agoPoD memory 8/9: libxc interface
Keir Fraser [Mon, 5 Jan 2009 10:46:37 +0000 (10:46 +0000)]
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>
16 years agoPoD memory 7/9: Xen interface
Keir Fraser [Mon, 5 Jan 2009 10:45:48 +0000 (10:45 +0000)]
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>
16 years agoPoD memory 6/9: superpage splintering
Keir Fraser [Mon, 5 Jan 2009 10:45:09 +0000 (10:45 +0000)]
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>
16 years agoPoD memory 5/9: emergency scan
Keir Fraser [Mon, 5 Jan 2009 10:44:39 +0000 (10:44 +0000)]
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>
16 years agoPoD memory 4/9: Decrease reservation
Keir Fraser [Mon, 5 Jan 2009 10:43:50 +0000 (10:43 +0000)]
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>
16 years agoPoD memory 3/9: PoD core
Keir Fraser [Mon, 5 Jan 2009 10:43:19 +0000 (10:43 +0000)]
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>
16 years agoPoD memory 2/9: calls to gfn_to_mfn_query()
Keir Fraser [Mon, 5 Jan 2009 10:42:39 +0000 (10:42 +0000)]
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>
16 years agoPoD (populate-on-demand) memory 1/9: Add a p2m query type.
Keir Fraser [Mon, 5 Jan 2009 10:41:48 +0000 (10:41 +0000)]
PoD (populate-on-demand) memory 1/9: Add a p2m query type.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
16 years ago[IA64] fix ia64_fast_eoi hypercall to catch up PHYSDEVOP_pirq_eoi_gmfn
Isaku Yamahata [Mon, 5 Jan 2009 05:13:38 +0000 (14:13 +0900)]
[IA64] fix ia64_fast_eoi hypercall to catch up PHYSDEVOP_pirq_eoi_gmfn

ia64 xen Linux uses ia64_fast_eoi to do eoi. So the c/s 18862:f0a9a58608a0
should also have changed od_pir_guest_eoi() too.
This patch changes it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years ago[IA64] fix mis-setting ed bit for itlb entry for hvm domain.
Isaku Yamahata [Mon, 5 Jan 2009 03:24:58 +0000 (12:24 +0900)]
[IA64] fix mis-setting ed bit for itlb entry for hvm domain.

This patch fixes a windows BSOD issue caused by mis-setting pte's ED bit
for itlb entry.
For hash vTLB, it uses unified tlb and doesn't differentiate itc and dtc
in its implementation, so itlb_miss handler may reference dtlb entry in
hash vTLB.
But it may result in issues, because dtlb's ED bit may be different with
itlb's setting.
Since the case is very rare, so just purge the corresponding entry in hash
vTLB and let guest OS to determin how to set ED bit for itlb mapping once
found it.

Signed-off-by : Xiantao Zhang <xiantao.zhang@intel.com>

16 years ago[IA64] paravirtualize itc and support save/restore.
Isaku Yamahata [Mon, 5 Jan 2009 03:24:58 +0000 (12:24 +0900)]
[IA64] paravirtualize itc and support save/restore.

ia64 linux 2.6.18 only use ar.itc for local ticks so that
ar.itc didn't need paravirtualization and it can be work arounded
when save/restore.
However recent ia64 linux uses ar.itc for sched_clock() and
CONFIG_VIRT_CPU_ACCOUNTING and other issues. So ar.itc needs
paravirtualization. Although Most part is done in guest OS,
save/restore needs hypervisor support.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years ago[IA64] remove warning.
Isaku Yamahata [Mon, 5 Jan 2009 03:24:58 +0000 (12:24 +0900)]
[IA64] remove warning.

This patch removes the following warning.
> hypercall.c:205: warning: implicit declaration of function 'vmx_lazy_load_fpu'

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agoacpi: Reserve IO ports used by hotplug
Keir Fraser [Mon, 29 Dec 2008 14:13:07 +0000 (14:13 +0000)]
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>
16 years agocpufreq: xen is default cpufreq, userspace is default governor (override on cmdline)
Keir Fraser [Mon, 29 Dec 2008 14:08:46 +0000 (14:08 +0000)]
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>
16 years agox86, vmx: Fix single step on debugger
Keir Fraser [Mon, 29 Dec 2008 14:05:26 +0000 (14:05 +0000)]
x86, vmx: Fix single step on debugger

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
16 years agox86, mce: Fix x86_mcinfo_getptr is called when no error found
Keir Fraser [Mon, 29 Dec 2008 14:03:26 +0000 (14:03 +0000)]
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>
16 years agorombios: disable DEBUG_ROMBIOS by default.
Keir Fraser [Mon, 29 Dec 2008 14:00:45 +0000 (14:00 +0000)]
rombios: disable DEBUG_ROMBIOS by default.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
16 years agorombios: pass BDF correctly during option ROM scan
Keir Fraser [Mon, 29 Dec 2008 14:00:15 +0000 (14:00 +0000)]
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>
16 years agorombios: enabling option ROM write access during initialisation.
Keir Fraser [Mon, 29 Dec 2008 13:55:59 +0000 (13:55 +0000)]
rombios: enabling option ROM write access during initialisation.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
16 years agocpufreq: Fix a cpufreq cmdline parse bug, and change sample_rate unit
Keir Fraser [Mon, 29 Dec 2008 13:37:46 +0000 (13:37 +0000)]
cpufreq: Fix a cpufreq cmdline parse bug, and change sample_rate unit

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
16 years agox86: Do not restrict 32-bit EPT to 4GB.
Keir Fraser [Mon, 29 Dec 2008 13:32:32 +0000 (13:32 +0000)]
x86: Do not restrict 32-bit EPT to 4GB.

Signed-off-by: Xin, Xiaohui <xiaohui.xin@intel.com>
16 years agox86, intel: Clear Error counter field when set new cmci owner
Keir Fraser [Mon, 29 Dec 2008 13:30:14 +0000 (13:30 +0000)]
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>
16 years agomerge with xen-unstable.hg
Isaku Yamahata [Wed, 24 Dec 2008 03:52:34 +0000 (12:52 +0900)]
merge with xen-unstable.hg

16 years ago[IA64]: Fix BUILD_BUG_ON().
Isaku Yamahata [Wed, 24 Dec 2008 03:50:57 +0000 (12:50 +0900)]
[IA64]: Fix BUILD_BUG_ON().

This is ia64 counter part of 1419a73316e1.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years ago[IA64]: fix compilation error.
Isaku Yamahata [Wed, 24 Dec 2008 03:50:55 +0000 (12:50 +0900)]
[IA64]: fix compilation error.

BUILD_BUG_ON() was changed so that now BUILD_BUG_ON() can't be
used with symbol values.
Fortunately dom_fpswa_hypercall_patch() isn't performance critical
so replace BUILD_BUG_ON() with BUG_ON().
Fixed the wrong condition which has off-by-one bug.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agoi386: Fix the build.
Keir Fraser [Mon, 22 Dec 2008 13:48:40 +0000 (13:48 +0000)]
i386: Fix the build.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoshadow: Remove warnings about writes to read-only BIOS area. These
Keir Fraser [Mon, 22 Dec 2008 13:43:13 +0000 (13:43 +0000)]
shadow: Remove warnings about writes to read-only BIOS area. These
attempts can be legitimate.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoCleanup Intel CMCI support.
Keir Fraser [Mon, 22 Dec 2008 12:07:20 +0000 (12:07 +0000)]
Cleanup Intel CMCI support.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoEnable CMCI for Intel CPUs
Keir Fraser [Mon, 22 Dec 2008 08:12:33 +0000 (08:12 +0000)]
Enable CMCI for Intel CPUs

Signed-off-by Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by Liping Ke <liping.ke@intel.com>

17 years agoSupport S3 for MSI interrupt
Keir Fraser [Fri, 19 Dec 2008 14:56:36 +0000 (14:56 +0000)]
Support S3 for MSI interrupt

From: "Jiang, Yunhong" <yunhong.jiang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoChange the pcidevs_lock from rw_lock to spin_lock
Keir Fraser [Fri, 19 Dec 2008 14:52:32 +0000 (14:52 +0000)]
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>
17 years agoCPUIDLE: adjust cstate statistic interface
Keir Fraser [Fri, 19 Dec 2008 14:44:40 +0000 (14:44 +0000)]
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>
17 years agoVT-d: Fix PCI-X device assignment
Keir Fraser [Fri, 19 Dec 2008 13:42:04 +0000 (13:42 +0000)]
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>
17 years agoxend: Actually restrict a domU's access to xenstore when we mean to --
Keir Fraser [Thu, 18 Dec 2008 17:18:28 +0000 (17:18 +0000)]
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>
17 years agox86: Quieten tracing in msi startup/shutdown handlers.
Keir Fraser [Thu, 18 Dec 2008 17:14:27 +0000 (17:14 +0000)]
x86: Quieten tracing in msi startup/shutdown handlers.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agorombios: Update to Bochs latest
Keir Fraser [Thu, 18 Dec 2008 14:52:53 +0000 (14:52 +0000)]
rombios: Update to Bochs latest

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
17 years agoxenoprof: Add support for Intel Dunnington cores.
Keir Fraser [Thu, 18 Dec 2008 11:29:33 +0000 (11:29 +0000)]
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>
17 years agox86, shadow: Avoid duplicates in fixup tables.
Keir Fraser [Thu, 18 Dec 2008 11:28:25 +0000 (11:28 +0000)]
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>
17 years agoFix mini-os ia64 compilation
Keir Fraser [Thu, 18 Dec 2008 11:27:37 +0000 (11:27 +0000)]
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>
17 years agox86, hvm: Don't ever call the shadow code to fix a page fault in an
Keir Fraser [Wed, 17 Dec 2008 11:36:22 +0000 (11:36 +0000)]
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>
17 years agoxenpm: add cpu frequency control interface, through which user can
Keir Fraser [Tue, 16 Dec 2008 13:14:25 +0000 (13:14 +0000)]
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>
17 years agox86: Update xen-detect utility to scan for Xen signature in CPUID space.
Keir Fraser [Tue, 16 Dec 2008 12:04:13 +0000 (12:04 +0000)]
x86: Update xen-detect utility to scan for Xen signature in CPUID space.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agomini-os: Make utility function get_self_id() in fs-front.c public.
Keir Fraser [Tue, 16 Dec 2008 12:00:25 +0000 (12:00 +0000)]
mini-os: Make utility function get_self_id() in fs-front.c public.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
17 years agox86: Simpler time handling when TSC is constant across all power saving states.
Keir Fraser [Tue, 16 Dec 2008 11:59:22 +0000 (11:59 +0000)]
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>
17 years agovmx: Do not disable real EFER.NXE even when disabled by guest.
Keir Fraser [Tue, 16 Dec 2008 11:54:11 +0000 (11:54 +0000)]
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>