aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/enlighten.c
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2016-08-29 02:48:45 -0400
committerIngo Molnar <mingo@kernel.org>2016-09-05 07:52:40 -0400
commit99bc67536d04bcb9133546284acfb15d033b8bfe (patch)
tree90054328e529dd9267920fa2443c6dfb40e6fce2 /arch/x86/xen/enlighten.c
parentdf8ce9d78a4e7fbe7ddfd8ccee3ecaaa0013e883 (diff)
xen: Add xen_pin_vcpu() to support calling functions on a dedicated pCPU
Some hardware models (e.g. Dell Studio 1555 laptops) require calls to the firmware to be issued on CPU 0 only. As Dom0 might have to use these calls, add xen_pin_vcpu() to achieve this functionality. In case either the domain doesn't have the privilege to make the related hypercall or the hypervisor isn't supporting it, issue a warning once and disable further pinning attempts. Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: David Vrabel <david.vrabel@citrix.com> Cc: Douglas_Warzecha@dell.com Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: akataria@vmware.com Cc: boris.ostrovsky@oracle.com Cc: chrisw@sous-sol.org Cc: hpa@zytor.com Cc: jdelvare@suse.com Cc: jeremy@goop.org Cc: linux@roeck-us.net Cc: pali.rohar@gmail.com Cc: rusty@rustcorp.com.au Cc: virtualization@lists.linux-foundation.org Cc: xen-devel@lists.xenproject.org Link: http://lkml.kernel.org/r/1472453327-19050-5-git-send-email-jgross@suse.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/xen/enlighten.c')
-rw-r--r--arch/x86/xen/enlighten.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index b86ebb1a9a7f..bc9aaba01a22 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1925,6 +1925,45 @@ static void xen_set_cpu_features(struct cpuinfo_x86 *c)
1925 } 1925 }
1926} 1926}
1927 1927
1928static void xen_pin_vcpu(int cpu)
1929{
1930 static bool disable_pinning;
1931 struct sched_pin_override pin_override;
1932 int ret;
1933
1934 if (disable_pinning)
1935 return;
1936
1937 pin_override.pcpu = cpu;
1938 ret = HYPERVISOR_sched_op(SCHEDOP_pin_override, &pin_override);
1939
1940 /* Ignore errors when removing override. */
1941 if (cpu < 0)
1942 return;
1943
1944 switch (ret) {
1945 case -ENOSYS:
1946 pr_warn("Unable to pin on physical cpu %d. In case of problems consider vcpu pinning.\n",
1947 cpu);
1948 disable_pinning = true;
1949 break;
1950 case -EPERM:
1951 WARN(1, "Trying to pin vcpu without having privilege to do so\n");
1952 disable_pinning = true;
1953 break;
1954 case -EINVAL:
1955 case -EBUSY:
1956 pr_warn("Physical cpu %d not available for pinning. Check Xen cpu configuration.\n",
1957 cpu);
1958 break;
1959 case 0:
1960 break;
1961 default:
1962 WARN(1, "rc %d while trying to pin vcpu\n", ret);
1963 disable_pinning = true;
1964 }
1965}
1966
1928const struct hypervisor_x86 x86_hyper_xen = { 1967const struct hypervisor_x86 x86_hyper_xen = {
1929 .name = "Xen", 1968 .name = "Xen",
1930 .detect = xen_platform, 1969 .detect = xen_platform,
@@ -1933,6 +1972,7 @@ const struct hypervisor_x86 x86_hyper_xen = {
1933#endif 1972#endif
1934 .x2apic_available = xen_x2apic_para_available, 1973 .x2apic_available = xen_x2apic_para_available,
1935 .set_cpu_features = xen_set_cpu_features, 1974 .set_cpu_features = xen_set_cpu_features,
1975 .pin_vcpu = xen_pin_vcpu,
1936}; 1976};
1937EXPORT_SYMBOL(x86_hyper_xen); 1977EXPORT_SYMBOL(x86_hyper_xen);
1938 1978