From patchwork Mon Jun 15 17:24:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 49898 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5FF73211FD for ; Mon, 15 Jun 2015 17:29:31 +0000 (UTC) Received: by wifx6 with SMTP id x6sf22992255wif.1 for ; Mon, 15 Jun 2015 10:29:30 -0700 (PDT) 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:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=0N2FrRYxnYbAI3GOBmQgz3uUdICNKjEWNLZjVoreRr0=; b=SkrpcPhp9vykl7jmhkfkCF0Fvad3J+47oGEEwrlPNWh6O3rFmPPsCM6xKlz528dCG4 J+pH0IWc/V/TYM9GVZx8kEXGdoYENh0Hz3jeQ9nPU+mcbafA2dAWqETV8SQsGBsPB5yR GM1FCY4FmhvFRCQcQ4/NDYFInDQV5KOkyY4hI9KM0NgX2dyHV+614V/8Gj6e3QhWqw27 fH4FIVzenU3BbfioLBDRPRc4PGZOjpm9fvGZ6+WElI4M2jB92Ups2vhU6HI6HNbwNCkH 5MB3bDMBYG3/FrmQ/dEwHGr5f/RuUtGLEQo4oZFkFTf+UkHZqp7zT4VZvZwkphrNs0a7 2ZRw== X-Gm-Message-State: ALoCoQlaY99qxQXzPcapN3MqS/WSkOO7B+xOmlT/k1V6w0S1zZY6Bf69uDBgN4PYNVZu09TQgTEW X-Received: by 10.180.86.98 with SMTP id o2mr9013344wiz.4.1434389370721; Mon, 15 Jun 2015 10:29:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.201 with SMTP id ao9ls651648lac.9.gmail; Mon, 15 Jun 2015 10:29:30 -0700 (PDT) X-Received: by 10.152.6.105 with SMTP id z9mr27581253laz.98.1434389370544; Mon, 15 Jun 2015 10:29:30 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id et6si11001445lac.38.2015.06.15.10.29.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2015 10:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lacny3 with SMTP id ny3so42639402lac.3 for ; Mon, 15 Jun 2015 10:29:30 -0700 (PDT) X-Received: by 10.112.97.194 with SMTP id ec2mr1274733lbb.88.1434389370405; Mon, 15 Jun 2015 10:29:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1564511lbb; Mon, 15 Jun 2015 10:29:29 -0700 (PDT) X-Received: by 10.140.145.207 with SMTP id 198mr39465198qhr.45.1434389368936; Mon, 15 Jun 2015 10:29:28 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 70si13423043qhg.62.2015.06.15.10.29.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 15 Jun 2015 10:29:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:35629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4YCO-0006Hg-2Y for patch@linaro.org; Mon, 15 Jun 2015 13:29:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4Y8E-0007Zy-QY for qemu-devel@nongnu.org; Mon, 15 Jun 2015 13:25:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4Y8C-0001QP-0O for qemu-devel@nongnu.org; Mon, 15 Jun 2015 13:25:10 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34471) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4Y8B-0001AA-OJ for qemu-devel@nongnu.org; Mon, 15 Jun 2015 13:25:07 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Z4Y83-0003X7-L7 for qemu-devel@nongnu.org; Mon, 15 Jun 2015 18:24:59 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 15 Jun 2015 18:24:53 +0100 Message-Id: <1434389098-13430-24-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1434389098-13430-1-git-send-email-peter.maydell@linaro.org> References: <1434389098-13430-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 23/28] arm: Add has-mpu property 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Peter Crosthwaite For processors that support MPUs, add a property to de-feature it. This is similar to the implementation of the EL3 feature. The processor definition in init sets ARM_FEATURE_MPU if it can support an MPU. post_init exposes the property, defaulting to true. If cleared by the instantiator, ARM_FEATURE_MPU is then removed at realize time. This is to support R profile processors that may or may-not have an MPU configured. Signed-off-by: Peter Crosthwaite Message-id: 632918cc48786e868ea18aa6bd12f70597994cad.1434066412.git.peter.crosthwaite@xilinx.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target-arm/cpu-qom.h | 3 +++ target-arm/cpu.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h index 57b4a12..072aa9b 100644 --- a/target-arm/cpu-qom.h +++ b/target-arm/cpu-qom.h @@ -103,6 +103,9 @@ typedef struct ARMCPU { /* CPU has security extension */ bool has_el3; + /* CPU has memory protection unit */ + bool has_mpu; + /* PSCI conduit used to invoke PSCI methods * 0 - disabled, 1 - smc, 2 - hvc */ diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 6fa51f4..7496983 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -454,6 +454,9 @@ static Property arm_cpu_rvbar_property = static Property arm_cpu_has_el3_property = DEFINE_PROP_BOOL("has_el3", ARMCPU, has_el3, true); +static Property arm_cpu_has_mpu_property = + DEFINE_PROP_BOOL("has-mpu", ARMCPU, has_mpu, true); + static void arm_cpu_post_init(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); @@ -481,6 +484,12 @@ static void arm_cpu_post_init(Object *obj) qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el3_property, &error_abort); } + + if (arm_feature(&cpu->env, ARM_FEATURE_MPU)) { + qdev_property_add_static(DEVICE(obj), &arm_cpu_has_mpu_property, + &error_abort); + } + } static void arm_cpu_finalizefn(Object *obj) @@ -567,6 +576,10 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) cpu->id_aa64pfr0 &= ~0xf000; } + if (!cpu->has_mpu) { + unset_feature(env, ARM_FEATURE_MPU); + } + register_cp_regs_for_features(cpu); arm_cpu_register_gdb_regs_for_features(cpu);