[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/1] xen-hvm.c: Add support for Xen access to vmport



On Fri, 26 Sep 2014, Don Slutz wrote:
> This adds synchronisation of the vcpu registers
> between Xen and QEMU.
> 
> Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>

[...]

> diff --git a/xen-hvm.c b/xen-hvm.c
> index 05e522c..e1274bb 100644
> --- a/xen-hvm.c
> +++ b/xen-hvm.c
> @@ -857,14 +857,48 @@ static void cpu_handle_ioreq(void *opaque)
>  
>      handle_buffered_iopage(state);
>      if (req) {
> +#ifdef IOREQ_TYPE_VMWARE_PORT

Is there any reason to #ifdef this code?
Couldn't we just always build it in QEMU?


> +        if (req->type == IOREQ_TYPE_VMWARE_PORT) {

I think it would make more sense to check for IOREQ_TYPE_VMWARE_PORT
from within handle_ioreq.


> +            CPUX86State *env;
> +            ioreq_t fake_req = {
> +                .type = IOREQ_TYPE_PIO,
> +                .addr = (uint16_t)req->size,
> +                .size = 4,
> +                .dir = IOREQ_READ,
> +                .df = 0,
> +                .data_is_ptr = 0,
> +            };
> +            if (!xen_opaque_env) {
> +                xen_opaque_env = g_malloc(sizeof(CPUX86State));
> +            }
> +            env = xen_opaque_env;
> +            env->regs[R_EAX] = (uint32_t)(req->addr >> 32);
> +            env->regs[R_EBX] = (uint32_t)(req->addr);
> +            env->regs[R_ECX] = req->count;
> +            env->regs[R_EDX] = req->size;
> +            env->regs[R_ESI] = (uint32_t)(req->data >> 32);
> +            env->regs[R_EDI] = (uint32_t)(req->data);
> +            handle_ioreq(&fake_req);
> +            req->addr = ((uint64_t)fake_req.data << 32) |
> +                (uint32_t)env->regs[R_EBX];
> +            req->count = env->regs[R_ECX];
> +            req->size = env->regs[R_EDX];
> +            req->data = ((uint64_t)env->regs[R_ESI] << 32) |
> +                (uint32_t)env->regs[R_EDI];

This code could be moved to a separate helper function called by
handle_ioreq.


> +        } else {
> +            handle_ioreq(req);
> +        }
> +#else
>          handle_ioreq(req);
> +#endif


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.