Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1116002imm; Wed, 13 Jun 2018 13:40:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKw/a8hOiPT+XYUjS/5EPFwcozw8t7Qf9WQ5BxMkdo0axoaFHrI9EU9cOi36D8lgeA6MXV7 X-Received: by 2002:a17:902:740a:: with SMTP id g10-v6mr6661009pll.246.1528922410481; Wed, 13 Jun 2018 13:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528922410; cv=none; d=google.com; s=arc-20160816; b=UdldFqR8tpqGz5oyThQNaWZyaRGbxHt6OrWqNi/23uqbkLKRpnaA7skTC8wqtYutN2 e/Wkb+C2/Aq8EYhEQPCTz3PnKqgz1ES5voA3OmRSHAjG10jo/3nYF0IdTACE29agxf0J TyVA4y8tZ0mVyjcgqVmmhFiolTGGMB+Uc8nXZc+tdcd7OyH3+koQHrBVQHsPUe88i/b3 nbqidwxNxdNbawTCpQdJ5vWhaGLq5LwiQjbp4xa92IjAx5MWTwpa29ZtpYUfUuqow8kI /r04XsygPngMXSWvGM6YkRfiazPxX2hQe100USqO1N6+GzGugSkgqt43MA+TpsHO6t/o NYag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to :references:in-reply-to:date:subject:cc:to:from :arc-authentication-results; bh=0AgLJNCgWySz+GKg5DC0293Bw1FW8rdJK1Wx38OaEOI=; b=FGVnqL6ICeaNb15VkJFYHQFn19pCrgJ295X3AVr8WoDdOK3Z1wCNlL4VIyQ2hfR+ma mMHHpq18n/MGyqhQdGaFEs+97QFZYdfVqNPndYThtFMdedF5+Md64b/DfTvmE34klHs0 fyTRm2VPkO3Ya1ZIrEWIi0vHxMoMJ1Hu4m3tZv/Xp0vqVjGd2ku3IyRvGwT93yn6FXK/ 60rVcoMe+IyWwIGY4zC6wMe81AjXoQJmNfxCU5/yfCu9sM5aohfvAEXxLkwe262QfS1Q Y7NATdAiI+YzxNZhmbCXC6DeuTOJ0d9is774N0SXEmkn8uoKqzLAHc/Y+y1CZS2nmjIG FFzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q86-v6si3592030pfg.298.2018.06.13.13.39.56; Wed, 13 Jun 2018 13:40:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935810AbeFMUjB (ORCPT + 99 others); Wed, 13 Jun 2018 16:39:01 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52350 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935352AbeFMUi4 (ORCPT ); Wed, 13 Jun 2018 16:38:56 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5DKXxBl064904 for ; Wed, 13 Jun 2018 16:38:56 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0b-001b2d01.pphosted.com with ESMTP id 2jk88xwh74-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 13 Jun 2018 16:38:55 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 13 Jun 2018 16:38:55 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 13 Jun 2018 16:38:52 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5DKcp7w10355354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 13 Jun 2018 20:38:51 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD3E1AC05E; Wed, 13 Jun 2018 16:40:12 -0400 (EDT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CDBDEAC05B; Wed, 13 Jun 2018 16:40:12 -0400 (EDT) Received: from alifm-ThinkPad-T470p.pok.ibm.com (unknown [9.56.58.93]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTPS; Wed, 13 Jun 2018 16:40:12 -0400 (EDT) From: Farhan Ali To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: mst@redhat.com, qemu-devel@nongnu.org, arei.gonglei@huawei.com, longpeng2@huawei.com, pasic@linux.ibm.com, frankja@linux.ibm.com, borntraeger@de.ibm.com, alifm@linux.ibm.com Subject: [PATCH v2 1/2] crypto/virtio-crypto: Read crypto services and algorithm masks Date: Wed, 13 Jun 2018 16:38:48 -0400 X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 x-cbid: 18061320-0064-0000-0000-0000031ACE20 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009185; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01046514; UDB=6.00535975; IPR=6.00825489; MB=3.00021630; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-13 20:38:54 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18061320-0065-0000-0000-00003995C95A Message-Id: <3b302b1a1f1b624713d29dc6b77778ebb31a491b.1528921468.git.alifm@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-13_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806130218 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Read the crypto services and algorithm masks which provides information about the services and algorithms supported by virtio-crypto backend. Signed-off-by: Farhan Ali Acked-by: Gonglei --- drivers/crypto/virtio/virtio_crypto_common.h | 14 ++++++++++++++ drivers/crypto/virtio/virtio_crypto_core.c | 29 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/crypto/virtio/virtio_crypto_common.h b/drivers/crypto/virtio/virtio_crypto_common.h index 66501a5..931a3bd 100644 --- a/drivers/crypto/virtio/virtio_crypto_common.h +++ b/drivers/crypto/virtio/virtio_crypto_common.h @@ -55,6 +55,20 @@ struct virtio_crypto { /* Number of queue currently used by the driver */ u32 curr_queue; + /* + * Specifies the services mask which the device support, + * see VIRTIO_CRYPTO_SERVICE_* + */ + u32 crypto_services; + + /* Detailed algorithms mask */ + u32 cipher_algo_l; + u32 cipher_algo_h; + u32 hash_algo; + u32 mac_algo_l; + u32 mac_algo_h; + u32 aead_algo; + /* Maximum length of cipher key */ u32 max_cipher_key_len; /* Maximum length of authenticated key */ diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c index 8332698..8f745f2 100644 --- a/drivers/crypto/virtio/virtio_crypto_core.c +++ b/drivers/crypto/virtio/virtio_crypto_core.c @@ -303,6 +303,13 @@ static int virtcrypto_probe(struct virtio_device *vdev) u32 max_data_queues = 0, max_cipher_key_len = 0; u32 max_auth_key_len = 0; u64 max_size = 0; + u32 cipher_algo_l = 0; + u32 cipher_algo_h = 0; + u32 hash_algo = 0; + u32 mac_algo_l = 0; + u32 mac_algo_h = 0; + u32 aead_algo = 0; + u32 crypto_services = 0; if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) return -ENODEV; @@ -339,6 +346,20 @@ static int virtcrypto_probe(struct virtio_device *vdev) max_auth_key_len, &max_auth_key_len); virtio_cread(vdev, struct virtio_crypto_config, max_size, &max_size); + virtio_cread(vdev, struct virtio_crypto_config, + crypto_services, &crypto_services); + virtio_cread(vdev, struct virtio_crypto_config, + cipher_algo_l, &cipher_algo_l); + virtio_cread(vdev, struct virtio_crypto_config, + cipher_algo_h, &cipher_algo_h); + virtio_cread(vdev, struct virtio_crypto_config, + hash_algo, &hash_algo); + virtio_cread(vdev, struct virtio_crypto_config, + mac_algo_l, &mac_algo_l); + virtio_cread(vdev, struct virtio_crypto_config, + mac_algo_h, &mac_algo_h); + virtio_cread(vdev, struct virtio_crypto_config, + aead_algo, &aead_algo); /* Add virtio crypto device to global table */ err = virtcrypto_devmgr_add_dev(vcrypto); @@ -358,6 +379,14 @@ static int virtcrypto_probe(struct virtio_device *vdev) vcrypto->max_cipher_key_len = max_cipher_key_len; vcrypto->max_auth_key_len = max_auth_key_len; vcrypto->max_size = max_size; + vcrypto->crypto_services = crypto_services; + vcrypto->cipher_algo_l = cipher_algo_l; + vcrypto->cipher_algo_h = cipher_algo_h; + vcrypto->mac_algo_l = mac_algo_l; + vcrypto->mac_algo_h = mac_algo_h; + vcrypto->hash_algo = hash_algo; + vcrypto->aead_algo = aead_algo; + dev_info(&vdev->dev, "max_queues: %u, max_cipher_key_len: %u, max_auth_key_len: %u, max_size 0x%llx\n", -- 2.7.4