Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp332019pxb; Wed, 14 Apr 2021 17:01:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyG071g4fvwZSU6UIX7WhiVWsRQIIvAuhY0ew5rTk0cpt8dwILY++EXXl0hYWqrfTg2MoOz X-Received: by 2002:a17:906:cc9b:: with SMTP id oq27mr598065ejb.81.1618444900509; Wed, 14 Apr 2021 17:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618444900; cv=none; d=google.com; s=arc-20160816; b=hT/TY6TfcH47R9wWieq3K8ApUufzzC6x4ns1VTobAJYlAzc+CzCPDwwcbPsco7zQxx cXpyuzCw3617gH1hTkskDAY/LjueSqP0jvHJjwtfAimgb6jrakvonjN3Z1V+Nu1Xe+8R RY+1qM38Q3X+RyLzIK3V8PNVTxC8H9swb8xpvcMveX1s3YtXtiaWNgBQFIIOMcKU+aO0 z/Jj4LMT9K2wrJqa7al9NT1FMOo3SjT/SAUkZ5by7LCKypgZNnzJBHnAKUXb2g+QTSF2 mqd9yEKRQsOQicWKofTABubi5gDcmLGPy9z56REhJFfqC5ADtZZec8DdN3xMeEhpvWvP aWkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=cRUqwrx3CzAgFx8cjiVlT9uXBRMOksMCWegEaWG1iHE=; b=MKQdmAm+t8zOhpHrIzpsiebYedqcjsu2cDPJ8Dz2+VvZyEQCvGFeyny+NjxpRS0cuD vWFt14jkGJtOYdIKpO3TB2bhAMO45fVHDH/moTKK7uSVD+4QTR0o9H20zNE3Y3mBbXCv dzaCiUIRmBPbPjUGbBFckdrQW1KhClB4mQIhg4+aqNDC2szxic3Rcl/N7KWHFf6zHjLU uvBiQwlyIGHqShcJIqvnoa4Uw5J8SY2Fp8mlfiyB+SA+4V00o4F+5Y6qkfu7q4MzwImR Ht4XXNNRZx6f9E6u9Z4EZB+NptokV+QuN5bbbuZP8H1qsJ0soaq1A4aEAfQcfUiyiM0F AFuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt40si704819ejc.577.2021.04.14.17.01.15; Wed, 14 Apr 2021 17:01:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350528AbhDNL0s (ORCPT + 99 others); Wed, 14 Apr 2021 07:26:48 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:16913 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349021AbhDNLZw (ORCPT ); Wed, 14 Apr 2021 07:25:52 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FL0Tj4nTczkjyc; Wed, 14 Apr 2021 19:23:37 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.47.82.32) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Wed, 14 Apr 2021 19:25:20 +0800 From: Shameer Kolothum To: , , CC: , , , , , , , , Subject: [PATCH v4 14/16] arm64/lib: Add an helper to free memory allocated by the ASID allocator Date: Wed, 14 Apr 2021 12:23:10 +0100 Message-ID: <20210414112312.13704-15-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20210414112312.13704-1-shameerali.kolothum.thodi@huawei.com> References: <20210414112312.13704-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.47.82.32] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julien Grall Some users of the ASID allocator (e.g VMID) may need to free any resources if the initialization fail. So introduce a function that allows freeing of any memory allocated by the ASID allocator. Signed-off-by: Julien Grall Signed-off-by: Shameer Kolothum --- arch/arm64/include/asm/lib_asid.h | 2 ++ arch/arm64/lib/asid.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/arch/arm64/include/asm/lib_asid.h b/arch/arm64/include/asm/lib_asid.h index acae8d243d17..4dbc0a3f19a6 100644 --- a/arch/arm64/include/asm/lib_asid.h +++ b/arch/arm64/include/asm/lib_asid.h @@ -82,4 +82,6 @@ void asid_context_pinned_put(struct asid_info *info, atomic64_t *pasid, refcount_t *pinned); int asid_allocator_init(struct asid_info *info, u32 bits, bool pinned); +void asid_allocator_free(struct asid_info *info); + #endif diff --git a/arch/arm64/lib/asid.c b/arch/arm64/lib/asid.c index 286285616f65..7bd031f9516a 100644 --- a/arch/arm64/lib/asid.c +++ b/arch/arm64/lib/asid.c @@ -256,3 +256,9 @@ int asid_allocator_init(struct asid_info *info, u32 bits, bool pinned) return 0; } + +void asid_allocator_free(struct asid_info *info) +{ + kfree(info->map); + kfree(info->pinned_map); +} -- 2.17.1