|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH 2/2] plat/rcar: Add region id support for PCI
With Region ID enabled, all CPU memory accesses need to have rgid bits
set in the physical address. This creates a problem for PCI BAR
accesses, as it would require all BARs to be 64bit. Implement fixup_bar
callback to add rgid bits to the address before mapping it to the
guests.
Add Kconfig options to enable region id support and set the rgid value
and physical address space size.
Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
---
xen/arch/arm/pci/pci-host-rcar4.c | 15 +++++++++++++++
xen/arch/arm/platforms/Kconfig | 21 +++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/xen/arch/arm/pci/pci-host-rcar4.c
b/xen/arch/arm/pci/pci-host-rcar4.c
index e1e8eb0ee1..50400c04c4 100644
--- a/xen/arch/arm/pci/pci-host-rcar4.c
+++ b/xen/arch/arm/pci/pci-host-rcar4.c
@@ -43,6 +43,12 @@ struct rcar4_pcie_priv {
DECLARE_BITMAP(osid_regs, NUM_OSID_REGS);
};
+#define ULL(X) _AC(X, ULL)
+#define MADDR_RGID(a) (ULL(a) << CONFIG_RCAR_PA_BITS)
+#define MADDR_PA_MASK ((1ULL << CONFIG_RCAR_PA_BITS) - 1)
+
+#define MADDR_ENCODE_RGID(a) (MADDR_RGID(CONFIG_RCAR_RGID) | (a))
+
/*
* PCI host bridges often have different ways to access the root and child
* bus config spaces:
@@ -61,6 +67,14 @@ static int __init rcar4_child_cfg_reg_index(struct
dt_device_node *np)
return dt_property_match_string(np, "reg-names", "config");
}
+static void rcar4_pcie_fixup_bar(struct pci_host_bridge *bridge,
+ unsigned int bar_num,
+ paddr_t *addr)
+{
+ if ( IS_ENABLED(CONFIG_RCAR_REGION_ID_SUPPORT) )
+ *addr = MADDR_ENCODE_RGID(*addr);
+}
+
/* ECAM ops */
static const struct pci_ecam_ops rcar4_pcie_ops = {
.bus_shift = 20,
@@ -71,6 +85,7 @@ static const struct pci_ecam_ops rcar4_pcie_ops = {
.write = pci_generic_config_write,
.need_p2m_hwdom_mapping = pci_ecam_need_p2m_hwdom_mapping,
.init_bus_range = pci_generic_init_bus_range,
+ .fixup_bar = rcar4_pcie_fixup_bar,
}
};
diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
index 888d0b85d5..db096952c8 100644
--- a/xen/arch/arm/platforms/Kconfig
+++ b/xen/arch/arm/platforms/Kconfig
@@ -64,6 +64,27 @@ config NO_PLAT
endchoice
+menu "RCar Region ID Support"
+ visible if RCAR4
+
+config RCAR_REGION_ID_SUPPORT
+ bool "Renesas Region ID support for R-Car Gen4 platforms" if EXPERT
+ depends on RCAR4
+ help
+ Enable experimental Region ID support for R-Car Gen4 platforms
+
+config RCAR_RGID
+ int "Region ID encoded in physical address"
+ depends on RCAR_REGION_ID_SUPPORT
+ default 0
+
+config RCAR_PA_BITS
+ int "Physical address space size"
+ depends on RCAR_REGION_ID_SUPPORT
+ default 36
+
+endmenu
+
config ALL64_PLAT
bool
default (ALL_PLAT && ARM_64)
--
2.51.2
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |