From: "Jan Beulich" Subject: [PATCH] x86-64/physdevop: reduce generated code duplication Date: Fri, 08 Jul 2011 09:34:36 +0100 Message-ID: <4E16DD3C020000780004CC3E@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartFDD2A80C.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartFDD2A80C.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline At least all the helper functions can be used by both the native and the compat-mode implementations, requiring their parameters to be adjusted. Additionally, rather than having the compat mode wrapper source file blindly define the native structures to be replaced by the compat mode ones, replace unnecessary (un-)definitions by layout match checks. In a second step, do_physdev_op() could be split into a part that needs re-compilation for compat mode handling and one that can be used for native and compat mode. Signed-off-by: Jan Beulich --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -17,17 +17,20 @@ #include #include =20 +int physdev_map_pirq(domid_t, int type, int *index, int *pirq_p, + struct msi_info *); +int physdev_unmap_pirq(domid_t, int pirq); + #ifndef COMPAT typedef long ret_t; -#endif =20 static int physdev_hvm_map_pirq( - struct domain *d, struct physdev_map_pirq *map) + struct domain *d, int type, int *index, int *pirq) { - int pirq, ret =3D 0; + int ret =3D 0; =20 spin_lock(&d->event_lock); - switch ( map->type ) + switch ( type ) { case MAP_PIRQ_TYPE_GSI: { struct hvm_irq_dpci *hvm_irq_dpci; @@ -40,33 +43,31 @@ static int physdev_hvm_map_pirq( if ( hvm_irq_dpci ) { list_for_each_entry ( girq, - &hvm_irq_dpci->girq[map->index], + &hvm_irq_dpci->girq[*index], list ) machine_gsi =3D girq->machine_gsi; } /* found one, this mean we are dealing with a pt device */ if ( machine_gsi ) { - map->index =3D domain_pirq_to_irq(d, machine_gsi); - pirq =3D machine_gsi; - ret =3D (pirq > 0) ? 0 : pirq; + *index =3D domain_pirq_to_irq(d, machine_gsi); + *pirq =3D machine_gsi; + ret =3D (*pirq > 0) ? 0 : *pirq; } /* we didn't find any, this means we are dealing * with an emulated device */ else { - pirq =3D map->pirq; - if ( pirq < 0 ) - pirq =3D get_free_pirq(d, map->type, map->index); - ret =3D map_domain_emuirq_pirq(d, pirq, map->index); + if ( *pirq < 0 ) + *pirq =3D get_free_pirq(d, type, *index); + ret =3D map_domain_emuirq_pirq(d, *pirq, *index); } - map->pirq =3D pirq; break; } =20 default: ret =3D -EINVAL; - dprintk(XENLOG_G_WARNING, "map type %d not supported yet\n", = map->type); + dprintk(XENLOG_G_WARNING, "map type %d not supported yet\n", = type); break; } =20 @@ -74,20 +75,20 @@ static int physdev_hvm_map_pirq( return ret; } =20 -static int physdev_map_pirq(struct physdev_map_pirq *map) +int physdev_map_pirq(domid_t domid, int type, int *index, int *pirq_p, + struct msi_info *msi) { struct domain *d; int pirq, irq, ret =3D 0; - struct msi_info _msi; void *map_data =3D NULL; =20 - ret =3D rcu_lock_target_domain_by_id(map->domid, &d); + ret =3D rcu_lock_target_domain_by_id(domid, &d); if ( ret ) return ret; =20 - if ( map->domid =3D=3D DOMID_SELF && is_hvm_domain(d) ) + if ( domid =3D=3D DOMID_SELF && is_hvm_domain(d) ) { - ret =3D physdev_hvm_map_pirq(d, map); + ret =3D physdev_hvm_map_pirq(d, type, index, pirq_p); goto free_domain; } =20 @@ -98,22 +99,22 @@ static int physdev_map_pirq(struct physd } =20 /* Verify or get irq. */ - switch ( map->type ) + switch ( type ) { case MAP_PIRQ_TYPE_GSI: - if ( map->index < 0 || map->index >=3D nr_irqs_gsi ) + if ( *index < 0 || *index >=3D nr_irqs_gsi ) { dprintk(XENLOG_G_ERR, "dom%d: map invalid irq %d\n", - d->domain_id, map->index); + d->domain_id, *index); ret =3D -EINVAL; goto free_domain; } =20 - irq =3D domain_pirq_to_irq(current->domain, map->index); + irq =3D domain_pirq_to_irq(current->domain, *index); if ( irq <=3D 0 ) { if ( IS_PRIV(current->domain) ) - irq =3D map->index; + irq =3D *index; else { dprintk(XENLOG_G_ERR, "dom%d: map pirq with incorrect = irq!\n", d->domain_id); @@ -124,7 +125,7 @@ static int physdev_map_pirq(struct physd break; =20 case MAP_PIRQ_TYPE_MSI: - irq =3D map->index; + irq =3D *index; if ( irq =3D=3D -1 ) irq =3D create_irq(); =20 @@ -136,17 +137,13 @@ static int physdev_map_pirq(struct physd goto free_domain; } =20 - _msi.bus =3D map->bus; - _msi.devfn =3D map->devfn; - _msi.entry_nr =3D map->entry_nr; - _msi.table_base =3D map->table_base; - _msi.irq =3D irq; - map_data =3D &_msi; + msi->irq =3D irq; + map_data =3D msi; break; =20 default: dprintk(XENLOG_G_ERR, "dom%d: wrong map_pirq type %x\n", - d->domain_id, map->type); + d->domain_id, type); ret =3D -EINVAL; goto free_domain; } @@ -155,13 +152,12 @@ static int physdev_map_pirq(struct physd /* Verify or get pirq. */ spin_lock(&d->event_lock); pirq =3D domain_irq_to_pirq(d, irq); - if ( map->pirq < 0 ) + if ( *pirq_p < 0 ) { if ( pirq ) { dprintk(XENLOG_G_ERR, "dom%d: %d:%d already mapped to %d\n", - d->domain_id, map->index, map->pirq, - pirq); + d->domain_id, *index, *pirq_p, pirq); if ( pirq < 0 ) { ret =3D -EBUSY; @@ -170,7 +166,7 @@ static int physdev_map_pirq(struct physd } else { - pirq =3D get_free_pirq(d, map->type, map->index); + pirq =3D get_free_pirq(d, type, *index); if ( pirq < 0 ) { dprintk(XENLOG_G_ERR, "dom%d: no free pirq\n", d->domain_i= d); @@ -181,20 +177,20 @@ static int physdev_map_pirq(struct physd } else { - if ( pirq && pirq !=3D map->pirq ) + if ( pirq && pirq !=3D *pirq_p ) { dprintk(XENLOG_G_ERR, "dom%d: pirq %d conflicts with irq = %d\n", - d->domain_id, map->index, map->pirq); + d->domain_id, *index, *pirq_p); ret =3D -EEXIST; goto done; } else - pirq =3D map->pirq; + pirq =3D *pirq_p; } =20 - ret =3D map_domain_pirq(d, pirq, irq, map->type, map_data); + ret =3D map_domain_pirq(d, pirq, irq, type, map_data); if ( ret =3D=3D 0 ) - map->pirq =3D pirq; + *pirq_p =3D pirq; =20 if ( !ret && is_hvm_domain(d) ) map_domain_emuirq_pirq(d, pirq, IRQ_PT); @@ -202,28 +198,28 @@ static int physdev_map_pirq(struct physd done: spin_unlock(&d->event_lock); spin_unlock(&pcidevs_lock); - if ( (ret !=3D 0) && (map->type =3D=3D MAP_PIRQ_TYPE_MSI) && = (map->index =3D=3D -1) ) + if ( (ret !=3D 0) && (type =3D=3D MAP_PIRQ_TYPE_MSI) && (*index = =3D=3D -1) ) destroy_irq(irq); free_domain: rcu_unlock_domain(d); return ret; } =20 -static int physdev_unmap_pirq(struct physdev_unmap_pirq *unmap) +int physdev_unmap_pirq(domid_t domid, int pirq) { struct domain *d; int ret; =20 - ret =3D rcu_lock_target_domain_by_id(unmap->domid, &d); + ret =3D rcu_lock_target_domain_by_id(domid, &d); if ( ret ) return ret; =20 if ( is_hvm_domain(d) ) { spin_lock(&d->event_lock); - ret =3D unmap_domain_pirq_emuirq(d, unmap->pirq); + ret =3D unmap_domain_pirq_emuirq(d, pirq); spin_unlock(&d->event_lock); - if ( unmap->domid =3D=3D DOMID_SELF || ret ) + if ( domid =3D=3D DOMID_SELF || ret ) goto free_domain; } =20 @@ -233,7 +229,7 @@ static int physdev_unmap_pirq(struct phy =20 spin_lock(&pcidevs_lock); spin_lock(&d->event_lock); - ret =3D unmap_domain_pirq(d, unmap->pirq); + ret =3D unmap_domain_pirq(d, pirq); spin_unlock(&d->event_lock); spin_unlock(&pcidevs_lock); =20 @@ -241,6 +237,7 @@ static int physdev_unmap_pirq(struct phy rcu_unlock_domain(d); return ret; } +#endif /* COMPAT */ =20 ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg) { @@ -352,13 +349,19 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H } =20 case PHYSDEVOP_map_pirq: { - struct physdev_map_pirq map; + physdev_map_pirq_t map; + struct msi_info msi; =20 ret =3D -EFAULT; if ( copy_from_guest(&map, arg, 1) !=3D 0 ) break; =20 - ret =3D physdev_map_pirq(&map); + msi.bus =3D map.bus; + msi.devfn =3D map.devfn; + msi.entry_nr =3D map.entry_nr; + msi.table_base =3D map.table_base; + ret =3D physdev_map_pirq(map.domid, map.type, &map.index, = &map.pirq, + &msi); =20 if ( copy_to_guest(arg, &map, 1) !=3D 0 ) ret =3D -EFAULT; @@ -372,7 +375,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H if ( copy_from_guest(&unmap, arg, 1) !=3D 0 ) break; =20 - ret =3D physdev_unmap_pirq(&unmap); + ret =3D physdev_unmap_pirq(unmap.domid, unmap.pirq); break; } =20 --- a/xen/arch/x86/x86_64/physdev.c +++ b/xen/arch/x86/x86_64/physdev.c @@ -15,8 +15,9 @@ #define physdev_apic compat_physdev_apic #define physdev_apic_t physdev_apic_compat_t =20 -#define physdev_eoi compat_physdev_eoi -#define physdev_eoi_t physdev_eoi_compat_t +#define xen_physdev_eoi physdev_eoi +CHECK_physdev_eoi; +#undef xen_physdev_eoi =20 #define physdev_pirq_eoi_gmfn compat_physdev_pirq_eoi_gmfn #define physdev_pirq_eoi_gmfn_t physdev_pirq_eoi_gmfn_compat_t @@ -24,35 +25,43 @@ #define physdev_set_iobitmap compat_physdev_set_iobitmap #define physdev_set_iobitmap_t physdev_set_iobitmap_compat_t =20 -#define physdev_set_iopl compat_physdev_set_iopl -#define physdev_set_iopl_t physdev_set_iopl_compat_t +#define xen_physdev_set_iopl physdev_set_iopl +CHECK_physdev_set_iopl; +#undef xen_physdev_set_iopl + +#define xen_physdev_irq physdev_irq +CHECK_physdev_irq; +#undef xen_physdev_irq + +#define xen_physdev_irq_status_query physdev_irq_status_query +CHECK_physdev_irq_status_query; +#undef xen_physdev_irq_status_query =20 -#define physdev_irq compat_physdev_irq -#define physdev_irq_t physdev_irq_compat_t - -#define physdev_irq_status_query compat_physdev_irq_status_query -#define physdev_irq_status_query_t physdev_irq_status_query_compat_t - -#define physdev_map_pirq compat_physdev_map_pirq #define physdev_map_pirq_t physdev_map_pirq_compat_t =20 -#define physdev_unmap_pirq compat_physdev_unmap_pirq -#define physdev_unmap_pirq_t physdev_unmap_pirq_compat_t - -#define physdev_manage_pci compat_physdev_manage_pci -#define physdev_manage_pci_t physdev_manage_pci_compat_t - -#define physdev_manage_pci_ext compat_physdev_manage_pci_ext -#define physdev_manage_pci_ext_t physdev_manage_pci_ext_compat_t - -#define physdev_restore_msi compat_physdev_restore_msi -#define physdev_restore_msi_t physdev_restore_msi_compat_t - -#define physdev_setup_gsi compat_physdev_setup_gsi -#define physdev_setup_gsi_t physdev_setup_gsi_compat_t - -#define physdev_get_free_pirq compat_physdev_get_free_pirq -#define physdev_get_free_pirq_t physdev_get_free_pirq_compat_t +#define xen_physdev_unmap_pirq physdev_unmap_pirq +CHECK_physdev_unmap_pirq; +#undef xen_physdev_unmap_pirq + +#define xen_physdev_manage_pci physdev_manage_pci +CHECK_physdev_manage_pci; +#undef xen_physdev_manage_pci + +#define xen_physdev_manage_pci_ext physdev_manage_pci_ext +CHECK_physdev_manage_pci_ext; +#undef xen_physdev_manage_pci_ext + +#define xen_physdev_restore_msi physdev_restore_msi +CHECK_physdev_restore_msi; +#undef xen_physdev_restore_msi + +#define xen_physdev_setup_gsi physdev_setup_gsi +CHECK_physdev_setup_gsi; +#undef xen_physdev_setup_gsi + +#define xen_physdev_get_free_pirq physdev_get_free_pirq +CHECK_physdev_get_free_pirq; +#undef xen_physdev_get_free_pirq =20 #define COMPAT #undef guest_handle_okay --- a/xen/include/xlat.lst +++ b/xen/include/xlat.lst @@ -59,6 +59,16 @@ ! memory_map memory.h ! memory_reservation memory.h ! pod_target memory.h +? physdev_eoi physdev.h +? physdev_get_free_pirq physdev.h +? physdev_irq physdev.h +? physdev_irq_status_query physdev.h +? physdev_manage_pci physdev.h +? physdev_manage_pci_ext physdev.h +? physdev_unmap_pirq physdev.h +? physdev_restore_msi physdev.h +? physdev_set_iopl physdev.h +? physdev_setup_gsi physdev.h ! sched_poll sched.h ? sched_remote_shutdown sched.h ? sched_shutdown sched.h --=__PartFDD2A80C.0__= Content-Type: text/plain; name="32on64-physdevop.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="32on64-physdevop.patch" At least all the helper functions can be used by both the native and=0Athe = compat-mode implementations, requiring their parameters to be=0Aadjusted.= =0A=0AAdditionally, rather than having the compat mode wrapper source = file=0Ablindly define the native structures to be replaced by the compat = mode=0Aones, replace unnecessary (un-)definitions by layout match = checks.=0A=0AIn a second step, do_physdev_op() could be split into a part = that needs=0Are-compilation for compat mode handling and one that can be = used for=0Anative and compat mode.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/physdev.c=0A+++ b/xen/arch/x8= 6/physdev.c=0A@@ -17,17 +17,20 @@=0A #include =0A #include = =0A =0A+int physdev_map_pirq(domid_t, int type, int *index, int = *pirq_p,=0A+ struct msi_info *);=0A+int physdev_unmap_p= irq(domid_t, int pirq);=0A+=0A #ifndef COMPAT=0A typedef long ret_t;=0A-#en= dif=0A =0A static int physdev_hvm_map_pirq(=0A- struct domain *d, = struct physdev_map_pirq *map)=0A+ struct domain *d, int type, int = *index, int *pirq)=0A {=0A- int pirq, ret =3D 0;=0A+ int ret =3D = 0;=0A =0A spin_lock(&d->event_lock);=0A- switch ( map->type )=0A+ = switch ( type )=0A {=0A case MAP_PIRQ_TYPE_GSI: {=0A = struct hvm_irq_dpci *hvm_irq_dpci;=0A@@ -40,33 +43,31 @@ static int = physdev_hvm_map_pirq(=0A if ( hvm_irq_dpci )=0A {=0A = list_for_each_entry ( girq,=0A- = &hvm_irq_dpci->girq[map->index],=0A+ = &hvm_irq_dpci->girq[*index],=0A list = )=0A machine_gsi =3D girq->machine_gsi;=0A }=0A = /* found one, this mean we are dealing with a pt device */=0A = if ( machine_gsi )=0A {=0A- map->index =3D domain_pirq_t= o_irq(d, machine_gsi);=0A- pirq =3D machine_gsi;=0A- = ret =3D (pirq > 0) ? 0 : pirq;=0A+ *index =3D domain_pirq_to_irq= (d, machine_gsi);=0A+ *pirq =3D machine_gsi;=0A+ ret = =3D (*pirq > 0) ? 0 : *pirq;=0A }=0A /* we didn't find = any, this means we are dealing=0A * with an emulated device */=0A = else=0A {=0A- pirq =3D map->pirq;=0A- = if ( pirq < 0 )=0A- pirq =3D get_free_pirq(d, map->type, = map->index);=0A- ret =3D map_domain_emuirq_pirq(d, pirq, = map->index);=0A+ if ( *pirq < 0 )=0A+ *pirq =3D = get_free_pirq(d, type, *index);=0A+ ret =3D map_domain_emuirq_pi= rq(d, *pirq, *index);=0A }=0A- map->pirq =3D pirq;=0A = break;=0A }=0A =0A default:=0A ret =3D -EINVAL;=0A- = dprintk(XENLOG_G_WARNING, "map type %d not supported yet\n", map->type);= =0A+ dprintk(XENLOG_G_WARNING, "map type %d not supported yet\n", = type);=0A break;=0A }=0A =0A@@ -74,20 +75,20 @@ static int = physdev_hvm_map_pirq(=0A return ret;=0A }=0A =0A-static int physdev_map= _pirq(struct physdev_map_pirq *map)=0A+int physdev_map_pirq(domid_t domid, = int type, int *index, int *pirq_p,=0A+ struct msi_info = *msi)=0A {=0A struct domain *d;=0A int pirq, irq, ret =3D 0;=0A- = struct msi_info _msi;=0A void *map_data =3D NULL;=0A =0A- ret =3D = rcu_lock_target_domain_by_id(map->domid, &d);=0A+ ret =3D rcu_lock_targe= t_domain_by_id(domid, &d);=0A if ( ret )=0A return ret;=0A = =0A- if ( map->domid =3D=3D DOMID_SELF && is_hvm_domain(d) )=0A+ if = ( domid =3D=3D DOMID_SELF && is_hvm_domain(d) )=0A {=0A- ret = =3D physdev_hvm_map_pirq(d, map);=0A+ ret =3D physdev_hvm_map_pirq(d= , type, index, pirq_p);=0A goto free_domain;=0A }=0A =0A@@ = -98,22 +99,22 @@ static int physdev_map_pirq(struct physd=0A }=0A =0A = /* Verify or get irq. */=0A- switch ( map->type )=0A+ switch ( = type )=0A {=0A case MAP_PIRQ_TYPE_GSI:=0A- if ( map->index = < 0 || map->index >=3D nr_irqs_gsi )=0A+ if ( *index < 0 || *index = >=3D nr_irqs_gsi )=0A {=0A dprintk(XENLOG_G_ERR, = "dom%d: map invalid irq %d\n",=0A- d->domain_id, = map->index);=0A+ d->domain_id, *index);=0A = ret =3D -EINVAL;=0A goto free_domain;=0A }=0A =0A- = irq =3D domain_pirq_to_irq(current->domain, map->index);=0A+ irq = =3D domain_pirq_to_irq(current->domain, *index);=0A if ( irq <=3D = 0 )=0A {=0A if ( IS_PRIV(current->domain) )=0A- = irq =3D map->index;=0A+ irq =3D *index;=0A = else {=0A dprintk(XENLOG_G_ERR, "dom%d: map pirq with = incorrect irq!\n",=0A d->domain_id);=0A@@ -124,7 = +125,7 @@ static int physdev_map_pirq(struct physd=0A break;=0A = =0A case MAP_PIRQ_TYPE_MSI:=0A- irq =3D map->index;=0A+ = irq =3D *index;=0A if ( irq =3D=3D -1 )=0A irq =3D = create_irq();=0A =0A@@ -136,17 +137,13 @@ static int physdev_map_pirq(struc= t physd=0A goto free_domain;=0A }=0A =0A- = _msi.bus =3D map->bus;=0A- _msi.devfn =3D map->devfn;=0A- = _msi.entry_nr =3D map->entry_nr;=0A- _msi.table_base =3D map->table_= base;=0A- _msi.irq =3D irq;=0A- map_data =3D &_msi;=0A+ = msi->irq =3D irq;=0A+ map_data =3D msi;=0A break;=0A =0A = default:=0A dprintk(XENLOG_G_ERR, "dom%d: wrong map_pirq type = %x\n",=0A- d->domain_id, map->type);=0A+ = d->domain_id, type);=0A ret =3D -EINVAL;=0A goto free_domai= n;=0A }=0A@@ -155,13 +152,12 @@ static int physdev_map_pirq(struct = physd=0A /* Verify or get pirq. */=0A spin_lock(&d->event_lock);=0A= pirq =3D domain_irq_to_pirq(d, irq);=0A- if ( map->pirq < 0 )=0A+ = if ( *pirq_p < 0 )=0A {=0A if ( pirq )=0A {=0A = dprintk(XENLOG_G_ERR, "dom%d: %d:%d already mapped to %d\n",=0A- = d->domain_id, map->index, map->pirq,=0A- = pirq);=0A+ d->domain_id, *index, *pirq_p, pirq);=0A = if ( pirq < 0 )=0A {=0A ret =3D = -EBUSY;=0A@@ -170,7 +166,7 @@ static int physdev_map_pirq(struct physd=0A = }=0A else=0A {=0A- pirq =3D get_free_pirq= (d, map->type, map->index);=0A+ pirq =3D get_free_pirq(d, type, = *index);=0A if ( pirq < 0 )=0A {=0A = dprintk(XENLOG_G_ERR, "dom%d: no free pirq\n", d->domain_id);=0A@@ = -181,20 +177,20 @@ static int physdev_map_pirq(struct physd=0A }=0A = else=0A {=0A- if ( pirq && pirq !=3D map->pirq )=0A+ if = ( pirq && pirq !=3D *pirq_p )=0A {=0A dprintk(XENLOG_G_= ERR, "dom%d: pirq %d conflicts with irq %d\n",=0A- = d->domain_id, map->index, map->pirq);=0A+ d->domain_id, = *index, *pirq_p);=0A ret =3D -EEXIST;=0A goto = done;=0A }=0A else=0A- pirq =3D map->pirq;=0A+ = pirq =3D *pirq_p;=0A }=0A =0A- ret =3D map_domain_pirq(d, = pirq, irq, map->type, map_data);=0A+ ret =3D map_domain_pirq(d, pirq, = irq, type, map_data);=0A if ( ret =3D=3D 0 )=0A- map->pirq =3D = pirq;=0A+ *pirq_p =3D pirq;=0A =0A if ( !ret && is_hvm_domain(d)= )=0A map_domain_emuirq_pirq(d, pirq, IRQ_PT);=0A@@ -202,28 = +198,28 @@ static int physdev_map_pirq(struct physd=0A done:=0A = spin_unlock(&d->event_lock);=0A spin_unlock(&pcidevs_lock);=0A- if = ( (ret !=3D 0) && (map->type =3D=3D MAP_PIRQ_TYPE_MSI) && (map->index = =3D=3D -1) )=0A+ if ( (ret !=3D 0) && (type =3D=3D MAP_PIRQ_TYPE_MSI) = && (*index =3D=3D -1) )=0A destroy_irq(irq);=0A free_domain:=0A = rcu_unlock_domain(d);=0A return ret;=0A }=0A =0A-static int = physdev_unmap_pirq(struct physdev_unmap_pirq *unmap)=0A+int physdev_unmap_p= irq(domid_t domid, int pirq)=0A {=0A struct domain *d;=0A int = ret;=0A =0A- ret =3D rcu_lock_target_domain_by_id(unmap->domid, = &d);=0A+ ret =3D rcu_lock_target_domain_by_id(domid, &d);=0A if ( = ret )=0A return ret;=0A =0A if ( is_hvm_domain(d) )=0A = {=0A spin_lock(&d->event_lock);=0A- ret =3D unmap_domain_pir= q_emuirq(d, unmap->pirq);=0A+ ret =3D unmap_domain_pirq_emuirq(d, = pirq);=0A spin_unlock(&d->event_lock);=0A- if ( unmap->domid= =3D=3D DOMID_SELF || ret )=0A+ if ( domid =3D=3D DOMID_SELF || ret = )=0A goto free_domain;=0A }=0A =0A@@ -233,7 +229,7 @@ = static int physdev_unmap_pirq(struct phy=0A =0A spin_lock(&pcidevs_lock= );=0A spin_lock(&d->event_lock);=0A- ret =3D unmap_domain_pirq(d, = unmap->pirq);=0A+ ret =3D unmap_domain_pirq(d, pirq);=0A spin_unlock= (&d->event_lock);=0A spin_unlock(&pcidevs_lock);=0A =0A@@ -241,6 = +237,7 @@ static int physdev_unmap_pirq(struct phy=0A rcu_unlock_domain= (d);=0A return ret;=0A }=0A+#endif /* COMPAT */=0A =0A ret_t do_physdev= _op(int cmd, XEN_GUEST_HANDLE(void) arg)=0A {=0A@@ -352,13 +349,19 @@ = ret_t do_physdev_op(int cmd, XEN_GUEST_H=0A }=0A =0A case = PHYSDEVOP_map_pirq: {=0A- struct physdev_map_pirq map;=0A+ = physdev_map_pirq_t map;=0A+ struct msi_info msi;=0A =0A ret = =3D -EFAULT;=0A if ( copy_from_guest(&map, arg, 1) !=3D 0 )=0A = break;=0A =0A- ret =3D physdev_map_pirq(&map);=0A+ = msi.bus =3D map.bus;=0A+ msi.devfn =3D map.devfn;=0A+ = msi.entry_nr =3D map.entry_nr;=0A+ msi.table_base =3D map.table_base= ;=0A+ ret =3D physdev_map_pirq(map.domid, map.type, &map.index, = &map.pirq,=0A+ &msi);=0A =0A if ( = copy_to_guest(arg, &map, 1) !=3D 0 )=0A ret =3D -EFAULT;=0A@@ = -372,7 +375,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H=0A if ( = copy_from_guest(&unmap, arg, 1) !=3D 0 )=0A break;=0A =0A- = ret =3D physdev_unmap_pirq(&unmap);=0A+ ret =3D physdev_unmap_pir= q(unmap.domid, unmap.pirq);=0A break;=0A }=0A =0A--- a/xen/arch= /x86/x86_64/physdev.c=0A+++ b/xen/arch/x86/x86_64/physdev.c=0A@@ -15,8 = +15,9 @@=0A #define physdev_apic compat_physdev_apic=0A = #define physdev_apic_t physdev_apic_compat_t=0A =0A-#define = physdev_eoi compat_physdev_eoi=0A-#define physdev_eoi_t = physdev_eoi_compat_t=0A+#define xen_physdev_eoi physdev_eoi=0A+CHE= CK_physdev_eoi;=0A+#undef xen_physdev_eoi=0A =0A #define physdev_pirq_eoi_g= mfn compat_physdev_pirq_eoi_gmfn=0A #define physdev_pirq_eoi_gmfn_t = physdev_pirq_eoi_gmfn_compat_t=0A@@ -24,35 +25,43 @@=0A #define physdev_se= t_iobitmap compat_physdev_set_iobitmap=0A #define physdev_set_iobitma= p_t physdev_set_iobitmap_compat_t=0A =0A-#define physdev_set_iopl = compat_physdev_set_iopl=0A-#define physdev_set_iopl_t = physdev_set_iopl_compat_t=0A+#define xen_physdev_set_iopl physdev_set_iopl= =0A+CHECK_physdev_set_iopl;=0A+#undef xen_physdev_set_iopl=0A+=0A+#define = xen_physdev_irq physdev_irq=0A+CHECK_physdev_irq;=0A+#undef xen_physdev_irq= =0A+=0A+#define xen_physdev_irq_status_query physdev_irq_status_query=0A+CH= ECK_physdev_irq_status_query;=0A+#undef xen_physdev_irq_status_query=0A = =0A-#define physdev_irq compat_physdev_irq=0A-#define = physdev_irq_t physdev_irq_compat_t=0A-=0A-#define physdev_irq_= status_query compat_physdev_irq_status_query=0A-#define physdev_irq_statu= s_query_t physdev_irq_status_query_compat_t=0A-=0A-#define physdev_map_pirq= compat_physdev_map_pirq=0A #define physdev_map_pirq_t = physdev_map_pirq_compat_t=0A =0A-#define physdev_unmap_pirq = compat_physdev_unmap_pirq=0A-#define physdev_unmap_pirq_t physdev_unm= ap_pirq_compat_t=0A-=0A-#define physdev_manage_pci compat_physdev_m= anage_pci=0A-#define physdev_manage_pci_t physdev_manage_pci_compat_t= =0A-=0A-#define physdev_manage_pci_ext compat_physdev_manage_pci_ext=0A= -#define physdev_manage_pci_ext_t physdev_manage_pci_ext_compat_t=0A-=0A-= #define physdev_restore_msi compat_physdev_restore_msi=0A-#define = physdev_restore_msi_t physdev_restore_msi_compat_t=0A-=0A-#define = physdev_setup_gsi compat_physdev_setup_gsi=0A-#define physdev_setu= p_gsi_t physdev_setup_gsi_compat_t=0A-=0A-#define physdev_get_free_p= irq compat_physdev_get_free_pirq=0A-#define physdev_get_free_pirq_t = physdev_get_free_pirq_compat_t=0A+#define xen_physdev_unmap_pirq = physdev_unmap_pirq=0A+CHECK_physdev_unmap_pirq;=0A+#undef xen_physdev_unmap= _pirq=0A+=0A+#define xen_physdev_manage_pci physdev_manage_pci=0A+CHECK_phy= sdev_manage_pci;=0A+#undef xen_physdev_manage_pci=0A+=0A+#define xen_physde= v_manage_pci_ext physdev_manage_pci_ext=0A+CHECK_physdev_manage_pci_ext;=0A= +#undef xen_physdev_manage_pci_ext=0A+=0A+#define xen_physdev_restore_msi = physdev_restore_msi=0A+CHECK_physdev_restore_msi;=0A+#undef xen_physdev_res= tore_msi=0A+=0A+#define xen_physdev_setup_gsi physdev_setup_gsi=0A+CHECK_ph= ysdev_setup_gsi;=0A+#undef xen_physdev_setup_gsi=0A+=0A+#define xen_physdev= _get_free_pirq physdev_get_free_pirq=0A+CHECK_physdev_get_free_pirq;=0A+#un= def xen_physdev_get_free_pirq=0A =0A #define COMPAT=0A #undef guest_handle_= okay=0A--- a/xen/include/xlat.lst=0A+++ b/xen/include/xlat.lst=0A@@ -59,6 = +59,16 @@=0A ! memory_map memory.h=0A ! memory_rese= rvation memory.h=0A ! pod_target memory.h=0A= +? physdev_eoi physdev.h=0A+? physdev_get_free_pi= rq physdev.h=0A+? physdev_irq = physdev.h=0A+? physdev_irq_status_query physdev.h=0A+? physdev_man= age_pci physdev.h=0A+? physdev_manage_pci_ext = physdev.h=0A+? physdev_unmap_pirq physdev.h=0A+? physdev_res= tore_msi physdev.h=0A+? physdev_set_iopl = physdev.h=0A+? physdev_setup_gsi physdev.h=0A ! sched_poll = sched.h=0A ? sched_remote_shutdown sched.h=0A = ? sched_shutdown sched.h=0A --=__PartFDD2A80C.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartFDD2A80C.0__=--