From patchwork Fri Jul 12 05:28:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 168871 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp394671ilk; Thu, 11 Jul 2019 22:29:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyL9s6d84/NiNrJPskzT6dCJyoU5mcVmkuWWz2o96NYjyZa0SncWneWNPeIL+gA9AGr403g X-Received: by 2002:a17:902:6a87:: with SMTP id n7mr9008658plk.336.1562909372972; Thu, 11 Jul 2019 22:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562909372; cv=none; d=google.com; s=arc-20160816; b=RCqvyQ/MviOMIGMaFA7/Zhr67N97ggUWm/9NGCJ9dSliPI28hfgJt4K2ep3mm3Osub OMZkXmrXyy7Da06xWSVE37ZRAJUTBQnS16pariCDBoYNvJVWQfqrDuQjQJw1pFGjfczp z8//POR+yosQjFwEu5FmaL1rPuu0VULXM+s0B88UCTzJriHuzhzMr4nyY213TxmH0o80 31M9lXXTsTtgysFzk427PlXrwqrIq9wvrtN6zuzSpGS5DEusK7INHSAYSajXnliJlAF9 QwXcjo61VeA6a0kSvxUW3RXH3z0UBg8RE6D+Omw3I94HSXlayt+Wx4EFazPXq8DVtnUX UMzA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/kfHaZYBMHfOrWZM24aWUbS5m2tlkmGASsL26R9/1y0=; b=YfkGYcI9qWNPpLyaIkRfLJGAS4aVP+Ac3t+IuH4GZbpRPbcZwfJrTSrilQ45/SiPY0 MJz6nmsZpyC5e1OEw3VOMQL8KHXNaHK9fz/gX62oIpKDkpnQPjV6u1/MvPRZWGdtsYRM W0OgJIzKAxJELHSe+fl2ROjV5VF3h9Uv1GDUfANDuEl03EBBPkHt6Mj7AmMi5840FMMf 7nXRxKfcqlIOXjQ1Vby666efo7smu/YrFUsj9ETXmlFaEhxNJh3pCCtuWuM/BeBgX1wm xBmF1mOVDXjpIz+7dHMj83+iYLHCtqvJhFs5fEgRQAXnqFzAP3wEXKmXU3bnwjhlT3Zz 6tRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cGmYhryo; 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 e36si5303191pgm.17.2019.07.11.22.29.32; Thu, 11 Jul 2019 22:29:32 -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 header.s=google header.b=cGmYhryo; 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 S1725877AbfGLF3c (ORCPT + 13 others); Fri, 12 Jul 2019 01:29:32 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:43502 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725791AbfGLF3c (ORCPT ); Fri, 12 Jul 2019 01:29:32 -0400 Received: by mail-pf1-f195.google.com with SMTP id i189so3784679pfg.10 for ; Thu, 11 Jul 2019 22:29:31 -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 :mime-version:content-transfer-encoding; bh=/kfHaZYBMHfOrWZM24aWUbS5m2tlkmGASsL26R9/1y0=; b=cGmYhryoCvANnaH4geFrp/J9iYbsc93CKBZgUMA9oUfaIiy5wdBhR4DlJmw3lRYYkA aVW9vCmzdn45ZIMZ1dMMq/N8JVs1GCVa8B89kv/v7c3FKhtB39xYSiG73QQR4kuM3JAb cL1tc5wyGgB1cEYzqSLcMKjG3Zfs2ngs3HKGI2Fy4Xyuya6kSkwu/P5920GkpBbj4Wk5 0q+nHiS2Ldbb8I+Wr9P0dryCEaZ2EiWQbjXGgDW2oeZoZQq2mF8seW0WrqTaTajMVkse GAdrTI0Kwc1mmnP0MN7Jp2dKsjRroebJ8GorFrfv+bWbEsgna60JLumwtDgx9vOMEbyA /O1w== 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=/kfHaZYBMHfOrWZM24aWUbS5m2tlkmGASsL26R9/1y0=; b=oc9m+7Gwzd57Vqbm0wXOkrw44ElTrILA5Z+vTfsu7N7vmv4LL+AAJIpaEPLS/lH5Mg Tjqd6HREcF46ns5ONXue0yOEVrD7pqpD1h1ies3eiYzRlRh0au4RqNvdCTCS2OiwXCuY TndjILNRSHQPNLLwm6na5Z1H3xh+FGSU1uOmDXOwFqBThe2ttUSz2VwI8i2LvTdipF6p hJerLulQjW9mAxxGEIPVLuVR/NyIsuwh+YomgTmiBngABk90UkF/8JMhkRAwdn6nQHoG HrhmVZ/QydL+AWfP9TUw+gUdqNTZW4KWXbiLWhGlRfZIrBpeadTv5/mKIOnDH/XHmRa/ 7S1Q== X-Gm-Message-State: APjAAAXoSNjVYTfwg+nGgGNtme8yxb+HgpbUVKdphNhiTCuL22rtI4hj l2vkjeRlInRPzjhvo/vmV09wozqJSvs= X-Received: by 2002:a63:6981:: with SMTP id e123mr8520931pgc.136.1562909371293; Thu, 11 Jul 2019 22:29:31 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id e6sm8850058pfn.71.2019.07.11.22.29.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jul 2019 22:29:30 -0700 (PDT) From: Viresh Kumar To: stable@vger.kernel.org, Julien Thierry Cc: Viresh Kumar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Marc Zyngier , Mark Rutland , Will Deacon , Russell King , Vincent Guittot , mark.brown@arm.com Subject: [PATCH v4.4 V2 12/43] arm64: cpufeature: Test 'matches' pointer to find the end of the list Date: Fri, 12 Jul 2019 10:58:00 +0530 Message-Id: <64c9f2c29cd2e63aecbd233aa96fd9d18e165330.1562908075.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: James Morse commit 644c2ae198412c956700e55a2acf80b2541f6aa5 upstream. CPU feature code uses the desc field as a test to find the end of the list, this means every entry must have a description. This generates noise for entries in the list that aren't really features, but combinations of them. e.g. > CPU features: detected feature: Privileged Access Never > CPU features: detected feature: PAN and not UAO These combination features are needed for corner cases with alternatives, where cpu features interact. Change all walkers of the arm64_features[] and arm64_hwcaps[] lists to test 'matches' not 'desc', and only print 'desc' if it is non-NULL. Signed-off-by: James Morse Reviewed-by : Suzuki K Poulose Signed-off-by: Catalin Marinas Signed-off-by: Viresh Kumar --- arch/arm64/kernel/cpufeature.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index c1eddc07d996..bdb4cd9ffccf 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -744,7 +744,7 @@ static void setup_cpu_hwcaps(void) int i; const struct arm64_cpu_capabilities *hwcaps = arm64_hwcaps; - for (i = 0; hwcaps[i].desc; i++) + for (i = 0; hwcaps[i].matches; i++) if (hwcaps[i].matches(&hwcaps[i])) cap_set_hwcap(&hwcaps[i]); } @@ -754,11 +754,11 @@ void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps, { int i; - for (i = 0; caps[i].desc; i++) { + for (i = 0; caps[i].matches; i++) { if (!caps[i].matches(&caps[i])) continue; - if (!cpus_have_cap(caps[i].capability)) + if (!cpus_have_cap(caps[i].capability) && caps[i].desc) pr_info("%s %s\n", info, caps[i].desc); cpus_set_cap(caps[i].capability); } @@ -772,7 +772,7 @@ static void enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps) { int i; - for (i = 0; caps[i].desc; i++) + for (i = 0; caps[i].matches; i++) if (caps[i].enable && cpus_have_cap(caps[i].capability)) /* * Use stop_machine() as it schedules the work allowing @@ -884,7 +884,7 @@ void verify_local_cpu_capabilities(void) return; caps = arm64_features; - for (i = 0; caps[i].desc; i++) { + for (i = 0; caps[i].matches; i++) { if (!cpus_have_cap(caps[i].capability) || !caps[i].sys_reg) continue; /* @@ -897,7 +897,7 @@ void verify_local_cpu_capabilities(void) caps[i].enable(NULL); } - for (i = 0, caps = arm64_hwcaps; caps[i].desc; i++) { + for (i = 0, caps = arm64_hwcaps; caps[i].matches; i++) { if (!cpus_have_hwcap(&caps[i])) continue; if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i]))