jonzhang@fb.com has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
mb/ocp/monolake: use RW_VPD to configure FSP UPD
Summary: This patch adds: * A framework to use VPD binary blob 2.0 data to configure FSP UPD. * A library to configure HyperThreading FSP UPD variable.
The framework is added in romstage to customize FSP UPD settings.
If RW_VPD and binary blob are not found, or if there is no "HyperThreading" setting in the binary blob, original configuration is used.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: Id66c3a7a0992037f59685c0c9250f90aefc3f105
Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/Makefile.inc M src/mainboard/ocp/monolake/romstage.c A src/mainboard/ocp/monolake/vpd_fsp.c A src/mainboard/ocp/monolake/vpd_fsp.h 4 files changed, 125 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/1
diff --git a/src/mainboard/ocp/monolake/Makefile.inc b/src/mainboard/ocp/monolake/Makefile.inc index 1606476..ce674e4 100644 --- a/src/mainboard/ocp/monolake/Makefile.inc +++ b/src/mainboard/ocp/monolake/Makefile.inc @@ -13,4 +13,5 @@ ## GNU General Public License for more details. ##
+romstage-y += vpd_fsp.c ramstage-y += irqroute.c diff --git a/src/mainboard/ocp/monolake/romstage.c b/src/mainboard/ocp/monolake/romstage.c index f3ec7e3..4add5f1 100644 --- a/src/mainboard/ocp/monolake/romstage.c +++ b/src/mainboard/ocp/monolake/romstage.c @@ -23,6 +23,9 @@ #include <device/pci_ops.h> #include <soc/pci_devs.h> #include <soc/lpc.h> +#include <fmap.h> + +#include "vpd_fsp.h"
/** * /brief mainboard call for setup that needs to be done before fsp init @@ -57,9 +60,61 @@ 0x0c0ca1); }
+/* + * This function uses a key/value pair to configure UPD. + */ +static int board_configure_upd( + const uint8_t *key, int32_t key_len, + const uint8_t *value, int32_t value_len, + void *UpdData) +{ + set_upd_hyper_threading(key, key_len, value, value_len, UpdData); + + return VPD_OK; +} + /** - * /brief customize fsp parameters here if needed + * /brief customize fsp parameters, use data stored in VPD binary blob + * to configure FSP UPD variables. */ void romstage_fsp_rt_buffer_callback(FSP_INIT_RT_BUFFER *FspRtBuffer) { + struct region_device rdev; + void *rw_vpd_addr = NULL; + size_t rw_vpd_size = -1; + int32_t consumed; + UPD_DATA_REGION *UpdData = FspRtBuffer->Common.UpdDataRgnPtr; + + /* + * If RW_VPD VPD partition exists, search key/value pairs + * to see if there are relevant FSP UPD variable setting(s). + * If so, use such setting(s) to customize FSP behavior. + */ + if (CONFIG(VPD)) { + if (!fmap_locate_area_as_rdev("RW_VPD", &rdev)) { + rdev_chain(&rdev, &rdev, GOOGLE_VPD_2_0_OFFSET, + region_device_sz(&rdev) - GOOGLE_VPD_2_0_OFFSET); + rw_vpd_addr = rdev_mmap_full(&rdev); + if (rw_vpd_addr != NULL) { + rw_vpd_size = region_device_sz(&rdev); + /* Skip the VPD info header */ + rw_vpd_addr += sizeof(struct google_vpd_info); + rw_vpd_size -= sizeof(struct google_vpd_info); + /* + * decodeVpdString() is called iteratively to process + * key/value pairs in RW_VPD iteratively. In such + * processing, callback function board_configure_upd() + * is called to process a pair and update FSP UPD + * variable. + */ + for (consumed = 0; consumed < rw_vpd_size; ) { + if (decodeVpdString(rw_vpd_size, rw_vpd_addr, &consumed, + board_configure_upd, (void *)UpdData) == VPD_FAIL) + break; + } + printk(FSP_INFO_LEVEL, + "Found and Processed VPD binary blob in RW_VPD.\n"); + } + } + }; } diff --git a/src/mainboard/ocp/monolake/vpd_fsp.c b/src/mainboard/ocp/monolake/vpd_fsp.c new file mode 100644 index 0000000..ee5c9ca --- /dev/null +++ b/src/mainboard/ocp/monolake/vpd_fsp.c @@ -0,0 +1,33 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 The coreboot Authors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * This file is part of the coreboot project. + */ +#include <string.h> +#include <drivers/vpd/vpd_fsp.h> +#include "vpd_fsp.h" + +/* + * For "HyperThreading" UPD variable, given a key/value + * pair, use the value to set the variable if there is match. + */ +void set_upd_hyper_threading(const uint8_t *key, + const int32_t key_len, const uint8_t *value, const int32_t value_len, + UPD_DATA_REGION *UpdData) +{ + uint8_t val; + if (set_upd_bool(FSP_VAR_HYPERTHREADING, key, key_len, value, + value_len, &val) == true) { + UpdData->HyperThreading = val; + } +} diff --git a/src/mainboard/ocp/monolake/vpd_fsp.h b/src/mainboard/ocp/monolake/vpd_fsp.h new file mode 100644 index 0000000..1e0965a --- /dev/null +++ b/src/mainboard/ocp/monolake/vpd_fsp.h @@ -0,0 +1,35 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 The coreboot Authors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __MB_OCP_MONOLAKE_VPD_FSP__ +#define __MB_OCP_MONOLAKE_VPD_FSP__ + +#include <drivers/vpd/lib_vpd.h> +#include <drivers/vpd/vpd_fsp.h> +#include <drivers/vpd/vpd_tables.h> +#include <inttypes.h> +#include <fsp.h> + +/* Define the strings for UPD variables that could be customized */ +#define FSP_VAR_HYPERTHREADING "HyperThreading" + +/* + * For "HyperThreading" UPD variable, given a key/value + * pair, use the value to set the variable if there is match. + */ +void set_upd_hyper_threading(const uint8_t *key, + const int32_t key_len, const uint8_t *value, const int32_t value_len, + UPD_DATA_REGION *UpdData); +#endif /* __MB_OCP_MONOLAKE_VPD_FSP__ */
Hello Patrick Rudolph, Philipp Deppenwiese, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#2).
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
mb/ocp/monolake: use RW_VPD to configure FSP UPD
Summary: This patch adds: * A framework to use VPD binary blob 2.0 data to configure FSP UPD. * A library to configure HyperThreading FSP UPD variable.
The framework is added in romstage to customize FSP UPD settings.
If RW_VPD and binary blob are not found, or if there is no "HyperThreading" setting in the binary blob, original configuration is used.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/Makefile.inc M src/mainboard/ocp/monolake/romstage.c A src/mainboard/ocp/monolake/vpd_fsp.c A src/mainboard/ocp/monolake/vpd_fsp.h 4 files changed, 126 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/2
jonzhang@fb.com has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
Patch Set 2:
Sorry for the spam, I accidentally changed the change-id.
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#3).
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
mb/ocp/monolake: use RW_VPD to configure FSP UPD
Summary: This patch adds: * A framework to use VPD binary blob 2.0 data to configure FSP UPD. * A library to configure HyperThreading FSP UPD variable.
The framework is added in romstage to customize FSP UPD settings.
If RW_VPD and binary blob are not found, or if there is no "HyperThreading" setting in the binary blob, original configuration is used.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/Makefile.inc M src/mainboard/ocp/monolake/romstage.c A src/mainboard/ocp/monolake/vpd_fsp.c A src/mainboard/ocp/monolake/vpd_fsp.h 4 files changed, 126 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/3
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#4).
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
mb/ocp/monolake: use RW_VPD to configure FSP UPD
Summary: This patch adds: * A framework to use VPD binary blob 2.0 data to configure FSP UPD. * A library to configure HyperThreading FSP UPD variable.
The framework is added in romstage to customize FSP UPD settings.
If RW_VPD and binary blob are not found, or if there is no "HyperThreading" setting in the binary blob, original configuration is used.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/Makefile.inc M src/mainboard/ocp/monolake/romstage.c A src/mainboard/ocp/monolake/vpd_fsp.c A src/mainboard/ocp/monolake/vpd_fsp.h 4 files changed, 126 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/4
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#5).
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
mb/ocp/monolake: use RW_VPD to configure FSP UPD
Summary: This patch adds: * A framework to use VPD binary blob 2.0 data to configure FSP UPD. * A library to configure HyperThreading FSP UPD variable.
The framework is added in romstage to customize FSP UPD settings.
If RW_VPD and binary blob are not found, or if there is no "HyperThreading" setting in the binary blob, original configuration is used.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/Makefile.inc M src/mainboard/ocp/monolake/romstage.c A src/mainboard/ocp/monolake/vpd_fsp.c A src/mainboard/ocp/monolake/vpd_fsp.h 4 files changed, 126 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/5
David Hendricks has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
Patch Set 5: Code-Review+1
(1 comment)
https://review.coreboot.org/c/coreboot/+/34636/5/src/mainboard/ocp/monolake/... File src/mainboard/ocp/monolake/vpd_fsp.h:
https://review.coreboot.org/c/coreboot/+/34636/5/src/mainboard/ocp/monolake/... PS5, Line 4: Copyright (C) 2019 The coreboot Authors. : * : * This program is free software; you can redistribute it and/or modify : * it under the terms of the GNU General Public License as published by : * the Free Software Foundation; version 2 of the License. : * : * This program is distributed in the hope that it will be useful, : * but WITHOUT ANY WARRANTY; without even the implied warranty of : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the : * GNU General Public License for more details. Copyright should be: "Copyright (c) Facebook, Inc. and its affiliates
This software may be used and distributed according to the terms of the GNU General Public License version 2."
Note that this will soon be obsolete, as coreboot will eventually move toward using an AUTHORS file: https://civs.cs.cornell.edu/cgi-bin/results.pl?id=E_9e4f5ea789b9ceb9
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#7).
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
mb/ocp/monolake: use RW_VPD to configure FSP UPD
Summary: This patch adds: * A framework to use VPD binary blob 2.0 data to configure FSP UPD. * A library to configure HyperThreading FSP UPD variable.
The framework is added in romstage to customize FSP UPD settings.
If RW_VPD and binary blob are not found, or if there is no "HyperThreading" setting in the binary blob, original configuration is used.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/Makefile.inc M src/mainboard/ocp/monolake/romstage.c A src/mainboard/ocp/monolake/vpd_fsp.c A src/mainboard/ocp/monolake/vpd_fsp.h 4 files changed, 114 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/7
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#8).
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
mb/ocp/monolake: use RW_VPD to configure FSP UPD
Summary: This patch adds: * A framework to use VPD binary blob 2.0 data to configure FSP UPD. * A library to configure HyperThreading FSP UPD variable.
The framework is added in romstage to customize FSP UPD settings.
If RW_VPD and binary blob are not found, or if there is no "HyperThreading" setting in the binary blob, original configuration is used.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/Makefile.inc M src/mainboard/ocp/monolake/romstage.c A src/mainboard/ocp/monolake/vpd_fsp.c A src/mainboard/ocp/monolake/vpd_fsp.h 4 files changed, 118 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/8
jonzhang@fb.com has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
Patch Set 8:
(1 comment)
Patch Set 5: Code-Review+1
(1 comment)
https://review.coreboot.org/c/coreboot/+/34636/5/src/mainboard/ocp/monolake/... File src/mainboard/ocp/monolake/vpd_fsp.h:
https://review.coreboot.org/c/coreboot/+/34636/5/src/mainboard/ocp/monolake/... PS5, Line 4: Copyright (C) 2019 The coreboot Authors. : * : * This program is free software; you can redistribute it and/or modify : * it under the terms of the GNU General Public License as published by : * the Free Software Foundation; version 2 of the License. : * : * This program is distributed in the hope that it will be useful, : * but WITHOUT ANY WARRANTY; without even the implied warranty of : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the : * GNU General Public License for more details.
Copyright should be: […]
Done
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#9).
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
mb/ocp/monolake: use RW_VPD to configure FSP UPD
Summary: This patch adds: * A framework to use VPD binary blob 2.0 data to configure FSP UPD. * A library to configure HyperThreading FSP UPD variable.
The framework is added in romstage to customize FSP UPD settings.
If RW_VPD and binary blob are not found, or if there is no "HyperThreading" setting in the binary blob, original configuration is used.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/Makefile.inc M src/mainboard/ocp/monolake/romstage.c A src/mainboard/ocp/monolake/vpd_fsp.c A src/mainboard/ocp/monolake/vpd_fsp.h 4 files changed, 88 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/9
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#10).
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
mb/ocp/monolake: use RW_VPD to configure FSP UPD
Summary: This patch adds: * A framework to use VPD binary blob 2.0 data to configure FSP UPD. * A library to configure HyperThreading FSP UPD variable.
The framework is added in romstage to customize FSP UPD settings.
If RW_VPD and binary blob are not found, or if there is no "HyperThreading" setting in the binary blob, original configuration is used.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/Makefile.inc M src/mainboard/ocp/monolake/romstage.c A src/mainboard/ocp/monolake/vpd_fsp.c A src/mainboard/ocp/monolake/vpd_fsp.h 4 files changed, 88 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/10
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#13).
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
mb/ocp/monolake: use RW_VPD to configure FSP UPD
Summary: This patch adds: * A framework to use VPD binary blob 2.0 data to configure FSP UPD. * A library to configure HyperThreading FSP UPD variable.
The framework is added in romstage to customize FSP UPD settings.
If RW_VPD and binary blob are not found, or if there is no "HyperThreading" setting in the binary blob, original configuration is used.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/Makefile.inc M src/mainboard/ocp/monolake/romstage.c A src/mainboard/ocp/monolake/vpd_fsp.c A src/mainboard/ocp/monolake/vpd_fsp.h 4 files changed, 92 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/13
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
Patch Set 13:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... File src/mainboard/ocp/monolake/romstage.c:
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... PS13, Line 78: void *rw_vpd_addr = NULL; : size_t rw_vpd_size = -1; : UPD_DATA_REGION *UpdData = FspRtBuffer->Common.UpdDataRgnPtr; : : /* : * If RW_VPD VPD partition exists, search key/value pairs : * to see if there are relevant FSP UPD variable setting(s). : * If so, use such setting(s) to customize FSP behavior. : */ : if (CONFIG(VPD)) { : rw_vpd_size = get_vpd_size("RW_VPD", rw_vpd_addr); : if (rw_vpd_size == 0) : return; : : board_configure_upd(rw_vpd_addr, rw_vpd_size, UpdData); : printk(FSP_INFO_LEVEL, : "Found and Processed VPD binary blob in RW_VPD.\n"); : } I feel there's too much overhead here. Why not just put everything in romstage file with just 2 functions? (this is also why I think we should simplify the VPD APIs just like how CBMEM version works today):
bool vpd_get_bool(const char *name, vpd_region, bool default);
static void board_configure_upd() { UPD_DATA_REGION *UpdData = FspRtBuffer->Common.UpdDataRgnPtr; if (vpd_get_bool(FSP_VAR_HYPERTHREADING, VPD_RW, False) UpdData->HyperThreading = val; }
...
if (CONFIG(VPD)) board_configure_upd();
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
Patch Set 13:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34636/13//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/34636/13//COMMIT_MSG@9 PS13, Line 9: Summary: : This patch adds: : * A framework to use VPD binary blob 2.0 data to configure : FSP UPD. : * A library to configure HyperThreading FSP UPD variable. : these should be removed
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
Patch Set 13:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... File src/mainboard/ocp/monolake/vpd_fsp.h:
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... PS13, Line 20: HyperThreading FYI in Chrome OS we usually prefer to name VPD values in lower_case_with_underline. But since this is a board-specific thing, I'm OK if you want to use CamelCase.
Jonathan Zhang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use RW_VPD to configure FSP UPD ......................................................................
Patch Set 13:
(3 comments)
https://review.coreboot.org/c/coreboot/+/34636/13//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/34636/13//COMMIT_MSG@9 PS13, Line 9: Summary: : This patch adds: : * A framework to use VPD binary blob 2.0 data to configure : FSP UPD. : * A library to configure HyperThreading FSP UPD variable. :
these should be removed
Ack
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... File src/mainboard/ocp/monolake/romstage.c:
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... PS13, Line 78: void *rw_vpd_addr = NULL; : size_t rw_vpd_size = -1; : UPD_DATA_REGION *UpdData = FspRtBuffer->Common.UpdDataRgnPtr; : : /* : * If RW_VPD VPD partition exists, search key/value pairs : * to see if there are relevant FSP UPD variable setting(s). : * If so, use such setting(s) to customize FSP behavior. : */ : if (CONFIG(VPD)) { : rw_vpd_size = get_vpd_size("RW_VPD", rw_vpd_addr); : if (rw_vpd_size == 0) : return; : : board_configure_upd(rw_vpd_addr, rw_vpd_size, UpdData); : printk(FSP_INFO_LEVEL, : "Found and Processed VPD binary blob in RW_VPD.\n"); : }
I feel there's too much overhead here. […]
This patchset adds a framework and an example to use the framework. More UPD processing are expected to be added in future. The thinking is: * functions such as vpd_get_bool() are provided by vpd driver. * functions such as set_upd_hyper_threading() are provided by SOC/FSP layer. * board chooses what UPD variables can be customized for the board, in board_configure_upd(). Today there is only one board (monolake), and thus this patchset does not touch SOC/FSP layer, but it can be done in future.
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... File src/mainboard/ocp/monolake/vpd_fsp.h:
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... PS13, Line 20: HyperThreading
FYI in Chrome OS we usually prefer to name VPD values in lower_case_with_underline. […]
In FSP UPD variable definition, CamelCase is used. The VPD key/value pairs are added by ODM engineers (before shipping) and by board owner (at run time). For the sake of avoiding confusion, it is preferred to keep the exact string with CamelCase if any as the VPD key name.
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#14).
Change subject: mb/ocp/monolake: use VPD data to configure FSP UPD ......................................................................
mb/ocp/monolake: use VPD data to configure FSP UPD
Summary: This patch calls monolake board specific function to query settings stored in VPD binary blob to configure FSP UPD variable HyperThreading.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/romstage.c 1 file changed, 25 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/14
David Hendricks has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use VPD data to configure FSP UPD ......................................................................
Patch Set 15: Code-Review+1
I'm not a fan of CamelCase, but since we are throwing FSP variables into the mix it makes sense here.
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use VPD data to configure FSP UPD ......................................................................
Patch Set 15:
(1 comment)
https://review.coreboot.org/c/coreboot/+/34636/15/src/mainboard/ocp/monolake... File src/mainboard/ocp/monolake/romstage.c:
https://review.coreboot.org/c/coreboot/+/34636/15/src/mainboard/ocp/monolake... PS15, Line 75: == true no need to write '== true' here since you're bool by itself.
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#16).
Change subject: mb/ocp/monolake: use VPD data to configure FSP UPD ......................................................................
mb/ocp/monolake: use VPD data to configure FSP UPD
Summary: This patch calls monolake board specific function to query settings stored in VPD binary blob to configure FSP UPD variable HyperThreading.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/romstage.c 1 file changed, 25 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/16
Jonathan Zhang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use VPD data to configure FSP UPD ......................................................................
Patch Set 16:
(6 comments)
https://review.coreboot.org/c/coreboot/+/34636/13//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/34636/13//COMMIT_MSG@9 PS13, Line 9: Summary: : This patch adds: : * A framework to use VPD binary blob 2.0 data to configure : FSP UPD. : * A library to configure HyperThreading FSP UPD variable. :
Ack
Done
https://review.coreboot.org/c/coreboot/+/34636/1/src/mainboard/ocp/monolake/... File src/mainboard/ocp/monolake/romstage.c:
https://review.coreboot.org/c/coreboot/+/34636/1/src/mainboard/ocp/monolake/... PS1, Line 112: board_configure_upd, (void *)UpdData) == VPD_FAIL)
line over 96 characters
Done
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... File src/mainboard/ocp/monolake/romstage.c:
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... PS13, Line 78: void *rw_vpd_addr = NULL; : size_t rw_vpd_size = -1; : UPD_DATA_REGION *UpdData = FspRtBuffer->Common.UpdDataRgnPtr; : : /* : * If RW_VPD VPD partition exists, search key/value pairs : * to see if there are relevant FSP UPD variable setting(s). : * If so, use such setting(s) to customize FSP behavior. : */ : if (CONFIG(VPD)) { : rw_vpd_size = get_vpd_size("RW_VPD", rw_vpd_addr); : if (rw_vpd_size == 0) : return; : : board_configure_upd(rw_vpd_addr, rw_vpd_size, UpdData); : printk(FSP_INFO_LEVEL, : "Found and Processed VPD binary blob in RW_VPD.\n"); : }
This patchset adds a framework and an example to use the framework. […]
Done
https://review.coreboot.org/c/coreboot/+/34636/15/src/mainboard/ocp/monolake... File src/mainboard/ocp/monolake/romstage.c:
https://review.coreboot.org/c/coreboot/+/34636/15/src/mainboard/ocp/monolake... PS15, Line 75: == true
no need to write '== true' here since you're bool by itself.
Done
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... File src/mainboard/ocp/monolake/vpd_fsp.h:
https://review.coreboot.org/c/coreboot/+/34636/13/src/mainboard/ocp/monolake... PS13, Line 20: HyperThreading
In FSP UPD variable definition, CamelCase is used. […]
Done
https://review.coreboot.org/c/coreboot/+/34636/5/src/mainboard/ocp/monolake/... File src/mainboard/ocp/monolake/vpd_fsp.h:
https://review.coreboot.org/c/coreboot/+/34636/5/src/mainboard/ocp/monolake/... PS5, Line 4: Copyright (C) 2019 The coreboot Authors. : * : * This program is free software; you can redistribute it and/or modify : * it under the terms of the GNU General Public License as published by : * the Free Software Foundation; version 2 of the License. : * : * This program is distributed in the hope that it will be useful, : * but WITHOUT ANY WARRANTY; without even the implied warranty of : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the : * GNU General Public License for more details.
Done
Done
Hello Andrey Petrov, Łukasz Siudut, Patrick Rudolph, Paul Menzel, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Huang Jin, David Hendricks, Philipp Deppenwiese, Nico Huber, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/34636
to look at the new patch set (#17).
Change subject: mb/ocp/monolake: use VPD data to configure FSP UPD ......................................................................
mb/ocp/monolake: use VPD data to configure FSP UPD
Summary: This patch calls monolake board specific function to query settings stored in VPD binary blob to configure FSP UPD variable HyperThreading.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 --- M src/mainboard/ocp/monolake/romstage.c 1 file changed, 22 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/34636/17
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use VPD data to configure FSP UPD ......................................................................
Patch Set 20: Code-Review+2
Please remember to turn on VPD option for your board if haven't.
Jonathan Zhang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use VPD data to configure FSP UPD ......................................................................
Patch Set 20:
Patch Set 20: Code-Review+2
Please remember to turn on VPD option for your board if haven't.
Yes, VPD option is turned on monolake.
Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/34636 )
Change subject: mb/ocp/monolake: use VPD data to configure FSP UPD ......................................................................
mb/ocp/monolake: use VPD data to configure FSP UPD
Summary: This patch calls monolake board specific function to query settings stored in VPD binary blob to configure FSP UPD variable HyperThreading.
Test Plan: * Build an OCP MonoLake coreboot image, run following command to initialize RW_VPD and insert HyperThreading key: vpd -f build/coreboot.rom -O -i RW_VPD -s 'HyperThreading=0' * Flash the image to MonoLake, boot and observe following message in boot log: Detected 16 CPU threads
If RW_VPD partition does not exist, or if HyperThreading key/value pair does not exist, the boot log has: Detected 32 CPU threads
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I799d27734fe4b67cd1f40cae710151a01562b1b2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/34636 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Hung-Te Lin hungte@chromium.org --- M src/mainboard/ocp/monolake/romstage.c 1 file changed, 22 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Hung-Te Lin: Looks good to me, approved
diff --git a/src/mainboard/ocp/monolake/romstage.c b/src/mainboard/ocp/monolake/romstage.c index f3ec7e3..8625868 100644 --- a/src/mainboard/ocp/monolake/romstage.c +++ b/src/mainboard/ocp/monolake/romstage.c @@ -17,6 +17,7 @@ #include <stddef.h> #include <soc/romstage.h> #include <drivers/intel/fsp1_0/fsp_util.h> +#include <drivers/vpd/vpd.h> #include <cpu/x86/msr.h> #include <cf9_reset.h> #include <console/console.h> @@ -24,6 +25,9 @@ #include <soc/pci_devs.h> #include <soc/lpc.h>
+/* Define the strings for UPD variables that could be customized */ +#define FSP_VAR_HYPERTHREADING "HyperThreading" + /** * /brief mainboard call for setup that needs to be done before fsp init * @@ -57,9 +61,26 @@ 0x0c0ca1); }
+/* + * This function sets up global variable to store VPD binary blob info, + * and use settings in the binary blob to configure UPD. + */ +static void board_configure_upd(UPD_DATA_REGION *UpdData) +{ + u8 val; + + if (vpd_get_bool(FSP_VAR_HYPERTHREADING, VPD_RW, &val)) + UpdData->HyperThreading = val; +} + /** - * /brief customize fsp parameters here if needed + * /brief customize fsp parameters, use data stored in VPD binary blob + * to configure FSP UPD variables. */ void romstage_fsp_rt_buffer_callback(FSP_INIT_RT_BUFFER *FspRtBuffer) { + UPD_DATA_REGION *UpdData = FspRtBuffer->Common.UpdDataRgnPtr; + + if (CONFIG(VPD)) + board_configure_upd(UpdData); }