Reserve the external PQC Root of Trust capability ID in the shared libie
capability list and parse its value into the device capabilities.

Firmware reports 1 when an external Root of Trust (eRoT) controller is
present and 0 when it is not. Keep a separate bit for an explicit value
other than 0 or 1, so the flash path can reject an unknown answer
instead of reading it as absence: an image the eRoT turns down leaves an
erased flash bank behind, so guessing is worse than not flashing. Set
both bits with |=, so a duplicated capability entry cannot undo a verdict
already taken from an earlier one: an invalid value always rejects the
update, and a mix of 0 and 1 keeps the eRoT checks enabled.

Signed-off-by: Aleksandr Loktionov <[email protected]>
---
 drivers/net/ethernet/intel/ice/ice_common.c | 7 +++++++
 drivers/net/ethernet/intel/ice/ice_type.h   | 3 +++
 include/linux/net/intel/libie/adminq.h      | 1 +
 3 files changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_common.c 
b/drivers/net/ethernet/intel/ice/ice_common.c
index 81187214..cc387c6 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -2482,6 +2482,13 @@ ice_parse_common_caps(struct ice_hw *hw, struct 
ice_hw_common_caps *caps,
        case LIBIE_AQC_CAPS_TX_SCHED_TOPO_COMP_MODE:
                caps->tx_sched_topo_comp_mode_en = (number == 1);
                break;
+       case LIBIE_AQC_CAPS_EXTERNAL_PQC_ROT_PRESENT:
+               /* sticky, so a duplicated entry cannot clear an earlier 
verdict */
+               caps->external_pqc_rot_present |= (number == 1);
+               caps->external_pqc_rot_invalid |= (number != 0 && number != 1);
+               ice_debug(hw, ICE_DBG_INIT, "%s: external_pqc_rot = %u\n",
+                         prefix, number);
+               break;
        default:
                /* Not one of the recognized common capabilities */
                found = false;
diff --git a/drivers/net/ethernet/intel/ice/ice_type.h 
b/drivers/net/ethernet/intel/ice/ice_type.h
index 4b6ed42..1ff69f7 100644
--- a/drivers/net/ethernet/intel/ice/ice_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_type.h
@@ -311,6 +311,9 @@ struct ice_hw_common_caps {
        /* Post update reset restriction */
        bool reset_restrict_support;
        bool tx_sched_topo_comp_mode_en;
+       /* External Root of Trust (eRoT) controller present */
+       bool external_pqc_rot_present;
+       bool external_pqc_rot_invalid;
 };
 
 /* IEEE 1588 TIME_SYNC specific info */
diff --git a/include/linux/net/intel/libie/adminq.h 
b/include/linux/net/intel/libie/adminq.h
index 839114d..df42f5b 100644
--- a/include/linux/net/intel/libie/adminq.h
+++ b/include/linux/net/intel/libie/adminq.h
@@ -175,6 +175,7 @@ LIBIE_CHECK_STRUCT_LEN(16, libie_aqc_list_caps);
 #define LIBIE_AQC_CAPS_PENDING_OROM_VER                        0x004B
 #define LIBIE_AQC_CAPS_NET_VER                         0x004C
 #define LIBIE_AQC_CAPS_PENDING_NET_VER                 0x004D
+#define LIBIE_AQC_CAPS_EXTERNAL_PQC_ROT_PRESENT                0x004E
 #define LIBIE_AQC_CAPS_RDMA                            0x0051
 #define LIBIE_AQC_CAPS_LED                             0x0061
 #define LIBIE_AQC_CAPS_SDP                             0x0062
-- 
2.56.0

Reply via email to