Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3477605ybl; Tue, 21 Jan 2020 01:18:08 -0800 (PST) X-Google-Smtp-Source: APXvYqzmz201c50tfmgUTgS8Ze3wkXqDGsYXsQ4NBPuQuiXmPhHYinxWOyrmGV/uM0juqk5PbY9+ X-Received: by 2002:a54:468b:: with SMTP id k11mr2145348oic.134.1579598287884; Tue, 21 Jan 2020 01:18:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579598287; cv=none; d=google.com; s=arc-20160816; b=U32abP/ug4Y/vvo0qVFZeWdHnVnQyYfD92eeBmCTaa2psn0BvImZk5irEM1VcQONDL C6A4qCwA2NZ4N1IaTW1+cn12vymPoC1KrBr99xRP6oPu5/lhNvTi0Li1ZJ6MpoQroDJR TJgWN4U8gTzhFUAhXi7NZPRJsrtjH2G0SlIdAtTP6HmLJVeO8nbcqDLmxEddo4W+N0tX uWlJAnlans+b992JPsDZTnLwm7dtgg76CYnVUuPH6VYkxuyJTS26KfVkQWxqqnlcgOyz qEezFwu50Jgrq26Yq4MkQ+hJkFrbikr7KpvROG3m2htg/8jHBKmoODNcEtwvPi8Ln6sx oecg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dkim-signature; bh=11V/WRJMhVLt/Jk+BSNeFSL8z5NFiwJOOmighuL7pHo=; b=l0EFIY5TTsHjqoHUfW2BqNnLZjgi32bYJBL09hhg9yT3+xOKTiH1sRRUCuHFUgyk2v 1hTKQgf8N4WBb1IRg+d4mB/EqvBK5k+cHj+Sb9mZ8aMEXRxcmcTfXKlCkGmNvCAhU0y3 QpeH0FMt0F4oEBF5J5ErPSty5gJy1AH2dp5Q/IhPqSMlbnxhveUijGCU5hCboxZ98+y/ dJrDQYuKMtgg9PvnCb8pPECAVaL7PRDb4aj50V9S8TYu45sVju3ha6luD91GPECdiy+x DtNFaPc9Kcm3+JVfl46jVWIspXUp+BSw1E4QAtgneVuYdb8r4b1MRaLrda1F/CfW/cEN kIkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@seznam.cz header.s=beta header.b=dx2NQ4G4; 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=NONE dis=NONE) header.from=seznam.cz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b145si19348487oii.67.2020.01.21.01.17.55; Tue, 21 Jan 2020 01:18:07 -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 (test mode) header.i=@seznam.cz header.s=beta header.b=dx2NQ4G4; 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=NONE dis=NONE) header.from=seznam.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727360AbgAUJRy (ORCPT + 99 others); Tue, 21 Jan 2020 04:17:54 -0500 Received: from mxs2.seznam.cz ([77.75.76.125]:52620 "EHLO mxs2.seznam.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728093AbgAUJRy (ORCPT ); Tue, 21 Jan 2020 04:17:54 -0500 X-Greylist: delayed 351 seconds by postgrey-1.27 at vger.kernel.org; Tue, 21 Jan 2020 04:17:52 EST Received: from email.seznam.cz by email-smtpc10b.ng.seznam.cz (email-smtpc10b.ng.seznam.cz [10.23.14.45]) id 665b938ad300f29866527659; Tue, 21 Jan 2020 10:17:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seznam.cz; s=beta; t=1579598270; bh=11V/WRJMhVLt/Jk+BSNeFSL8z5NFiwJOOmighuL7pHo=; h=Received:Reply-To:Subject:To:Cc:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding; b=dx2NQ4G44JTU0iiXzopo/YxfzBHAGrd70V6Zuo3EfCmKeucfbe+vX3mdWVit+Nk8N RGodWqhotLrhzc+BosTcn9bSOTeayGybrnuu30V4q56SH+t1wvht0OGdJseyONHHXQ CRA3HPg24j1STMQs6GkuuCAUYjrB0slPB+/06s9g= Received: from [77.75.76.48] (unknown-62-130.xilinx.com [149.199.62.130]) by email-relay3.ng.seznam.cz (Seznam SMTPD 1.3.108) with ESMTP; Tue, 21 Jan 2020 10:15:56 +0100 (CET) Reply-To: monstr@monstr.eu Subject: Re: [PATCH V4 3/4] firmware: xilinx: Add ZynqMP aes API for AES functionality To: Kalyani Akula , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: git , Harsh Jain , Sarat Chand Savitala , Mohan , Kalyani Akul References: <1574235842-7930-1-git-send-email-kalyani.akula@xilinx.com> <1574235842-7930-4-git-send-email-kalyani.akula@xilinx.com> From: Michal Simek Message-ID: <3357664b-d502-ca0c-c166-679001de5f39@seznam.cz> Date: Tue, 21 Jan 2020 10:15:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <1574235842-7930-4-git-send-email-kalyani.akula@xilinx.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 20. 11. 19 8:44, Kalyani Akula wrote: > Add ZynqMP firmware AES API to perform encryption/decryption of given data. > > Signed-off-by: Kalyani Akula > --- > drivers/firmware/xilinx/zynqmp.c | 23 +++++++++++++++++++++++ > include/linux/firmware/xlnx-zynqmp.h | 2 ++ > 2 files changed, 25 insertions(+) > > diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c > index fd3d837..7ddf38e 100644 > --- a/drivers/firmware/xilinx/zynqmp.c > +++ b/drivers/firmware/xilinx/zynqmp.c > @@ -664,6 +664,28 @@ static int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities, > qos, ack, NULL); > } > > +/** > + * zynqmp_pm_aes - Access AES hardware to encrypt/decrypt the data using > + * AES-GCM core. > + * @address: Address of the AesParams structure. > + * @out: Returned output value > + * > + * Return: Returns status, either success or error code. > + */ > +static int zynqmp_pm_aes_engine(const u64 address, u32 *out) > +{ > + u32 ret_payload[PAYLOAD_ARG_CNT]; > + int ret; > + > + if (!out) > + return -EINVAL; > + > + ret = zynqmp_pm_invoke_fn(PM_SECURE_AES, upper_32_bits(address), > + lower_32_bits(address), > + 0, 0, ret_payload); > + *out = ret_payload[1]; newline here please. > + return ret; > +} newline here please. > static const struct zynqmp_eemi_ops eemi_ops = { > .get_api_version = zynqmp_pm_get_api_version, > .get_chipid = zynqmp_pm_get_chipid, > @@ -687,6 +709,7 @@ static int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities, > .set_requirement = zynqmp_pm_set_requirement, > .fpga_load = zynqmp_pm_fpga_load, > .fpga_get_status = zynqmp_pm_fpga_get_status, > + .aes = zynqmp_pm_aes_engine, > }; > > /** > diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h > index 778abbb..508edd7 100644 > --- a/include/linux/firmware/xlnx-zynqmp.h > +++ b/include/linux/firmware/xlnx-zynqmp.h > @@ -77,6 +77,7 @@ enum pm_api_id { > PM_CLOCK_GETRATE, > PM_CLOCK_SETPARENT, > PM_CLOCK_GETPARENT, > + PM_SECURE_AES = 47, > }; > > /* PMU-FW return status codes */ > @@ -294,6 +295,7 @@ struct zynqmp_eemi_ops { > const u32 capabilities, > const u32 qos, > const enum zynqmp_pm_request_ack ack); > + int (*aes)(const u64 address, u32 *out); > }; > > int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1, > Thanks, Michal