From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49864C4338F for ; Thu, 19 Aug 2021 16:16:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 00C0D60698 for ; Thu, 19 Aug 2021 16:16:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 00C0D60698 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IU7WZOlnPisVOAklqK55QwT3qMI+VZMvyRWUbT0bPt8=; b=WOOyEliwSFy+fC F+VPxQH2it5fObyDiLo9RbyCRS5jgVy5WVYDOO2UVggjyEEQouC7KVJ8HAXzl/pcCqeqHBYWmZYOU EnU7+ZFxI/ZIiS/zxha9DndTBn/pAeMQr64NSTW1Nm97bW3XO8knB5UYIyVNGTnCAiOH//W4JUnmP icZWb8kuQlBHF2lUhG3cs0499xLs3PfpIMPyVCeJljsOsw42OLZqiodrpGIFJKYSPUnn1EqDLJ4XF 0/8uHtpE73y8Uhgfd8YG5aWHNvPEV7GIB+aRCYUCgduGchW8RxR7V1ixsoz3upNKm/Hrn/T3K9oyN wuMYy+qKonmhY/GIiSyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGkg8-008ulk-2t; Thu, 19 Aug 2021 16:14:04 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGkg3-008ukn-NK for linux-arm-kernel@lists.infradead.org; Thu, 19 Aug 2021 16:14:01 +0000 Received: by mail-io1-xd30.google.com with SMTP id b200so8349504iof.13 for ; Thu, 19 Aug 2021 09:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ySNm5Bk9COcoCTlxBoNx2xtiQU2siDNi9QvD6Fw2LHY=; b=eT3kT21+h9KmKJuMtIfZt2j7b7Gh71x95InJl9NmoGC3d65urtKYQ2ivzWhXTyt3N9 cwRgMANy01hRZGHK3WbR3Fofy9qgV1oJJaO2GGLQwruCzjeQlg2p3D9E7XRZjPKWX9Nr Q+MRAcb0Bx21kyY6DOsYhhrioYovi5H3VL3sjSqJn1BnojOIkrpw7Tavm3ivfGlw/lqB CrfgGT4/tgxJh5QMPvilbOYYUk5lDcGVZ2OgkuqHJiq8XI4SAh4ojpnGsowxu5KfqMyw uXKlqn57l3QvRCIFlJ+rowU8hB+XfYMFt/Yp23HLrjzMAqiulI1K/WJBkk+C2lrawz16 95zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ySNm5Bk9COcoCTlxBoNx2xtiQU2siDNi9QvD6Fw2LHY=; b=QeMOWYKYSqZnYWwUvpHYCTQBuHW8qCduaUqiAwNx06YFt69gsKF/KaEALvSInj8syd of9ajcRoFS/KiXPjJxS/pLVx7ja2xUi+QKkSNWLWhB0Eos5ATCAjwlh6pPkUw/39hJY+ 7t8fekS0BlCKLnK9MEQB82LhN+q3MbrcYMdcHaiizCVqFm2wpTkHA382awNn8Y1CwR1m OODjmsvdH5g7UB6/ZZX1j3e4FxGwQJHPWrjRe1S5LXVaqY+E+fqsSBLdHxd+0YhtdBg3 cEoDCD50DG8zHniRv5SDt+rQ06kuqcZ82tNFPoOM6qJ7qoFVgxv2ernCb46vE1to1n+3 zRsA== X-Gm-Message-State: AOAM533jKs2wemAJX/AaKfwaWBgzIK8Hd6TpZGjv+wEK7SQByuD0YFRP RVq1UXFyz9VYweRB+bJkEQ0= X-Google-Smtp-Source: ABdhPJxrl82ZSwavV3V8BmvBTWnuI3ManBU9zK9oiUPO/16jM4jSUXw3hhNmmOgZXhh4QQFB1OWyVA== X-Received: by 2002:a5e:df0d:: with SMTP id f13mr12029301ioq.108.1629389638574; Thu, 19 Aug 2021 09:13:58 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id k2sm1733779ior.40.2021.08.19.09.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 09:13:58 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailauth.nyi.internal (Postfix) with ESMTP id 260F027C005A; Thu, 19 Aug 2021 12:13:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 19 Aug 2021 12:13:57 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrleejgdeliecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpeevieejtdfhieejfeduheehvdevgedugeethefggfdtvdeutdevgeetvddvfeeg tdenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 19 Aug 2021 12:13:55 -0400 (EDT) Date: Fri, 20 Aug 2021 00:13:22 +0800 From: Boqun Feng To: Catalin Marinas , Will Deacon Cc: Catalin Marinas , Will Deacon , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, Sunil Muthuswamy , Mike Rapoport , Bjorn Helgaas , Arnd Bergmann , Marc Zyngier , Lorenzo Pieralisi Subject: Re: [PATCH v6 4/8] arm64: PCI: Support root bridge preparation for Hyper-V Message-ID: References: <20210726180657.142727-1-boqun.feng@gmail.com> <20210726180657.142727-5-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210726180657.142727-5-boqun.feng@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210819_091359_811368_1987A209 X-CRM114-Status: GOOD ( 30.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Catalin and Will, Appreciate it that you can have a look at this one and patch #4, note that there exists an alternative solution at[1]. The difference is the way used to pass the corresponding ACPI device pointers for PCI host bridges: currently pci_config_window->parent is used, and this patch and patch #4 allow the field to be NULL, because Hyper-V's PCI host bridges don't have ACPI devices, while [1] changes to use pci_host_bridge->private. And I'm OK with either way, I don't have a strong opinion here ;-) Looking forwards to your suggestion, Thanks! Regards, Boqun [1]: https://lore.kernel.org/lkml/20210811153619.88922-1-boqun.feng@gmail.com/ On Tue, Jul 27, 2021 at 02:06:53AM +0800, Boqun Feng wrote: > 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. > > Use a NULL pointer as the ACPI device if there is no corresponding ACPI > device, and this is fine because: 1) ACPI_COMPANION_SET() can work with > the second parameter being NULL, 2) semantically, if a NULL pointer is > set via ACPI_COMPANION_SET(), ACPI_COMPANION() (the read API for this > field) will return NULL, and since ACPI_COMPANION() may return NULL, so > users must have handled the cases where it returns NULL, and 3) since > there is no corresponding ACPI device, it would be wrong to use any > other value here. > > Signed-off-by: Boqun Feng > --- > arch/arm64/kernel/pci.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c > index 5148ae242780..2276689b5411 100644 > --- a/arch/arm64/kernel/pci.c > +++ b/arch/arm64/kernel/pci.c > @@ -90,7 +90,17 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) > return 0; > > cfg = bridge->bus->sysdata; > - adev = to_acpi_device(cfg->parent); > + > + /* > + * On Hyper-V there is no corresponding ACPI device for a root bridge, > + * therefore ->parent is set as NULL by the driver. And set 'adev' as > + * NULL in this case because there is no proper ACPI device. > + */ > + if (!cfg->parent) > + adev = NULL; > + else > + adev = to_acpi_device(cfg->parent); > + > bus_dev = &bridge->bus->dev; > > ACPI_COMPANION_SET(&bridge->dev, adev); > -- > 2.32.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel