Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1024207ybe; Wed, 4 Sep 2019 11:18:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdSBAgcAlR9Rz8MhitzVOM9mYgwwjlFMP7nT5MM45dym+ltqC9+p6dMDPHW3lCiHOMTFm4 X-Received: by 2002:a62:2f85:: with SMTP id v127mr14534906pfv.68.1567621117244; Wed, 04 Sep 2019 11:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621117; cv=none; d=google.com; s=arc-20160816; b=pXMY0hpXwpv5VgBERtcJpN5TtQxxz4Ek8vqfTyDHerq2XbyqOdSl5MdPt7aH3nU4wW Og7arYiRepaESbsJemsZPup9e3pxJzHJuRUTSP4Onpv7nBeGvB6Sre29bwTN+jeysvRj 2H5WLTezXfDqeaf/CcIYj/JUVUYV3Pk6fvg54YAkSocaA1YeoRl1ZskNqTT9X5rXzaK9 wxfvEdY+VVCMzE3mhgDXU9xXsXnhY3gnQt2jV7UT0gx9TJ0fHGW9Z9iAGZWuW4Ez7u9l 4soLT5piIxEo855d8gCCneGXXunsSz4+KerPtF8aThtZYhxENqi529kaHNcAGs4PZjeD IOaw== 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 m186si2046447pfb.248.2019.09.04.11.18.21; Wed, 04 Sep 2019 11:18:37 -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 S2390337AbfIDSNq (ORCPT + 99 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 *