Commit d4c6fa73 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'stable/for-linus-3.4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen

Pull xen updates from Konrad Rzeszutek Wilk:
 "which has three neat features:

   - PV multiconsole support, so that there can be hvc1, hvc2, etc; This
     can be used in HVM and in PV mode.

   - P-state and C-state power management driver that uploads said power
     management data to the hypervisor.  It also inhibits cpufreq
     scaling drivers to load so that only the hypervisor can make power
     management decisions - fixing a weird perf bug.

     There is one thing in the Kconfig that you won't like: "default y
     if (X86_ACPI_CPUFREQ = y || X86_POWERNOW_K8 = y)" (note, that it
     all depends on CONFIG_XEN which depends on CONFIG_PARAVIRT which by
     default is off).  I've a fix to convert that boolean expression
     into "default m" which I am going to post after the cpufreq git
     pull - as the two patches to make this work depend on a fix in Dave
     Jones's tree.

   - Function Level Reset (FLR) support in the Xen PCI backend.

  Fixes:

   - Kconfig dependencies for Xen PV keyboard and video
   - Compile warnings and constify fixes
   - Change over to use percpu_xxx instead of this_cpu_xxx"

Fix up trivial conflicts in drivers/tty/hvc/hvc_xen.c due to changes to
a removed commit.

* tag 'stable/for-linus-3.4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  xen kconfig: relax INPUT_XEN_KBDDEV_FRONTEND deps
  xen/acpi-processor: C and P-state driver that uploads said data to hypervisor.
  xen: constify all instances of "struct attribute_group"
  xen/xenbus: ignore console/0
  hvc_xen: introduce HVC_XEN_FRONTEND
  hvc_xen: implement multiconsole support
  hvc_xen: support PV on HVM consoles
  xenbus: don't free other end details too early
  xen/enlighten: Expose MWAIT and MWAIT_LEAF if hypervisor OKs it.
  xen/setup/pm/acpi: Remove the call to boot_option_idle_override.
  xenbus: address compiler warnings
  xen: use this_cpu_xxx replace percpu_xxx funcs
  xen/pciback: Support pci_reset_function, aka FLR or D3 support.
  pci: Introduce __pci_reset_function_locked to be used when holding device_lock.
  xen: Utilize the restore_msi_irqs hook.
parents aab008db 4bc25af7
...@@ -77,6 +77,7 @@ DEFINE_GUEST_HANDLE(int); ...@@ -77,6 +77,7 @@ DEFINE_GUEST_HANDLE(int);
DEFINE_GUEST_HANDLE(long); DEFINE_GUEST_HANDLE(long);
DEFINE_GUEST_HANDLE(void); DEFINE_GUEST_HANDLE(void);
DEFINE_GUEST_HANDLE(uint64_t); DEFINE_GUEST_HANDLE(uint64_t);
DEFINE_GUEST_HANDLE(uint32_t);
typedef unsigned long xen_pfn_t; typedef unsigned long xen_pfn_t;
DEFINE_GUEST_HANDLE(xen_pfn_t); DEFINE_GUEST_HANDLE(xen_pfn_t);
......
...@@ -56,6 +56,7 @@ DEFINE_GUEST_HANDLE(int); ...@@ -56,6 +56,7 @@ DEFINE_GUEST_HANDLE(int);
DEFINE_GUEST_HANDLE(long); DEFINE_GUEST_HANDLE(long);
DEFINE_GUEST_HANDLE(void); DEFINE_GUEST_HANDLE(void);
DEFINE_GUEST_HANDLE(uint64_t); DEFINE_GUEST_HANDLE(uint64_t);
DEFINE_GUEST_HANDLE(uint32_t);
#endif #endif
#ifndef HYPERVISOR_VIRT_START #ifndef HYPERVISOR_VIRT_START
......
...@@ -324,6 +324,32 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) ...@@ -324,6 +324,32 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
out: out:
return ret; return ret;
} }
static void xen_initdom_restore_msi_irqs(struct pci_dev *dev, int irq)
{
int ret = 0;
if (pci_seg_supported) {
struct physdev_pci_device restore_ext;
restore_ext.seg = pci_domain_nr(dev->bus);
restore_ext.bus = dev->bus->number;
restore_ext.devfn = dev->devfn;
ret = HYPERVISOR_physdev_op(PHYSDEVOP_restore_msi_ext,
&restore_ext);
if (ret == -ENOSYS)
pci_seg_supported = false;
WARN(ret && ret != -ENOSYS, "restore_msi_ext -> %d\n", ret);
}
if (!pci_seg_supported) {
struct physdev_restore_msi restore;
restore.bus = dev->bus->number;
restore.devfn = dev->devfn;
ret = HYPERVISOR_physdev_op(PHYSDEVOP_restore_msi, &restore);
WARN(ret && ret != -ENOSYS, "restore_msi -> %d\n", ret);
}
}
#endif #endif
static void xen_teardown_msi_irqs(struct pci_dev *dev) static void xen_teardown_msi_irqs(struct pci_dev *dev)
...@@ -446,6 +472,7 @@ int __init pci_xen_initial_domain(void) ...@@ -446,6 +472,7 @@ int __init pci_xen_initial_domain(void)
#ifdef CONFIG_PCI_MSI #ifdef CONFIG_PCI_MSI
x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs; x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs;
x86_msi.teardown_msi_irq = xen_teardown_msi_irq; x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs;
#endif #endif
xen_setup_acpi_sci(); xen_setup_acpi_sci();
__acpi_register_gsi = acpi_register_gsi_xen; __acpi_register_gsi = acpi_register_gsi_xen;
......
...@@ -62,6 +62,15 @@ ...@@ -62,6 +62,15 @@
#include <asm/reboot.h> #include <asm/reboot.h>
#include <asm/stackprotector.h> #include <asm/stackprotector.h>
#include <asm/hypervisor.h> #include <asm/hypervisor.h>
#include <asm/mwait.h>
#ifdef CONFIG_ACPI
#include <linux/acpi.h>
#include <asm/acpi.h>
#include <acpi/pdc_intel.h>
#include <acpi/processor.h>
#include <xen/interface/platform.h>
#endif
#include "xen-ops.h" #include "xen-ops.h"
#include "mmu.h" #include "mmu.h"
...@@ -200,13 +209,17 @@ static void __init xen_banner(void) ...@@ -200,13 +209,17 @@ static void __init xen_banner(void)
static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0; static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0;
static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0;
static __read_mostly unsigned int cpuid_leaf1_ecx_set_mask;
static __read_mostly unsigned int cpuid_leaf5_ecx_val;
static __read_mostly unsigned int cpuid_leaf5_edx_val;
static void xen_cpuid(unsigned int *ax, unsigned int *bx, static void xen_cpuid(unsigned int *ax, unsigned int *bx,
unsigned int *cx, unsigned int *dx) unsigned int *cx, unsigned int *dx)
{ {
unsigned maskebx = ~0; unsigned maskebx = ~0;
unsigned maskecx = ~0; unsigned maskecx = ~0;
unsigned maskedx = ~0; unsigned maskedx = ~0;
unsigned setecx = 0;
/* /*
* Mask out inconvenient features, to try and disable as many * Mask out inconvenient features, to try and disable as many
* unsupported kernel subsystems as possible. * unsupported kernel subsystems as possible.
...@@ -214,9 +227,18 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, ...@@ -214,9 +227,18 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
switch (*ax) { switch (*ax) {
case 1: case 1:
maskecx = cpuid_leaf1_ecx_mask; maskecx = cpuid_leaf1_ecx_mask;
setecx = cpuid_leaf1_ecx_set_mask;
maskedx = cpuid_leaf1_edx_mask; maskedx = cpuid_leaf1_edx_mask;
break; break;
case CPUID_MWAIT_LEAF:
/* Synthesize the values.. */
*ax = 0;
*bx = 0;
*cx = cpuid_leaf5_ecx_val;
*dx = cpuid_leaf5_edx_val;
return;
case 0xb: case 0xb:
/* Suppress extended topology stuff */ /* Suppress extended topology stuff */
maskebx = 0; maskebx = 0;
...@@ -232,9 +254,75 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, ...@@ -232,9 +254,75 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
*bx &= maskebx; *bx &= maskebx;
*cx &= maskecx; *cx &= maskecx;
*cx |= setecx;
*dx &= maskedx; *dx &= maskedx;
} }
static bool __init xen_check_mwait(void)
{
#ifdef CONFIG_ACPI
struct xen_platform_op op = {
.cmd = XENPF_set_processor_pminfo,
.u.set_pminfo.id = -1,
.u.set_pminfo.type = XEN_PM_PDC,
};
uint32_t buf[3];
unsigned int ax, bx, cx, dx;
unsigned int mwait_mask;
/* We need to determine whether it is OK to expose the MWAIT
* capability to the kernel to harvest deeper than C3 states from ACPI
* _CST using the processor_harvest_xen.c module. For this to work, we
* need to gather the MWAIT_LEAF values (which the cstate.c code
* checks against). The hypervisor won't expose the MWAIT flag because
* it would break backwards compatibility; so we will find out directly
* from the hardware and hypercall.
*/
if (!xen_initial_domain())
return false;
ax = 1;
cx = 0;
native_cpuid(&ax, &bx, &cx, &dx);
mwait_mask = (1 << (X86_FEATURE_EST % 32)) |
(1 << (X86_FEATURE_MWAIT % 32));
if ((cx & mwait_mask) != mwait_mask)
return false;
/* We need to emulate the MWAIT_LEAF and for that we need both
* ecx and edx. The hypercall provides only partial information.
*/
ax = CPUID_MWAIT_LEAF;
bx = 0;
cx = 0;
dx = 0;
native_cpuid(&ax, &bx, &cx, &dx);
/* Ask the Hypervisor whether to clear ACPI_PDC_C_C2C3_FFH. If so,
* don't expose MWAIT_LEAF and let ACPI pick the IOPORT version of C3.
*/
buf[0] = ACPI_PDC_REVISION_ID;
buf[1] = 1;
buf[2] = (ACPI_PDC_C_CAPABILITY_SMP | ACPI_PDC_EST_CAPABILITY_SWSMP);
set_xen_guest_handle(op.u.set_pminfo.pdc, buf);
if ((HYPERVISOR_dom0_op(&op) == 0) &&
(buf[2] & (ACPI_PDC_C_C1_FFH | ACPI_PDC_C_C2C3_FFH))) {
cpuid_leaf5_ecx_val = cx;
cpuid_leaf5_edx_val = dx;
}
return true;
#else
return false;
#endif
}
static void __init xen_init_cpuid_mask(void) static void __init xen_init_cpuid_mask(void)
{ {
unsigned int ax, bx, cx, dx; unsigned int ax, bx, cx, dx;
...@@ -261,6 +349,9 @@ static void __init xen_init_cpuid_mask(void) ...@@ -261,6 +349,9 @@ static void __init xen_init_cpuid_mask(void)
/* Xen will set CR4.OSXSAVE if supported and not disabled by force */ /* Xen will set CR4.OSXSAVE if supported and not disabled by force */
if ((cx & xsave_mask) != xsave_mask) if ((cx & xsave_mask) != xsave_mask)
cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */ cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */
if (xen_check_mwait())
cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32));
} }
static void xen_set_debugreg(int reg, unsigned long val) static void xen_set_debugreg(int reg, unsigned long val)
...@@ -777,11 +868,11 @@ static DEFINE_PER_CPU(unsigned long, xen_cr0_value); ...@@ -777,11 +868,11 @@ static DEFINE_PER_CPU(unsigned long, xen_cr0_value);
static unsigned long xen_read_cr0(void) static unsigned long xen_read_cr0(void)
{ {
unsigned long cr0 = percpu_read(xen_cr0_value); unsigned long cr0 = this_cpu_read(xen_cr0_value);
if (unlikely(cr0 == 0)) { if (unlikely(cr0 == 0)) {
cr0 = native_read_cr0(); cr0 = native_read_cr0();
percpu_write(xen_cr0_value, cr0); this_cpu_write(xen_cr0_value, cr0);
} }
return cr0; return cr0;
...@@ -791,7 +882,7 @@ static void xen_write_cr0(unsigned long cr0) ...@@ -791,7 +882,7 @@ static void xen_write_cr0(unsigned long cr0)
{ {
struct multicall_space mcs; struct multicall_space mcs;
percpu_write(xen_cr0_value, cr0); this_cpu_write(xen_cr0_value, cr0);
/* Only pay attention to cr0.TS; everything else is /* Only pay attention to cr0.TS; everything else is
ignored. */ ignored. */
......
...@@ -26,7 +26,7 @@ static unsigned long xen_save_fl(void) ...@@ -26,7 +26,7 @@ static unsigned long xen_save_fl(void)
struct vcpu_info *vcpu; struct vcpu_info *vcpu;
unsigned long flags; unsigned long flags;
vcpu = percpu_read(xen_vcpu); vcpu = this_cpu_read(xen_vcpu);
/* flag has opposite sense of mask */ /* flag has opposite sense of mask */
flags = !vcpu->evtchn_upcall_mask; flags = !vcpu->evtchn_upcall_mask;
...@@ -50,7 +50,7 @@ static void xen_restore_fl(unsigned long flags) ...@@ -50,7 +50,7 @@ static void xen_restore_fl(unsigned long flags)
make sure we're don't switch CPUs between getting the vcpu make sure we're don't switch CPUs between getting the vcpu
pointer and updating the mask. */ pointer and updating the mask. */
preempt_disable(); preempt_disable();
vcpu = percpu_read(xen_vcpu); vcpu = this_cpu_read(xen_vcpu);
vcpu->evtchn_upcall_mask = flags; vcpu->evtchn_upcall_mask = flags;
preempt_enable_no_resched(); preempt_enable_no_resched();
...@@ -72,7 +72,7 @@ static void xen_irq_disable(void) ...@@ -72,7 +72,7 @@ static void xen_irq_disable(void)
make sure we're don't switch CPUs between getting the vcpu make sure we're don't switch CPUs between getting the vcpu
pointer and updating the mask. */ pointer and updating the mask. */
preempt_disable(); preempt_disable();
percpu_read(xen_vcpu)->evtchn_upcall_mask = 1; this_cpu_read(xen_vcpu)->evtchn_upcall_mask = 1;
preempt_enable_no_resched(); preempt_enable_no_resched();
} }
PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable); PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable);
...@@ -86,7 +86,7 @@ static void xen_irq_enable(void) ...@@ -86,7 +86,7 @@ static void xen_irq_enable(void)
the caller is confused and is trying to re-enable interrupts the caller is confused and is trying to re-enable interrupts
on an indeterminate processor. */ on an indeterminate processor. */
vcpu = percpu_read(xen_vcpu); vcpu = this_cpu_read(xen_vcpu);
vcpu->evtchn_upcall_mask = 0; vcpu->evtchn_upcall_mask = 0;
/* Doesn't matter if we get preempted here, because any /* Doesn't matter if we get preempted here, because any
......
...@@ -1071,14 +1071,14 @@ static void drop_other_mm_ref(void *info) ...@@ -1071,14 +1071,14 @@ static void drop_other_mm_ref(void *info)
struct mm_struct *mm = info; struct mm_struct *mm = info;
struct mm_struct *active_mm; struct mm_struct *active_mm;
active_mm = percpu_read(cpu_tlbstate.active_mm); active_mm = this_cpu_read(cpu_tlbstate.active_mm);
if (active_mm == mm && percpu_read(cpu_tlbstate.state) != TLBSTATE_OK) if (active_mm == mm && this_cpu_read(cpu_tlbstate.state) != TLBSTATE_OK)
leave_mm(smp_processor_id()); leave_mm(smp_processor_id());
/* If this cpu still has a stale cr3 reference, then make sure /* If this cpu still has a stale cr3 reference, then make sure
it has been flushed. */ it has been flushed. */
if (percpu_read(xen_current_cr3) == __pa(mm->pgd)) if (this_cpu_read(xen_current_cr3) == __pa(mm->pgd))
load_cr3(swapper_pg_dir); load_cr3(swapper_pg_dir);
} }
...@@ -1185,17 +1185,17 @@ static void __init xen_pagetable_setup_done(pgd_t *base) ...@@ -1185,17 +1185,17 @@ static void __init xen_pagetable_setup_done(pgd_t *base)
static void xen_write_cr2(unsigned long cr2) static void xen_write_cr2(unsigned long cr2)
{ {
percpu_read(xen_vcpu)->arch.cr2 = cr2; this_cpu_read(xen_vcpu)->arch.cr2 = cr2;
} }
static unsigned long xen_read_cr2(void) static unsigned long xen_read_cr2(void)
{ {
return percpu_read(xen_vcpu)->arch.cr2; return this_cpu_read(xen_vcpu)->arch.cr2;
} }
unsigned long xen_read_cr2_direct(void) unsigned long xen_read_cr2_direct(void)
{ {
return percpu_read(xen_vcpu_info.arch.cr2); return this_cpu_read(xen_vcpu_info.arch.cr2);
} }
static void xen_flush_tlb(void) static void xen_flush_tlb(void)
...@@ -1278,12 +1278,12 @@ static void xen_flush_tlb_others(const struct cpumask *cpus, ...@@ -1278,12 +1278,12 @@ static void xen_flush_tlb_others(const struct cpumask *cpus,
static unsigned long xen_read_cr3(void) static unsigned long xen_read_cr3(void)
{ {
return percpu_read(xen_cr3); return this_cpu_read(xen_cr3);
} }
static void set_current_cr3(void *v) static void set_current_cr3(void *v)
{ {
percpu_write(xen_current_cr3, (unsigned long)v); this_cpu_write(xen_current_cr3, (unsigned long)v);
} }
static void __xen_write_cr3(bool kernel, unsigned long cr3) static void __xen_write_cr3(bool kernel, unsigned long cr3)
...@@ -1306,7 +1306,7 @@ static void __xen_write_cr3(bool kernel, unsigned long cr3) ...@@ -1306,7 +1306,7 @@ static void __xen_write_cr3(bool kernel, unsigned long cr3)
xen_extend_mmuext_op(&op); xen_extend_mmuext_op(&op);
if (kernel) { if (kernel) {
percpu_write(xen_cr3, cr3); this_cpu_write(xen_cr3, cr3);
/* Update xen_current_cr3 once the batch has actually /* Update xen_current_cr3 once the batch has actually
been submitted. */ been submitted. */
...@@ -1322,7 +1322,7 @@ static void xen_write_cr3(unsigned long cr3) ...@@ -1322,7 +1322,7 @@ static void xen_write_cr3(unsigned long cr3)
/* Update while interrupts are disabled, so its atomic with /* Update while interrupts are disabled, so its atomic with
respect to ipis */ respect to ipis */
percpu_write(xen_cr3, cr3); this_cpu_write(xen_cr3, cr3);
__xen_write_cr3(true, cr3); __xen_write_cr3(true, cr3);
......
...@@ -47,7 +47,7 @@ static inline void xen_mc_issue(unsigned mode) ...@@ -47,7 +47,7 @@ static inline void xen_mc_issue(unsigned mode)
xen_mc_flush(); xen_mc_flush();
/* restore flags saved in xen_mc_batch */ /* restore flags saved in xen_mc_batch */
local_irq_restore(percpu_read(xen_mc_irq_flags)); local_irq_restore(this_cpu_read(xen_mc_irq_flags));
} }
/* Set up a callback to be called when the current batch is flushed */ /* Set up a callback to be called when the current batch is flushed */
......
...@@ -420,7 +420,6 @@ void __init xen_arch_setup(void) ...@@ -420,7 +420,6 @@ void __init xen_arch_setup(void)
boot_cpu_data.hlt_works_ok = 1; boot_cpu_data.hlt_works_ok = 1;
#endif #endif
disable_cpuidle(); disable_cpuidle();
boot_option_idle_override = IDLE_HALT;
WARN_ON(set_pm_idle_to_default()); WARN_ON(set_pm_idle_to_default());
fiddle_vdso(); fiddle_vdso();
} }
...@@ -76,7 +76,7 @@ static void __cpuinit cpu_bringup(void) ...@@ -76,7 +76,7 @@ static void __cpuinit cpu_bringup(void)
xen_setup_cpu_clockevents(); xen_setup_cpu_clockevents();
set_cpu_online(cpu, true); set_cpu_online(cpu, true);
percpu_write(cpu_state, CPU_ONLINE); this_cpu_write(cpu_state, CPU_ONLINE);
wmb(); wmb();
/* We can take interrupts now: we're officially "up". */ /* We can take interrupts now: we're officially "up". */
......
...@@ -558,7 +558,7 @@ config INPUT_CMA3000_I2C ...@@ -558,7 +558,7 @@ config INPUT_CMA3000_I2C
config INPUT_XEN_KBDDEV_FRONTEND config INPUT_XEN_KBDDEV_FRONTEND
tristate "Xen virtual keyboard and mouse support" tristate "Xen virtual keyboard and mouse support"
depends on XEN_FBDEV_FRONTEND depends on XEN
default y default y
select XEN_XENBUS_FRONTEND select XEN_XENBUS_FRONTEND
help help
......
...@@ -3162,6 +3162,31 @@ int __pci_reset_function(struct pci_dev *dev) ...@@ -3162,6 +3162,31 @@ int __pci_reset_function(struct pci_dev *dev)
} }
EXPORT_SYMBOL_GPL(__pci_reset_function); EXPORT_SYMBOL_GPL(__pci_reset_function);
/**
* __pci_reset_function_locked - reset a PCI device function while holding
* the @dev mutex lock.
* @dev: PCI device to reset
*
* Some devices allow an individual function to be reset without affecting
* other functions in the same device. The PCI device must be responsive
* to PCI config space in order to use this function.
*
* The device function is presumed to be unused and the caller is holding
* the device mutex lock when this function is called.
* Resetting the device will make the contents of PCI configuration space
* random, so any caller of this must be prepared to reinitialise the
* device including MSI, bus mastering, BARs, decoding IO and memory spaces,
* etc.
*
* Returns 0 if the device function was successfully reset or negative if the
* device doesn't support resetting a single function.
*/
int __pci_reset_function_locked(struct pci_dev *dev)
{
return pci_dev_reset(dev, 1);
}
EXPORT_SYMBOL_GPL(__pci_reset_function_locked);
/** /**
* pci_probe_reset_function - check whether the device can be safely reset * pci_probe_reset_function - check whether the device can be safely reset
* @dev: PCI device to reset * @dev: PCI device to reset
......
...@@ -66,6 +66,14 @@ config HVC_XEN ...@@ -66,6 +66,14 @@ config HVC_XEN
help help
Xen virtual console device driver Xen virtual console device driver
config HVC_XEN_FRONTEND
bool "Xen Hypervisor Multiple Consoles support"
depends on HVC_XEN
select XEN_XENBUS_FRONTEND
default y
help
Xen driver for secondary virtual consoles
config HVC_UDBG config HVC_UDBG
bool "udbg based fake hypervisor console" bool "udbg based fake hypervisor console"
depends on PPC && EXPERIMENTAL depends on PPC && EXPERIMENTAL
......
This diff is collapsed.
...@@ -2269,6 +2269,7 @@ config XEN_FBDEV_FRONTEND ...@@ -2269,6 +2269,7 @@ config XEN_FBDEV_FRONTEND
select FB_SYS_IMAGEBLIT select FB_SYS_IMAGEBLIT
select FB_SYS_FOPS select FB_SYS_FOPS
select FB_DEFERRED_IO select FB_DEFERRED_IO
select INPUT_XEN_KBDDEV_FRONTEND
select XEN_XENBUS_FRONTEND select XEN_XENBUS_FRONTEND
default y default y
help help
......
...@@ -178,4 +178,21 @@ config XEN_PRIVCMD ...@@ -178,4 +178,21 @@ config XEN_PRIVCMD
depends on XEN depends on XEN
default m default m
config XEN_ACPI_PROCESSOR
tristate "Xen ACPI processor"
depends on XEN && X86 && ACPI_PROCESSOR
default y if (X86_ACPI_CPUFREQ = y || X86_POWERNOW_K8 = y)
default m if (X86_ACPI_CPUFREQ = m || X86_POWERNOW_K8 = m)
help
This ACPI processor uploads Power Management information to the Xen hypervisor.
To do that the driver parses the Power Management data and uploads said
information to the Xen hypervisor. Then the Xen hypervisor can select the
proper Cx and Pxx states. It also registers itslef as the SMM so that
other drivers (such as ACPI cpufreq scaling driver) will not load.
To compile this driver as a module, choose M here: the
module will be called xen_acpi_processor If you do not know what to choose,
select M here. If the CPUFREQ drivers are built in, select Y here.
endmenu endmenu
...@@ -20,7 +20,7 @@ obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o ...@@ -20,7 +20,7 @@ obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o
obj-$(CONFIG_XEN_DOM0) += pci.o obj-$(CONFIG_XEN_DOM0) += pci.o
obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback/ obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback/
obj-$(CONFIG_XEN_PRIVCMD) += xen-privcmd.o obj-$(CONFIG_XEN_PRIVCMD) += xen-privcmd.o
obj-$(CONFIG_XEN_ACPI_PROCESSOR) += xen-acpi-processor.o
xen-evtchn-y := evtchn.o xen-evtchn-y := evtchn.o
xen-gntdev-y := gntdev.o xen-gntdev-y := gntdev.o
xen-gntalloc-y := gntalloc.o xen-gntalloc-y := gntalloc.o
......
...@@ -97,7 +97,7 @@ static struct attribute *version_attrs[] = { ...@@ -97,7 +97,7 @@ static struct attribute *version_attrs[] = {
NULL NULL
}; };
static struct attribute_group version_group = { static const struct attribute_group version_group = {
.name = "version", .name = "version",
.attrs = version_attrs, .attrs = version_attrs,
}; };
...@@ -210,7 +210,7 @@ static struct attribute *xen_compile_attrs[] = { ...@@ -210,7 +210,7 @@ static struct attribute *xen_compile_attrs[] = {
NULL NULL
}; };
static struct attribute_group xen_compilation_group = { static const struct attribute_group xen_compilation_group = {
.name = "compilation", .name = "compilation",
.attrs = xen_compile_attrs, .attrs = xen_compile_attrs,
}; };
...@@ -340,7 +340,7 @@ static struct attribute *xen_properties_attrs[] = { ...@@ -340,7 +340,7 @@ static struct attribute *xen_properties_attrs[] = {
NULL NULL
}; };
static struct attribute_group xen_properties_group = { static const struct attribute_group xen_properties_group = {
.name = "properties", .name = "properties",
.attrs = xen_properties_attrs, .attrs = xen_properties_attrs,
}; };
......
This diff is collapsed.
...@@ -207,7 +207,7 @@ static struct attribute *balloon_info_attrs[] = { ...@@ -207,7 +207,7 @@ static struct attribute *balloon_info_attrs[] = {
NULL NULL
}; };
static struct attribute_group balloon_info_group = { static const struct attribute_group balloon_info_group = {
.name = "info", .name = "info",
.attrs = balloon_info_attrs .attrs = balloon_info_attrs
}; };
......
...@@ -85,19 +85,34 @@ static struct pcistub_device *pcistub_device_alloc(struct pci_dev *dev) ...@@ -85,19 +85,34 @@ static struct pcistub_device *pcistub_device_alloc(struct pci_dev *dev)
static void pcistub_device_release(struct kref *kref) static void pcistub_device_release(struct kref *kref)
{ {
struct pcistub_device *psdev; struct pcistub_device *psdev;
struct xen_pcibk_dev_data *dev_data;
psdev = container_of(kref, struct pcistub_device, kref); psdev = container_of(kref, struct pcistub_device, kref);
dev_data = pci_get_drvdata(psdev->dev);
dev_dbg(&psdev->dev->dev, "pcistub_device_release\n"); dev_dbg(&psdev->dev->dev, "pcistub_device_release\n");
xen_unregister_device_domain_owner(psdev->dev); xen_unregister_device_domain_owner(psdev->dev);
/* Clean-up the device */ /* Call the reset function which does not take lock as this
* is called from "unbind" which takes a device_lock mutex.
*/
__pci_reset_function_locked(psdev->dev);
if (pci_load_and_free_saved_state(psdev->dev,
&dev_data->pci_saved_state)) {
dev_dbg(&psdev->dev->dev, "Could not reload PCI state\n");
} else
pci_restore_state(psdev->dev);
/* Disable the device */
xen_pcibk_reset_device(psdev->dev); xen_pcibk_reset_device(psdev->dev);
kfree(dev_data);
pci_set_drvdata(psdev->dev, NULL);
/* Clean-up the device */
xen_pcibk_config_free_dyn_fields(psdev->dev); xen_pcibk_config_free_dyn_fields(psdev->dev);
xen_pcibk_config_free_dev(psdev->dev); xen_pcibk_config_free_dev(psdev->dev);
kfree(pci_get_drvdata(psdev->dev));
pci_set_drvdata(psdev->dev, NULL);
psdev->dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED; psdev->dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
pci_dev_put(psdev->dev); pci_dev_put(psdev->dev);
...@@ -231,7 +246,17 @@ void pcistub_put_pci_dev(struct pci_dev *dev) ...@@ -231,7 +246,17 @@ void pcistub_put_pci_dev(struct pci_dev *dev)
/* Cleanup our device /* Cleanup our device
* (so it's ready for the next domain) * (so it's ready for the next domain)
*/ */
/* This is OK - we are running from workqueue context
* and want to inhibit the user from fiddling with 'reset'
*/
pci_reset_function(dev);
pci_restore_state(psdev->dev);
/* This disables the device. */
xen_pcibk_reset_device(found_psdev->dev); xen_pcibk_reset_device(found_psdev->dev);
/* And cleanup up our emulated fields. */
xen_pcibk_config_free_dyn_fields(found_psdev->dev); xen_pcibk_config_free_dyn_fields(found_psdev->dev);
xen_pcibk_config_reset_dev(found_psdev->dev); xen_pcibk_config_reset_dev(found_psdev->dev);
...@@ -328,6 +353,16 @@ static int __devinit pcistub_init_device(struct pci_dev *dev) ...@@ -328,6 +353,16 @@ static int __devinit pcistub_init_device(struct pci_dev *dev)
if (err) if (err)
goto config_release; goto config_release;
dev_dbg(&dev->dev, "reseting (FLR, D3, etc) the device\n");
__pci_reset_function_locked(dev);
/* We need the device active to save the state. */
dev_dbg(&dev->dev, "save state of device\n");
pci_save_state(dev);
dev_data->pci_saved_state = pci_store_saved_state(dev);
if (!dev_data->pci_saved_state)
dev_err(&dev->dev, "Could not store PCI conf saved state!\n");
/* Now disable the device (this also ensures some private device /* Now disable the device (this also ensures some private device
* data is setup before we export) * data is setup before we export)
*/ */
......
...@@ -41,6 +41,7 @@ struct xen_pcibk_device { ...@@ -41,6 +41,7 @@ struct xen_pcibk_device {
struct xen_pcibk_dev_data { struct xen_pcibk_dev_data {
struct list_head config_fields; struct list_head config_fields;
struct pci_saved_state *pci_saved_state;
unsigned int permissive:1; unsigned int permissive:1;
unsigned int warned_on_write:1; unsigned int warned_on_write:1;
unsigned int enable_intx:1; unsigned int enable_intx:1;
......
...@@ -488,7 +488,7 @@ static struct attribute *selfballoon_attrs[] = { ...@@ -488,7 +488,7 @@ static struct attribute *selfballoon_attrs[] = {
NULL NULL
}; };
static struct attribute_group selfballoon_group = { static const struct attribute_group selfballoon_group = {
.name = "selfballoon", .name = "selfballoon",
.attrs = selfballoon_attrs .attrs = selfballoon_attrs
}; };
......
...@@ -569,7 +569,7 @@ int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref, ...@@ -569,7 +569,7 @@ int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
{ {
struct gnttab_map_grant_ref op; struct gnttab_map_grant_ref op;
gnttab_set_map_op(&op, (phys_addr_t)vaddr, GNTMAP_host_map, gnt_ref, gnttab_set_map_op(&op, (unsigned long)vaddr, GNTMAP_host_map, gnt_ref,
dev->otherend_id); dev->otherend_id);
if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1)) if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &op, 1))
...@@ -662,7 +662,7 @@ static int xenbus_unmap_ring_vfree_hvm(struct xenbus_device *dev, void *vaddr) ...@@ -662,7 +662,7 @@ static int xenbus_unmap_ring_vfree_hvm(struct xenbus_device *dev, void *vaddr)
goto found; goto found;
} }
} }
node = NULL; node = addr = NULL;
found: found:
spin_unlock(&xenbus_valloc_lock); spin_unlock(&xenbus_valloc_lock);
...@@ -698,7 +698,7 @@ int xenbus_unmap_ring(struct xenbus_device *dev, ...@@ -698,7 +698,7 @@ int xenbus_unmap_ring(struct xenbus_device *dev,
{ {
struct gnttab_unmap_grant_ref op; struct gnttab_unmap_grant_ref op;
gnttab_set_unmap_op(&op, (phys_addr_t)vaddr, GNTMAP_host_map, handle); gnttab_set_unmap_op(&op, (unsigned long)vaddr, GNTMAP_host_map, handle);
if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1)) if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
BUG(); BUG();
......
...@@ -257,11 +257,12 @@ int xenbus_dev_remove(struct device *_dev) ...@@ -257,11 +257,12 @@ int xenbus_dev_remove(struct device *_dev)
DPRINTK("%s", dev->nodename); DPRINTK("%s", dev->nodename);
free_otherend_watch(dev); free_otherend_watch(dev);
free_otherend_details(dev);
if (drv->remove) if (drv->remove)
drv->remove(dev); drv->remove(dev);
free_otherend_details(dev);
xenbus_switch_state(dev, XenbusStateClosed); xenbus_switch_state(dev, XenbusStateClosed);
return 0; return 0;
} }
......
...@@ -53,6 +53,12 @@ static int xenbus_probe_frontend(struct xen_bus_type *bus, const char *type, ...@@ -53,6 +53,12 @@ static int xenbus_probe_frontend(struct xen_bus_type *bus, const char *type,
char *nodename; char *nodename;
int err; int err;
/* ignore console/0 */
if (!strncmp(type, "console", 7) && !strncmp(name, "0", 1)) {
DPRINTK("Ignoring buggy device entry console/0");
return 0;
}
nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", bus->root, type, name); nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", bus->root, type, name);
if (!nodename) if (!nodename)
return -ENOMEM; return -ENOMEM;
......
...@@ -817,6 +817,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq); ...@@ -817,6 +817,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq);
int pcie_get_mps(struct pci_dev *dev); int pcie_get_mps(struct pci_dev *dev);
int pcie_set_mps(struct pci_dev *dev, int mps); int pcie_set_mps(struct pci_dev *dev, int mps);
int __pci_reset_function(struct pci_dev *dev); int __pci_reset_function(struct pci_dev *dev);
int __pci_reset_function_locked(struct pci_dev *dev);
int pci_reset_function(struct pci_dev *dev); int pci_reset_function(struct pci_dev *dev);
void pci_update_resource(struct pci_dev *dev, int resno); void pci_update_resource(struct pci_dev *dev, int resno);
int __must_check pci_assign_resource(struct pci_dev *dev, int i); int __must_check pci_assign_resource(struct pci_dev *dev, int i);
......
...@@ -90,6 +90,10 @@ ...@@ -90,6 +90,10 @@
/* Boolean: Enable aligning all periodic vpts to reduce interrupts */ /* Boolean: Enable aligning all periodic vpts to reduce interrupts */
#define HVM_PARAM_VPT_ALIGN 16 #define HVM_PARAM_VPT_ALIGN 16
#define HVM_NR_PARAMS 17 /* Console debug shared memory ring and event channel */
#define HVM_PARAM_CONSOLE_PFN 17
#define HVM_PARAM_CONSOLE_EVTCHN 18
#define HVM_NR_PARAMS 19
#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
...@@ -145,6 +145,13 @@ struct physdev_manage_pci { ...@@ -145,6 +145,13 @@ struct physdev_manage_pci {
uint8_t devfn; uint8_t devfn;
}; };
#define PHYSDEVOP_restore_msi 19
struct physdev_restore_msi {
/* IN */
uint8_t bus;
uint8_t devfn;
};
#define PHYSDEVOP_manage_pci_add_ext 20 #define PHYSDEVOP_manage_pci_add_ext 20
struct physdev_manage_pci_ext { struct physdev_manage_pci_ext {
/* IN */ /* IN */
......
...@@ -200,7 +200,7 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_getidletime_t); ...@@ -200,7 +200,7 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_getidletime_t);
#define XEN_PM_CX 0 #define XEN_PM_CX 0
#define XEN_PM_PX 1 #define XEN_PM_PX 1
#define XEN_PM_TX 2 #define XEN_PM_TX 2
#define XEN_PM_PDC 3
/* Px sub info type */ /* Px sub info type */
#define XEN_PX_PCT 1 #define XEN_PX_PCT 1
#define XEN_PX_PSS 2 #define XEN_PX_PSS 2
...@@ -293,10 +293,27 @@ struct xenpf_set_processor_pminfo { ...@@ -293,10 +293,27 @@ struct xenpf_set_processor_pminfo {
union { union {
struct xen_processor_power power;/* Cx: _CST/_CSD */ struct xen_processor_power power;/* Cx: _CST/_CSD */
struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */
GUEST_HANDLE(uint32_t) pdc;
}; };
}; };
DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo); DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo);
#define XENPF_get_cpuinfo 55
struct xenpf_pcpuinfo {
/* IN */
uint32_t xen_cpuid;
/* OUT */
/* The maxium cpu_id that is present */
uint32_t max_present;
#define XEN_PCPU_FLAGS_ONLINE 1
/* Correponding xen_cpuid is not present*/
#define XEN_PCPU_FLAGS_INVALID 2
uint32_t flags;
uint32_t apic_id;
uint32_t acpi_id;
};
DEFINE_GUEST_HANDLE_STRUCT(xenpf_pcpuinfo);
struct xen_platform_op { struct xen_platform_op {
uint32_t cmd; uint32_t cmd;
uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
...@@ -312,6 +329,7 @@ struct xen_platform_op { ...@@ -312,6 +329,7 @@ struct xen_platform_op {
struct xenpf_change_freq change_freq; struct xenpf_change_freq change_freq;
struct xenpf_getidletime getidletime; struct xenpf_getidletime getidletime;
struct xenpf_set_processor_pminfo set_pminfo; struct xenpf_set_processor_pminfo set_pminfo;
struct xenpf_pcpuinfo pcpu_info;
uint8_t pad[128]; uint8_t pad[128];
} u; } u;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment