From patchwork Wed Jun 7 17:11:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 103303 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2042484qgd; Wed, 7 Jun 2017 10:12:34 -0700 (PDT) X-Received: by 10.99.163.25 with SMTP id s25mr33459002pge.191.1496855554171; Wed, 07 Jun 2017 10:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496855554; cv=none; d=google.com; s=arc-20160816; b=YfOrlicXPBHBaYYBBgT/9E8U/UXntiMOT+OydOGd1r5lckXbS6H//+CkV+umawumWR HGjt6OPW0h5jqHDK3jZshCAXoSdMEDHozb7YXHj2rKKnV9bEMdZnLq0D/1lXFt2rf1uw ZxB2qFU49M8zHkiVwoMzbZWrsIpw4xXOPFDnrhPT3eDWKgOIRTREcM2EMDUhdwByMNlG CzcXAdToAduKjV3mDwz1s80CeoFJlddMIIjwFK5zoCMJInxmlbHYCplymtrkgPB3VRCB IMToT9RZIR6dv3At6+srD2/Qo3rehJM4CB/2cZtYGZJQur9aXX7d/Yau+PyT2iTRI+xY Id5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=OzMas14WKct7ApvdLL7743kw3lJsxKT47nOta7IKK5I=; b=VNIZW7V93VbKD4DSN0UHJytWTOInDno4eoyCDnghaJd6NZ6dsNh2BHXMJ8AbG4qMyQ /HVxYAn63O6oK1qyFBZsy3kZboevWqWEa0TVOw/Eo04WOkxe9Iis/nV81o+mmj/5KfT0 hn/KAGQAxPuxPcW6ywLHYmLL0O2wuuFKuD5rQV6oyk5+NdU4chwzL8u0mDhnVaQZ6qPH /I9mMZARiaSEieHE5ReDI76T8GkWROgE+QktS9+qFz44r1cQrjJtWsv3D2HKE2D93dIN zYPn9P1kASDy0yirDahG5kxIXJwft58hg1/yFBM+3e7qLaoTgMyG2PR0y1wQXStXwliw L4wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si2136473plh.341.2017.06.07.10.12.33; Wed, 07 Jun 2017 10:12:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751594AbdFGRMQ (ORCPT + 6 others); Wed, 7 Jun 2017 13:12:16 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:37302 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751592AbdFGRMM (ORCPT ); Wed, 7 Jun 2017 13:12:12 -0400 Received: by mail-wm0-f49.google.com with SMTP id d73so15626664wma.0 for ; Wed, 07 Jun 2017 10:12:12 -0700 (PDT) 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=OzMas14WKct7ApvdLL7743kw3lJsxKT47nOta7IKK5I=; b=Jx3dce7M0vTFrmvePJEX36rCJBCQBuZPMhjASmCZ/83N5G49W/s0EjUbgnUw5toVvs SkqK2vnPS7sHkEvnUS6bp3KjkaMDbERiVYCKFKuUSp8q3GBJfZM2x6h/oVdN+O2GjFvd qv9RjtEMqFxaiRWSebudrCaWnmL9NrmjccXHA= 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=OzMas14WKct7ApvdLL7743kw3lJsxKT47nOta7IKK5I=; b=DyeX1v2EX1egIRU/Vi8u/X3E0k5NtG6CJUOEDZq5NsroOwvjYXvNRhe3JkaFKt8Wa2 r9m2KFSNNsNcwyl4g2sP6yNJW3/RqdTdH676JQl7hjBV/gxdx4PfI7ggVQJ8pyX1ofJH mIS1vg48eP0y2lHI73tRx0eSdUj/qRA1ZKvHussfxofa64qhojCyjcsDHz+EvyMNSomC iszhnkJzpmsyj0Y9vKX7aV8JCGFOT9n/iXGAkbqkDUx3RRmygSOX7jaF14YCtfvWCC3/ 3k/juj4YfW8k/LK1p0AcgcpbTQny4cO3HQ+dzqczW78k8xYmPGvcCBVS222udbTkAVQu olcQ== X-Gm-Message-State: AODbwcAIiYFj6wbJCY2PvpqIFZ4JKHMDBlfhJcOR/4u580Pbyat23lQE kiiNltpfES9Hk3/U X-Received: by 10.80.153.143 with SMTP id m15mr25705678edb.35.1496855531269; Wed, 07 Jun 2017 10:12:11 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id c2sm966244edc.34.2017.06.07.10.12.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jun 2017 10:12:10 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org, Christoffer Dall Subject: [PULL v2 5/6] arm64: KVM: Allow unaligned accesses at EL2 Date: Wed, 7 Jun 2017 19:11:51 +0200 Message-Id: <20170607171152.21874-6-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170607171152.21874-1-cdall@linaro.org> References: <20170607171152.21874-1-cdall@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier We currently have the SCTLR_EL2.A bit set, trapping unaligned accesses at EL2, but we're not really prepared to deal with it. So far, this has been unnoticed, until GCC 7 started emitting those (in particular 64bit writes on a 32bit boundary). Since the rest of the kernel is pretty happy about that, let's follow its example and set SCTLR_EL2.A to zero. Modern CPUs don't really care. Cc: stable@vger.kernel.org Reported-by: Alexander Graf Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm64/kvm/hyp-init.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.9.0 diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S index 4072d40..3f96155 100644 --- a/arch/arm64/kvm/hyp-init.S +++ b/arch/arm64/kvm/hyp-init.S @@ -108,9 +108,10 @@ __do_hyp_init: /* * Preserve all the RES1 bits while setting the default flags, - * as well as the EE bit on BE. + * as well as the EE bit on BE. Drop the A flag since the compiler + * is allowed to generate unaligned accesses. */ - ldr x4, =(SCTLR_EL2_RES1 | SCTLR_ELx_FLAGS) + ldr x4, =(SCTLR_EL2_RES1 | (SCTLR_ELx_FLAGS & ~SCTLR_ELx_A)) CPU_BE( orr x4, x4, #SCTLR_ELx_EE) msr sctlr_el2, x4 isb