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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull KVM fixes from Paolo Bonzini:
"ARM fixes:
- A bug in handling of SPE state for non-vhe systems
- A fix for a crash on system shutdown
- Three timer fixes, introduced by the timer optimizations for v4.15

x86 fixes:
- fix for a WARN that was introduced in 4.15
- fix for SMM when guest uses PCID
- fixes for several bugs found by syzkaller

... and a dozen papercut fixes for the kvm_stat tool"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (22 commits)
tools/kvm_stat: sort '-f help' output
kvm: x86: fix RSM when PCID is non-zero
KVM: Fix stack-out-of-bounds read in write_mmio
KVM: arm/arm64: Fix timer enable flow
KVM: arm/arm64: Properly handle arch-timer IRQs after vtimer_save_state
KVM: arm/arm64: timer: Don't set irq as forwarded if no usable GIC
KVM: arm/arm64: Fix HYP unmapping going off limits
arm64: kvm: Prevent restoring stale PMSCR_EL1 for vcpu
KVM/x86: Check input paging mode when cs.l is set
tools/kvm_stat: add line for totals
tools/kvm_stat: stop ignoring unhandled arguments
tools/kvm_stat: suppress usage information on command line errors
tools/kvm_stat: handle invalid regular expressions
tools/kvm_stat: add hint on '-f help' to man page
tools/kvm_stat: fix child trace events accounting
tools/kvm_stat: fix extra handling of 'help' with fields filter
tools/kvm_stat: fix missing field update after filter change
tools/kvm_stat: fix drilldown in events-by-guests mode
tools/kvm_stat: fix command line option '-g'
kvm: x86: fix WARN due to uninitialized guest FPU state
...

+151 -85
+3
arch/arm64/kvm/hyp/debug-sr.c
··· 74 74 { 75 75 u64 reg; 76 76 77 + /* Clear pmscr in case of early return */ 78 + *pmscr_el1 = 0; 79 + 77 80 /* SPE present on this CPU? */ 78 81 if (!cpuid_feature_extract_unsigned_field(read_sysreg(id_aa64dfr0_el1), 79 82 ID_AA64DFR0_PMSVER_SHIFT))
+25 -7
arch/x86/kvm/emulate.c
··· 2390 2390 } 2391 2391 2392 2392 static int rsm_enter_protected_mode(struct x86_emulate_ctxt *ctxt, 2393 - u64 cr0, u64 cr4) 2393 + u64 cr0, u64 cr3, u64 cr4) 2394 2394 { 2395 2395 int bad; 2396 + u64 pcid; 2397 + 2398 + /* In order to later set CR4.PCIDE, CR3[11:0] must be zero. */ 2399 + pcid = 0; 2400 + if (cr4 & X86_CR4_PCIDE) { 2401 + pcid = cr3 & 0xfff; 2402 + cr3 &= ~0xfff; 2403 + } 2404 + 2405 + bad = ctxt->ops->set_cr(ctxt, 3, cr3); 2406 + if (bad) 2407 + return X86EMUL_UNHANDLEABLE; 2396 2408 2397 2409 /* 2398 2410 * First enable PAE, long mode needs it before CR0.PG = 1 is set. ··· 2423 2411 bad = ctxt->ops->set_cr(ctxt, 4, cr4); 2424 2412 if (bad) 2425 2413 return X86EMUL_UNHANDLEABLE; 2414 + if (pcid) { 2415 + bad = ctxt->ops->set_cr(ctxt, 3, cr3 | pcid); 2416 + if (bad) 2417 + return X86EMUL_UNHANDLEABLE; 2418 + } 2419 + 2426 2420 } 2427 2421 2428 2422 return X86EMUL_CONTINUE; ··· 2439 2421 struct desc_struct desc; 2440 2422 struct desc_ptr dt; 2441 2423 u16 selector; 2442 - u32 val, cr0, cr4; 2424 + u32 val, cr0, cr3, cr4; 2443 2425 int i; 2444 2426 2445 2427 cr0 = GET_SMSTATE(u32, smbase, 0x7ffc); 2446 - ctxt->ops->set_cr(ctxt, 3, GET_SMSTATE(u32, smbase, 0x7ff8)); 2428 + cr3 = GET_SMSTATE(u32, smbase, 0x7ff8); 2447 2429 ctxt->eflags = GET_SMSTATE(u32, smbase, 0x7ff4) | X86_EFLAGS_FIXED; 2448 2430 ctxt->_eip = GET_SMSTATE(u32, smbase, 0x7ff0); 2449 2431 ··· 2485 2467 2486 2468 ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smbase, 0x7ef8)); 2487 2469 2488 - return rsm_enter_protected_mode(ctxt, cr0, cr4); 2470 + return rsm_enter_protected_mode(ctxt, cr0, cr3, cr4); 2489 2471 } 2490 2472 2491 2473 static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt, u64 smbase) 2492 2474 { 2493 2475 struct desc_struct desc; 2494 2476 struct desc_ptr dt; 2495 - u64 val, cr0, cr4; 2477 + u64 val, cr0, cr3, cr4; 2496 2478 u32 base3; 2497 2479 u16 selector; 2498 2480 int i, r; ··· 2509 2491 ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1); 2510 2492 2511 2493 cr0 = GET_SMSTATE(u64, smbase, 0x7f58); 2512 - ctxt->ops->set_cr(ctxt, 3, GET_SMSTATE(u64, smbase, 0x7f50)); 2494 + cr3 = GET_SMSTATE(u64, smbase, 0x7f50); 2513 2495 cr4 = GET_SMSTATE(u64, smbase, 0x7f48); 2514 2496 ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smbase, 0x7f00)); 2515 2497 val = GET_SMSTATE(u64, smbase, 0x7ed0); ··· 2537 2519 dt.address = GET_SMSTATE(u64, smbase, 0x7e68); 2538 2520 ctxt->ops->set_gdt(ctxt, &dt); 2539 2521 2540 - r = rsm_enter_protected_mode(ctxt, cr0, cr4); 2522 + r = rsm_enter_protected_mode(ctxt, cr0, cr3, cr4); 2541 2523 if (r != X86EMUL_CONTINUE) 2542 2524 return r; 2543 2525
+4 -4
arch/x86/kvm/mmu.c
··· 3395 3395 spin_lock(&vcpu->kvm->mmu_lock); 3396 3396 if(make_mmu_pages_available(vcpu) < 0) { 3397 3397 spin_unlock(&vcpu->kvm->mmu_lock); 3398 - return 1; 3398 + return -ENOSPC; 3399 3399 } 3400 3400 sp = kvm_mmu_get_page(vcpu, 0, 0, 3401 3401 vcpu->arch.mmu.shadow_root_level, 1, ACC_ALL); ··· 3410 3410 spin_lock(&vcpu->kvm->mmu_lock); 3411 3411 if (make_mmu_pages_available(vcpu) < 0) { 3412 3412 spin_unlock(&vcpu->kvm->mmu_lock); 3413 - return 1; 3413 + return -ENOSPC; 3414 3414 } 3415 3415 sp = kvm_mmu_get_page(vcpu, i << (30 - PAGE_SHIFT), 3416 3416 i << 30, PT32_ROOT_LEVEL, 1, ACC_ALL); ··· 3450 3450 spin_lock(&vcpu->kvm->mmu_lock); 3451 3451 if (make_mmu_pages_available(vcpu) < 0) { 3452 3452 spin_unlock(&vcpu->kvm->mmu_lock); 3453 - return 1; 3453 + return -ENOSPC; 3454 3454 } 3455 3455 sp = kvm_mmu_get_page(vcpu, root_gfn, 0, 3456 3456 vcpu->arch.mmu.shadow_root_level, 0, ACC_ALL); ··· 3487 3487 spin_lock(&vcpu->kvm->mmu_lock); 3488 3488 if (make_mmu_pages_available(vcpu) < 0) { 3489 3489 spin_unlock(&vcpu->kvm->mmu_lock); 3490 - return 1; 3490 + return -ENOSPC; 3491 3491 } 3492 3492 sp = kvm_mmu_get_page(vcpu, root_gfn, i << 30, PT32_ROOT_LEVEL, 3493 3493 0, ACC_ALL);
+35 -13
arch/x86/kvm/x86.c
··· 4384 4384 addr, n, v)) 4385 4385 && kvm_io_bus_read(vcpu, KVM_MMIO_BUS, addr, n, v)) 4386 4386 break; 4387 - trace_kvm_mmio(KVM_TRACE_MMIO_READ, n, addr, *(u64 *)v); 4387 + trace_kvm_mmio(KVM_TRACE_MMIO_READ, n, addr, v); 4388 4388 handled += n; 4389 4389 addr += n; 4390 4390 len -= n; ··· 4643 4643 { 4644 4644 if (vcpu->mmio_read_completed) { 4645 4645 trace_kvm_mmio(KVM_TRACE_MMIO_READ, bytes, 4646 - vcpu->mmio_fragments[0].gpa, *(u64 *)val); 4646 + vcpu->mmio_fragments[0].gpa, val); 4647 4647 vcpu->mmio_read_completed = 0; 4648 4648 return 1; 4649 4649 } ··· 4665 4665 4666 4666 static int write_mmio(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes, void *val) 4667 4667 { 4668 - trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, bytes, gpa, *(u64 *)val); 4668 + trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, bytes, gpa, val); 4669 4669 return vcpu_mmio_write(vcpu, gpa, bytes, val); 4670 4670 } 4671 4671 4672 4672 static int read_exit_mmio(struct kvm_vcpu *vcpu, gpa_t gpa, 4673 4673 void *val, int bytes) 4674 4674 { 4675 - trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, bytes, gpa, 0); 4675 + trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, bytes, gpa, NULL); 4676 4676 return X86EMUL_IO_NEEDED; 4677 4677 } 4678 4678 ··· 7264 7264 7265 7265 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 7266 7266 { 7267 - struct fpu *fpu = &current->thread.fpu; 7268 7267 int r; 7269 7268 7270 - fpu__initialize(fpu); 7271 - 7272 7269 kvm_sigset_activate(vcpu); 7270 + 7271 + kvm_load_guest_fpu(vcpu); 7273 7272 7274 7273 if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) { 7275 7274 if (kvm_run->immediate_exit) { ··· 7295 7296 } 7296 7297 } 7297 7298 7298 - kvm_load_guest_fpu(vcpu); 7299 - 7300 7299 if (unlikely(vcpu->arch.complete_userspace_io)) { 7301 7300 int (*cui)(struct kvm_vcpu *) = vcpu->arch.complete_userspace_io; 7302 7301 vcpu->arch.complete_userspace_io = NULL; 7303 7302 r = cui(vcpu); 7304 7303 if (r <= 0) 7305 - goto out_fpu; 7304 + goto out; 7306 7305 } else 7307 7306 WARN_ON(vcpu->arch.pio.count || vcpu->mmio_needed); 7308 7307 ··· 7309 7312 else 7310 7313 r = vcpu_run(vcpu); 7311 7314 7312 - out_fpu: 7313 - kvm_put_guest_fpu(vcpu); 7314 7315 out: 7316 + kvm_put_guest_fpu(vcpu); 7315 7317 post_kvm_run_save(vcpu); 7316 7318 kvm_sigset_deactivate(vcpu); 7317 7319 ··· 7380 7384 #endif 7381 7385 7382 7386 kvm_rip_write(vcpu, regs->rip); 7383 - kvm_set_rflags(vcpu, regs->rflags); 7387 + kvm_set_rflags(vcpu, regs->rflags | X86_EFLAGS_FIXED); 7384 7388 7385 7389 vcpu->arch.exception.pending = false; 7386 7390 ··· 7494 7498 } 7495 7499 EXPORT_SYMBOL_GPL(kvm_task_switch); 7496 7500 7501 + int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) 7502 + { 7503 + if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG_BIT)) { 7504 + /* 7505 + * When EFER.LME and CR0.PG are set, the processor is in 7506 + * 64-bit mode (though maybe in a 32-bit code segment). 7507 + * CR4.PAE and EFER.LMA must be set. 7508 + */ 7509 + if (!(sregs->cr4 & X86_CR4_PAE_BIT) 7510 + || !(sregs->efer & EFER_LMA)) 7511 + return -EINVAL; 7512 + } else { 7513 + /* 7514 + * Not in 64-bit mode: EFER.LMA is clear and the code 7515 + * segment cannot be 64-bit. 7516 + */ 7517 + if (sregs->efer & EFER_LMA || sregs->cs.l) 7518 + return -EINVAL; 7519 + } 7520 + 7521 + return 0; 7522 + } 7523 + 7497 7524 int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, 7498 7525 struct kvm_sregs *sregs) 7499 7526 { ··· 7527 7508 7528 7509 if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) && 7529 7510 (sregs->cr4 & X86_CR4_OSXSAVE)) 7511 + return -EINVAL; 7512 + 7513 + if (kvm_valid_sregs(vcpu, sregs)) 7530 7514 return -EINVAL; 7531 7515 7532 7516 apic_base_msr.data = sregs->apic_base;
+1 -1
include/kvm/arm_arch_timer.h
··· 62 62 bool enabled; 63 63 }; 64 64 65 - int kvm_timer_hyp_init(void); 65 + int kvm_timer_hyp_init(bool); 66 66 int kvm_timer_enable(struct kvm_vcpu *vcpu); 67 67 int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); 68 68 void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
+5 -2
include/trace/events/kvm.h
··· 211 211 { KVM_TRACE_MMIO_WRITE, "write" } 212 212 213 213 TRACE_EVENT(kvm_mmio, 214 - TP_PROTO(int type, int len, u64 gpa, u64 val), 214 + TP_PROTO(int type, int len, u64 gpa, void *val), 215 215 TP_ARGS(type, len, gpa, val), 216 216 217 217 TP_STRUCT__entry( ··· 225 225 __entry->type = type; 226 226 __entry->len = len; 227 227 __entry->gpa = gpa; 228 - __entry->val = val; 228 + __entry->val = 0; 229 + if (val) 230 + memcpy(&__entry->val, val, 231 + min_t(u32, sizeof(__entry->val), len)); 229 232 ), 230 233 231 234 TP_printk("mmio %s len %u gpa 0x%llx val 0x%llx",
+43 -31
tools/kvm/kvm_stat/kvm_stat
··· 478 478 @staticmethod 479 479 def is_field_wanted(fields_filter, field): 480 480 """Indicate whether field is valid according to fields_filter.""" 481 - if not fields_filter or fields_filter == "help": 481 + if not fields_filter: 482 482 return True 483 483 return re.match(fields_filter, field) is not None 484 484 ··· 549 549 550 550 def update_fields(self, fields_filter): 551 551 """Refresh fields, applying fields_filter""" 552 - self._fields = [field for field in self.get_available_fields() 553 - if self.is_field_wanted(fields_filter, field)] 552 + self.fields = [field for field in self.get_available_fields() 553 + if self.is_field_wanted(fields_filter, field)] 554 554 555 555 @staticmethod 556 556 def get_online_cpus(): ··· 950 950 curses.nocbreak() 951 951 curses.endwin() 952 952 953 - def get_all_gnames(self): 953 + @staticmethod 954 + def get_all_gnames(): 954 955 """Returns a list of (pid, gname) tuples of all running guests""" 955 956 res = [] 956 957 try: ··· 964 963 # perform a sanity check before calling the more expensive 965 964 # function to possibly extract the guest name 966 965 if ' -name ' in line[1]: 967 - res.append((line[0], self.get_gname_from_pid(line[0]))) 966 + res.append((line[0], Tui.get_gname_from_pid(line[0]))) 968 967 child.stdout.close() 969 968 970 969 return res ··· 985 984 except Exception: 986 985 self.screen.addstr(row + 1, 2, 'Not available') 987 986 988 - def get_pid_from_gname(self, gname): 987 + @staticmethod 988 + def get_pid_from_gname(gname): 989 989 """Fuzzy function to convert guest name to QEMU process pid. 990 990 991 991 Returns a list of potential pids, can be empty if no match found. ··· 994 992 995 993 """ 996 994 pids = [] 997 - for line in self.get_all_gnames(): 995 + for line in Tui.get_all_gnames(): 998 996 if gname == line[1]: 999 997 pids.append(int(line[0])) 1000 998 ··· 1092 1090 # sort by totals 1093 1091 return (0, -stats[x][0]) 1094 1092 total = 0. 1095 - for val in stats.values(): 1096 - total += val[0] 1093 + for key in stats.keys(): 1094 + if key.find('(') is -1: 1095 + total += stats[key][0] 1097 1096 if self._sorting == SORT_DEFAULT: 1098 1097 sortkey = sortCurAvg 1099 1098 else: 1100 1099 sortkey = sortTotal 1100 + tavg = 0 1101 1101 for key in sorted(stats.keys(), key=sortkey): 1102 - 1103 - if row >= self.screen.getmaxyx()[0]: 1102 + if row >= self.screen.getmaxyx()[0] - 1: 1104 1103 break 1105 1104 values = stats[key] 1106 1105 if not values[0] and not values[1]: ··· 1113 1110 self.screen.addstr(row, 1, '%-40s %10d%7.1f %8s' % 1114 1111 (key, values[0], values[0] * 100 / total, 1115 1112 cur)) 1113 + if cur is not '' and key.find('(') is -1: 1114 + tavg += cur 1116 1115 row += 1 1117 1116 if row == 3: 1118 1117 self.screen.addstr(4, 1, 'No matching events reported yet') 1118 + else: 1119 + self.screen.addstr(row, 1, '%-40s %10d %8s' % 1120 + ('Total', total, tavg if tavg else ''), 1121 + curses.A_BOLD) 1119 1122 self.screen.refresh() 1120 1123 1121 1124 def show_msg(self, text): ··· 1367 1358 if char == 'x': 1368 1359 self.update_drilldown() 1369 1360 # prevents display of current values on next refresh 1370 - self.stats.get() 1361 + self.stats.get(self._display_guests) 1371 1362 except KeyboardInterrupt: 1372 1363 break 1373 1364 except curses.error: ··· 1460 1451 try: 1461 1452 pids = Tui.get_pid_from_gname(val) 1462 1453 except: 1463 - raise optparse.OptionValueError('Error while searching for guest ' 1464 - '"{}", use "-p" to specify a pid ' 1465 - 'instead'.format(val)) 1454 + sys.exit('Error while searching for guest "{}". Use "-p" to ' 1455 + 'specify a pid instead?'.format(val)) 1466 1456 if len(pids) == 0: 1467 - raise optparse.OptionValueError('No guest by the name "{}" ' 1468 - 'found'.format(val)) 1457 + sys.exit('Error: No guest by the name "{}" found'.format(val)) 1469 1458 if len(pids) > 1: 1470 - raise optparse.OptionValueError('Multiple processes found (pids: ' 1471 - '{}) - use "-p" to specify a pid ' 1472 - 'instead'.format(" ".join(pids))) 1459 + sys.exit('Error: Multiple processes found (pids: {}). Use "-p" ' 1460 + 'to specify the desired pid'.format(" ".join(pids))) 1473 1461 parser.values.pid = pids[0] 1474 1462 1475 1463 optparser = optparse.OptionParser(description=description_text, ··· 1524 1518 help='restrict statistics to guest by name', 1525 1519 callback=cb_guest_to_pid, 1526 1520 ) 1527 - (options, _) = optparser.parse_args(sys.argv) 1521 + options, unkn = optparser.parse_args(sys.argv) 1522 + if len(unkn) != 1: 1523 + sys.exit('Error: Extra argument(s): ' + ' '.join(unkn[1:])) 1524 + try: 1525 + # verify that we were passed a valid regex up front 1526 + re.compile(options.fields) 1527 + except re.error: 1528 + sys.exit('Error: "' + options.fields + '" is not a valid regular ' 1529 + 'expression') 1530 + 1528 1531 return options 1529 1532 1530 1533 ··· 1579 1564 1580 1565 stats = Stats(options) 1581 1566 1582 - if options.fields == "help": 1583 - event_list = "\n" 1584 - s = stats.get() 1585 - for key in s.keys(): 1586 - if key.find('(') != -1: 1587 - key = key[0:key.find('(')] 1588 - if event_list.find('\n' + key + '\n') == -1: 1589 - event_list += key + '\n' 1590 - sys.stdout.write(event_list) 1591 - return "" 1567 + if options.fields == 'help': 1568 + stats.fields_filter = None 1569 + event_list = [] 1570 + for key in stats.get().keys(): 1571 + event_list.append(key.split('(', 1)[0]) 1572 + sys.stdout.write(' ' + '\n '.join(sorted(set(event_list))) + '\n') 1573 + sys.exit(0) 1592 1574 1593 1575 if options.log: 1594 1576 log(stats)
+3 -1
tools/kvm/kvm_stat/kvm_stat.txt
··· 50 50 *s*:: set update interval 51 51 52 52 *x*:: toggle reporting of stats for child trace events 53 + :: *Note*: The stats for the parents summarize the respective child trace 54 + events 53 55 54 56 Press any other key to refresh statistics immediately. 55 57 ··· 88 86 89 87 -f<fields>:: 90 88 --fields=<fields>:: 91 - fields to display (regex) 89 + fields to display (regex), "-f help" for a list of available events 92 90 93 91 -h:: 94 92 --help::
+24 -16
virt/kvm/arm/arch_timer.c
··· 92 92 { 93 93 struct kvm_vcpu *vcpu = *(struct kvm_vcpu **)dev_id; 94 94 struct arch_timer_context *vtimer; 95 + u32 cnt_ctl; 95 96 96 - if (!vcpu) { 97 - pr_warn_once("Spurious arch timer IRQ on non-VCPU thread\n"); 98 - return IRQ_NONE; 99 - } 97 + /* 98 + * We may see a timer interrupt after vcpu_put() has been called which 99 + * sets the CPU's vcpu pointer to NULL, because even though the timer 100 + * has been disabled in vtimer_save_state(), the hardware interrupt 101 + * signal may not have been retired from the interrupt controller yet. 102 + */ 103 + if (!vcpu) 104 + return IRQ_HANDLED; 105 + 100 106 vtimer = vcpu_vtimer(vcpu); 101 - 102 107 if (!vtimer->irq.level) { 103 - vtimer->cnt_ctl = read_sysreg_el0(cntv_ctl); 104 - if (kvm_timer_irq_can_fire(vtimer)) 108 + cnt_ctl = read_sysreg_el0(cntv_ctl); 109 + cnt_ctl &= ARCH_TIMER_CTRL_ENABLE | ARCH_TIMER_CTRL_IT_STAT | 110 + ARCH_TIMER_CTRL_IT_MASK; 111 + if (cnt_ctl == (ARCH_TIMER_CTRL_ENABLE | ARCH_TIMER_CTRL_IT_STAT)) 105 112 kvm_timer_update_irq(vcpu, true, vtimer); 106 113 } 107 114 ··· 362 355 363 356 /* Disable the virtual timer */ 364 357 write_sysreg_el0(0, cntv_ctl); 358 + isb(); 365 359 366 360 vtimer->loaded = false; 367 361 out: ··· 728 720 return 0; 729 721 } 730 722 731 - int kvm_timer_hyp_init(void) 723 + int kvm_timer_hyp_init(bool has_gic) 732 724 { 733 725 struct arch_timer_kvm_info *info; 734 726 int err; ··· 764 756 return err; 765 757 } 766 758 767 - err = irq_set_vcpu_affinity(host_vtimer_irq, kvm_get_running_vcpus()); 768 - if (err) { 769 - kvm_err("kvm_arch_timer: error setting vcpu affinity\n"); 770 - goto out_free_irq; 759 + if (has_gic) { 760 + err = irq_set_vcpu_affinity(host_vtimer_irq, 761 + kvm_get_running_vcpus()); 762 + if (err) { 763 + kvm_err("kvm_arch_timer: error setting vcpu affinity\n"); 764 + goto out_free_irq; 765 + } 771 766 } 772 767 773 768 kvm_info("virtual timer IRQ%d\n", host_vtimer_irq); ··· 846 835 no_vgic: 847 836 preempt_disable(); 848 837 timer->enabled = 1; 849 - if (!irqchip_in_kernel(vcpu->kvm)) 850 - kvm_timer_vcpu_load_user(vcpu); 851 - else 852 - kvm_timer_vcpu_load_vgic(vcpu); 838 + kvm_timer_vcpu_load(vcpu); 853 839 preempt_enable(); 854 840 855 841 return 0;
+1 -1
virt/kvm/arm/arm.c
··· 1326 1326 /* 1327 1327 * Init HYP architected timer support 1328 1328 */ 1329 - err = kvm_timer_hyp_init(); 1329 + err = kvm_timer_hyp_init(vgic_present); 1330 1330 if (err) 1331 1331 goto out; 1332 1332
+3 -3
virt/kvm/arm/mmio.c
··· 112 112 } 113 113 114 114 trace_kvm_mmio(KVM_TRACE_MMIO_READ, len, run->mmio.phys_addr, 115 - data); 115 + &data); 116 116 data = vcpu_data_host_to_guest(vcpu, data, len); 117 117 vcpu_set_reg(vcpu, vcpu->arch.mmio_decode.rt, data); 118 118 } ··· 182 182 data = vcpu_data_guest_to_host(vcpu, vcpu_get_reg(vcpu, rt), 183 183 len); 184 184 185 - trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, len, fault_ipa, data); 185 + trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, len, fault_ipa, &data); 186 186 kvm_mmio_write_buf(data_buf, len, data); 187 187 188 188 ret = kvm_io_bus_write(vcpu, KVM_MMIO_BUS, fault_ipa, len, 189 189 data_buf); 190 190 } else { 191 191 trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, len, 192 - fault_ipa, 0); 192 + fault_ipa, NULL); 193 193 194 194 ret = kvm_io_bus_read(vcpu, KVM_MMIO_BUS, fault_ipa, len, 195 195 data_buf);
+4 -6
virt/kvm/arm/mmu.c
··· 509 509 */ 510 510 void free_hyp_pgds(void) 511 511 { 512 - unsigned long addr; 513 - 514 512 mutex_lock(&kvm_hyp_pgd_mutex); 515 513 516 514 if (boot_hyp_pgd) { ··· 519 521 520 522 if (hyp_pgd) { 521 523 unmap_hyp_range(hyp_pgd, hyp_idmap_start, PAGE_SIZE); 522 - for (addr = PAGE_OFFSET; virt_addr_valid(addr); addr += PGDIR_SIZE) 523 - unmap_hyp_range(hyp_pgd, kern_hyp_va(addr), PGDIR_SIZE); 524 - for (addr = VMALLOC_START; is_vmalloc_addr((void*)addr); addr += PGDIR_SIZE) 525 - unmap_hyp_range(hyp_pgd, kern_hyp_va(addr), PGDIR_SIZE); 524 + unmap_hyp_range(hyp_pgd, kern_hyp_va(PAGE_OFFSET), 525 + (uintptr_t)high_memory - PAGE_OFFSET); 526 + unmap_hyp_range(hyp_pgd, kern_hyp_va(VMALLOC_START), 527 + VMALLOC_END - VMALLOC_START); 526 528 527 529 free_pages((unsigned long)hyp_pgd, hyp_pgd_order); 528 530 hyp_pgd = NULL;