Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4528391ybl; Tue, 20 Aug 2019 13:26:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlmuwXb6+9ckElZgo4prucpMR8UN6L4ZOvi6BZL75ToTk9yhbJJ89fIBk1owBvqoz5+zKf X-Received: by 2002:a63:3dcd:: with SMTP id k196mr26566359pga.45.1566332800474; Tue, 20 Aug 2019 13:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566332800; cv=none; d=google.com; s=arc-20160816; b=lydw0GTkBAyaOCCVvhxpdAXwslXTwk/4LA7EWk2uzMY/FHXcfAzMAf79TcVGMTnCzb 8MLfJqVsJJlK7z/zBSoLw6uwuDaFS0TM9ZQNCJKc1Bi1/bqv8ebeHqyOX+BxZNEvgPev qv59GuLh3gzdW/tzJ7e+slMfd32UHL46UxG1nhfKfeN7l/IYrknAoWQ49KsDFjza7h4r AXM2r//U5Ifu2STi9qPcIYsm+x0n7vJbKUhcexcrnz+9T55rKet7OTws6txZC/Hl16lB kYSlzjo93aQcKMRlRipH1NE31fvq8rS1vgFX5vBtALhkkQY6RBIkokMFsoL6X/9A1vxH 8DLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=na3FREkudwb1VMnaG2ccAswT2v+ZuC8y+xiG8YtQBYY=; b=ZHXB6RURwCzkKzfOdB8KuXaD2QHBZ4s/Yc/re/vSyf520uT2Ntn9zcXjDh5flWtJ0x 6H28iAbXPNivUcvT4ptNlFQqipFwgHpgMz8EbjnM6+2rZZDPBAxD5hNMEjFVlJoi6D7Q hYAtInKFzm8EIGLClyeACPUZbDuaxgaVka9Tfud7V86prWSVDregmq0cQUSDlZG4Ri/B rbpgX193qiZE+nGC0gc7Mu2SILPav/QfXc+S5n3PSxRb9vO4rJsC79g51L7Jj4m3x5iY Ai4mJat9fEn7kV7+R1u3uTBiZ9jNOKl+J1dH4JukObTyOlgSCBKLiUVBgzC7mv2a2uUr TTYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XI1KpQiW; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x13si12807258pgr.210.2019.08.20.13.26.27; Tue, 20 Aug 2019 13:26:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XI1KpQiW; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731161AbfHTUZq (ORCPT + 99 others); Tue, 20 Aug 2019 16:25:46 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43658 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730945AbfHTUYd (ORCPT ); Tue, 20 Aug 2019 16:24:33 -0400 Received: by mail-pf1-f196.google.com with SMTP id v12so4048134pfn.10; Tue, 20 Aug 2019 13:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=na3FREkudwb1VMnaG2ccAswT2v+ZuC8y+xiG8YtQBYY=; b=XI1KpQiWyMhjzJhwmR2SesNXeBqep8k/k21tUnzOhcZPe9IcuO8kdlU7hy1BcUciP3 ZmQs7uuIEG0Bdkffz3BdoaSu3HbfJ6kHdqQxaTVDvJW+o5yUAiMhLa1bg5zkjZo2nKgk XmrTn6ir5F54zPPx1N6Srg7MqwrhMVXpbUX2QxBMlBjO6ActJN9rbe0Ula3Z9y9drcRq C/Au/8bPnUfM+obwYIAPe4zO/XRl22kGXyK/ywv5rNzLNChkduQLHZP9UxnGJ4RX3sbR pi7UON3N3m3Ee74p06s0OyIFNWwCCedKagdIT7RTaLU7qo6HMJKeNvnFTagzdlGF2Zku ZBMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=na3FREkudwb1VMnaG2ccAswT2v+ZuC8y+xiG8YtQBYY=; b=eeP6jTOpl60sWlYCCQO4+rbblFeiAM+qCUwZ7HM3eX/6Y7U1DY0ZFWv29FoeDlVM/W HIPnyJrlpYs6rQMFc3+MVKsJi4NfbBbDV43KkB+Ypsb/Ao3cMrekGlwZo+Y31JcOA1cO 4g2heoeKM1S8RrPQFqYEC1M+bDsy+wKEyNcraWMWThkGjCtZJajPHW9yJsc7ClaHw96o GR22LDl39y9Cx9ce25q7qxAMKU7oHKiOQiqcbm/PQjsvtSe2X15ZpO7I6gwXWgm2ydy2 e8MqRjnwUAazVxQisZ+QUNbOTRF5B07g0Ou5CIvtDPmQv1r6+m7fhKqV+JqNNNrF1zxy 1MCA== X-Gm-Message-State: APjAAAW6ga9usSq6XqHwRqr4aY3lllYA6mL2JosQQcAd578uFmBYSf9O 6vGxeGqmGlSTPWgi6ZhvdVlODoHIx20= X-Received: by 2002:a17:90a:5207:: with SMTP id v7mr1640091pjh.127.1566332672285; Tue, 20 Aug 2019 13:24:32 -0700 (PDT) Received: from localhost.lan (c-67-185-54-80.hsd1.wa.comcast.net. [67.185.54.80]) by smtp.gmail.com with ESMTPSA id k3sm36149846pfg.23.2019.08.20.13.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 13:24:31 -0700 (PDT) From: Andrey Smirnov To: linux-crypto@vger.kernel.org Cc: Andrey Smirnov , Chris Spencer , Cory Tusar , Chris Healy , Lucas Stach , =?UTF-8?q?Horia=20Geant=C4=83?= , Aymen Sghaier , Leonard Crestez , linux-kernel@vger.kernel.org Subject: [PATCH v8 10/16] crypto: caam - move cpu_to_caam_dma() selection to runtime Date: Tue, 20 Aug 2019 13:23:56 -0700 Message-Id: <20190820202402.24951-11-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190820202402.24951-1-andrew.smirnov@gmail.com> References: <20190820202402.24951-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Instead of selecting the implementation of cpu_to_caam_dma()/caam_dma_to_cpu() at build time using the preprocessor, convert the code to do that at run-time using IS_ENABLED macro. This is needed to add support for i.MX8MQ. No functional change intended. Signed-off-by: Andrey Smirnov Cc: Chris Spencer Cc: Cory Tusar Cc: Chris Healy Cc: Lucas Stach Cc: Horia Geantă Cc: Aymen Sghaier Cc: Leonard Crestez Cc: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/crypto/caam/regs.h | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index 489d6c1eec7d..0df4cf32fe78 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -188,13 +188,21 @@ static inline u64 caam_dma64_to_cpu(u64 value) return caam64_to_cpu(value); } -#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT -#define cpu_to_caam_dma(value) cpu_to_caam_dma64(value) -#define caam_dma_to_cpu(value) caam_dma64_to_cpu(value) -#else -#define cpu_to_caam_dma(value) cpu_to_caam32(value) -#define caam_dma_to_cpu(value) caam32_to_cpu(value) -#endif /* CONFIG_ARCH_DMA_ADDR_T_64BIT */ +static inline u64 cpu_to_caam_dma(u64 value) +{ + if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT)) + return cpu_to_caam_dma64(value); + else + return cpu_to_caam32(value); +} + +static inline u64 caam_dma_to_cpu(u64 value) +{ + if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT)) + return caam_dma64_to_cpu(value); + else + return caam32_to_cpu(value); +} /* * jr_outentry -- 2.21.0