From patchwork Wed Nov 7 16:43:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 150419 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5387170ljp; Wed, 7 Nov 2018 08:44:10 -0800 (PST) X-Received: by 2002:a37:6801:: with SMTP id d1mr882415qkc.217.1541609050318; Wed, 07 Nov 2018 08:44:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541609050; cv=none; d=google.com; s=arc-20160816; b=onqUJ+CpxC48uFPiEoN7IxxWZvldw1OxNvakBJBPKmlICGUXTMZJqk7HhTrNoUqBsq 73LFKvrQ/Lc/BSoD8Cwd6jrricatKXuY+4EkVFFueVZITY2tWYeakpatXWEG0a+vuPkj LmEQQUDS6Zhns4m/EsiVw2JtBAdX8zraQRbqZiFA78tKXd6YXVANrxK0m1xvxe17LHNf wCjhfeZ99jDfyXOM2s5HuGLDw5RMU4JuX4ed7P2dU/XvSjYq7HCmCv3VK5O/yWeypUOi 7rserbdgddR9lHB39mQSf9ut1nFAGdWgmtmfFsmCrLZxZj3mWRVwWR7G18akLo8R9RJ9 EW4A== 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=ulNwLNjAaCC2tonK7jCjILJil9vQHg0oYi7nJN2/5DZUdT8smTUlvRQysujXfkDrLH +5YVKsgu6PITRDRz9LzwBA+WX9Qc0ND1Dwo85bvo4xx+KvV1gMb22v0So2oleYHGK2tW ILGGKNLxZpss2uot09fRa7e3oxsS6yyIx7tY4XsE54+YiStwYtbXzWUIdfaWQuIvHgQq lDCsaUZQwP5jro+8N3UaHJhIA4pTmwyNSlfjTVnacTNs4Gusx9b4I3E2Rma5EIJpEi3t jbajbu6BXNFfjTrKyFcEXP4uCxBgJ3UnGeIPXtgbq0arV11wgj7pTIG1AxkIOfpWhOwT 1kCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bbmGd9HN; 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 o6sor648116qkh.123.2018.11.07.08.44.10 for (Google Transport Security); Wed, 07 Nov 2018 08:44:10 -0800 (PST) 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=bbmGd9HN; 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=bbmGd9HNSjzJ3dwwYAnlM0P021ptxCvJ6Ksu2h9K1jxwggAXLvnveSP2YEAE6UY4tL cESsunC/5lB6JLJAS2Gu42zXrq0fzOMBh6GauWb8w6Kt9eRhbGKm7XAGpPHaMmyWiMp1 r2Zxpx5kynhpbLraqa4okF4K2ddlUKvAXeyao= 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=MIj6k8KSOyz7lyVPe30DL4Uihlg2GWgOArLyUYOSfaChLrvScVzEPUpbSGBvy0BLU5 Hlt+NJ6v5uf/+pctJtUk19kg162/cZjjIaQxSrVUGftIcxB9DOJQwhXBrgyuQm4hDG9l QYVg50txc63yFzPtdYSSINrzlsv4tCy9sUeq3ndrSduwCxyGJCI8+Qlre9OUAWK6GNe9 jsyXBM/dyCBL3g4KfOEPukgXCSNYsDgu75sHcbXR1FEraImriHLlsS96JpO3WMYauHaI aLgJFQnajsBtUYktBjAGlnurVTU+Zqv9o4J/5Fdo3FYSSWHqsXqQf59AeH6y9R3Tzxei 5Nbw== X-Gm-Message-State: AGRZ1gIigCERHFCHx1/HTIlOItVWRz9OKA3cNTzRzO+JS7mRjW8fTrBr u2wove31bGQZ+knaHDcLihvjzwAQ X-Google-Smtp-Source: AJdET5dffq93vF6jQerX1CVLHHHlY6Uds7Y1b5zxEMrQBx3w2PVX0Uyux6ZOaqYCHPpNnyWu00Q+mQ== X-Received: by 2002:a37:12a1:: with SMTP id 33mr899094qks.151.1541609049783; Wed, 07 Nov 2018 08:44:09 -0800 (PST) Return-Path: Received: from localhost.localdomain (pool-72-71-243-63.cncdnh.fast00.myfairpoint.net. [72.71.243.63]) by smtp.googlemail.com with ESMTPSA id 96-v6sm681817qtc.56.2018.11.07.08.44.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 08:44:09 -0800 (PST) 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 V2 04/24] ARM: bugs: add support for per-processor bug checking Date: Wed, 7 Nov 2018 11:43:42 -0500 Message-Id: <20181107164402.9380-5-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181107164402.9380-1-dave.long@linaro.org> References: <20181107164402.9380-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