diff options
-rw-r--r-- | drivers/kvm/kvm.h | 8 | ||||
-rw-r--r-- | drivers/kvm/kvm_main.c | 18 | ||||
-rw-r--r-- | drivers/kvm/svm.c | 4 | ||||
-rw-r--r-- | drivers/kvm/vmx.c | 2 |
4 files changed, 19 insertions, 13 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index cfda3abff89a..6d258261891e 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -474,6 +474,14 @@ struct kvm_arch_ops { | |||
474 | 474 | ||
475 | extern struct kvm_arch_ops *kvm_arch_ops; | 475 | extern struct kvm_arch_ops *kvm_arch_ops; |
476 | 476 | ||
477 | /* The guest did something we don't support. */ | ||
478 | #define pr_unimpl(vcpu, fmt, ...) \ | ||
479 | do { \ | ||
480 | if (printk_ratelimit()) \ | ||
481 | printk(KERN_ERR "kvm: %i: cpu%i " fmt, \ | ||
482 | current->tgid, (vcpu)->vcpu_id , ## __VA_ARGS__); \ | ||
483 | } while(0) | ||
484 | |||
477 | #define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt) | 485 | #define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt) |
478 | #define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt) | 486 | #define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt) |
479 | 487 | ||
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 9de3b1aba20f..1b86ab0d42f6 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -962,8 +962,7 @@ static int emulator_write_std(unsigned long addr, | |||
962 | unsigned int bytes, | 962 | unsigned int bytes, |
963 | struct kvm_vcpu *vcpu) | 963 | struct kvm_vcpu *vcpu) |
964 | { | 964 | { |
965 | printk(KERN_ERR "emulator_write_std: addr %lx n %d\n", | 965 | pr_unimpl(vcpu, "emulator_write_std: addr %lx n %d\n", addr, bytes); |
966 | addr, bytes); | ||
967 | return X86EMUL_UNHANDLEABLE; | 966 | return X86EMUL_UNHANDLEABLE; |
968 | } | 967 | } |
969 | 968 | ||
@@ -1138,8 +1137,7 @@ int emulator_get_dr(struct x86_emulate_ctxt* ctxt, int dr, unsigned long *dest) | |||
1138 | *dest = kvm_arch_ops->get_dr(vcpu, dr); | 1137 | *dest = kvm_arch_ops->get_dr(vcpu, dr); |
1139 | return X86EMUL_CONTINUE; | 1138 | return X86EMUL_CONTINUE; |
1140 | default: | 1139 | default: |
1141 | printk(KERN_DEBUG "%s: unexpected dr %u\n", | 1140 | pr_unimpl(vcpu, "%s: unexpected dr %u\n", __FUNCTION__, dr); |
1142 | __FUNCTION__, dr); | ||
1143 | return X86EMUL_UNHANDLEABLE; | 1141 | return X86EMUL_UNHANDLEABLE; |
1144 | } | 1142 | } |
1145 | } | 1143 | } |
@@ -1488,7 +1486,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) | |||
1488 | break; | 1486 | break; |
1489 | #endif | 1487 | #endif |
1490 | default: | 1488 | default: |
1491 | printk(KERN_ERR "kvm: unhandled rdmsr: 0x%x\n", msr); | 1489 | pr_unimpl(vcpu, "unhandled rdmsr: 0x%x\n", msr); |
1492 | return 1; | 1490 | return 1; |
1493 | } | 1491 | } |
1494 | *pdata = data; | 1492 | *pdata = data; |
@@ -1543,11 +1541,11 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
1543 | break; | 1541 | break; |
1544 | #endif | 1542 | #endif |
1545 | case MSR_IA32_MC0_STATUS: | 1543 | case MSR_IA32_MC0_STATUS: |
1546 | printk(KERN_WARNING "%s: MSR_IA32_MC0_STATUS 0x%llx, nop\n", | 1544 | pr_unimpl(vcpu, "%s: MSR_IA32_MC0_STATUS 0x%llx, nop\n", |
1547 | __FUNCTION__, data); | 1545 | __FUNCTION__, data); |
1548 | break; | 1546 | break; |
1549 | case MSR_IA32_MCG_STATUS: | 1547 | case MSR_IA32_MCG_STATUS: |
1550 | printk(KERN_WARNING "%s: MSR_IA32_MCG_STATUS 0x%llx, nop\n", | 1548 | pr_unimpl(vcpu, "%s: MSR_IA32_MCG_STATUS 0x%llx, nop\n", |
1551 | __FUNCTION__, data); | 1549 | __FUNCTION__, data); |
1552 | break; | 1550 | break; |
1553 | case MSR_IA32_UCODE_REV: | 1551 | case MSR_IA32_UCODE_REV: |
@@ -1567,7 +1565,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
1567 | return vcpu_register_para(vcpu, data); | 1565 | return vcpu_register_para(vcpu, data); |
1568 | 1566 | ||
1569 | default: | 1567 | default: |
1570 | printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr); | 1568 | pr_unimpl(vcpu, "unhandled wrmsr: 0x%x\n", msr); |
1571 | return 1; | 1569 | return 1; |
1572 | } | 1570 | } |
1573 | return 0; | 1571 | return 0; |
@@ -1798,7 +1796,7 @@ int kvm_setup_pio(struct kvm_vcpu *vcpu, struct kvm_run *run, int in, | |||
1798 | /* | 1796 | /* |
1799 | * String I/O in reverse. Yuck. Kill the guest, fix later. | 1797 | * String I/O in reverse. Yuck. Kill the guest, fix later. |
1800 | */ | 1798 | */ |
1801 | printk(KERN_ERR "kvm: guest string pio down\n"); | 1799 | pr_unimpl(vcpu, "guest string pio down\n"); |
1802 | inject_gp(vcpu); | 1800 | inject_gp(vcpu); |
1803 | return 1; | 1801 | return 1; |
1804 | } | 1802 | } |
@@ -1829,7 +1827,7 @@ int kvm_setup_pio(struct kvm_vcpu *vcpu, struct kvm_run *run, int in, | |||
1829 | ret = 1; | 1827 | ret = 1; |
1830 | } | 1828 | } |
1831 | } else if (pio_dev) | 1829 | } else if (pio_dev) |
1832 | printk(KERN_ERR "no string pio read support yet, " | 1830 | pr_unimpl(vcpu, "no string pio read support yet, " |
1833 | "port %x size %d count %ld\n", | 1831 | "port %x size %d count %ld\n", |
1834 | port, size, count); | 1832 | port, size, count); |
1835 | 1833 | ||
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 7beaff1789b1..3ec30d7c9b93 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -1167,7 +1167,7 @@ static int invalid_op_interception(struct vcpu_svm *svm, | |||
1167 | static int task_switch_interception(struct vcpu_svm *svm, | 1167 | static int task_switch_interception(struct vcpu_svm *svm, |
1168 | struct kvm_run *kvm_run) | 1168 | struct kvm_run *kvm_run) |
1169 | { | 1169 | { |
1170 | printk(KERN_DEBUG "%s: task swiche is unsupported\n", __FUNCTION__); | 1170 | pr_unimpl(&svm->vcpu, "%s: task switch is unsupported\n", __FUNCTION__); |
1171 | kvm_run->exit_reason = KVM_EXIT_UNKNOWN; | 1171 | kvm_run->exit_reason = KVM_EXIT_UNKNOWN; |
1172 | return 0; | 1172 | return 0; |
1173 | } | 1173 | } |
@@ -1183,7 +1183,7 @@ static int emulate_on_interception(struct vcpu_svm *svm, | |||
1183 | struct kvm_run *kvm_run) | 1183 | struct kvm_run *kvm_run) |
1184 | { | 1184 | { |
1185 | if (emulate_instruction(&svm->vcpu, NULL, 0, 0) != EMULATE_DONE) | 1185 | if (emulate_instruction(&svm->vcpu, NULL, 0, 0) != EMULATE_DONE) |
1186 | printk(KERN_ERR "%s: failed\n", __FUNCTION__); | 1186 | pr_unimpl(&svm->vcpu, "%s: failed\n", __FUNCTION__); |
1187 | return 1; | 1187 | return 1; |
1188 | } | 1188 | } |
1189 | 1189 | ||
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 3bf36508c84b..ae54d9a24ce8 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -1920,7 +1920,7 @@ static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1920 | break; | 1920 | break; |
1921 | } | 1921 | } |
1922 | kvm_run->exit_reason = 0; | 1922 | kvm_run->exit_reason = 0; |
1923 | printk(KERN_ERR "kvm: unhandled control register: op %d cr %d\n", | 1923 | pr_unimpl(vcpu, "unhandled control register: op %d cr %d\n", |
1924 | (int)(exit_qualification >> 4) & 3, cr); | 1924 | (int)(exit_qualification >> 4) & 3, cr); |
1925 | return 0; | 1925 | return 0; |
1926 | } | 1926 | } |