mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
Anti-Rollback (ARB) is a QAT GEN6 hardware feature that prevents loading firmware with a Security Version Number (SVN) lower than an authorized minimum. This protects against downgrade attacks by ensuring that only firmware at or above a committed SVN can run on the acceleration device. During firmware loading, the driver checks the SVN validation status via a hardware CSR. If the check reports a failure, firmware authentication is aborted. If it reports a retry status, the driver reissues the authentication command up to a maximum number of retries. Extend the firmware admin interface with two new messages, ICP_QAT_FW_SVN_READ and ICP_QAT_FW_SVN_COMMIT, to query and commit the SVN, respectively. Integrate the SVN check into the firmware authentication path in qat_uclo.c so the driver can react to anti-rollback status during device bring-up. Expose SVN information to userspace via a new sysfs attribute group, qat_svn, under the PCI device directory. The group provides read-only attributes for the active, enforced minimum, and permanent minimum SVN values, as well as a write-only commit attribute that allows a system administrator to commit the currently active SVN as the new authorized minimum. This is based on earlier work by Ciunas Bennett. Signed-off-by: Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
38 lines
915 B
C
38 lines
915 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/* Copyright(c) 2026 Intel Corporation */
|
|
#ifndef ADF_ANTI_RB_H_
|
|
#define ADF_ANTI_RB_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
#define GET_ANTI_RB_DATA(accel_dev) (&(accel_dev)->hw_device->anti_rb_data)
|
|
|
|
#define ADF_SVN_NO_STS 0x00
|
|
#define ADF_SVN_PASS_STS 0x01
|
|
#define ADF_SVN_RETRY_STS 0x02
|
|
#define ADF_SVN_FAIL_STS 0x03
|
|
#define ADF_SVN_RETRY_MS 250
|
|
#define ADF_SVN_STS_MASK GENMASK(7, 0)
|
|
|
|
enum anti_rb {
|
|
ARB_ENFORCED_MIN_SVN,
|
|
ARB_PERMANENT_MIN_SVN,
|
|
ARB_ACTIVE_SVN,
|
|
};
|
|
|
|
struct adf_accel_dev;
|
|
struct pci_dev;
|
|
|
|
struct adf_anti_rb_hw_data {
|
|
bool (*anti_rb_enabled)(struct adf_accel_dev *accel_dev);
|
|
u32 svncheck_offset;
|
|
u32 svncheck_retry;
|
|
bool sysfs_added;
|
|
};
|
|
|
|
int adf_anti_rb_commit(struct adf_accel_dev *accel_dev);
|
|
int adf_anti_rb_query(struct adf_accel_dev *accel_dev, enum anti_rb cmd, u8 *svn);
|
|
int adf_anti_rb_check(struct pci_dev *pdev);
|
|
|
|
#endif /* ADF_ANTI_RB_H_ */
|