On Mon, Nov 07, 2011 at 12:02:03PM +0000, Stefano Stabellini wrote:
On Thu, 3 Nov 2011, Keir Fraser wrote:
> On 03/11/2011 18:07, "Pasi KÃ?rkkÃ?inen" <pasik(a)iki.fi> wrote:
>
> > On Tue, Nov 01, 2011 at 10:56:06PM +0200, Pasi KÃ?rkkÃ?inen wrote:
> >> On Mon, Oct 31, 2011 at 09:29:24PM +0200, Pasi KÃ?rkkÃ?inen wrote:
> >>> On Mon, Oct 31, 2011 at 12:24:14PM -0700, Boris Derzhavets wrote:
> >>>> Seems to related
> >>>>
> >>>>
https://bugs.launchpad.net/ubuntu/+source/xen/+bug/854829
> >>>>
> >>>
> >>> Thanks, that seems to be the same bug.
> >>>
> >>> Is the bugfix patch from xen-unstable going to backported to
> >>> xen-4.1-testing.hg ?
> >>> (4.1 backported patch available on ubuntu's launchpad above..)
> >>>
> >>
> >> So the Ubuntu backport from xen-unstable to Xen 4.1.1 is here:
> >>
https://launchpadlibrarian.net/81948978/xen-pirq-resubmit-irq.patch
> >>
> >> It seems to be shipping in Ubuntu 11.10 xen 4.1.1-2ubuntu4.1 packages.
> >>
> >> Does that patch look suitable to be applied to xen-4.1-testing.hg ?
> >> This bug should be fixed for Xen 4.1.3.
> >
> > Any comments?
>
> This looks like a backport of Stefano's xen-unstable c/s 24007. I would like
> him to submit/ack the backport, as it is not a trivial backport of the
> xen-unstable patch.
I would rather use the following backport. Compared to the other one it
returns EINVAL in PHYSDEVOP_irq_status_query when the arguments are not
correct.
Thanks! Mayoung added this patch in xen-4.1.2-1.1.fc14.src.rpm,
and binary rpms are built for Fedora 16 here:
http://koji.fedoraproject.org/koji/taskinfo?taskID=3495905
So people should test this patch (or the rpms above) and confirm
that it fixes the emulated realtek/ne2k issues.
Thanks,
-- Pasi
---
diff -r 8c2d76193eaf xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c Wed Nov 02 15:02:18 2011 +0000
+++ b/xen/arch/x86/physdev.c Mon Nov 07 11:58:28 2011 +0000
@@ -261,6 +261,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
ret = -EINVAL;
if ( eoi.irq >= v->domain->nr_pirqs )
break;
+ spin_lock(&v->domain->event_lock);
if ( v->domain->arch.pirq_eoi_map )
evtchn_unmask(v->domain->pirq_to_evtchn[eoi.irq]);
if ( !is_hvm_domain(v->domain) ||
@@ -268,6 +269,19 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
ret = pirq_guest_eoi(v->domain, eoi.irq);
else
ret = 0;
+ if ( is_hvm_domain(v->domain) &&
+ domain_pirq_to_emuirq(v->domain, eoi.irq) > 0 )
+ {
+ struct hvm_irq *hvm_irq = &v->domain->arch.hvm_domain.irq;
+ int gsi = domain_pirq_to_emuirq(v->domain, eoi.irq);
+
+ /* if this is a level irq and count > 0, send another
+ * notification */
+ if ( gsi >= NR_ISAIRQS /* ISA irqs are edge triggered */
+ && hvm_irq->gsi_assert_count[gsi] )
+ send_guest_pirq(v->domain, eoi.irq);
+ }
+ spin_unlock(&v->domain->event_lock);
break;
}
@@ -323,9 +337,10 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
break;
irq_status_query.flags = 0;
if ( is_hvm_domain(v->domain) &&
- domain_pirq_to_irq(v->domain, irq) <= 0 )
+ domain_pirq_to_irq(v->domain, irq) <= 0 &&
+ domain_pirq_to_emuirq(v->domain, irq) == IRQ_UNBOUND )
{
- ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
+ ret = -EINVAL;
break;
}