From patchwork Mon Jan 28 22:31:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 156899 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3959442jaa; Mon, 28 Jan 2019 14:42:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN69RBA0jl6B2UTmcYmq51geMjJJY/vHc2rFcRWBXBu51kw91oSpU7GyayXhNFF9ogAEp0lS X-Received: by 2002:a1c:cc2:: with SMTP id 185mr19387304wmm.1.1548715370814; Mon, 28 Jan 2019 14:42:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548715370; cv=none; d=google.com; s=arc-20160816; b=u7sZPGm/A61zbcxSkFELUc9pJKRjiMo4MTcwrLzcYLDaNgITxsCJbV9UVPRE7FBiKo tU8cGqxbEEuyG0bAKHZGiMvPFsk8/pYYdweyjEopDWnoIps2vRd/PsDtCtObQp8rlqb9 EkNR1FY/FxUAn0xaHlTIv0HRuomoCZ6eTGk7WGLAZoT8lzRI/tQV3kyW95GahqYSgCJn PZJOy2GuAiqSedRdhr09U9Sjm58yshKM+Hr+IUKMaEhVOk656upK0LfG4Kmwh6thKdNL F0yGZzH7tbdCxm0CSUGa6vKhFq4agyVO1AYrXB+aP9ApzZ6sgcnaOMk/hrJtpqNRe9hq n1wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Srgal5L+T4f9BJA308PnBpjmkpNAduRiPZ7ATLTRwkQ=; b=aMb0Hjpa60GOHyHdUFIPwk7K0jUqh2CRfhBICnFDpOdkO54axIAl/5J4Ommlw3iUwT gRD54jbtbMSSPTa2jGhcpI1urW1dtISTzb43M1F+IsYNnHsPNdHz+J13lT7irqSBnahZ /rYlAVeVxzE4S54as7tWOoWGpvm4TBPmX5hqJJWdDEkl1JBpD4Jjuk8V0cqBtm5nXnui lmBzZpzrjmB25IEh4tFBTre46VLOYP+mwkBca5kOPglzifQ6d8uu8WTIFVaY2EUvKXiM dArODFF1YKh5i8Lvf4b16sWRVIL69FT0Kr21f6ZXad0GIcrbRNo/bwu9rTjdmGPA8Gik QMRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="RCl/BXog"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t132si533194wmd.119.2019.01.28.14.42.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 28 Jan 2019 14:42:50 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="RCl/BXog"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:39574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goFc9-0006jp-Ai for patch@linaro.org; Mon, 28 Jan 2019 17:42:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goFbq-0006iZ-Dx for qemu-devel@nongnu.org; Mon, 28 Jan 2019 17:42:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goFRP-0006HX-09 for qemu-devel@nongnu.org; Mon, 28 Jan 2019 17:31:44 -0500 Received: from mail-oi1-x241.google.com ([2607:f8b0:4864:20::241]:35289) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1goFRN-0006EV-HY for qemu-devel@nongnu.org; Mon, 28 Jan 2019 17:31:42 -0500 Received: by mail-oi1-x241.google.com with SMTP id v6so14531168oif.2 for ; Mon, 28 Jan 2019 14:31:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Srgal5L+T4f9BJA308PnBpjmkpNAduRiPZ7ATLTRwkQ=; b=RCl/BXogUyRAExfZa+W/Gw9RrHscv7PKc3rJQ7rXYxB4Yzzvoenr7ayW4Dj1Wg0f6n J3IJ8xDBWQMj7Nm8ilIe6ZbI98aYFcqLHQ28FSEWs4OsTWZ0FEHoT9kaAbna9pR7WR5K MS4conjzW3IJ2kvIutc9M74mIdZ0RQo7R3y0E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Srgal5L+T4f9BJA308PnBpjmkpNAduRiPZ7ATLTRwkQ=; b=HAiRQSMKifUX+PSP4ZNi8QJ8MwxYwIVgcayKttc1QryHObG0jbaIuvTRX8RSY14ZgC sbkoa9eCBReXAi1Y4PxTvbkJVqP73cxX2UrZdwwTkPsToRYLFsJqXhPDCw4X77DE4GdL rPAwS1YyjOwkCiSTad+TWS5mYpd1Nijl0k7zHRCDuuhqH2euQFRRVn1BVLvtj8IrdWJa SCsbIKtvgx5WX0jW6HXhtoPvbVKZ9Q58VdFue7T7Ddyt7MbW6lciec7nrU6Gr4+/0n0K Yqw+QmVSrQ4tkTvJ6sAvtLjaevq46nyNk7QQ1WXQIwTmZGNfz/MuxACDcZzz1KR0o64K yzjg== X-Gm-Message-State: AJcUukdPmr3x3+71OcPGM15P6/gHNt4wkW3TV1KHGc0s8RYNZ1hTd+hT f3coeQDsUzn0b/kgBPbk3/VHBFb8NQE= X-Received: by 2002:a54:4f8f:: with SMTP id g15mr7662915oiy.166.1548714695462; Mon, 28 Jan 2019 14:31:35 -0800 (PST) Received: from cloudburst.twiddle.net ([12.227.73.85]) by smtp.gmail.com with ESMTPSA id v3sm7460438oib.57.2019.01.28.14.31.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 14:31:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 28 Jan 2019 14:31:15 -0800 Message-Id: <20190128223118.5255-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190128223118.5255-1-richard.henderson@linaro.org> References: <20190128223118.5255-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::241 Subject: [Qemu-devel] [PATCH v2 09/12] target/arm: Add x-guarded-pages cpu property for user-only X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" While waiting for a proper userland ABI, allow static test cases to be written assuming that GP is set for all pages. Signed-off-by: Richard Henderson --- v2: Renamed the property with x- prefix --- target/arm/cpu.h | 4 ++++ target/arm/cpu64.c | 18 ++++++++++++++++++ target/arm/translate-a64.c | 8 +++++++- 3 files changed, 29 insertions(+), 1 deletion(-) -- 2.17.2 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index e18f823419..8c9eb519ef 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -895,6 +895,10 @@ struct ARMCPU { */ bool cfgend; +#ifdef CONFIG_USER_ONLY + bool guarded_pages; +#endif + QLIST_HEAD(, ARMELChangeHook) pre_el_change_hooks; QLIST_HEAD(, ARMELChangeHook) el_change_hooks; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index e9bc461c36..a563f7e74d 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -311,6 +311,18 @@ static void cpu_max_set_packey(Object *obj, Visitor *v, const char *name, } error_propagate(errp, err); } + +static bool aarch64_cpu_get_guarded_pages(Object *obj, Error **errp) +{ + ARMCPU *cpu = ARM_CPU(obj); + return cpu->guarded_pages; +} + +static void aarch64_cpu_set_guarded_pages(Object *obj, bool val, Error **errp) +{ + ARMCPU *cpu = ARM_CPU(obj); + cpu->guarded_pages = val; +} #endif /* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); @@ -416,6 +428,12 @@ static void aarch64_max_initfn(Object *obj) cpu->env.cp15.sctlr_el[1] |= SCTLR_EnIA | SCTLR_EnIB; cpu->env.cp15.sctlr_el[1] |= SCTLR_EnDA | SCTLR_EnDB; } + + object_property_add_bool(obj, "x-guarded-pages", + aarch64_cpu_get_guarded_pages, + aarch64_cpu_set_guarded_pages, NULL); + object_property_set_description(obj, "x-guarded-pages", + "Set on/off GuardPage bit for all pages", NULL); #endif cpu->sve_max_vq = ARM_MAX_VQ; diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 89cc54dbed..a1adb8cde0 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -13778,7 +13778,13 @@ static void disas_data_proc_simd_fp(DisasContext *s, uint32_t insn) static bool is_guarded_page(CPUARMState *env, DisasContext *s) { #ifdef CONFIG_USER_ONLY - return false; /* FIXME */ + /* + * FIXME: What is the userland ABI for this? + * For the moment this is controlled by an attribute: + * -cpu max,guarded_pages=on. + */ + ARMCPU *cpu = arm_env_get_cpu(env); + return cpu->guarded_pages; #else uint64_t addr = s->base.pc_first; int mmu_idx = arm_to_core_mmu_idx(s->mmu_idx);