From patchwork Wed May 7 15:09:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 346693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E2DB51401B4 for ; Thu, 8 May 2014 01:34:37 +1000 (EST) Received: from localhost ([::1]:41907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wi3XB-0003tW-U0 for incoming@patchwork.ozlabs.org; Wed, 07 May 2014 11:13:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wi3Ub-0007x4-9R for qemu-devel@nongnu.org; Wed, 07 May 2014 11:10:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wi3UV-0000vP-BD for qemu-devel@nongnu.org; Wed, 07 May 2014 11:10:45 -0400 Received: from smtp.citrix.com ([66.165.176.89]:57985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wi3UV-0000uT-6f for qemu-devel@nongnu.org; Wed, 07 May 2014 11:10:39 -0400 X-IronPort-AV: E=Sophos; i="4.97,1004,1389744000"; d="scan'208"; a="128639615" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 07 May 2014 15:10:35 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Wed, 7 May 2014 11:10:33 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Wi3UK-0004B3-LE; Wed, 07 May 2014 16:10:28 +0100 From: Stefano Stabellini To: Date: Wed, 7 May 2014 16:09:56 +0100 Message-ID: <1399475403-5408-1-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: olaf@aepfle.de, xen-devel@lists.xensource.com, Stefano Stabellini , Alexey Kardashevskiy , qemu-devel@nongnu.org, anthony@codemonkey.ws, Anthony.Perard@citrix.com, pbonzini@redhat.com Subject: [Qemu-devel] [PULL 1/7] exec: Limit translation limiting in address_space_translate to xen 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: Alexey Kardashevskiy The address_space_translate() function cuts the returned plen (page size) to hardcoded TARGET_PAGE_SIZE. This function can be used on pages bigger than that so this limiting should not be used on such pages. Since originally the limiting was introduced for XEN, we can safely limit this piece of code to XEN. So does the patch. Suggested-by: Paolo Bonzini Signed-off-by: Alexey Kardashevskiy Signed-off-by: Stefano Stabellini --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 91513c6..cf12049 100644 --- a/exec.c +++ b/exec.c @@ -380,7 +380,7 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, as = iotlb.target_as; } - if (memory_access_is_direct(mr, is_write)) { + if (xen_enabled() && memory_access_is_direct(mr, is_write)) { hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr; len = MIN(page, len); }