Skip to content

Commit

Permalink
crypto: qat - adf_get_etr_base() helper
Browse files Browse the repository at this point in the history
Add and use the new helper function adf_get_etr_base() which retrieves
the virtual address of the ring bar.

This will be used extensively when adding support for Live Migration.

Signed-off-by: Giovanni Cabiddu <[email protected]>
Signed-off-by: Xin Zeng <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
gcabiddu authored and herbertx committed Apr 2, 2024
1 parent 174fdc9 commit 1894cb1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 10 additions & 0 deletions drivers/crypto/intel/qat/qat_common/adf_common_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ static inline void __iomem *adf_get_pmisc_base(struct adf_accel_dev *accel_dev)
return pmisc->virt_addr;
}

static inline void __iomem *adf_get_etr_base(struct adf_accel_dev *accel_dev)
{
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
struct adf_bar *etr;

etr = &GET_BARS(accel_dev)[hw_data->get_etr_bar_id(hw_data)];

return etr->virt_addr;
}

static inline void __iomem *adf_get_aram_base(struct adf_accel_dev *accel_dev)
{
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
Expand Down
4 changes: 1 addition & 3 deletions drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ static int reset_ring_pair(void __iomem *csr, u32 bank_number)
int adf_gen4_ring_pair_reset(struct adf_accel_dev *accel_dev, u32 bank_number)
{
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
u32 etr_bar_id = hw_data->get_etr_bar_id(hw_data);
void __iomem *csr;
void __iomem *csr = adf_get_etr_base(accel_dev);
int ret;

if (bank_number >= hw_data->num_banks)
Expand All @@ -331,7 +330,6 @@ int adf_gen4_ring_pair_reset(struct adf_accel_dev *accel_dev, u32 bank_number)
dev_dbg(&GET_DEV(accel_dev),
"ring pair reset for bank:%d\n", bank_number);

csr = (&GET_BARS(accel_dev)[etr_bar_id])->virt_addr;
ret = reset_ring_pair(csr, bank_number);
if (ret)
dev_err(&GET_DEV(accel_dev),
Expand Down
4 changes: 1 addition & 3 deletions drivers/crypto/intel/qat/qat_common/adf_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ static int adf_init_bank(struct adf_accel_dev *accel_dev,
int adf_init_etr_data(struct adf_accel_dev *accel_dev)
{
struct adf_etr_data *etr_data;
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
void __iomem *csr_addr;
u32 size;
u32 num_banks = 0;
Expand All @@ -495,8 +494,7 @@ int adf_init_etr_data(struct adf_accel_dev *accel_dev)
}

accel_dev->transport = etr_data;
i = hw_data->get_etr_bar_id(hw_data);
csr_addr = accel_dev->accel_pci_dev.pci_bars[i].virt_addr;
csr_addr = adf_get_etr_base(accel_dev);

/* accel_dev->debugfs_dir should always be non-NULL here */
etr_data->debug = debugfs_create_dir("transport",
Expand Down

0 comments on commit 1894cb1

Please sign in to comment.