[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen: workaround missing device_type property in pci/pcie nodes


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 10 Feb 2021 14:54:07 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yT2L1fUBE9nlkNBPBTTteUVTdeWMoWNrWKJyimGsx7w=; b=bY2Fs730fGB0bPw7zpcLdUBT5quGuQDFxS1pC6dzsjpdg5x0SyPdHAWveZum1VPCzK90qcTQm3p+RS3sKB0Q+43IdU7jyjIaBQ2DbJxtHYObyzg99DKa5u4zA4825hly63ZPf9s0VpTNELD2HPyPZ7AgM7IzjnHYXPHo91TA8OBi1fo2n/AbuzmUD54Wk4/uAnTgd5DKIKykMXwFI17LjDzANUald7gBhoCi05rw0fDni/kOHSaRruN68+Ogjsv3FMtpA2Txhfu9qpgwnBOROLmvmuFPNfM3vpZCpgxVCad3aajKjINGp1RiqsXF20KRuXfSDevZOzPDuGieEgTeVg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JfeWfZNezlDWy7bl3+JU2ilwg2KZ9RdK/jyfwL2o/MdKQ2U9DWd5beyhG44KI9cocLO9+Fdf/nIQF9VNWOEpTK7eYJJKDd0l6llssDTB8NF0tPg2dJhemA6U8OQYFTZyM3e03mw/2jcvO+CNqBhczxWYZbBJUUYdse4rY4Og93gdOd3CZvpQDx3O8IbflpwwY/JTTBLNC7veGzOxzReq19/hhd59qvcaVP/+whetn6610MxK5bh4snZmI+3+ECvsmShZAX9KdmE8I3XF3Ne4d5F9g6zYura8y4FSwHBj5+2wW31TszeOzx14RwTdoyTIecaRQQWI29wzk1aXb6xP2g==
  • Authentication-results-original: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "Volodymyr_Babchuk@xxxxxxxx" <Volodymyr_Babchuk@xxxxxxxx>, "ehem+xen@xxxxxxx" <ehem+xen@xxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
  • Delivery-date: Wed, 10 Feb 2021 14:54:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHW/x1qfHDypyDl2UmolBAclq6QOKpReu0A
  • Thread-topic: [PATCH v2] xen: workaround missing device_type property in pci/pcie nodes

Hi Stefano,

> On 9 Feb 2021, at 19:53, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> 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 = "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. Some RPi4 kernels have the following node
> on their device trees:
> 
> &pcie0 {
>       pci@1,0 {
>               #address-cells = <3>;
>               #size-cells = <2>;
>               ranges;
> 
>               reg = <0 0 0 0 0>;
> 
>               usb@1,0 {
>                               reg = <0x10000 0 0 0 0>;
>                               resets = <&reset 
> RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
>               };
>       };
> };
> 
> The pci@1,0 node is a PCI bus. If we parse the node and its children as
> a default bus, the reg property under usb@1,0 would have to be
> interpreted as an address range mappable by the CPU, which is not the
> case and would break.
> 
> Link: https://lore.kernel.org/xen-devel/YBmQQ3Tzu++AadKx@xxxxxxxxxxxxxxxx/
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
With the type, spaces and tab fixes already found:

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Thanks the commit message is more clear :-)

Cheers
Bertrand

> ---
> Changes in v2:
> - improve commit message
> 
> 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
>  */
> 
> +static bool_t dt_node_is_pci(const struct dt_device_node *np)
> +{
> +    bool is_pci = !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);
> }
> 
> static void dt_bus_pci_count_cells(const struct dt_device_node *np,
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.