From patchwork Tue Feb 27 13:30:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 129784 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp280284edc; Tue, 27 Feb 2018 05:31:09 -0800 (PST) X-Google-Smtp-Source: AH8x225Mkmg6Z8xJ/IvuEucT0mQhVx+oytfTnQIBfLzTu+c8uK/Nvg50vdREXUZSZk6dhShesENp X-Received: by 10.98.156.16 with SMTP id f16mr14245569pfe.180.1519738268991; Tue, 27 Feb 2018 05:31:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519738268; cv=none; d=google.com; s=arc-20160816; b=pPCGnW+AnhoEr0SVJk1/EqhrIQcbimd7QkRng8yB1KbjWuVa9NXl08REKvDy/IoKRR BAiPFrdd4fiyze1g7oKbtsjys9skp7aZOKTV1ybR1cxnm9GP/2rxwGERWUhd/zwcPrjS jCB8YbT1gKck4TPWgQQ83CqxpS6U/0dSrWsW5Q2Zvmie2LMQaQA0vycylOCCUO0dq5uK K5xWAR31FEi8eO06jAicu4IuYEpHP6aCvOcPSWudMjo0XI8sJjNmcKWjRfjnjI2vyB27 2gs7gbPYCe/BjyVeNHhqjmwUpI35WEP6OZtbj90rSNR8/qQomOU3bK2KhOKm42eBJYha BXqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=N4FUIsejYUZ19DudHxF+cGAWolsoI6jj5zVIdeD5MXk=; b=EQhczYMVrRDZt2La+/La8bwtxHBIkhABVzAw3UJcU9CTHGpClKe8qeTjc+kIECqO08 4ZMO07kkdp2SUZj8oP/khZSFvELFZxEHIh/HHj1qxGuK7fnoChEeC2yWHUtuk4rGRQC3 1lt+93QJA72iKrm9oAd+iomCqfMJzuHLILPb87FvJdPiOgYLKBoRX8dkROtxtnx6cZDM csTXJqZ4o484doVCTzX5vYK7y+U3po57bE2vStkyBIuhZh/JQjDXWZ+0DfQGJYfjlRO8 EsVL0EGFytIseSxkSxw+dfjG+x1QHfpf7zifv0NbMLLFUGAF/ULpbI6Ad9evPwMiTj79 hMfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cniAPeGW; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si5585201plf.98.2018.02.27.05.31.08; Tue, 27 Feb 2018 05:31:08 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=cniAPeGW; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753361AbeB0NbD (ORCPT + 1 other); Tue, 27 Feb 2018 08:31:03 -0500 Received: from lelnx193.ext.ti.com ([198.47.27.77]:27555 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753210AbeB0NbB (ORCPT ); Tue, 27 Feb 2018 08:31:01 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1RDUv1i019514; Tue, 27 Feb 2018 07:30:57 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519738257; bh=J4egHFPx0FjrmR8RHYH9JqjdgwqKrh0DCn6cEhJ9DhI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cniAPeGWNnSTAkYLLOunhvb7o7AyWPH2x5eqi6tvhiNb9TJ4ceO2BdauhfOsLfMaU dNyTWjxW+Py/u96qQZ+Npa2EqiCquHUbxL0Q/LXNOdLq3bNUW2po0cH/0oRjhjQZ6j bapVGMu2yTIPXJBUjs9YUmf3UR69qdpj89OAdmpg= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1RDUvp9020181; Tue, 27 Feb 2018 07:30:57 -0600 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Tue, 27 Feb 2018 07:30:56 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Tue, 27 Feb 2018 07:30:56 -0600 Received: from gomoku.home (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1RDUoJ2022412; Tue, 27 Feb 2018 07:30:55 -0600 From: Tero Kristo To: , , , CC: Subject: [PATCH 2/6] crypto: omap-crypto: Verify page zone scatterlists before starting DMA Date: Tue, 27 Feb 2018 15:30:35 +0200 Message-ID: <1519738239-28616-3-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519738239-28616-1-git-send-email-t-kristo@ti.com> References: <1519738239-28616-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org In certain platforms like DRA7xx having memory > 2GB with LPAE enabled has a constraint that DMA can be done with the initial 2GB and marks it as ZONE_DMA. But openssl when used with cryptodev does not make sure that input buffer is DMA capable. So, adding a check to verify if the input buffer is capable of DMA. Signed-off-by: Tero Kristo --- drivers/crypto/omap-crypto.c | 4 ++++ 1 file changed, 4 insertions(+) -- 1.9.1 -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/crypto/omap-crypto.c b/drivers/crypto/omap-crypto.c index 23e3777..2c42e4b 100644 --- a/drivers/crypto/omap-crypto.c +++ b/drivers/crypto/omap-crypto.c @@ -104,6 +104,10 @@ static int omap_crypto_check_sg(struct scatterlist *sg, int total, int bs, return OMAP_CRYPTO_NOT_ALIGNED; if (!IS_ALIGNED(sg->length, bs)) return OMAP_CRYPTO_NOT_ALIGNED; +#ifdef CONFIG_ZONE_DMA + if (page_zonenum(sg_page(sg)) != ZONE_DMA) + return OMAP_CRYPTO_NOT_ALIGNED; +#endif len += sg->length; sg = sg_next(sg);