From patchwork Mon Sep 13 17:23:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 509827 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp763848jao; Mon, 13 Sep 2021 10:28:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmiIhBbncmrDvvdWSyLamHREZmWn51lALJ8J9K9XeCE25GtKLDBG3zkMuajMJ/JT2V7F3v X-Received: by 2002:a17:906:688a:: with SMTP id n10mr13853454ejr.389.1631554089274; Mon, 13 Sep 2021 10:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631554089; cv=none; d=google.com; s=arc-20160816; b=04xleayqivca5wy8ZToJiV9b3KAP5m58ZPgtEuHu2d83rvNU3PJLIzKe8EwjgYVEIP 8F+9gBCT+j0q2Sno8pIsC+wxEgX1hLhUFWp58tZW1AJ5RLEIY6hS+EU3evSnRDhvq2MY mzTKSApQKNVlTSRH7afdNbZlFG4c0yXgglb3IehjpN0ca+yZJcOZYfMxLQfAOyL48kip BQkGu7XiLxdr+zKAQMzu90O+pZZhDjUKfvlYuJSo0v+DIzKtAkUZVNDRghGm9UDuKp// JGTCSjLaasznMvReLyhrHBlgsYAY3/cQP+Glc0LVgQjAlV6bdCgVwJpdhIluHv52RcSn jYLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=IYkKjupU60hjMoVoiKRZMcxcNQZn+uo4Fm5/nL836Ps=; b=OQClZCISjrMliwHiSMlwP/saSaawhpUiW4DGtwCONOzLMY/PWmB4z9zJ4AqSULRXNk OLIYwQWH8a+DkE76EADVYs6PqRBIJyYOehNBLSxGMP7YrAEI0CQL+vF2zbOGf9tvLnT1 Ds1kt1oZGH2fD1LwZJgniU5FbEzp7LNuveeiygzg7txAfhURGEsZGHB2+XJxoVQmxWqW Gs5tWdboHDP7eBcMWtSQ0F1qsz+ctKafxw35/JsTJIFwJbe3fKLTNzoaa0xe5LNTwM9l WkEN6yXGv6S9mWbmxe2bdG4QQf+CaphJ92uskx9P98Dt1/NfuJ3AHaDzymAB9lLpUk23 XOSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v0dJK0mx; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si7826747edx.506.2021.09.13.10.28.09; Mon, 13 Sep 2021 10:28:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v0dJK0mx; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243002AbhIMR3W (ORCPT + 2 others); Mon, 13 Sep 2021 13:29:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242416AbhIMR3O (ORCPT ); Mon, 13 Sep 2021 13:29:14 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C143C061574 for ; Mon, 13 Sep 2021 10:27:58 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id t18so15928536wrb.0 for ; Mon, 13 Sep 2021 10:27:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IYkKjupU60hjMoVoiKRZMcxcNQZn+uo4Fm5/nL836Ps=; b=v0dJK0mx5IKoUqec9tlPaB87hp2PgiZTKU2qd+dihbVLNs3hzol0pLJ7WlmQ6nwf3l Cw3xr0gvIwV7AJjVeO4XAO2yDCZAL4p7jAsmcJz0OyerpVEBILEVlwbflvIAQHL89ZX6 dHmPlyXKRt4uTh7Y/3hhKbME9K1DY3nxtSso3BI5o0Lmx9ZgF0pg+n0YcCkEtF9E6NWo eAboQnljnOIz5qNrCcZKnyGyIuWlaGJ5lBfRe70aXqEfwurAM4giPGIpePd1NU25XWGy cUn/einI0MDJAbV5oAEiKHygrWzYX4Kd6bJr03rqyaoBrXKwc7luaiLxacUv8geympzR pUUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IYkKjupU60hjMoVoiKRZMcxcNQZn+uo4Fm5/nL836Ps=; b=l95lNYF8lieBC+5eSu6hADTKL7RJk7/Op1bfJD0tobzFbGUkB4tevjEcBEGvPJRyTQ ig693xMfx4xcFTV1hJFkSTJf6XmuBbR9aS/3IONTfdZ/d0zncOii3B59Nux8gGbNGN92 i2Ix1lVxRnUoSZUvJ0G1XWIxBrXM2XqOkUFb5bjyKgkgMcN1fRTNF3hrf/7zIDYaLDkg Zis/8X/XKIv/aipgHILcN+UJPMltJVfr8DAOMmX+bVnOX7r9maDh+2RRzL18dWXuxVr+ yqz3lOcKpA6K8T/MEM2001OkIoj+PBOVDWUEEk+rcJBHWez3WWbMBekxtPozD7rLL/Aj yDYA== X-Gm-Message-State: AOAM532cRya4Xhzr/BXq+ruHoXou5kOycfrIz51sWozuIrwYK8cL2yyH o8tNE1JiUlIEnztHM6/SZPGCxw== X-Received: by 2002:adf:db4a:: with SMTP id f10mr4772713wrj.91.1631554077026; Mon, 13 Sep 2021 10:27:57 -0700 (PDT) Received: from localhost.localdomain (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id x13sm7933228wrg.62.2021.09.13.10.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 10:27:56 -0700 (PDT) From: Jean-Philippe Brucker To: rafael@kernel.org, lenb@kernel.org, bhelgaas@google.com Cc: linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, sdonthineni@nvidia.com, Jean-Philippe Brucker Subject: [PATCH] PCI/ACPI: Don't reset a fwnode set by OF Date: Mon, 13 Sep 2021 18:23:59 +0100 Message-Id: <20210913172358.1775381-1-jean-philippe@linaro.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Commit 375553a93201 ("PCI: Setup ACPI fwnode early and at the same time with OF") added a call to pci_set_acpi_fwnode() in pci_setup_device(), which unconditionally clears any fwnode previously set by pci_set_of_node(). pci_set_acpi_fwnode() looks for ACPI_COMPANION(), which only returns the existing fwnode if it was set by ACPI_COMPANION_SET(). If it was set by OF instead, ACPI_COMPANION() returns NULL and pci_set_acpi_fwnode() accidentally clears the fwnode. To fix this, look for any fwnode instead of just ACPI companions. Fixes: 375553a93201 ("PCI: Setup ACPI fwnode early and at the same time with OF") Signed-off-by: Jean-Philippe Brucker --- This fixes boot of virtio-iommu under OF on v5.15-rc1 --- drivers/pci/pci-acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.33.0 diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index a1b1e2a01632..483a9e50f6ca 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -937,7 +937,7 @@ static struct acpi_device *acpi_pci_find_companion(struct device *dev); void pci_set_acpi_fwnode(struct pci_dev *dev) { - if (!ACPI_COMPANION(&dev->dev) && !pci_dev_is_added(dev)) + if (!dev->dev.fwnode && !pci_dev_is_added(dev)) ACPI_COMPANION_SET(&dev->dev, acpi_pci_find_companion(&dev->dev)); }