From patchwork Wed Oct 31 13:56:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 149798 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6826359ljp; Wed, 31 Oct 2018 06:57:22 -0700 (PDT) X-Received: by 2002:a1f:95d1:: with SMTP id x200-v6mr1271747vkd.33.1540994242248; Wed, 31 Oct 2018 06:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540994242; cv=none; d=google.com; s=arc-20160816; b=eSTmNk5rfswsOuPaHqYaH6iEgPjEqGy9Fzu+ssNC9Zve+RZ9ZxRAhjbuujJ/K7mqe3 TnhFHY3xHWZksmtRezwoYN+TeKq9YXjw28UPLkwKklGgCkfAesNKQ/7FSV5tEvzdQ1rU Ctog7sruUPoxgqIJPBswOMTF/BVq5NZAelMDkYvPPEIOn+qlBflTWPQlL1keE+OrIQKf zvcu4poJ+hKFANBU+vbDqsti1CGgtI4YjJoox/Xp94qEVwjdjA7Ak+4ldgwmBbNSChly wa50NmyiDy51/JX+cHjfPZTB3VNzf9eZIqOyIuIWHfwlWY+Qn/tPm17If95BpVakuuB/ T5Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=es8Z1MprFzy9vBwnFnUHPP886nyXeKeu6ARHnvEKVLE=; b=ib8CyveXH9e8W8wSkKfQYsLpOqUbghHjQAMzef2Hf3kC3Gi0q3u/B+Zk+lHpzwDbmp TOxHK+godIV3EW90YvB7Vp1eBR02bNLpqe6XVYnebhUV0HGhkJk6NNFq0lL4kDw7EYf2 FdWZyvyZHB8WtsX1jsSchyT3EYZDblMza0lYU7xnVRdugAXpiBZEuobSvgT0RGYX4QLw k2IIWJRZ9qitFhp0fRev20qD6adqyYuSLINWzXiBYsgDu7cdrJ/pGuG2koZrY6oxe+zZ K76UAJR/ftoO8CsEXIUA+U2+ExVH8+eAaC0oBNHK6hqFEXtuYmFaVKPFTKFvjB+ETncb 9kzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=emKQQ0Mx; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id e18sor12564983uam.14.2018.10.31.06.57.22 for (Google Transport Security); Wed, 31 Oct 2018 06:57:22 -0700 (PDT) Received-SPF: pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=emKQQ0Mx; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=es8Z1MprFzy9vBwnFnUHPP886nyXeKeu6ARHnvEKVLE=; b=emKQQ0MxvRNsJKs36qW3P6oqUkI1hTBKXnpY+QY/KvdAzRa47YPtmAY/J+RhrAzdlL I2Ly8ZB2rAfK6iqrPsScKuWlOTuPH2O2zNQR5zzs6nVAU1D7p4usDOzM1AdmyHDfHHN9 yA7iIaLuatrSAhRaiP7H2/+BPGjjiEGdFXeF8= 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=es8Z1MprFzy9vBwnFnUHPP886nyXeKeu6ARHnvEKVLE=; b=KgiPIs1UbRls/FjO9eTCTugB99elCDBRMUAkcDYMc4IsrEdIQf9wHr5i627loApDyJ o2hYlDSUU13cglZLrir0wINUo80CUzXReFpDp7efY7GZGgXKBH3GlN5AI5n1ezM0v2sp 6WepKd6E9IrVv3LXfWo+8sbYt3BDXqwuZD4N4DJD6kktdgtfEtN0kXKzr3yBhu86GKZe I92Pjip4qwPc2AJozISsWsB1tHlXKNF3kgsxJkli9Vs1/hTVNugKcrPILWomat2AoFjD ecdU7picqI1dA0j9jqhPgjHNDXdJXltiYa9PpBUCDNUVq2lyTcJQHwMrnmLjsG324qp4 P3VA== X-Gm-Message-State: AGRZ1gKGb7EmsL7h3g4GW6J3oPMt5uN2TmtSIvpML6uM3Ab+3A5Q0BP/ BFW0IgIo4baeAHSmXoCgj+q23bDX X-Google-Smtp-Source: AJdET5fb6wrm8FTyCggTe8QkHATvDl3wKYgkfBuFOU/UET3fY0BWNxG7246vAkf99Nj1vZMHfdb1RA== X-Received: by 2002:ab0:4ac9:: with SMTP id t9mr1450982uae.74.1540994241768; Wed, 31 Oct 2018 06:57:21 -0700 (PDT) Return-Path: Received: from dave-Dell-System-XPS-L502X.hsd1.nh.comcast.net ([2603:3005:3403:7100:2c71:8680:34e1:a6aa]) by smtp.googlemail.com with ESMTPSA id s85-v6sm2275624vse.29.2018.10.31.06.57.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 06:57:21 -0700 (PDT) From: David Long To: stable@vger.kernel.org, Russell King - ARM Linux , Florian Fainelli , Tony Lindgren , Marc Zyngier , Mark Rutland Cc: Greg KH , Mark Brown Subject: [PATCH 4.9 04/24] ARM: bugs: add support for per-processor bug checking Date: Wed, 31 Oct 2018 09:56:53 -0400 Message-Id: <20181031135713.2873-5-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031135713.2873-1-dave.long@linaro.org> References: <20181031135713.2873-1-dave.long@linaro.org> From: Russell King Commit 9d3a04925deeabb97c8e26d940b501a2873e8af3 upstream. Add support for per-processor bug checking - each processor function descriptor gains a function pointer for this check, which must not be an __init function. If non-NULL, this will be called whenever a CPU enters the kernel via which ever path (boot CPU, secondary CPU startup, CPU resuming, etc.) This allows processor specific bug checks to validate that workaround bits are properly enabled by firmware via all entry paths to the kernel. Signed-off-by: Russell King Reviewed-by: Florian Fainelli Boot-tested-by: Tony Lindgren Reviewed-by: Tony Lindgren Acked-by: Marc Zyngier Signed-off-by: David A. Long --- arch/arm/include/asm/proc-fns.h | 4 ++++ arch/arm/kernel/bugs.c | 4 ++++ arch/arm/mm/proc-macros.S | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h index 8877ad5ffe10..f379f5f849a9 100644 --- a/arch/arm/include/asm/proc-fns.h +++ b/arch/arm/include/asm/proc-fns.h @@ -36,6 +36,10 @@ extern struct processor { * Set up any processor specifics */ void (*_proc_init)(void); + /* + * Check for processor bugs + */ + void (*check_bugs)(void); /* * Disable any processor specifics */ diff --git a/arch/arm/kernel/bugs.c b/arch/arm/kernel/bugs.c index 16e7ba2a9cc4..7be511310191 100644 --- a/arch/arm/kernel/bugs.c +++ b/arch/arm/kernel/bugs.c @@ -5,6 +5,10 @@ void check_other_bugs(void) { +#ifdef MULTI_CPU + if (processor.check_bugs) + processor.check_bugs(); +#endif } void __init check_bugs(void) diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S index 0d40c285bd86..7d9176c4a21d 100644 --- a/arch/arm/mm/proc-macros.S +++ b/arch/arm/mm/proc-macros.S @@ -274,13 +274,14 @@ mcr p15, 0, ip, c7, c10, 4 @ data write barrier .endm -.macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0 +.macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0, bugs=0 .type \name\()_processor_functions, #object .align 2 ENTRY(\name\()_processor_functions) .word \dabort .word \pabort .word cpu_\name\()_proc_init + .word \bugs .word cpu_\name\()_proc_fin .word cpu_\name\()_reset .word cpu_\name\()_do_idle