diff options
-rw-r--r-- | arch/x86/kernel/cpu/intel_cacheinfo.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index 31590a001e2a..c105c533ed94 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -453,27 +453,16 @@ int amd_set_l3_disable_slot(struct amd_l3_cache *l3, int cpu, unsigned slot, | |||
453 | { | 453 | { |
454 | int ret = 0; | 454 | int ret = 0; |
455 | 455 | ||
456 | #define SUBCACHE_MASK (3UL << 20) | 456 | /* check if @slot is already used or the index is already disabled */ |
457 | #define SUBCACHE_INDEX 0xfff | ||
458 | |||
459 | /* | ||
460 | * check whether this slot is already used or | ||
461 | * the index is already disabled | ||
462 | */ | ||
463 | ret = amd_get_l3_disable_slot(l3, slot); | 457 | ret = amd_get_l3_disable_slot(l3, slot); |
464 | if (ret >= 0) | 458 | if (ret >= 0) |
465 | return -EINVAL; | 459 | return -EINVAL; |
466 | 460 | ||
467 | /* | 461 | if (index > l3->indices) |
468 | * check whether the other slot has disabled the | ||
469 | * same index already | ||
470 | */ | ||
471 | if (index == amd_get_l3_disable_slot(l3, !slot)) | ||
472 | return -EINVAL; | 462 | return -EINVAL; |
473 | 463 | ||
474 | /* do not allow writes outside of allowed bits */ | 464 | /* check whether the other slot has disabled the same index already */ |
475 | if ((index & ~(SUBCACHE_MASK | SUBCACHE_INDEX)) || | 465 | if (index == amd_get_l3_disable_slot(l3, !slot)) |
476 | ((index & SUBCACHE_INDEX) > l3->indices)) | ||
477 | return -EINVAL; | 466 | return -EINVAL; |
478 | 467 | ||
479 | amd_l3_disable_index(l3, cpu, slot, index); | 468 | amd_l3_disable_index(l3, cpu, slot, index); |