Skip to contentSkip to conversation

arm64: dts: rockchip: Add Vicharak Vaaman2 board support

PATCH Superseded Hrushiraj Gandhi 1 participant 6 messages Jul 14

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover arm64: dts: rockchip: Add Vicharak Vaaman2 board support

This patch series adds device tree support for the Vicharak Vaaman2, a single-board computer based on the Rockchip RK3588 SoC.

The Vaaman2 board features include:
- RK3588 SoC
- eMMC storage and microSD support
- RK806 PMIC and multiple RK8602/RK8603 regulators
- Real-time clock and status LED
- UART serial console and SARADC

Note: This series is generated on top of the Vicharak Axon v8 series.

Changes since v2:
- Moved 'compatible' before 'reg' in the PMIC node to follow DT coding style convention.
- Verified with dtbs_check: no warnings.

Hrushiraj Gandhi (2):
dt-bindings: arm: rockchip: Add Vicharak Vaaman2
arm64: dts: rockchip: Add Vicharak Vaaman2 board

 .../devicetree/bindings/arm/rockchip.yaml     |   5 +
 arch/arm64/boot/dts/rockchip/Makefile         |   1 +
 .../dts/rockchip/rk3588-vicharak-vaaman2.dts  | 547 ++++++++++++++++++
 3 files changed, 553 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3588-vicharak-vaaman2.dts
Signature · 1 line
2.47.3
#1 lore raw

PATCH v3 1/2 dt-bindings: arm: rockchip: Add Vicharak Vaaman2

Add device tree binding documentation for the Vicharak Vaaman2, a single-board computer based on the Rockchip RK3588 SoC.

---
 Documentation/devicetree/bindings/arm/rockchip.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/arm/rockchip.yaml +5 -0
index b023d4cc9842..b5a43fd5e546 100644
@@ -1311,6 +1311,11 @@ properties:
           - const: vicharak,axon
           - const: rockchip,rk3588
 
+      - description: Vicharak Vaaman2
+        items:
+          - const: vicharak,vaaman2
+          - const: rockchip,rk3588
+
       - description: WolfVision PF5 mainboard
         items:
           - const: wolfvision,rk3568-pf5
Signature · 1 line
2.47.3
#2 lore raw

PATCH v3 1/3 netdevsim: fix use-after-free of ethtool debugfs data

In reply to Hrushiraj Gandhi

debugfs files created by nsim_ethtool_init() store raw pointers directly into the netdevsim struct, which lives in the net_device private data kmalloc slab.

If the ethtool subdirectory outlives the netdevsim struct, a concurrent reader can trigger a slab-use-after-free by passing debugfs_file_get() (which only checks dentry lifetime) and then dereferencing the freed data pointer in e.g. debugfs_u32_get().

In __nsim_dev_port_del(), nsim_destroy() is called before nsim_dev_port_debugfs_exit(). nsim_destroy() ends with free_netdev(), while nsim_dev_port_debugfs_exit() removes the port's debugfs directory afterwards. This means the slab is freed before the ethtool debugfs files that point into it are removed.

The same window exists on nsim_create()'s error path: nsim_ethtool_init() creates debugfs files under ddir with pointers into ns before nsim_init_netdevsim()/nsim_init_netdevsim_vf(), which can fail. The err_free_netdev label then calls free_netdev() while those ethtool debugfs entries are still live.

All other features that create per-port debugfs files (pp_hold, queue_reset, vlan) already remove their own entries explicitly in nsim_destroy() before free_netdev(). ethtool is the only one that does not. Fix this by saving the ethtool dentry in struct nsim_ethtool and calling debugfs_remove_recursive() on it before free_netdev() in both nsim_destroy() and the nsim_create() error path. The port ddir teardown is left to nsim_dev_port_debugfs_exit() as before.

Reported-by [email protected]
Fixes e05b2d141fef ("netdevsim: move netdev creation/destruction to dev probe")

---
v3:
- Instead of removing the entire port ddir before free_netdev(), save and remove only the ethtool dentry. All other features (pp_hold, queue_reset, vlan) already clean up after themselves; ethtool is the only exception. This aligns ethtool with how the other features behave, as suggested by Jakub Kicinski.
v2:
- Also fix the same use-after-free window on the error path of nsim_create() as suggested by Simon Horman.
- Shorten the code comment in nsim_destroy() to be more concise.

---
 drivers/net/netdevsim/ethtool.c   | 1 +
 drivers/net/netdevsim/netdev.c    | 9 +++++++++
 drivers/net/netdevsim/netdevsim.h | 1 +
 3 files changed, 11 insertions(+)
drivers/net/netdevsim/ethtool.c +1 -0
index 9350ba48eb81..a465f3220a7c 100644
@@ -252,6 +252,7 @@ void nsim_ethtool_init(struct netdevsim *ns)
 	ns->ethtool.channels = ns->nsim_bus_dev->num_queues;
 
 	ethtool = debugfs_create_dir("ethtool", ns->nsim_dev_port->ddir);
+	ns->ethtool.ddir = ethtool;
 
 	debugfs_create_u32("get_err", 0600, ethtool, &ns->ethtool.get_err);
 	debugfs_create_u32("set_err", 0600, ethtool, &ns->ethtool.set_err);
drivers/net/netdevsim/netdev.c +9 -0
index 27e5f109f933..09d86a591fac 100644
@@ -1165,6 +1165,7 @@ struct netdevsim *nsim_create(struct nsim_dev *nsim_dev,
 	return ns;
 
 err_free_netdev:
+	debugfs_remove_recursive(ns->ethtool.ddir);
 	free_netdev(dev);
 	return ERR_PTR(err);
 }
@@ -1214,6 +1215,14 @@ void nsim_destroy(struct netdevsim *ns)
 		ns->page = NULL;
 	}
 
+	/*
+	 * Remove the ethtool debugfs directory before free_netdev() releases
+	 * the netdevsim struct to prevent use-after-free in concurrent readers.
+	 * Other per-port debugfs files are already removed above, and the port
+	 * ddir itself is cleaned up by nsim_dev_port_debugfs_exit().
+	 */
+	debugfs_remove_recursive(ns->ethtool.ddir);
+
 	free_netdev(dev);
 }
 
drivers/net/netdevsim/netdevsim.h +1 -0
index 4c9cc96dcec3..c08a01af31e9 100644
@@ -95,6 +95,7 @@ struct nsim_ethtool {
 	struct ethtool_coalesce coalesce;
 	struct ethtool_ringparam ring;
 	struct ethtool_fecparam fec;
+	struct dentry *ddir;
 };
 
 struct nsim_rq {
Signature · 1 line
2.47.3
#3 lore raw

PATCH v3 2/2 arm64: dts: rockchip: Add Vicharak Vaaman2 board

In reply to Hrushiraj Gandhi

Add device tree for the Vicharak Vaaman2, a single-board computer based on the Rockchip RK3588 SoC.

The board features:
- RK3588 SoC with 4x Cortex-A76 (big) + 4x Cortex-A55 (little)
- eMMC storage via SDHCI (HS400)
- microSD card via SDMMC
- RK806 PMIC on SPI2 providing all required power domains
- Two RK8602/RK8603 CPU regulators on I2C0 (big clusters)
- RK8602 NPU regulator on I2C1
- HYM8563 RTC on I2C0
- Status LED on GPIO2_C5 (active-low, heartbeat trigger)
- UART2 as serial console at 1500000 baud
- SARADC with 1.8V reference

---
 arch/arm64/boot/dts/rockchip/Makefile         |   1 +
 .../dts/rockchip/rk3588-vicharak-vaaman2.dts  | 547 ++++++++++++++++++
 2 files changed, 548 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3588-vicharak-vaaman2.dts
arch/arm64/boot/dts/rockchip/Makefile +1 -0
index 92114cb757cc..9213280d831b 100644
@@ -214,6 +214,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-tiger-haikou-video-demo.dtbo
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-toybrick-x0.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-turing-rk1.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-vicharak-axon.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-vicharak-vaaman2.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-coolpi-4b.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-evb1-v10.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-gameforce-ace.dtb
arch/arm64/boot/dts/rockchip/rk3588-vicharak-vaaman2.dts new file +547 -0

547 lines not on this page · raw message

Signature · 1 line
2.47.3
#4 lore raw

PATCH v3 2/3 dt-bindings: arm: rockchip: Add Vicharak Vaaman2

In reply to Hrushiraj Gandhi

Add device tree binding documentation for the Vicharak Vaaman2, a single-board computer based on the Rockchip RK3588 SoC.

---
 Documentation/devicetree/bindings/arm/rockchip.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/arm/rockchip.yaml +5 -0
index b023d4cc9842..b5a43fd5e546 100644
@@ -1311,6 +1311,11 @@ properties:
           - const: vicharak,axon
           - const: rockchip,rk3588
 
+      - description: Vicharak Vaaman2
+        items:
+          - const: vicharak,vaaman2
+          - const: rockchip,rk3588
+
       - description: WolfVision PF5 mainboard
         items:
           - const: wolfvision,rk3568-pf5
Signature · 1 line
2.47.3
#5 lore raw

PATCH v3 3/3 arm64: dts: rockchip: Add Vicharak Vaaman2 board

In reply to Hrushiraj Gandhi

Add device tree for the Vicharak Vaaman2, a single-board computer based on the Rockchip RK3588 SoC.

The board features:
- RK3588 SoC with 4x Cortex-A76 (big) + 4x Cortex-A55 (little)
- eMMC storage via SDHCI (HS400)
- microSD card via SDMMC
- RK806 PMIC on SPI2 providing all required power domains
- Two RK8602/RK8603 CPU regulators on I2C0 (big clusters)
- RK8602 NPU regulator on I2C1
- HYM8563 RTC on I2C0
- Status LED on GPIO2_C5 (active-low, heartbeat trigger)
- UART2 as serial console at 1500000 baud
- SARADC with 1.8V reference

---
 arch/arm64/boot/dts/rockchip/Makefile         |   1 +
 .../dts/rockchip/rk3588-vicharak-vaaman2.dts  | 547 ++++++++++++++++++
 2 files changed, 548 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3588-vicharak-vaaman2.dts
arch/arm64/boot/dts/rockchip/Makefile +1 -0
index 92114cb757cc..9213280d831b 100644
@@ -214,6 +214,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-tiger-haikou-video-demo.dtbo
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-toybrick-x0.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-turing-rk1.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-vicharak-axon.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-vicharak-vaaman2.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-coolpi-4b.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-evb1-v10.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-gameforce-ace.dtb
arch/arm64/boot/dts/rockchip/rk3588-vicharak-vaaman2.dts new file +547 -0

547 lines not on this page · raw message

Signature · 1 line
2.47.3