All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksandr Tyshchenko <olekstysh@gmail.com>
To: Mykyta Poturai <Mykyta_Poturai@epam.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Michal Orzel <michal.orzel@amd.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH v1 2/2] pci/rcar: Add support for Gen5 PCI host
Date: Mon, 16 Nov 2026 14:04:30 +0200	[thread overview]
Message-ID: <4039731c-bbf6-43dd-b7b6-e4470fac68c7@gmail.com> (raw)
In-Reply-To: <2871b83d934f6254fd593ff9fc75de03728b69ac.1794817300.git.mykyta_poturai@epam.com>



16.11.2026 10:40, Mykyta Poturai пишет:


Hello Mykyta

> Add support for Renesas R-Car Gen5 PCI host controller. This includes
> updating the device tree match table to recognize the new compatible
> string "renesas,rcar-gen5-pcie6" and ensuring that the OSID registers
> are only initialized when they are supported by the hardware.


NIT: It is not entirely precise, the code only skips the app range 
lookup and ioremap on Gen5. Nothing guards OSID initialisation. That is 
harmless, because only the IPMMU driver uses it and Gen5 uses SMMUv3.


> 
> Gen5 hosts do not expose the "app" register range, so only look it up
> on Gen4.
> 
> Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
> ---
>   xen/arch/arm/pci/pci-host-rcar.c | 17 ++++++++++++++---
>   1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/pci/pci-host-rcar.c b/xen/arch/arm/pci/pci-host-rcar.c
> index 5f184d5ebc..87b3ccbc1c 100644
> --- a/xen/arch/arm/pci/pci-host-rcar.c
> +++ b/xen/arch/arm/pci/pci-host-rcar.c
> @@ -17,6 +17,9 @@
>   
>   #define RCAR_DWC_VERSION     0x520A
>   
> +#define RCAR_GEN4    4
> +#define RCAR_GEN5    5
> +
>   /* PCIE BDF-OSID assignment */
>   #define CNVID(n)             (0x700 + ((n) * 4))
>   #define CNVID_CNV_EN         (1U << 31)
> @@ -87,8 +90,9 @@ static const struct pci_ecam_ops rcar_pcie_child_ops = {
>   };
>   
>   static const struct dt_device_match __initconstrel rcar_pcie_dt_match[] = {
> -    { .compatible = "renesas,r8a779f0-pcie" },
> -    { .compatible = "renesas,r8a779g0-pcie" },
> +    { .compatible = "renesas,r8a779f0-pcie", .data = (void *)RCAR_GEN4 },
> +    { .compatible = "renesas,r8a779g0-pcie", .data = (void *)RCAR_GEN4 },
> +    { .compatible = "renesas,rcar-gen5-pcie6", .data = (void *)RCAR_GEN5 },
>       {},
>   };
>   
> @@ -182,6 +186,7 @@ void rcar4_pcie_bdf_msk_set(struct pci_host_bridge *bridge, unsigned int reg_id,
>   static int __init pci_host_rcar_probe(struct dt_device_node *dev,
>                                         const void *data)
>   {
> +    const struct dt_device_match *match;
>       struct pci_host_bridge *bridge;
>       paddr_t app_phys_addr;
>       paddr_t app_size;
> @@ -194,6 +199,11 @@ static int __init pci_host_rcar_probe(struct dt_device_node *dev,
>       bridge = dw_pcie_host_probe(dev, data, &rcar_pcie_ops,
>                                   &rcar_pcie_child_ops);

Remark: The result of dw_pcie_host_probe() is not checked. On failure it 
returns an ERR_PTR ...


>   
> +    match = dt_match_node(rcar_pcie_dt_match, dev);
> +    ASSERT(match);

NIT: To be honest, I am not entirely sure why this assert is here. I 
assume it was copied from existing code. As far as I understand, 
dt_match_node() cannot fail here, because the device was already matched 
to reach the probe...

> +    if ( match->data != (void *)RCAR_GEN4 )
> +        goto skip_app;
> +
>       app_idx = dt_property_match_string(dev, "reg-names", "app");
>       if ( app_idx < 0 )
>       {
> @@ -218,6 +228,7 @@ static int __init pci_host_rcar_probe(struct dt_device_node *dev,
>       printk("APP at [mem 0x%" PRIpaddr "-0x%" PRIpaddr "]\n", app_phys_addr,
>              app_phys_addr + app_size - 1);
>   
> +skip_app:
>       dw_pcie_set_priv(bridge, priv);

  ... which dw_pcie_set_priv() then dereferences. This is pre-existing, 
so maybe better to fix it in prereq commit.

As for the current commit:
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>


>       dw_pcie_set_version(bridge, RCAR_DWC_VERSION);
>   
> @@ -227,7 +238,7 @@ err:
>       return ret;
>   }
>   
> -DT_DEVICE_START(pci_gen, "PCI HOST R-CAR GEN4", DEVICE_PCI_HOSTBRIDGE)
> +DT_DEVICE_START(pci_gen, "PCI HOST R-CAR GEN4/GEN5", DEVICE_PCI_HOSTBRIDGE)
>   .dt_match = rcar_pcie_dt_match,
>   .init = pci_host_rcar_probe,
>   DT_DEVICE_END



  reply	other threads:[~2026-11-16 12:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  8:40 [PATCH v1 0/2] Add R-Car Gen5 PCI host support Mykyta Poturai
2026-11-16  8:40 ` [PATCH v1 1/2] pci/rcar: Rename PCI host rcar4 to rcar Mykyta Poturai
2026-11-17 16:34   ` Oleksandr Tyshchenko
2026-11-16  8:40 ` [PATCH v1 2/2] pci/rcar: Add support for Gen5 PCI host Mykyta Poturai
2026-11-16 12:04   ` Oleksandr Tyshchenko [this message]
2026-11-16  9:44 ` [PATCH v1 0/2] Add R-Car Gen5 PCI host support Oleksii Kurochko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4039731c-bbf6-43dd-b7b6-e4470fac68c7@gmail.com \
    --to=olekstysh@gmail.com \
    --cc=Mykyta_Poturai@epam.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.