qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: agraf@suse.de, anthony@codemonkey.ws
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/3] pseries: Allow writes to KVM accelerated TCE table
Date: Fri, 28 Oct 2011 12:56:31 +1100	[thread overview]
Message-ID: <1319766992-2596-3-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1319766992-2596-1-git-send-email-david@gibson.dropbear.id.au>

Sufficiently recent kernels include a KVM call to accelerate use of
PAPR TCE tables (IOMMU), which are used by PAPR virtual IO devices.
This involves qemu mapping the TCE table in from a kernel obtained fd,
which currently we do with PROT_READ only.  This is a hangover from
early (never released) versions of this kernel interface which only
permitted read-only mappings and required us to destroy and recreate
the table when we needed to clear it from qemu.

Now, the kernel permits read-write mappings, and we rely on this to
clear the table in spapr_vio_quiesce_one().  However, due to
insufficient testing, I forgot to update the actual mapping of the
table in kvmppc_create_spapr_tce() to add PROT_WRITE to the mmap().

This patch corrects the oversight.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 target-ppc/kvm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 6b156be..1663be0 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -850,7 +850,7 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd)
     len = (window_size / SPAPR_VIO_TCE_PAGE_SIZE) * sizeof(VIOsPAPR_RTCE);
     /* FIXME: round this up to page size */
 
-    table = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
+    table = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (table == MAP_FAILED) {
         close(fd);
         return NULL;
-- 
1.7.7

  parent reply	other threads:[~2011-10-28  1:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28  1:56 [Qemu-devel] [0/3] Bugfixes and updates for pseries David Gibson
2011-10-28  1:56 ` [Qemu-devel] [PATCH 1/3] ppc: Correctly handle errors reading ibm, vmx and ibm, dfp properties David Gibson
2011-10-30 16:53   ` Alexander Graf
2011-10-31  0:01     ` [Qemu-devel] [Qemu-ppc] " David Gibson
2011-10-28  1:56 ` David Gibson [this message]
2011-10-30 17:07   ` [Qemu-devel] [PATCH 2/3] pseries: Allow writes to KVM accelerated TCE table Alexander Graf
2011-10-28  1:56 ` [Qemu-devel] [PATCH 3/3] pseries: Add partial support for PCI David Gibson
2011-10-30 17:06   ` Alexander Graf
2011-10-31  1:48     ` [Qemu-devel] [Qemu-ppc] " David Gibson

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=1319766992-2596-3-git-send-email-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).