* [PATCH v2 1/3] pci/rcar: Check dw_pcie_host_probe() return value
2026-11-30 11:50 [PATCH v2 0/3] Add R-Car Gen5 PCI host support Mykyta Poturai
@ 2026-11-30 11:50 ` Mykyta Poturai
2026-11-30 15:15 ` Oleksandr Tyshchenko
2026-11-30 11:50 ` [PATCH v2 2/3] pci/rcar: Rename PCI host rcar4 to rcar Mykyta Poturai
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Mykyta Poturai @ 2026-11-30 11:50 UTC (permalink / raw)
To: xen-devel@lists.xenproject.org
Cc: Mykyta Poturai, Oleksandr Tyshchenko, Stefano Stabellini,
Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk,
Andrew Cooper, Anthony PERARD, Jan Beulich, Roger Pau Monné,
Oleksii Kurochko, Community Manager
dw_pcie_host_probe() returns an ERR_PTR on failure, which was then
passed on to dw_pcie_set_priv().
Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
---
v1->v2:
* new patch
---
xen/arch/arm/pci/pci-host-rcar4.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/xen/arch/arm/pci/pci-host-rcar4.c b/xen/arch/arm/pci/pci-host-rcar4.c
index e1e8eb0ee1..611342f98e 100644
--- a/xen/arch/arm/pci/pci-host-rcar4.c
+++ b/xen/arch/arm/pci/pci-host-rcar4.c
@@ -193,6 +193,11 @@ static int __init pci_host_rcar4_probe(struct dt_device_node *dev,
bridge = dw_pcie_host_probe(dev, data, &rcar4_pcie_ops,
&rcar4_pcie_child_ops);
+ if ( IS_ERR(bridge) )
+ {
+ ret = PTR_ERR(bridge);
+ goto err;
+ }
app_idx = dt_property_match_string(dev, "reg-names", "app");
if ( app_idx < 0 )
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 1/3] pci/rcar: Check dw_pcie_host_probe() return value
2026-11-30 11:50 ` [PATCH v2 1/3] pci/rcar: Check dw_pcie_host_probe() return value Mykyta Poturai
@ 2026-11-30 15:15 ` Oleksandr Tyshchenko
0 siblings, 0 replies; 6+ messages in thread
From: Oleksandr Tyshchenko @ 2026-11-30 15:15 UTC (permalink / raw)
To: Mykyta Poturai, xen-devel@lists.xenproject.org
Cc: Oleksandr Tyshchenko, Stefano Stabellini, Julien Grall,
Bertrand Marquis, Michal Orzel, Volodymyr Babchuk, Andrew Cooper,
Anthony PERARD, Jan Beulich, Roger Pau Monné,
Oleksii Kurochko, Community Manager
30.11.2026 13:50, Mykyta Poturai пишет:
Hello Mykyta
> dw_pcie_host_probe() returns an ERR_PTR on failure, which was then
> passed on to dw_pcie_set_priv().
>
> Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
I assume we need a "Fixes:" tag.
Also ...
> ---
> v1->v2:
> * new patch
> ---
> xen/arch/arm/pci/pci-host-rcar4.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/xen/arch/arm/pci/pci-host-rcar4.c b/xen/arch/arm/pci/pci-host-rcar4.c
> index e1e8eb0ee1..611342f98e 100644
> --- a/xen/arch/arm/pci/pci-host-rcar4.c
> +++ b/xen/arch/arm/pci/pci-host-rcar4.c
> @@ -193,6 +193,11 @@ static int __init pci_host_rcar4_probe(struct dt_device_node *dev,
>
> bridge = dw_pcie_host_probe(dev, data, &rcar4_pcie_ops,
> &rcar4_pcie_child_ops);
> + if ( IS_ERR(bridge) )
... when looking more closely into what the underlying code can
return, I noticed a couple of issues:
1. In dw_pcie_host_probe(), pci_host_common_probe() can return NULL.
Since IS_ERR(NULL) is false, dw_pcie_host_probe() misses the failure and
dereferences bridge->priv = priv.
2. When ioremap_nocache() fails, dw_pcie_host_probe() returns
ERR_PTR(ENXIO) instead of ERR_PTR(-ENXIO). Since IS_ERR(ERR_PTR(ENXIO))
is false, pci_host_rcar4_probe() misses the failure and passes the
invalid pointer to dw_pcie_set_priv().
Would you be able to fix those as well, please (ideally in a separate
commit on pci-designware.c)? If you would prefer to keep this series
focused on R-Car, the pci-designware.c fix could be handled separately.
> + {
> + ret = PTR_ERR(bridge);
> + goto err;
> + }
>
> app_idx = dt_property_match_string(dev, "reg-names", "app");
> if ( app_idx < 0 )
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] pci/rcar: Rename PCI host rcar4 to rcar
2026-11-30 11:50 [PATCH v2 0/3] Add R-Car Gen5 PCI host support Mykyta Poturai
2026-11-30 11:50 ` [PATCH v2 1/3] pci/rcar: Check dw_pcie_host_probe() return value Mykyta Poturai
@ 2026-11-30 11:50 ` Mykyta Poturai
2026-11-30 11:50 ` [PATCH v2 3/3] pci/rcar: Add support for Gen5 PCI host Mykyta Poturai
2026-12-02 23:47 ` [PATCH v2 0/3] Add R-Car Gen5 PCI host support Stefano Stabellini
3 siblings, 0 replies; 6+ messages in thread
From: Mykyta Poturai @ 2026-11-30 11:50 UTC (permalink / raw)
To: xen-devel@lists.xenproject.org
Cc: Mykyta Poturai, Oleksandr Tyshchenko, Stefano Stabellini,
Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk,
Andrew Cooper, Anthony PERARD, Jan Beulich, Roger Pau Monné,
Oleksii Kurochko, Community Manager
Gen5 mostly reuses the same DesignWare integration and register layout
as Gen4, so one driver covers both. Drop the generation number from the
file and symbol names.
Keep the rcar4_ prefix on the exported OSID helpers, as the BDF-to-OSID
registers only exist on Gen4.
Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
---
v1->v2:
* add osid registers remark to the commit message
* add pci-host-rcar.h to MAINTAINERS
---
MAINTAINERS | 3 +-
xen/arch/arm/pci/Makefile | 2 +-
.../arm/pci/{pci-host-rcar4.c => pci-host-rcar.c} | 32 +++++++++++-----------
.../arm/pci/{pci-host-rcar4.h => pci-host-rcar.h} | 6 ++--
xen/drivers/passthrough/arm/ipmmu-vmsa.c | 2 +-
5 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index cefb6dc01d..774a1a87b5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -511,7 +511,8 @@ T: git https://xenbits.xenproject.org/git-http/qemu-xen.git
RCAR PCI
M: Mykyta Poturai <mykyta_poturai@epam.com>
S: Supported
-F: xen/arch/arm/pci/pci-host-rcar4.c
+F: xen/arch/arm/pci/pci-host-rcar.c
+F: xen/arch/arm/pci/pci-host-rcar.h
REMUS
S: Orphan
diff --git a/xen/arch/arm/pci/Makefile b/xen/arch/arm/pci/Makefile
index ca6135e282..431a91c46d 100644
--- a/xen/arch/arm/pci/Makefile
+++ b/xen/arch/arm/pci/Makefile
@@ -5,4 +5,4 @@ obj-y += pci-host-common.o
obj-y += ecam.o
obj-y += pci-host-zynqmp.o
obj-y += pci-designware.o
-obj-y += pci-host-rcar4.o
+obj-y += pci-host-rcar.o
diff --git a/xen/arch/arm/pci/pci-host-rcar4.c b/xen/arch/arm/pci/pci-host-rcar.c
similarity index 88%
rename from xen/arch/arm/pci/pci-host-rcar4.c
rename to xen/arch/arm/pci/pci-host-rcar.c
index 611342f98e..883ccfaeca 100644
--- a/xen/arch/arm/pci/pci-host-rcar4.c
+++ b/xen/arch/arm/pci/pci-host-rcar.c
@@ -13,9 +13,9 @@
#include <asm/pci.h>
#include "pci-designware.h"
-#include "pci-host-rcar4.h"
+#include "pci-host-rcar.h"
-#define RCAR4_DWC_VERSION 0x520A
+#define RCAR_DWC_VERSION 0x520A
/* PCIE BDF-OSID assignment */
#define CNVID(n) (0x700 + ((n) * 4))
@@ -51,20 +51,20 @@ struct rcar4_pcie_priv {
* "config": child's configuration space
* "atu" : iATU registers for DWC version 4.80 or later
*/
-static int __init rcar4_cfg_reg_index(struct dt_device_node *np)
+static int __init rcar_cfg_reg_index(struct dt_device_node *np)
{
return dt_property_match_string(np, "reg-names", "dbi");
}
-static int __init rcar4_child_cfg_reg_index(struct dt_device_node *np)
+static int __init rcar_child_cfg_reg_index(struct dt_device_node *np)
{
return dt_property_match_string(np, "reg-names", "config");
}
/* ECAM ops */
-static const struct pci_ecam_ops rcar4_pcie_ops = {
+static const struct pci_ecam_ops rcar_pcie_ops = {
.bus_shift = 20,
- .cfg_reg_index = rcar4_cfg_reg_index,
+ .cfg_reg_index = rcar_cfg_reg_index,
.pci_ops = {
.map_bus = pci_ecam_map_bus,
.read = pci_generic_config_read,
@@ -74,9 +74,9 @@ static const struct pci_ecam_ops rcar4_pcie_ops = {
}
};
-static const struct pci_ecam_ops rcar4_pcie_child_ops = {
+static const struct pci_ecam_ops rcar_pcie_child_ops = {
.bus_shift = 20,
- .cfg_reg_index = rcar4_child_cfg_reg_index,
+ .cfg_reg_index = rcar_child_cfg_reg_index,
.pci_ops = {
.map_bus = dw_pcie_child_map_bus,
.read = dw_pcie_child_config_read,
@@ -86,7 +86,7 @@ static const struct pci_ecam_ops rcar4_pcie_child_ops = {
}
};
-static const struct dt_device_match __initconstrel rcar4_pcie_dt_match[] = {
+static const struct dt_device_match __initconstrel rcar_pcie_dt_match[] = {
{ .compatible = "renesas,r8a779f0-pcie" },
{ .compatible = "renesas,r8a779g0-pcie" },
{},
@@ -179,8 +179,8 @@ void rcar4_pcie_bdf_msk_set(struct pci_host_bridge *bridge, unsigned int reg_id,
rcar4_pcie_writel_app(priv, CNVIDMSK(reg_id), val);
}
-static int __init pci_host_rcar4_probe(struct dt_device_node *dev,
- const void *data)
+static int __init pci_host_rcar_probe(struct dt_device_node *dev,
+ const void *data)
{
struct pci_host_bridge *bridge;
paddr_t app_phys_addr;
@@ -191,8 +191,8 @@ static int __init pci_host_rcar4_probe(struct dt_device_node *dev,
if ( !priv )
return -ENOMEM;
- bridge = dw_pcie_host_probe(dev, data, &rcar4_pcie_ops,
- &rcar4_pcie_child_ops);
+ bridge = dw_pcie_host_probe(dev, data, &rcar_pcie_ops,
+ &rcar_pcie_child_ops);
if ( IS_ERR(bridge) )
{
ret = PTR_ERR(bridge);
@@ -224,7 +224,7 @@ static int __init pci_host_rcar4_probe(struct dt_device_node *dev,
app_phys_addr + app_size - 1);
dw_pcie_set_priv(bridge, priv);
- dw_pcie_set_version(bridge, RCAR4_DWC_VERSION);
+ dw_pcie_set_version(bridge, RCAR_DWC_VERSION);
return 0;
err:
@@ -233,8 +233,8 @@ err:
}
DT_DEVICE_START(pci_gen, "PCI HOST R-CAR GEN4", DEVICE_PCI_HOSTBRIDGE)
-.dt_match = rcar4_pcie_dt_match,
-.init = pci_host_rcar4_probe,
+.dt_match = rcar_pcie_dt_match,
+.init = pci_host_rcar_probe,
DT_DEVICE_END
/*
diff --git a/xen/arch/arm/pci/pci-host-rcar4.h b/xen/arch/arm/pci/pci-host-rcar.h
similarity index 88%
rename from xen/arch/arm/pci/pci-host-rcar4.h
rename to xen/arch/arm/pci/pci-host-rcar.h
index 31ef9d2d40..ffd49e3c1c 100644
--- a/xen/arch/arm/pci/pci-host-rcar4.h
+++ b/xen/arch/arm/pci/pci-host-rcar.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __PCI_HOST_RCAR4_H__
-#define __PCI_HOST_RCAR4_H__
+#ifndef __PCI_HOST_RCAR_H__
+#define __PCI_HOST_RCAR_H__
#include <asm/pci.h>
@@ -17,4 +17,4 @@ void rcar4_pcie_osid_reg_free(struct pci_host_bridge *bridge,
int rcar4_pcie_osid_regs_init(struct pci_host_bridge *bridge);
#endif
-#endif /* __PCI_HOST_RCAR4_H__ */
+#endif /* __PCI_HOST_RCAR_H__ */
diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 0648f9b407..bfb9df238a 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -51,7 +51,7 @@
#include <asm/device.h>
#include <asm/io.h>
#include <asm/iommu_fwspec.h>
-#include "../arch/arm/pci/pci-host-rcar4.h"
+#include "../arch/arm/pci/pci-host-rcar.h"
#define dev_name(dev) dt_node_full_name(dev_to_dt(dev))
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 3/3] pci/rcar: Add support for Gen5 PCI host
2026-11-30 11:50 [PATCH v2 0/3] Add R-Car Gen5 PCI host support Mykyta Poturai
2026-11-30 11:50 ` [PATCH v2 1/3] pci/rcar: Check dw_pcie_host_probe() return value Mykyta Poturai
2026-11-30 11:50 ` [PATCH v2 2/3] pci/rcar: Rename PCI host rcar4 to rcar Mykyta Poturai
@ 2026-11-30 11:50 ` Mykyta Poturai
2026-12-02 23:47 ` [PATCH v2 0/3] Add R-Car Gen5 PCI host support Stefano Stabellini
3 siblings, 0 replies; 6+ messages in thread
From: Mykyta Poturai @ 2026-11-30 11:50 UTC (permalink / raw)
To: xen-devel@lists.xenproject.org
Cc: Mykyta Poturai, Oleksandr Tyshchenko, Stefano Stabellini,
Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk,
Andrew Cooper, Anthony PERARD, Jan Beulich, Roger Pau Monné,
Oleksii Kurochko, Community Manager
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 skipping the "app" register range
setup when the hardware does not have it.
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>
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
---
v1->v2:
* clarify the commit message regarding app registers
* drop ASSERT() after dt_match_node()
* add CHANGELOG.md entry
---
CHANGELOG.md | 2 ++
xen/arch/arm/pci/pci-host-rcar.c | 16 +++++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f967437eda..e09c4d0b34 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
afterwards.
### Added
+ - On Arm:
+ - R-Car Gen5 PCI host controller support.
### Removed
- On Arm:
diff --git a/xen/arch/arm/pci/pci-host-rcar.c b/xen/arch/arm/pci/pci-host-rcar.c
index 883ccfaeca..b4f678d6f0 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;
@@ -199,6 +204,10 @@ static int __init pci_host_rcar_probe(struct dt_device_node *dev,
goto err;
}
+ match = dt_match_node(rcar_pcie_dt_match, dev);
+ if ( match->data != (void *)RCAR_GEN4 )
+ goto skip_app;
+
app_idx = dt_property_match_string(dev, "reg-names", "app");
if ( app_idx < 0 )
{
@@ -223,6 +232,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);
dw_pcie_set_version(bridge, RCAR_DWC_VERSION);
@@ -232,7 +242,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
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 0/3] Add R-Car Gen5 PCI host support
2026-11-30 11:50 [PATCH v2 0/3] Add R-Car Gen5 PCI host support Mykyta Poturai
` (2 preceding siblings ...)
2026-11-30 11:50 ` [PATCH v2 3/3] pci/rcar: Add support for Gen5 PCI host Mykyta Poturai
@ 2026-12-02 23:47 ` Stefano Stabellini
3 siblings, 0 replies; 6+ messages in thread
From: Stefano Stabellini @ 2026-12-02 23:47 UTC (permalink / raw)
To: Mykyta Poturai
Cc: xen-devel@lists.xenproject.org, Oleksandr Tyshchenko,
Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD, Jan Beulich,
Roger Pau Monné, Oleksii Kurochko, Community Manager
acked and pushed
On Mon, 30 Nov 2026, Mykyta Poturai wrote:
> Add R-Car Gen5 PCI host support to the existing Gen4 driver. Gen5 uses
> the same DesignWare integration and register layout, so one driver
> covers both.
>
> Drop the generation number from the driver file and static symbols. Keep
> the rcar4_ prefix on the exported OSID helpers, as the BDF-to-OSID
> registers only exist on Gen4.
>
> Add the "renesas,rcar-gen5-pcie6" compatible and skip the "app" register
> range on Gen5, as the hardware does not have it.
>
> v1->v2:
> * new patch to check dw_pcie_host_probe() return value
> * add CHANGELOG entry
> * add pci-host-rcar.h to MAINTAINERS
> * address nits and collect tags
>
> ---
> Mykyta Poturai (3):
> pci/rcar: Check dw_pcie_host_probe() return value
> pci/rcar: Rename PCI host rcar4 to rcar
> pci/rcar: Add support for Gen5 PCI host
>
> CHANGELOG.md | 2 +
> MAINTAINERS | 3 +-
> xen/arch/arm/pci/Makefile | 2 +-
> .../arm/pci/{pci-host-rcar4.c => pci-host-rcar.c} | 53 ++++++++++++++--------
> .../arm/pci/{pci-host-rcar4.h => pci-host-rcar.h} | 6 +--
> xen/drivers/passthrough/arm/ipmmu-vmsa.c | 2 +-
> 6 files changed, 43 insertions(+), 25 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread