Attention is currently required from: Nico Huber, Furquan Shaikh, Patrick Rudolph, Stefan Reinauer, Tim Wawrzynczak, Subrata Banik, Arthur Heymans, Aaron Durbin.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/52522 )
Change subject: cpu/x86/mtrr: Use a Kconfig for reserving MTRRs for OS
......................................................................
Patch Set 6:
(1 comment)
File src/cpu/x86/mtrr/mtrr.c:
https://review.coreboot.org/c/coreboot/+/52522/comment/f5be6371_9427662d
PS6, Line 711: wb_deftype_count > bios_mtrrs && uc_deftype_count > bios_mtrrs
If we keep `bios_mtrrs` around, then we would need the check for CONFIG(RESERVE_MTRRS_FOR_OS) somewh […]
The main reason to do the reordering is to avoid printing "Taking a reserved OS MTRR." when we have run out of MTRRs.
If we decide to drop the `bios_mtrrs` variable, I would introduce an `os_mtrrs` constant for clarity:
if (var_state->mtrr_index >= total_mtrrs) {
printk(BIOS_ERR, "ERROR: Not enough MTRRs available! MTRR index is %d with %d MTRRs in total.\n",
var_state->mtrr_index, total_mtrrs);
return;
}
const int os_mtrrs = CONFIG(RESERVE_MTRRS_FOR_OS) ? 2 : 0;
if (var_state->mtrr_index >= total_mtrrs - os_mtrrs)
printk(BIOS_WARNING, "Taking a reserved OS MTRR.\n");
I would expect that gcc inlines the `os_mtrrs` constant and, if CONFIG_RESERVE_MTRRS_FOR_OS is not set, optimises away the second check.
Note: I have used `int` because it is what the current code uses. If the values are never negative, I would use `unsigned int` instead.
--
To view, visit
https://review.coreboot.org/c/coreboot/+/52522
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I2ae2851248c95fd516627b101ebcb36ec59c29c3
Gerrit-Change-Number: 52522
Gerrit-PatchSet: 6
Gerrit-Owner: Tim Wawrzynczak
twawrzynczak@chromium.org
Gerrit-Reviewer: Aaron Durbin
adurbin@chromium.org
Gerrit-Reviewer: Angel Pons
th3fanbus@gmail.com
Gerrit-Reviewer: Arthur Heymans
arthur@aheymans.xyz
Gerrit-Reviewer: Furquan Shaikh
furquan@google.com
Gerrit-Reviewer: Nico Huber
nico.h@gmx.de
Gerrit-Reviewer: Patrick Rudolph
patrick.rudolph@9elements.com
Gerrit-Reviewer: Patrick Rudolph
siro@das-labor.org
Gerrit-Reviewer: Stefan Reinauer
reinauer@chromium.org
Gerrit-Reviewer: Stefan Reinauer
stefan.reinauer@coreboot.org
Gerrit-Reviewer: Subrata Banik
subrata.banik@intel.com
Gerrit-Reviewer: build bot (Jenkins)
no-reply@coreboot.org
Gerrit-Attention: Nico Huber
nico.h@gmx.de
Gerrit-Attention: Furquan Shaikh
furquan@google.com
Gerrit-Attention: Patrick Rudolph
patrick.rudolph@9elements.com
Gerrit-Attention: Stefan Reinauer
reinauer@chromium.org
Gerrit-Attention: Tim Wawrzynczak
twawrzynczak@chromium.org
Gerrit-Attention: Stefan Reinauer
stefan.reinauer@coreboot.org
Gerrit-Attention: Subrata Banik
subrata.banik@intel.com
Gerrit-Attention: Arthur Heymans
arthur@aheymans.xyz
Gerrit-Attention: Aaron Durbin
adurbin@chromium.org
Gerrit-Attention: Patrick Rudolph
siro@das-labor.org
Gerrit-Comment-Date: Fri, 23 Apr 2021 08:54:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Furquan Shaikh
furquan@google.com
Comment-In-Reply-To: Angel Pons
th3fanbus@gmail.com
Gerrit-MessageType: comment