Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1832528imm; Mon, 3 Sep 2018 10:35:12 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaWWErU8NrkoJO55tX5ahmTWzzCDM16+fBO9d8KYNmfhdUaTDkiLhzbGPwPR10S/Cf1pI+G X-Received: by 2002:a62:e08b:: with SMTP id d11-v6mr30541609pfm.214.1535996112142; Mon, 03 Sep 2018 10:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535996112; cv=none; d=google.com; s=arc-20160816; b=RVWC1A3jV8LFBxi3RgiEvVSmsnZJYj29o6J8mVVllBZkszUhrDPR/NvKoXzVFMQkp3 CR0VaPHA0hiGleZZyNWhPq3BhDixX0LKFUCJ2TRR5khZKHPdin2g5gDbp3aQVq0KDp+D 3/yOMf0ot37BBoOnIIcvkf/HVWciXug3WgBhx3mMyNFik/N1rwPjMZzUQf2AEqMmxIz5 O1t97LVX7VnEzLgJmNyh+W+VEAsPBrVpZKctOxunkJZZ6zQaMAYwDMz2v6p1bOWlFKqo J4wSmpqUZKVmsAgEur1l7KSNUivG5QjklHrYcuEFtV1Dh3Vf+J6BlhWJeymG5UbNvDQL nE1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=lawEtUi1TDrId8gzbRW3pUPgrc3icmGHSyvT4ZjqhBQ=; b=XYKp2/IM9Qgwreuu4iZxHZeXwQOxhMVs0BgcJaCvJ9r/+5Y2zm2D10KajlSquNfz0A m15hkxGTBz8ftmMKVEEUoaCaOUy0QStL5QIU4yfgsIEECidsKegjOiSq+cZWai5PyO4z oOaW6ug7R5itwuBQ+YUSXm4P9XiBFF4gtZBUzdj3fAZQXWmhHm94JPhKll8n+YZHCcIj ESxOXkLI4v8RkxWXadUo6BdFNH+jb68pKaou9zyr5SAEdBOsvrjDUNvF5+2hRzIpe2yq liFEWEjx0/f9f9s9f2kzf0uEaI2XwVJfFUV25TA1H9FNagCfIaQkLasbAbBxyEsJi1mQ QdPQ== ARC-Authentication-Results: i=1; mx.google.com; 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 y63-v6si17690781pgd.435.2018.09.03.10.34.56; Mon, 03 Sep 2018 10:35:12 -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; 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 S1731294AbeICVyY (ORCPT + 99 others); Mon, 3 Sep 2018 17:54:24 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47636 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728253AbeICVyY (ORCPT ); Mon, 3 Sep 2018 17:54:24 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5221DD16; Mon, 3 Sep 2018 17:33:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Will Deacon , Catalin Marinas , Suzuki K Poulose Subject: [PATCH 4.18 030/123] arm64: Handle mismatched cache type Date: Mon, 3 Sep 2018 18:56:14 +0200 Message-Id: <20180903165720.764050546@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165719.499675257@linuxfoundation.org> References: <20180903165719.499675257@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Suzuki K Poulose commit 314d53d297980676011e6fd83dac60db4a01dc70 upstream. Track mismatches in the cache type register (CTR_EL0), other than the D/I min line sizes and trap user accesses if there are any. Fixes: be68a8aaf925 ("arm64: cpufeature: Fix CTR_EL0 field definitions") Cc: Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Signed-off-by: Suzuki K Poulose Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/cpucaps.h | 3 ++- arch/arm64/kernel/cpu_errata.c | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) --- a/arch/arm64/include/asm/cpucaps.h +++ b/arch/arm64/include/asm/cpucaps.h @@ -49,7 +49,8 @@ #define ARM64_HAS_CACHE_DIC 28 #define ARM64_HW_DBM 29 #define ARM64_SSBD 30 +#define ARM64_MISMATCHED_CACHE_TYPE 31 -#define ARM64_NCAPS 31 +#define ARM64_NCAPS 32 #endif /* __ASM_CPUCAPS_H */ --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -65,11 +65,15 @@ is_kryo_midr(const struct arm64_cpu_capa } static bool -has_mismatched_cache_line_size(const struct arm64_cpu_capabilities *entry, - int scope) +has_mismatched_cache_type(const struct arm64_cpu_capabilities *entry, + int scope) { u64 mask = CTR_CACHE_MINLINE_MASK; + /* Skip matching the min line sizes for cache type check */ + if (entry->capability == ARM64_MISMATCHED_CACHE_TYPE) + mask ^= arm64_ftr_reg_ctrel0.strict_mask; + WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible()); return (read_cpuid_cachetype() & mask) != (arm64_ftr_reg_ctrel0.sys_val & mask); @@ -615,7 +619,14 @@ const struct arm64_cpu_capabilities arm6 { .desc = "Mismatched cache line size", .capability = ARM64_MISMATCHED_CACHE_LINE_SIZE, - .matches = has_mismatched_cache_line_size, + .matches = has_mismatched_cache_type, + .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, + .cpu_enable = cpu_enable_trap_ctr_access, + }, + { + .desc = "Mismatched cache type", + .capability = ARM64_MISMATCHED_CACHE_TYPE, + .matches = has_mismatched_cache_type, .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, .cpu_enable = cpu_enable_trap_ctr_access, },