From patchwork Mon May 3 14:46:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12236067 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=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 BDF15C433ED for ; Mon, 3 May 2021 14:50:12 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 25699611C0 for ; Mon, 3 May 2021 14:50:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25699611C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=ZhzdlmAFJPVYRiFxmt5C9Md8KMJHp5miIXh1435NdtI=; b=njDk+3reORjS9FXTD1r3xEAsz 5yJGRma5Bpm2g2GUxMRpRprtJahByAZUT89iAhMZAamvDTIVXPhkYkOICRH2w1haE7kuyh/KZQ+u/ uUwn67Q552RgyR+Z9XPNROzCxSpqTWshjtji+kDABYawagf3rDtoRlEafTwUPuer6JlN/34K1v8Ia 5E8JVFel1oGHhjMxcrrSAz4qY3iYR+kovpiAHA1VZH7HIyul8Guoi/ldkSGyufisFYBFpx2synYeq n32/djI7IbhlJOA87uXyIYykADXMtui0p45bcLFATS4Fsfy7SegvL68HjxEtz1mj90nY+tpZB6Yb3 j1kTXArLQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldZsP-00E6n5-Nf; Mon, 03 May 2021 14:48:50 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrV-00E6YK-MF for linux-arm-kernel@desiato.infradead.org; Mon, 03 May 2021 14:47:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=QWGd3JZfCgq7eTKfJP0e8l8aGD/9nEGlQMt+hKKZY8A=; b=X80oQ+1u+AX8ILQEWB6pqSZol4 5Jn/PT5OYDt2L7QBxG5/57u7uQyq1W7phOjE98ahUsV1bIHUXKmOSIYQZjm4TL6z3J92tE7+o1cIi 58BSU2ddhyOQHgXSWF8tpvzojpZ3HA+hgKWmuF3roBKIYjjs1Qk2pDJxP2AnUPhHBBS6uc/3m6PDc WrnfdFwv6/uALzjx5KfJ2m+DTAMcerBwf+bmejbhP7wxt4DeqBoB9nT4BzbFrLlpAKabzSP/Iodhq Z5rJO8FamUMB9+V96MW7lKV9xiBjtBd244HE1nxOUgC+0UMO9Ui39siCoKt+KLIrIpomOR7GqmpZx fz+HMcSA==; Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrT-0038dS-3O for linux-arm-kernel@lists.infradead.org; Mon, 03 May 2021 14:47:52 +0000 Received: by mail-qv1-xf2e.google.com with SMTP id r13so2666448qvm.7 for ; Mon, 03 May 2021 07:47:50 -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=QWGd3JZfCgq7eTKfJP0e8l8aGD/9nEGlQMt+hKKZY8A=; b=pSkfiyb0wtubGvLMi2eXrfzDkJ5X9eLg/4Me5N9YOiME/jPpHKHSwGwsXH1+X1BcSb HlcPE2vOJFcg7orkh4S9K5GSwhd/ytSDy00syRcCCUuZYivKJFufAE/XWV1FFrf1jpeF mvjia0KQQmZcP/goMIGJknd325xKQCRhCUfJe3RmXEhAwNwRDxTmpJilBF4B3IXCF5+y wsq/KrzAA0bp2cXTqsVihNVSS66srFWnf6k73SF2VwwpNIVQfQVL9ilYFvzz8vWEk5Xg odwKKCYTmR32q4yH9WhxmerI/HiVkYMllNfDrTvVcP2inTA2602GZAfDPkF0xsq3KH5F 4WDg== 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=QWGd3JZfCgq7eTKfJP0e8l8aGD/9nEGlQMt+hKKZY8A=; b=Cy7DLDvM9i2iiPq4AWPWaTByQ0DlCHqQ4n89upHKaBT8ADjOI/bq2lvnLHAVBoDpR1 dJkJfzFOXsy9fFneGZsRvDh1keQkzJQegS8AlJT97uRrrARDERuiXv9TysF9kWkBIjZf HVcRWMTBMRHgFdSCoyWurZ3mOeyYPXbYmIhFs/rB8H2VNb/tSuqkhVno8sj3UxjBm9sJ ybTfAPYoVOV43c1zIIk5X79F13gS644WWGR5+CNovbEfE1BIOTvJLlvkYcdT/BHwJYNF ETP16O5oY8Ivpqr3mflQ2usqp8RPw5ebn/nZtJ1T54xB0kBOyOUrtx6GiFxlbvGj/eVr N3ZQ== X-Gm-Message-State: AOAM530vFIgLS5JdrFWFRSf+/g0oRT+fFRQ7vpWaZdj70916q8IOeYvE Xxwb5lbNi8FeFO3KihxazNo= X-Google-Smtp-Source: ABdhPJxGkDhQ4Z7gX1EcIbTfincvhtJ+ymk7z9TCLM44IZ4v0r18q4U9mIVYSELaANxcDuZJOCoJ4g== X-Received: by 2002:a0c:ea86:: with SMTP id d6mr16429735qvp.5.1620053270101; Mon, 03 May 2021 07:47:50 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id o12sm5247623qtq.96.2021.05.03.07.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 07:47:49 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id D923D27C0054; Mon, 3 May 2021 10:47:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 03 May 2021 10:47:48 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedvveetfefgiedutedtfeevvddvleekjeeuffffleeguefhhfejteekieeu ueelnecukfhppedufedurddutdejrddurddvheegnecuvehluhhsthgvrhfuihiivgepud enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Received: from localhost (unknown [131.107.1.254]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 May 2021 10:47:48 -0400 (EDT) From: Boqun Feng To: Bjorn Helgaas , Arnd Bergmann , Marc Zyngier Cc: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Lorenzo Pieralisi , Rob Herring , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Thomas Petazzoni , Boqun Feng , Mike Rapoport , Robin Murphy , Thomas Gleixner , Jon Derrick , Sunil Muthuswamy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [RFC v2 5/7] PCI: hv: Set up msi domain at bridge probing time Date: Mon, 3 May 2021 22:46:33 +0800 Message-Id: <20210503144635.2297386-6-boqun.feng@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503144635.2297386-1-boqun.feng@gmail.com> References: <20210503144635.2297386-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-20210503_074751_165167_82B86254 X-CRM114-Status: GOOD ( 17.59 ) 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 Since PCI_HYPERV depends on PCI_MSI_IRQ_DOMAIN which selects GENERIC_MSI_IRQ_DOMAIN, we can use dev_set_msi_domain() to set up the msi irq domain at probing time, and this works for both x86 and ARM64. Therefore use it as the preparation for ARM64 Hyper-V PCI support. As a result, there is no need to set the pci_sysdata::fwnode which is x86 specific. In addition, make hv_pcibus_device own the fwnode instead of sysdata to make the code generic. Signed-off-by: Boqun Feng --- drivers/pci/controller/pci-hyperv.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 05b73d5dfe9d..4ec7839d0adf 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -451,6 +451,7 @@ enum hv_pcibus_state { struct hv_pcibus_device { struct pci_sysdata sysdata; struct pci_host_bridge *bridge; + struct fwnode_handle *fwnode; /* Protocol version negotiated with the host */ enum pci_protocol_version_t protocol_version; enum hv_pcibus_state state; @@ -1571,7 +1572,7 @@ static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus) hbus->msi_info.handler = handle_edge_irq; hbus->msi_info.handler_name = "edge"; hbus->msi_info.data = hbus; - hbus->irq_domain = pci_msi_create_irq_domain(hbus->sysdata.fwnode, + hbus->irq_domain = pci_msi_create_irq_domain(hbus->fwnode, &hbus->msi_info, x86_vector_domain); if (!hbus->irq_domain) { @@ -1580,6 +1581,8 @@ static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus) return -ENODEV; } + dev_set_msi_domain(&hbus->bridge->dev, hbus->irq_domain); + return 0; } @@ -3147,9 +3150,9 @@ static int hv_pci_probe(struct hv_device *hdev, goto unmap; } - hbus->sysdata.fwnode = irq_domain_alloc_named_fwnode(name); + hbus->fwnode = irq_domain_alloc_named_fwnode(name); kfree(name); - if (!hbus->sysdata.fwnode) { + if (!hbus->fwnode) { ret = -ENOMEM; goto unmap; } @@ -3227,7 +3230,7 @@ static int hv_pci_probe(struct hv_device *hdev, free_irq_domain: irq_domain_remove(hbus->irq_domain); free_fwnode: - irq_domain_free_fwnode(hbus->sysdata.fwnode); + irq_domain_free_fwnode(hbus->fwnode); unmap: iounmap(hbus->cfg_addr); free_config: @@ -3325,7 +3328,7 @@ static int hv_pci_remove(struct hv_device *hdev) hv_free_config_window(hbus); hv_pci_free_bridge_windows(hbus); irq_domain_remove(hbus->irq_domain); - irq_domain_free_fwnode(hbus->sysdata.fwnode); + irq_domain_free_fwnode(hbus->fwnode); put_hvpcibus(hbus); wait_for_completion(&hbus->remove_event); destroy_workqueue(hbus->wq);