kvm-s390.c (414d3b07496604a4372466a6b474ca24291a143c) kvm-s390.c (b2d73b2a0ad1c758cb0c1acb01a911744b845942)
1/*
2 * hosting zSeries kernel virtual machines
3 *
4 * Copyright IBM Corp. 2008, 2009
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.

--- 7 unchanged lines hidden (view full) ---

16
17#include <linux/compiler.h>
18#include <linux/err.h>
19#include <linux/fs.h>
20#include <linux/hrtimer.h>
21#include <linux/init.h>
22#include <linux/kvm.h>
23#include <linux/kvm_host.h>
1/*
2 * hosting zSeries kernel virtual machines
3 *
4 * Copyright IBM Corp. 2008, 2009
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.

--- 7 unchanged lines hidden (view full) ---

16
17#include <linux/compiler.h>
18#include <linux/err.h>
19#include <linux/fs.h>
20#include <linux/hrtimer.h>
21#include <linux/init.h>
22#include <linux/kvm.h>
23#include <linux/kvm_host.h>
24#include <linux/mman.h>
24#include <linux/module.h>
25#include <linux/random.h>
26#include <linux/slab.h>
27#include <linux/timer.h>
28#include <linux/vmalloc.h>
29#include <linux/bitmap.h>
30#include <asm/asm-offsets.h>
31#include <asm/lowcore.h>

--- 148 unchanged lines hidden (view full) ---

180
181static struct notifier_block kvm_clock_notifier = {
182 .notifier_call = kvm_clock_sync,
183};
184
185int kvm_arch_hardware_setup(void)
186{
187 gmap_notifier.notifier_call = kvm_gmap_notifier;
25#include <linux/module.h>
26#include <linux/random.h>
27#include <linux/slab.h>
28#include <linux/timer.h>
29#include <linux/vmalloc.h>
30#include <linux/bitmap.h>
31#include <asm/asm-offsets.h>
32#include <asm/lowcore.h>

--- 148 unchanged lines hidden (view full) ---

181
182static struct notifier_block kvm_clock_notifier = {
183 .notifier_call = kvm_clock_sync,
184};
185
186int kvm_arch_hardware_setup(void)
187{
188 gmap_notifier.notifier_call = kvm_gmap_notifier;
188 gmap_register_ipte_notifier(&gmap_notifier);
189 gmap_register_pte_notifier(&gmap_notifier);
189 atomic_notifier_chain_register(&s390_epoch_delta_notifier,
190 &kvm_clock_notifier);
191 return 0;
192}
193
194void kvm_arch_hardware_unsetup(void)
195{
190 atomic_notifier_chain_register(&s390_epoch_delta_notifier,
191 &kvm_clock_notifier);
192 return 0;
193}
194
195void kvm_arch_hardware_unsetup(void)
196{
196 gmap_unregister_ipte_notifier(&gmap_notifier);
197 gmap_unregister_pte_notifier(&gmap_notifier);
197 atomic_notifier_chain_unregister(&s390_epoch_delta_notifier,
198 &kvm_clock_notifier);
199}
200
201static void allow_cpu_feat(unsigned long nr)
202{
203 set_bit_inv(nr, kvm_s390_available_cpu_feat);
204}

--- 2062 unchanged lines hidden (view full) ---

2267static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
2268{
2269retry:
2270 kvm_s390_vcpu_request_handled(vcpu);
2271 if (!vcpu->requests)
2272 return 0;
2273 /*
2274 * We use MMU_RELOAD just to re-arm the ipte notifier for the
198 atomic_notifier_chain_unregister(&s390_epoch_delta_notifier,
199 &kvm_clock_notifier);
200}
201
202static void allow_cpu_feat(unsigned long nr)
203{
204 set_bit_inv(nr, kvm_s390_available_cpu_feat);
205}

--- 2062 unchanged lines hidden (view full) ---

2268static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
2269{
2270retry:
2271 kvm_s390_vcpu_request_handled(vcpu);
2272 if (!vcpu->requests)
2273 return 0;
2274 /*
2275 * We use MMU_RELOAD just to re-arm the ipte notifier for the
2275 * guest prefix page. gmap_ipte_notify will wait on the ptl lock.
2276 * guest prefix page. gmap_mprotect_notify will wait on the ptl lock.
2276 * This ensures that the ipte instruction for this request has
2277 * already finished. We might race against a second unmapper that
2278 * wants to set the blocking bit. Lets just retry the request loop.
2279 */
2280 if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu)) {
2281 int rc;
2277 * This ensures that the ipte instruction for this request has
2278 * already finished. We might race against a second unmapper that
2279 * wants to set the blocking bit. Lets just retry the request loop.
2280 */
2281 if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu)) {
2282 int rc;
2282 rc = gmap_ipte_notify(vcpu->arch.gmap,
2283 kvm_s390_get_prefix(vcpu),
2284 PAGE_SIZE * 2);
2283 rc = gmap_mprotect_notify(vcpu->arch.gmap,
2284 kvm_s390_get_prefix(vcpu),
2285 PAGE_SIZE * 2, PROT_WRITE);
2285 if (rc)
2286 return rc;
2287 goto retry;
2288 }
2289
2290 if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu)) {
2291 vcpu->arch.sie_block->ihcpu = 0xffff;
2292 goto retry;

--- 945 unchanged lines hidden ---
2286 if (rc)
2287 return rc;
2288 goto retry;
2289 }
2290
2291 if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu)) {
2292 vcpu->arch.sie_block->ihcpu = 0xffff;
2293 goto retry;

--- 945 unchanged lines hidden ---