From patchwork Wed Jun 9 16:32:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 1489983 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=qVgFnwbg; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4G0XhJ65r0z9sRf for ; Thu, 10 Jun 2021 02:32:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233878AbhFIQeZ (ORCPT ); Wed, 9 Jun 2021 12:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233840AbhFIQeW (ORCPT ); Wed, 9 Jun 2021 12:34:22 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70141C061574; Wed, 9 Jun 2021 09:32:21 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id b14so8352080iow.13; Wed, 09 Jun 2021 09:32:21 -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=42JnOdJokx7Och02Cf7RNqk0hUjrnHJDOmXKi7hmkA8=; b=qVgFnwbgVuXAbOztSYWDdMoeeu0L/eObqpS83NcZ3O06eQW1qMsIqueSHDcNCFi6EN cm2HGCjcGZ0ISxb78qDHCgs8Rr2dz9G0I2w6rC6S8iH9ue+bEKZInmQEkHrjiMM0XpKt ca8q98omXJxG0s5vEuGVGzKj5MGcXKN3KqiCRvcqjEoa+oUns9adsp/PcaxlmRdZT5+j 74vABjFXwVzD841MI27xuKPLZMlXOESx96O/cwU6eYbX302LkSD3/1PgtBhFPNiULbfT XTjdExQDfwbK/7JpJgoGSTxOG3J0rof7qeevWC2qKwEaCpZrPQKUlVs341GIJ/oOa2i3 GM3w== 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=42JnOdJokx7Och02Cf7RNqk0hUjrnHJDOmXKi7hmkA8=; b=F1Q2AY5Hn1SrM/AQ0UZDsBldV9hTE4sDNa4Ra9naJC6uXL3Po530EK/wVDoxHqxH/R r8LEGfknrDR6/+iSr/5JA7udkksP6hzfN6oTJXSMHPQrnIgeJ36CT12YPZJ/+rrBL7ZL d5Aws8tOk+WFVwEOA5hGzk3+oB9UJaywD/Lb/xhUicioN5zFbcWp428IVPcfAjvQOUj5 6Opp7ck1MZGBrRb6QxAUl6Kcg8QS9d1Pp7+Cm1Sxkj8wYbDttLyyPopNwl1gLW92craa v9LLrE7lmG9dHObXfh+Ua8kgDgClwnWCW9QjQrf77PjMynjTLL3DPJxyzA5tVBT21XKT peXQ== X-Gm-Message-State: AOAM530Mgzyf9hdwuRBzIO9xrGxRr/SQ0DQ3xGInxedqMfZ5f1rWzrQd MvxvtjV+/0qhf6OUY6xM/KQ= X-Google-Smtp-Source: ABdhPJxcqj+WXs35mm8AkaAEN9mW9wi2tCnnEiv6kQtMaPkhaByp9p8TEuHPogLCtJsdOOJ4C8aL1Q== X-Received: by 2002:a05:6638:2202:: with SMTP id l2mr485439jas.98.1623256340420; Wed, 09 Jun 2021 09:32:20 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id w11sm255942ilv.14.2021.06.09.09.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 09:32:20 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id E22C827C005B; Wed, 9 Jun 2021 12:32:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 09 Jun 2021 12:32:18 -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:17 -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 1/7] PCI: Introduce domain_nr in pci_host_bridge Date: Thu, 10 Jun 2021 00:32:05 +0800 Message-Id: <20210609163211.3467449-2-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 we retrieve the PCI domain number of the host bridge from the bus sysdata (or pci_config_window if PCI_DOMAINS_GENERIC=y). Actually we have the information at PCI host bridge probing time, and it makes sense that we store it into pci_host_bridge. One benefit of doing so is the requirement for supporting PCI on Hyper-V for ARM64, because the host bridge of Hyper-V doesn't have pci_config_window, whereas ARM64 is a PCI_DOMAINS_GENERIC=y arch, so we cannot retrieve the PCI domain number from pci_config_window on ARM64 Hyper-V guest. As the preparation for ARM64 Hyper-V PCI support, we introduce the domain_nr in pci_host_bridge and a sentinel value to allow drivers to set domain numbers properly at probing time. Currently CONFIG_PCI_DOMAINS_GENERIC=y archs are only users of this newly-introduced field. Signed-off-by: Boqun Feng --- drivers/pci/probe.c | 4 +++- include/linux/pci.h | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 275204646c68..d2753097a1b0 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -594,6 +594,7 @@ static void pci_init_host_bridge(struct pci_host_bridge *bridge) bridge->native_pme = 1; bridge->native_ltr = 1; bridge->native_dpc = 1; + bridge->domain_nr = PCI_DOMAIN_NR_NOT_SET; device_initialize(&bridge->dev); } @@ -898,7 +899,8 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) bus->ops = bridge->ops; bus->number = bus->busn_res.start = bridge->busnr; #ifdef CONFIG_PCI_DOMAINS_GENERIC - bus->domain_nr = pci_bus_find_domain_nr(bus, parent); + if (bridge->domain_nr == PCI_DOMAIN_NR_NOT_SET) + bus->domain_nr = pci_bus_find_domain_nr(bus, parent); #endif b = pci_find_bus(pci_domain_nr(bus), bridge->busnr); diff --git a/include/linux/pci.h b/include/linux/pci.h index 24306504226a..d85d41b5abbd 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -526,6 +526,15 @@ static inline int pci_channel_offline(struct pci_dev *pdev) return (pdev->error_state != pci_channel_io_normal); } +/* + * PCI Conventional has at most 256 PCI bus segments and PCI Express has at + * most 65536 "PCI Segments Groups", therefore -1 is not a valid PCI domain + * number, and can be used as a sentinel value indicating ->domain_nr is not + * set by the driver (and CONFIG_PCI_DOMAINS_GENERIC=y can set it in generic + * code). + */ +#define PCI_DOMAIN_NR_NOT_SET (-1) + struct pci_host_bridge { struct device dev; struct pci_bus *bus; /* Root bus */ @@ -533,6 +542,7 @@ struct pci_host_bridge { struct pci_ops *child_ops; void *sysdata; int busnr; + int domain_nr; struct list_head windows; /* resource_entry */ struct list_head dma_ranges; /* dma ranges resource list */ u8 (*swizzle_irq)(struct pci_dev *, u8 *); /* Platform IRQ swizzler */ From patchwork Wed Jun 9 16:32:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 1489987 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=VzXVi+aP; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4G0XjH543lz9sRf for ; Thu, 10 Jun 2021 02:33:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234732AbhFIQfQ (ORCPT ); Wed, 9 Jun 2021 12:35:16 -0400 Received: from mail-io1-f42.google.com ([209.85.166.42]:35438 "EHLO mail-io1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233934AbhFIQfQ (ORCPT ); Wed, 9 Jun 2021 12:35:16 -0400 Received: by mail-io1-f42.google.com with SMTP id d9so23409620ioo.2; Wed, 09 Jun 2021 09:33:21 -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=h6/SeYfOWSphhPUzzUCOjWtJORlKfdGfIiP9ztyD/8s=; b=VzXVi+aP/kh7qxv56RdgMxAYCmt5nnDhOgudMEpuUcIKcvzShAfp01wYRDjMjsLmqy xMmx+fFZbLUFtlfq+iN+jQ6JFFjX04Qk8w6HR9VE5VV3M4kbZc+7za+Xoo5H03lkkTB9 blGt9ZzjHe4h1jMsU4wWYoVNgcdS9eJvh6qsHcX/9nmw7G7bNWr/uHe3m5uaJbB0Tg/H E5IrYL3OJ8VQyo7rsUqZcqIAfEwOAJgxwY3lHIiB6ari5063pTmWT56WJAjRdPUgNFrz odriMPk0pPLdW1r0HzGZ+Evxa4R/tQkWlXPebuWowEzMBsADddrNYEsFc4VMjN3jkEEr kutg== 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=h6/SeYfOWSphhPUzzUCOjWtJORlKfdGfIiP9ztyD/8s=; b=heZt7/CuNpOsJNmBWFZ+meT4gyQqfHPeXlFgVjf4w8zA0zz+FQgqQfDF6neOnwqxQ4 B38N1RG0m9JzjwXGnbZGXpOvhAFiPmn+bpVHH/z/8ZMf2qhPfb+ro460zltazAgEPxAT ihfa9V2wl70yOuGqJFvXbS0ZLdyt2Pu1Z/EwYsZZYuf10puFardIkt3dYFRzkCVtYGP2 ESG8rorQlvajI9atbG9pgpA8NzuPnTZFKmLbrSCI3acPO7Pu+RqTOXpWFys3m6/DYp9N JIJldPkEEubbHOIVFh3yDoD3zEqsFQ3+X3g24i+xOKzvZwGdNDl73FUZ1sHsOuXu5b1I O0tw== X-Gm-Message-State: AOAM531eTDyfI8uCGfkdHEwqlSk1UBJG5qYrqLLVXqxbaFwlCAq/3cey SJw2sJbd7wZ5V7/sSJuFJP4= X-Google-Smtp-Source: ABdhPJxTGsMwJckSOcHPUfZkQMSOylbN7ZjTcunLm5nQTVNYS9kSiq81BVkc6A3EWg7CyKw7qvnZ4A== X-Received: by 2002:a5e:860f:: with SMTP id z15mr227163ioj.193.1623256341541; Wed, 09 Jun 2021 09:32:21 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id j18sm251468ila.29.2021.06.09.09.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 09:32:21 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 2A12327C005C; Wed, 9 Jun 2021 12:32:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 09 Jun 2021 12:32:20 -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:19 -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 , Arnd Bergmann Subject: [RFC v3 2/7] PCI: Allow msi domain set-up at host probing time Date: Thu, 10 Jun 2021 00:32:06 +0800 Message-Id: <20210609163211.3467449-3-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 For GENERIC_MSI_IRQ_DOMAIN drivers, we can set up the msi domain via dev_set_msi_domain() at probing time, and drivers can use this more generic way to set up the msi domain for the host bridge. This is the preparation for ARM64 Hyper-V PCI support. Originally-by: Arnd Bergmann Signed-off-by: Boqun Feng --- drivers/pci/probe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index d2753097a1b0..38bee41dedcc 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -829,11 +829,14 @@ static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus) { struct irq_domain *d; + /* Default set by host bridge driver */ + 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); From patchwork Wed Jun 9 16:32:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 1489985 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=IVlt30w8; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4G0XhS3s60z9sRf for ; Thu, 10 Jun 2021 02:32:40 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234345AbhFIQed (ORCPT ); Wed, 9 Jun 2021 12:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234131AbhFIQec (ORCPT ); Wed, 9 Jun 2021 12:34:32 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76839C06175F; Wed, 9 Jun 2021 09:32:23 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id q7so23440554iob.4; Wed, 09 Jun 2021 09:32:23 -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=vqBveVW+QXtLYaHB7yqWFO//rHtu2kTppz7aYTPDGpI=; b=IVlt30w8gXUQQVpoIG8k7AhJU4bKQn4HR7uLbTBl/+JgID4AnYciYfQujYnqikZTl0 blVMEyOmhj1ICGRi/q9eNomk6Mg3T0rn0KlTDQmmRJZfrpk/U/f72QO27WaOBYVtbOFk CrUvyGBbBBKIJmcLfUr4Gp2NfxZxlmuAksfQTnp1EN3lZ7p3MHv3DiUOBuvYo8zRoArK k6SKJ4V6YLrbYFccW5kFhhwP87v//gL/xRVFY03m1MADyq1VrV//EXOhjtBSlipuT6pu ydyhkAYGHD5PcbFajgSrs8giXNftnxNkDsRE3gwN3lj3lLEqim60Lv+8VBF6fjLAlGLM eOBg== 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=vqBveVW+QXtLYaHB7yqWFO//rHtu2kTppz7aYTPDGpI=; b=uaRSOi3M4AnOLaKAqpsW77Yw7/7P+KLaD1mQ/TXpie3gMstSTv4mJLF1gGkNW9mNTk omofn0yN5sGcT9Oa44xtTtey7HysRBdJqPtHNurjrVxAQ85Qz+xwVt8Y7GM7cpCiQAF+ ildRM0jus2FPj4WnoG1fk60ntCw8jSIqPUaT+ZahQQ66hClX1IT4TKA+ec0Sf/XPWK4l Fd/VO0VHrvJ6uSK9sn7xFcQ8MiJgXVzY1dFEgqZr3c4zrfwnJvssga7F47bLTAZrLPmm wWZ5OMj0fgdI/VqsmpxROfsW/1PZrylLggNBcF0ELPZOs3BNF/flXkC2CpzbKba1PwsU dkEg== X-Gm-Message-State: AOAM532v2UiDE7g4q/ArXkef01KTmpo+IcQIoxUhvwsVlS9IEWO2PHIl yH+IiDzeyc51wigCdemPths= X-Google-Smtp-Source: ABdhPJz1gIAsh3FzP6RRQPelu9Vh+/ATzj3yw+zK9wSyf2wONV6zQZAPcTZQ8AUUthktTSAXzbgXFQ== X-Received: by 2002:a02:2a8c:: with SMTP id w134mr469641jaw.138.1623256342893; Wed, 09 Jun 2021 09:32:22 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id j18sm230844ioo.3.2021.06.09.09.32.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 09:32:22 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailauth.nyi.internal (Postfix) with ESMTP id 9286727C005B; Wed, 9 Jun 2021 12:32:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 09 Jun 2021 12:32:21 -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:20 -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 , Arnd Bergmann Subject: [RFC v3 3/7] PCI: hv: Generify PCI probing Date: Thu, 10 Jun 2021 00:32:07 +0800 Message-Id: <20210609163211.3467449-4-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 From: Arnd Bergmann In order to support ARM64 Hyper-V PCI, we need to set up the bridge at probing time because ARM64 is a PCI_DOMAIN_GENERIC arch and we don't have pci_config_window (ARM64 sysdata) for a PCI root bus on Hyper-V, so it's impossible to retrieve the information (e.g. PCI domains, irq domains) from bus sysdata on ARM64 after creation. Originally in create_root_hv_pci_bus(), pci_create_root_bus() is used to create the root bus and the corresponding bridge based on x86 sysdata. Now we create a bridge first and then call pci_scan_root_bus_bridge(), which allows us to do the necessary set-ups for the bridge. Signed-off-by: Arnd Bergmann Signed-off-by: Boqun Feng --- drivers/pci/controller/pci-hyperv.c | 58 +++++++++++++++-------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 6511648271b2..ee9f8e27e2e8 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -450,6 +450,7 @@ enum hv_pcibus_state { struct hv_pcibus_device { struct pci_sysdata sysdata; + struct pci_host_bridge *bridge; /* Protocol version negotiated with the host */ enum pci_protocol_version_t protocol_version; enum hv_pcibus_state state; @@ -462,13 +463,10 @@ struct hv_pcibus_device { struct resource *high_mmio_res; struct completion *survey_event; struct completion remove_event; - struct pci_bus *pci_bus; spinlock_t config_lock; /* Avoid two threads writing index page */ spinlock_t device_list_lock; /* Protect lists below */ void __iomem *cfg_addr; - struct list_head resources_for_children; - struct list_head children; struct list_head dr_list; @@ -1803,7 +1801,7 @@ static void hv_pci_assign_slots(struct hv_pcibus_device *hbus) slot_nr = PCI_SLOT(wslot_to_devfn(hpdev->desc.win_slot.slot)); snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser); - hpdev->pci_slot = pci_create_slot(hbus->pci_bus, slot_nr, + hpdev->pci_slot = pci_create_slot(hbus->bridge->bus, slot_nr, name, NULL); if (IS_ERR(hpdev->pci_slot)) { pr_warn("pci_create slot %s failed\n", name); @@ -1833,7 +1831,7 @@ static void hv_pci_remove_slots(struct hv_pcibus_device *hbus) static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) { struct pci_dev *dev; - struct pci_bus *bus = hbus->pci_bus; + struct pci_bus *bus = hbus->bridge->bus; struct hv_pci_dev *hv_dev; list_for_each_entry(dev, &bus->devices, bus_list) { @@ -1856,21 +1854,22 @@ static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) */ static int create_root_hv_pci_bus(struct hv_pcibus_device *hbus) { - /* Register the device */ - hbus->pci_bus = pci_create_root_bus(&hbus->hdev->device, - 0, /* bus number is always zero */ - &hv_pcifront_ops, - &hbus->sysdata, - &hbus->resources_for_children); - if (!hbus->pci_bus) - return -ENODEV; + int error; + struct pci_host_bridge *bridge = hbus->bridge; + + bridge->dev.parent = &hbus->hdev->device; + bridge->sysdata = &hbus->sysdata; + bridge->ops = &hv_pcifront_ops; + + error = pci_scan_root_bus_bridge(bridge); + if (error) + return error; pci_lock_rescan_remove(); - pci_scan_child_bus(hbus->pci_bus); hv_pci_assign_numa_node(hbus); - pci_bus_assign_resources(hbus->pci_bus); + pci_bus_assign_resources(bridge->bus); hv_pci_assign_slots(hbus); - pci_bus_add_devices(hbus->pci_bus); + pci_bus_add_devices(bridge->bus); pci_unlock_rescan_remove(); hbus->state = hv_pcibus_installed; return 0; @@ -2135,7 +2134,7 @@ static void pci_devices_present_work(struct work_struct *work) * because there may have been changes. */ pci_lock_rescan_remove(); - pci_scan_child_bus(hbus->pci_bus); + pci_scan_child_bus(hbus->bridge->bus); hv_pci_assign_numa_node(hbus); hv_pci_assign_slots(hbus); pci_unlock_rescan_remove(); @@ -2306,8 +2305,8 @@ static void hv_eject_device_work(struct work_struct *work) /* * Ejection can come before or after the PCI bus has been set up, so * attempt to find it and tear down the bus state, if it exists. This - * must be done without constructs like pci_domain_nr(hbus->pci_bus) - * because hbus->pci_bus may not exist yet. + * must be done without constructs like pci_domain_nr(hbus->bridge->bus) + * because hbus->bridge->bus may not exist yet. */ wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); pdev = pci_get_domain_bus_and_slot(hbus->sysdata.domain, 0, wslot); @@ -2676,8 +2675,7 @@ static int hv_pci_allocate_bridge_windows(struct hv_pcibus_device *hbus) /* Modify this resource to become a bridge window. */ hbus->low_mmio_res->flags |= IORESOURCE_WINDOW; hbus->low_mmio_res->flags &= ~IORESOURCE_BUSY; - pci_add_resource(&hbus->resources_for_children, - hbus->low_mmio_res); + pci_add_resource(&hbus->bridge->windows, hbus->low_mmio_res); } if (hbus->high_mmio_space) { @@ -2696,8 +2694,7 @@ static int hv_pci_allocate_bridge_windows(struct hv_pcibus_device *hbus) /* Modify this resource to become a bridge window. */ hbus->high_mmio_res->flags |= IORESOURCE_WINDOW; hbus->high_mmio_res->flags &= ~IORESOURCE_BUSY; - pci_add_resource(&hbus->resources_for_children, - hbus->high_mmio_res); + pci_add_resource(&hbus->bridge->windows, hbus->high_mmio_res); } return 0; @@ -3027,6 +3024,7 @@ static void hv_put_dom_num(u16 dom) static int hv_pci_probe(struct hv_device *hdev, const struct hv_vmbus_device_id *dev_id) { + struct pci_host_bridge *bridge; struct hv_pcibus_device *hbus; u16 dom_req, dom; char *name; @@ -3039,6 +3037,10 @@ static int hv_pci_probe(struct hv_device *hdev, */ BUILD_BUG_ON(sizeof(*hbus) > HV_HYP_PAGE_SIZE); + bridge = devm_pci_alloc_host_bridge(&hdev->device, 0); + if (!bridge) + return -ENOMEM; + /* * With the recent 59bb47985c1d ("mm, sl[aou]b: guarantee natural * alignment for kmalloc(power-of-two)"), kzalloc() is able to allocate @@ -3060,6 +3062,8 @@ static int hv_pci_probe(struct hv_device *hdev, hbus = kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL); if (!hbus) return -ENOMEM; + + hbus->bridge = bridge; hbus->state = hv_pcibus_init; hbus->wslot_res_allocated = -1; @@ -3097,7 +3101,6 @@ static int hv_pci_probe(struct hv_device *hdev, refcount_set(&hbus->remove_lock, 1); INIT_LIST_HEAD(&hbus->children); INIT_LIST_HEAD(&hbus->dr_list); - INIT_LIST_HEAD(&hbus->resources_for_children); spin_lock_init(&hbus->config_lock); spin_lock_init(&hbus->device_list_lock); spin_lock_init(&hbus->retarget_msi_interrupt_lock); @@ -3303,9 +3306,9 @@ static int hv_pci_remove(struct hv_device *hdev) if (hbus->state == hv_pcibus_installed) { /* Remove the bus from PCI's point of view. */ pci_lock_rescan_remove(); - pci_stop_root_bus(hbus->pci_bus); + pci_stop_root_bus(hbus->bridge->bus); hv_pci_remove_slots(hbus); - pci_remove_root_bus(hbus->pci_bus); + pci_remove_root_bus(hbus->bridge->bus); pci_unlock_rescan_remove(); hbus->state = hv_pcibus_removed; } @@ -3316,7 +3319,6 @@ static int hv_pci_remove(struct hv_device *hdev) iounmap(hbus->cfg_addr); hv_free_config_window(hbus); - pci_free_resource_list(&hbus->resources_for_children); hv_pci_free_bridge_windows(hbus); irq_domain_remove(hbus->irq_domain); irq_domain_free_fwnode(hbus->sysdata.fwnode); @@ -3402,7 +3404,7 @@ static int hv_pci_restore_msi_msg(struct pci_dev *pdev, void *arg) */ static void hv_pci_restore_msi_state(struct hv_pcibus_device *hbus) { - pci_walk_bus(hbus->pci_bus, hv_pci_restore_msi_msg, NULL); + pci_walk_bus(hbus->bridge->bus, hv_pci_restore_msi_msg, NULL); } static int hv_pci_resume(struct hv_device *hdev) From patchwork Wed Jun 9 16:32:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 1489989 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=FEur/cmK; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4G0Xjb1WwQz9sRN for ; Thu, 10 Jun 2021 02:33:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234054AbhFIQfc (ORCPT ); Wed, 9 Jun 2021 12:35:32 -0400 Received: from mail-io1-f44.google.com ([209.85.166.44]:36507 "EHLO mail-io1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235211AbhFIQfa (ORCPT ); Wed, 9 Jun 2021 12:35:30 -0400 Received: by mail-io1-f44.google.com with SMTP id s19so13669229ioc.3; Wed, 09 Jun 2021 09:33:24 -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=1VxZA1hOFGfFK+vjOpS6yCsaoNwIfiljMaf64AqSDfI=; b=FEur/cmKBsioloDLkauRtbBKVtl+caWc3kOqD3+wTib2WiNL7QNiXDLe0e2j50FZOh b1PKYz4nByqiO09xpfXkLeu95yW+tGKLegWwskgzsNdQZEwVVxAQ1W5hNxRxTpTzzIcL rvQuRgCouD1yjkavWd8IGGbbsIwLGS9yUg+jur11KCrqG9N8aqElmk1IW4OxyFyKkra/ RUDuTMlwjcIyFaIULPNeDL9VW/8R1Ouzp/Gy7ZGsDtcg9Yfo6VEMaL+QrrD/R94VjF0B R8lrEVy3ehZE6E2CnQnCE27+hxXhSMPqjY1pJXd+uohFbZeQMJYyOUASIuVECp/Ssm1t N3pw== 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=1VxZA1hOFGfFK+vjOpS6yCsaoNwIfiljMaf64AqSDfI=; b=bFHTndGKYqLwTl8sW2ZbS5R49m4bI8gwbSuJuCyNCSsbFHoaupQfKalfVF1QfKEA6g uPycnesCO0HtlbxFMIuCXhIo5BSMg0oCXbh7UGgsk8dIpMnPw0CYEeFjl97+0/mrO4IA 6IkAEQ3ratwJcUNNNz2YCWTr/1/z2Ig6LhvBQnPImzuPVkUmp4sbdvg+88FuZancjySd g4+kzGEF4vpi8tUwv0Syor+8vJ9ElnusT1Wy/P/Edt6gppEN4E7BZmwIRaEubEL7BEYc FrYqeuO5z5ayTJLW3bk11HuBeGe+JsFAInZdl9yr0oynFQow1k51VnlEbxW1abuFfFmo T2HA== X-Gm-Message-State: AOAM532856TDav5/na5GCteXkwM3TOdiNSl4rU5XKAIIZWJyNvUEPsRT ghzDZJM91ZSYcJYs6bOPemE= X-Google-Smtp-Source: ABdhPJwDNhbpuCkL/OdOC3pA3sAMZxtbTpMrWkq91DrOfhSQHKnVE0o5WXQ+N5F3mTOS6xBSbbjO0w== X-Received: by 2002:a6b:7d0b:: with SMTP id c11mr274416ioq.8.1623256344068; Wed, 09 Jun 2021 09:32:24 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id x21sm234208ioa.36.2021.06.09.09.32.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 09:32:23 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id A8F0427C005C; Wed, 9 Jun 2021 12:32:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 09 Jun 2021 12:32:22 -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:22 -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 4/7] PCI: hv: Use pci_host_bridge::domain_nr for PCI domain Date: Thu, 10 Jun 2021 00:32:08 +0800 Message-Id: <20210609163211.3467449-5-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 No functional change, just store and maintain the PCI domain number in the generic pci_host_bridge instead of x86 specific pci_sysdata. Signed-off-by: Boqun Feng --- drivers/pci/controller/pci-hyperv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index ee9f8e27e2e8..f9a644ae3b74 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -2309,7 +2309,7 @@ static void hv_eject_device_work(struct work_struct *work) * because hbus->bridge->bus may not exist yet. */ wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); - pdev = pci_get_domain_bus_and_slot(hbus->sysdata.domain, 0, wslot); + pdev = pci_get_domain_bus_and_slot(hbus->bridge->domain_nr, 0, wslot); if (pdev) { pci_lock_rescan_remove(); pci_stop_and_remove_bus_device(pdev); @@ -3095,6 +3095,7 @@ static int hv_pci_probe(struct hv_device *hdev, "PCI dom# 0x%hx has collision, using 0x%hx", dom_req, dom); + hbus->bridge->domain_nr = dom; hbus->sysdata.domain = dom; hbus->hdev = hdev; @@ -3106,7 +3107,7 @@ static int hv_pci_probe(struct hv_device *hdev, spin_lock_init(&hbus->retarget_msi_interrupt_lock); init_completion(&hbus->remove_event); hbus->wq = alloc_ordered_workqueue("hv_pci_%x", 0, - hbus->sysdata.domain); + hbus->bridge->domain_nr); if (!hbus->wq) { ret = -ENOMEM; goto free_dom; @@ -3233,7 +3234,7 @@ static int hv_pci_probe(struct hv_device *hdev, destroy_wq: destroy_workqueue(hbus->wq); free_dom: - hv_put_dom_num(hbus->sysdata.domain); + hv_put_dom_num(hbus->bridge->domain_nr); free_bus: kfree(hbus); return ret; @@ -3326,7 +3327,7 @@ static int hv_pci_remove(struct hv_device *hdev) wait_for_completion(&hbus->remove_event); destroy_workqueue(hbus->wq); - hv_put_dom_num(hbus->sysdata.domain); + hv_put_dom_num(hbus->bridge->domain_nr); kfree(hbus); return ret; From patchwork Wed Jun 9 16:32:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 1489982 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=mInlmwAL; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4G0XhF72dmz9sRN for ; Thu, 10 Jun 2021 02:32:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232602AbhFIQeU (ORCPT ); Wed, 9 Jun 2021 12:34:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232165AbhFIQeU (ORCPT ); Wed, 9 Jun 2021 12:34:20 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 905E2C061760; Wed, 9 Jun 2021 09:32:25 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id l64so1741574ioa.7; Wed, 09 Jun 2021 09:32: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=2QP+aooIgaNykddMTYMcLiVqjqY2nSO7f91rbFSftQ4=; b=mInlmwALviaiYQUx0afzCiTgkb1BiLfdzItjjT8qdPxWiKCDX3dCjGHRzO0Tt+HUFY BcGxAXmlc1CkORATdMGP3ICTSNP/KXm8xChX7xQzWLC1GLK/qqEnCj8Z9IDUxSrrfVcf s64aIlpzjyUJ8PvUMnAxHduxRYzCZMf2uRA4reJlq2wmw4y/9xSXDiB4ul+4+g8lbqyO C/9NpzgvkRWy1MsupRWxQcunEQpreUNdjd2z1ybVqbJKMtS4fS2HAAzBnLIwfSTAnPpX swwFSWafvo6+NCro9jsw2sV3K4ZWLfX90JxO82ihm7dAyyPfSof9ifx/EVSkQ++aWxnv SQ+g== 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=2QP+aooIgaNykddMTYMcLiVqjqY2nSO7f91rbFSftQ4=; b=U5uMqnDLr1SokEkhDI3cmy6cJaIfZ3JoUFa1p9PKttPiK2DQh9N4+mHlLdaMt5RTAl EydHErVajH4otaS8Rg5HkpjgRV79wRF/S8eOEYU+/Q9jG1e8RzqQIAQtJUySOjN5l+lh dUsWZ/So4s2uhe9h7W9yFE57UThFGwcDiGurkfnQW9mu5t4pmoRYMc1EexnJS9G70I1E pk4EohC1JNo0X57qQ52umotSjNjeb+99K7+ZGDSzZJ6R2lxRIAc7wyRkYTniIm8W/027 Ag4L8RMQkT3P5XeGn2cf+NzqYc2Jz6h+mDredNOTcc71tgw6XZ1wietBTlyo1S7DPInU neNw== X-Gm-Message-State: AOAM531q5dpK/fJLJtnU6b9CxFbTPMSazlYsIh7au8tKOwgNeUdHLbuy 9UJHmnhq49/9HCcm0RiE5pc= X-Google-Smtp-Source: ABdhPJy8E2PUp9QlOixOC91R/fd1nmvZB+codXg5z54MPEev8olrDFKgxrTKo1fnZuUktaWnMuSMzA== X-Received: by 2002:a6b:5b06:: with SMTP id v6mr267414ioh.84.1623256345056; Wed, 09 Jun 2021 09:32:25 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id h20sm270056ilo.34.2021.06.09.09.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 09:32:24 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id C4DEE27C005B; Wed, 9 Jun 2021 12:32:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 09 Jun 2021 12:32:23 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduuddguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeehvdevteefgfeiudettdefvedvvdelkeejueffffelgeeuhffhjeetkeei ueeuleenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Jun 2021 12:32:23 -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 5/7] PCI: hv: Set up msi domain at bridge probing time Date: Thu, 10 Jun 2021 00:32:09 +0800 Message-Id: <20210609163211.3467449-6-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 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 f9a644ae3b74..16a779ab9ed4 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; @@ -1570,7 +1571,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) { @@ -1579,6 +1580,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; } @@ -3144,9 +3147,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; } @@ -3224,7 +3227,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: @@ -3322,7 +3325,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); 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); From patchwork Wed Jun 9 16:32:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 1489986 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=IL895TA+; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4G0Xhb1wspz9sRf for ; Thu, 10 Jun 2021 02:32:47 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234114AbhFIQek (ORCPT ); Wed, 9 Jun 2021 12:34:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234732AbhFIQei (ORCPT ); Wed, 9 Jun 2021 12:34:38 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6593EC0617A6; Wed, 9 Jun 2021 09:32:28 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id 5so23406635ioe.1; Wed, 09 Jun 2021 09:32:28 -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=15t7ZKTSX9WU503SVEKMIKymOsp0yb03DbikdqeGm38=; b=IL895TA+hvrX3n0qdh9JJZDlsA+zMM40QHD9YuLGcFvWyFmOBbWr0lwsaAEA/sDP3K iFVOzZzN8SgYt1T/Imb/+iyDliuKqHw3rq4mBWgspDpmiKr06PA6iLRSvIt3hJB4O1aY toqIyYe8lCVdoENWwYcnZwWSV+xVpKpFiMnbwCmTqhaDKg6ynHNUHy+4iqZkdyC9pr61 IZ7qNz3LEV6Ip/F18DKU7VLSouVvRLCcd/xmj5hUBWpvkH8y9VvsFDhs2h0qpbpq4lVg rwdBYEpcXvk37O5uAA6bRMrGKBTlcMygnp+qYboJC1W7sp1RKrUtXJsqhZU90Lw0YmG0 tipg== 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=15t7ZKTSX9WU503SVEKMIKymOsp0yb03DbikdqeGm38=; b=f8t8VJg5cTanUpEYvbj8DXKrMRaMbCGkN2CK2MYA4cawdZgPwWLwV1twHtbqlHgSnM MpI492vA/QZHjwUNXD3pPQciyHAweCHG/uQx9agDHYxocfAsgntZdr57V7RKXI5d7bFp D1jHUOuIxTeaSYqn8xy+NmMHwgDxavHQJWeOfUI171qT1+CPcnI6UTOThBskyELHbMzU ZV52cv0ZI3wfWVl/iggG90WCbaibKlHz8FV2TEKcachFC7JDqVNtUUqQVKcnMpFWn1tv H7j9zwmrA0skC/I/ZWf/3eEU0JbPc7yHNlovgibRUxPO4f7Gf2RJL3KNwDQ00Y9X9SeX dGuQ== X-Gm-Message-State: AOAM531hk9UvxN5oNU0L9BD2oRgOf1dyOkqPQnL2QIvKYeqVUpC8Smtb oTrBpPdMWlAWKzcj80spFQQ= X-Google-Smtp-Source: ABdhPJyhgEqY3+4woUSGc66Hoo7NTM4a2l3JyXWUFWWECsf/CaRguxBXkWADIBSg3+gt9uwmlaziiQ== X-Received: by 2002:a05:6638:2725:: with SMTP id m37mr461409jav.121.1623256347937; Wed, 09 Jun 2021 09:32:27 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id i7sm263328ilb.67.2021.06.09.09.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 09:32:27 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 7184D27C005C; Wed, 9 Jun 2021 12:32:26 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 09 Jun 2021 12:32:26 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduuddguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeehvdevteefgfeiudettdefvedvvdelkeejueffffelgeeuhffhjeetkeei ueeuleenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Jun 2021 12:32:26 -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 7/7] PCI: hv: Turn on the host bridge probing on ARM64 Date: Thu, 10 Jun 2021 00:32:11 +0800 Message-Id: <20210609163211.3467449-8-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 Now we have everything we need, just provide a proper sysdata type for the bus to use on ARM64 and everything else works. Signed-off-by: Boqun Feng --- drivers/pci/controller/pci-hyperv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 16a779ab9ed4..271d0b6d4796 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -449,7 +450,11 @@ enum hv_pcibus_state { }; struct hv_pcibus_device { +#ifdef CONFIG_X86 struct pci_sysdata sysdata; +#elif defined(CONFIG_ARM64) + struct pci_config_window sysdata; +#endif struct pci_host_bridge *bridge; struct fwnode_handle *fwnode; /* Protocol version negotiated with the host */ @@ -3099,7 +3104,9 @@ static int hv_pci_probe(struct hv_device *hdev, dom_req, dom); hbus->bridge->domain_nr = dom; +#ifdef CONFIG_X86 hbus->sysdata.domain = dom; +#endif hbus->hdev = hdev; refcount_set(&hbus->remove_lock, 1);