From patchwork Wed Jul 24 16:25:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 169626 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp10466584ilk; Wed, 24 Jul 2019 09:26:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqweqWcGjoW/T0OB9/uIZKF3JH16W3g7QHnDGtOPaeD4PfOfRgHMRHpGyF6b8u4rJn83NcNb X-Received: by 2002:a63:4f51:: with SMTP id p17mr60234596pgl.333.1563985572269; Wed, 24 Jul 2019 09:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563985572; cv=none; d=google.com; s=arc-20160816; b=tpIsv5T/WuMCH6ONY+9bcSJCKZWp2qZz4ktbB9CcYV4n1YwhBIFAoSkv/MN530djbO Oju/peF7A1qyxlL8wEXf1ixV+JXh3QEucW6tCDTNB5qtnFjBTrVTQduqazSD5xIqKQOg dMBnFihiLNHaH5fI3lbb5vAh9X9GU2xkQaB6fz0q1D0zaCfUAau2VzpYPwSBbrzC2jF+ lGDhFSZ7OnNMhXY+vK7iX+xHBB4kQ+wFHzLtrCp2sVYBrnSTiVYFjhQ8YGq/aoIr4bC4 TkwUxB/9TvBRA6r8zEPgL06AyuMDeS5O1INyvPWRSr/uXeOWnvK3M39oQn1mWKxZonco RvVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=QMia8MqWppUyTniiiBsj+k4yE9pycwjXa8XNFdZZCZg=; b=ufagfjQDmUJuAtc0D22/YaKcyz9ArIeiL/kaPoBOCmUcFCymEvk4GhqYJ8P7AHOVqi CE6qxOmOkHtBjwGhWVC+hPAyKml4Jl+e1V4BBJDW4Zah3LQe9VggZWa73UNVIVslaKeL at1yJQSJNhDHSLntUHyNy03zuNsd/Fw9729utTWf74zriTJ5/rHnDuoZNtUdAiGLEUtR 24vKWlXGUuOnB4B8/l0+mwx9vI/aEH5gnb5mY9/h/OJpcIistX8TG8QNdW6gJbJLYVKj TUE5XxUI6Tt+n2owP6TouCKyKtroIVj8PmDQpbamkJ2WAmrM9AmuKvt+qCI8kz5rrRsH IEBg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8si12873638plq.53.2019.07.24.09.26.12; Wed, 24 Jul 2019 09:26:12 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728915AbfGXQ0K (ORCPT + 29 others); Wed, 24 Jul 2019 12:26:10 -0400 Received: from foss.arm.com ([217.140.110.172]:43434 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728902AbfGXQ0G (ORCPT ); Wed, 24 Jul 2019 12:26:06 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0329428; Wed, 24 Jul 2019 09:26:06 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A35343F71F; Wed, 24 Jul 2019 09:26:04 -0700 (PDT) From: Julien Grall To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: james.morse@arm.com, marc.zyngier@arm.com, julien.thierry@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Julien Grall Subject: [PATCH v3 12/15] arm64/lib: Add an helper to free memory allocated by the ASID allocator Date: Wed, 24 Jul 2019 17:25:31 +0100 Message-Id: <20190724162534.7390-13-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190724162534.7390-1-julien.grall@arm.com> References: <20190724162534.7390-1-julien.grall@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some users of the ASID allocator (e.g VMID) may require to free any resource if the initialization fail. So introduce a function allows to free any memory allocated by the ASID allocator. Signed-off-by: Julien Grall --- Changes in v3: - Patch added --- arch/arm64/include/asm/lib_asid.h | 2 ++ arch/arm64/lib/asid.c | 5 +++++ 2 files changed, 7 insertions(+) -- 2.11.0 diff --git a/arch/arm64/include/asm/lib_asid.h b/arch/arm64/include/asm/lib_asid.h index c18e9eca500e..ff78865a6823 100644 --- a/arch/arm64/include/asm/lib_asid.h +++ b/arch/arm64/include/asm/lib_asid.h @@ -74,4 +74,6 @@ int asid_allocator_init(struct asid_info *info, u32 bits, unsigned int asid_per_ctxt, void (*flush_cpu_ctxt_cb)(void)); +void asid_allocator_free(struct asid_info *info); + #endif diff --git a/arch/arm64/lib/asid.c b/arch/arm64/lib/asid.c index 0b3a99c4aed4..d23f0df656c1 100644 --- a/arch/arm64/lib/asid.c +++ b/arch/arm64/lib/asid.c @@ -183,3 +183,8 @@ int asid_allocator_init(struct asid_info *info, return 0; } + +void asid_allocator_free(struct asid_info *info) +{ + kfree(info->map); +}