Received: from eggs.gnu.org ([140.186.70.92]:46855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJbgr-0007XT-K2 for qemu-devel@nongnu.org; Thu, 27 Oct 2011 21:57:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJbgq-0001ij-2P for qemu-devel@nongnu.org; Thu, 27 Oct 2011 21:57:01 -0400 From: David Gibson Date: Fri, 28 Oct 2011 12:56:31 +1100 Message-Id: <1319766992-2596-3-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1319766992-2596-1-git-send-email-david@gibson.dropbear.id.au> References: <1319766992-2596-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PATCH 2/3] pseries: Allow writes to KVM accelerated TCE table List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: agraf@suse.de, anthony@codemonkey.ws Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org 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 --- 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