|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v3 03/10] x86/mtrr: replace use_intel() with a local flag
On 12.09.22 11:10, Juergen Gross wrote: On 11.09.22 12:16, Borislav Petkov wrote:On Thu, Sep 08, 2022 at 10:49:07AM +0200, Juergen Gross wrote:diff --git a/arch/x86/include/asm/cacheinfo.h b/arch/x86/include/asm/cacheinfo.h index 86b2e0dcc4bf..1aeafa9888f7 100644 --- a/arch/x86/include/asm/cacheinfo.h +++ b/arch/x86/include/asm/cacheinfo.h @@ -2,6 +2,11 @@ #ifndef _ASM_X86_CACHEINFO_H #define _ASM_X86_CACHEINFO_H +/* Kernel controls MTRR and/or PAT MSRs. */ +extern unsigned int cache_generic;So this should be called something more descriptive like memory_caching_typesIn the end this variable doesn't specify which caching types are available, but the ways to select/control the caching types. So what about "memory_caching_select" or "memory_caching_control" instead?or so to denote that this is a bitfield of supported memory caching technologies. The code then would read as if (memory_caching_types & CACHE_MTRR) The name's still not optimal tho - needs more brooding over.+#define CACHE_GENERIC_MTRR 0x01 +#define CACHE_GENERIC_PAT 0x02 Hmm, this might be a little bit risky. It can be done, but then X86_FEATURE_MTRR could be set even for cpus NOT supporting it (the 32-bit special cases AMD, CENTAUR, CYRIX). So we have the following alternatives: - do the switch to X86_FEATURE_MTRR risking code breakage for later code changes querying X86_FEATURE_MTRR and assuming the MTRR MSRs being available - keep the current bool - replace the bool with mtrr_if != NULL - add a new synthetic feature, e.g. X86_FEATURE_MTRR_ENABLED (which in fact would be just a replacement of the current bool) My preference would be the replacement with mtrr_if != NULL. Juergen Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc Attachment:
OpenPGP_signature
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |