Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1318919yba; Thu, 16 May 2019 19:13:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzt92tkn5BvKTlD8AgcUfUlLu585Now8aNj80BfipnXTAWhNKqF1PuMkuMv107pk+p0xwrC X-Received: by 2002:a17:902:b205:: with SMTP id t5mr5559662plr.314.1558059222390; Thu, 16 May 2019 19:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558059222; cv=none; d=google.com; s=arc-20160816; b=W/hTK6Jc4nqaJWq76/cFjHSMQML0F258rFkx1DdSmHnR7OpuvJAmM1OQGAADSoEze0 xfpTH1852TdKnoK3QjUIBRZCv6MyWARtiZ3NupNrjPQ7NJhT/78npbCCef8i7mgtvgJA aMLHvWZ1tv0ltlLxRcHDNbJM+cWfROotiezNB0upgrFGWzrAda8lk2W79rnxxWrBvBv3 tMw/kSWKsAJM2+SQAHH8sXdWremuo1N1WVFBpUSyIFjUNd4aD1ZG3LXas4bBn671BHaP 3P8oTNr3RfbP9/xKK3tLIlCFBHXAZCrcK5cJn8pdtcVaLRD8PSs0ZWoYnvyHzfbeG9/Q Kahg== 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=YRUQVTclzQlq5SfgWCXCC24GCaikSSIUoKKXs/j3H9hteFLc/8pR69fwwLc11t9y7X YgirRPoUn9w4H4hjb6LdpHsL5AjPevDrzJqRakzCOhUgETzvAmbRA0jYpOSIwkSINz47 7pXMBc8cEzlvZsSINbHajZ/XdVoap59fR2prquE/uU/StkAry4cn8dMiw9a3m3EXuYnr W9eQ1hlDqVMzjYE5YCpqJToCpJAillycS39AA4RZUr8X0F2KbE5f7O8WWqxzIaVu2S+F hr6vGrch+HmLQa6y+eGiEWbOUONNOwCJzBa94zp13AfHfI4RJkAZVM4Knk0JqTHxAZzL 6JPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=Arista-A header.b="W0R/TFST"; 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 z19si2117555pfc.265.2019.05.16.19.13.27; Thu, 16 May 2019 19:13:42 -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="W0R/TFST"; 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 S1727259AbfEQBAB (ORCPT + 99 others); Thu, 16 May 2019 21:00:01 -0400 Received: from smtp.aristanetworks.com ([52.0.43.43]:39212 "EHLO usvae2-clmxp01.aristanetworks.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726901AbfEQBAA (ORCPT ); Thu, 16 May 2019 21:00:00 -0400 X-Greylist: delayed 398 seconds by postgrey-1.27 at vger.kernel.org; Thu, 16 May 2019 21:00:00 EDT Received: from usvae2-clmxp01.aristanetworks.com (localhost [127.0.0.1]) by usvae2-clmxp01.aristanetworks.com (Postfix) with ESMTP id 60B3830D51F7; Thu, 16 May 2019 17:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=Arista-A; t=1558054400; bh=gZKRKJcuRQSwe2TyYVhO9ixqNktFM8piGcLI2AKiDUY=; h=From:To:Cc:Subject:Date; b=W0R/TFSTzK9An9pCZ5cWXkyfD+NQGfUw4fj9BddSbmVeI5W9KzH3YhRfLvhMSTLbY XgELyp0YcG37szHF1Wl0s4/1b3fcpwQiGZPFcx6i7mu1suwFAbtPbHor6PXaZZtjI+ qd17afeUKsWTE/T7zBFtO1+11PUu+pwBZxz2bb3pOb1pAUSALAUs82ymFrKW5iGgmc yv1jZ4VSZfU+Grw+1Tp2wbCCIfe80NKqZKfCyImCDkP8KBCtHVIzWAQlwAEg99Gg6c Aivf/3fVaDCuC+OjZqJ/VXsXS4jwy6iQPiQPZsOJ7gjJ8U0wZZyF5aM4I1pwCSABYj UOYSSg8c8kZxA== Received: from chmeee (unknown [10.95.92.211]) by usvae2-clmxp01.aristanetworks.com (Postfix) with ESMTP id 9C78E30D51F6; Thu, 16 May 2019 17:53:19 -0700 (PDT) Received: from kevmitch by chmeee with local (Exim 4.92) (envelope-from ) id 1hRR7e-00011A-Dt; Thu, 16 May 2019 17:53: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: Thu, 16 May 2019 17:52:39 -0700 Message-Id: <20190517005242.20257-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