Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-linus-4.8-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen updates from David Vrabel:
"Features and fixes for 4.8-rc0:

- ACPI support for guests on ARM platforms.
- Generic steal time support for arm and x86.
- Support cases where kernel cpu is not Xen VCPU number (e.g., if
in-guest kexec is used).
- Use the system workqueue instead of a custom workqueue in various
places"

* tag 'for-linus-4.8-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: (47 commits)
xen: add static initialization of steal_clock op to xen_time_ops
xen/pvhvm: run xen_vcpu_setup() for the boot CPU
xen/evtchn: use xen_vcpu_id mapping
xen/events: fifo: use xen_vcpu_id mapping
xen/events: use xen_vcpu_id mapping in events_base
x86/xen: use xen_vcpu_id mapping when pointing vcpu_info to shared_info
x86/xen: use xen_vcpu_id mapping for HYPERVISOR_vcpu_op
xen: introduce xen_vcpu_id mapping
x86/acpi: store ACPI ids from MADT for future usage
x86/xen: update cpuid.h from Xen-4.7
xen/evtchn: add IOCTL_EVTCHN_RESTRICT
xen-blkback: really don't leak mode property
xen-blkback: constify instance of "struct attribute_group"
xen-blkfront: prefer xenbus_scanf() over xenbus_gather()
xen-blkback: prefer xenbus_scanf() over xenbus_gather()
xen: support runqueue steal time on xen
arm/xen: add support for vm_assist hypercall
xen: update xen headers
xen-pciback: drop superfluous variables
xen-pciback: short-circuit read path used for merging write values
...

+1150 -493
+35
Documentation/devicetree/bindings/arm/xen.txt
··· 11 11 memory where the grant table should be mapped to, using an 12 12 HYPERVISOR_memory_op hypercall. The memory region is large enough to map 13 13 the whole grant table (it is larger or equal to gnttab_max_grant_frames()). 14 + This property is unnecessary when booting Dom0 using ACPI. 14 15 15 16 - interrupts: the interrupt used by Xen to inject event notifications. 16 17 A GIC node is also required. 18 + This property is unnecessary when booting Dom0 using ACPI. 17 19 20 + To support UEFI on Xen ARM virtual platforms, Xen populates the FDT "uefi" node 21 + under /hypervisor with following parameters: 22 + 23 + ________________________________________________________________________________ 24 + Name | Size | Description 25 + ================================================================================ 26 + xen,uefi-system-table | 64-bit | Guest physical address of the UEFI System 27 + | | Table. 28 + -------------------------------------------------------------------------------- 29 + xen,uefi-mmap-start | 64-bit | Guest physical address of the UEFI memory 30 + | | map. 31 + -------------------------------------------------------------------------------- 32 + xen,uefi-mmap-size | 32-bit | Size in bytes of the UEFI memory map 33 + | | pointed to in previous entry. 34 + -------------------------------------------------------------------------------- 35 + xen,uefi-mmap-desc-size | 32-bit | Size in bytes of each entry in the UEFI 36 + | | memory map. 37 + -------------------------------------------------------------------------------- 38 + xen,uefi-mmap-desc-ver | 32-bit | Version of the mmap descriptor format. 39 + -------------------------------------------------------------------------------- 18 40 19 41 Example (assuming #address-cells = <2> and #size-cells = <2>): 20 42 ··· 44 22 compatible = "xen,xen-4.3", "xen,xen"; 45 23 reg = <0 0xb0000000 0 0x20000>; 46 24 interrupts = <1 15 0xf08>; 25 + uefi { 26 + xen,uefi-system-table = <0xXXXXXXXX>; 27 + xen,uefi-mmap-start = <0xXXXXXXXX>; 28 + xen,uefi-mmap-size = <0xXXXXXXXX>; 29 + xen,uefi-mmap-desc-size = <0xXXXXXXXX>; 30 + xen,uefi-mmap-desc-ver = <0xXXXXXXXX>; 31 + }; 47 32 }; 33 + 34 + The format and meaning of the "xen,uefi-*" parameters are similar to those in 35 + Documentation/arm/uefi.txt, which are provided by the regular UEFI stub. However 36 + they differ because they are provided by the Xen hypervisor, together with a set 37 + of UEFI runtime services implemented via hypercalls, see 38 + http://xenbits.xen.org/docs/unstable/hypercall/x86_64/include,public,platform.h.html.
+1
arch/arm/include/asm/xen/hypercall.h
··· 52 52 int HYPERVISOR_physdev_op(int cmd, void *arg); 53 53 int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args); 54 54 int HYPERVISOR_tmem_op(void *arg); 55 + int HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type); 55 56 int HYPERVISOR_platform_op_raw(void *arg); 56 57 static inline int HYPERVISOR_platform_op(struct xen_platform_op *op) 57 58 {
+6
arch/arm/include/asm/xen/xen-ops.h
··· 1 + #ifndef _ASM_XEN_OPS_H 2 + #define _ASM_XEN_OPS_H 3 + 4 + void xen_efi_runtime_setup(void); 5 + 6 + #endif /* _ASM_XEN_OPS_H */
+1 -1
arch/arm/kernel/setup.c
··· 1064 1064 early_paging_init(mdesc); 1065 1065 #endif 1066 1066 setup_dma_zone(mdesc); 1067 + xen_early_init(); 1067 1068 efi_init(); 1068 1069 sanity_check_meminfo(); 1069 1070 arm_memblock_init(mdesc); ··· 1081 1080 1082 1081 arm_dt_init_cpu_maps(); 1083 1082 psci_dt_init(); 1084 - xen_early_init(); 1085 1083 #ifdef CONFIG_SMP 1086 1084 if (is_smp()) { 1087 1085 if (!mdesc->smp_init || !mdesc->smp_init()) {
+1
arch/arm/xen/Makefile
··· 1 1 obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o 2 + obj-$(CONFIG_XEN_EFI) += efi.o
+40
arch/arm/xen/efi.c
··· 1 + /* 2 + * Copyright (c) 2015, Linaro Limited, Shannon Zhao 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + * 14 + * You should have received a copy of the GNU General Public License along 15 + * with this program. If not, see <http://www.gnu.org/licenses/>. 16 + */ 17 + 18 + #include <linux/efi.h> 19 + #include <xen/xen-ops.h> 20 + #include <asm/xen/xen-ops.h> 21 + 22 + /* Set XEN EFI runtime services function pointers. Other fields of struct efi, 23 + * e.g. efi.systab, will be set like normal EFI. 24 + */ 25 + void __init xen_efi_runtime_setup(void) 26 + { 27 + efi.get_time = xen_efi_get_time; 28 + efi.set_time = xen_efi_set_time; 29 + efi.get_wakeup_time = xen_efi_get_wakeup_time; 30 + efi.set_wakeup_time = xen_efi_set_wakeup_time; 31 + efi.get_variable = xen_efi_get_variable; 32 + efi.get_next_variable = xen_efi_get_next_variable; 33 + efi.set_variable = xen_efi_set_variable; 34 + efi.query_variable_info = xen_efi_query_variable_info; 35 + efi.update_capsule = xen_efi_update_capsule; 36 + efi.query_capsule_caps = xen_efi_query_capsule_caps; 37 + efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; 38 + efi.reset_system = NULL; /* Functionality provided by Xen. */ 39 + } 40 + EXPORT_SYMBOL_GPL(xen_efi_runtime_setup);
+116 -41
arch/arm/xen/enlighten.c
··· 12 12 #include <xen/page.h> 13 13 #include <xen/interface/sched.h> 14 14 #include <xen/xen-ops.h> 15 - #include <asm/paravirt.h> 16 15 #include <asm/xen/hypervisor.h> 17 16 #include <asm/xen/hypercall.h> 17 + #include <asm/xen/xen-ops.h> 18 18 #include <asm/system_misc.h> 19 + #include <asm/efi.h> 19 20 #include <linux/interrupt.h> 20 21 #include <linux/irqreturn.h> 21 22 #include <linux/module.h> 22 23 #include <linux/of.h> 24 + #include <linux/of_fdt.h> 23 25 #include <linux/of_irq.h> 24 26 #include <linux/of_address.h> 25 27 #include <linux/cpuidle.h> ··· 32 30 #include <linux/time64.h> 33 31 #include <linux/timekeeping.h> 34 32 #include <linux/timekeeper_internal.h> 33 + #include <linux/acpi.h> 35 34 36 35 #include <linux/mm.h> 37 36 ··· 49 46 DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); 50 47 static struct vcpu_info __percpu *xen_vcpu_info; 51 48 49 + /* Linux <-> Xen vCPU id mapping */ 50 + DEFINE_PER_CPU(int, xen_vcpu_id) = -1; 51 + EXPORT_PER_CPU_SYMBOL(xen_vcpu_id); 52 + 52 53 /* These are unused until we support booting "pre-ballooned" */ 53 54 unsigned long xen_released_pages; 54 55 struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata; 55 56 56 57 static __read_mostly unsigned int xen_events_irq; 57 - 58 - static __initdata struct device_node *xen_node; 59 58 60 59 int xen_remap_domain_gfn_array(struct vm_area_struct *vma, 61 60 unsigned long addr, ··· 88 83 return xen_xlate_unmap_gfn_range(vma, nr, pages); 89 84 } 90 85 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range); 91 - 92 - static unsigned long long xen_stolen_accounting(int cpu) 93 - { 94 - struct vcpu_runstate_info state; 95 - 96 - BUG_ON(cpu != smp_processor_id()); 97 - 98 - xen_get_runstate_snapshot(&state); 99 - 100 - WARN_ON(state.state != RUNSTATE_running); 101 - 102 - return state.time[RUNSTATE_runnable] + state.time[RUNSTATE_offline]; 103 - } 104 86 105 87 static void xen_read_wallclock(struct timespec64 *ts) 106 88 { ··· 171 179 pr_info("Xen: initializing cpu%d\n", cpu); 172 180 vcpup = per_cpu_ptr(xen_vcpu_info, cpu); 173 181 182 + /* Direct vCPU id mapping for ARM guests. */ 183 + per_cpu(xen_vcpu_id, cpu) = cpu; 184 + 174 185 info.mfn = virt_to_gfn(vcpup); 175 186 info.offset = xen_offset_in_page(vcpup); 176 187 177 - err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, cpu, &info); 188 + err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, xen_vcpu_nr(cpu), 189 + &info); 178 190 BUG_ON(err); 179 191 per_cpu(xen_vcpu, cpu) = vcpup; 180 192 ··· 233 237 return IRQ_HANDLED; 234 238 } 235 239 240 + static __initdata struct { 241 + const char *compat; 242 + const char *prefix; 243 + const char *version; 244 + bool found; 245 + } hyper_node = {"xen,xen", "xen,xen-", NULL, false}; 246 + 247 + static int __init fdt_find_hyper_node(unsigned long node, const char *uname, 248 + int depth, void *data) 249 + { 250 + const void *s = NULL; 251 + int len; 252 + 253 + if (depth != 1 || strcmp(uname, "hypervisor") != 0) 254 + return 0; 255 + 256 + if (of_flat_dt_is_compatible(node, hyper_node.compat)) 257 + hyper_node.found = true; 258 + 259 + s = of_get_flat_dt_prop(node, "compatible", &len); 260 + if (strlen(hyper_node.prefix) + 3 < len && 261 + !strncmp(hyper_node.prefix, s, strlen(hyper_node.prefix))) 262 + hyper_node.version = s + strlen(hyper_node.prefix); 263 + 264 + /* 265 + * Check if Xen supports EFI by checking whether there is the 266 + * "/hypervisor/uefi" node in DT. If so, runtime services are available 267 + * through proxy functions (e.g. in case of Xen dom0 EFI implementation 268 + * they call special hypercall which executes relevant EFI functions) 269 + * and that is why they are always enabled. 270 + */ 271 + if (IS_ENABLED(CONFIG_XEN_EFI)) { 272 + if ((of_get_flat_dt_subnode_by_name(node, "uefi") > 0) && 273 + !efi_runtime_disabled()) 274 + set_bit(EFI_RUNTIME_SERVICES, &efi.flags); 275 + } 276 + 277 + return 0; 278 + } 279 + 236 280 /* 237 281 * see Documentation/devicetree/bindings/arm/xen.txt for the 238 282 * documentation of the Xen Device Tree format. ··· 280 244 #define GRANT_TABLE_PHYSADDR 0 281 245 void __init xen_early_init(void) 282 246 { 283 - int len; 284 - const char *s = NULL; 285 - const char *version = NULL; 286 - const char *xen_prefix = "xen,xen-"; 287 - 288 - xen_node = of_find_compatible_node(NULL, NULL, "xen,xen"); 289 - if (!xen_node) { 247 + of_scan_flat_dt(fdt_find_hyper_node, NULL); 248 + if (!hyper_node.found) { 290 249 pr_debug("No Xen support\n"); 291 250 return; 292 251 } 293 - s = of_get_property(xen_node, "compatible", &len); 294 - if (strlen(xen_prefix) + 3 < len && 295 - !strncmp(xen_prefix, s, strlen(xen_prefix))) 296 - version = s + strlen(xen_prefix); 297 - if (version == NULL) { 252 + 253 + if (hyper_node.version == NULL) { 298 254 pr_debug("Xen version not found\n"); 299 255 return; 300 256 } 301 257 302 - pr_info("Xen %s support found\n", version); 258 + pr_info("Xen %s support found\n", hyper_node.version); 303 259 304 260 xen_domain_type = XEN_HVM_DOMAIN; 305 261 ··· 306 278 add_preferred_console("hvc", 0, NULL); 307 279 } 308 280 281 + static void __init xen_acpi_guest_init(void) 282 + { 283 + #ifdef CONFIG_ACPI 284 + struct xen_hvm_param a; 285 + int interrupt, trigger, polarity; 286 + 287 + a.domid = DOMID_SELF; 288 + a.index = HVM_PARAM_CALLBACK_IRQ; 289 + 290 + if (HYPERVISOR_hvm_op(HVMOP_get_param, &a) 291 + || (a.value >> 56) != HVM_PARAM_CALLBACK_TYPE_PPI) { 292 + xen_events_irq = 0; 293 + return; 294 + } 295 + 296 + interrupt = a.value & 0xff; 297 + trigger = ((a.value >> 8) & 0x1) ? ACPI_EDGE_SENSITIVE 298 + : ACPI_LEVEL_SENSITIVE; 299 + polarity = ((a.value >> 8) & 0x2) ? ACPI_ACTIVE_LOW 300 + : ACPI_ACTIVE_HIGH; 301 + xen_events_irq = acpi_register_gsi(NULL, interrupt, trigger, polarity); 302 + #endif 303 + } 304 + 305 + static void __init xen_dt_guest_init(void) 306 + { 307 + struct device_node *xen_node; 308 + 309 + xen_node = of_find_compatible_node(NULL, NULL, "xen,xen"); 310 + if (!xen_node) { 311 + pr_err("Xen support was detected before, but it has disappeared\n"); 312 + return; 313 + } 314 + 315 + xen_events_irq = irq_of_parse_and_map(xen_node, 0); 316 + } 317 + 309 318 static int __init xen_guest_init(void) 310 319 { 311 320 struct xen_add_to_physmap xatp; 312 321 struct shared_info *shared_info_page = NULL; 313 - struct resource res; 314 - phys_addr_t grant_frames; 315 322 316 323 if (!xen_domain()) 317 324 return 0; 318 325 319 - if (of_address_to_resource(xen_node, GRANT_TABLE_PHYSADDR, &res)) { 320 - pr_err("Xen grant table base address not found\n"); 321 - return -ENODEV; 322 - } 323 - grant_frames = res.start; 326 + if (!acpi_disabled) 327 + xen_acpi_guest_init(); 328 + else 329 + xen_dt_guest_init(); 324 330 325 - xen_events_irq = irq_of_parse_and_map(xen_node, 0); 326 331 if (!xen_events_irq) { 327 332 pr_err("Xen event channel interrupt not found\n"); 328 333 return -ENODEV; 329 334 } 335 + 336 + /* 337 + * The fdt parsing codes have set EFI_RUNTIME_SERVICES if Xen EFI 338 + * parameters are found. Force enable runtime services. 339 + */ 340 + if (efi_enabled(EFI_RUNTIME_SERVICES)) 341 + xen_efi_runtime_setup(); 330 342 331 343 shared_info_page = (struct shared_info *)get_zeroed_page(GFP_KERNEL); 332 344 ··· 396 328 if (xen_vcpu_info == NULL) 397 329 return -ENOMEM; 398 330 399 - if (gnttab_setup_auto_xlat_frames(grant_frames)) { 331 + /* Direct vCPU id mapping for ARM guests. */ 332 + per_cpu(xen_vcpu_id, 0) = 0; 333 + 334 + xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames(); 335 + if (xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn, 336 + &xen_auto_xlat_grant_frames.vaddr, 337 + xen_auto_xlat_grant_frames.count)) { 400 338 free_percpu(xen_vcpu_info); 401 339 return -ENOMEM; 402 340 } ··· 429 355 430 356 register_cpu_notifier(&xen_cpu_notifier); 431 357 432 - pv_time_ops.steal_clock = xen_stolen_accounting; 433 - static_key_slow_inc(&paravirt_steal_enabled); 358 + xen_time_setup_guest(); 359 + 434 360 if (xen_initial_domain()) 435 361 pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier); 436 362 ··· 477 403 EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op); 478 404 EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op); 479 405 EXPORT_SYMBOL_GPL(HYPERVISOR_multicall); 406 + EXPORT_SYMBOL_GPL(HYPERVISOR_vm_assist); 480 407 EXPORT_SYMBOL_GPL(privcmd_call);
+1
arch/arm/xen/hypercall.S
··· 91 91 HYPERCALL1(tmem_op); 92 92 HYPERCALL1(platform_op_raw); 93 93 HYPERCALL2(multicall); 94 + HYPERCALL2(vm_assist); 94 95 95 96 ENTRY(privcmd_call) 96 97 stmdb sp!, {r4}
+6
arch/arm64/include/asm/xen/xen-ops.h
··· 1 + #ifndef _ASM_XEN_OPS_H 2 + #define _ASM_XEN_OPS_H 3 + 4 + void xen_efi_runtime_setup(void); 5 + 6 + #endif /* _ASM_XEN_OPS_H */
+1 -2
arch/arm64/kernel/setup.c
··· 257 257 */ 258 258 cpu_uninstall_idmap(); 259 259 260 + xen_early_init(); 260 261 efi_init(); 261 262 arm64_memblock_init(); 262 263 ··· 283 282 psci_dt_init(); 284 283 else 285 284 psci_acpi_init(); 286 - 287 - xen_early_init(); 288 285 289 286 cpu_read_bootcpu_ops(); 290 287 smp_init_cpus();
+1
arch/arm64/xen/Makefile
··· 1 1 xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o) 2 2 obj-y := xen-arm.o hypercall.o 3 + obj-$(CONFIG_XEN_EFI) += $(addprefix ../../arm/xen/, efi.o)
+1
arch/arm64/xen/hypercall.S
··· 82 82 HYPERCALL1(tmem_op); 83 83 HYPERCALL1(platform_op_raw); 84 84 HYPERCALL2(multicall); 85 + HYPERCALL2(vm_assist); 85 86 86 87 ENTRY(privcmd_call) 87 88 mov x16, x0
+1
arch/x86/include/asm/cpu.h
··· 16 16 static inline void prefill_possible_map(void) {} 17 17 18 18 #define cpu_physical_id(cpu) boot_cpu_physical_apicid 19 + #define cpu_acpi_id(cpu) 0 19 20 #define safe_smp_processor_id() 0 20 21 21 22 #endif /* CONFIG_SMP */
+2
arch/x86/include/asm/smp.h
··· 33 33 } 34 34 35 35 DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_cpu_to_apicid); 36 + DECLARE_EARLY_PER_CPU_READ_MOSTLY(u32, x86_cpu_to_acpiid); 36 37 DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_bios_cpu_apicid); 37 38 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) 38 39 DECLARE_EARLY_PER_CPU_READ_MOSTLY(int, x86_cpu_to_logical_apicid); ··· 149 148 void smp_store_boot_cpu_info(void); 150 149 void smp_store_cpu_info(int id); 151 150 #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) 151 + #define cpu_acpi_id(cpu) per_cpu(x86_cpu_to_acpiid, cpu) 152 152 153 153 #else /* !CONFIG_SMP */ 154 154 #define wbinvd_on_cpu(cpu) wbinvd()
+4 -1
arch/x86/include/asm/xen/cpuid.h
··· 76 76 /* 77 77 * Leaf 5 (0x40000x04) 78 78 * HVM-specific features 79 + * EAX: Features 80 + * EBX: vcpu id (iff EAX has XEN_HVM_CPUID_VCPU_ID_PRESENT flag) 79 81 */ 80 82 81 - /* EAX Features */ 82 83 /* Virtualized APIC registers */ 83 84 #define XEN_HVM_CPUID_APIC_ACCESS_VIRT (1u << 0) 84 85 /* Virtualized x2APIC accesses */ 85 86 #define XEN_HVM_CPUID_X2APIC_VIRT (1u << 1) 86 87 /* Memory mapped from other domains has valid IOMMU entries */ 87 88 #define XEN_HVM_CPUID_IOMMU_MAPPINGS (1u << 2) 89 + /* vcpu id is present in EBX */ 90 + #define XEN_HVM_CPUID_VCPU_ID_PRESENT (1u << 3) 88 91 89 92 #define XEN_CPUID_MAX_NUM_LEAVES 4 90 93
+12 -4
arch/x86/kernel/acpi/boot.c
··· 161 161 /** 162 162 * acpi_register_lapic - register a local apic and generates a logic cpu number 163 163 * @id: local apic id to register 164 + * @acpiid: ACPI id to register 164 165 * @enabled: this cpu is enabled or not 165 166 * 166 167 * Returns the logic cpu number which maps to the local apic 167 168 */ 168 - static int acpi_register_lapic(int id, u8 enabled) 169 + static int acpi_register_lapic(int id, u32 acpiid, u8 enabled) 169 170 { 170 171 unsigned int ver = 0; 172 + int cpu; 171 173 172 174 if (id >= MAX_LOCAL_APIC) { 173 175 printk(KERN_INFO PREFIX "skipped apicid that is too big\n"); ··· 184 182 if (boot_cpu_physical_apicid != -1U) 185 183 ver = apic_version[boot_cpu_physical_apicid]; 186 184 187 - return generic_processor_info(id, ver); 185 + cpu = generic_processor_info(id, ver); 186 + if (cpu >= 0) 187 + early_per_cpu(x86_cpu_to_acpiid, cpu) = acpiid; 188 + 189 + return cpu; 188 190 } 189 191 190 192 static int __init ··· 218 212 if (!apic->apic_id_valid(apic_id) && enabled) 219 213 printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); 220 214 else 221 - acpi_register_lapic(apic_id, enabled); 215 + acpi_register_lapic(apic_id, processor->uid, enabled); 222 216 #else 223 217 printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); 224 218 #endif ··· 246 240 * when we use CPU hotplug. 247 241 */ 248 242 acpi_register_lapic(processor->id, /* APIC ID */ 243 + processor->processor_id, /* ACPI ID */ 249 244 processor->lapic_flags & ACPI_MADT_ENABLED); 250 245 251 246 return 0; ··· 265 258 acpi_table_print_madt_entry(header); 266 259 267 260 acpi_register_lapic((processor->id << 8) | processor->eid,/* APIC ID */ 261 + processor->processor_id, /* ACPI ID */ 268 262 processor->lapic_flags & ACPI_MADT_ENABLED); 269 263 270 264 return 0; ··· 722 714 { 723 715 int cpu; 724 716 725 - cpu = acpi_register_lapic(physid, ACPI_MADT_ENABLED); 717 + cpu = acpi_register_lapic(physid, U32_MAX, ACPI_MADT_ENABLED); 726 718 if (cpu < 0) { 727 719 pr_info(PREFIX "Unable to map lapic to logical cpu number\n"); 728 720 return cpu;
+2
arch/x86/kernel/apic/apic.c
··· 92 92 */ 93 93 DEFINE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_cpu_to_apicid, BAD_APICID); 94 94 DEFINE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_bios_cpu_apicid, BAD_APICID); 95 + DEFINE_EARLY_PER_CPU_READ_MOSTLY(u32, x86_cpu_to_acpiid, U32_MAX); 95 96 EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_apicid); 96 97 EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid); 98 + EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_acpiid); 97 99 98 100 #ifdef CONFIG_X86_32 99 101
+3
arch/x86/kernel/setup_percpu.c
··· 236 236 early_per_cpu_map(x86_cpu_to_apicid, cpu); 237 237 per_cpu(x86_bios_cpu_apicid, cpu) = 238 238 early_per_cpu_map(x86_bios_cpu_apicid, cpu); 239 + per_cpu(x86_cpu_to_acpiid, cpu) = 240 + early_per_cpu_map(x86_cpu_to_acpiid, cpu); 239 241 #endif 240 242 #ifdef CONFIG_X86_32 241 243 per_cpu(x86_cpu_to_logical_apicid, cpu) = ··· 273 271 #ifdef CONFIG_X86_LOCAL_APIC 274 272 early_per_cpu_ptr(x86_cpu_to_apicid) = NULL; 275 273 early_per_cpu_ptr(x86_bios_cpu_apicid) = NULL; 274 + early_per_cpu_ptr(x86_cpu_to_acpiid) = NULL; 276 275 #endif 277 276 #ifdef CONFIG_X86_32 278 277 early_per_cpu_ptr(x86_cpu_to_logical_apicid) = NULL;
+111
arch/x86/xen/efi.c
··· 20 20 #include <linux/init.h> 21 21 #include <linux/string.h> 22 22 23 + #include <xen/xen.h> 23 24 #include <xen/xen-ops.h> 25 + #include <xen/interface/platform.h> 24 26 25 27 #include <asm/page.h> 26 28 #include <asm/setup.h> 29 + #include <asm/xen/hypercall.h> 30 + 31 + static efi_char16_t vendor[100] __initdata; 32 + 33 + static efi_system_table_t efi_systab_xen __initdata = { 34 + .hdr = { 35 + .signature = EFI_SYSTEM_TABLE_SIGNATURE, 36 + .revision = 0, /* Initialized later. */ 37 + .headersize = 0, /* Ignored by Linux Kernel. */ 38 + .crc32 = 0, /* Ignored by Linux Kernel. */ 39 + .reserved = 0 40 + }, 41 + .fw_vendor = EFI_INVALID_TABLE_ADDR, /* Initialized later. */ 42 + .fw_revision = 0, /* Initialized later. */ 43 + .con_in_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 44 + .con_in = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 45 + .con_out_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 46 + .con_out = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 47 + .stderr_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 48 + .stderr = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 49 + .runtime = (efi_runtime_services_t *)EFI_INVALID_TABLE_ADDR, 50 + /* Not used under Xen. */ 51 + .boottime = (efi_boot_services_t *)EFI_INVALID_TABLE_ADDR, 52 + /* Not used under Xen. */ 53 + .nr_tables = 0, /* Initialized later. */ 54 + .tables = EFI_INVALID_TABLE_ADDR /* Initialized later. */ 55 + }; 56 + 57 + static const struct efi efi_xen __initconst = { 58 + .systab = NULL, /* Initialized later. */ 59 + .runtime_version = 0, /* Initialized later. */ 60 + .mps = EFI_INVALID_TABLE_ADDR, 61 + .acpi = EFI_INVALID_TABLE_ADDR, 62 + .acpi20 = EFI_INVALID_TABLE_ADDR, 63 + .smbios = EFI_INVALID_TABLE_ADDR, 64 + .smbios3 = EFI_INVALID_TABLE_ADDR, 65 + .sal_systab = EFI_INVALID_TABLE_ADDR, 66 + .boot_info = EFI_INVALID_TABLE_ADDR, 67 + .hcdp = EFI_INVALID_TABLE_ADDR, 68 + .uga = EFI_INVALID_TABLE_ADDR, 69 + .uv_systab = EFI_INVALID_TABLE_ADDR, 70 + .fw_vendor = EFI_INVALID_TABLE_ADDR, 71 + .runtime = EFI_INVALID_TABLE_ADDR, 72 + .config_table = EFI_INVALID_TABLE_ADDR, 73 + .get_time = xen_efi_get_time, 74 + .set_time = xen_efi_set_time, 75 + .get_wakeup_time = xen_efi_get_wakeup_time, 76 + .set_wakeup_time = xen_efi_set_wakeup_time, 77 + .get_variable = xen_efi_get_variable, 78 + .get_next_variable = xen_efi_get_next_variable, 79 + .set_variable = xen_efi_set_variable, 80 + .query_variable_info = xen_efi_query_variable_info, 81 + .update_capsule = xen_efi_update_capsule, 82 + .query_capsule_caps = xen_efi_query_capsule_caps, 83 + .get_next_high_mono_count = xen_efi_get_next_high_mono_count, 84 + .reset_system = NULL, /* Functionality provided by Xen. */ 85 + .set_virtual_address_map = NULL, /* Not used under Xen. */ 86 + .flags = 0 /* Initialized later. */ 87 + }; 88 + 89 + static efi_system_table_t __init *xen_efi_probe(void) 90 + { 91 + struct xen_platform_op op = { 92 + .cmd = XENPF_firmware_info, 93 + .u.firmware_info = { 94 + .type = XEN_FW_EFI_INFO, 95 + .index = XEN_FW_EFI_CONFIG_TABLE 96 + } 97 + }; 98 + union xenpf_efi_info *info = &op.u.firmware_info.u.efi_info; 99 + 100 + if (!xen_initial_domain() || HYPERVISOR_platform_op(&op) < 0) 101 + return NULL; 102 + 103 + /* Here we know that Xen runs on EFI platform. */ 104 + 105 + efi = efi_xen; 106 + 107 + efi_systab_xen.tables = info->cfg.addr; 108 + efi_systab_xen.nr_tables = info->cfg.nent; 109 + 110 + op.cmd = XENPF_firmware_info; 111 + op.u.firmware_info.type = XEN_FW_EFI_INFO; 112 + op.u.firmware_info.index = XEN_FW_EFI_VENDOR; 113 + info->vendor.bufsz = sizeof(vendor); 114 + set_xen_guest_handle(info->vendor.name, vendor); 115 + 116 + if (HYPERVISOR_platform_op(&op) == 0) { 117 + efi_systab_xen.fw_vendor = __pa_symbol(vendor); 118 + efi_systab_xen.fw_revision = info->vendor.revision; 119 + } else 120 + efi_systab_xen.fw_vendor = __pa_symbol(L"UNKNOWN"); 121 + 122 + op.cmd = XENPF_firmware_info; 123 + op.u.firmware_info.type = XEN_FW_EFI_INFO; 124 + op.u.firmware_info.index = XEN_FW_EFI_VERSION; 125 + 126 + if (HYPERVISOR_platform_op(&op) == 0) 127 + efi_systab_xen.hdr.revision = info->version; 128 + 129 + op.cmd = XENPF_firmware_info; 130 + op.u.firmware_info.type = XEN_FW_EFI_INFO; 131 + op.u.firmware_info.index = XEN_FW_EFI_RT_VERSION; 132 + 133 + if (HYPERVISOR_platform_op(&op) == 0) 134 + efi.runtime_version = info->version; 135 + 136 + return &efi_systab_xen; 137 + } 27 138 28 139 void __init xen_efi_init(void) 29 140 {
+37 -12
arch/x86/xen/enlighten.c
··· 59 59 #include <asm/xen/pci.h> 60 60 #include <asm/xen/hypercall.h> 61 61 #include <asm/xen/hypervisor.h> 62 + #include <asm/xen/cpuid.h> 62 63 #include <asm/fixmap.h> 63 64 #include <asm/processor.h> 64 65 #include <asm/proto.h> ··· 118 117 * overrides the default per_cpu(xen_vcpu, cpu) value. 119 118 */ 120 119 DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info); 120 + 121 + /* Linux <-> Xen vCPU id mapping */ 122 + DEFINE_PER_CPU(int, xen_vcpu_id) = -1; 123 + EXPORT_PER_CPU_SYMBOL(xen_vcpu_id); 121 124 122 125 enum xen_domain_type xen_domain_type = XEN_NATIVE; 123 126 EXPORT_SYMBOL_GPL(xen_domain_type); ··· 184 179 #endif 185 180 } 186 181 187 - static void xen_vcpu_setup(int cpu) 182 + void xen_vcpu_setup(int cpu) 188 183 { 189 184 struct vcpu_register_vcpu_info info; 190 185 int err; ··· 207 202 if (per_cpu(xen_vcpu, cpu) == &per_cpu(xen_vcpu_info, cpu)) 208 203 return; 209 204 } 210 - if (cpu < MAX_VIRT_CPUS) 211 - per_cpu(xen_vcpu,cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; 205 + if (xen_vcpu_nr(cpu) < MAX_VIRT_CPUS) 206 + per_cpu(xen_vcpu, cpu) = 207 + &HYPERVISOR_shared_info->vcpu_info[xen_vcpu_nr(cpu)]; 212 208 213 209 if (!have_vcpu_info_placement) { 214 210 if (cpu >= MAX_VIRT_CPUS) ··· 229 223 hypervisor has no unregister variant and this hypercall does not 230 224 allow to over-write info.mfn and info.offset. 231 225 */ 232 - err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, cpu, &info); 226 + err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, xen_vcpu_nr(cpu), 227 + &info); 233 228 234 229 if (err) { 235 230 printk(KERN_DEBUG "register_vcpu_info failed: err=%d\n", err); ··· 254 247 255 248 for_each_possible_cpu(cpu) { 256 249 bool other_cpu = (cpu != smp_processor_id()); 257 - bool is_up = HYPERVISOR_vcpu_op(VCPUOP_is_up, cpu, NULL); 250 + bool is_up = HYPERVISOR_vcpu_op(VCPUOP_is_up, xen_vcpu_nr(cpu), 251 + NULL); 258 252 259 253 if (other_cpu && is_up && 260 - HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL)) 254 + HYPERVISOR_vcpu_op(VCPUOP_down, xen_vcpu_nr(cpu), NULL)) 261 255 BUG(); 262 256 263 257 xen_setup_runstate_info(cpu); ··· 267 259 xen_vcpu_setup(cpu); 268 260 269 261 if (other_cpu && is_up && 270 - HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL)) 262 + HYPERVISOR_vcpu_op(VCPUOP_up, xen_vcpu_nr(cpu), NULL)) 271 263 BUG(); 272 264 } 273 265 } ··· 596 588 { 597 589 unsigned long va = dtr->address; 598 590 unsigned int size = dtr->size + 1; 599 - unsigned pages = (size + PAGE_SIZE - 1) / PAGE_SIZE; 591 + unsigned pages = DIV_ROUND_UP(size, PAGE_SIZE); 600 592 unsigned long frames[pages]; 601 593 int f; 602 594 ··· 645 637 { 646 638 unsigned long va = dtr->address; 647 639 unsigned int size = dtr->size + 1; 648 - unsigned pages = (size + PAGE_SIZE - 1) / PAGE_SIZE; 640 + unsigned pages = DIV_ROUND_UP(size, PAGE_SIZE); 649 641 unsigned long frames[pages]; 650 642 int f; 651 643 ··· 1143 1135 { 1144 1136 int cpu; 1145 1137 1146 - for_each_possible_cpu(cpu) 1138 + for_each_possible_cpu(cpu) { 1139 + /* Set up direct vCPU id mapping for PV guests. */ 1140 + per_cpu(xen_vcpu_id, cpu) = cpu; 1147 1141 xen_vcpu_setup(cpu); 1142 + } 1148 1143 1149 1144 /* xen_vcpu_setup managed to place the vcpu_info within the 1150 1145 * percpu area for all cpus, so make use of it. Note that for ··· 1738 1727 #endif 1739 1728 xen_raw_console_write("about to get started...\n"); 1740 1729 1730 + /* Let's presume PV guests always boot on vCPU with id 0. */ 1731 + per_cpu(xen_vcpu_id, 0) = 0; 1732 + 1741 1733 xen_setup_runstate_info(0); 1742 1734 1743 1735 xen_efi_init(); ··· 1782 1768 * in that case multiple vcpus might be online. */ 1783 1769 for_each_online_cpu(cpu) { 1784 1770 /* Leave it to be NULL. */ 1785 - if (cpu >= MAX_VIRT_CPUS) 1771 + if (xen_vcpu_nr(cpu) >= MAX_VIRT_CPUS) 1786 1772 continue; 1787 - per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; 1773 + per_cpu(xen_vcpu, cpu) = 1774 + &HYPERVISOR_shared_info->vcpu_info[xen_vcpu_nr(cpu)]; 1788 1775 } 1789 1776 } 1790 1777 ··· 1810 1795 1811 1796 xen_setup_features(); 1812 1797 1798 + cpuid(base + 4, &eax, &ebx, &ecx, &edx); 1799 + if (eax & XEN_HVM_CPUID_VCPU_ID_PRESENT) 1800 + this_cpu_write(xen_vcpu_id, ebx); 1801 + else 1802 + this_cpu_write(xen_vcpu_id, smp_processor_id()); 1803 + 1813 1804 pv_info.name = "Xen HVM"; 1814 1805 1815 1806 xen_domain_type = XEN_HVM_DOMAIN; ··· 1827 1806 int cpu = (long)hcpu; 1828 1807 switch (action) { 1829 1808 case CPU_UP_PREPARE: 1809 + if (cpu_acpi_id(cpu) != U32_MAX) 1810 + per_cpu(xen_vcpu_id, cpu) = cpu_acpi_id(cpu); 1811 + else 1812 + per_cpu(xen_vcpu_id, cpu) = cpu; 1830 1813 xen_vcpu_setup(cpu); 1831 1814 if (xen_have_vector_callback) { 1832 1815 if (xen_feature(XENFEAT_hvm_safe_pvclock))
+6 -51
arch/x86/xen/grant-table.c
··· 111 111 } 112 112 113 113 #ifdef CONFIG_XEN_PVH 114 - #include <xen/balloon.h> 115 114 #include <xen/events.h> 116 - #include <linux/slab.h> 117 - static int __init xlated_setup_gnttab_pages(void) 118 - { 119 - struct page **pages; 120 - xen_pfn_t *pfns; 121 - void *vaddr; 122 - int rc; 123 - unsigned int i; 124 - unsigned long nr_grant_frames = gnttab_max_grant_frames(); 125 - 126 - BUG_ON(nr_grant_frames == 0); 127 - pages = kcalloc(nr_grant_frames, sizeof(pages[0]), GFP_KERNEL); 128 - if (!pages) 129 - return -ENOMEM; 130 - 131 - pfns = kcalloc(nr_grant_frames, sizeof(pfns[0]), GFP_KERNEL); 132 - if (!pfns) { 133 - kfree(pages); 134 - return -ENOMEM; 135 - } 136 - rc = alloc_xenballooned_pages(nr_grant_frames, pages); 137 - if (rc) { 138 - pr_warn("%s Couldn't balloon alloc %ld pfns rc:%d\n", __func__, 139 - nr_grant_frames, rc); 140 - kfree(pages); 141 - kfree(pfns); 142 - return rc; 143 - } 144 - for (i = 0; i < nr_grant_frames; i++) 145 - pfns[i] = page_to_pfn(pages[i]); 146 - 147 - vaddr = vmap(pages, nr_grant_frames, 0, PAGE_KERNEL); 148 - if (!vaddr) { 149 - pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__, 150 - nr_grant_frames, rc); 151 - free_xenballooned_pages(nr_grant_frames, pages); 152 - kfree(pages); 153 - kfree(pfns); 154 - return -ENOMEM; 155 - } 156 - kfree(pages); 157 - 158 - xen_auto_xlat_grant_frames.pfn = pfns; 159 - xen_auto_xlat_grant_frames.count = nr_grant_frames; 160 - xen_auto_xlat_grant_frames.vaddr = vaddr; 161 - 162 - return 0; 163 - } 164 - 115 + #include <xen/xen-ops.h> 165 116 static int __init xen_pvh_gnttab_setup(void) 166 117 { 167 118 if (!xen_pvh_domain()) 168 119 return -ENODEV; 169 120 170 - return xlated_setup_gnttab_pages(); 121 + xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames(); 122 + 123 + return xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn, 124 + &xen_auto_xlat_grant_frames.vaddr, 125 + xen_auto_xlat_grant_frames.count); 171 126 } 172 127 /* Call it _before_ __gnttab_init as we need to initialize the 173 128 * xen_auto_xlat_grant_frames first. */
+2 -1
arch/x86/xen/irq.c
··· 109 109 static void xen_halt(void) 110 110 { 111 111 if (irqs_disabled()) 112 - HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); 112 + HYPERVISOR_vcpu_op(VCPUOP_down, 113 + xen_vcpu_nr(smp_processor_id()), NULL); 113 114 else 114 115 xen_safe_halt(); 115 116 }
+1 -1
arch/x86/xen/pmu.c
··· 547 547 return; 548 548 549 549 fail: 550 - pr_warn_once("Could not initialize VPMU for cpu %d, error %d\n", 550 + pr_info_once("Could not initialize VPMU for cpu %d, error %d\n", 551 551 cpu, err); 552 552 free_pages((unsigned long)xenpmu_data, 0); 553 553 }
+13 -5
arch/x86/xen/smp.c
··· 322 322 xen_filter_cpu_maps(); 323 323 xen_setup_vcpu_info_placement(); 324 324 } 325 + 326 + /* 327 + * Setup vcpu_info for boot CPU. 328 + */ 329 + if (xen_hvm_domain()) 330 + xen_vcpu_setup(0); 331 + 325 332 /* 326 333 * The alternative logic (which patches the unlock/lock) runs before 327 334 * the smp bootup up code is activated. Hence we need to set this up ··· 461 454 #endif 462 455 ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs); 463 456 ctxt->ctrlreg[3] = xen_pfn_to_cr3(virt_to_gfn(swapper_pg_dir)); 464 - if (HYPERVISOR_vcpu_op(VCPUOP_initialise, cpu, ctxt)) 457 + if (HYPERVISOR_vcpu_op(VCPUOP_initialise, xen_vcpu_nr(cpu), ctxt)) 465 458 BUG(); 466 459 467 460 kfree(ctxt); ··· 499 492 if (rc) 500 493 return rc; 501 494 502 - rc = HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL); 495 + rc = HYPERVISOR_vcpu_op(VCPUOP_up, xen_vcpu_nr(cpu), NULL); 503 496 BUG_ON(rc); 504 497 505 498 while (cpu_report_state(cpu) != CPU_ONLINE) ··· 527 520 528 521 static void xen_cpu_die(unsigned int cpu) 529 522 { 530 - while (xen_pv_domain() && HYPERVISOR_vcpu_op(VCPUOP_is_up, cpu, NULL)) { 523 + while (xen_pv_domain() && HYPERVISOR_vcpu_op(VCPUOP_is_up, 524 + xen_vcpu_nr(cpu), NULL)) { 531 525 __set_current_state(TASK_UNINTERRUPTIBLE); 532 526 schedule_timeout(HZ/10); 533 527 } ··· 544 536 static void xen_play_dead(void) /* used only with HOTPLUG_CPU */ 545 537 { 546 538 play_dead_common(); 547 - HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); 539 + HYPERVISOR_vcpu_op(VCPUOP_down, xen_vcpu_nr(smp_processor_id()), NULL); 548 540 cpu_bringup(); 549 541 /* 550 542 * commit 4b0c0f294 (tick: Cleanup NOHZ per cpu data on cpu down) ··· 584 576 585 577 set_cpu_online(cpu, false); 586 578 587 - HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL); 579 + HYPERVISOR_vcpu_op(VCPUOP_down, xen_vcpu_nr(cpu), NULL); 588 580 BUG(); 589 581 } 590 582
+15 -48
arch/x86/xen/time.c
··· 11 11 #include <linux/interrupt.h> 12 12 #include <linux/clocksource.h> 13 13 #include <linux/clockchips.h> 14 - #include <linux/kernel_stat.h> 15 - #include <linux/math64.h> 16 14 #include <linux/gfp.h> 17 15 #include <linux/slab.h> 18 16 #include <linux/pvclock_gtod.h> ··· 29 31 30 32 /* Xen may fire a timer up to this many ns early */ 31 33 #define TIMER_SLOP 100000 32 - #define NS_PER_TICK (1000000000LL / HZ) 33 - 34 - /* snapshots of runstate info */ 35 - static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot); 36 - 37 - /* unused ns of stolen time */ 38 - static DEFINE_PER_CPU(u64, xen_residual_stolen); 39 - 40 - static void do_stolen_accounting(void) 41 - { 42 - struct vcpu_runstate_info state; 43 - struct vcpu_runstate_info *snap; 44 - s64 runnable, offline, stolen; 45 - cputime_t ticks; 46 - 47 - xen_get_runstate_snapshot(&state); 48 - 49 - WARN_ON(state.state != RUNSTATE_running); 50 - 51 - snap = this_cpu_ptr(&xen_runstate_snapshot); 52 - 53 - /* work out how much time the VCPU has not been runn*ing* */ 54 - runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable]; 55 - offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline]; 56 - 57 - *snap = state; 58 - 59 - /* Add the appropriate number of ticks of stolen time, 60 - including any left-overs from last time. */ 61 - stolen = runnable + offline + __this_cpu_read(xen_residual_stolen); 62 - 63 - if (stolen < 0) 64 - stolen = 0; 65 - 66 - ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen); 67 - __this_cpu_write(xen_residual_stolen, stolen); 68 - account_steal_ticks(ticks); 69 - } 70 34 71 35 /* Get the TSC speed from Xen */ 72 36 static unsigned long xen_tsc_khz(void) ··· 223 263 { 224 264 int cpu = smp_processor_id(); 225 265 226 - if (HYPERVISOR_vcpu_op(VCPUOP_stop_singleshot_timer, cpu, NULL) || 227 - HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) 266 + if (HYPERVISOR_vcpu_op(VCPUOP_stop_singleshot_timer, xen_vcpu_nr(cpu), 267 + NULL) || 268 + HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, xen_vcpu_nr(cpu), 269 + NULL)) 228 270 BUG(); 229 271 230 272 return 0; ··· 236 274 { 237 275 int cpu = smp_processor_id(); 238 276 239 - if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) 277 + if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, xen_vcpu_nr(cpu), 278 + NULL)) 240 279 BUG(); 241 280 242 281 return 0; ··· 256 293 /* Get an event anyway, even if the timeout is already expired */ 257 294 single.flags = 0; 258 295 259 - ret = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &single); 296 + ret = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, xen_vcpu_nr(cpu), 297 + &single); 260 298 BUG_ON(ret != 0); 261 299 262 300 return ret; ··· 298 334 evt->event_handler(evt); 299 335 ret = IRQ_HANDLED; 300 336 } 301 - 302 - do_stolen_accounting(); 303 337 304 338 return ret; 305 339 } ··· 356 394 return; 357 395 358 396 for_each_online_cpu(cpu) { 359 - if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) 397 + if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, 398 + xen_vcpu_nr(cpu), NULL)) 360 399 BUG(); 361 400 } 362 401 } 363 402 364 403 static const struct pv_time_ops xen_time_ops __initconst = { 365 404 .sched_clock = xen_clocksource_read, 405 + .steal_clock = xen_steal_clock, 366 406 }; 367 407 368 408 static void __init xen_time_init(void) ··· 378 414 379 415 clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC); 380 416 381 - if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) { 417 + if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, xen_vcpu_nr(cpu), 418 + NULL) == 0) { 382 419 /* Successfully turned off 100Hz tick, so we have the 383 420 vcpuop-based timer interface */ 384 421 printk(KERN_DEBUG "Xen: using vcpuop timer interface\n"); ··· 395 430 xen_setup_runstate_info(cpu); 396 431 xen_setup_timer(cpu); 397 432 xen_setup_cpu_clockevents(); 433 + 434 + xen_time_setup_guest(); 398 435 399 436 if (xen_initial_domain()) 400 437 pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier);
+1
arch/x86/xen/xen-ops.h
··· 76 76 77 77 bool xen_vcpu_stolen(int vcpu); 78 78 79 + void xen_vcpu_setup(int cpu); 79 80 void xen_setup_vcpu_info_placement(void); 80 81 81 82 #ifdef CONFIG_SMP
+74
drivers/acpi/scan.c
··· 46 46 LIST_HEAD(acpi_wakeup_device_list); 47 47 static DEFINE_MUTEX(acpi_hp_context_lock); 48 48 49 + /* 50 + * The UART device described by the SPCR table is the only object which needs 51 + * special-casing. Everything else is covered by ACPI namespace paths in STAO 52 + * table. 53 + */ 54 + static u64 spcr_uart_addr; 55 + 49 56 struct acpi_dep_data { 50 57 struct list_head node; 51 58 acpi_handle master; ··· 1465 1458 return 0; 1466 1459 } 1467 1460 1461 + static acpi_status acpi_get_resource_memory(struct acpi_resource *ares, 1462 + void *context) 1463 + { 1464 + struct resource *res = context; 1465 + 1466 + if (acpi_dev_resource_memory(ares, res)) 1467 + return AE_CTRL_TERMINATE; 1468 + 1469 + return AE_OK; 1470 + } 1471 + 1472 + static bool acpi_device_should_be_hidden(acpi_handle handle) 1473 + { 1474 + acpi_status status; 1475 + struct resource res; 1476 + 1477 + /* Check if it should ignore the UART device */ 1478 + if (!(spcr_uart_addr && acpi_has_method(handle, METHOD_NAME__CRS))) 1479 + return false; 1480 + 1481 + /* 1482 + * The UART device described in SPCR table is assumed to have only one 1483 + * memory resource present. So we only look for the first one here. 1484 + */ 1485 + status = acpi_walk_resources(handle, METHOD_NAME__CRS, 1486 + acpi_get_resource_memory, &res); 1487 + if (ACPI_FAILURE(status) || res.start != spcr_uart_addr) 1488 + return false; 1489 + 1490 + acpi_handle_info(handle, "The UART device @%pa in SPCR table will be hidden\n", 1491 + &res.start); 1492 + 1493 + return true; 1494 + } 1495 + 1468 1496 static int acpi_bus_type_and_status(acpi_handle handle, int *type, 1469 1497 unsigned long long *sta) 1470 1498 { ··· 1513 1471 switch (acpi_type) { 1514 1472 case ACPI_TYPE_ANY: /* for ACPI_ROOT_OBJECT */ 1515 1473 case ACPI_TYPE_DEVICE: 1474 + if (acpi_device_should_be_hidden(handle)) 1475 + return -ENODEV; 1476 + 1516 1477 *type = ACPI_BUS_TYPE_DEVICE; 1517 1478 status = acpi_bus_get_status_handle(handle, sta); 1518 1479 if (ACPI_FAILURE(status)) ··· 1970 1925 return result < 0 ? result : 0; 1971 1926 } 1972 1927 1928 + static void __init acpi_get_spcr_uart_addr(void) 1929 + { 1930 + acpi_status status; 1931 + struct acpi_table_spcr *spcr_ptr; 1932 + 1933 + status = acpi_get_table(ACPI_SIG_SPCR, 0, 1934 + (struct acpi_table_header **)&spcr_ptr); 1935 + if (ACPI_SUCCESS(status)) 1936 + spcr_uart_addr = spcr_ptr->serial_port.address; 1937 + else 1938 + printk(KERN_WARNING PREFIX "STAO table present, but SPCR is missing\n"); 1939 + } 1940 + 1973 1941 static bool acpi_scan_initialized; 1974 1942 1975 1943 int __init acpi_scan_init(void) 1976 1944 { 1977 1945 int result; 1946 + acpi_status status; 1947 + struct acpi_table_stao *stao_ptr; 1978 1948 1979 1949 acpi_pci_root_init(); 1980 1950 acpi_pci_link_init(); ··· 2004 1944 acpi_amba_init(); 2005 1945 2006 1946 acpi_scan_add_handler(&generic_device_handler); 1947 + 1948 + /* 1949 + * If there is STAO table, check whether it needs to ignore the UART 1950 + * device in SPCR table. 1951 + */ 1952 + status = acpi_get_table(ACPI_SIG_STAO, 0, 1953 + (struct acpi_table_header **)&stao_ptr); 1954 + if (ACPI_SUCCESS(status)) { 1955 + if (stao_ptr->header.length > sizeof(struct acpi_table_stao)) 1956 + printk(KERN_INFO PREFIX "STAO Name List not yet supported."); 1957 + 1958 + if (stao_ptr->ignore_uart) 1959 + acpi_get_spcr_uart_addr(); 1960 + } 2007 1961 2008 1962 mutex_lock(&acpi_scan_lock); 2009 1963 /*
+11 -9
drivers/block/xen-blkback/xenbus.c
··· 379 379 NULL 380 380 }; 381 381 382 - static struct attribute_group xen_vbdstat_group = { 382 + static const struct attribute_group xen_vbdstat_group = { 383 383 .name = "statistics", 384 384 .attrs = xen_vbdstat_attrs, 385 385 }; ··· 715 715 716 716 /* Front end dir is a number, which is used as the handle. */ 717 717 err = kstrtoul(strrchr(dev->otherend, '/') + 1, 0, &handle); 718 - if (err) 718 + if (err) { 719 + kfree(be->mode); 720 + be->mode = NULL; 719 721 return; 722 + } 720 723 721 724 be->major = major; 722 725 be->minor = minor; ··· 1025 1022 pr_debug("%s %s\n", __func__, dev->otherend); 1026 1023 1027 1024 be->blkif->blk_protocol = BLKIF_PROTOCOL_DEFAULT; 1028 - err = xenbus_gather(XBT_NIL, dev->otherend, "protocol", 1029 - "%63s", protocol, NULL); 1030 - if (err) 1025 + err = xenbus_scanf(XBT_NIL, dev->otherend, "protocol", 1026 + "%63s", protocol); 1027 + if (err <= 0) 1031 1028 strcpy(protocol, "unspecified, assuming default"); 1032 1029 else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) 1033 1030 be->blkif->blk_protocol = BLKIF_PROTOCOL_NATIVE; ··· 1039 1036 xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); 1040 1037 return -ENOSYS; 1041 1038 } 1042 - err = xenbus_gather(XBT_NIL, dev->otherend, 1043 - "feature-persistent", "%u", 1044 - &pers_grants, NULL); 1045 - if (err) 1039 + err = xenbus_scanf(XBT_NIL, dev->otherend, 1040 + "feature-persistent", "%u", &pers_grants); 1041 + if (err <= 0) 1046 1042 pers_grants = 0; 1047 1043 1048 1044 be->blkif->vbd.feature_gnt_persistent = pers_grants;
+19 -24
drivers/block/xen-blkfront.c
··· 2197 2197 info->discard_granularity = discard_granularity; 2198 2198 info->discard_alignment = discard_alignment; 2199 2199 } 2200 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 2201 - "discard-secure", "%d", &discard_secure, 2202 - NULL); 2203 - if (!err) 2200 + err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, 2201 + "discard-secure", "%u", &discard_secure); 2202 + if (err > 0) 2204 2203 info->feature_secdiscard = !!discard_secure; 2205 2204 } 2206 2205 ··· 2299 2300 info->feature_flush = 0; 2300 2301 info->feature_fua = 0; 2301 2302 2302 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 2303 - "feature-barrier", "%d", &barrier, 2304 - NULL); 2303 + err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, 2304 + "feature-barrier", "%d", &barrier); 2305 2305 2306 2306 /* 2307 2307 * If there's no "feature-barrier" defined, then it means ··· 2309 2311 * 2310 2312 * If there are barriers, then we use flush. 2311 2313 */ 2312 - if (!err && barrier) { 2314 + if (err > 0 && barrier) { 2313 2315 info->feature_flush = 1; 2314 2316 info->feature_fua = 1; 2315 2317 } ··· 2318 2320 * And if there is "feature-flush-cache" use that above 2319 2321 * barriers. 2320 2322 */ 2321 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 2322 - "feature-flush-cache", "%d", &flush, 2323 - NULL); 2323 + err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, 2324 + "feature-flush-cache", "%d", &flush); 2324 2325 2325 - if (!err && flush) { 2326 + if (err > 0 && flush) { 2326 2327 info->feature_flush = 1; 2327 2328 info->feature_fua = 0; 2328 2329 } 2329 2330 2330 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 2331 - "feature-discard", "%d", &discard, 2332 - NULL); 2331 + err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, 2332 + "feature-discard", "%d", &discard); 2333 2333 2334 - if (!err && discard) 2334 + if (err > 0 && discard) 2335 2335 blkfront_setup_discard(info); 2336 2336 2337 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 2338 - "feature-persistent", "%u", &persistent, 2339 - NULL); 2340 - if (err) 2337 + err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, 2338 + "feature-persistent", "%d", &persistent); 2339 + if (err <= 0) 2341 2340 info->feature_persistent = 0; 2342 2341 else 2343 2342 info->feature_persistent = persistent; 2344 2343 2345 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 2346 - "feature-max-indirect-segments", "%u", &indirect_segments, 2347 - NULL); 2348 - if (err) 2344 + err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, 2345 + "feature-max-indirect-segments", "%u", 2346 + &indirect_segments); 2347 + if (err <= 0) 2349 2348 info->max_indirect_segments = 0; 2350 2349 else 2351 2350 info->max_indirect_segments = min(indirect_segments,
+5
drivers/firmware/efi/arm-runtime.c
··· 107 107 return 0; 108 108 } 109 109 110 + if (efi_enabled(EFI_RUNTIME_SERVICES)) { 111 + pr_info("EFI runtime services access via paravirt.\n"); 112 + return 0; 113 + } 114 + 110 115 pr_info("Remapping and enabling EFI services.\n"); 111 116 112 117 mapsize = efi.memmap.map_end - efi.memmap.map;
+65 -16
drivers/firmware/efi/efi.c
··· 568 568 FIELD_SIZEOF(struct efi_fdt_params, field) \ 569 569 } 570 570 571 - static __initdata struct { 571 + struct params { 572 572 const char name[32]; 573 573 const char propname[32]; 574 574 int offset; 575 575 int size; 576 - } dt_params[] = { 576 + }; 577 + 578 + static __initdata struct params fdt_params[] = { 577 579 UEFI_PARAM("System Table", "linux,uefi-system-table", system_table), 578 580 UEFI_PARAM("MemMap Address", "linux,uefi-mmap-start", mmap), 579 581 UEFI_PARAM("MemMap Size", "linux,uefi-mmap-size", mmap_size), ··· 583 581 UEFI_PARAM("MemMap Desc. Version", "linux,uefi-mmap-desc-ver", desc_ver) 584 582 }; 585 583 584 + static __initdata struct params xen_fdt_params[] = { 585 + UEFI_PARAM("System Table", "xen,uefi-system-table", system_table), 586 + UEFI_PARAM("MemMap Address", "xen,uefi-mmap-start", mmap), 587 + UEFI_PARAM("MemMap Size", "xen,uefi-mmap-size", mmap_size), 588 + UEFI_PARAM("MemMap Desc. Size", "xen,uefi-mmap-desc-size", desc_size), 589 + UEFI_PARAM("MemMap Desc. Version", "xen,uefi-mmap-desc-ver", desc_ver) 590 + }; 591 + 592 + #define EFI_FDT_PARAMS_SIZE ARRAY_SIZE(fdt_params) 593 + 594 + static __initdata struct { 595 + const char *uname; 596 + const char *subnode; 597 + struct params *params; 598 + } dt_params[] = { 599 + { "hypervisor", "uefi", xen_fdt_params }, 600 + { "chosen", NULL, fdt_params }, 601 + }; 602 + 586 603 struct param_info { 587 604 int found; 588 605 void *params; 606 + const char *missing; 589 607 }; 590 608 591 - static int __init fdt_find_uefi_params(unsigned long node, const char *uname, 592 - int depth, void *data) 609 + static int __init __find_uefi_params(unsigned long node, 610 + struct param_info *info, 611 + struct params *params) 593 612 { 594 - struct param_info *info = data; 595 613 const void *prop; 596 614 void *dest; 597 615 u64 val; 598 616 int i, len; 599 617 600 - if (depth != 1 || strcmp(uname, "chosen") != 0) 601 - return 0; 602 - 603 - for (i = 0; i < ARRAY_SIZE(dt_params); i++) { 604 - prop = of_get_flat_dt_prop(node, dt_params[i].propname, &len); 605 - if (!prop) 618 + for (i = 0; i < EFI_FDT_PARAMS_SIZE; i++) { 619 + prop = of_get_flat_dt_prop(node, params[i].propname, &len); 620 + if (!prop) { 621 + info->missing = params[i].name; 606 622 return 0; 607 - dest = info->params + dt_params[i].offset; 623 + } 624 + 625 + dest = info->params + params[i].offset; 608 626 info->found++; 609 627 610 628 val = of_read_number(prop, len / sizeof(u32)); 611 629 612 - if (dt_params[i].size == sizeof(u32)) 630 + if (params[i].size == sizeof(u32)) 613 631 *(u32 *)dest = val; 614 632 else 615 633 *(u64 *)dest = val; 616 634 617 635 if (efi_enabled(EFI_DBG)) 618 - pr_info(" %s: 0x%0*llx\n", dt_params[i].name, 619 - dt_params[i].size * 2, val); 636 + pr_info(" %s: 0x%0*llx\n", params[i].name, 637 + params[i].size * 2, val); 620 638 } 639 + 621 640 return 1; 641 + } 642 + 643 + static int __init fdt_find_uefi_params(unsigned long node, const char *uname, 644 + int depth, void *data) 645 + { 646 + struct param_info *info = data; 647 + int i; 648 + 649 + for (i = 0; i < ARRAY_SIZE(dt_params); i++) { 650 + const char *subnode = dt_params[i].subnode; 651 + 652 + if (depth != 1 || strcmp(uname, dt_params[i].uname) != 0) { 653 + info->missing = dt_params[i].params[0].name; 654 + continue; 655 + } 656 + 657 + if (subnode) { 658 + node = of_get_flat_dt_subnode_by_name(node, subnode); 659 + if (node < 0) 660 + return 0; 661 + } 662 + 663 + return __find_uefi_params(node, info, dt_params[i].params); 664 + } 665 + 666 + return 0; 622 667 } 623 668 624 669 int __init efi_get_fdt_params(struct efi_fdt_params *params) ··· 683 634 pr_info("UEFI not found.\n"); 684 635 else if (!ret) 685 636 pr_err("Can't find '%s' in device tree!\n", 686 - dt_params[info.found].name); 637 + info.missing); 687 638 688 639 return ret; 689 640 }
+13
drivers/of/fdt.c
··· 744 744 } 745 745 746 746 /** 747 + * of_get_flat_dt_subnode_by_name - get the subnode by given name 748 + * 749 + * @node: the parent node 750 + * @uname: the name of subnode 751 + * @return offset of the subnode, or -FDT_ERR_NOTFOUND if there is none 752 + */ 753 + 754 + int of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname) 755 + { 756 + return fdt_subnode_offset(initial_boot_params, node, uname); 757 + } 758 + 759 + /** 747 760 * of_get_flat_dt_root - find the root node in the flat blob 748 761 */ 749 762 unsigned long __init of_get_flat_dt_root(void)
+1 -1
drivers/xen/Kconfig
··· 275 275 276 276 config XEN_EFI 277 277 def_bool y 278 - depends on X86_64 && EFI 278 + depends on (ARM || ARM64 || X86_64) && EFI 279 279 280 280 config XEN_AUTO_XLATE 281 281 def_bool y
+1
drivers/xen/Makefile
··· 10 10 CFLAGS_efi.o += -fshort-wchar 11 11 LDFLAGS += $(call ld-option, --no-wchar-size-warning) 12 12 13 + dom0-$(CONFIG_ARM64) += arm-device.o 13 14 dom0-$(CONFIG_PCI) += pci.o 14 15 dom0-$(CONFIG_USB_SUPPORT) += dbgp.o 15 16 dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
+196
drivers/xen/arm-device.c
··· 1 + /* 2 + * Copyright (c) 2015, Linaro Limited, Shannon Zhao 3 + * 4 + * This program is free software; you can redistribute it and/or modify it 5 + * under the terms and conditions of the GNU General Public License, 6 + * version 2, as published by the Free Software Foundation. 7 + * 8 + * This program is distributed in the hope it will be useful, but WITHOUT 9 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 + * more details. 12 + * 13 + * You should have received a copy of the GNU General Public License 14 + * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 + */ 16 + 17 + #include <linux/platform_device.h> 18 + #include <linux/acpi.h> 19 + #include <xen/xen.h> 20 + #include <xen/page.h> 21 + #include <xen/interface/memory.h> 22 + #include <asm/xen/hypervisor.h> 23 + #include <asm/xen/hypercall.h> 24 + 25 + static int xen_unmap_device_mmio(const struct resource *resources, 26 + unsigned int count) 27 + { 28 + unsigned int i, j, nr; 29 + int rc = 0; 30 + const struct resource *r; 31 + struct xen_remove_from_physmap xrp; 32 + 33 + for (i = 0; i < count; i++) { 34 + r = &resources[i]; 35 + nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE); 36 + if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) 37 + continue; 38 + 39 + for (j = 0; j < nr; j++) { 40 + xrp.domid = DOMID_SELF; 41 + xrp.gpfn = XEN_PFN_DOWN(r->start) + j; 42 + rc = HYPERVISOR_memory_op(XENMEM_remove_from_physmap, 43 + &xrp); 44 + if (rc) 45 + return rc; 46 + } 47 + } 48 + 49 + return rc; 50 + } 51 + 52 + static int xen_map_device_mmio(const struct resource *resources, 53 + unsigned int count) 54 + { 55 + unsigned int i, j, nr; 56 + int rc = 0; 57 + const struct resource *r; 58 + xen_pfn_t *gpfns; 59 + xen_ulong_t *idxs; 60 + int *errs; 61 + struct xen_add_to_physmap_range xatp; 62 + 63 + for (i = 0; i < count; i++) { 64 + r = &resources[i]; 65 + nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE); 66 + if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) 67 + continue; 68 + 69 + gpfns = kzalloc(sizeof(xen_pfn_t) * nr, GFP_KERNEL); 70 + idxs = kzalloc(sizeof(xen_ulong_t) * nr, GFP_KERNEL); 71 + errs = kzalloc(sizeof(int) * nr, GFP_KERNEL); 72 + if (!gpfns || !idxs || !errs) { 73 + kfree(gpfns); 74 + kfree(idxs); 75 + kfree(errs); 76 + rc = -ENOMEM; 77 + goto unmap; 78 + } 79 + 80 + for (j = 0; j < nr; j++) { 81 + /* 82 + * The regions are always mapped 1:1 to DOM0 and this is 83 + * fine because the memory map for DOM0 is the same as 84 + * the host (except for the RAM). 85 + */ 86 + gpfns[j] = XEN_PFN_DOWN(r->start) + j; 87 + idxs[j] = XEN_PFN_DOWN(r->start) + j; 88 + } 89 + 90 + xatp.domid = DOMID_SELF; 91 + xatp.size = nr; 92 + xatp.space = XENMAPSPACE_dev_mmio; 93 + 94 + set_xen_guest_handle(xatp.gpfns, gpfns); 95 + set_xen_guest_handle(xatp.idxs, idxs); 96 + set_xen_guest_handle(xatp.errs, errs); 97 + 98 + rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap_range, &xatp); 99 + kfree(gpfns); 100 + kfree(idxs); 101 + kfree(errs); 102 + if (rc) 103 + goto unmap; 104 + } 105 + 106 + return rc; 107 + 108 + unmap: 109 + xen_unmap_device_mmio(resources, i); 110 + return rc; 111 + } 112 + 113 + static int xen_platform_notifier(struct notifier_block *nb, 114 + unsigned long action, void *data) 115 + { 116 + struct platform_device *pdev = to_platform_device(data); 117 + int r = 0; 118 + 119 + if (pdev->num_resources == 0 || pdev->resource == NULL) 120 + return NOTIFY_OK; 121 + 122 + switch (action) { 123 + case BUS_NOTIFY_ADD_DEVICE: 124 + r = xen_map_device_mmio(pdev->resource, pdev->num_resources); 125 + break; 126 + case BUS_NOTIFY_DEL_DEVICE: 127 + r = xen_unmap_device_mmio(pdev->resource, pdev->num_resources); 128 + break; 129 + default: 130 + return NOTIFY_DONE; 131 + } 132 + if (r) 133 + dev_err(&pdev->dev, "Platform: Failed to %s device %s MMIO!\n", 134 + action == BUS_NOTIFY_ADD_DEVICE ? "map" : 135 + (action == BUS_NOTIFY_DEL_DEVICE ? "unmap" : "?"), 136 + pdev->name); 137 + 138 + return NOTIFY_OK; 139 + } 140 + 141 + static struct notifier_block platform_device_nb = { 142 + .notifier_call = xen_platform_notifier, 143 + }; 144 + 145 + static int __init register_xen_platform_notifier(void) 146 + { 147 + if (!xen_initial_domain() || acpi_disabled) 148 + return 0; 149 + 150 + return bus_register_notifier(&platform_bus_type, &platform_device_nb); 151 + } 152 + 153 + arch_initcall(register_xen_platform_notifier); 154 + 155 + #ifdef CONFIG_ARM_AMBA 156 + #include <linux/amba/bus.h> 157 + 158 + static int xen_amba_notifier(struct notifier_block *nb, 159 + unsigned long action, void *data) 160 + { 161 + struct amba_device *adev = to_amba_device(data); 162 + int r = 0; 163 + 164 + switch (action) { 165 + case BUS_NOTIFY_ADD_DEVICE: 166 + r = xen_map_device_mmio(&adev->res, 1); 167 + break; 168 + case BUS_NOTIFY_DEL_DEVICE: 169 + r = xen_unmap_device_mmio(&adev->res, 1); 170 + break; 171 + default: 172 + return NOTIFY_DONE; 173 + } 174 + if (r) 175 + dev_err(&adev->dev, "AMBA: Failed to %s device %s MMIO!\n", 176 + action == BUS_NOTIFY_ADD_DEVICE ? "map" : 177 + (action == BUS_NOTIFY_DEL_DEVICE ? "unmap" : "?"), 178 + adev->dev.init_name); 179 + 180 + return NOTIFY_OK; 181 + } 182 + 183 + static struct notifier_block amba_device_nb = { 184 + .notifier_call = xen_amba_notifier, 185 + }; 186 + 187 + static int __init register_xen_amba_notifier(void) 188 + { 189 + if (!xen_initial_domain() || acpi_disabled) 190 + return 0; 191 + 192 + return bus_register_notifier(&amba_bustype, &amba_device_nb); 193 + } 194 + 195 + arch_initcall(register_xen_amba_notifier); 196 + #endif
+34 -139
drivers/xen/efi.c
··· 38 38 39 39 #define efi_data(op) (op.u.efi_runtime_call) 40 40 41 - static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) 41 + efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) 42 42 { 43 43 struct xen_platform_op op = INIT_EFI_OP(get_time); 44 44 ··· 59 59 60 60 return efi_data(op).status; 61 61 } 62 + EXPORT_SYMBOL_GPL(xen_efi_get_time); 62 63 63 - static efi_status_t xen_efi_set_time(efi_time_t *tm) 64 + efi_status_t xen_efi_set_time(efi_time_t *tm) 64 65 { 65 66 struct xen_platform_op op = INIT_EFI_OP(set_time); 66 67 ··· 73 72 74 73 return efi_data(op).status; 75 74 } 75 + EXPORT_SYMBOL_GPL(xen_efi_set_time); 76 76 77 - static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, 78 - efi_bool_t *pending, 79 - efi_time_t *tm) 77 + efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, 78 + efi_time_t *tm) 80 79 { 81 80 struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time); 82 81 ··· 96 95 97 96 return efi_data(op).status; 98 97 } 98 + EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time); 99 99 100 - static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) 100 + efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) 101 101 { 102 102 struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time); 103 103 ··· 115 113 116 114 return efi_data(op).status; 117 115 } 116 + EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time); 118 117 119 - static efi_status_t xen_efi_get_variable(efi_char16_t *name, 120 - efi_guid_t *vendor, 121 - u32 *attr, 122 - unsigned long *data_size, 123 - void *data) 118 + efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, 119 + u32 *attr, unsigned long *data_size, 120 + void *data) 124 121 { 125 122 struct xen_platform_op op = INIT_EFI_OP(get_variable); 126 123 ··· 139 138 140 139 return efi_data(op).status; 141 140 } 141 + EXPORT_SYMBOL_GPL(xen_efi_get_variable); 142 142 143 - static efi_status_t xen_efi_get_next_variable(unsigned long *name_size, 144 - efi_char16_t *name, 145 - efi_guid_t *vendor) 143 + efi_status_t xen_efi_get_next_variable(unsigned long *name_size, 144 + efi_char16_t *name, 145 + efi_guid_t *vendor) 146 146 { 147 147 struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name); 148 148 ··· 163 161 164 162 return efi_data(op).status; 165 163 } 164 + EXPORT_SYMBOL_GPL(xen_efi_get_next_variable); 166 165 167 - static efi_status_t xen_efi_set_variable(efi_char16_t *name, 168 - efi_guid_t *vendor, 169 - u32 attr, 170 - unsigned long data_size, 171 - void *data) 166 + efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, 167 + u32 attr, unsigned long data_size, 168 + void *data) 172 169 { 173 170 struct xen_platform_op op = INIT_EFI_OP(set_variable); 174 171 ··· 184 183 185 184 return efi_data(op).status; 186 185 } 186 + EXPORT_SYMBOL_GPL(xen_efi_set_variable); 187 187 188 - static efi_status_t xen_efi_query_variable_info(u32 attr, 189 - u64 *storage_space, 190 - u64 *remaining_space, 191 - u64 *max_variable_size) 188 + efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, 189 + u64 *remaining_space, 190 + u64 *max_variable_size) 192 191 { 193 192 struct xen_platform_op op = INIT_EFI_OP(query_variable_info); 194 193 ··· 206 205 207 206 return efi_data(op).status; 208 207 } 208 + EXPORT_SYMBOL_GPL(xen_efi_query_variable_info); 209 209 210 - static efi_status_t xen_efi_get_next_high_mono_count(u32 *count) 210 + efi_status_t xen_efi_get_next_high_mono_count(u32 *count) 211 211 { 212 212 struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count); 213 213 ··· 219 217 220 218 return efi_data(op).status; 221 219 } 220 + EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count); 222 221 223 - static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, 224 - unsigned long count, 225 - unsigned long sg_list) 222 + efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, 223 + unsigned long count, unsigned long sg_list) 226 224 { 227 225 struct xen_platform_op op = INIT_EFI_OP(update_capsule); 228 226 ··· 239 237 240 238 return efi_data(op).status; 241 239 } 240 + EXPORT_SYMBOL_GPL(xen_efi_update_capsule); 242 241 243 - static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, 244 - unsigned long count, 245 - u64 *max_size, 246 - int *reset_type) 242 + efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, 243 + unsigned long count, u64 *max_size, 244 + int *reset_type) 247 245 { 248 246 struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities); 249 247 ··· 262 260 263 261 return efi_data(op).status; 264 262 } 265 - 266 - static efi_char16_t vendor[100] __initdata; 267 - 268 - static efi_system_table_t efi_systab_xen __initdata = { 269 - .hdr = { 270 - .signature = EFI_SYSTEM_TABLE_SIGNATURE, 271 - .revision = 0, /* Initialized later. */ 272 - .headersize = 0, /* Ignored by Linux Kernel. */ 273 - .crc32 = 0, /* Ignored by Linux Kernel. */ 274 - .reserved = 0 275 - }, 276 - .fw_vendor = EFI_INVALID_TABLE_ADDR, /* Initialized later. */ 277 - .fw_revision = 0, /* Initialized later. */ 278 - .con_in_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 279 - .con_in = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 280 - .con_out_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 281 - .con_out = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 282 - .stderr_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 283 - .stderr = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ 284 - .runtime = (efi_runtime_services_t *)EFI_INVALID_TABLE_ADDR, 285 - /* Not used under Xen. */ 286 - .boottime = (efi_boot_services_t *)EFI_INVALID_TABLE_ADDR, 287 - /* Not used under Xen. */ 288 - .nr_tables = 0, /* Initialized later. */ 289 - .tables = EFI_INVALID_TABLE_ADDR /* Initialized later. */ 290 - }; 291 - 292 - static const struct efi efi_xen __initconst = { 293 - .systab = NULL, /* Initialized later. */ 294 - .runtime_version = 0, /* Initialized later. */ 295 - .mps = EFI_INVALID_TABLE_ADDR, 296 - .acpi = EFI_INVALID_TABLE_ADDR, 297 - .acpi20 = EFI_INVALID_TABLE_ADDR, 298 - .smbios = EFI_INVALID_TABLE_ADDR, 299 - .smbios3 = EFI_INVALID_TABLE_ADDR, 300 - .sal_systab = EFI_INVALID_TABLE_ADDR, 301 - .boot_info = EFI_INVALID_TABLE_ADDR, 302 - .hcdp = EFI_INVALID_TABLE_ADDR, 303 - .uga = EFI_INVALID_TABLE_ADDR, 304 - .uv_systab = EFI_INVALID_TABLE_ADDR, 305 - .fw_vendor = EFI_INVALID_TABLE_ADDR, 306 - .runtime = EFI_INVALID_TABLE_ADDR, 307 - .config_table = EFI_INVALID_TABLE_ADDR, 308 - .get_time = xen_efi_get_time, 309 - .set_time = xen_efi_set_time, 310 - .get_wakeup_time = xen_efi_get_wakeup_time, 311 - .set_wakeup_time = xen_efi_set_wakeup_time, 312 - .get_variable = xen_efi_get_variable, 313 - .get_next_variable = xen_efi_get_next_variable, 314 - .set_variable = xen_efi_set_variable, 315 - .query_variable_info = xen_efi_query_variable_info, 316 - .update_capsule = xen_efi_update_capsule, 317 - .query_capsule_caps = xen_efi_query_capsule_caps, 318 - .get_next_high_mono_count = xen_efi_get_next_high_mono_count, 319 - .reset_system = NULL, /* Functionality provided by Xen. */ 320 - .set_virtual_address_map = NULL, /* Not used under Xen. */ 321 - .flags = 0 /* Initialized later. */ 322 - }; 323 - 324 - efi_system_table_t __init *xen_efi_probe(void) 325 - { 326 - struct xen_platform_op op = { 327 - .cmd = XENPF_firmware_info, 328 - .u.firmware_info = { 329 - .type = XEN_FW_EFI_INFO, 330 - .index = XEN_FW_EFI_CONFIG_TABLE 331 - } 332 - }; 333 - union xenpf_efi_info *info = &op.u.firmware_info.u.efi_info; 334 - 335 - if (!xen_initial_domain() || HYPERVISOR_platform_op(&op) < 0) 336 - return NULL; 337 - 338 - /* Here we know that Xen runs on EFI platform. */ 339 - 340 - efi = efi_xen; 341 - 342 - efi_systab_xen.tables = info->cfg.addr; 343 - efi_systab_xen.nr_tables = info->cfg.nent; 344 - 345 - op.cmd = XENPF_firmware_info; 346 - op.u.firmware_info.type = XEN_FW_EFI_INFO; 347 - op.u.firmware_info.index = XEN_FW_EFI_VENDOR; 348 - info->vendor.bufsz = sizeof(vendor); 349 - set_xen_guest_handle(info->vendor.name, vendor); 350 - 351 - if (HYPERVISOR_platform_op(&op) == 0) { 352 - efi_systab_xen.fw_vendor = __pa_symbol(vendor); 353 - efi_systab_xen.fw_revision = info->vendor.revision; 354 - } else 355 - efi_systab_xen.fw_vendor = __pa_symbol(L"UNKNOWN"); 356 - 357 - op.cmd = XENPF_firmware_info; 358 - op.u.firmware_info.type = XEN_FW_EFI_INFO; 359 - op.u.firmware_info.index = XEN_FW_EFI_VERSION; 360 - 361 - if (HYPERVISOR_platform_op(&op) == 0) 362 - efi_systab_xen.hdr.revision = info->version; 363 - 364 - op.cmd = XENPF_firmware_info; 365 - op.u.firmware_info.type = XEN_FW_EFI_INFO; 366 - op.u.firmware_info.index = XEN_FW_EFI_RT_VERSION; 367 - 368 - if (HYPERVISOR_platform_op(&op) == 0) 369 - efi.runtime_version = info->version; 370 - 371 - return &efi_systab_xen; 372 - } 263 + EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps);
+7 -6
drivers/xen/events/events_base.c
··· 895 895 irq_set_chip_and_handler_name(irq, &xen_percpu_chip, 896 896 handle_percpu_irq, "ipi"); 897 897 898 - bind_ipi.vcpu = cpu; 898 + bind_ipi.vcpu = xen_vcpu_nr(cpu); 899 899 if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, 900 900 &bind_ipi) != 0) 901 901 BUG(); ··· 991 991 handle_edge_irq, "virq"); 992 992 993 993 bind_virq.virq = virq; 994 - bind_virq.vcpu = cpu; 994 + bind_virq.vcpu = xen_vcpu_nr(cpu); 995 995 ret = HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, 996 996 &bind_virq); 997 997 if (ret == 0) ··· 1211 1211 1212 1212 #ifdef CONFIG_X86 1213 1213 if (unlikely(vector == XEN_NMI_VECTOR)) { 1214 - int rc = HYPERVISOR_vcpu_op(VCPUOP_send_nmi, cpu, NULL); 1214 + int rc = HYPERVISOR_vcpu_op(VCPUOP_send_nmi, xen_vcpu_nr(cpu), 1215 + NULL); 1215 1216 if (rc < 0) 1216 1217 printk(KERN_WARNING "Sending nmi to CPU%d failed (rc:%d)\n", cpu, rc); 1217 1218 return; ··· 1319 1318 1320 1319 /* Send future instances of this interrupt to other vcpu. */ 1321 1320 bind_vcpu.port = evtchn; 1322 - bind_vcpu.vcpu = tcpu; 1321 + bind_vcpu.vcpu = xen_vcpu_nr(tcpu); 1323 1322 1324 1323 /* 1325 1324 * Mask the event while changing the VCPU binding to prevent ··· 1459 1458 1460 1459 /* Get a new binding from Xen. */ 1461 1460 bind_virq.virq = virq; 1462 - bind_virq.vcpu = cpu; 1461 + bind_virq.vcpu = xen_vcpu_nr(cpu); 1463 1462 if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, 1464 1463 &bind_virq) != 0) 1465 1464 BUG(); ··· 1483 1482 BUG_ON(ipi_from_irq(irq) != ipi); 1484 1483 1485 1484 /* Get a new binding from Xen. */ 1486 - bind_ipi.vcpu = cpu; 1485 + bind_ipi.vcpu = xen_vcpu_nr(cpu); 1487 1486 if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, 1488 1487 &bind_ipi) != 0) 1489 1488 BUG();
+1 -1
drivers/xen/events/events_fifo.c
··· 113 113 114 114 init_control.control_gfn = virt_to_gfn(control_block); 115 115 init_control.offset = 0; 116 - init_control.vcpu = cpu; 116 + init_control.vcpu = xen_vcpu_nr(cpu); 117 117 118 118 return HYPERVISOR_event_channel_op(EVTCHNOP_init_control, &init_control); 119 119 }
+42 -1
drivers/xen/evtchn.c
··· 55 55 #include <xen/xen.h> 56 56 #include <xen/events.h> 57 57 #include <xen/evtchn.h> 58 + #include <xen/xen-ops.h> 58 59 #include <asm/xen/hypervisor.h> 59 60 60 61 struct per_user_data { ··· 74 73 wait_queue_head_t evtchn_wait; 75 74 struct fasync_struct *evtchn_async_queue; 76 75 const char *name; 76 + 77 + domid_t restrict_domid; 77 78 }; 79 + 80 + #define UNRESTRICTED_DOMID ((domid_t)-1) 78 81 79 82 struct user_evtchn { 80 83 struct rb_node node; ··· 448 443 struct ioctl_evtchn_bind_virq bind; 449 444 struct evtchn_bind_virq bind_virq; 450 445 446 + rc = -EACCES; 447 + if (u->restrict_domid != UNRESTRICTED_DOMID) 448 + break; 449 + 451 450 rc = -EFAULT; 452 451 if (copy_from_user(&bind, uarg, sizeof(bind))) 453 452 break; 454 453 455 454 bind_virq.virq = bind.virq; 456 - bind_virq.vcpu = 0; 455 + bind_virq.vcpu = xen_vcpu_nr(0); 457 456 rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, 458 457 &bind_virq); 459 458 if (rc != 0) ··· 477 468 if (copy_from_user(&bind, uarg, sizeof(bind))) 478 469 break; 479 470 471 + rc = -EACCES; 472 + if (u->restrict_domid != UNRESTRICTED_DOMID && 473 + u->restrict_domid != bind.remote_domain) 474 + break; 475 + 480 476 bind_interdomain.remote_dom = bind.remote_domain; 481 477 bind_interdomain.remote_port = bind.remote_port; 482 478 rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain, ··· 498 484 case IOCTL_EVTCHN_BIND_UNBOUND_PORT: { 499 485 struct ioctl_evtchn_bind_unbound_port bind; 500 486 struct evtchn_alloc_unbound alloc_unbound; 487 + 488 + rc = -EACCES; 489 + if (u->restrict_domid != UNRESTRICTED_DOMID) 490 + break; 501 491 502 492 rc = -EFAULT; 503 493 if (copy_from_user(&bind, uarg, sizeof(bind))) ··· 571 553 break; 572 554 } 573 555 556 + case IOCTL_EVTCHN_RESTRICT_DOMID: { 557 + struct ioctl_evtchn_restrict_domid ierd; 558 + 559 + rc = -EACCES; 560 + if (u->restrict_domid != UNRESTRICTED_DOMID) 561 + break; 562 + 563 + rc = -EFAULT; 564 + if (copy_from_user(&ierd, uarg, sizeof(ierd))) 565 + break; 566 + 567 + rc = -EINVAL; 568 + if (ierd.domid == 0 || ierd.domid >= DOMID_FIRST_RESERVED) 569 + break; 570 + 571 + u->restrict_domid = ierd.domid; 572 + rc = 0; 573 + 574 + break; 575 + } 576 + 574 577 default: 575 578 rc = -ENOSYS; 576 579 break; ··· 639 600 mutex_init(&u->bind_mutex); 640 601 mutex_init(&u->ring_cons_mutex); 641 602 spin_lock_init(&u->ring_prod_lock); 603 + 604 + u->restrict_domid = UNRESTRICTED_DOMID; 642 605 643 606 filp->private_data = u; 644 607
+1 -1
drivers/xen/gntalloc.c
··· 504 504 struct gntalloc_file_private_data *priv = filp->private_data; 505 505 struct gntalloc_vma_private_data *vm_priv; 506 506 struct gntalloc_gref *gref; 507 - int count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 507 + int count = vma_pages(vma); 508 508 int rv, i; 509 509 510 510 if (!(vma->vm_flags & VM_SHARED)) {
+1 -1
drivers/xen/gntdev.c
··· 982 982 { 983 983 struct gntdev_priv *priv = flip->private_data; 984 984 int index = vma->vm_pgoff; 985 - int count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 985 + int count = vma_pages(vma); 986 986 struct grant_map *map; 987 987 int i, err = -EINVAL; 988 988
+1 -1
drivers/xen/privcmd.c
··· 582 582 static void privcmd_close(struct vm_area_struct *vma) 583 583 { 584 584 struct page **pages = vma->vm_private_data; 585 - int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 585 + int numpgs = vma_pages(vma); 586 586 int numgfns = (vma->vm_end - vma->vm_start) >> XEN_PAGE_SHIFT; 587 587 int rc; 588 588
+38 -12
drivers/xen/time.c
··· 6 6 #include <linux/math64.h> 7 7 #include <linux/gfp.h> 8 8 9 + #include <asm/paravirt.h> 9 10 #include <asm/xen/hypervisor.h> 10 11 #include <asm/xen/hypercall.h> 11 12 ··· 47 46 return ret; 48 47 } 49 48 50 - /* 51 - * Runstate accounting 52 - */ 53 - void xen_get_runstate_snapshot(struct vcpu_runstate_info *res) 49 + static void xen_get_runstate_snapshot_cpu(struct vcpu_runstate_info *res, 50 + unsigned int cpu) 54 51 { 55 52 u64 state_time; 56 53 struct vcpu_runstate_info *state; 57 54 58 55 BUG_ON(preemptible()); 59 56 60 - state = this_cpu_ptr(&xen_runstate); 57 + state = per_cpu_ptr(&xen_runstate, cpu); 61 58 62 - /* 63 - * The runstate info is always updated by the hypervisor on 64 - * the current CPU, so there's no need to use anything 65 - * stronger than a compiler barrier when fetching it. 66 - */ 67 59 do { 68 60 state_time = get64(&state->state_entry_time); 61 + rmb(); /* Hypervisor might update data. */ 69 62 *res = READ_ONCE(*state); 70 - } while (get64(&state->state_entry_time) != state_time); 63 + rmb(); /* Hypervisor might update data. */ 64 + } while (get64(&state->state_entry_time) != state_time || 65 + (state_time & XEN_RUNSTATE_UPDATE)); 66 + } 67 + 68 + /* 69 + * Runstate accounting 70 + */ 71 + void xen_get_runstate_snapshot(struct vcpu_runstate_info *res) 72 + { 73 + xen_get_runstate_snapshot_cpu(res, smp_processor_id()); 71 74 } 72 75 73 76 /* return true when a vcpu could run but has no real cpu to run on */ 74 77 bool xen_vcpu_stolen(int vcpu) 75 78 { 76 79 return per_cpu(xen_runstate, vcpu).state == RUNSTATE_runnable; 80 + } 81 + 82 + u64 xen_steal_clock(int cpu) 83 + { 84 + struct vcpu_runstate_info state; 85 + 86 + xen_get_runstate_snapshot_cpu(&state, cpu); 87 + return state.time[RUNSTATE_runnable] + state.time[RUNSTATE_offline]; 77 88 } 78 89 79 90 void xen_setup_runstate_info(int cpu) ··· 95 82 area.addr.v = &per_cpu(xen_runstate, cpu); 96 83 97 84 if (HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, 98 - cpu, &area)) 85 + xen_vcpu_nr(cpu), &area)) 99 86 BUG(); 100 87 } 101 88 89 + void __init xen_time_setup_guest(void) 90 + { 91 + bool xen_runstate_remote; 92 + 93 + xen_runstate_remote = !HYPERVISOR_vm_assist(VMASST_CMD_enable, 94 + VMASST_TYPE_runstate_update_flag); 95 + 96 + pv_time_ops.steal_clock = xen_steal_clock; 97 + 98 + static_key_slow_inc(&paravirt_steal_enabled); 99 + if (xen_runstate_remote) 100 + static_key_slow_inc(&paravirt_steal_rq_enabled); 101 + }
+8 -14
drivers/xen/xen-pciback/conf_space.c
··· 148 148 struct xen_pcibk_dev_data *dev_data = pci_get_drvdata(dev); 149 149 const struct config_field_entry *cfg_entry; 150 150 const struct config_field *field; 151 - int req_start, req_end, field_start, field_end; 151 + int field_start, field_end; 152 152 /* if read fails for any reason, return 0 153 153 * (as if device didn't respond) */ 154 154 u32 value = 0, tmp_val; ··· 178 178 list_for_each_entry(cfg_entry, &dev_data->config_fields, list) { 179 179 field = cfg_entry->field; 180 180 181 - req_start = offset; 182 - req_end = offset + size; 183 181 field_start = OFFSET(cfg_entry); 184 182 field_end = OFFSET(cfg_entry) + field->size; 185 183 186 - if (req_end > field_start && field_end > req_start) { 184 + if (offset + size > field_start && field_end > offset) { 187 185 err = conf_space_read(dev, cfg_entry, field_start, 188 186 &tmp_val); 189 187 if (err) ··· 189 191 190 192 value = merge_value(value, tmp_val, 191 193 get_mask(field->size), 192 - field_start - req_start); 194 + field_start - offset); 193 195 } 194 196 } 195 197 ··· 209 211 const struct config_field_entry *cfg_entry; 210 212 const struct config_field *field; 211 213 u32 tmp_val; 212 - int req_start, req_end, field_start, field_end; 214 + int field_start, field_end; 213 215 214 216 if (unlikely(verbose_request)) 215 217 printk(KERN_DEBUG ··· 222 224 list_for_each_entry(cfg_entry, &dev_data->config_fields, list) { 223 225 field = cfg_entry->field; 224 226 225 - req_start = offset; 226 - req_end = offset + size; 227 227 field_start = OFFSET(cfg_entry); 228 228 field_end = OFFSET(cfg_entry) + field->size; 229 229 230 - if (req_end > field_start && field_end > req_start) { 231 - tmp_val = 0; 232 - 233 - err = xen_pcibk_config_read(dev, field_start, 234 - field->size, &tmp_val); 230 + if (offset + size > field_start && field_end > offset) { 231 + err = conf_space_read(dev, cfg_entry, field_start, 232 + &tmp_val); 235 233 if (err) 236 234 break; 237 235 238 236 tmp_val = merge_value(tmp_val, value, get_mask(size), 239 - req_start - field_start); 237 + offset - field_start); 240 238 241 239 err = conf_space_write(dev, cfg_entry, field_start, 242 240 tmp_val);
+17 -40
drivers/xen/xen-pciback/conf_space_header.c
··· 209 209 return 0; 210 210 } 211 211 212 - static inline void read_dev_bar(struct pci_dev *dev, 213 - struct pci_bar_info *bar_info, int offset, 214 - u32 len_mask) 212 + static void *bar_init(struct pci_dev *dev, int offset) 215 213 { 216 - int pos; 217 - struct resource *res = dev->resource; 214 + unsigned int pos; 215 + const struct resource *res = dev->resource; 216 + struct pci_bar_info *bar = kzalloc(sizeof(*bar), GFP_KERNEL); 217 + 218 + if (!bar) 219 + return ERR_PTR(-ENOMEM); 218 220 219 221 if (offset == PCI_ROM_ADDRESS || offset == PCI_ROM_ADDRESS1) 220 222 pos = PCI_ROM_RESOURCE; 221 223 else { 222 224 pos = (offset - PCI_BASE_ADDRESS_0) / 4; 223 - if (pos && ((res[pos - 1].flags & (PCI_BASE_ADDRESS_SPACE | 224 - PCI_BASE_ADDRESS_MEM_TYPE_MASK)) == 225 - (PCI_BASE_ADDRESS_SPACE_MEMORY | 226 - PCI_BASE_ADDRESS_MEM_TYPE_64))) { 227 - bar_info->val = res[pos - 1].start >> 32; 228 - bar_info->len_val = -resource_size(&res[pos - 1]) >> 32; 229 - return; 225 + if (pos && (res[pos - 1].flags & IORESOURCE_MEM_64)) { 226 + bar->val = res[pos - 1].start >> 32; 227 + bar->len_val = -resource_size(&res[pos - 1]) >> 32; 228 + return bar; 230 229 } 231 230 } 232 231 233 232 if (!res[pos].flags || 234 233 (res[pos].flags & (IORESOURCE_DISABLED | IORESOURCE_UNSET | 235 234 IORESOURCE_BUSY))) 236 - return; 235 + return bar; 237 236 238 - bar_info->val = res[pos].start | 239 - (res[pos].flags & PCI_REGION_FLAG_MASK); 240 - bar_info->len_val = -resource_size(&res[pos]) | 241 - (res[pos].flags & PCI_REGION_FLAG_MASK); 242 - } 243 - 244 - static void *bar_init(struct pci_dev *dev, int offset) 245 - { 246 - struct pci_bar_info *bar = kzalloc(sizeof(*bar), GFP_KERNEL); 247 - 248 - if (!bar) 249 - return ERR_PTR(-ENOMEM); 250 - 251 - read_dev_bar(dev, bar, offset, ~0); 252 - 253 - return bar; 254 - } 255 - 256 - static void *rom_init(struct pci_dev *dev, int offset) 257 - { 258 - struct pci_bar_info *bar = kzalloc(sizeof(*bar), GFP_KERNEL); 259 - 260 - if (!bar) 261 - return ERR_PTR(-ENOMEM); 262 - 263 - read_dev_bar(dev, bar, offset, ~PCI_ROM_ADDRESS_ENABLE); 237 + bar->val = res[pos].start | 238 + (res[pos].flags & PCI_REGION_FLAG_MASK); 239 + bar->len_val = -resource_size(&res[pos]) | 240 + (res[pos].flags & PCI_REGION_FLAG_MASK); 264 241 265 242 return bar; 266 243 } ··· 360 383 { \ 361 384 .offset = reg_offset, \ 362 385 .size = 4, \ 363 - .init = rom_init, \ 386 + .init = bar_init, \ 364 387 .reset = bar_reset, \ 365 388 .release = bar_release, \ 366 389 .u.dw.read = bar_read, \
-1
drivers/xen/xen-pciback/pciback.h
··· 55 55 56 56 /* Used by XenBus and xen_pcibk_ops.c */ 57 57 extern wait_queue_head_t xen_pcibk_aer_wait_queue; 58 - extern struct workqueue_struct *xen_pcibk_wq; 59 58 /* Used by pcistub.c and conf_space_quirks.c */ 60 59 extern struct list_head xen_pcibk_quirks; 61 60
+1 -1
drivers/xen/xen-pciback/pciback_ops.c
··· 310 310 * already processing a request */ 311 311 if (test_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags) 312 312 && !test_and_set_bit(_PDEVF_op_active, &pdev->flags)) { 313 - queue_work(xen_pcibk_wq, &pdev->op_work); 313 + schedule_work(&pdev->op_work); 314 314 } 315 315 /*_XEN_PCIB_active should have been cleared by pcifront. And also make 316 316 sure xen_pcibk is waiting for ack by checking _PCIB_op_pending*/
+1 -9
drivers/xen/xen-pciback/xenbus.c
··· 17 17 #include "pciback.h" 18 18 19 19 #define INVALID_EVTCHN_IRQ (-1) 20 - struct workqueue_struct *xen_pcibk_wq; 21 20 22 21 static bool __read_mostly passthrough; 23 22 module_param(passthrough, bool, S_IRUGO); ··· 75 76 /* If the driver domain started an op, make sure we complete it 76 77 * before releasing the shared memory */ 77 78 78 - /* Note, the workqueue does not use spinlocks at all.*/ 79 - flush_workqueue(xen_pcibk_wq); 79 + flush_work(&pdev->op_work); 80 80 81 81 if (pdev->sh_info != NULL) { 82 82 xenbus_unmap_ring_vfree(pdev->xdev, pdev->sh_info); ··· 731 733 732 734 int __init xen_pcibk_xenbus_register(void) 733 735 { 734 - xen_pcibk_wq = create_workqueue("xen_pciback_workqueue"); 735 - if (!xen_pcibk_wq) { 736 - pr_err("%s: create xen_pciback_workqueue failed\n", __func__); 737 - return -EFAULT; 738 - } 739 736 xen_pcibk_backend = &xen_pcibk_vpci_backend; 740 737 if (passthrough) 741 738 xen_pcibk_backend = &xen_pcibk_passthrough_backend; ··· 740 747 741 748 void __exit xen_pcibk_xenbus_unregister(void) 742 749 { 743 - destroy_workqueue(xen_pcibk_wq); 744 750 xenbus_unregister_driver(&xen_pcibk_driver); 745 751 }
+1 -14
drivers/xen/xenbus/xenbus_probe_frontend.c
··· 31 31 #include "xenbus_probe.h" 32 32 33 33 34 - static struct workqueue_struct *xenbus_frontend_wq; 35 34 36 35 /* device/<type>/<id> => <type>-<id> */ 37 36 static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) ··· 108 109 if (xen_store_domain_type == XS_LOCAL) { 109 110 struct xenbus_device *xdev = to_xenbus_device(dev); 110 111 111 - if (!xenbus_frontend_wq) { 112 - pr_err("%s: no workqueue to process delayed resume\n", 113 - xdev->nodename); 114 - return -EFAULT; 115 - } 116 - 117 - queue_work(xenbus_frontend_wq, &xdev->work); 112 + schedule_work(&xdev->work); 118 113 119 114 return 0; 120 115 } ··· 477 484 return err; 478 485 479 486 register_xenstore_notifier(&xenstore_notifier); 480 - 481 - if (xen_store_domain_type == XS_LOCAL) { 482 - xenbus_frontend_wq = create_workqueue("xenbus_frontend"); 483 - if (!xenbus_frontend_wq) 484 - pr_warn("create xenbus frontend workqueue failed, S3 resume is likely to fail\n"); 485 - } 486 487 487 488 return 0; 488 489 }
+77
drivers/xen/xlate_mmu.c
··· 29 29 */ 30 30 #include <linux/kernel.h> 31 31 #include <linux/mm.h> 32 + #include <linux/slab.h> 33 + #include <linux/vmalloc.h> 32 34 33 35 #include <asm/xen/hypercall.h> 34 36 #include <asm/xen/hypervisor.h> ··· 39 37 #include <xen/page.h> 40 38 #include <xen/interface/xen.h> 41 39 #include <xen/interface/memory.h> 40 + #include <xen/balloon.h> 42 41 43 42 typedef void (*xen_gfn_fn_t)(unsigned long gfn, void *data); 44 43 ··· 188 185 return 0; 189 186 } 190 187 EXPORT_SYMBOL_GPL(xen_xlate_unmap_gfn_range); 188 + 189 + struct map_balloon_pages { 190 + xen_pfn_t *pfns; 191 + unsigned int idx; 192 + }; 193 + 194 + static void setup_balloon_gfn(unsigned long gfn, void *data) 195 + { 196 + struct map_balloon_pages *info = data; 197 + 198 + info->pfns[info->idx++] = gfn; 199 + } 200 + 201 + /** 202 + * xen_xlate_map_ballooned_pages - map a new set of ballooned pages 203 + * @gfns: returns the array of corresponding GFNs 204 + * @virt: returns the virtual address of the mapped region 205 + * @nr_grant_frames: number of GFNs 206 + * @return 0 on success, error otherwise 207 + * 208 + * This allocates a set of ballooned pages and maps them into the 209 + * kernel's address space. 210 + */ 211 + int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt, 212 + unsigned long nr_grant_frames) 213 + { 214 + struct page **pages; 215 + xen_pfn_t *pfns; 216 + void *vaddr; 217 + struct map_balloon_pages data; 218 + int rc; 219 + unsigned long nr_pages; 220 + 221 + BUG_ON(nr_grant_frames == 0); 222 + nr_pages = DIV_ROUND_UP(nr_grant_frames, XEN_PFN_PER_PAGE); 223 + pages = kcalloc(nr_pages, sizeof(pages[0]), GFP_KERNEL); 224 + if (!pages) 225 + return -ENOMEM; 226 + 227 + pfns = kcalloc(nr_grant_frames, sizeof(pfns[0]), GFP_KERNEL); 228 + if (!pfns) { 229 + kfree(pages); 230 + return -ENOMEM; 231 + } 232 + rc = alloc_xenballooned_pages(nr_pages, pages); 233 + if (rc) { 234 + pr_warn("%s Couldn't balloon alloc %ld pages rc:%d\n", __func__, 235 + nr_pages, rc); 236 + kfree(pages); 237 + kfree(pfns); 238 + return rc; 239 + } 240 + 241 + data.pfns = pfns; 242 + data.idx = 0; 243 + xen_for_each_gfn(pages, nr_grant_frames, setup_balloon_gfn, &data); 244 + 245 + vaddr = vmap(pages, nr_pages, 0, PAGE_KERNEL); 246 + if (!vaddr) { 247 + pr_warn("%s Couldn't map %ld pages rc:%d\n", __func__, 248 + nr_pages, rc); 249 + free_xenballooned_pages(nr_pages, pages); 250 + kfree(pages); 251 + kfree(pfns); 252 + return -ENOMEM; 253 + } 254 + kfree(pages); 255 + 256 + *gfns = pfns; 257 + *virt = vaddr; 258 + 259 + return 0; 260 + } 261 + EXPORT_SYMBOL_GPL(xen_xlate_map_ballooned_pages);
-1
include/linux/kernel_stat.h
··· 92 92 extern void account_process_tick(struct task_struct *, int user); 93 93 #endif 94 94 95 - extern void account_steal_ticks(unsigned long ticks); 96 95 extern void account_idle_ticks(unsigned long ticks); 97 96 98 97 #endif /* _LINUX_KERNEL_STAT_H */
+2
include/linux/of_fdt.h
··· 53 53 extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, 54 54 int depth, void *data), 55 55 void *data); 56 + extern int of_get_flat_dt_subnode_by_name(unsigned long node, 57 + const char *uname); 56 58 extern const void *of_get_flat_dt_prop(unsigned long node, const char *name, 57 59 int *size); 58 60 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
+15
include/uapi/xen/evtchn.h
··· 85 85 #define IOCTL_EVTCHN_RESET \ 86 86 _IOC(_IOC_NONE, 'E', 5, 0) 87 87 88 + /* 89 + * Restrict this file descriptor so that it can only be used to bind 90 + * new interdomain events from one domain. 91 + * 92 + * Once a file descriptor has been restricted it cannot be 93 + * de-restricted, and must be closed and re-opened. Event channels 94 + * which were bound before restricting remain bound afterwards, and 95 + * can be notified as usual. 96 + */ 97 + #define IOCTL_EVTCHN_RESTRICT_DOMID \ 98 + _IOC(_IOC_NONE, 'E', 6, sizeof(struct ioctl_evtchn_restrict_domid)) 99 + struct ioctl_evtchn_restrict_domid { 100 + domid_t domid; 101 + }; 102 + 88 103 #endif /* __LINUX_PUBLIC_EVTCHN_H__ */
+34 -6
include/xen/interface/hvm/params.h
··· 27 27 * Parameter space for HVMOP_{set,get}_param. 28 28 */ 29 29 30 + #define HVM_PARAM_CALLBACK_IRQ 0 30 31 /* 31 32 * How should CPU0 event-channel notifications be delivered? 32 - * val[63:56] == 0: val[55:0] is a delivery GSI (Global System Interrupt). 33 - * val[63:56] == 1: val[55:0] is a delivery PCI INTx line, as follows: 34 - * Domain = val[47:32], Bus = val[31:16], 35 - * DevFn = val[15: 8], IntX = val[ 1: 0] 36 - * val[63:56] == 2: val[7:0] is a vector number. 33 + * 37 34 * If val == 0 then CPU0 event-channel notifications are not delivered. 35 + * If val != 0, val[63:56] encodes the type, as follows: 38 36 */ 39 - #define HVM_PARAM_CALLBACK_IRQ 0 37 + 38 + #define HVM_PARAM_CALLBACK_TYPE_GSI 0 39 + /* 40 + * val[55:0] is a delivery GSI. GSI 0 cannot be used, as it aliases val == 0, 41 + * and disables all notifications. 42 + */ 43 + 44 + #define HVM_PARAM_CALLBACK_TYPE_PCI_INTX 1 45 + /* 46 + * val[55:0] is a delivery PCI INTx line: 47 + * Domain = val[47:32], Bus = val[31:16] DevFn = val[15:8], IntX = val[1:0] 48 + */ 49 + 50 + #if defined(__i386__) || defined(__x86_64__) 51 + #define HVM_PARAM_CALLBACK_TYPE_VECTOR 2 52 + /* 53 + * val[7:0] is a vector number. Check for XENFEAT_hvm_callback_vector to know 54 + * if this delivery method is available. 55 + */ 56 + #elif defined(__arm__) || defined(__aarch64__) 57 + #define HVM_PARAM_CALLBACK_TYPE_PPI 2 58 + /* 59 + * val[55:16] needs to be zero. 60 + * val[15:8] is interrupt flag of the PPI used by event-channel: 61 + * bit 8: the PPI is edge(1) or level(0) triggered 62 + * bit 9: the PPI is active low(1) or high(0) 63 + * val[7:0] is a PPI number used by event-channel. 64 + * This is only used by ARM/ARM64 and masking/eoi the interrupt associated to 65 + * the notification is handled by the interrupt controller. 66 + */ 67 + #endif 40 68 41 69 #define HVM_PARAM_STORE_PFN 1 42 70 #define HVM_PARAM_STORE_EVTCHN 2
+1
include/xen/interface/memory.h
··· 160 160 #define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another dom, 161 161 * XENMEM_add_to_physmap_range only. 162 162 */ 163 + #define XENMAPSPACE_dev_mmio 5 /* device mmio region */ 163 164 164 165 /* 165 166 * Sets the GPFN at which a particular page appears in the specified guest's
+15 -9
include/xen/interface/vcpu.h
··· 75 75 */ 76 76 #define VCPUOP_get_runstate_info 4 77 77 struct vcpu_runstate_info { 78 - /* VCPU's current state (RUNSTATE_*). */ 79 - int state; 80 - /* When was current state entered (system time, ns)? */ 81 - uint64_t state_entry_time; 82 - /* 83 - * Time spent in each RUNSTATE_* (ns). The sum of these times is 84 - * guaranteed not to drift from system time. 85 - */ 86 - uint64_t time[4]; 78 + /* VCPU's current state (RUNSTATE_*). */ 79 + int state; 80 + /* When was current state entered (system time, ns)? */ 81 + uint64_t state_entry_time; 82 + /* 83 + * Update indicator set in state_entry_time: 84 + * When activated via VMASST_TYPE_runstate_update_flag, set during 85 + * updates in guest memory mapped copy of vcpu_runstate_info. 86 + */ 87 + #define XEN_RUNSTATE_UPDATE (1ULL << 63) 88 + /* 89 + * Time spent in each RUNSTATE_* (ns). The sum of these times is 90 + * guaranteed not to drift from system time. 91 + */ 92 + uint64_t time[4]; 87 93 }; 88 94 DEFINE_GUEST_HANDLE_STRUCT(vcpu_runstate_info); 89 95
+16 -1
include/xen/interface/xen.h
··· 413 413 /* x86/PAE guests: support PDPTs above 4GB. */ 414 414 #define VMASST_TYPE_pae_extended_cr3 3 415 415 416 - #define MAX_VMASST_TYPE 3 416 + /* 417 + * x86 guests: Sane behaviour for virtual iopl 418 + * - virtual iopl updated from do_iret() hypercalls. 419 + * - virtual iopl reported in bounce frames. 420 + * - guest kernels assumed to be level 0 for the purpose of iopl checks. 421 + */ 422 + #define VMASST_TYPE_architectural_iopl 4 423 + 424 + /* 425 + * All guests: activate update indicator in vcpu_runstate_info 426 + * Enable setting the XEN_RUNSTATE_UPDATE flag in guest memory mapped 427 + * vcpu_runstate_info during updates of the runstate information. 428 + */ 429 + #define VMASST_TYPE_runstate_update_flag 5 430 + 431 + #define MAX_VMASST_TYPE 5 417 432 418 433 #ifndef __ASSEMBLY__ 419 434
+32 -8
include/xen/xen-ops.h
··· 9 9 10 10 DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); 11 11 12 + DECLARE_PER_CPU(int, xen_vcpu_id); 13 + static inline int xen_vcpu_nr(int cpu) 14 + { 15 + return per_cpu(xen_vcpu_id, cpu); 16 + } 17 + 12 18 void xen_arch_pre_suspend(void); 13 19 void xen_arch_post_suspend(int suspend_cancelled); 14 20 ··· 27 21 28 22 bool xen_vcpu_stolen(int vcpu); 29 23 void xen_setup_runstate_info(int cpu); 24 + void xen_time_setup_guest(void); 30 25 void xen_get_runstate_snapshot(struct vcpu_runstate_info *res); 26 + u64 xen_steal_clock(int cpu); 31 27 32 28 int xen_setup_shutdown_event(void); 33 29 ··· 93 85 struct page **pages); 94 86 int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma, 95 87 int nr, struct page **pages); 88 + int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr, 89 + unsigned long nr_grant_frames); 96 90 97 91 bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); 98 92 99 - #ifdef CONFIG_XEN_EFI 100 - extern efi_system_table_t *xen_efi_probe(void); 101 - #else 102 - static inline efi_system_table_t __init *xen_efi_probe(void) 103 - { 104 - return NULL; 105 - } 106 - #endif 93 + efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc); 94 + efi_status_t xen_efi_set_time(efi_time_t *tm); 95 + efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, 96 + efi_time_t *tm); 97 + efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm); 98 + efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, 99 + u32 *attr, unsigned long *data_size, 100 + void *data); 101 + efi_status_t xen_efi_get_next_variable(unsigned long *name_size, 102 + efi_char16_t *name, efi_guid_t *vendor); 103 + efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, 104 + u32 attr, unsigned long data_size, 105 + void *data); 106 + efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, 107 + u64 *remaining_space, 108 + u64 *max_variable_size); 109 + efi_status_t xen_efi_get_next_high_mono_count(u32 *count); 110 + efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, 111 + unsigned long count, unsigned long sg_list); 112 + efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, 113 + unsigned long count, u64 *max_size, 114 + int *reset_type); 107 115 108 116 #ifdef CONFIG_PREEMPT 109 117
-10
kernel/sched/cputime.c
··· 503 503 } 504 504 505 505 /* 506 - * Account multiple ticks of steal time. 507 - * @p: the process from which the cpu time has been stolen 508 - * @ticks: number of stolen ticks 509 - */ 510 - void account_steal_ticks(unsigned long ticks) 511 - { 512 - account_steal_time(jiffies_to_cputime(ticks)); 513 - } 514 - 515 - /* 516 506 * Account multiple ticks of idle time. 517 507 * @ticks: number of stolen ticks 518 508 */