From patchwork Wed Jun 9 16:32:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 1489984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=msxBvyiJ; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4G0XhS1YLfz9sRN for ; Thu, 10 Jun 2021 02:32:40 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233840AbhFIQed (ORCPT ); Wed, 9 Jun 2021 12:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234202AbhFIQec (ORCPT ); Wed, 9 Jun 2021 12:34:32 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EA01C061760; Wed, 9 Jun 2021 09:32:27 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id j26so17064558ila.4; Wed, 09 Jun 2021 09:32:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ejFMapilAMOPPgo65R0NoskzTqCmBJQGTttVyFEof2s=; b=msxBvyiJQsbZYn9NVGTvjMwaHc6gfCHlPxwqAAetEsFg3aT1qqdvBeUI8ZS1GSyVOr fb3UQ0BD56z/9dZTq3kf8skbvHbiNXPtj76RLdJzgQbvf/qJ3b6GYZnYP9MOuHqTg98W +kOo1FVGNr+bo21YZYzwXMvunLzJGGoQ9AnJWHgl6YluBQ2ZAa8m6t4QcXSy8K70uzMN qKHmXEI+EWLi79TOw1zNhk1GxbWsKvUzqxt9DP3JFkRwgoppbKOwmm2otClEynJ+Mg3p Mdb4EzuQXRnr19TlALueNSBx20UNJNDryBSAZF2JYMl8oVhaJvbkvjl4inyKSAgPPlQZ rCiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ejFMapilAMOPPgo65R0NoskzTqCmBJQGTttVyFEof2s=; b=aDx0d+dwuXI4eh9H1Nq6nvl3jz+ovRHAOCmYkD2ZagrDUlMNJSoJ3dEWlzVIU/xqYu DM9Of3Nu1iI26cIki5A3+G8Zb95gQF8QROrosykfq7Zbm0neooZtre+6maFvgt0UOZob 8/gqUkXOhn3cIYcU67wh/VYUO0PEAMrah2xce4U81Q5xJvcdqPNfBqKj9Sz0yQ/Nh0zq EdcHLJ6ObAYRFXzN2EkocXzWU+anRjbA+dwGNf1BgBmRqBPJYyMNNffut0BDTb+H9k8H goalOo7oWgs9aNCqmBUZuJ0NZ0wtIna2tPZlaX4PA9YKHWfBq8FmxivrVB/IRaNzI00K WBAA== X-Gm-Message-State: AOAM533DSUHmEeovNpsyeBb5gUOCUZBJPZSkbpQhG3fpO+WSw0AMNjaw T9p0wZ9BIKt40rkh+Mc9HH0= X-Google-Smtp-Source: ABdhPJyGfS687wl4KOUdiCz4Zzh820mpkXMSIFgCcRgiZpXFua5L069oVO9LWHjCOlyNwF69yurATw== X-Received: by 2002:a05:6e02:b43:: with SMTP id f3mr439896ilu.22.1623256346695; Wed, 09 Jun 2021 09:32:26 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id i13sm262519ilr.16.2021.06.09.09.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 09:32:26 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 524A327C005B; Wed, 9 Jun 2021 12:32:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 09 Jun 2021 12:32:25 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduuddguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeehvdevteefgfeiudettdefvedvvdelkeejueffffelgeeuhffhjeetkeei ueeuleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Jun 2021 12:32:24 -0400 (EDT) From: Boqun Feng To: Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org Cc: Catalin Marinas , Will Deacon , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Lorenzo Pieralisi , Rob Herring , Clint Sbisa , Boqun Feng , Ard Biesheuvel , Sunil Muthuswamy Subject: [RFC v3 6/7] arm64: PCI: Support root bridge preparation for Hyper-V PCI Date: Thu, 10 Jun 2021 00:32:10 +0800 Message-Id: <20210609163211.3467449-7-boqun.feng@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210609163211.3467449-1-boqun.feng@gmail.com> References: <20210609163211.3467449-1-boqun.feng@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Currently at root bridge preparation, the corresponding ACPI device will be set as the companion, however for a Hyper-V virtual PCI root bridge, there is no corresponding ACPI device, because a Hyper-V virtual PCI root bridge is discovered via VMBus rather than ACPI table. In order to support this, we need to make pcibios_root_bridge_prepare() work with cfg->parent being NULL. Signed-off-by: Boqun Feng --- arch/arm64/kernel/pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 1006ed2d7c60..020bc268bf06 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -84,7 +84,12 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) { if (!acpi_disabled) { struct pci_config_window *cfg = bridge->bus->sysdata; - struct acpi_device *adev = to_acpi_device(cfg->parent); + /* + * On Hyper-V, there is no corresponding APCI device for a root + * bridge, therefore ->parent is set as NULL by the driver. Then + * 'adev' should be NULL in this case. + */ + struct acpi_device *adev = cfg->parent ? to_acpi_device(cfg->parent) : NULL; struct device *bus_dev = &bridge->bus->dev; ACPI_COMPANION_SET(&bridge->dev, adev);