From patchwork Mon Jun 24 14:35:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 167598 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4311738ilk; Mon, 24 Jun 2019 07:36:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXSlAjmWt6Pq9xVC4k1Z93ysxwhgKiL7s0UlVNe/xvKmH9bgBx4FgRBEZPirCGQjsB4F2j X-Received: by 2002:a17:90a:ad93:: with SMTP id s19mr25309067pjq.36.1561387009856; Mon, 24 Jun 2019 07:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561387009; cv=none; d=google.com; s=arc-20160816; b=iuoqNuvuipf2n1hOnJvIDph54Nzm0yo5J34IaRd0Tlw77mZDOdy49iKy9HAeUNGJCz P16etlr3c3ip/p2ILXbN2EVOk89FuLaf3f0ehOvz3BDe04/XNJXktEMBuJtVrUvikaIp XS8UnuXsQcfDyB4YC/ryIH5gtXCHeLMY0qFZToj6dCrk3seqi2ELbSZw7awjR/DqOsoZ wOTyAFCMz26m3dsaEDWuskUddJNslyizfhm6ZF4egdFVwF3jznbq/MUNgQY8gqjtxnKk Hx2BDW5l/W64rbbJgQen/vFKaCXM8EdoOuNMJKIkYRvA9ycikhl89DqSit6cYC9p2ZFe KHxQ== 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=pNKE2rqUCdUavwy+JybVxJR6VmTEd9c0z4nMimI03sM=; b=UeZR/e2cNgs+DsMi4RJHFhL3rU8IcMfocYYu7o3Ju1vWJPIlqjJawX0cQJ/zDBknf1 OdIO4TRtmEC7aLrUY+OMX0rgK1ljCgWUNVQjOzOUEAwG5NCwjF5TLB0SXUyrc0gpRM6y anop7EAJWDyNf/0ocdpOCmwgDChJAJ4hKdwSL3DZneMtB2DUFPnqPxYxL8GChkV9uzpG yo3YgCaIjHXKMWvjKsl9v+VmfqiSreJGaJHrraXkMWoEgMb9CK9wyrugfwoufoqFUOM6 tOuC7RAoUT0guK0VVRxMAVtxa0CcK/VZcO5dGyv4s1hEeEYQfUgo5cUpUvg90xk79PaF pxxA== 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 t23si11097668pjw.56.2019.06.24.07.36.49; Mon, 24 Jun 2019 07:36: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 S1728609AbfFXOgl (ORCPT + 30 others); Mon, 24 Jun 2019 10:36:41 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:19068 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727170AbfFXOgj (ORCPT ); Mon, 24 Jun 2019 10:36:39 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0CD4920D55B641FA4EB3; Mon, 24 Jun 2019 22:36:37 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Mon, 24 Jun 2019 22:36:27 +0800 From: John Garry To: CC: , , , , , , John Garry Subject: [PATCH v2 0/6] Fixes for HiSilicon LPC driver and logical PIO code Date: Mon, 24 Jun 2019 22:35:02 +0800 Message-ID: <1561386908-31884-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. Cc. linux-pci@vger.kernel.org [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/ 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 | 43 +++++++++++++++++--- include/linux/logic_pio.h | 1 + lib/logic_pio.c | 86 +++++++++++++++++++++++++++------------ 3 files changed, 99 insertions(+), 31 deletions(-) -- 2.17.1