On 2/20/2024 8:01 AM, Oded Gabbay wrote:> From: Ohad Sharabi
<osharabi@xxxxxxxxx>
>
> Currently, the code contains 2 types of FW version comparison functions:
> - hl_is_fw_sw_ver_[below/equal_or_greater]()
> - gaudi2 specific function of the type
> gaudi2_is_fw_ver_[below/above]x_y_z()
>
> Moreover, some functions use the inner FW version which should be only
> stage during development but not version dependencies.
>
> Finally, some tests are done to deprecated FW version to which LKD
> should hold no compatibility.
>
> This commit aligns all APIs to a single function that just compares the
> version and return an integers indicator (similar in some way to
> strcmp()).
>
> In addition, this generic function now considers also the sub-minor FW
> version and also remove dead code resulting in deprecated FW versions
> compatibility.
>
> Signed-off-by: Ohad Sharabi <osharabi@xxxxxxxxx>
> Reviewed-by: Oded Gabbay <ogabbay@xxxxxxxxxx>
> Signed-off-by: Oded Gabbay <ogabbay@xxxxxxxxxx>
> ---
> drivers/accel/habanalabs/common/firmware_if.c | 25 ++++++++
> drivers/accel/habanalabs/common/habanalabs.h | 20 +------
> drivers/accel/habanalabs/gaudi2/gaudi2.c | 57 +++----------------
> 3 files changed, 34 insertions(+), 68 deletions(-)
>
...
> diff --git a/drivers/accel/habanalabs/gaudi2/gaudi2.c
b/drivers/accel/habanalabs/gaudi2/gaudi2.c
> index 1f061209ae21..4a0917aa4dd7 100644
> --- a/drivers/accel/habanalabs/gaudi2/gaudi2.c
> +++ b/drivers/accel/habanalabs/gaudi2/gaudi2.c
> @@ -2601,6 +2601,8 @@ static int gaudi2_set_fixed_properties(struct
hl_device *hdev)
>
> prop->hbw_flush_reg = mmPCIE_WRAP_SPECIAL_GLBL_SPARE_0;
>
> + prop->supports_advanced_cpucp_rc = true;
> +
> return 0;
>
> free_qprops:
> @@ -3308,8 +3310,6 @@ static int gaudi2_late_init(struct hl_device *hdev)
> struct gaudi2_device *gaudi2 = hdev->asic_specific;
> int rc;
>
> - hdev->asic_prop.supports_advanced_cpucp_rc = true;
> -
> rc = hl_fw_send_pci_access_msg(hdev, CPUCP_PACKET_ENABLE_PCI_ACCESS,
> gaudi2->virt_msix_db_dma_addr);
> if (rc) {
Is this change in support of the others in this patch? Feels like this
should be more than one patch (adding new version_cmp, removing old checks).
-Carl V.