ia64/xen-unstable

changeset 18847:a00eb6595d3c

x86: Fix PHYSDEVOP_pirq_eoi_mfn, which I modified and broke.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Sat Nov 29 09:07:52 2008 +0000 (2008-11-29)
parents 4d52d3c53850
children f39673ce7d6e
files xen/arch/x86/physdev.c
line diff
     1.1 --- a/xen/arch/x86/physdev.c	Fri Nov 28 13:28:16 2008 +0000
     1.2 +++ b/xen/arch/x86/physdev.c	Sat Nov 29 09:07:52 2008 +0000
     1.3 @@ -202,7 +202,6 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
     1.4  
     1.5      case PHYSDEVOP_pirq_eoi_mfn: {
     1.6          struct physdev_pirq_eoi_mfn info;
     1.7 -        unsigned long *p;
     1.8  
     1.9          BUILD_BUG_ON(NR_IRQS > (PAGE_SIZE * 8));
    1.10  
    1.11 @@ -216,16 +215,23 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
    1.12                                  PGT_writable_page) )
    1.13              break;
    1.14  
    1.15 -        ret = -ENOSPC;
    1.16 -        if ( (p = map_domain_page_global(info.mfn)) == NULL )
    1.17 +        if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn, 0, info.mfn) != 0 )
    1.18 +        {
    1.19 +            put_page_and_type(mfn_to_page(info.mfn));
    1.20 +            ret = -EBUSY;
    1.21              break;
    1.22 +        }
    1.23  
    1.24 -        ret = -EBUSY;
    1.25 -        if ( cmpxchg(&v->domain->arch.pirq_eoi_map, NULL, p) != NULL )
    1.26 -            unmap_domain_page_global(p);
    1.27 -        else
    1.28 -            v->domain->arch.pirq_eoi_map_mfn = info.mfn;
    1.29 +        v->domain->arch.pirq_eoi_map = map_domain_page_global(info.mfn);
    1.30 +        if ( v->domain->arch.pirq_eoi_map == NULL )
    1.31 +        {
    1.32 +            v->domain->arch.pirq_eoi_map_mfn = 0;
    1.33 +            put_page_and_type(mfn_to_page(info.mfn));
    1.34 +            ret = -ENOSPC;
    1.35 +            break;
    1.36 +        }
    1.37  
    1.38 +        ret = 0;
    1.39          break;
    1.40      }
    1.41