From nobody Wed May 8 00:54:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1612828598; cv=none; d=zohomail.com; s=zohoarc; b=K/jKCqAMTBEbEmmFiIlpPqPnXVeFS+wdS0YhQIsPD6B4PNH3irLv/U38I8PIq3xbcPq6DQfLPvreyEMNNCwzl3ZK0H4CxRk0UuU25rwfKDwaOiXUPi/rQS21amymAKZEqkqk/1SmdCiKV2sk3UVRcSJZqp4j+r/Xs1fLHRoYN1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612828598; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=EWFO7g15VgwBJmfkqNvxVv9MLvxKJizWYcVU/NZJPf0=; b=n+IyDy3W10Wcx+ZF09ZnhrZFSM248rOOdjvzu8OthcU6nrCsBVUFxvPGqOxV++5q5mJmz2rV9ykmH5pZJ1hGdbSU3rZx5l+0bbgNbM6wPNPd/OCU9wHAWBT3h3SDfh1+0AEDIm1NLSjGzFQQoAL+TdLw6ccXPyKTG2BUsZMAgkw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1612828598706943.0666962370468; Mon, 8 Feb 2021 15:56:38 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.83098.153884 (Exim 4.92) (envelope-from ) id 1l9GO8-00069L-5v; Mon, 08 Feb 2021 23:56:16 +0000 Received: by outflank-mailman (output) from mailman id 83098.153884; Mon, 08 Feb 2021 23:56:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l9GO8-00069E-2u; Mon, 08 Feb 2021 23:56:16 +0000 Received: by outflank-mailman (input) for mailman id 83098; Mon, 08 Feb 2021 23:56:14 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l9GO6-000699-S4 for xen-devel@lists.xenproject.org; Mon, 08 Feb 2021 23:56:14 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d9827e62-59f5-416e-9adc-0090c8a60223; Mon, 08 Feb 2021 23:56:14 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 0CF4D64E76; Mon, 8 Feb 2021 23:56:13 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d9827e62-59f5-416e-9adc-0090c8a60223 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612828573; bh=JC2fgA3vCo0/t26eZhsquPHOlPBaFoo5utCIes70ss4=; h=Date:From:To:cc:Subject:From; b=OU0bgciatfTnoFcp9WJ+rdfVyTkXWGIJLBPZk7h1UmcGFO/kGJbvT3/Xaenk9rIJ1 e7jxOALI9PopYsF+6J6breULtNiaOnXcH7fl9GDdkqRw1MKNv6uIl3yZossGHcYU4P wmIZhtUNcsuqBlUjBYxkFLVvGhKJey67CYDL6p6FsrJKKo727c9lhSZEqQkt1tXqyp d75L9lRUHOG6itLPg6Ma1GtzU3VJKUjkacspFeU1nVBLDwpP68p4M4WQMMFcURlvBb rpWmbGrxlJdZRJwyE+FJVOhWlmX+IVBPnkVEmJdKX8I/xBFAqS89M6fjQQunadd6TM uNufNg/FGsdjA== Date: Mon, 8 Feb 2021 15:56:12 -0800 (PST) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: xen-devel@lists.xenproject.org cc: sstabellini@kernel.org, Julien Grall , Volodymyr Babchuk , ehem+xen@m5p.com Subject: [PATCH] xen: workaround missing device_type property in pci/pcie nodes Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @kernel.org) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" PCI buses differ from default buses in a few important ways, so it is important to detect them properly. Normally, PCI buses are expected to have the following property: device_type =3D "pci" In reality, it is not always the case. To handle PCI bus nodes that don't have the device_type property, also consider the node name: if the node name is "pcie" or "pci" then consider the bus as a PCI bus. This commit is based on the Linux kernel commit d1ac0002dd29 "of: address: Work around missing device_type property in pcie nodes". This fixes Xen boot on RPi4. Signed-off-by: Stefano Stabellini diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 18825e333e..f1a96a3b90 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -563,14 +563,28 @@ static unsigned int dt_bus_default_get_flags(const __= be32 *addr) * PCI bus specific translator */ =20 +static bool_t dt_node_is_pci(const struct dt_device_node *np) +{ + bool is_pci =3D !strcmp(np->name, "pcie") || !strcmp(np->name, "pci"); + + if (is_pci) + printk(XENLOG_WARNING "%s: Missing device_type\n", np->full_name); + + return is_pci; +} + static bool_t dt_bus_pci_match(const struct dt_device_node *np) { /* * "pciex" is PCI Express "vci" is for the /chaos bridge on 1st-gen PCI * powermacs "ht" is hypertransport + * + * If none of the device_type match, and that the node name is + * "pcie" or "pci", accept the device as PCI (with a warning). */ return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") || - !strcmp(np->type, "vci") || !strcmp(np->type, "ht"); + !strcmp(np->type, "vci") || !strcmp(np->type, "ht") || + dt_node_is_pci(np); } =20 static void dt_bus_pci_count_cells(const struct dt_device_node *np,