WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

RE: [Xen-ia64-devel] [RFC][PATCH] fix zero extending for mmio ld1/2/4emu

To: "Isaku Yamahata" <yamahata@xxxxxxxxxxxxx>, <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-ia64-devel] [RFC][PATCH] fix zero extending for mmio ld1/2/4emulation
From: "Xu, Anthony" <anthony.xu@xxxxxxxxx>
Date: Thu, 22 May 2008 00:13:40 +0800
Delivery-date: Wed, 21 May 2008 09:14:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20080521081054.GG26483%yamahata@xxxxxxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20080521081054.GG26483%yamahata@xxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Aci7GkAXtWP4Jeh/RIO7enFp33TkTQAQwBUw
Thread-topic: [Xen-ia64-devel] [RFC][PATCH] fix zero extending for mmio ld1/2/4emulation
Hi Isaku,

Before copying value  ( *val=p->data),
The code sets p->data to 0,( p->data=0)
I think this can avoid the issue Jes found in KVM/IA64.


Anthony



    if (dir == IOREQ_WRITE)
        p->data = *val;
    else
        p->data = 0;
    p->data_is_ptr = 0;
    p->dir = dir;
    p->df = 0;
    p->type = 1;

    p->io_count++;

    if (hvm_buffered_io_intercept(p)) {
        p->state = STATE_IORESP_READY;
        vmx_io_assist(v);
        if (dir != IOREQ_READ)
            return;
    }

    vmx_send_assist_req(v);
    if (dir == IOREQ_READ)
        *val = p->data;



Isaku Yamahata wrote:
> Recently Jes Soresen found a bug in kvm/ia64 mmio emulator.
> I believe xen/ia64 needs same bug fix, but I haven't confirmed
> the bug and the fix.
> Can anyone confirm this patch?
> 
> # HG changeset patch
> # User Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
> # Date 1211356962 -32400
> # Node ID 9b9a503239d60b3595c772d9337c4a217960a93e
> # Parent  f04ce41dab843b275ccb6636290e51c591ac2a06
> [IA64] fix zero extending for mmio ld1/2/4 emulation
> 
> This bug was found by Jes Soresen with kvm/ia64 as follows.
> This patch is xen/ia64 counterpart.
> 
>> Only copy in the data actually requested by the instruction emulation
>> and zero pad the destination register first. This avoids the problem
>> where emulated mmio access got garbled data from ld2.acq instructions
>> in the vga console driver.
> 
> Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
> 
> diff --git a/xen/arch/ia64/vmx/mmio.c b/xen/arch/ia64/vmx/mmio.c
> --- a/xen/arch/ia64/vmx/mmio.c
> +++ b/xen/arch/ia64/vmx/mmio.c
> @@ -170,8 +170,9 @@
>      }
> 
>      vmx_send_assist_req(v);
> -    if (dir == IOREQ_READ)
> -        *val = p->data;
> +    if (dir == IOREQ_READ)
> +        /* it's necessary to ensure zero extending */
> +        *val = p->data & (~0UL >> (64 - (s * 8)));
> 
>      return;
>  }

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

<Prev in Thread] Current Thread [Next in Thread>