-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm64: Extract feature parsing code from cpu_errata.c
As we detect more architectural features at runtime, it makes sense to reuse the existing framework whilst avoiding to call a feature an erratum... This patch extract the core capability parsing, moves it into a new file (cpufeature.c), and let the CPU errata detection code use it. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
- Loading branch information
Marc Zyngier
authored and
Will Deacon
committed
Mar 30, 2015
1 parent
fef7f2b
commit 359b706
Showing
5 changed files
with
68 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Contains CPU feature definitions | ||
* | ||
* Copyright (C) 2015 ARM Ltd. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#define pr_fmt(fmt) "alternatives: " fmt | ||
|
||
#include <linux/types.h> | ||
#include <asm/cpu.h> | ||
#include <asm/cpufeature.h> | ||
|
||
static const struct arm64_cpu_capabilities arm64_features[] = { | ||
{}, | ||
}; | ||
|
||
void check_cpu_capabilities(const struct arm64_cpu_capabilities *caps, | ||
const char *info) | ||
{ | ||
int i; | ||
|
||
for (i = 0; caps[i].desc; i++) { | ||
if (!caps[i].matches(&caps[i])) | ||
continue; | ||
|
||
if (!cpus_have_cap(caps[i].capability)) | ||
pr_info("%s %s\n", info, caps[i].desc); | ||
cpus_set_cap(caps[i].capability); | ||
} | ||
} | ||
|
||
void check_local_cpu_features(void) | ||
{ | ||
check_cpu_capabilities(arm64_features, "detected feature"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters