From patchwork Wed Jun 26 16:26:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 167842 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1158340ilk; Wed, 26 Jun 2019 09:28:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNSRBkSPL7ou/JeZZZsgG/BZHGnisIWzOkKsqFANjAliZI6kbOjiJZId+VCY6RHBXNjzde X-Received: by 2002:a17:902:1004:: with SMTP id b4mr6532923pla.325.1561566529707; Wed, 26 Jun 2019 09:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561566529; cv=none; d=google.com; s=arc-20160816; b=pdmf77RyOYSTK26Bxxes2b33uWVxKQg/Ux/xBgArB7IKL65bqMBqXuQXA9K9hDvlwO EWqOwYI6y9GLvq2Net3R1OGknFpSK8cYDYDFsYCOVI+l4/p2LbR7cCSSRETF9+Sb9GWj S9e9ts0+WWCVMqrlAl9qdAW+3pkPRWIGFUdRTBppBQNxdBXV9wHO/ZueyucrsfFiT4nq euKnaTFQzzqF6V07ovLm6usPFqJXC0Rd0rpRGort8BG7hQ8SSNpir2DJTJtht5SnC29h tX2lM9wQzoyZTa6CFm9jcNKgRtoHhDNqRTCUr6VTlASoI3Z9JzD4fBz/XQluJXkcpo2e HMAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=kqb2rhUzMZ0lk2DynawsttvN4ey+X9f93Bq4cQtnYL8=; b=BgHoNCfAT4T0st8GeO+KUYgQHEMvYdIcHKkmtRFu9UWwG+LvLuBFn6wrSO+lWEeXCc WERwO6I7Qzv5KqwPfmoAQuSES2BjWLCaaAHCoV618lxuHvmWUqm6nUaSDiwqA4RFHRvO karNS2924cOSEPj/4X5LHmofoiBrLtZVyo4hg68ckb1RGdHn+H60pv3Q6s0mZxWA5Uv4 gMksYF/L5vX2sI4RDwUATq20Dh3s+tA7sTeDaJeXlbp+974XI7474iLUKJJV0GhH14nw ijzr0hC5hl6phJjdsvrUydLMOc+Wd3n0spKaHV0kE+/2j9y5bjQOif/wJQQ9xExBVFNT Dc4w== 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 i101si2256177pje.4.2019.06.26.09.28.49; Wed, 26 Jun 2019 09:28:49 -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 S1726651AbfFZQ2o (ORCPT + 30 others); Wed, 26 Jun 2019 12:28:44 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:50166 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726603AbfFZQ2l (ORCPT ); Wed, 26 Jun 2019 12:28:41 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 423AD8CC4CB42EDAAF54; Thu, 27 Jun 2019 00:28:31 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Thu, 27 Jun 2019 00:28:25 +0800 From: John Garry To: CC: , , , , , John Garry Subject: [PATCH v3 0/6] Fixes for HiSilicon LPC driver and logical PIO code Date: Thu, 27 Jun 2019 00:26:52 +0800 Message-ID: <1561566418-22714-1-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As reported in [1], the hisi-lpc driver has certain issues in handling logical PIO regions, specifically unregistering regions. This series add a method to unregister a logical PIO region, and fixes up the driver to use them. RCU usage in logical PIO code looks to always have been broken, so that is fixed also. This is not a major fix as the list which RCU protects would be rarely modified. There is another patch to simplify logical PIO registration, made possible by the fixes. At this point, there are still separate ongoing discussions about how to stop the logical PIO and PCI host bridge code leaking ranges, as in [2]. Hopefully this series can go through the arm soc tree and the maintainers have no issue with that. I'm talking specifically about the logical PIO code, which went through PCI tree on only previous upstreaming. Since we so late in the cycle, it may be best to target v5.3, and I can backport the fixes to stable myself. [1] https://lore.kernel.org/lkml/1560770148-57960-1-git-send-email-john.garry@huawei.com/ [2] https://lore.kernel.org/lkml/4b24fd36-e716-7c5e-31cc-13da727802e7@huawei.com/ Change since v2: - Add hisi_lpc_acpi_remove() stub to fix build for !CONFIG_ACPI Changes since v1: - Add more reasoning in RCU fix patch - Create separate patch to change LOGIC_PIO_CPU_MMIO registration to accomodate unregistration John Garry (6): lib: logic_pio: Fix RCU usage lib: logic_pio: Avoid possible overlap for unregistering regions lib: logic_pio: Add logic_pio_unregister_range() bus: hisi_lpc: Unregister logical PIO range to avoid potential use-after-free bus: hisi_lpc: Add .remove method to avoid driver unbind crash lib: logic_pio: Enforce LOGIC_PIO_INDIRECT region ops are set at registration drivers/bus/hisi_lpc.c | 47 ++++++++++++++++++--- include/linux/logic_pio.h | 1 + lib/logic_pio.c | 86 +++++++++++++++++++++++++++------------ 3 files changed, 103 insertions(+), 31 deletions(-) -- 2.17.1