From patchwork Mon Feb 17 20:08:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 24792 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f70.google.com (mail-pb0-f70.google.com [209.85.160.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5A05020143 for ; Mon, 17 Feb 2014 20:08:14 +0000 (UTC) Received: by mail-pb0-f70.google.com with SMTP id rq2sf36521485pbb.1 for ; Mon, 17 Feb 2014 12:08:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=8JjVMM0bv8R9RS9xewRyq/HuJNDRhdGNolfqrisU+Ss=; b=C3Uq7Wl7KXAmq3NyKDWfjRkBfDqraGDJ0oEk6wC+W0MNzew6Ezj7JJuWO5ZQ7ECGY6 va8yV89MNE7TYSHwFKTF/R0ZwX7+T2o+xuRMpdeO9eBHF1ftk7VXSkEe1Im4MuMiPVHS h2T8wfZ8chv+H/QcnbZzvGkqM5/zPJmqnr16SPwXcVX31oAqd9UBbfopZCo3oa/ashsH vIJmc1dpWzi6wgkw+8Xmw22/C1PoTssdmFZubDiyR1ypz3iSBUGY8Sc+T71RCRlafe05 ETn3Vjj6t1/zjrt0YNISkqABJaTBaFvAlpEnqYXFLeWYJGmaUhj3G9Aairj1hxT4sAqz 0//A== X-Gm-Message-State: ALoCoQn2xMHUSd73GcEtrH6HjjTlGXETeao2zawfBp+7ZgLweD86JMbAeLJjs2rpCsB+qKGjpJtU X-Received: by 10.68.223.202 with SMTP id qw10mr11094734pbc.6.1392667693047; Mon, 17 Feb 2014 12:08:13 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.26.40 with SMTP id 37ls1114797qgu.46.gmail; Mon, 17 Feb 2014 12:08:12 -0800 (PST) X-Received: by 10.220.159.4 with SMTP id h4mr18520764vcx.1.1392667692932; Mon, 17 Feb 2014 12:08:12 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id uo16si4731282veb.124.2014.02.17.12.08.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Feb 2014 12:08:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id jw12so5448689veb.32 for ; Mon, 17 Feb 2014 12:08:12 -0800 (PST) X-Received: by 10.220.10.2 with SMTP id n2mr13898038vcn.26.1392667692803; Mon, 17 Feb 2014 12:08:12 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp164146vcz; Mon, 17 Feb 2014 12:08:12 -0800 (PST) X-Received: by 10.180.182.199 with SMTP id eg7mr14858967wic.13.1392667691895; Mon, 17 Feb 2014 12:08:11 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id h16si12226022wjr.14.2014.02.17.12.08.11 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 17 Feb 2014 12:08:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WFUU6-0002HI-8B; Mon, 17 Feb 2014 20:08:10 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio Subject: [PATCH] target-arm: Load correct access bits from ARMv5 level 2 page table descriptors Date: Mon, 17 Feb 2014 20:08:10 +0000 Message-Id: <1392667690-8731-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In ARMv5 level 2 page table descriptors, each 4K or 64K page is split into four subpages, each of which can have different access permission settings, which are specified by four two-bit fields in the l2 descriptor. A long-standing cut-and-paste error meant we were using the wrong bits in the virtual address to select the access-permission field for 4K pages. The error has presumably not been noticed before because most guests don't make use of the ability to set the access permissions differently for each 1K subpage: if the guest gives the whole page the same access permissions it doesn't matter which of the 4 AP fields we select. (The whole issue is irrelevant for ARMv7 CPUs anyway because subpages aren't supported there.) Reported-by: Vivek Rai Signed-off-by: Peter Maydell --- target-arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 5ae08c9..8eb10dc 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -2874,7 +2874,7 @@ static int get_phys_addr_v5(CPUARMState *env, uint32_t address, int access_type, break; case 2: /* 4k page. */ phys_addr = (desc & 0xfffff000) | (address & 0xfff); - ap = (desc >> (4 + ((address >> 13) & 6))) & 3; + ap = (desc >> (4 + ((address >> 9) & 6))) & 3; *page_size = 0x1000; break; case 3: /* 1k page. */