Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7142102ybi; Thu, 13 Jun 2019 10:15:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwBTgRb9im60CYwWre2KdRBy8sBEM7Kl4r/Bma/AZEWXgvslgH/7o4SP3eNAOaEqUFuje/ X-Received: by 2002:a17:90a:9dc5:: with SMTP id x5mr6405015pjv.110.1560446143582; Thu, 13 Jun 2019 10:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560446143; cv=none; d=google.com; s=arc-20160816; b=LE7yV4hA4T/t86PHux8sC45g8OZj6HJje4YYXxo1PeX/9b5FVhQSPHq+bDTqNJbz/M B5Y0S5si4a1Jv4b3ypQXWzjfIW6v4/+2ETe6NuZsY9ZaK4G6POpi5MaaBtwR3xpTbnH+ 3hFCzoiOZ3WIM9OKHu4lhMcpNHgys3fbd13iQVpiUZchjqtnmqOSqHvMjidMuCT2aFbM 41W2BgKzIaEZ6kUaNnrKngDx3iI2zIEUxnKLC3+jj1w6hECrH5DYIPHRkIhgXfWTvckl nZvYWYkaOsl3Yln3NY/faBUnZk2dM6pIKozxWGuubqKs9wUeeVZ2KvEc2L3w2G9hnhYH kPyA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=gZKRKJcuRQSwe2TyYVhO9ixqNktFM8piGcLI2AKiDUY=; b=ubmVzEq3f4ZQrWhGiHw+zFgdP0SYUNS1ov8JzmtUY6LVBra9BtIFJJm7/ZDZV/p+Dn lpZoT5ZGV0qKS9nf1W26iwu3JqnGUWf0bCtnnqZhCJMrYAkp6jPPmW963u/MyDzAz2fu 5RtS8aIk746F41vstIrhiyApJMD2feXLTaM9rJmV1nQ0JQePAEwUBbRm8adToxVta/QQ tZVaMjLKVA59wIyyiF4slmx+A3U8mr08Y94fnGul4RoOjA4CZoxPNsA9zsQYulGFn5lt K9kW1wFRif3ZS9E2rWoB4JFuC5vc8r0ieG9FQ2CXfeQqy4QhEW8pZ8MvnmfE8TjjC6Z9 Z+Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=Arista-A header.b=1ceR8VNQ; 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; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si193091pjw.15.2019.06.13.10.15.05; Thu, 13 Jun 2019 10:15:43 -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=@arista.com header.s=Arista-A header.b=1ceR8VNQ; 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; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388740AbfFMRPC (ORCPT + 99 others); Thu, 13 Jun 2019 13:15:02 -0400 Received: from smtp.aristanetworks.com ([52.0.43.43]:48978 "EHLO smtp.aristanetworks.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728800AbfFLVwV (ORCPT ); Wed, 12 Jun 2019 17:52:21 -0400 Received: from smtp.aristanetworks.com (localhost [127.0.0.1]) by smtp.aristanetworks.com (Postfix) with ESMTP id A816030DD5A8; Wed, 12 Jun 2019 14:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=Arista-A; t=1560376339; bh=gZKRKJcuRQSwe2TyYVhO9ixqNktFM8piGcLI2AKiDUY=; h=From:To:Cc:Subject:Date; b=1ceR8VNQckqIlWxoGgGn9zbBtPmVs/5npYY8OjtyIbVGHiciJtQ0dQNe4lKERZPMu 6CixhkXs+XOyifhEnimauktjNu4j/0hBisAPV1usnGX4f2c7pT+Y2h8J0B2YdHfaSK q8B+AScT1PhpDKlgQAs1bWqRZOTxY7t7YAS5QPuxKeNL+33t+KICul0yaoW561kE1N h40tF1z2SrnXXl0oTL0gTm3N2v7XgMSJB9YHNeU2ojrjSalGGtf9Rw030hlJJ+HI7Q i6LISs1BjX6+ye66fIAAXJ/kaEF/P4EUYC1B7IUB6AbX/iVD/BQIDK9Y3Yu77Ha2Wt pIFLYmOZLBTYQ== Received: from chmeee (unknown [10.80.4.152]) by smtp.aristanetworks.com (Postfix) with ESMTP id 84CAB30DD5A5; Wed, 12 Jun 2019 14:52:19 -0700 (PDT) Received: from kevmitch by chmeee with local (Exim 4.92) (envelope-from ) id 1hbBAI-0003K5-UY; Wed, 12 Jun 2019 14:52:18 -0700 From: Kevin Mitchell To: Joerg Roedel Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Kevin Mitchell Subject: [PATCH 0/3] handle init errors more gracefully in amd_iommu Date: Wed, 12 Jun 2019 14:52:01 -0700 Message-Id: <20190612215203.12711-1-kevmitch@arista.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series makes error handling more robust in the amd_iommu init code. It was initially motivated by problematic firmware that does not set up the physical address of the iommu. This led to a NULL dereference panic when iommu_disable was called during cleanup. While the first patch is sufficient to avoid the panic, the subsequent two move the cleanup closer to the actual error and avoid calling the cleanup code twice when amd_iommu=off is specified on the command line. I have tested this series on a variety of AMD CPUs with firmware exhibiting the issue. I have additionally tested on platforms where the firmware has been fixed. I tried both with and without amd_iommu=off. I have also tested on older CPUs where no IOMMU is detected and even one where the GART driver ends up running. Thanks, Kevin Kevin Mitchell (3): iommu/amd: make iommu_disable safer iommu/amd: move gart fallback to amd_iommu_init iommu/amd: only free resources once on init error drivers/iommu/amd_iommu_init.c | 45 ++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 21 deletions(-) -- 2.20.1