Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/irdma/irdma_hmc.c
/*- | /*- | ||||
* SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB | * SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB | ||||
* | * | ||||
* Copyright (c) 2015 - 2021 Intel Corporation | * Copyright (c) 2015 - 2022 Intel Corporation | ||||
* | * | ||||
* This software is available to you under a choice of one of two | * This software is available to you under a choice of one of two | ||||
* licenses. You may choose to be licensed under the terms of the GNU | * licenses. You may choose to be licensed under the terms of the GNU | ||||
Context not available. | |||||
irdma_set_sd_entry(u64 pa, u32 idx, enum irdma_sd_entry_type type, | irdma_set_sd_entry(u64 pa, u32 idx, enum irdma_sd_entry_type type, | ||||
struct irdma_update_sd_entry *entry) | struct irdma_update_sd_entry *entry) | ||||
{ | { | ||||
entry->data = pa | (IRDMA_HMC_MAX_BP_COUNT << IRDMA_PFHMC_SDDATALOW_PMSDBPCOUNT_S) | | entry->data = pa | | ||||
(((type == IRDMA_SD_TYPE_PAGED) ? 0 : 1) << IRDMA_PFHMC_SDDATALOW_PMSDTYPE_S) | | FIELD_PREP(IRDMA_PFHMC_SDDATALOW_PMSDBPCOUNT, IRDMA_HMC_MAX_BP_COUNT) | | ||||
(1 << IRDMA_PFHMC_SDDATALOW_PMSDVALID_S); | FIELD_PREP(IRDMA_PFHMC_SDDATALOW_PMSDTYPE, | ||||
entry->cmd = (idx | (1 << IRDMA_PFHMC_SDCMD_PMSDWR_S) | (1 << 15)); | type == IRDMA_SD_TYPE_PAGED ? 0 : 1) | | ||||
FIELD_PREP(IRDMA_PFHMC_SDDATALOW_PMSDVALID, 1); | |||||
entry->cmd = idx | FIELD_PREP(IRDMA_PFHMC_SDCMD_PMSDWR, 1) | | |||||
IRDMA_PFHMC_SDCMD_PMSDPARTSEL; | |||||
} | } | ||||
/** | /** | ||||
Context not available. | |||||
irdma_clr_sd_entry(u32 idx, enum irdma_sd_entry_type type, | irdma_clr_sd_entry(u32 idx, enum irdma_sd_entry_type type, | ||||
struct irdma_update_sd_entry *entry) | struct irdma_update_sd_entry *entry) | ||||
{ | { | ||||
entry->data = (IRDMA_HMC_MAX_BP_COUNT << IRDMA_PFHMC_SDDATALOW_PMSDBPCOUNT_S) | | entry->data = FIELD_PREP(IRDMA_PFHMC_SDDATALOW_PMSDBPCOUNT, IRDMA_HMC_MAX_BP_COUNT) | | ||||
(((type == IRDMA_SD_TYPE_PAGED) ? 0 : 1) << IRDMA_PFHMC_SDDATALOW_PMSDTYPE_S); | FIELD_PREP(IRDMA_PFHMC_SDDATALOW_PMSDTYPE, | ||||
entry->cmd = (idx | (1 << IRDMA_PFHMC_SDCMD_PMSDWR_S) | (1 << 15)); | type == IRDMA_SD_TYPE_PAGED ? 0 : 1); | ||||
entry->cmd = idx | FIELD_PREP(IRDMA_PFHMC_SDCMD_PMSDWR, 1) | | |||||
IRDMA_PFHMC_SDCMD_PMSDPARTSEL; | |||||
} | } | ||||
/** | /** | ||||
Context not available. | |||||
irdma_invalidate_pf_hmc_pd(struct irdma_sc_dev *dev, u32 sd_idx, | irdma_invalidate_pf_hmc_pd(struct irdma_sc_dev *dev, u32 sd_idx, | ||||
u32 pd_idx) | u32 pd_idx) | ||||
{ | { | ||||
u32 val = LS_32(sd_idx, IRDMA_PFHMC_PDINV_PMSDIDX) | | u32 val = FIELD_PREP(IRDMA_PFHMC_PDINV_PMSDIDX, sd_idx) | | ||||
LS_32(1, IRDMA_PFHMC_PDINV_PMSDPARTSEL) | | FIELD_PREP(IRDMA_PFHMC_PDINV_PMSDPARTSEL, 1) | | ||||
LS_32(pd_idx, IRDMA_PFHMC_PDINV_PMPDIDX); | FIELD_PREP(IRDMA_PFHMC_PDINV_PMPDIDX, pd_idx); | ||||
writel(val, dev->hw_regs[IRDMA_PFHMC_PDINV]); | writel(val, dev->hw_regs[IRDMA_PFHMC_PDINV]); | ||||
} | } | ||||
Context not available. | |||||
* @setsd: flag to set or clear sd | * @setsd: flag to set or clear sd | ||||
*/ | */ | ||||
int | int | ||||
irdma_hmc_sd_one(struct irdma_sc_dev *dev, u8 hmc_fn_id, u64 pa, u32 sd_idx, | irdma_hmc_sd_one(struct irdma_sc_dev *dev, u16 hmc_fn_id, u64 pa, u32 sd_idx, | ||||
enum irdma_sd_entry_type type, bool setsd) | enum irdma_sd_entry_type type, bool setsd) | ||||
{ | { | ||||
struct irdma_update_sds_info sdinfo; | struct irdma_update_sds_info sdinfo; | ||||
Context not available. | |||||
&sd_entry->u.pd_table.pd_entry_virt_mem; | &sd_entry->u.pd_table.pd_entry_virt_mem; | ||||
vmem->size = sizeof(struct irdma_hmc_pd_entry) * 512; | vmem->size = sizeof(struct irdma_hmc_pd_entry) * 512; | ||||
vmem->va = kzalloc(vmem->size, GFP_ATOMIC); | vmem->va = kzalloc(vmem->size, GFP_KERNEL); | ||||
if (!vmem->va) { | if (!vmem->va) { | ||||
irdma_free_dma_mem(hw, &dma_mem); | irdma_free_dma_mem(hw, &dma_mem); | ||||
return -ENOMEM; | return -ENOMEM; | ||||
Context not available. |