]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
pseries: Allow writes to KVM accelerated TCE table
authorDavid Gibson <david@gibson.dropbear.id.au>
Thu, 27 Oct 2011 15:56:31 +0000 (15:56 +0000)
committerAlexander Graf <agraf@suse.de>
Sun, 30 Oct 2011 19:03:27 +0000 (20:03 +0100)
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>
Signed-off-by: Alexander Graf <agraf@suse.de>
target-ppc/kvm.c

index f3d0861a111e3fefd0f2d51b1161c263432b6309..429349fb94b78c7da45934195926ad7e393fd9cc 100644 (file)
@@ -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;