Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1018633ybe; Wed, 4 Sep 2019 11:13:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqw08riTnrMzZuORnD6iq9d1OK83stbnMPNJ6pTtXM+yeObwYt8OUmy3XKPYlF3PS8cc1iSR X-Received: by 2002:a17:902:8d82:: with SMTP id v2mr41247330plo.24.1567620802375; Wed, 04 Sep 2019 11:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620802; cv=none; d=google.com; s=arc-20160816; b=Wtf/EWWt3i7DwUGLwCFkdHu38vQ2omGYPuYCjiM0I+saJMHx/yPtU/YyBzMhTs6QPU Vy+93BXk08TtNiPNhIlZWwZFGM7rIo3ieq66jISknGk51n+6vu0d6Uvt8EKxpMoBMvYQ 6z0p8jLmsymfx+rZKv42g7zqlcd7f37IuziKZxCUpG1DARthA2bcRAn/gxdZiPHzXMtO uUCjQZFWM1bt41qzBUMYe9d6jRVBiVefIY/3B3TqKM//FyLJ9e9BGE9a7sX8ytRoP4N2 SZ+ITxhZb2N3GDU5HdCGVNBeoBIM+WV7SV7bXnEW3F2GiICU2aWb+zkxq3ZepQAMZmx6 tJag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hUBl4hcQq7tBNyF0RJ0hZtQ1+kJvr8+9kfl+tG2qRqw=; b=VcuLDP76IvBv4QsE82QtX0fHEJG2K/S7Q2M8FLIvKRvuWlTS2+IEeInt58585FnII0 taNPJPkMM7I38+mJTBu+DtHW6Bh8cVSj40QRUn2qp1rBh4dEY/+F9OlFLAM1uFhI1RW0 oxkbQHFe2QwyMnKp8YiBCR+F6uPMbSAXzeGXrtafv+MDaF3yGzuar2Q8z/lgE2N9aCo7 nzXcDYWV6qqQqi6hpUkKaO0K0PwEvhuf/ueBgeDpFKho/3Jsvpa19eSsNkuYjpnZeKA1 c++RXiqapyw6YO5seDmr25fT7Xt7iA+rNbe6JDouqq5EOKigFhT/ZIylS+hwZ3jCbGje RH8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pPYOHJ5d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si17845028plt.26.2019.09.04.11.13.07; Wed, 04 Sep 2019 11:13:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@kernel.org header.s=default header.b=pPYOHJ5d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390098AbfIDSK1 (ORCPT + 99 others); Wed, 4 Sep 2019 14:10:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:54018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390085AbfIDSK0 (ORCPT ); Wed, 4 Sep 2019 14:10:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B6339208E4; Wed, 4 Sep 2019 18:10:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620625; bh=meFTcUmkxYfq3pNm9SZhxFxrV8BBcqZk9PMJBplnH0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pPYOHJ5dn8U80SShYL6JysB545qsQ+uSi6vul8/frsDvtJ8qnlagpmwWMqAL6vcvv x17u2NE1L7Cjm+SVr+EzbHXTDfw3kRY/8bhu0dE3bfqu5wh6gk8zPMvDIC+MyqcB6j OkZOS/vvItbxAP+oNNvVSjl/hhKt/bKGQ8YBaxMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Kevin Hilman , Mark Rutland , Suzuki K Poulose , Will Deacon , Catalin Marinas , Sasha Levin Subject: [PATCH 5.2 034/143] arm64: cpufeature: Dont treat granule sizes as strict Date: Wed, 4 Sep 2019 19:52:57 +0200 Message-Id: <20190904175315.385235253@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 5717fe5ab38f9ccb32718bcb03bea68409c9cce4 ] If a CPU doesn't support the page size for which the kernel is configured, then we will complain and refuse to bring it online. For secondary CPUs (and the boot CPU on a system booting with EFI), we will also print an error identifying the mismatch. Consequently, the only time that the cpufeature code can detect a granule size mismatch is for a granule other than the one that is currently being used. Although we would rather such systems didn't exist, we've unfortunately lost that battle and Kevin reports that on his amlogic S922X (odroid-n2 board) we end up warning and taining with defconfig because 16k pages are not supported by all of the CPUs. In such a situation, we don't actually care about the feature mismatch, particularly now that KVM only exposes the sanitised view of the CPU registers (commit 93390c0a1b20 - "arm64: KVM: Hide unsupported AArch64 CPU features from guests"). Treat the granule fields as non-strict and let Kevin run without a tainted kernel. Cc: Marc Zyngier Reported-by: Kevin Hilman Tested-by: Kevin Hilman Acked-by: Mark Rutland Acked-by: Suzuki K Poulose Signed-off-by: Will Deacon [catalin.marinas@arm.com: changelog updated with KVM sanitised regs commit] Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/kernel/cpufeature.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index ae63eedea1c12..68faf535f40a3 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -184,9 +184,17 @@ static const struct arm64_ftr_bits ftr_id_aa64zfr0[] = { }; static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = { - S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN4_SHIFT, 4, ID_AA64MMFR0_TGRAN4_NI), - S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN64_SHIFT, 4, ID_AA64MMFR0_TGRAN64_NI), - ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN16_SHIFT, 4, ID_AA64MMFR0_TGRAN16_NI), + /* + * We already refuse to boot CPUs that don't support our configured + * page size, so we can only detect mismatches for a page size other + * than the one we're currently using. Unfortunately, SoCs like this + * exist in the wild so, even though we don't like it, we'll have to go + * along with it and treat them as non-strict. + */ + S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN4_SHIFT, 4, ID_AA64MMFR0_TGRAN4_NI), + S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN64_SHIFT, 4, ID_AA64MMFR0_TGRAN64_NI), + ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_TGRAN16_SHIFT, 4, ID_AA64MMFR0_TGRAN16_NI), + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_BIGENDEL0_SHIFT, 4, 0), /* Linux shouldn't care about secure memory */ ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_SNSMEM_SHIFT, 4, 0), -- 2.20.1