From patchwork Mon Jul 26 18:06:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12400451 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=-13.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,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 7C471C4338F for ; Mon, 26 Jul 2021 18:09:49 +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 4070060F91 for ; Mon, 26 Jul 2021 18:09:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4070060F91 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=j+3S/fTzu+pjkcyP9FdWkhdi8NuevIuLaFlTPjDSATk=; b=HT1eB8cCUdau8n qhY4Vb9QyOoC9zbAs8s+SuTE/MnUre4/j/j0CQQ8nBvFIOJCluvEz4EJ19r6cWohZGeYqCTr/AMWT JWPLBioEmBPEpWFRvAl5y1VvDgOaS+rsRGYooU8BFUpQwXCikIDVOtRa5uE9NDDGfZ9nKAVLIF3sL jd7jw2IlwBYKXfTa90zrjMDkanDzflxkjZ457WZd3o38h4j6sG41fM3qXA8O4ocpw0US4CV4+gjfB Xt0ASv/NEXxCh3MwDo09sLCegtBARBykG3t0k9eQB1aeWEuf8SWSrcFn8OkyqcjUi7P1BzRfagYds neNsF5z1TZ7IX7n7W4Aw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8518-00CBvJ-0X; Mon, 26 Jul 2021 18:07:54 +0000 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m850f-00CBnx-9a for linux-arm-kernel@lists.infradead.org; Mon, 26 Jul 2021 18:07:28 +0000 Received: by mail-io1-xd35.google.com with SMTP id l126so12972514ioa.12 for ; Mon, 26 Jul 2021 11:07:25 -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=1c0YHVVpshurDZxktAEbB6eItllT1ZgLTMwS/SNq12o=; b=UnIOIAZJUrGAXTOWCzN1UMMXXj4Y+n9S8YfEiw78eH1knvpO26QeIHGpvc3ECp5DOF 8uFGupNy4Wwsg0x+/ouySrZe0aBowIqg/ox/4WA35/M1jo1waN6vPTgCGCA2FPF2TM9U BegLQx4FJeSJLM5qabXk5tFna9jem6KfDr75kkriVy7afRUuRMfXHBT7CcQWNTlJicl2 MQTDYvBQT2qI0Ho+aAWgx6w+5gFNu0CZpbpEZ4QxRSerh94eVqP3kN6jfIWDY57d6WMe aUxnaaehoZaeKFGOKDH9nrQKqqtMLCRoM1VocV05psPd2OCpgOiqqE57kcdXchYulY1W SN3Q== 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=1c0YHVVpshurDZxktAEbB6eItllT1ZgLTMwS/SNq12o=; b=sh8k7MBHDivUy6cIdm3rN/fqP1spq3XrxBEzQwlzhyDLHsee6Wwz7UZG6UBLZ9cDvW Sov6rTbqddMUDbqTAl93zni41HDZv+eqmj+273qnq4TkEdvwl3vE3OVktgnyy1bj91H0 g58evHgmhnGr/cBqJhgfin3+TOb6Z/3L//1XrBjIDMz/dxf9bqO1EFh3cevioDLDWsTe BOgHXA7Ib++dAxKc8R/oIZblycTm3P5mo4Ggs7FX1DaZv7Jzk/nx4lXGYCXC8Qy0gD3r HanbIBk/DZ4ey87Mh+ddpn0nyorIx8uwdLyHvAcMAmjciHAQjaBE3BAP6Mn8gFrbKXQX 3q0w== X-Gm-Message-State: AOAM531MY46pr3VoV7b2Ek3b7YEKJAPkxHyvfk66kHtpq9wBq6wBkL8F PLC88T0fVPDZQ81MNaUrSwM= X-Google-Smtp-Source: ABdhPJy4DVeG+yNbFIVzEGfn5ZuDU5SR1maRI+Tc0qIy+0mRktuOsYlJdQSPYbAsLFUj8MH+a7Jl7g== X-Received: by 2002:a5e:924a:: with SMTP id z10mr15688350iop.35.1627322844639; Mon, 26 Jul 2021 11:07:24 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id j20sm316369ile.17.2021.07.26.11.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 11:07:24 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 4F23427C0066; Mon, 26 Jul 2021 14:07:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 26 Jul 2021 14:07:23 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrgeehgdduudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedvveetfefgiedutedtfeevvddvleekjeeuffffleeguefhhfejteekieeu ueelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsg hoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedtieeg qddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfhhigi hmvgdrnhgrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 26 Jul 2021 14:07:22 -0400 (EDT) From: Boqun Feng To: Bjorn Helgaas , Arnd Bergmann , Marc Zyngier , Lorenzo Pieralisi Cc: Catalin Marinas , Will Deacon , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Boqun Feng , 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 Subject: [PATCH v6 2/8] PCI: Support populating MSI domains of root buses via bridges Date: Tue, 27 Jul 2021 02:06:51 +0800 Message-Id: <20210726180657.142727-3-boqun.feng@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726180657.142727-1-boqun.feng@gmail.com> References: <20210726180657.142727-1-boqun.feng@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_110725_386112_56666910 X-CRM114-Status: GOOD ( 16.50 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently, at probing time, the MSI domains of root buses are populated if either the information of MSI domain is available from firmware (DT or ACPI), or arch-specific sysdata is used to pass the fwnode of the MSI domain. These two conditions don't cover all, e.g. Hyper-V virtual PCI on ARM64, which doesn't have the MSI information in the firmware and couldn't use arch-specific sysdata because running on an architecture with PCI_DOMAINS_GENERIC=y. To support populating MSI domains of the root buses at the probing when neither of the above condition is true, the ->msi_domain of the corresponding bridge device is used: in pci_host_bridge_msi_domain(), which should return the MSI domain of the root bus, the ->msi_domain of the corresponding bridge is fetched first as a potential value of the MSI domain of the root bus. In order to use the approach to populate MSI domains, the driver needs to dev_set_msi_domain() on the bridge before calling pci_register_host_bridge(), and makes sure GENERIC_MSI_IRQ_DOMAIN=y. Another advantage of this new approach is providing an arch-independent way to populate MSI domains, which allows sharing the driver code as much as possible between architectures. Originally-by: Arnd Bergmann Signed-off-by: Boqun Feng Acked-by: Bjorn Helgaas --- drivers/pci/probe.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 60c50d4f156f..ea7f2a57e2f5 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -829,11 +829,15 @@ static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus) { struct irq_domain *d; + /* If the host bridge driver sets a MSI domain of the bridge, use it */ + d = dev_get_msi_domain(bus->bridge); + /* * Any firmware interface that can resolve the msi_domain * should be called from here. */ - d = pci_host_bridge_of_msi_domain(bus); + if (!d) + d = pci_host_bridge_of_msi_domain(bus); if (!d) d = pci_host_bridge_acpi_msi_domain(bus);