From patchwork Mon Nov 2 17:09:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 320328 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp3899066ilc; Mon, 2 Nov 2020 09:17:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYWfkhoMhMG815ObVair3iICGb0MynzZU6nT+Dtr98QSsqZJ/eD9N/TDfHBc0/EW75vOhS X-Received: by 2002:a37:a692:: with SMTP id p140mr15473947qke.125.1604337475082; Mon, 02 Nov 2020 09:17:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604337475; cv=none; d=google.com; s=arc-20160816; b=u/o3RpLSygpwbvTQI6yqTfM3ml89DvOJowRF7RPy03cVLTB4aIEJ89Llj+KpvvVZbe X4dH1S+pEWLrAnU2fDP/FRWess04SsMslHqtXUOb/imvL59j8zXDKTKyDh5NlZK4HSvS ks0GsZNGbRVdTqZwtvoI/CflJnhRBZoIWn8bX6uZF9ZUvo5He4LfDdAZ+CfbvnS35IBW 6awShVFNUa4L/klH6TmABdOQr5GDJM3RbrnBU4fVRUsTikDHOlOmerpytzVOq32Nrqjd 8XJbgABBgtQbUf/I+6XegKbsqbdSnLZK+N57lJ7yyrtxt421+VpoVolKqC6gb9kdndFc p0Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=oS0wIyEvl6kAmgjQUcastyFGaftesb6oVP+8lJQGRmA=; b=RQhFLF87nxB/zweU2EInJVtEZaqsg0dG28yyfDuwKtudC0DDhbnl/wCBSKtx5CW12A SzREbvUwBg94+ykhhsmsO4atAolE5UWywMk+5vm2IcOvKl0Uj2HZwVtWY+r0mMcr1ydG 17tlQ2a7NwnwWdqaSAG9gZXJde5VnR3Myc+NtCLNo8Jyv8rNSL6u/69Su0Dvcq5Lj2lh uj8URPxPN4CtXjJlWi5V9TQ/fX6vyNP2+1UaZEhoFjX0ybUfX+yCJMYBXo4KZ+W6dkeh A9KVw2OVdFCsViNx10KMl6ZmQqhzQXR3R8+9M2arKldWkPJ07hlZYgFMdJl1NZuDOkwK fSWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="w6AK/ZU8"; 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 m7si7928024qka.291.2020.11.02.09.17.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Nov 2020 09:17:55 -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="w6AK/ZU8"; 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]:60580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZdSs-0000v7-9Z for patch@linaro.org; Mon, 02 Nov 2020 12:17:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZdLu-0000yB-6g for qemu-devel@nongnu.org; Mon, 02 Nov 2020 12:10:42 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:40587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kZdLr-0006at-JG for qemu-devel@nongnu.org; Mon, 02 Nov 2020 12:10:41 -0500 Received: by mail-wr1-x443.google.com with SMTP id 33so4707934wrl.7 for ; Mon, 02 Nov 2020 09:10:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=oS0wIyEvl6kAmgjQUcastyFGaftesb6oVP+8lJQGRmA=; b=w6AK/ZU8E7lFeVE63BSJIzdZKFOLZf2Ex4ohEHQW3gUvWDN8Jvzh+EPSfjf9cBpLz7 KpNXTunV+/oY/ijxmkdP94ApH1c3tJxv7OX9y2lo6mI6Q5LTKuAWRxitVZtt35BlHp2L LPMiIUmVctrRK7UO/r+mWZ5RwnLgpC09dHMkPxd7K+SSGEFtV63iHFmkHk30dL0SYQRB Jd0oFNdY3FM+/oMlzSLnCu4bMjYZlQpMKlZ3hK6uE0gtirSOJUZHMZpUfx9HVXzulTjW 9Y+fSpe8Dib/mfMlL+Wcnd+yna5n5HqO6cTUK8cYP1oKP9AInJuVdKoPgTYndsUin0oD YwuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oS0wIyEvl6kAmgjQUcastyFGaftesb6oVP+8lJQGRmA=; b=s8iYz+9ku2DyjGtr5p3ExAq/EMVHl48habJ5ea6yjqE3mBj5dRz6eF6RGJfqY6Oz6v Y5qfMgcyhc8m6LpVMH/x4wfNfi8/e/2FlO8m3jhSR/tc3Hx0YyisPJjzB1khR3yZUkrO /oDySyEM0BO8pRvMsqEGUmKKvKblsg2q7ZpzXfHrPt0tQnPbkYhcG63HiAn9g6TxW18k Et92Z4WX/WQc+Jor8IXPWWzgNXZOtujyypLQNGdzAltK5j/VP7HloKjKBGIEmUs5HM7D IdVC/ZIiIviXZXNUYnEJGVuzUCGx3Fdoyp4KwjDzr3DUdub3T/4ZdFoJF+xCjGApXn8k Wlbg== X-Gm-Message-State: AOAM533gFkBS15AlyJcxSsKnejb/YdBeZq651Q8QVSK+F4qtzKhiPDq9 iJyi7wATrBRInE8bZWliFhhY4/9pjE+Ssg== X-Received: by 2002:adf:ba4f:: with SMTP id t15mr20633953wrg.335.1604337035495; Mon, 02 Nov 2020 09:10:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id c18sm22396540wrt.10.2020.11.02.09.10.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 09:10:34 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/26] target/arm: fix LORID_EL1 access check Date: Mon, 2 Nov 2020 17:09:54 +0000 Message-Id: <20201102171005.30690-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201102171005.30690-1-peter.maydell@linaro.org> References: <20201102171005.30690-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Rémi Denis-Courmont Secure mode is not exempted from checking SCR_EL3.TLOR, and in the future HCR_EL2.TLOR when S-EL2 is enabled. Signed-off-by: Rémi Denis-Courmont Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) -- 2.20.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index dc51175bf05..68545919865 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6679,9 +6679,10 @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) #endif /* Shared logic between LORID and the rest of the LOR* registers. - * Secure state has already been delt with. + * Secure state exclusion has already been dealt with. */ -static CPAccessResult access_lor_ns(CPUARMState *env) +static CPAccessResult access_lor_ns(CPUARMState *env, + const ARMCPRegInfo *ri, bool isread) { int el = arm_current_el(env); @@ -6694,16 +6695,6 @@ static CPAccessResult access_lor_ns(CPUARMState *env) return CP_ACCESS_OK; } -static CPAccessResult access_lorid(CPUARMState *env, const ARMCPRegInfo *ri, - bool isread) -{ - if (arm_is_secure_below_el3(env)) { - /* Access ok in secure mode. */ - return CP_ACCESS_OK; - } - return access_lor_ns(env); -} - static CPAccessResult access_lor_other(CPUARMState *env, const ARMCPRegInfo *ri, bool isread) { @@ -6711,7 +6702,7 @@ static CPAccessResult access_lor_other(CPUARMState *env, /* Access denied in secure mode. */ return CP_ACCESS_TRAP; } - return access_lor_ns(env); + return access_lor_ns(env, ri, isread); } /* @@ -6738,7 +6729,7 @@ static const ARMCPRegInfo lor_reginfo[] = { .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, - .access = PL1_R, .accessfn = access_lorid, + .access = PL1_R, .accessfn = access_lor_ns, .type = ARM_CP_CONST, .resetvalue = 0 }, REGINFO_SENTINEL };