Message ID | 20090722144113.GB7942@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Jul 22, 2009 at 05:41:13PM +0300, Michael S. Tsirkin wrote: > over the old one. Current code gets it wrong, and only works because > it's uncommon for guests to change MSI tables. > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > --- > qemu-kvm.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/qemu-kvm.c b/qemu-kvm.c > index 60e5eac..cebaa65 100644 > --- a/qemu-kvm.c > +++ b/qemu-kvm.c > @@ -1552,7 +1552,7 @@ int kvm_update_routing_entry(kvm_context_t kvm, > if (e->u.msi.address_lo == entry->u.msi.address_lo && > e->u.msi.address_hi == entry->u.msi.address_hi && > e->u.msi.data == entry->u.msi.data) { > - memcpy(&e->u.msi, &entry->u.msi, sizeof e->u.msi); > + memcpy(&e->u.msi, &newentry->u.msi, sizeof e->u.msi); > return 0; > } > break; Non-msi case seems to suffer from the same problem? -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Jul 22, 2009 at 05:18:49PM -0300, Marcelo Tosatti wrote: > > On Wed, Jul 22, 2009 at 05:41:13PM +0300, Michael S. Tsirkin wrote: > > over the old one. Current code gets it wrong, and only works because > > it's uncommon for guests to change MSI tables. > > Non-msi case seems to suffer from the same problem? Correct of course. Sent out v2 which fixes non-msi as well. Thanks!
diff --git a/qemu-kvm.c b/qemu-kvm.c index 60e5eac..cebaa65 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1552,7 +1552,7 @@ int kvm_update_routing_entry(kvm_context_t kvm, if (e->u.msi.address_lo == entry->u.msi.address_lo && e->u.msi.address_hi == entry->u.msi.address_hi && e->u.msi.data == entry->u.msi.data) { - memcpy(&e->u.msi, &entry->u.msi, sizeof e->u.msi); + memcpy(&e->u.msi, &newentry->u.msi, sizeof e->u.msi); return 0; } break;
When updating msi irq routing entries, we should memcpy the new entry over the old one. Current code gets it wrong, and only works because it's uncommon for guests to change MSI tables. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- qemu-kvm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)