From patchwork Wed Sep 4 17:54:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 172955 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp272214ilq; Wed, 4 Sep 2019 11:13:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOm8LS3je4hiHTUgnsIzzbufakXMVaTDiSHiHA2DzRQeqSXNq9UfDHd6yKk9ggvInyeZaq X-Received: by 2002:aa7:998f:: with SMTP id k15mr34122137pfh.203.1567620828546; Wed, 04 Sep 2019 11:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567620828; cv=none; d=google.com; s=arc-20160816; b=HDnXn1YBvlrFc58Chw1+sPnzVq2zjFMDmGzhwK5tNT+4chRcotJglN9tbwMfv4ZXp2 6qo6EjzzKMWzBDIsrQ5I0OUFPKYFng+zZvEqcPSXvLjdDM9Uu52TzUoRqHYK+J+WguxQ G7JfbifTZsx0D2/kuEmjTMqOs7jbcA5spnzdHZPTfaspe8EdNIH9UCare0SPEqCVA4UQ MZLChSUwNAgMCRMiID+s3reVADeZoZT46e29UEsgnSH2ACvHxWlBa3GMpEA+4dysLJNG hXfElMAkJnTmP+r2vd0l2LiyqgO1uBUWQZ2NsSPSGzZIUYBOE70K/bolukCQnI2AyLzE nuuw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KrV8T0HaWbpbELilfw7x90MNqYHtZaqDNT2nMNqDKmg=; b=ZYHaDqK9TDBo7xr3nsi9pelkwtGio28DYEVz0JRk5bPCRjifji5O4/gYMKDxLvOdQj JXmaAea2BL/Kh33FnqEY18kWmtzwKNJIpmd8thaDJdzQRMYYIjY0gJe0jf0HYReV8l2z WwBXjK1WoD2gQEy+hk4XBui1xgqkUU6yIOgtm/bxq7Lik5e1L0xVdqwyXxJAjDAfHyTL mCfpYs55F+BJb3ubsLiXopcJ/vmvRL1fGOH4qNgpXBs9fgpqCeJJQMXwC0vgVUZDox// aAyo5QI3wIUj59SvQasxiZS1NVmwDTX96ptwBX9ZGDvuJJWrWb/tVC552Sb1a2+NRfbs SWgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=g53H2+Yv; 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 e3si17464131pgv.153.2019.09.04.11.13.48; Wed, 04 Sep 2019 11:13:48 -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; dkim=pass header.i=@kernel.org header.s=default header.b=g53H2+Yv; 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 S2390341AbfIDSNq (ORCPT + 28 others); Wed, 4 Sep 2019 14:13:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:58644 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389972AbfIDSNn (ORCPT ); Wed, 4 Sep 2019 14:13:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DC79D208E4; Wed, 4 Sep 2019 18:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620822; bh=izBRRnXiw9mOfutHNB06OnVP5gsPFMTfZ8E+HUYKFVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g53H2+YvJ7V0o1HGulFNEvw7tbfyLiR0ZHtfNKayhX74uZud4ELH1mJM5EtaEGhJN xW1zRsn1BRi2nIOv2t1qYReK3SPFWtx9LcAKI8hATFnE4AKIMItTvvSLtnbbAsc0W9 uGni6C+5Jz4XFwhdpotxQhyn3ble3uxF4vSc8OHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Wei Xu Subject: [PATCH 5.2 109/143] lib: logic_pio: Add logic_pio_unregister_range() Date: Wed, 4 Sep 2019 19:54:12 +0200 Message-Id: <20190904175318.668350121@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Garry commit b884e2de2afc68ce30f7093747378ef972dde253 upstream. Add a function to unregister a logical PIO range. Logical PIO space can still be leaked when unregistering certain LOGIC_PIO_CPU_MMIO regions, but this acceptable for now since there are no callers to unregister LOGIC_PIO_CPU_MMIO regions, and the logical PIO region allocation scheme would need significant work to improve this. Cc: stable@vger.kernel.org Signed-off-by: John Garry Signed-off-by: Wei Xu Signed-off-by: Greg Kroah-Hartman --- include/linux/logic_pio.h | 1 + lib/logic_pio.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) --- a/include/linux/logic_pio.h +++ b/include/linux/logic_pio.h @@ -117,6 +117,7 @@ struct logic_pio_hwaddr *find_io_range_b unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode, resource_size_t hw_addr, resource_size_t size); int logic_pio_register_range(struct logic_pio_hwaddr *newrange); +void logic_pio_unregister_range(struct logic_pio_hwaddr *range); resource_size_t logic_pio_to_hwaddr(unsigned long pio); unsigned long logic_pio_trans_cpuaddr(resource_size_t hw_addr); --- a/lib/logic_pio.c +++ b/lib/logic_pio.c @@ -99,6 +99,20 @@ end_register: } /** + * logic_pio_unregister_range - unregister a logical PIO range for a host + * @range: pointer to the IO range which has been already registered. + * + * Unregister a previously-registered IO range node. + */ +void logic_pio_unregister_range(struct logic_pio_hwaddr *range) +{ + mutex_lock(&io_range_mutex); + list_del_rcu(&range->list); + mutex_unlock(&io_range_mutex); + synchronize_rcu(); +} + +/** * find_io_range_by_fwnode - find logical PIO range for given FW node * @fwnode: FW node handle associated with logical PIO range *