From patchwork Tue Feb 23 16:36:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Righi X-Patchwork-Id: 1443573 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DlPnY5hFpz9sVr; Wed, 24 Feb 2021 03:36:17 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lEafW-0000r2-HK; Tue, 23 Feb 2021 16:36:14 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lEafT-0000qX-EL for kernel-team@lists.ubuntu.com; Tue, 23 Feb 2021 16:36:11 +0000 Received: from mail-ej1-f72.google.com ([209.85.218.72]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lEafT-0003jL-5a for kernel-team@lists.ubuntu.com; Tue, 23 Feb 2021 16:36:11 +0000 Received: by mail-ej1-f72.google.com with SMTP id g7so2765491ejd.16 for ; Tue, 23 Feb 2021 08:36:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TJENtAhLJEo7NcJnFaCU8NQ+efB0ImHzZZqzAhSZrqY=; b=dfYAYXGScAo01rptQ1vPuj2n9y5JH1hRCQbsZthuSIP0tFu71q1NYOt82+nlr3wDjR W0bcC6Lgu86vedj/A4ouceNyAaMlGJEKlpvw3pqR5OOF/HX+c+rVJvp+Y75Dku0GKkkd yHY+0m2cpBpI4Qg7ngpUypGbAs5UnWroPuT0/J5zlzWc39JRKFBVuKiRp8+93sehKAfY eZ9XFihDJEu3VeBdI+UWgPlCB72tSTVgpQDBZU8ANC1z7LGx3mDB6NHxzdeu4/UEJG77 3aL0TnpXRUTm51Hu29cOYeoP8Xum2e8BEzCM5KWe6j/I7wISKdCUyMRRUquVV72YxQ77 DUyw== X-Gm-Message-State: AOAM531X+k4kBzhpuE+jNJwKpJRTqwQyTURwgo2dYKWnpKkpt6mE6WFp 5n0GqpWFGYMXqWfJTkOjRqK4D3vHWOqrt1zBru50KRJoP8osgYKq+r82Y+N+C4XlzsZDRfIplzf ycTSx4/cfy0qj4MuTLEc5MaopBXckY/UHQbf+fadyjg== X-Received: by 2002:a17:906:7c43:: with SMTP id g3mr26821726ejp.210.1614098170911; Tue, 23 Feb 2021 08:36:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJy93YFJ+6OPcNMk31L8t3um8KoyZP8648ht8fNPk0qkVqX5NFoox30GFt/ZCitSwckHT3dG4Q== X-Received: by 2002:a17:906:7c43:: with SMTP id g3mr26821709ejp.210.1614098170722; Tue, 23 Feb 2021 08:36:10 -0800 (PST) Received: from xps-13-7390.homenet.telecomitalia.it (host-95-234-130-215.retail.telecomitalia.it. [95.234.130.215]) by smtp.gmail.com with ESMTPSA id b4sm16926948edh.40.2021.02.23.08.36.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 08:36:10 -0800 (PST) From: Andrea Righi To: kernel-team@lists.ubuntu.com Subject: [SRU][X/aws][PATCH 1/1] Revert "iommu/vt-d: Gracefully handle DMAR units with no supported address widths" Date: Tue, 23 Feb 2021 17:36:07 +0100 Message-Id: <20210223163607.76266-2-andrea.righi@canonical.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210223163607.76266-1-andrea.righi@canonical.com> References: <20210223163607.76266-1-andrea.righi@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1913739 This reverts commit 561ef22a7d396289a1c5a1d18057ccdf9bb59826. It seems that this patch is addressing the problem correctly only with kernels >4.4. For now it is probably safer to simply drop this patch and revert this change in 4.4 to avoid introducing potential regressions. Signed-off-by: Andrea Righi Acked-by: Guilherme G. Piccoli Acked-by: Colin Ian King --- drivers/iommu/dmar.c | 45 ++++++++++++++------------------------------ 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 78174f2f9fafb..00169c9eb3eed 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c @@ -1012,8 +1012,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) { struct intel_iommu *iommu; u32 ver, sts; - int agaw = -1; - int msagaw = -1; + int agaw = 0; + int msagaw = 0; int err; if (!drhd->reg_base_addr) { @@ -1038,28 +1038,17 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) } err = -EINVAL; - if (cap_sagaw(iommu->cap) == 0) { - pr_info("%s: No supported address widths. Not attempting DMA translation.\n", - iommu->name); - drhd->ignored = 1; + agaw = iommu_calculate_agaw(iommu); + if (agaw < 0) { + pr_err("Cannot get a valid agaw for iommu (seq_id = %d)\n", + iommu->seq_id); + goto err_unmap; } - - if (!drhd->ignored) { - agaw = iommu_calculate_agaw(iommu); - if (agaw < 0) { - pr_err("Cannot get a valid agaw for iommu (seq_id = %d)\n", - iommu->seq_id); - drhd->ignored = 1; - } - } - if (!drhd->ignored) { - msagaw = iommu_calculate_max_sagaw(iommu); - if (msagaw < 0) { - pr_err("Cannot get a valid max agaw for iommu (seq_id = %d)\n", - iommu->seq_id); - drhd->ignored = 1; - agaw = -1; - } + msagaw = iommu_calculate_max_sagaw(iommu); + if (msagaw < 0) { + pr_err("Cannot get a valid max agaw for iommu (seq_id = %d)\n", + iommu->seq_id); + goto err_unmap; } iommu->agaw = agaw; iommu->msagaw = msagaw; @@ -1088,12 +1077,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) drhd->iommu = iommu; - /* - * This is only for hotplug; at boot time intel_iommu_enabled won't - * be set yet. When intel_iommu_init() runs, it registers the units - * present at boot time, then sets intel_iommu_enabled. - */ - if (intel_iommu_enabled && !drhd->ignored) + if (intel_iommu_enabled) iommu->iommu_dev = iommu_device_create(NULL, iommu, intel_iommu_groups, "%s", iommu->name); @@ -1111,8 +1095,7 @@ error: static void free_iommu(struct intel_iommu *iommu) { - if (intel_iommu_enabled && iommu->iommu_dev) - iommu_device_destroy(iommu->iommu_dev); + iommu_device_destroy(iommu->iommu_dev); if (iommu->irq) { if (iommu->pr_irq) {