From patchwork Tue Jun 11 14:12:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 166459 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2420415ilk; Tue, 11 Jun 2019 07:14:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqymVcmroMOJ1O7LMcbiVgLBxSxZ3w2IUA5OnBtC12h+9ytVVzdFl9QnJi7sQThKZmtwkM+O X-Received: by 2002:a63:5a4b:: with SMTP id k11mr20233487pgm.143.1560262460061; Tue, 11 Jun 2019 07:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560262460; cv=none; d=google.com; s=arc-20160816; b=oLKIk9Cq8fyM1iQ/wtBDawxqhCzn91sow/ZvcdOILQhLJpysG9jyYiPIf3pgwNbr/8 ynZBDqllgm9H0flVcgCyV6X6eS9qeOBbYpgbTYdXNpIR6U7tLTvCnTOqA/BA17xL+3JF W8a+Ak3rGFl/ctrsckpR//q4GUK5VyDw53JtzjBtAjCNRq5Zgs90Xyd5HTdRVU7w1cA3 wxKS6o3FkI4vwMjD6mQTgNYD9dLYy/pTK1hepmKgEcApqEWN8TptQXCDsQCSSVywlEW6 ANIRoTLAGMwYT58eIYiAOAHdxLqC6kTx3++aJhOPMtBxG6plIhPeyflBZCnQuWT7kUiE I4vw== 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=H/mVkE+k2aGeD1G/8PvXsqmQ6/3SQX7IVK8R9wALxjY=; b=JLS0pOZt3DNzohThojSH2h6vcuAyOGbIfXKCMR+RTJXFgWFTz37oGIKOX2u7xwLfK0 WKnqWMKTpXDAcA1rD4BfGf6b5HQZqcCdMGN1zPzIYX9FOmh6NrnPFc4vs90MrM9sipdc lBwm/g2Xmtup3d9ijS0UBCd23iP+PGVy3rrohL4cFLvlftAebhEWjXJJtBntHk4JuTzE rYKtrTmsrVAH4Q94AaQkiC1okVbLkSa+1BcUI21/gl+CITEAGs8cwkiRczpcfVDAZJZk zlD9bHeO0OOPU41KXX6h3emF+GLpN1OTJEVId7l4W5PFBbjueJKMVQmvupF7MAklUl65 6MRw== 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 g35si2515806pje.73.2019.06.11.07.14.19; Tue, 11 Jun 2019 07:14:20 -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 S2390180AbfFKOOS (ORCPT + 30 others); Tue, 11 Jun 2019 10:14:18 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:18551 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728264AbfFKOOP (ORCPT ); Tue, 11 Jun 2019 10:14:15 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 50806A18E011A450749A; Tue, 11 Jun 2019 22:14:12 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Tue, 11 Jun 2019 22:14:06 +0800 From: John Garry To: , , CC: , , , , , , , , , John Garry Subject: [PATCH v4 0/3] Fix ARM64 crash for accessing unmapped IO port regions Date: Tue, 11 Jun 2019 22:12:51 +0800 Message-ID: <1560262374-67875-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 It was reported some time ago that arm64 systems will crash if a driver attempts to access IO port addresses when the PCI IO port region has not been mapped [1]. More recently, a similar crash is where the system PCI host probe fails, and the IPMI driver crashes the system while attempting to do some IO port accesses [2]. This patchset attempts to keep the kernel alive in such situations by rejecting logical PIO access to PCI IO regions until PCI IO port regions have been mapped. Accesses to unmapped regions fail silently, mimicking x86 behaviour. The previous versions of this patchset also included a patch to reject IO port resource requests until PCI IO port regions have been mapped (in a pci_remap_iospace() call). However I decided to drop it since the validity of the patch was strongly in doubt - [3]. 1. https://lore.kernel.org/linux-pci/56F209A9.4040304@huawei.com 2. https://lore.kernel.org/linux-arm-kernel/e6995b4a-184a-d8d4-f4d4-9ce75d8f47c0@huawei.com/ 3. https://lore.kernel.org/linux-pci/20190326224810.GY24180@google.com/ Differences to v3 patchset: https://lkml.org/lkml/2019/4/4/1294 - Drop patch to reject IO port requests - Make unmapped IO port accesses silent, mimicking x86 Differences to v2 patchset: https://lkml.org/lkml/2019/3/20/788 - Add a patch to use logical PIO accessors for !CONFIG_INDIRECT_PIO - Some tidy-up according to Andy's review Differences to v1 patchset: https://lkml.org/lkml/2019/3/14/630 - Drop f71805f fix - it can be done in a separate patchset - Change implementation in resource.c patch to check if parent of region is ioport_resource - Add patch to fix some logic_pio.c prints John Garry (3): lib: logic_pio: Use logical PIO low-level accessors for !CONFIG_INDIRECT_PIO lib: logic_pio: Reject accesses to unregistered CPU MMIO regions lib: logic_pio: Fix up a print include/linux/logic_pio.h | 7 ++- lib/logic_pio.c | 116 ++++++++++++++++++++++++++++---------- 2 files changed, 90 insertions(+), 33 deletions(-) -- 2.17.1