I'm poking around mtrr.c (v2 and v3 are almost identical, but I'm looking at v3), and I'm trying to understand set_var_mtrr_resource(). It looks to me like the code is setting up the mtrrs for the var_mtrr_state struct, then setting var_mtrr_state struct to equal the values passed by the resource struct, so it's always one base/size behind. This then has to be corrected for in x86_setup_var_mtrrs(), which writes the last mtrr. It would make more sense to me for var_mtrr_state to be the state of the mtrrs AFTER the function runs, and for the function to be setting up the mtrrs for the resource it was just passed. It would also make the code to automagically figure out if it's better to use additive or subtractive mtrrs marginally simpler to write. Is there any reason for it to work this way, or was it just pulled from kernel source that way?
Also, does anyone know of any CPUs or situations where a subtractive MTRR setup would break things?
Thanks, Corey
On Fri, Apr 3, 2009 at 10:21 PM, Corey Osgood corey.osgood@gmail.comwrote:
Also, does anyone know of any CPUs or situations where a subtractive MTRR setup would break things?
you may not add range for write-combing for some X server... because UC will take first sequence.
YH