firmware: bpmp-tegra186-hv: Enable build for Linux 6.2

The build of bpmp-tegra186-hv was disabled due to change
in core kernel to move the Tegra BPMP IVC to IOSYS-MAP
framework by commit 4c1e0a97351a5e ("firmware: tegra:
bpmp: Use iosys-map helpers") in Linux 6.1.

Bug 4346767

Change-Id: I704ef454192613ade8e97f708e997fa74a186b7b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031778
(cherry picked from commit 1fc6fc17f2)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3038670
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-11 05:36:46 +00:00
committed by mobile promotions
parent f7d42ed1c4
commit 2fc926c8fe
2 changed files with 43 additions and 6 deletions

View File

@@ -1,16 +1,14 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Makefile for Extended IVC Driver and BPMP driver
#
obj-m += ivc_ext.o
ifneq ($(CONFIG_TEGRA_IVC_LEGACY_DISABLE),y)
tegra_bpmp-y += ../../clk/tegra/clk-bpmp.o
tegra_bpmp-y += ../../reset/tegra/reset-bpmp.o
tegra_bpmp-y += ../../soc/tegra/powergate-bpmp.o
tegra_bpmp-$(CONFIG_DEBUG_FS) += bpmp-debugfs.o
tegra_bpmp-y += bpmp-tegra186-hv.o
obj-m += tegra_bpmp.o
endif
obj-m += tegra_bpmp.o

View File

@@ -1,8 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
@@ -82,7 +84,11 @@ static void tegra_bpmp_handle_mrq(struct tegra_bpmp *bpmp,
static void tegra_bpmp_channel_signal(struct tegra_bpmp_channel *channel)
{
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
unsigned long flags = tegra_bpmp_mb_read_field(&channel->ob, flags);
#else
unsigned long flags = channel->ob->flags;
#endif
if ((flags & MSG_RING) == 0)
return;
@@ -116,8 +122,15 @@ void tegra_bpmp_handle_rx(struct tegra_bpmp *bpmp)
/* If supported incoming channel */
if (bpmp->soc->channels.cpu_rx.count == MAX_POSSIBLE_RX_CHANNEL) {
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
if (tegra_bpmp_is_request_ready(channel)) {
unsigned int mrq = tegra_bpmp_mb_read_field(&channel->ib, code);
tegra_bpmp_handle_mrq(bpmp, mrq, channel);
}
#else
if (tegra_bpmp_is_request_ready(channel))
tegra_bpmp_handle_mrq(bpmp, channel->ib->code, channel);
#endif
}
spin_lock(&bpmp->lock);
@@ -198,12 +211,20 @@ static bool tegra186_bpmp_hv_is_message_ready(struct tegra_bpmp_channel *channel
void *frame;
frame = tegra_hv_ivc_read_get_next_frame(hv_ivc);
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
if (IS_ERR(frame)) {
iosys_map_clear(&channel->ib);
return false;
}
iosys_map_set_vaddr(&channel->ib, frame);
#else
if (IS_ERR(frame)) {
channel->ib = NULL;
return false;
}
channel->ib = frame;
#endif
return true;
}
@@ -221,12 +242,20 @@ static bool tegra186_hv_bpmp_is_channel_free(struct tegra_bpmp_channel *channel)
void *frame;
frame = tegra_hv_ivc_write_get_next_frame(hv_ivc);
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
if (IS_ERR(frame)) {
iosys_map_clear(&channel->ob);
return false;
}
iosys_map_set_vaddr(&channel->ob, frame);
#else
if (IS_ERR(frame)) {
channel->ob = NULL;
return false;
}
channel->ob = frame;
#endif
return true;
}
@@ -432,13 +461,23 @@ static void tegra_bpmp_mrq_handle_ping(unsigned int mrq,
struct tegra_bpmp_channel *channel,
void *data)
{
struct mrq_ping_request *request;
struct mrq_ping_response response;
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
struct mrq_ping_request request;
tegra_bpmp_mb_read(&request, &channel->ib, sizeof(request));
memset(&response, 0, sizeof(response));
response.reply = request.challenge << 1;
#else
struct mrq_ping_request *request;
request = (struct mrq_ping_request *)channel->ib->data;
memset(&response, 0, sizeof(response));
response.reply = request->challenge << 1;
#endif
tegra_bpmp_mrq_return(channel, 0, &response, sizeof(response));
}