From patchwork Wed Oct 31 14:04:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 149823 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6835981ljp; Wed, 31 Oct 2018 07:04:45 -0700 (PDT) X-Received: by 2002:a67:8406:: with SMTP id g6mr1380318vsd.0.1540994685349; Wed, 31 Oct 2018 07:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540994685; cv=none; d=google.com; s=arc-20160816; b=N3dt0Jzsmbd6+gAFWYDc9sRlNRUdadceOD2fb5fJ/OGq8SWq99Gi1x6L8bPNXX337A 1zjhK7VXDq9CNX7lFHbT2+VVSWvvxVcN2STV6fbaCoVIqx+cj8D68bsV9qLbuqk6wpJ6 WjBmnlLOxPdcamSuyPrV6ZQiFYYLm+X61wlu5fKoD6lHTUmarl4JE+W28tdEZWDSExaM FQvrEGIo8x+fOvbXv6Gk6Uiy8qI4Ngya9TEn8+rzwrMAe7o6EptIVsmZDbzuqvmrTkap DPfmz2kVBmKIMgCVEvIeDnaI1q7Ek0V1kx9fvpBFlQDHmCHoxRV/Pge6UWoVk6X91kvL /H+w== 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=ETbNdSeBPd5xM2dN4FrDzl5stbA+LzyzD4VmBVmdPGg=; b=enTQr4dSgRk0t3fMqoBvcqMNwxtdZUtLN4Qf8SgUn25NJzHYNbiIZssFXQwejBX6nM Hv54ltr2EhVBl8nzl5+DSggivm7GFKG74bR0ZFpKTa6qkTFVXtgEAKaAHYqhMGbxxLnp c/ba6EfCrA7Y6LkIv9RXhQFoYT6WI6BXxU+YvmWw90TLyqfTQIuCz+YzRmbhwxz2LV3b E7anmH6OmbKGSQYNW7LzlRytWx8lfQ6mYCcayNsi8wr6QkLsBM3lk4xg3ixZHdW6/4R3 Elzx9UggpORVCrADgZRsO6QC16XXaIzd4hrKaVZD9g2SMILCsAn1VnEM3ZZtDVi0ad2H iAAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L7bEqun5; 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 b187sor16167813vsd.54.2018.10.31.07.04.45 for (Google Transport Security); Wed, 31 Oct 2018 07:04:45 -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=L7bEqun5; 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=ETbNdSeBPd5xM2dN4FrDzl5stbA+LzyzD4VmBVmdPGg=; b=L7bEqun521oaqk2WTcO/fR/5e2dbRx7+iqdR8fyRauKqYkK9KVp4UQ/n0t7+wPuOQI KPEqymre4PVMRR70myzdwyLdt8qVz9oe7OK/WEL1X1El1A6w9fCOo5RNTagJXl0Zg7S9 5GaH+Yak9qEEE743eaF6eXmpWDgoO6QCuUaAM= 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=ETbNdSeBPd5xM2dN4FrDzl5stbA+LzyzD4VmBVmdPGg=; b=CSNPxFkeus7wD5/Ji9PEXg9wVB9aYCrnUhvDHVli+6HWvKH3UKL892YrvLKRgOjTmO QGAGpVV5sWMBSaVH9y+IblOLjEuXd0bhs/0gTvlE5DPlRZEYY/RT6HpOl0EKXyH9NYtW MMWtotZBTM9wJ2owj0vKUgwdOufIWDYnbCq23ghHos1owGTmHgCb23F4eAZWzhR4SfSP bBFCy0qzWxoOEDYUIkC6Ia3TtqMu8eBeZ8CEj8EeL5UOfzEHuLQNwPRl64VlooxvOe1M Dlmz1iIuSDkHZMvVbqRZiCCFh+S2+AMFi/Hs4DHf56Zc0a48S9WvMQL1rNelUf9YNUli VNxw== X-Gm-Message-State: AGRZ1gImsIe/91EmZ0RiM0+Rya8poueXbo2lC6lAC+dmgdz/lefkGDuj 7/uqFaXNYyqHeekH5VID5y0sfZRQ X-Google-Smtp-Source: AJdET5eMLo9Hx8lg/rPLUW9xGsgiBbnvll5/j4yD1Ndr7tpcbcJpi/dzKkdnHq0nyKSVs8tXOBdG7w== X-Received: by 2002:a67:4441:: with SMTP id r62mr1331511vsa.38.1540994684880; Wed, 31 Oct 2018 07:04:44 -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 6sm6795632vsy.25.2018.10.31.07.04.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 07:04:43 -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.4 04/18] ARM: bugs: add support for per-processor bug checking Date: Wed, 31 Oct 2018 10:04:22 -0400 Message-Id: <20181031140436.2964-5-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031140436.2964-1-dave.long@linaro.org> References: <20181031140436.2964-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 c671f345266a..212147c78f4b 100644 --- a/arch/arm/mm/proc-macros.S +++ b/arch/arm/mm/proc-macros.S @@ -258,13 +258,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