Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2448005rdb; Wed, 21 Feb 2024 08:01:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWXRbcefbkHvvln6eWoFwy3M397PnXarsWE8hpvenfcjGDPogaBcVd+UssVQt+yplaW//88xbfise2r66omykRNMsDZU8wwZMqCLWyVsA== X-Google-Smtp-Source: AGHT+IEpapO5MtZszpzZMBd/VY9a4A90FXKttGYSZrapWMTpgpI3lQIdBtRg3pfIX3WNqIdvn8pO X-Received: by 2002:a17:90a:fa11:b0:299:5d2c:9aa2 with SMTP id cm17-20020a17090afa1100b002995d2c9aa2mr9866890pjb.9.1708531262997; Wed, 21 Feb 2024 08:01:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708531262; cv=pass; d=google.com; s=arc-20160816; b=XK/apPU7l7HdNPM9omQ19gQEw0yGu7hj42VJxJVLRYhG3RB/UHqFOtW6rnHQhksORZ /KU50SVQE3QlF8W0CGvjxlgEJiWeoMamsDbTBvX6Fd/AqJSlGu4rbq5ArRv8o7guGB/q B2UPxMa5Dy+Wyn6ReXaDLA1ZMDO1XRNI4ldRS0l9JkLL0S09GMfW5cpw9w87GZGtz3PP PCEwui1k8+U5FNCP+N00NBaGfe6IS8UwOmPwHe3WoJHTqYfeXKcShwecnOodrBZojWFv kn+1GS0/QNU/Pj6GL2BdtSIIQ2sH+YZ4jnNo3ycCX7895SCDCGtyWvxOe5iOJ+JweMtQ /9jg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=vvK/iuat8u6ewYsAKqEWz3RfteYST0Tm2MBLGFw/QL8=; fh=ZPROJzuhd/Qq40NWmBKtN+BxE47hO5e9Z0KZWRZnOPo=; b=jDU5+M3uEXEOV+F7LW1mpO2HE1OyPeC/fqEy2bTo0+JN2bjuVhdYxhLptbG7tE+5Zw yri4f0JIc2ThlNBSRlRleWrVjl4jvSmCW2o+64bW1MqRYv9r2Hg/E9F5qCjJvMnk01jR ttDdEBxTSePHyxDgIo7GVBZM2vCz3EFPt8lTBw5+S+bJCOUPg5XFSRpKQkk9EtH7tHW1 dkQOn7KtDIguEl54lNIq9EA44Ir0nI9SL/k/a/NybMydUNbi03odV3aqqqj2BNi1BIcS qJdQklpvclYuG2gm++FZTv/F18tPWW7U5cUQsNxdQQ6+s9FZwvrbV0f14n27VHtwnPrW zOnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hClAXwO6; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-crypto+bounces-2220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id il17-20020a17090b165100b00298ff25a532si8472676pjb.63.2024.02.21.08.01.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 08:01:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hClAXwO6; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-crypto+bounces-2220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 594A4283E59 for ; Wed, 21 Feb 2024 16:01:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7CEF82D63; Wed, 21 Feb 2024 15:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hClAXwO6" X-Original-To: linux-crypto@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAA2381730; Wed, 21 Feb 2024 15:58:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708531141; cv=none; b=LuDgu+5zanVuld+Ag1um/xamwWRMu/qqWpQVvzCFQm2VqEzAG/FOqXV7agcE0ePRvI/URAPhWb3V9ZHf9JQUOfgYObifLOp54lkmC+JJq8OGLSe3x15gJYnsr1oi/NNsk2ti6pNVc50Uiw8Rx5i5mQJowzVERUCAgzVm0JIF8/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708531141; c=relaxed/simple; bh=1fwiIQI3dQ8ibBmhmYK31NfhCwSYTtk6PsHOviUYBZs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=AEgRb13y1kHpneUUjc3GoCGqsO6YBBASt4UnAkkXF4GN4imrkMwGLYfOzqwY/6P5bsiLbcJ6HB78HEoDF8xE3ADvntk9I0CLcVXq1+Pgm48cG1AX+JtakicEio1BmH6Ts1h12stUsIH5oKF2WRqp7z4B1zDFRXzioMBFTaQeiDY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hClAXwO6; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708531140; x=1740067140; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=1fwiIQI3dQ8ibBmhmYK31NfhCwSYTtk6PsHOviUYBZs=; b=hClAXwO6OUX9BycTmvj05NdYwM5+pb+r9j3W41ynV2SBg8eRi6BnsHYF kRjZRvwUI2L3ZIurLnyTzKFreb4sniev6/fiEBShwDnQCjjn9UkKLawWh qXrJzSaD1QPGz155aCzSPZvB/SzC/y25Yu0gAyyTf1x0B6kqRav06DkJU bhwAVyJv759K12PDYHxugdEgCDnzitDeaO0RF3qFQ52z566B86YzHWM8G MROCIgHBYsye0TaAIoMmD8CNeLEDAVsg8WOkNT3uh4eM3cz/r0GslV8GJ DcRSLD52l0uPRdU0Ima8ooa46qIG+ye6ZOx77Q1rN/nkgOiN3qEqNDXoP A==; X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="2568696" X-IronPort-AV: E=Sophos;i="6.06,175,1705392000"; d="scan'208";a="2568696" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2024 07:58:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,175,1705392000"; d="scan'208";a="9760802" Received: from qat-server-archercity1.sh.intel.com ([10.67.111.115]) by fmviesa004.fm.intel.com with ESMTP; 21 Feb 2024 07:58:44 -0800 From: Xin Zeng To: herbert@gondor.apana.org.au, alex.williamson@redhat.com, jgg@nvidia.com, yishaih@nvidia.com, shameerali.kolothum.thodi@huawei.com, kevin.tian@intel.com Cc: linux-crypto@vger.kernel.org, kvm@vger.kernel.org, qat-linux@intel.com, Giovanni Cabiddu , Xin Zeng Subject: [PATCH v3 01/10] crypto: qat - adf_get_etr_base() helper Date: Wed, 21 Feb 2024 23:49:59 +0800 Message-Id: <20240221155008.960369-2-xin.zeng@intel.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20240221155008.960369-1-xin.zeng@intel.com> References: <20240221155008.960369-1-xin.zeng@intel.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Giovanni Cabiddu 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 Reviewed-by: Xin Zeng Signed-off-by: Xin Zeng --- drivers/crypto/intel/qat/qat_common/adf_common_drv.h | 10 ++++++++++ drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c | 4 +--- drivers/crypto/intel/qat/qat_common/adf_transport.c | 4 +--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/intel/qat/qat_common/adf_common_drv.h b/drivers/crypto/intel/qat/qat_common/adf_common_drv.h index 57328249c89e..3bec9e20bad0 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_common_drv.h +++ b/drivers/crypto/intel/qat/qat_common/adf_common_drv.h @@ -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; diff --git a/drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c b/drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c index d28e1921940a..b8a6d24f791f 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c +++ b/drivers/crypto/intel/qat/qat_common/adf_gen4_hw_data.c @@ -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) @@ -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), diff --git a/drivers/crypto/intel/qat/qat_common/adf_transport.c b/drivers/crypto/intel/qat/qat_common/adf_transport.c index 630d0483c4e0..1efdf46490f1 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_transport.c +++ b/drivers/crypto/intel/qat/qat_common/adf_transport.c @@ -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; @@ -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", -- 2.18.2