Displaying 20 results from an estimated 106 matches for "rpl".
Did you mean:
rp
2007 Apr 18
3
QEMU virtualization and segment RPL
...g like VMI is expected to be supported soon by QEMU, I have a
small question: does the virtualization API you are defining supports
that the guest kernel code can be executed in ring 3 ?
In QEMU for example, the guest kernel code can be executed either by the
dynamic translator (in this case CS.rpl = 0 and SS.rpl = 0) or by the
kqemu kernel module (in this case CS.rpl = 3 and SS.rpl = 3). So a good
behaviour would be to ignore the rpl field of both CS and SS in kernel mode.
Regards,
Fabrice.
2020 Jul 21
0
[PATCH v9 56/84] KVM: introspection: add KVMI_VCPU_GET_REGISTERS
...(vcpu, sregs);
+ *mode = kvmi_vcpu_mode(vcpu, sregs);
+
+ for (; msr < end && !err; msr++) {
+ m.index = msr->index;
+
+ err = kvm_x86_ops.get_msr(vcpu, &m);
+
+ if (!err)
+ msr->data = m.data;
+ }
+
+ return err ? -KVM_EINVAL : 0;
+}
+
+static bool valid_reply_size(size_t rpl_size)
+{
+ size_t msg_size;
+
+ if (check_add_overflow(sizeof(struct kvmi_error_code),
+ rpl_size, &msg_size))
+ return false;
+
+ if (msg_size > KVMI_MSG_SIZE)
+ return false;
+
+ return true;
+}
+
+int kvmi_arch_cmd_vcpu_get_registers(struct kvm_vcpu *vcpu,
+ const struct kvmi_msg_...
2020 Feb 07
0
[RFC PATCH v7 54/78] KVM: introspection: add KVMI_VCPU_GET_REGISTERS
...cf2d19ba0f 100644
--- a/arch/x86/kvm/kvmi.c
+++ b/arch/x86/kvm/kvmi.c
@@ -70,3 +70,73 @@ int kvmi_arch_cmd_vcpu_get_info(struct kvm_vcpu *vcpu,
return 0;
}
+
+static void *
+alloc_get_registers_reply(const struct kvmi_msg_hdr *msg,
+ const struct kvmi_vcpu_get_registers *req,
+ size_t *rpl_size)
+{
+ struct kvmi_vcpu_get_registers_reply *rpl;
+ u16 k, n = req->nmsrs;
+
+ *rpl_size = struct_size(rpl, msrs.entries, n);
+ rpl = kvmi_msg_alloc_check(*rpl_size);
+ if (rpl) {
+ rpl->msrs.nmsrs = n;
+
+ for (k = 0; k < n; k++)
+ rpl->msrs.entries[k].index = req->msrs_idx[...
2020 Jul 21
0
[PATCH v9 58/84] KVM: introspection: add KVMI_VCPU_GET_CPUID
...nsigned int kvmi_vcpu_mode(const struct kvm_vcpu *vcpu,
@@ -191,3 +192,21 @@ int kvmi_arch_cmd_vcpu_get_registers(struct kvm_vcpu *vcpu,
return err;
}
+
+int kvmi_arch_cmd_vcpu_get_cpuid(struct kvm_vcpu *vcpu,
+ const struct kvmi_vcpu_get_cpuid *req,
+ struct kvmi_vcpu_get_cpuid_reply *rpl)
+{
+ struct kvm_cpuid_entry2 *e;
+
+ e = kvm_find_cpuid_entry(vcpu, req->function, req->index);
+ if (!e)
+ return -KVM_ENOENT;
+
+ rpl->eax = e->eax;
+ rpl->ebx = e->ebx;
+ rpl->ecx = e->ecx;
+ rpl->edx = e->edx;
+
+ return 0;
+}
diff --git a/include/uapi/linux/kvmi...
2020 Jul 21
0
[PATCH v9 70/84] KVM: introspection: add KVMI_VCPU_GET_XSAVE
...t_xsave_reply {
+ __u32 region[0];
+};
+
#endif /* _UAPI_ASM_X86_KVMI_H */
diff --git a/arch/x86/kvm/kvmi.c b/arch/x86/kvm/kvmi.c
index ff70c9a33ccf..7b7122784f0f 100644
--- a/arch/x86/kvm/kvmi.c
+++ b/arch/x86/kvm/kvmi.c
@@ -737,3 +737,27 @@ int kvmi_arch_cmd_vcpu_get_xcr(struct kvm_vcpu *vcpu,
rpl->value = vcpu->arch.xcr0;
return 0;
}
+
+int kvmi_arch_cmd_vcpu_get_xsave(struct kvm_vcpu *vcpu,
+ struct kvmi_vcpu_get_xsave_reply **dest,
+ size_t *dest_size)
+{
+ struct kvmi_vcpu_get_xsave_reply *rpl = NULL;
+ size_t rpl_size = sizeof(*rpl) + sizeof(struct kvm_xsave);
+ struct...
2020 Feb 07
0
[RFC PATCH v7 40/78] KVM: introspection: add KVMI_GET_VERSION
...100644
--- a/tools/testing/selftests/kvm/x86_64/kvmi_test.c
+++ b/tools/testing/selftests/kvm/x86_64/kvmi_test.c
@@ -177,12 +177,37 @@ static void test_cmd_invalid(void)
-r, kvm_strerror(-r));
}
+static void test_vm_command(int cmd_id, struct kvmi_msg_hdr *req,
+ size_t req_size, void *rpl, size_t rpl_size)
+{
+ int r;
+
+ r = do_command(cmd_id, req, req_size, rpl, rpl_size);
+ TEST_ASSERT(r == 0,
+ "Command %d failed, error %d (%s)\n",
+ cmd_id, -r, kvm_strerror(-r));
+}
+
+static void test_cmd_get_version(void)
+{
+ struct kvmi_get_version_reply rpl;
+ struct kv...
2020 Jul 21
0
[PATCH v9 69/84] KVM: introspection: add KVMI_VCPU_GET_XCR
...arch/x86/kvm/kvmi.c
+++ b/arch/x86/kvm/kvmi.c
@@ -720,3 +720,20 @@ void kvmi_xsetbv_event(struct kvm_vcpu *vcpu, u8 xcr,
kvmi_put(vcpu->kvm);
}
+
+int kvmi_arch_cmd_vcpu_get_xcr(struct kvm_vcpu *vcpu,
+ const struct kvmi_vcpu_get_xcr *req,
+ struct kvmi_vcpu_get_xcr_reply *rpl)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(req->padding); i++)
+ if (req->padding[i])
+ return -KVM_EINVAL;
+
+ if (req->xcr != 0)
+ return -KVM_EINVAL;
+
+ rpl->value = vcpu->arch.xcr0;
+ return 0;
+}
diff --git a/include/uapi/linux/kvmi.h b/include/uapi/linux/kvmi.h
index 3...
2020 Feb 07
0
[RFC PATCH v7 65/78] KVM: introspection: add KVMI_VCPU_GET_XSAVE
...kvmi.c
@@ -616,3 +616,24 @@ void kvmi_arch_inject_pending_exception(struct kvm_vcpu *vcpu)
kvmi_save_injected_event(vcpu);
}
+
+int kvmi_arch_cmd_vcpu_get_xsave(struct kvm_vcpu *vcpu,
+ struct kvmi_vcpu_get_xsave_reply **dest,
+ size_t *dest_size)
+{
+ struct kvmi_vcpu_get_xsave_reply *rpl = NULL;
+ size_t rpl_size = sizeof(*rpl) + sizeof(struct kvm_xsave);
+ struct kvm_xsave *area;
+
+ rpl = kvmi_msg_alloc_check(rpl_size);
+ if (!rpl)
+ return -KVM_ENOMEM;
+
+ area = (struct kvm_xsave *) &rpl->region[0];
+ kvm_vcpu_ioctl_x86_get_xsave(vcpu, area);
+
+ *dest = rpl;
+ *dest_si...
2020 Jul 22
0
[RFC PATCH v1 13/34] KVM: introspection: add KVMI_VCPU_GET_EPT_VIEW
..._test.c
@@ -2071,6 +2071,33 @@ static void test_cmd_translate_gva(struct kvm_vm *vm)
(vm_vaddr_t)-1, (vm_paddr_t)-1);
}
+static __u16 get_ept_view(struct kvm_vm *vm)
+{
+ struct {
+ struct kvmi_msg_hdr hdr;
+ struct kvmi_vcpu_hdr vcpu_hdr;
+ } req = {};
+ struct kvmi_vcpu_get_ept_view_reply rpl;
+
+ test_vcpu0_command(vm, KVMI_VCPU_GET_EPT_VIEW,
+ &req.hdr, sizeof(req), &rpl, sizeof(rpl));
+
+ return rpl.view;
+}
+
+static void test_cmd_vcpu_get_ept_view(struct kvm_vm *vm)
+{
+ __u16 view;
+
+ if (!features.eptp) {
+ print_skip("EPT views not supported");
+ return...
2020 Feb 07
0
[RFC PATCH v7 52/78] KVM: introspection: add KVMI_EVENT_PAUSE_VCPU
...kvm_arch_vcpu_get_regs(vcpu, &event->regs);
+ kvm_arch_vcpu_get_sregs(vcpu, &event->sregs);
+ ev->arch.mode = kvmi_vcpu_mode(vcpu, &event->sregs);
+ kvmi_get_msrs(vcpu, event);
+}
+
int kvmi_arch_cmd_vcpu_get_info(struct kvm_vcpu *vcpu,
struct kvmi_vcpu_get_info_reply *rpl)
{
diff --git a/include/linux/kvmi_host.h b/include/linux/kvmi_host.h
index 988927c29bf5..49e68777a390 100644
--- a/include/linux/kvmi_host.h
+++ b/include/linux/kvmi_host.h
@@ -11,6 +11,14 @@ struct kvm_vcpu;
#define KVMI_NUM_COMMANDS KVMI_NUM_MESSAGES
+struct kvmi_vcpu_reply {
+ int error;...
2020 Feb 07
0
[RFC PATCH v7 63/78] KVM: introspection: add KVMI_VM_GET_MAX_GFN
...sts/kvm/x86_64/kvmi_test.c
+++ b/tools/testing/selftests/kvm/x86_64/kvmi_test.c
@@ -1229,6 +1229,17 @@ static void test_cmd_vcpu_inject_exception(struct kvm_vm *vm)
disable_vcpu_event(vm, KVMI_EVENT_BREAKPOINT);
}
+static void test_cmd_vm_get_max_gfn(void)
+{
+ struct kvmi_vm_get_max_gfn_reply rpl;
+ struct kvmi_msg_hdr req;
+
+ test_vm_command(KVMI_VM_GET_MAX_GFN, &req, sizeof(req),
+ &rpl, sizeof(rpl));
+
+ DEBUG("max_gfn: 0x%llx\n", rpl.gfn);
+}
+
static void test_introspection(struct kvm_vm *vm)
{
setup_socket();
@@ -1252,6 +1263,7 @@ static void test_introspectio...
2020 Feb 07
0
[RFC PATCH v7 73/78] KVM: introspection: extend KVMI_GET_VERSION with struct kvmi_features
...est.c
+++ b/tools/testing/selftests/kvm/x86_64/kvmi_test.c
@@ -55,6 +55,8 @@ struct vcpu_worker_data {
bool restart_on_shutdown;
};
+static struct kvmi_features features;
+
typedef void (*fct_pf_event)(struct kvm_vm *vm, struct kvmi_msg_hdr *hdr,
struct pf_ev *ev,
struct vcpu_reply *rpl);
@@ -371,7 +373,10 @@ static void test_cmd_get_version(void)
"Unexpected KVMI version %d, expecting %d\n",
rpl.version, KVMI_VERSION);
+ features = rpl.features;
+
DEBUG("KVMI version: %u\n", rpl.version);
+ DEBUG("\tsinglestep: %u\n", features.singl...
2020 Feb 07
0
[RFC PATCH v7 76/78] KVM: introspection: add KVMI_VCPU_TRANSLATE_GVA
...VMI_EVENT_SINGLESTEP);
}
+static void cmd_translate_gva(struct kvm_vm *vm, vm_vaddr_t gva,
+ vm_paddr_t expected_gpa)
+{
+ struct {
+ struct kvmi_msg_hdr hdr;
+ struct kvmi_vcpu_hdr vcpu_hdr;
+ struct kvmi_vcpu_translate_gva cmd;
+ } req = { 0 };
+ struct kvmi_vcpu_translate_gva_reply rpl;
+
+ req.cmd.gva = gva;
+
+ test_vcpu0_command(vm, KVMI_VCPU_TRANSLATE_GVA, &req.hdr, sizeof(req),
+ &rpl, sizeof(rpl));
+
+ TEST_ASSERT(rpl.gpa == expected_gpa,
+ "Translation failed for gva 0x%llx -> gpa 0x%llx instead of 0x%llx\n",
+ gva, rpl.gpa, expected_gpa)...
2020 Jul 21
0
[PATCH v9 72/84] KVM: introspection: add KVMI_VCPU_GET_MTRR_TYPE
...cpu_xsave(struct kvm_vm *vm)
cmd_vcpu_set_xsave(vm, &xsave);
}
+static void test_cmd_vcpu_get_mtrr_type(struct kvm_vm *vm)
+{
+ struct {
+ struct kvmi_msg_hdr hdr;
+ struct kvmi_vcpu_hdr vcpu_hdr;
+ struct kvmi_vcpu_get_mtrr_type cmd;
+ } req = {};
+ struct kvmi_vcpu_get_mtrr_type_reply rpl;
+
+ req.cmd.gpa = test_gpa;
+
+ test_vcpu0_command(vm, KVMI_VCPU_GET_MTRR_TYPE,
+ &req.hdr, sizeof(req),
+ &rpl, sizeof(rpl));
+
+ pr_info("mtrr_type: gpa 0x%lx type 0x%x\n", test_gpa, rpl.type);
+}
+
static void test_introspection(struct kvm_vm *vm)
{
srandom(time(...
2019 Aug 09
0
[RFC PATCH v6 07/92] kvm: introspection: honor the reply option when handling the KVMI_GET_VERSION command
...kvm/kvmi_msg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt/kvm/kvmi_msg.c b/virt/kvm/kvmi_msg.c
index ea5c7e23669a..2237a6ed25f6 100644
--- a/virt/kvm/kvmi_msg.c
+++ b/virt/kvm/kvmi_msg.c
@@ -169,7 +169,7 @@ static int handle_get_version(struct kvmi *ikvm,
memset(&rpl, 0, sizeof(rpl));
rpl.version = KVMI_VERSION;
- return kvmi_msg_vm_reply(ikvm, msg, 0, &rpl, sizeof(rpl));
+ return kvmi_msg_vm_maybe_reply(ikvm, msg, 0, &rpl, sizeof(rpl));
}
static bool is_command_allowed(struct kvmi *ikvm, int id)
2020 Feb 07
0
[RFC PATCH v7 75/78] KVM: introspection: add KVMI_EVENT_SINGLESTEP
..._test.c
+++ b/tools/testing/selftests/kvm/x86_64/kvmi_test.c
@@ -738,6 +738,14 @@ static void stop_vcpu_worker(pthread_t vcpu_thread,
wait_vcpu_worker(vcpu_thread);
}
+static int __do_vcpu_command(struct kvm_vm *vm, int cmd_id,
+ struct kvmi_msg_hdr *req, size_t req_size,
+ void *rpl, size_t rpl_size)
+{
+ send_message(cmd_id, req, req_size);
+ return receive_cmd_reply(req, rpl, rpl_size);
+}
+
static int do_vcpu_command(struct kvm_vm *vm, int cmd_id,
struct kvmi_msg_hdr *req, size_t req_size,
void *rpl, size_t rpl_size)
@@ -748,13 +756,24 @@ static int do_vcpu_c...
2020 Jul 21
0
[PATCH v9 71/84] KVM: introspection: add KVMI_VCPU_SET_XSAVE
...lftests/kvm/x86_64/kvmi_test.c
@@ -1551,25 +1551,43 @@ static void test_cmd_vcpu_get_xcr(struct kvm_vm *vm)
cmd_vcpu_get_xcr(vm, xcr1, &value, no_padding, -KVM_EINVAL);
}
-static void cmd_vcpu_get_xsave(struct kvm_vm *vm)
+static void cmd_vcpu_get_xsave(struct kvm_vm *vm, struct kvm_xsave *rpl)
{
struct {
struct kvmi_msg_hdr hdr;
struct kvmi_vcpu_hdr vcpu_hdr;
} req = {};
- struct kvm_xsave rpl;
int r;
r = do_vcpu0_command(vm, KVMI_VCPU_GET_XSAVE, &req.hdr, sizeof(req),
- &rpl, sizeof(rpl));
+ rpl, sizeof(*rpl));
TEST_ASSERT(r == 0,
"K...
2003 Feb 25
6
token ring for pxelinux
is token ring supported by pxelinux or only ethernet?
2019 Aug 09
0
[RFC PATCH v6 05/92] kvm: introspection: add KVMI_GET_VERSION
...+9,7 @@
#include "kvmi_int.h"
static const char *const msg_IDs[] = {
+ [KVMI_GET_VERSION] = "KVMI_GET_VERSION",
};
static bool is_known_message(u16 id)
@@ -129,6 +130,17 @@ static int kvmi_msg_vm_reply(struct kvmi *ikvm,
return kvmi_msg_reply(ikvm, msg, err, rpl, rpl_size);
}
+static int handle_get_version(struct kvmi *ikvm,
+ const struct kvmi_msg_hdr *msg, const void *req)
+{
+ struct kvmi_get_version_reply rpl;
+
+ memset(&rpl, 0, sizeof(rpl));
+ rpl.version = KVMI_VERSION;
+
+ return kvmi_msg_vm_reply(ikvm, msg, 0, &rpl, sizeof(rpl))...
2020 Jul 21
0
[PATCH v9 81/84] KVM: introspection: add KVMI_EVENT_SINGLESTEP
..._test.c
+++ b/tools/testing/selftests/kvm/x86_64/kvmi_test.c
@@ -829,6 +829,14 @@ static void stop_vcpu_worker(pthread_t vcpu_thread,
wait_vcpu_worker(vcpu_thread);
}
+static int __do_vcpu_command(struct kvm_vm *vm, int cmd_id,
+ struct kvmi_msg_hdr *req, size_t req_size,
+ void *rpl, size_t rpl_size)
+{
+ send_message(cmd_id, req, req_size);
+ return receive_cmd_reply(req, rpl, rpl_size);
+}
+
static int do_vcpu_command(struct kvm_vm *vm, int cmd_id,
struct kvmi_msg_hdr *req, size_t req_size,
void *rpl, size_t rpl_size)
@@ -839,8 +847,7 @@ static int do_vcpu_com...