diff --git a/[refs] b/[refs] index 174abdbd54a4..59cf0773b750 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a7be94ac8d69c037d08f0fd94b45a593f1d45176 +refs/heads/master: 9a032e393a8bc888a9b0c898cbdb9db2cee7b536 diff --git a/trunk/arch/x86/xen/enlighten.c b/trunk/arch/x86/xen/enlighten.c index 3aeaa933b527..a90c3bb58bed 100644 --- a/trunk/arch/x86/xen/enlighten.c +++ b/trunk/arch/x86/xen/enlighten.c @@ -223,21 +223,6 @@ static void __init xen_banner(void) version >> 16, version & 0xffff, extra.extraversion, xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); } -/* Check if running on Xen version (major, minor) or later */ -bool -xen_running_on_version_or_later(unsigned int major, unsigned int minor) -{ - unsigned int version; - - if (!xen_domain()) - return false; - - version = HYPERVISOR_xen_version(XENVER_version, NULL); - if ((((version >> 16) == major) && ((version & 0xffff) >= minor)) || - ((version >> 16) > major)) - return true; - return false; -} #define CPUID_THERM_POWER_LEAF 6 #define APERFMPERF_PRESENT 0 @@ -302,7 +287,8 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, static bool __init xen_check_mwait(void) { -#ifdef CONFIG_ACPI +#if defined(CONFIG_ACPI) && !defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) && \ + !defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) struct xen_platform_op op = { .cmd = XENPF_set_processor_pminfo, .u.set_pminfo.id = -1, @@ -323,13 +309,6 @@ static bool __init xen_check_mwait(void) if (!xen_initial_domain()) return false; - /* - * When running under platform earlier than Xen4.2, do not expose - * mwait, to avoid the risk of loading native acpi pad driver - */ - if (!xen_running_on_version_or_later(4, 2)) - return false; - ax = 1; cx = 0; @@ -1578,7 +1557,7 @@ static void __init xen_hvm_init_shared_info(void) static void __init init_hvm_pv_info(void) { - uint32_t ecx, edx, pages, msr, base; + uint32_t eax, ebx, ecx, edx, pages, msr, base; u64 pfn; base = xen_cpuid_base(); diff --git a/trunk/arch/x86/xen/mmu.c b/trunk/arch/x86/xen/mmu.c index 6226c99729b9..0f6386a5b437 100644 --- a/trunk/arch/x86/xen/mmu.c +++ b/trunk/arch/x86/xen/mmu.c @@ -2479,7 +2479,9 @@ static int remap_area_mfn_pte_fn(pte_t *ptep, pgtable_t token, int xen_remap_domain_mfn_range(struct vm_area_struct *vma, unsigned long addr, unsigned long mfn, int nr, - pgprot_t prot, unsigned domid) + pgprot_t prot, unsigned domid, + struct page **pages) + { struct remap_data rmd; struct mmu_update mmu_update[REMAP_BATCH_SIZE]; @@ -2523,3 +2525,14 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma, return err; } EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range); + +/* Returns: 0 success */ +int xen_unmap_domain_mfn_range(struct vm_area_struct *vma, + int numpgs, struct page **pages) +{ + if (!pages || !xen_feature(XENFEAT_auto_translated_physmap)) + return 0; + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range); diff --git a/trunk/drivers/xen/Makefile b/trunk/drivers/xen/Makefile index 3c397170f39c..0e8637035457 100644 --- a/trunk/drivers/xen/Makefile +++ b/trunk/drivers/xen/Makefile @@ -10,8 +10,7 @@ CFLAGS_features.o := $(nostackp) dom0-$(CONFIG_PCI) += pci.o dom0-$(CONFIG_USB_SUPPORT) += dbgp.o -dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y) -xen-pad-$(CONFIG_X86) += xen-acpi-pad.o +dom0-$(CONFIG_ACPI) += acpi.o dom0-$(CONFIG_X86) += pcpu.o obj-$(CONFIG_XEN_DOM0) += $(dom0-y) obj-$(CONFIG_BLOCK) += biomerge.o diff --git a/trunk/drivers/xen/privcmd.c b/trunk/drivers/xen/privcmd.c index 8adb9cc267f9..b612267a8cb6 100644 --- a/trunk/drivers/xen/privcmd.c +++ b/trunk/drivers/xen/privcmd.c @@ -178,7 +178,7 @@ static int mmap_mfn_range(void *data, void *state) msg->va & PAGE_MASK, msg->mfn, msg->npages, vma->vm_page_prot, - st->domain); + st->domain, NULL); if (rc < 0) return rc; @@ -267,7 +267,8 @@ static int mmap_batch_fn(void *data, void *state) int ret; ret = xen_remap_domain_mfn_range(st->vma, st->va & PAGE_MASK, *mfnp, 1, - st->vma->vm_page_prot, st->domain); + st->vma->vm_page_prot, st->domain, + NULL); /* Store error code for second pass. */ *(st->err++) = ret; diff --git a/trunk/drivers/xen/xen-acpi-pad.c b/trunk/drivers/xen/xen-acpi-pad.c deleted file mode 100644 index da39191e7278..000000000000 --- a/trunk/drivers/xen/xen-acpi-pad.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * xen-acpi-pad.c - Xen pad interface - * - * Copyright (c) 2012, Intel Corporation. - * Author: Liu, Jinsong - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#include -#include -#include -#include -#include -#include -#include - -#define ACPI_PROCESSOR_AGGREGATOR_CLASS "acpi_pad" -#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" -#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 -static DEFINE_MUTEX(xen_cpu_lock); - -static int xen_acpi_pad_idle_cpus(unsigned int idle_nums) -{ - struct xen_platform_op op; - - op.cmd = XENPF_core_parking; - op.u.core_parking.type = XEN_CORE_PARKING_SET; - op.u.core_parking.idle_nums = idle_nums; - - return HYPERVISOR_dom0_op(&op); -} - -static int xen_acpi_pad_idle_cpus_num(void) -{ - struct xen_platform_op op; - - op.cmd = XENPF_core_parking; - op.u.core_parking.type = XEN_CORE_PARKING_GET; - - return HYPERVISOR_dom0_op(&op) - ?: op.u.core_parking.idle_nums; -} - -/* - * Query firmware how many CPUs should be idle - * return -1 on failure - */ -static int acpi_pad_pur(acpi_handle handle) -{ - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *package; - int num = -1; - - if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) - return num; - - if (!buffer.length || !buffer.pointer) - return num; - - package = buffer.pointer; - - if (package->type == ACPI_TYPE_PACKAGE && - package->package.count == 2 && - package->package.elements[0].integer.value == 1) /* rev 1 */ - num = package->package.elements[1].integer.value; - - kfree(buffer.pointer); - return num; -} - -/* Notify firmware how many CPUs are idle */ -static void acpi_pad_ost(acpi_handle handle, int stat, - uint32_t idle_nums) -{ - union acpi_object params[3] = { - {.type = ACPI_TYPE_INTEGER,}, - {.type = ACPI_TYPE_INTEGER,}, - {.type = ACPI_TYPE_BUFFER,}, - }; - struct acpi_object_list arg_list = {3, params}; - - params[0].integer.value = ACPI_PROCESSOR_AGGREGATOR_NOTIFY; - params[1].integer.value = stat; - params[2].buffer.length = 4; - params[2].buffer.pointer = (void *)&idle_nums; - acpi_evaluate_object(handle, "_OST", &arg_list, NULL); -} - -static void acpi_pad_handle_notify(acpi_handle handle) -{ - int idle_nums; - - mutex_lock(&xen_cpu_lock); - idle_nums = acpi_pad_pur(handle); - if (idle_nums < 0) { - mutex_unlock(&xen_cpu_lock); - return; - } - - idle_nums = xen_acpi_pad_idle_cpus(idle_nums) - ?: xen_acpi_pad_idle_cpus_num(); - if (idle_nums >= 0) - acpi_pad_ost(handle, 0, idle_nums); - mutex_unlock(&xen_cpu_lock); -} - -static void acpi_pad_notify(acpi_handle handle, u32 event, - void *data) -{ - switch (event) { - case ACPI_PROCESSOR_AGGREGATOR_NOTIFY: - acpi_pad_handle_notify(handle); - break; - default: - pr_warn("Unsupported event [0x%x]\n", event); - break; - } -} - -static int acpi_pad_add(struct acpi_device *device) -{ - acpi_status status; - - strcpy(acpi_device_name(device), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME); - strcpy(acpi_device_class(device), ACPI_PROCESSOR_AGGREGATOR_CLASS); - - status = acpi_install_notify_handler(device->handle, - ACPI_DEVICE_NOTIFY, acpi_pad_notify, device); - if (ACPI_FAILURE(status)) - return -ENODEV; - - return 0; -} - -static int acpi_pad_remove(struct acpi_device *device, - int type) -{ - mutex_lock(&xen_cpu_lock); - xen_acpi_pad_idle_cpus(0); - mutex_unlock(&xen_cpu_lock); - - acpi_remove_notify_handler(device->handle, - ACPI_DEVICE_NOTIFY, acpi_pad_notify); - return 0; -} - -static const struct acpi_device_id pad_device_ids[] = { - {"ACPI000C", 0}, - {"", 0}, -}; - -static struct acpi_driver acpi_pad_driver = { - .name = "processor_aggregator", - .class = ACPI_PROCESSOR_AGGREGATOR_CLASS, - .ids = pad_device_ids, - .ops = { - .add = acpi_pad_add, - .remove = acpi_pad_remove, - }, -}; - -static int __init xen_acpi_pad_init(void) -{ - /* Only DOM0 is responsible for Xen acpi pad */ - if (!xen_initial_domain()) - return -ENODEV; - - /* Only Xen4.2 or later support Xen acpi pad */ - if (!xen_running_on_version_or_later(4, 2)) - return -ENODEV; - - return acpi_bus_register_driver(&acpi_pad_driver); -} -subsys_initcall(xen_acpi_pad_init); diff --git a/trunk/drivers/xen/xenbus/xenbus_xs.c b/trunk/drivers/xen/xenbus/xenbus_xs.c index 88e677b0de74..acedeabe589c 100644 --- a/trunk/drivers/xen/xenbus/xenbus_xs.c +++ b/trunk/drivers/xen/xenbus/xenbus_xs.c @@ -48,6 +48,7 @@ #include #include #include "xenbus_comms.h" +#include struct xs_stored_msg { struct list_head list; diff --git a/trunk/include/xen/interface/platform.h b/trunk/include/xen/interface/platform.h index 5e36932ab407..4755b5fac9c7 100644 --- a/trunk/include/xen/interface/platform.h +++ b/trunk/include/xen/interface/platform.h @@ -324,22 +324,6 @@ struct xenpf_cpu_ol { }; DEFINE_GUEST_HANDLE_STRUCT(xenpf_cpu_ol); -/* - * CMD 58 and 59 are reserved for cpu hotadd and memory hotadd, - * which are already occupied at Xen hypervisor side. - */ -#define XENPF_core_parking 60 -struct xenpf_core_parking { - /* IN variables */ -#define XEN_CORE_PARKING_SET 1 -#define XEN_CORE_PARKING_GET 2 - uint32_t type; - /* IN variables: set cpu nums expected to be idled */ - /* OUT variables: get cpu nums actually be idled */ - uint32_t idle_nums; -}; -DEFINE_GUEST_HANDLE_STRUCT(xenpf_core_parking); - struct xen_platform_op { uint32_t cmd; uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ @@ -357,7 +341,6 @@ struct xen_platform_op { struct xenpf_set_processor_pminfo set_pminfo; struct xenpf_pcpuinfo pcpu_info; struct xenpf_cpu_ol cpu_ol; - struct xenpf_core_parking core_parking; uint8_t pad[128]; } u; }; diff --git a/trunk/include/xen/xen-ops.h b/trunk/include/xen/xen-ops.h index 6170abd53d0b..990b43e441e6 100644 --- a/trunk/include/xen/xen-ops.h +++ b/trunk/include/xen/xen-ops.h @@ -27,7 +27,9 @@ struct vm_area_struct; int xen_remap_domain_mfn_range(struct vm_area_struct *vma, unsigned long addr, unsigned long mfn, int nr, - pgprot_t prot, unsigned domid); + pgprot_t prot, unsigned domid, + struct page **pages); +int xen_unmap_domain_mfn_range(struct vm_area_struct *vma, + int numpgs, struct page **pages); -bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); #endif /* INCLUDE_XEN_OPS_H */