All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: peter.maydell@linaro.org, stefanha@gmail.com
Cc: sstabellini@kernel.org, stefanha@redhat.com,
	anthony.perard@citrix.com, xen-devel@lists.xenproject.org,
	qemu-devel@nongnu.org, Igor Druzhinin <igor.druzhinin@citrix.com>
Subject: [Qemu-devel] [PULL 02/15] xen/pt: use address_space_memory object for memory region hooks
Date: Mon, 21 May 2018 12:34:51 -0700	[thread overview]
Message-ID: <1526931304-7289-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1805211229070.4520@sstabellini-ThinkPad-X260>

From: Igor Druzhinin <igor.druzhinin@citrix.com>

Commit 99605175c (xen-pt: Fix PCI devices re-attach failed) introduced
a subtle bug. As soon as the guest switches off Bus Mastering on the
device it immediately causes all the BARs be unmapped due to the DMA
address space of the device being changed. This is undesired behavior
because the guest may try to communicate with the device after that
which triggers the following errors in the logs:

[00:05.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x0000000000000200
[00:05.0] xen_pt_bar_write: Error: Should not write BAR through QEMU. @0x0000000000000200

The issue that the original patch tried to workaround (uneven number of
region_add/del calls on device attach/detach) was fixed in d25836cafd
(memory: do explicit cleanup when remove listeners).

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
---
 hw/xen/xen_pt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index 9b7a960..e5a6eff 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -907,7 +907,7 @@ out:
         }
     }
 
-    memory_listener_register(&s->memory_listener, &s->dev.bus_master_as);
+    memory_listener_register(&s->memory_listener, &address_space_memory);
     memory_listener_register(&s->io_listener, &address_space_io);
     s->listener_set = true;
     XEN_PT_LOG(d,
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Stefano Stabellini <sstabellini@kernel.org>
To: peter.maydell@linaro.org, stefanha@gmail.com
Cc: Igor Druzhinin <igor.druzhinin@citrix.com>,
	sstabellini@kernel.org, qemu-devel@nongnu.org,
	stefanha@redhat.com, anthony.perard@citrix.com,
	xen-devel@lists.xenproject.org
Subject: [PULL 02/15] xen/pt: use address_space_memory object for memory region hooks
Date: Mon, 21 May 2018 12:34:51 -0700	[thread overview]
Message-ID: <1526931304-7289-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1805211229070.4520@sstabellini-ThinkPad-X260>

From: Igor Druzhinin <igor.druzhinin@citrix.com>

Commit 99605175c (xen-pt: Fix PCI devices re-attach failed) introduced
a subtle bug. As soon as the guest switches off Bus Mastering on the
device it immediately causes all the BARs be unmapped due to the DMA
address space of the device being changed. This is undesired behavior
because the guest may try to communicate with the device after that
which triggers the following errors in the logs:

[00:05.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x0000000000000200
[00:05.0] xen_pt_bar_write: Error: Should not write BAR through QEMU. @0x0000000000000200

The issue that the original patch tried to workaround (uneven number of
region_add/del calls on device attach/detach) was fixed in d25836cafd
(memory: do explicit cleanup when remove listeners).

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
---
 hw/xen/xen_pt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index 9b7a960..e5a6eff 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -907,7 +907,7 @@ out:
         }
     }
 
-    memory_listener_register(&s->memory_listener, &s->dev.bus_master_as);
+    memory_listener_register(&s->memory_listener, &address_space_memory);
     memory_listener_register(&s->io_listener, &address_space_io);
     s->listener_set = true;
     XEN_PT_LOG(d,
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-05-21 19:35 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 19:34 [Qemu-devel] [PULL 00/15] xen-20180521-tag Stefano Stabellini
2018-05-21 19:34 ` Stefano Stabellini
2018-05-21 19:34 ` [Qemu-devel] [PULL 01/15] xen-pvdevice: Introduce a simplistic xen-pvdevice save state Stefano Stabellini
2018-05-21 19:34   ` Stefano Stabellini
2018-05-21 19:34 ` Stefano Stabellini [this message]
2018-05-21 19:34   ` [PULL 02/15] xen/pt: use address_space_memory object for memory region hooks Stefano Stabellini
2018-05-21 19:34 ` [Qemu-devel] [PULL 03/15] configure: Add explanation for --enable-xen-pci-passthrough Stefano Stabellini
2018-05-21 19:34   ` Stefano Stabellini
2018-05-21 19:34 ` [Qemu-devel] [PULL 04/15] xen_pt: Present the size of 64 bit BARs correctly Stefano Stabellini
2018-05-21 19:34   ` Stefano Stabellini
2018-05-21 19:34 ` [Qemu-devel] [PULL 05/15] xen-hvm: create separate function for ioreq server initialization Stefano Stabellini
2018-05-21 19:34   ` Stefano Stabellini
2018-05-21 19:34 ` [Qemu-devel] [PULL 06/15] All the xen stable APIs define handle types of the form: Stefano Stabellini
2018-05-21 19:34   ` Stefano Stabellini
2018-05-21 19:34 ` [Qemu-devel] [PULL 07/15] xen: add a meaningful declaration of grant_copy_segment into xen_common.h Stefano Stabellini
2018-05-21 19:34   ` Stefano Stabellini
2018-05-21 19:34 ` [Qemu-devel] [PULL 08/15] xen_backend: add grant table helpers Stefano Stabellini
2018-05-21 19:34   ` Stefano Stabellini
2018-05-21 19:34 ` [Qemu-devel] [PULL 09/15] xen_disk: remove open-coded use of libxengnttab Stefano Stabellini
2018-05-21 19:34   ` Stefano Stabellini
2018-05-21 19:34 ` [Qemu-devel] [PULL 10/15] xen: remove other " Stefano Stabellini
2018-05-21 19:34   ` Stefano Stabellini
2018-05-21 19:35 ` [Qemu-devel] [PULL 11/15] xen_backend: add an emulation of grant copy Stefano Stabellini
2018-05-21 19:35   ` Stefano Stabellini
2018-05-21 19:35 ` [Qemu-devel] [PULL 12/15] xen_disk: remove use of grant map/unmap Stefano Stabellini
2018-05-21 19:35   ` Stefano Stabellini
2018-05-21 19:35 ` [Qemu-devel] [PULL 13/15] xen_backend: make the xen_feature_grant_copy flag private Stefano Stabellini
2018-05-21 19:35   ` Stefano Stabellini
2018-05-21 19:35 ` [Qemu-devel] [PULL 14/15] xen_disk: use a single entry iovec Stefano Stabellini
2018-05-21 19:35   ` Stefano Stabellini
2018-05-21 19:35 ` [Qemu-devel] [PULL 15/15] xen_disk: be consistent with use of xendev and blkdev->xendev Stefano Stabellini
2018-05-21 19:35   ` Stefano Stabellini
2018-05-21 19:57 ` [Qemu-devel] [PULL 00/15] xen-20180521-tag no-reply
2018-05-21 19:57   ` no-reply
2018-05-22 10:11 ` Peter Maydell
2018-05-22 10:11   ` Peter Maydell
2018-05-22 18:35   ` Stefano Stabellini
2018-05-22 18:35   ` [Qemu-devel] " Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1526931304-7289-2-git-send-email-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=anthony.perard@citrix.com \
    --cc=igor.druzhinin@citrix.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.