From patchwork Sat Feb 29 01:28:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 184047 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1373643ile; Fri, 28 Feb 2020 17:32:29 -0800 (PST) X-Google-Smtp-Source: APXvYqyh95RnWCRsPYAtNTRmcVNnp7CiIffLJ2Vi9pUuFAbLJs3ouXWypkVGzNXczH49PAiT4MEQ X-Received: by 2002:ac8:19b6:: with SMTP id u51mr6740571qtj.319.1582939949846; Fri, 28 Feb 2020 17:32:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582939949; cv=none; d=google.com; s=arc-20160816; b=dlrrL7HQUkoOMFOL9Hfhs7YsNZyTAGx9Iv7OJ2cH9A2ACM2y8xYAsxOTFSWznowtry nyVoI2sTZjgVBlRTk2EBXXy5KmmUA/6PirNet6ml+Uo+P+oztixrxDI5OD3dCV1rmQCf XU5dwsQweP4QF0F3Q5I5YOwpRCmQrd7/bvslHnsqoNsokPiOlTPGqInI5UUftp8Wfd1B Gijy2ZAqUTMjhPwgpKuyCjkkhaUc5GrPe3jv+daqWpg6PGoYFR4cfx7j0c41CBZ9pCZ+ 8aandGI1mpPH6JNetX4HQbchygBTlMdzEtEiFeAaRN9mNbcCvIr2ihYkh2UpaJ0caNk+ MtBw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=QpMHNZIbcT5PzqjajR8IDp8eTMJQTzdyuvxjhrMoYDc=; b=E3OPtoGfmvOsKZXBsN3vjVMykRFC4eyYvCSzWNs2zqamkyfM8FEW7VrtCdi3VQksEe p6ffCXABumBzHU6FQ3Yh+R5U3bwF/z7ECn14XOa6S4Z4PrhXAdrVnUmN5fSpxyDYZ2Dm 8kK90gGC4liXjxbOgP60cPzRByM64wJAcqfKhgeVXMtnHtNSW5qp4NIe0cqsrI8ipQch HIPrIWCIjGMUK4CE2GKTqDxXwBsS2HDGes069XguMfDmFPReEVaMks4T6OqACkZCKv/m AUYhjTWF1QSXhZSjbiufUgX96ehKam2ZX/NdeqDPEpughS/v6cQUutBA0Anbe/rEmX4W 9zeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YY2Mz0sz; 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=pass (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 n7si2548445qtl.44.2020.02.28.17.32.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Feb 2020 17:32:29 -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=pass header.i=@linaro.org header.s=google header.b=YY2Mz0sz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7qzV-0004xa-Au for patch@linaro.org; Fri, 28 Feb 2020 20:32:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36985) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7qvW-0004kZ-67 for qemu-devel@nongnu.org; Fri, 28 Feb 2020 20:28:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7qvV-00060b-2b for qemu-devel@nongnu.org; Fri, 28 Feb 2020 20:28:22 -0500 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:44139) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j7qvU-0005z8-SX for qemu-devel@nongnu.org; Fri, 28 Feb 2020 20:28:21 -0500 Received: by mail-pl1-x641.google.com with SMTP id d9so1900247plo.11 for ; Fri, 28 Feb 2020 17:28:19 -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 :mime-version:content-transfer-encoding; bh=QpMHNZIbcT5PzqjajR8IDp8eTMJQTzdyuvxjhrMoYDc=; b=YY2Mz0sznUyzLkAu1ttdhi9ccja2VcdZ72zNGleYvo831HwzPkcs197oPmgr6em6O2 LZJH/O75OrxN2+rDi1nF+8SgvkWTYd5qQpCArvjePBcriTVbzyLidObarP1f4M1+jcn/ Y6PhNuae4pAmb56QmYcCVgpy7FzESM3dM7H5LCOStgueezcuczF2mTSszdceXTpUlYN1 LeupHVsARLhHvRKtTZ7P8LZBoszOakQUg1se3av9J4n95a3xHEMB3joKVLtdQuyH8A+G 3ED8dUat1+2kN1KLcCFtppx8Jf7p7OxzaZqbTqTQWkMOhCRtjuYNG4ZShvVPj+hlc5K0 EXxA== 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:mime-version:content-transfer-encoding; bh=QpMHNZIbcT5PzqjajR8IDp8eTMJQTzdyuvxjhrMoYDc=; b=ZNG2fZUWQUIwRKUd2HhY9gdr9ZJhfzd+4tEyl6TnK6jt0G1mosDHsi0xQmtIStzGTJ C7tdOtsDhy0W5sMvfIdxtUjP4gvqiTgrumNqSuqfP7720TSCuiqnu0Ya2WQpQRhR84KT D6TKcytVX1p+/WAaIhQmjbQZLHA9KXcYTR6pwSNEm/mPEJPZP51M1T+Uk9lTWz909JlX TInLYOlfaK3q/JRP45gU8VoXffNk9bmTDDiPjDNQPPRRQqcIr5WSa4SdRlPu2K912Ynx lVmukTpn8wSxqNSBBAe/ts6AiqMh3UpF10rCBqr80LCbRFkad9rUY/VpyVsAK++7oq7m +mCw== X-Gm-Message-State: APjAAAVrzDhwCKKwm9RT5mNM47xm0eCAZAJfsI3YOFeq7VUINDw+EyGn 9jZpPchHb1gVHSmR+a7ekBZWKlcy4kU= X-Received: by 2002:a17:90b:243:: with SMTP id fz3mr7826522pjb.29.1582939698546; Fri, 28 Feb 2020 17:28:18 -0800 (PST) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id r3sm4606313pfq.126.2020.02.28.17.28.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 17:28:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 03/12] target/arm: Disable has_el2 and has_el3 for user-only Date: Fri, 28 Feb 2020 17:28:02 -0800 Message-Id: <20200229012811.24129-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200229012811.24129-1-richard.henderson@linaro.org> References: <20200229012811.24129-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In arm_cpu_reset, we configure many system registers so that user-only behaves as it should with a minimum of ifdefs. However, we do not set all of the system registers as required for a cpu with EL2 and EL3. Disabling EL2 and EL3 mean that we will not look at those registers, which means that we don't have to worry about configuring them. Signed-off-by: Richard Henderson --- target/arm/cpu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index e6016e33ce..33c28fe868 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1103,11 +1103,13 @@ static Property arm_cpu_reset_hivecs_property = static Property arm_cpu_rvbar_property = DEFINE_PROP_UINT64("rvbar", ARMCPU, rvbar, 0); +#ifndef CONFIG_USER_ONLY static Property arm_cpu_has_el2_property = DEFINE_PROP_BOOL("has_el2", ARMCPU, has_el2, true); static Property arm_cpu_has_el3_property = DEFINE_PROP_BOOL("has_el3", ARMCPU, has_el3, true); +#endif static Property arm_cpu_cfgend_property = DEFINE_PROP_BOOL("cfgend", ARMCPU, cfgend, false); @@ -1222,25 +1224,25 @@ void arm_cpu_post_init(Object *obj) qdev_property_add_static(DEVICE(obj), &arm_cpu_rvbar_property); } +#ifndef CONFIG_USER_ONLY if (arm_feature(&cpu->env, ARM_FEATURE_EL3)) { /* Add the has_el3 state CPU property only if EL3 is allowed. This will * prevent "has_el3" from existing on CPUs which cannot support EL3. */ qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el3_property); -#ifndef CONFIG_USER_ONLY object_property_add_link(obj, "secure-memory", TYPE_MEMORY_REGION, (Object **)&cpu->secure_memory, qdev_prop_allow_set_link_before_realize, OBJ_PROP_LINK_STRONG, &error_abort); -#endif } if (arm_feature(&cpu->env, ARM_FEATURE_EL2)) { qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el2_property); } +#endif if (arm_feature(&cpu->env, ARM_FEATURE_PMU)) { cpu->has_pmu = true;