From patchwork Mon May 3 14:46:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12236065 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=-8.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_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 0A113C433B4 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 67E30611C9 for ; Mon, 3 May 2021 14:50:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67E30611C9 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: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:In-Reply-To:References:List-Owner; bh=Rxy07DeXbTBTGqVDg0rRH/PMsq4NV8/lX957OkJtBrM=; b=OQaYju7MYOO1T7+JJDoJ9o1Tbg R0QN1V2rudmKZvVNzYOrUnx4VGyihR8vfFIaPKtKUMWVUdRpto+4nKIj6Ba4c2sM3cBydqHm6x70p AofbXbMyc35bKLgX9wXrguCnMR2KpttHmnFcrFe8ZALnSixPLg8sJayd6WGsy/ElQJGFfgXTAeze4 4CfTLIvEfKIPx6+GCZrOdr6Zf2xOZ3lrr8pTmVua9UR7zwSfVUyC4MbyjyUV4oJTzQq1fJUlkfro1 ilHbOEwYQIARQi8qUCavM1DTbdJgWFExHX8k5WRxxGtyOR33Q+FRi/8NnlhvG3TuMtVq4RMkeamVN YC/J5obg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrP-00E6Xr-Lb; Mon, 03 May 2021 14:47:47 +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 1ldZrM-00E6XO-Ar for linux-arm-kernel@desiato.infradead.org; Mon, 03 May 2021 14:47:44 +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:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=Cc7KqrSAJiYapYa5F88FOvtiyXEfLLsv6TzMqNJOvHw=; b=fyzibi3x4GcRxhfpma3JAS5I4J r564fl6JE6Zvxb2rPStJJ+MLKlgoMikVycg28RGL+TtjAXxnfdGyYxv9HEF7rejRKspT/MOv9p5tQ 2vNaaghHL+cwNHCeDX/AJIojtEnp7V+IpfckDFkYy5wUwTvpFaNWE8QuhK8zQEH3C/ihveBtzlk97 y37p/V6r8cvmrMOSYrRF75GkIC8HEv9gd/RXih295UACAasHV3bwJIy049B+bZwSS+5nndW+WrgLC 45L/XkVpnipBCRBeZ872xLex8McGFQIN349VeEEL8zInAX+8FpnFqKVCMT21gauo8DE5UvMJ2TE6P j8KyaQew==; Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrJ-0038an-Dg for linux-arm-kernel@lists.infradead.org; Mon, 03 May 2021 14:47:43 +0000 Received: by mail-qv1-xf29.google.com with SMTP id jm10so2668958qvb.5 for ; Mon, 03 May 2021 07:47:39 -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:mime-version :content-transfer-encoding; bh=Cc7KqrSAJiYapYa5F88FOvtiyXEfLLsv6TzMqNJOvHw=; b=P+4pjBqfZWYIzHy1idxXlZrLpeYBcNHZKynKI9jlWICV8xP2E+8MLza3PuZuneqLxK ru4RlOsW48q02q7bsO1xNCfWIxkqYyt8Z+zhvWJ0IpAMJzJI/vaWAcIohCTh3vMItnio 7OZkb8CJ6KYRty/U4Aoo30WUvCUN/7IN+1BO26IPMiMilpLTTwevnY3yTK2p5zg2PieO OQduz2EA0MD35EoKbUIzysUAwfES6Zteo3Kd0mKemVJQMmqIFcd8EQJJoXVMvBYycLW6 cQMzTxjByOW8+/xZEcvwuOskfEhCoM4h5gkf0jbLiZWJsyJTy5wygTHzvoEez+g3EcQs 2uyQ== 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:mime-version :content-transfer-encoding; bh=Cc7KqrSAJiYapYa5F88FOvtiyXEfLLsv6TzMqNJOvHw=; b=YRzc1IIbXf5PDyuwaN/yKm8jnafRz6xh/4Ui4uAqHoplvNA4dWs0PQCalDKCsgczVj puCP1im6tavAhuLqwUN7bwP4R7qx72CH3oXgJHBPcr9O1H1zQRhddORnuaScTMnRbNu3 60yQ1rk311+Lec0UxKMsZv+GvsENns+tRVNfulIrzqY5ZWrx7FGLM/nSPQf840cpthhC J3Ng2FA6uwwa3Gjd7/KTDveByyE8XuJCyKHhDRgPJYzzpytF7IW55BJFm3XvUmnPBZy8 ZgvOnJ9L+UWMOMOAFckHYXKOSBvlibTN34ohZAg5wmagJ2qeXAFeUMDlsA46N+/r4NwB uBHw== X-Gm-Message-State: AOAM532D4u3+rkK+oD0V6nlhAHSviL9xmu/EwVMrDrGGMxUD4eUuHwvG Wok9nvzmOZ2yg/zQvlzNJYM= X-Google-Smtp-Source: ABdhPJwXngsSyo5CxEf+ZbNm1Rt0FtFhYEyf3zUSNK+ua1xGBaxGy+0Pf40fzQEYJ+WZbXfENVdWDQ== X-Received: by 2002:ad4:4081:: with SMTP id l1mr20206807qvp.24.1620053258558; Mon, 03 May 2021 07:47:38 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id l6sm8559395qkk.130.2021.05.03.07.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 07:47:37 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 1826727C0054; Mon, 3 May 2021 10:47:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 03 May 2021 10:47:37 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhnucfh vghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrthhtvg hrnhepieeuveejleehudetfeevfeelgfejteefhedvkedukefggedugefhudfhteevjedu necuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepudefuddruddtjedruddrvd ehgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegs ohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeige dqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihig mhgvrdhnrghmvg X-ME-Proxy: Received: from localhost (unknown [131.107.1.254]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 May 2021 10:47:34 -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 0/7] PCI: hv: Support host bridge probing on ARM64 Date: Mon, 3 May 2021 22:46:28 +0800 Message-Id: <20210503144635.2297386-1-boqun.feng@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210503_074741_485709_7085EFA1 X-CRM114-Status: GOOD ( 16.04 ) 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 Hi Bjorn, Arnd and Marc, This is the updated version of my first try to prepare for virtual PCI support on Hyper-V ARM64: https://lore.kernel.org/lkml/20210319161956.2838291-1-boqun.feng@gmail.com/ , thanks a lot for your suggestions in the previous one. This is still more an RFC, and trying to see what I'm on the correct direction. The basic problem we need to resolve is that ARM64 is an arch with PCI_DOMAINS_GENERIC=y, so the bus sysdata is pci_config_window. However, Hyper-V PCI provides a paravirtualized PCI interface, so there is no actual pci_config_window for a PCI host bridge, so no information can be retrieve from the pci_config_window of a Hyper-V virtual PCI bus. This patchset mainly handle three things: 1) PCI domain number. As suggested by Bjorn and Arnd, I introduce a member in pci_host_bridge, and Hyper-V can use it to set up the correct PCI domain number for the bus, while others remain the same behavior. 2) MSI irq_domain. As suggested by Arnd, I use the GENERIC_MSI_IRQ_DOMAIN's dev_{set,get}_msi_domain() to allow Hyper-V set up the msi domain using generic code. 3) pcibios_root_bridge_prepare(). This one is new, PCI core will call this during host bridge register, and it will access the pci_config_window, luckily the only field it accesses it the parent field, and I change the ARM64's behavior to treat the acpi device as NULL if pci_config_window::parent is NULL, so that Hyper-V can provide a all-zeroed pci_config_window. With the above, we could enable the virtual PCI on Hyper-V ARM64 guest with other code under development. Comments and suggestions are welcome. Regards, Boqun Arnd Bergmann (1): PCI: hv: Generify PCI probing Boqun Feng (6): PCI: Introduce pci_host_bridge::domain_nr PCI: Allow msi domain set-up at host probing time PCI: hv: Use pci_host_bridge::domain_nr for PCI domain PCI: hv: Set up msi domain at bridge probing time PCI: arm64: Allow pci_config_window::parent to be NULL PCI: hv: Turn on the host bridge probing on ARM64 arch/arm/kernel/bios32.c | 2 + arch/arm/mach-dove/pcie.c | 2 + arch/arm/mach-mv78xx0/pcie.c | 2 + arch/arm/mach-orion5x/pci.c | 2 + arch/arm64/kernel/pci.c | 5 +- arch/mips/pci/pci-legacy.c | 2 + arch/mips/pci/pci-xtalk-bridge.c | 2 + drivers/pci/controller/pci-ftpci100.c | 2 + drivers/pci/controller/pci-hyperv.c | 90 +++++++++++++++------------ drivers/pci/controller/pci-mvebu.c | 2 + drivers/pci/pci.c | 4 +- drivers/pci/probe.c | 12 +++- include/linux/pci.h | 11 +++- 13 files changed, 89 insertions(+), 49 deletions(-)