mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-24 19:45:06 +08:00
94a9e04aa1
Add a new item to the feature set (ARM64_HAS_SYSREG_GIC_CPUIF) to indicate that we have a system register GIC CPU interface This will help KVM switching to alternative instruction patching. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
64 lines
1.6 KiB
C
64 lines
1.6 KiB
C
/*
|
|
* 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 bool
|
|
has_id_aa64pfr0_feature(const struct arm64_cpu_capabilities *entry)
|
|
{
|
|
u64 val;
|
|
|
|
val = read_cpuid(id_aa64pfr0_el1);
|
|
return (val & entry->register_mask) == entry->register_value;
|
|
}
|
|
|
|
static const struct arm64_cpu_capabilities arm64_features[] = {
|
|
{
|
|
.desc = "GIC system register CPU interface",
|
|
.capability = ARM64_HAS_SYSREG_GIC_CPUIF,
|
|
.matches = has_id_aa64pfr0_feature,
|
|
.register_mask = (0xf << 24),
|
|
.register_value = (1 << 24),
|
|
},
|
|
{},
|
|
};
|
|
|
|
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");
|
|
}
|