lkml.org 
[lkml]   [2023]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 09/12] x86/mtrr: construct a memory map with cache modes
On Mon, Mar 06, 2023 at 05:34:22PM +0100, Juergen Gross wrote:
> +/* Build the cache_map containing the cache modes per memory range. */
> +void mtrr_build_map(void)
> +{
> + unsigned int i;
> + u64 start, end, size;
> + u8 type;
> +
> + if (!mtrr_state.enabled)
^^^^^^^^^^^^^^^^^^^

> + return;
> +
> + /* Add fixed MTRRs, optimize for adjacent entries with same type. */
> + if (mtrr_state.enabled & MTRR_STATE_MTRR_FIXED_ENABLED) {
^^^^^^^^^^^^^^^^^^

First check can go.

> + start = 0;
> + end = size = 0x10000;
> + type = mtrr_state.fixed_ranges[0];
> +
> + for (i = 1; i < MTRR_NUM_FIXED_RANGES; i++) {

Loops starts at 1. Comment explaining why pls.

> + if (i == 8 || i == 24)

Magic numbers.

Ok, I'll stop here.

Please send a new version with the review comments incorporated. I need
to look more at that map thing more.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

\
 
 \ /
  Last update: 2023-03-31 14:58    [W:0.748 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site