From patchwork Sun Oct 30 20:23:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 122686 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 74014B6F76 for ; Mon, 31 Oct 2011 08:41:02 +1100 (EST) Received: from localhost ([::1]:60216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKbnb-0005cN-Nh for incoming@patchwork.ozlabs.org; Sun, 30 Oct 2011 16:16:07 -0400 Received: from eggs.gnu.org ([140.186.70.92]:43372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKbmV-0003hN-7t for qemu-devel@nongnu.org; Sun, 30 Oct 2011 16:15:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RKbmE-0002pu-5F for qemu-devel@nongnu.org; Sun, 30 Oct 2011 16:14:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:60687 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKbmD-0002om-O8; Sun, 30 Oct 2011 16:14:41 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id C8B718F9AB; Sun, 30 Oct 2011 21:14:38 +0100 (CET) From: Alexander Graf To: qemu-devel@nongnu.org Date: Sun, 30 Oct 2011 21:23:13 +0100 Message-Id: <1320006193-15219-23-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1320006193-15219-1-git-send-email-agraf@suse.de> References: <1320006193-15219-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Blue Swirl , qemu-ppc@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCH 22/22] pseries: Allow writes to KVM accelerated TCE table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: David Gibson 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 Signed-off-by: Alexander Graf --- 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 f3d0861..429349f 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;