Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ CONFIG_INTEL_MODULES=y
CONFIG_LIBRARY_MANAGER=y
CONFIG_INTEL_ADSP_TIMER=y
CONFIG_MM_DRV_INTEL_ADSP_TLB_REMAP_UNUSED_RAM=y
CONFIG_AMS=y

CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_L3_HEAP=y
Expand Down
1 change: 1 addition & 0 deletions app/boards/intel_adsp_cavs25.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ CONFIG_INTEL_DMIC=y
CONFIG_COMP_CHAIN_DMA=y
CONFIG_DMIC_HW_IOCLK=38400000
CONFIG_INTEL_SSP=y
CONFIG_AMS=y
CONFIG_INTEL_ALH=y
CONFIG_LP_MEMORY_BANKS=1
CONFIG_HP_MEMORY_BANKS=30
Expand Down
22 changes: 22 additions & 0 deletions src/arch/host/lib/ams.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2023 Intel Corporation. All rights reserved.
//
// Author: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>

/**
* \file
* \brief Xtensa Asynchronous Messaging Service implementation file
* \authors Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
*/

#include <sof/lib/cpu.h>
#include <sof/lib/ams.h>
#include <xtos-structs.h>

static struct async_message_service *host_ams;

struct async_message_service **arch_ams_get(void)
{
return &host_ams;
}
4 changes: 4 additions & 0 deletions src/arch/xtensa/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

add_local_sources(sof notifier.c)

if (CONFIG_AMS)
add_local_sources(sof ams.c)
endif()

if (CONFIG_MULTICORE)
add_local_sources(sof cpu.c)
endif()
26 changes: 26 additions & 0 deletions src/arch/xtensa/lib/ams.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2023 Intel Corporation. All rights reserved.
//
// Author: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>

/**
* \file
* \brief Xtensa Asynchronous Messaging Service implementation file
* \authors Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
*/

#include <sof/lib/cpu.h>
#include <sof/lib/ams.h>
#include <xtos-structs.h>

struct async_message_service **arch_ams_get(void)
{
#if CONFIG_AMS
struct core_context *ctx = (struct core_context *)cpu_read_threadptr();

return &ctx->ams;
#else
return NULL;
#endif
}
3 changes: 3 additions & 0 deletions src/arch/xtensa/xtos/xtos-structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ struct core_context {
struct task *main_task;
struct schedulers *schedulers;
struct notify *notify;
#ifdef CONFIG_AMS
struct async_message_service *ams;
#endif
struct idc *idc;
};

Expand Down
13 changes: 13 additions & 0 deletions src/idc/idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <ipc/topology.h>
#include <errno.h>
#include <stdint.h>
#include <sof/lib/ams.h>

LOG_MODULE_REGISTER(idc, CONFIG_SOF_LOG_LEVEL);

Expand Down Expand Up @@ -274,6 +275,15 @@ static void idc_prepare_d0ix(void)
platform_pm_runtime_prepare_d0ix_en(cpu_get_id());
}

static void idc_process_async_msg(uint32_t slot)
{
#if CONFIG_AMS
process_incoming_message(slot);
#else
tr_err(&idc_tr, "idc_cmd(): AMS not enabled");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be a one-time log, this could swamp the logs with repeated 'AMS not enabled"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, this should not happen when ams is used correctly. If only ams interface functions are used without CONFIG_AMS, than this will never be called. Nevertheless such case should be reported when looking at idc layer separately.

#endif
}

/**
* \brief Handle IDC secondary core crashed message.
* \param[in] header IDC message header
Expand Down Expand Up @@ -335,6 +345,9 @@ void idc_cmd(struct idc_msg *msg)
case iTS(IDC_MSG_SECONDARY_CORE_CRASHED):
idc_secondary_core_crashed(msg->header);
break;
case iTS(IDC_MSG_AMS):
idc_process_async_msg(IDC_HEADER_TO_AMS_SLOT_MASK(msg->header));
break;
default:
tr_err(&idc_tr, "idc_cmd(): invalid msg->header = %u",
msg->header);
Expand Down
Loading