* [PATCH][2/6] add call entry for vmx guest
@ 2005-09-05 10:40 Xiaofeng Ling
0 siblings, 0 replies; 3+ messages in thread
From: Xiaofeng Ling @ 2005-09-05 10:40 UTC (permalink / raw)
To: Ian Pratt, Keir Fraser; +Cc: xen-devel
This patch add the entry to hypercall for vmx guest.
vmx guest use vmcall to invoke hypercall.
This patch use the original hypercall table with a permit check.
If you think use a seperate table it better, I'll send another
patch later.
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
diff -r 287d36b46fa3 xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c Tue Aug 30 20:36:49 2005
+++ b/xen/arch/x86/vmx.c Fri Sep 2 22:46:13 2005
@@ -1463,9 +1463,12 @@
char print_buf[BUF_SIZ];
static int index;
-static void vmx_print_line(const char c, struct vcpu *d)
-{
-
+asmlinkage unsigned long do_vmx_print_line(unsigned long ch)
+{
+
+#if VMX_DEBUG
+ char c = (char)ch;
+ struct vcpu *d = current;
if (index == MAX_LINE || c == '\n') {
if (index == MAX_LINE) {
print_buf[index++] = c;
@@ -1476,7 +1479,55 @@
}
else
print_buf[index++] = c;
-}
+ return 0;
+#endif
+ return -ENOSYS;
+}
+
+unsigned char vmx_hypercall_permit[NR_hypercalls/sizeof(unsigned char)] =
+{
+ 0x2, /* do_mmu_update */
+ 0x78, /* do_dom_mem_op 12
+ do_multicall 13
+ do_update_va_mapping 14
+ */
+ 0x13, /* do_event_channel_op 16
+ do_xen_version 17
+ do_grant_table_op 20
+ */
+ 0x10 /* do_virtual_device_op 28*/
+};
+#if defined(__i386__)
+void vmx_do_hypercall(struct cpu_user_regs *pregs)
+{
+ unsigned long retcode;
+
+ /* Check whether this hypercall is permited from vmx domain*/
+ if(unlikely(!test_bit(pregs->eax, &vmx_hypercall_permit[0]))){
+ printk("not permit hypercall, %d\n", pregs->eax);
+ return;
+ }
+ __asm__ __volatile__(
+ "pushl %6\n\t"
+ "pushl %5\n\t"
+ "pushl %4\n\t"
+ "pushl %3\n\t"
+ "pushl %2\n\t"
+ "call *(hypercall_table)(,%0,4)\n\t"
+ "addl $20, %%esp\n\t"
+ :"=&a"(retcode)
+ :"0"(pregs->eax), "r"(pregs->ebx), "r"(pregs->ecx),
+ "r"(pregs->edx), "r"(pregs->esi), "r"(pregs->edi)
+ );
+ pregs->eax = retcode;
+ return;
+}
+#else
+void vmx_do_hypercall(struct cpu_user_regs *pregs)
+{
+ printk("not supported yet!\n");
+}
+#endif
void save_vmx_cpu_user_regs(struct cpu_user_regs *ctxt)
{
@@ -1691,7 +1742,7 @@
__vmread(GUEST_RIP, &eip);
__vmread(EXIT_QUALIFICATION, &exit_qualification);
- vmx_print_line(regs.eax, v); /* provides the current domain */
+ vmx_do_hypercall(®s);
__update_guest_eip(inst_len);
break;
case EXIT_REASON_CR_ACCESS:
@@ -1772,7 +1898,6 @@
return;
}
#endif
-#endif /* CONFIG_VMX */
/*
* Local variables:
diff -r 287d36b46fa3 xen/include/public/arch-x86_32.h
--- a/xen/include/public/arch-x86_32.h Tue Aug 30 20:36:49 2005
+++ b/xen/include/public/arch-x86_32.h Fri Sep 2 22:46:13 2005
@@ -42,7 +42,12 @@
#define FLAT_USER_SS FLAT_RING3_SS
/* And the trap vector is... */
+#if defined (CONFIG_VMX_GUEST)
+/*for VMX paravirtualized driver*/
+#define TRAP_INSTR ".byte 0x0f,0x01,0xc1\n"
+#else
#define TRAP_INSTR "int $0x82"
+#endif
/*
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH][2/6] add call entry for vmx guest
@ 2005-09-05 14:36 Ling, Xiaofeng
0 siblings, 0 replies; 3+ messages in thread
From: Ling, Xiaofeng @ 2005-09-05 14:36 UTC (permalink / raw)
To: Ling, Xiaofeng, Ian Pratt, Keir Fraser; +Cc: xen-devel
[-- Attachment #1: Type: text/plain, Size: 361 bytes --]
Attach is the alternative patch to use a separate hypercall table for vmx guest.
Xiaofeng Ling <> wrote:
> This patch add the entry to hypercall for vmx guest.
> vmx guest use vmcall to invoke hypercall.
> This patch use the original hypercall table with a permit check.
> If you think use a seperate table it better, I'll send another patch
> later.
[-- Attachment #2: vbd-hv-vmxhypercalltable.patch --]
[-- Type: application/octet-stream, Size: 3297 bytes --]
diff -r 287d36b46fa3 xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c Tue Aug 30 20:36:49 2005
+++ b/xen/arch/x86/vmx.c Mon Sep 5 22:26:56 2005
@@ -1463,9 +1463,12 @@
char print_buf[BUF_SIZ];
static int index;
-static void vmx_print_line(const char c, struct vcpu *d)
-{
-
+asmlinkage unsigned long do_vmx_print_line(unsigned long ch)
+{
+
+#if VMX_DEBUG
+ char c = (char)ch;
+ struct vcpu *d = current;
if (index == MAX_LINE || c == '\n') {
if (index == MAX_LINE) {
print_buf[index++] = c;
@@ -1476,7 +1479,37 @@
}
else
print_buf[index++] = c;
-}
+ return 0;
+#endif
+ return -ENOSYS;
+}
+
+#if defined(__i386__)
+void vmx_do_hypercall(struct cpu_user_regs *pregs)
+{
+ unsigned long retcode;
+
+ __asm__ __volatile__(
+ "pushl %6\n\t"
+ "pushl %5\n\t"
+ "pushl %4\n\t"
+ "pushl %3\n\t"
+ "pushl %2\n\t"
+ "call *(vmx_hypercall_table)(,%0,4)\n\t"
+ "addl $20, %%esp\n\t"
+ :"=&a"(retcode)
+ :"0"(pregs->eax), "r"(pregs->ebx), "r"(pregs->ecx),
+ "r"(pregs->edx), "r"(pregs->esi), "r"(pregs->edi)
+ );
+ pregs->eax = retcode;
+ return;
+}
+#else
+void vmx_do_hypercall(struct cpu_user_regs *pregs)
+{
+ printk("not supported yet!\n");
+}
+#endif
void save_vmx_cpu_user_regs(struct cpu_user_regs *ctxt)
{
@@ -1691,7 +1724,7 @@
__vmread(GUEST_RIP, &eip);
__vmread(EXIT_QUALIFICATION, &exit_qualification);
- vmx_print_line(regs.eax, v); /* provides the current domain */
+ vmx_do_hypercall(®s);
__update_guest_eip(inst_len);
break;
case EXIT_REASON_CR_ACCESS:
diff -r 287d36b46fa3 xen/arch/x86/x86_32/entry.S
--- a/xen/arch/x86/x86_32/entry.S Tue Aug 30 20:36:49 2005
+++ b/xen/arch/x86/x86_32/entry.S Mon Sep 5 22:26:56 2005
@@ -812,7 +812,42 @@
.long do_ni_hypercall /* 25 */
.long do_mmuext_op
.long do_acm_op /* 27 */
+ .long do_virtual_device_op /* virutal device op for VMX */
.rept NR_hypercalls-((.-hypercall_table)/4)
+ .long do_ni_hypercall
+ .endr
+
+ENTRY(vmx_hypercall_table)
+ .long do_ni_hypercall /* 0 */
+ .long do_mmu_update
+ .long do_ni_hypercall
+ .long do_ni_hypercall
+ .long do_ni_hypercall
+ .long do_ni_hypercall /* 5 */
+ .long do_ni_hypercall
+ .long do_ni_hypercall
+ .long do_ni_hypercall
+ .long do_ni_hypercall
+ .long do_ni_hypercall /* 10 */
+ .long do_ni_hypercall
+ .long do_memory_op
+ .long do_multicall
+ .long do_update_va_mapping
+ .long do_ni_hypercall /* 15 */
+ .long do_event_channel_op
+ .long do_xen_version
+ .long do_ni_hypercall
+ .long do_ni_hypercall
+ .long do_grant_table_op /* 20 */
+ .long do_ni_hypercall
+ .long do_ni_hypercall
+ .long do_ni_hypercall
+ .long do_ni_hypercall
+ .long do_ni_hypercall /* 25 */
+ .long do_ni_hypercall
+ .long do_ni_hypercall
+ .long do_virtual_device_op /* 28 */
+ .rept NR_hypercalls-((.-vmx_hypercall_table)/4)
.long do_ni_hypercall
.endr
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH][2/6] add call entry for vmx guest
@ 2005-09-07 3:14 Ling, Xiaofeng
0 siblings, 0 replies; 3+ messages in thread
From: Ling, Xiaofeng @ 2005-09-07 3:14 UTC (permalink / raw)
To: Ian Pratt, Keir Fraser; +Cc: xen-devel
Ian and Keir
Do you have more suggestion beside the seperate hypercall table for para-driver?
some other possible alternative:
1. move the change to grant_table.c to vmx.c, and use a virtual_device_op to setup up the grant
table share page so that grant_table.c don't need change.
2. move the logic of copying hypercall paramter to share page to hypervisor instead of in guest.
then share page is not needed. but the copy overhead maybe bigger because each copy need to map.
Ling, Xiaofeng <> wrote:
> Attach is the alternative patch to use a separate hypercall table for
> vmx guest.
>
> Xiaofeng Ling <> wrote:
>> This patch add the entry to hypercall for vmx guest.
>> vmx guest use vmcall to invoke hypercall.
>> This patch use the original hypercall table with a permit check.
>> If you think use a seperate table it better, I'll send another patch
>> later.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-09-07 3:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-05 10:40 [PATCH][2/6] add call entry for vmx guest Xiaofeng Ling
-- strict thread matches above, loose matches on Subject: below --
2005-09-05 14:36 Ling, Xiaofeng
2005-09-07 3:14 Ling, Xiaofeng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.