Skip to content

Commit

Permalink
HSD#15015508123: firmware: stratix10-svc: add address offset for RECO…
Browse files Browse the repository at this point in the history
…NFIG_DATA_SUBMIT smc command

Add dma addr offset iova for agilex5 sent to SDM to satisfy address
range checking in ATF.

Signed-off-by: Adrian Ng Ho Yin <adrian.ho.yin.ng@intel.com>
  • Loading branch information
hoyin0722 committed Mar 21, 2024
1 parent 26a6443 commit 2f1e504
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/firmware/stratix10-svc.c
Expand Up @@ -51,6 +51,7 @@
#define FPGA_CONFIG_POLL_INTERVAL_MS_SLOW 500
#define FPGA_CONFIG_POLL_COUNT_FAST 50
#define FPGA_CONFIG_POLL_COUNT_SLOW 58
#define AGILEX5_SDM_DMA_ADDR_OFFSET 0x80000000
#define BYTE_TO_WORD_SIZE 4
#define IOMMU_LIMIT_ADDR 0x20000000
#define IOMMU_STARTING_ADDR 0x0
Expand Down Expand Up @@ -168,6 +169,7 @@ struct stratix10_svc_controller {
struct mutex *sdm_lock;
struct iommu_domain *domain;
bool is_smmu_enabled;
dma_addr_t sdm_dma_addr_offset;
struct {
struct iova_domain domain;
unsigned long shift;
Expand Down Expand Up @@ -1664,6 +1666,8 @@ int stratix10_svc_send(struct stratix10_svc_chan *chan, void *msg)
if (p_mem->vaddr == p_msg->payload) {
p_data->paddr = p_mem->paddr;
p_data->size = p_msg->payload_length;
if(p_msg->command == COMMAND_RECONFIG_DATA_SUBMIT && chan->ctrl->is_smmu_enabled)
p_data->paddr += chan->ctrl->sdm_dma_addr_offset;
}
if (p_msg->payload_output) {
list_for_each_entry(p_mem, &svc_data_mem, node)
Expand Down Expand Up @@ -1903,11 +1907,13 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
controller->chans = chans;
controller->genpool = genpool;
controller->invoke_fn = invoke_fn;
controller->sdm_dma_addr_offset = 0x0;
init_completion(&controller->complete_status);

if (of_device_is_compatible(node, "intel,agilex5-svc")) {
if (iommu_present(&platform_bus_type)) {
controller->is_smmu_enabled = true;
controller->sdm_dma_addr_offset = AGILEX5_SDM_DMA_ADDR_OFFSET;
pr_debug("Intel Service Layer Driver: IOMMU Present\n");
controller->domain = iommu_get_dma_domain(dev);

Expand Down

0 comments on commit 2f1e504

Please sign in to comment.