Received: by 2002:a05:6a10:5594:0:0:0:0 with SMTP id ee20csp540459pxb; Mon, 25 Apr 2022 16:01:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOSDIwkZyk8dPqPTDDFipZcamXbOYqEOzSGb8m/3YFU3fsxsgBIpE59sipBRIVL2LrVsYm X-Received: by 2002:a17:903:18f:b0:15a:d3e:1e47 with SMTP id z15-20020a170903018f00b0015a0d3e1e47mr20819324plg.54.1650927692031; Mon, 25 Apr 2022 16:01:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650927692; cv=none; d=google.com; s=arc-20160816; b=t/j4vTmO8AWMeBGAW3b0FNx9hPtGJXE+bsIuDAHwvJDbRksoArSMXOS4aLveQ90Glz +t/jXmVvpdFUIgbODoeWGgNBKjE7cfXNBo1IbWwbM+cstImsP3FMGHzdsFHAiH9gMO2T VtI7/N7p8XeBiOZLPtsf6y5H0iECUqMHOIc7pqL/DmxvO25wYW/DiRTlJ8yLni2OjZxf LgCmB7vD6nZ+e69ii4prEBrB8qxW4rmkqPyJwTd3UqP4zZsnzO1wO+fTi6JnEDNRqRxd 6z9gIkAwUFsZOTm4trnJEEyjqQWhU76F7v0Te9M2OV2lV7zjSS5mHW2OVKBzTFE8tYeR qtmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=AuEsjx7xWt7vjtQJfTCObI5PEP1ZQJh+mLBcUDtY/ZU=; b=TyvPSMpAARVdGDolQgfNUmKbC4zcX5HI3XcCTZmvHAg2lizpDuOcPphyJy5pCZrqOp 5fTLivzCzgbmRuAMnrDd/c92+DAQuleE6YE87lXdxfEFboIcU1ZkHCS6jGaiIXV4KKQi pbCDGX1KaDDJsnDhiq63vnYP9/CvnZSpINhAHD19ZMQpeSzSdrAr/gN+bYH+YZyrRZL9 CWaCnGIk7kQIkAQXmh1Hx+cALBIizn/uDCEzQj/5odUGSOeqII1Nv8HSXmrjKKQa3hBL CkzfA71UX7aYE0lnXsz3p9cIkHW9CIcGNlH0KTEm+ywONMSrrcqliveN0/jt9PRUgvEz jBzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=IA+dM4qC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y15-20020a1709029b8f00b001562e0ba125si16761954plp.504.2022.04.25.16.01.15; Mon, 25 Apr 2022 16:01:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=IA+dM4qC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S242402AbiDYOTe (ORCPT + 99 others); Mon, 25 Apr 2022 10:19:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232603AbiDYOTZ (ORCPT ); Mon, 25 Apr 2022 10:19:25 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E6811EAC5 for ; Mon, 25 Apr 2022 07:16:20 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 23PEGI4d010824; Mon, 25 Apr 2022 09:16:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1650896178; bh=AuEsjx7xWt7vjtQJfTCObI5PEP1ZQJh+mLBcUDtY/ZU=; h=From:To:CC:Subject:Date; b=IA+dM4qCJusLwDfw6jFtvJNmEw0iLTB+VKn4j9QNnD7ItRUVptRqbm6PxKyAkBDAi Hr6zO4fJvqBA7kbA5uVZ++i13NQRv1ocxSorEDolvWP1X5al02KXDVxjYX99ZLUlNN yp9N+8vfz7ywDdq0lbTyZe8M4dc/O9fCeKMpRLjU= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 23PEGIaA108280 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Apr 2022 09:16:18 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 25 Apr 2022 09:16:18 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Mon, 25 Apr 2022 09:16:18 -0500 Received: from ula0226330.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 23PEGH7l023455; Mon, 25 Apr 2022 09:16:18 -0500 From: Andrew Davis To: Jens Wiklander , Sumit Garg , , CC: Andrew Davis Subject: [PATCH v2 1/2] tee: remove tee_shm_va2pa() and tee_shm_pa2va() Date: Mon, 25 Apr 2022 09:16:16 -0500 Message-ID: <20220425141617.23925-1-afd@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We should not need to index into SHMs based on absolute VA/PA. These functions are not used and this kind of usage should not be encouraged anyway. Remove these functions. Signed-off-by: Andrew Davis Reviewed-by: Sumit Garg --- drivers/tee/tee_shm.c | 50 ----------------------------------------- include/linux/tee_drv.h | 18 --------------- 2 files changed, 68 deletions(-) diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c index f31e29e8f1cac..b0c6d553d3a70 100644 --- a/drivers/tee/tee_shm.c +++ b/drivers/tee/tee_shm.c @@ -414,56 +414,6 @@ void tee_shm_free(struct tee_shm *shm) } EXPORT_SYMBOL_GPL(tee_shm_free); -/** - * tee_shm_va2pa() - Get physical address of a virtual address - * @shm: Shared memory handle - * @va: Virtual address to tranlsate - * @pa: Returned physical address - * @returns 0 on success and < 0 on failure - */ -int tee_shm_va2pa(struct tee_shm *shm, void *va, phys_addr_t *pa) -{ - if (!shm->kaddr) - return -EINVAL; - /* Check that we're in the range of the shm */ - if ((char *)va < (char *)shm->kaddr) - return -EINVAL; - if ((char *)va >= ((char *)shm->kaddr + shm->size)) - return -EINVAL; - - return tee_shm_get_pa( - shm, (unsigned long)va - (unsigned long)shm->kaddr, pa); -} -EXPORT_SYMBOL_GPL(tee_shm_va2pa); - -/** - * tee_shm_pa2va() - Get virtual address of a physical address - * @shm: Shared memory handle - * @pa: Physical address to tranlsate - * @va: Returned virtual address - * @returns 0 on success and < 0 on failure - */ -int tee_shm_pa2va(struct tee_shm *shm, phys_addr_t pa, void **va) -{ - if (!shm->kaddr) - return -EINVAL; - /* Check that we're in the range of the shm */ - if (pa < shm->paddr) - return -EINVAL; - if (pa >= (shm->paddr + shm->size)) - return -EINVAL; - - if (va) { - void *v = tee_shm_get_va(shm, pa - shm->paddr); - - if (IS_ERR(v)) - return PTR_ERR(v); - *va = v; - } - return 0; -} -EXPORT_SYMBOL_GPL(tee_shm_pa2va); - /** * tee_shm_get_va() - Get virtual address of a shared memory plus an offset * @shm: Shared memory handle diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h index 911cad324acc7..17eb1c5205d34 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h @@ -298,24 +298,6 @@ void tee_shm_free(struct tee_shm *shm); */ void tee_shm_put(struct tee_shm *shm); -/** - * tee_shm_va2pa() - Get physical address of a virtual address - * @shm: Shared memory handle - * @va: Virtual address to tranlsate - * @pa: Returned physical address - * @returns 0 on success and < 0 on failure - */ -int tee_shm_va2pa(struct tee_shm *shm, void *va, phys_addr_t *pa); - -/** - * tee_shm_pa2va() - Get virtual address of a physical address - * @shm: Shared memory handle - * @pa: Physical address to tranlsate - * @va: Returned virtual address - * @returns 0 on success and < 0 on failure - */ -int tee_shm_pa2va(struct tee_shm *shm, phys_addr_t pa, void **va); - /** * tee_shm_get_va() - Get virtual address of a shared memory plus an offset * @shm: Shared memory handle -- 2.17.1