AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/08/11 16:41 flow patch-triage
0m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "KMSANReasoning": "",
  "NeedsKMSAN": false,
  "Reasoning": "The patch refactors gPTP support in the Renesas Ethernet AVB (ravb) driver, adding support for Gen4 gPTP and introducing a struct for platform-specific callbacks. This is a vendor-specific platform driver for Renesas R-Car SoCs. The hardware is not emulated in standard QEMU/GCE environments, and the driver requires specific device tree nodes to probe. Therefore, the modified code paths are unreachable during standard fuzzing.",
  "WorthFuzzing": false
}

1/1 2026/08/11 16:41 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit dcc705ffe8ebbf669c7932e642a61d50a51c0800\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Tue Aug 11 16:41:33 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml\nindex 1e00ef5b3acda..fad002492421a 100644\n--- a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml\n+++ b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml\n@@ -97,6 +97,8 @@ properties:\n \n   phy-handle: true\n \n+  ptp-timer: true\n+\n   '#address-cells':\n     description: Number of address cells for the MDIO bus.\n     const: 1\n@@ -305,6 +307,15 @@ allOf:\n             items:\n               - const: fck\n               - const: refclk\n+  - if:\n+      not:\n+        properties:\n+          compatible:\n+            contains:\n+              const: renesas,etheravb-rcar-gen4\n+    then:\n+      properties:\n+        ptp-timer: false\n \n additionalProperties: false\n \ndiff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h\nindex 5e56ec9b1013a..4c8dc02022e23 100644\n--- a/drivers/net/ethernet/renesas/ravb.h\n+++ b/drivers/net/ethernet/renesas/ravb.h\n@@ -249,6 +249,8 @@ enum APSR_BIT {\n \tAPSR_RDM\t= 0x00002000,\n \tAPSR_TDM\t= 0x00004000,\n \tAPSR_MIISELECT\t= 0x01000000,\t/* R-Car V4M only */\n+\tAPSR_GPTPTIMER_SOURCE = BIT(25), /* Gen4 */\n+\tAPSR_GPTPCLOCK\t= BIT(29),\t/* Gen4 */\n };\n \n /* RCR */\n@@ -1034,6 +1036,31 @@ struct ravb_ptp {\n \tstruct ravb_ptp_perout perout[N_PER_OUT];\n };\n \n+/**\n+ * struct ravb_gptp_info - Platform specific gPTP behavior\n+ *\n+ * Each generation of RAVB have slightly different behaviors when interacting\n+ * with the gPTP clock. This struct provides the callbacks to be called at\n+ * critical points in the RAVB driver.\n+ *\n+ * @probe:\t\tProbe the gPTP clock\n+ * @clock_index:\tGet the PTP clock index, if any\n+ * @set_config_mode:\tEnter config mode\n+ * @dmac_start:\t\tCalled when the DMAC starts\n+ * @dmac_stop:\t\tCalled when the DMAC stops\n+ * @ndev_open:\t\tCalled when the ndev is opened\n+ * @ndev_close:\t\tCalled when the ndev is closed\n+ */\n+struct ravb_gptp_info {\n+\tint (*probe)(struct net_device *ndev);\n+\tint (*clock_index)(struct net_device *ndev);\n+\tint (*set_config_mode)(struct net_device *ndev);\n+\tint (*dmac_start)(struct net_device *ndev);\n+\tvoid (*dmac_stop)(struct net_device *ndev);\n+\tint (*ndev_open)(struct net_device *ndev);\n+\tvoid (*ndev_close)(struct net_device *ndev);\n+};\n+\n struct ravb_hw_info {\n \tint (*receive)(struct net_device *ndev, int budget, int q);\n \tvoid (*set_rate)(struct net_device *ndev);\n@@ -1052,6 +1079,7 @@ struct ravb_hw_info {\n \tu32 rx_buffer_size;\n \tu32 rx_desc_size;\n \tu32 dbat_entry_num;\n+\tconst struct ravb_gptp_info *ptp; /* Callbacks to handle gPTP interactions. */\n \tunsigned aligned_tx: 1;\n \tunsigned coalesce_irqs:1;\t/* Needs software IRQ coalescing */\n \n@@ -1062,9 +1090,6 @@ struct ravb_hw_info {\n \tunsigned multi_irqs:1;\t\t/* AVB-DMAC and E-MAC has multiple irqs */\n \tunsigned irq_en_dis:1;\t\t/* Has separate irq enable and disable regs */\n \tunsigned err_mgmt_irqs:1;\t/* Line1 (Err) and Line2 (Mgmt) irqs are separate */\n-\tunsigned gptp:1;\t\t/* AVB-DMAC has gPTP support */\n-\tunsigned ccc_gac:1;\t\t/* AVB-DMAC has gPTP support active in config mode */\n-\tunsigned gptp_ref_clk:1;\t/* gPTP has separate reference clock */\n \tunsigned nc_queues:1;\t\t/* AVB-DMAC has RX and TX NC queues */\n \tunsigned magic_pkt:1;\t\t/* E-MAC supports magic packet detection */\n \tunsigned half_duplex:1;\t\t/* E-MAC supports half duplex mode */\n@@ -1109,6 +1134,7 @@ struct ravb_private {\n \tstruct list_head ts_skb_list;\n \tu32 ts_skb_tag;\n \tstruct ravb_ptp ptp;\n+\tstruct device_node *of_gptp;\t/* Reference to external gPTP clock, if any. */\n \tspinlock_t lock;\t\t/* Register access lock */\n \tu32 cur_rx[NUM_RX_QUEUE];\t/* Consumer ring indices */\n \tu32 dirty_rx[NUM_RX_QUEUE];\t/* Producer ring indices */\n@@ -1160,7 +1186,7 @@ void ravb_modify(struct net_device *ndev, enum ravb_reg reg, u32 clear,\n int ravb_wait(struct net_device *ndev, enum ravb_reg reg, u32 mask, u32 value);\n \n void ravb_ptp_interrupt(struct net_device *ndev);\n-void ravb_ptp_init(struct net_device *ndev, struct platform_device *pdev);\n+int ravb_ptp_init(struct net_device *ndev);\n void ravb_ptp_stop(struct net_device *ndev);\n \n #endif\t/* #ifndef __RAVB_H__ */\ndiff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c\nindex 5f88733094d0f..30170e92d3d70 100644\n--- a/drivers/net/ethernet/renesas/ravb_main.c\n+++ b/drivers/net/ethernet/renesas/ravb_main.c\n@@ -707,7 +707,15 @@ static int ravb_dmac_init(struct net_device *ndev)\n \t\treturn error;\n \n \t/* Setting the control will start the AVB-DMAC process. */\n-\treturn ravb_set_opmode(ndev, CCC_OPC_OPERATION);\n+\terror = ravb_set_opmode(ndev, CCC_OPC_OPERATION);\n+\tif (error)\n+\t\treturn error;\n+\n+\t/* Initialise PTP Clock driver */\n+\tif (info-\u003eptp \u0026\u0026 info-\u003eptp-\u003edmac_start)\n+\t\treturn info-\u003eptp-\u003edmac_start(ndev);\n+\n+\treturn 0;\n }\n \n static void ravb_get_tx_tstamp(struct net_device *ndev)\n@@ -1115,6 +1123,10 @@ static int ravb_stop_dma(struct net_device *ndev)\n \t\t\tnetdev_err(ndev, \"failed to stop AXI BUS\\n\");\n \t}\n \n+\t/* Stop PTP Clock driver */\n+\tif (info-\u003eptp \u0026\u0026 info-\u003eptp-\u003edmac_stop)\n+\t\tinfo-\u003eptp-\u003edmac_stop(ndev);\n+\n \t/* Stop AVB-DMAC process */\n \treturn ravb_set_opmode(ndev, CCC_OPC_CONFIG);\n }\n@@ -1719,9 +1731,7 @@ static int ravb_set_ringparam(struct net_device *ndev,\n \n \tif (netif_running(ndev)) {\n \t\tnetif_device_detach(ndev);\n-\t\t/* Stop PTP Clock driver */\n-\t\tif (info-\u003egptp)\n-\t\t\travb_ptp_stop(ndev);\n+\n \t\t/* Wait for DMA stopping */\n \t\terror = ravb_stop_dma(ndev);\n \t\tif (error) {\n@@ -1752,10 +1762,6 @@ static int ravb_set_ringparam(struct net_device *ndev,\n \n \t\travb_emac_init(ndev);\n \n-\t\t/* Initialise PTP Clock driver */\n-\t\tif (info-\u003egptp)\n-\t\t\travb_ptp_init(ndev, priv-\u003epdev);\n-\n \t\tnetif_device_attach(ndev);\n \t}\n \n@@ -1767,8 +1773,13 @@ static int ravb_get_ts_info(struct net_device *ndev,\n {\n \tstruct ravb_private *priv = netdev_priv(ndev);\n \tconst struct ravb_hw_info *hw_info = priv-\u003einfo;\n+\tint index = -1;\n+\n+\tif (hw_info-\u003eptp \u0026\u0026 hw_info-\u003eptp-\u003eclock_index)\n+\t\tindex = hw_info-\u003eptp-\u003eclock_index(ndev);\n \n-\tif (hw_info-\u003egptp || hw_info-\u003eccc_gac) {\n+\t/* Only advertise ptp clock if present. */\n+\tif (index \u003e= 0) {\n \t\tinfo-\u003eso_timestamping =\n \t\t\tSOF_TIMESTAMPING_TX_SOFTWARE |\n \t\t\tSOF_TIMESTAMPING_TX_HARDWARE |\n@@ -1779,7 +1790,7 @@ static int ravb_get_ts_info(struct net_device *ndev,\n \t\t\t(1 \u003c\u003c HWTSTAMP_FILTER_NONE) |\n \t\t\t(1 \u003c\u003c HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |\n \t\t\t(1 \u003c\u003c HWTSTAMP_FILTER_ALL);\n-\t\tinfo-\u003ephc_index = ptp_clock_index(priv-\u003eptp.clock);\n+\t\tinfo-\u003ephc_index = index;\n \t}\n \n \treturn 0;\n@@ -1826,55 +1837,24 @@ static const struct ethtool_ops ravb_ethtool_ops = {\n };\n \n static int ravb_set_config_mode(struct net_device *ndev)\n-{\n-\tstruct ravb_private *priv = netdev_priv(ndev);\n-\tconst struct ravb_hw_info *info = priv-\u003einfo;\n-\tint error;\n-\n-\tif (info-\u003egptp) {\n-\t\terror = ravb_set_opmode(ndev, CCC_OPC_CONFIG);\n-\t\tif (error)\n-\t\t\treturn error;\n-\t\t/* Set CSEL value */\n-\t\travb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB);\n-\t} else if (info-\u003eccc_gac) {\n-\t\terror = ravb_set_opmode(ndev, CCC_OPC_CONFIG | CCC_GAC | CCC_CSEL_HPB);\n-\t} else {\n-\t\terror = ravb_set_opmode(ndev, CCC_OPC_CONFIG);\n-\t}\n-\n-\treturn error;\n-}\n-\n-static void ravb_set_gti(struct net_device *ndev)\n {\n \tstruct ravb_private *priv = netdev_priv(ndev);\n \tconst struct ravb_hw_info *info = priv-\u003einfo;\n \n-\tif (!(info-\u003egptp || info-\u003eccc_gac))\n-\t\treturn;\n+\tif (info-\u003eptp \u0026\u0026 info-\u003eptp-\u003eset_config_mode)\n+\t\treturn info-\u003eptp-\u003eset_config_mode(ndev);\n \n-\travb_write(ndev, priv-\u003egti_tiv, GTI);\n-\n-\t/* Request GTI loading */\n-\travb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);\n+\treturn ravb_set_opmode(ndev, CCC_OPC_CONFIG);\n }\n \n-static int ravb_compute_gti(struct net_device *ndev)\n+static int ravb_compute_gti(struct net_device *ndev, struct clk *clk)\n {\n \tstruct ravb_private *priv = netdev_priv(ndev);\n-\tconst struct ravb_hw_info *info = priv-\u003einfo;\n \tstruct device *dev = ndev-\u003edev.parent;\n \tunsigned long rate;\n \tu64 inc;\n \n-\tif (!(info-\u003egptp || info-\u003eccc_gac))\n-\t\treturn 0;\n-\n-\tif (info-\u003egptp_ref_clk)\n-\t\trate = clk_get_rate(priv-\u003egptp_clk);\n-\telse\n-\t\trate = clk_get_rate(priv-\u003eclk);\n+\trate = clk_get_rate(clk);\n \tif (!rate)\n \t\treturn -EINVAL;\n \n@@ -1974,11 +1954,12 @@ static int ravb_open(struct net_device *ndev)\n \n \travb_emac_init(ndev);\n \n-\travb_set_gti(ndev);\n-\n \t/* Initialise PTP Clock driver */\n-\tif (info-\u003egptp || info-\u003eccc_gac)\n-\t\travb_ptp_init(ndev, priv-\u003epdev);\n+\tif (info-\u003eptp \u0026\u0026 info-\u003eptp-\u003endev_open) {\n+\t\terror = info-\u003eptp-\u003endev_open(ndev);\n+\t\tif (error)\n+\t\t\tgoto out_ptp_stop;\n+\t}\n \n \t/* PHY control start */\n \terror = ravb_phy_start(ndev);\n@@ -1990,9 +1971,6 @@ static int ravb_open(struct net_device *ndev)\n \treturn 0;\n \n out_ptp_stop:\n-\t/* Stop PTP Clock driver */\n-\tif (info-\u003egptp || info-\u003eccc_gac)\n-\t\travb_ptp_stop(ndev);\n \travb_stop_dma(ndev);\n out_set_reset:\n \travb_set_opmode(ndev, CCC_OPC_RESET);\n@@ -2036,10 +2014,6 @@ static void ravb_tx_timeout_work(struct work_struct *work)\n \n \tnetif_tx_stop_all_queues(ndev);\n \n-\t/* Stop PTP Clock driver */\n-\tif (info-\u003egptp)\n-\t\travb_ptp_stop(ndev);\n-\n \t/* Wait for DMA stopping */\n \tif (ravb_stop_dma(ndev)) {\n \t\t/* If ravb_stop_dma() fails, the hardware is still operating\n@@ -2072,10 +2046,6 @@ static void ravb_tx_timeout_work(struct work_struct *work)\n \travb_emac_init(ndev);\n \n out:\n-\t/* Initialise PTP Clock driver */\n-\tif (info-\u003egptp)\n-\t\travb_ptp_init(ndev, priv-\u003epdev);\n-\n \tnetif_tx_start_all_queues(ndev);\n \n out_unlock:\n@@ -2208,7 +2178,7 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)\n \tdesc-\u003edptr = cpu_to_le32(dma_addr);\n \n \t/* TX timestamp required */\n-\tif (info-\u003egptp || info-\u003eccc_gac) {\n+\tif (info-\u003eptp) {\n \t\tif (q == RAVB_NC) {\n \t\t\tts_skb = kmalloc_obj(*ts_skb, GFP_ATOMIC);\n \t\t\tif (!ts_skb) {\n@@ -2390,8 +2360,8 @@ static int ravb_close(struct net_device *ndev)\n \t}\n \n \t/* Stop PTP Clock driver */\n-\tif (info-\u003egptp || info-\u003eccc_gac)\n-\t\travb_ptp_stop(ndev);\n+\tif (info-\u003eptp \u0026\u0026 info-\u003eptp-\u003endev_close)\n+\t\tinfo-\u003eptp-\u003endev_close(ndev);\n \n \t/* Set the config mode to stop the AVB-DMAC's processes */\n \tif (ravb_stop_dma(ndev) \u003c 0)\n@@ -2399,7 +2369,7 @@ static int ravb_close(struct net_device *ndev)\n \t\t\t   \"device will be stopped after h/w processes are done.\\n\");\n \n \t/* Clear the timestamp list */\n-\tif (info-\u003egptp || info-\u003eccc_gac) {\n+\tif (info-\u003eptp) {\n \t\tlist_for_each_entry_safe(ts_skb, ts_skb2, \u0026priv-\u003ets_skb_list, list) {\n \t\t\tlist_del(\u0026ts_skb-\u003elist);\n \t\t\tkfree_skb(ts_skb-\u003eskb);\n@@ -2681,6 +2651,42 @@ static int ravb_mdio_release(struct ravb_private *priv)\n \treturn 0;\n }\n \n+static int ravb_gen2_ptp_probe(struct net_device *ndev)\n+{\n+\tstruct ravb_private *priv = netdev_priv(ndev);\n+\n+\treturn ravb_compute_gti(ndev, priv-\u003eclk);\n+}\n+\n+static int ravb_gen2_ptp_clock_index(struct net_device *ndev)\n+{\n+\tstruct ravb_private *priv = netdev_priv(ndev);\n+\n+\treturn ptp_clock_index(priv-\u003eptp.clock);\n+}\n+\n+static int ravb_gen2_ptp_set_config_mode(struct net_device *ndev)\n+{\n+\tint ret;\n+\n+\tret = ravb_set_opmode(ndev, CCC_OPC_CONFIG);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* gPTP Clock Select High-speed peripheral bus clock. */\n+\travb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB);\n+\n+\treturn 0;\n+}\n+\n+static const struct ravb_gptp_info ravb_gen2_ptp_info = {\n+\t.probe = ravb_gen2_ptp_probe,\n+\t.clock_index = ravb_gen2_ptp_clock_index,\n+\t.set_config_mode = ravb_gen2_ptp_set_config_mode,\n+\t.dmac_start = ravb_ptp_init,\n+\t.dmac_stop = ravb_ptp_stop,\n+};\n+\n static const struct ravb_hw_info ravb_gen2_hw_info = {\n \t.receive = ravb_rx_rcar,\n \t.set_rate = ravb_set_rate_rcar,\n@@ -2699,12 +2705,26 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {\n \t\t\t  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),\n \t.rx_desc_size = sizeof(struct ravb_ex_rx_desc),\n \t.dbat_entry_num = 22,\n+\t.ptp = \u0026ravb_gen2_ptp_info,\n \t.aligned_tx = 1,\n-\t.gptp = 1,\n \t.nc_queues = 1,\n \t.magic_pkt = 1,\n };\n \n+static int ravb_gen3_ptp_set_config_mode(struct net_device *ndev)\n+{\n+\t/* Enable gPTP Clock and Select High-speed peripheral bus clock. */\n+\treturn ravb_set_opmode(ndev, CCC_OPC_CONFIG | CCC_GAC | CCC_CSEL_HPB);\n+}\n+\n+static const struct ravb_gptp_info ravb_gen3_ptp_info = {\n+\t.probe = ravb_gen2_ptp_probe,\n+\t.clock_index = ravb_gen2_ptp_clock_index,\n+\t.set_config_mode = ravb_gen3_ptp_set_config_mode,\n+\t.ndev_open = ravb_ptp_init,\n+\t.ndev_close = ravb_ptp_stop,\n+};\n+\n static const struct ravb_hw_info ravb_gen3_hw_info = {\n \t.receive = ravb_rx_rcar,\n \t.set_rate = ravb_set_rate_rcar,\n@@ -2723,15 +2743,68 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {\n \t\t\t  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),\n \t.rx_desc_size = sizeof(struct ravb_ex_rx_desc),\n \t.dbat_entry_num = 22,\n+\t.ptp = \u0026ravb_gen3_ptp_info,\n \t.internal_delay = 1,\n \t.tx_counters = 1,\n \t.multi_irqs = 1,\n \t.irq_en_dis = 1,\n-\t.ccc_gac = 1,\n \t.nc_queues = 1,\n \t.magic_pkt = 1,\n };\n \n+static int ravb_gen4_ptp_probe(struct net_device *ndev)\n+{\n+\tstruct ravb_private *priv = netdev_priv(ndev);\n+\n+\tpriv-\u003eof_gptp =\n+\t\tof_parse_phandle(priv-\u003epdev-\u003edev.of_node, \"ptp-timer\", 0);\n+\tif (!priv-\u003eof_gptp)\n+\t\treturn 0;\n+\n+\tif (!of_device_is_available(priv-\u003eof_gptp)) {\n+\t\tof_node_put(priv-\u003eof_gptp);\n+\t\tpriv-\u003eof_gptp = NULL;\n+\t\treturn 0;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int ravb_gen4_ptp_clock_index(struct net_device *ndev)\n+{\n+\tstruct ravb_private *priv = netdev_priv(ndev);\n+\n+\t/* If no clock, mimic ptp_clock_index_by_of_node() fail and return -1 */\n+\tif (!priv-\u003eof_gptp)\n+\t\treturn -1;\n+\n+\treturn ptp_clock_index_by_of_node(priv-\u003eof_gptp);\n+}\n+\n+static int ravb_gen4_ptp_set_config_mode(struct net_device *ndev)\n+{\n+\tstruct ravb_private *priv = netdev_priv(ndev);\n+\tint ret;\n+\n+\t/* Enable gPTP Clock and Select High-speed peripheral bus clock. */\n+\tret = ravb_set_opmode(ndev, CCC_OPC_CONFIG | CCC_GAC | CCC_CSEL_HPB);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Set PTP source to GPTP module, only option on Gen4. */\n+\tif (priv-\u003eof_gptp)\n+\t\travb_modify(ndev, APSR, APSR_GPTPTIMER_SOURCE | APSR_GPTPCLOCK,\n+\t\t\t    APSR_GPTPTIMER_SOURCE | APSR_GPTPCLOCK);\n+\n+\treturn 0;\n+}\n+\n+static const struct ravb_gptp_info ravb_gen4_ptp_info = {\n+\t.probe = ravb_gen4_ptp_probe,\n+\t.clock_index = ravb_gen4_ptp_clock_index,\n+\t.set_config_mode = ravb_gen4_ptp_set_config_mode,\n+};\n+\n static const struct ravb_hw_info ravb_gen4_hw_info = {\n \t.receive = ravb_rx_rcar,\n \t.set_rate = ravb_set_rate_rcar,\n@@ -2754,11 +2827,30 @@ static const struct ravb_hw_info ravb_gen4_hw_info = {\n \t.tx_counters = 1,\n \t.multi_irqs = 1,\n \t.irq_en_dis = 1,\n-\t.ccc_gac = 1,\n+\t.ptp = \u0026ravb_gen4_ptp_info,\n \t.nc_queues = 1,\n \t.magic_pkt = 1,\n };\n \n+static int ravb_rzv2m_ptp_probe(struct net_device *ndev)\n+{\n+\tstruct ravb_private *priv = netdev_priv(ndev);\n+\n+\tpriv-\u003egptp_clk = devm_clk_get(\u0026priv-\u003epdev-\u003edev, \"gptp\");\n+\tif (IS_ERR(priv-\u003egptp_clk))\n+\t\treturn PTR_ERR(priv-\u003egptp_clk);\n+\n+\treturn ravb_compute_gti(ndev, priv-\u003egptp_clk);\n+}\n+\n+static const struct ravb_gptp_info ravb_rzv2m_ptp_info = {\n+\t.probe = ravb_rzv2m_ptp_probe,\n+\t.clock_index = ravb_gen2_ptp_clock_index,\n+\t.set_config_mode = ravb_gen2_ptp_set_config_mode,\n+\t.dmac_start = ravb_ptp_init,\n+\t.dmac_stop = ravb_ptp_stop,\n+};\n+\n static const struct ravb_hw_info ravb_rzv2m_hw_info = {\n \t.receive = ravb_rx_rcar,\n \t.set_rate = ravb_set_rate_rcar,\n@@ -2779,8 +2871,7 @@ static const struct ravb_hw_info ravb_rzv2m_hw_info = {\n \t.dbat_entry_num = 22,\n \t.multi_irqs = 1,\n \t.err_mgmt_irqs = 1,\n-\t.gptp = 1,\n-\t.gptp_ref_clk = 1,\n+\t.ptp = \u0026ravb_rzv2m_ptp_info,\n \t.nc_queues = 1,\n \t.magic_pkt = 1,\n };\n@@ -2970,12 +3061,10 @@ static int ravb_probe(struct platform_device *pdev)\n \t\tgoto out_reset_assert;\n \t}\n \n-\tif (info-\u003egptp_ref_clk) {\n-\t\tpriv-\u003egptp_clk = devm_clk_get(\u0026pdev-\u003edev, \"gptp\");\n-\t\tif (IS_ERR(priv-\u003egptp_clk)) {\n-\t\t\terror = PTR_ERR(priv-\u003egptp_clk);\n+\tif (info-\u003eptp \u0026\u0026 info-\u003eptp-\u003eprobe) {\n+\t\terror = info-\u003eptp-\u003eprobe(ndev);\n+\t\tif (error)\n \t\t\tgoto out_reset_assert;\n-\t\t}\n \t}\n \n \tpriv-\u003erefclk = devm_clk_get_optional(\u0026pdev-\u003edev, \"refclk\");\n@@ -3028,10 +3117,6 @@ static int ravb_probe(struct platform_device *pdev)\n \tndev-\u003enetdev_ops = \u0026ravb_netdev_ops;\n \tndev-\u003eethtool_ops = \u0026ravb_ethtool_ops;\n \n-\terror = ravb_compute_gti(ndev);\n-\tif (error)\n-\t\tgoto out_rpm_put;\n-\n \travb_parse_delay_mode(np, ndev);\n \n \t/* Allocate descriptor base address table */\n@@ -3154,6 +3239,7 @@ static void ravb_remove(struct platform_device *pdev)\n \tpm_runtime_disable(\u0026pdev-\u003edev);\n \tpm_runtime_dont_use_autosuspend(dev);\n \tclk_unprepare(priv-\u003erefclk);\n+\tof_node_put(priv-\u003eof_gptp);\n \treset_control_assert(priv-\u003erstc);\n \tfree_netdev(ndev);\n \tplatform_set_drvdata(pdev, NULL);\n@@ -3179,9 +3265,6 @@ static int ravb_wol_setup(struct net_device *ndev)\n \t/* Enable MagicPacket */\n \travb_modify(ndev, ECMR, ECMR_MPDE, ECMR_MPDE);\n \n-\tif (priv-\u003einfo-\u003eccc_gac)\n-\t\travb_ptp_stop(ndev);\n-\n \treturn enable_irq_wake(priv-\u003eemac_irq);\n }\n \n@@ -3201,9 +3284,6 @@ static int ravb_wol_restore(struct net_device *ndev)\n \tif (error)\n \t\treturn error;\n \n-\tif (priv-\u003einfo-\u003eccc_gac)\n-\t\travb_ptp_init(ndev, priv-\u003epdev);\n-\n \tif (info-\u003enc_queues)\n \t\tnapi_enable(\u0026priv-\u003enapi[RAVB_NC]);\n \tnapi_enable(\u0026priv-\u003enapi[RAVB_BE]);\ndiff --git a/drivers/net/ethernet/renesas/ravb_ptp.c b/drivers/net/ethernet/renesas/ravb_ptp.c\nindex 226c6c0ab945b..473a2aedb745e 100644\n--- a/drivers/net/ethernet/renesas/ravb_ptp.c\n+++ b/drivers/net/ethernet/renesas/ravb_ptp.c\n@@ -312,22 +312,39 @@ void ravb_ptp_interrupt(struct net_device *ndev)\n \travb_write(ndev, ~(gis | GIS_RESERVED), GIS);\n }\n \n-void ravb_ptp_init(struct net_device *ndev, struct platform_device *pdev)\n+int ravb_ptp_init(struct net_device *ndev)\n {\n \tstruct ravb_private *priv = netdev_priv(ndev);\n \tunsigned long flags;\n+\tint ret = 0;\n \n \tpriv-\u003eptp.info = ravb_ptp_info;\n \n-\tpriv-\u003eptp.default_addend = ravb_read(ndev, GTI);\n+\tpriv-\u003eptp.default_addend = priv-\u003egti_tiv;\n \tpriv-\u003eptp.current_addend = priv-\u003eptp.default_addend;\n \n \tspin_lock_irqsave(\u0026priv-\u003elock, flags);\n+\n+\t/* Set gPTP Timer Increment Value. */\n+\travb_write(ndev, priv-\u003eptp.default_addend, GTI);\n+\n+\t/* Request GTI loading. */\n+\travb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);\n+\n+\t/* Wait for GIT loading to complete. */\n \travb_wait(ndev, GCCR, GCCR_TCR, GCCR_TCR_NOREQ);\n+\n \travb_modify(ndev, GCCR, GCCR_TCSS, GCCR_TCSS_ADJGPTP);\n \tspin_unlock_irqrestore(\u0026priv-\u003elock, flags);\n \n-\tpriv-\u003eptp.clock = ptp_clock_register(\u0026priv-\u003eptp.info, \u0026pdev-\u003edev);\n+\tpriv-\u003eptp.clock = ptp_clock_register(\u0026priv-\u003eptp.info, \u0026priv-\u003epdev-\u003edev);\n+\tif (IS_ERR(priv-\u003eptp.clock)) {\n+\t\tret = PTR_ERR(priv-\u003eptp.clock);\n+\t\tpriv-\u003eptp.clock = NULL;\n+\t\travb_ptp_stop(ndev);\n+\t}\n+\n+\treturn ret;\n }\n \n void ravb_ptp_stop(struct net_device *ndev)\n@@ -337,5 +354,6 @@ void ravb_ptp_stop(struct net_device *ndev)\n \travb_write(ndev, 0, GIC);\n \travb_write(ndev, 0, GIS);\n \n-\tptp_clock_unregister(priv-\u003eptp.clock);\n+\tif (priv-\u003eptp.clock)\n+\t\tptp_clock_unregister(priv-\u003eptp.clock);\n }\n"
}

2/1 2026/08/11 16:41 agent patch-evaluator
0m Model:
best-expensive

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch refactors gPTP support in the Renesas Ethernet AVB (ravb) driver, adding support for Gen4 gPTP and introducing a struct for platform-specific callbacks. This is a vendor-specific platform driver for Renesas R-Car SoCs. The hardware is not emulated in standard QEMU/GCE environments, and the driver requires specific device tree nodes to probe. Therefore, the modified code paths are unreachable during standard fuzzing.",
  "WorthFuzzing": false
}

Instruction:
You are an expert Linux kernel maintainer.
Your job is to review a provided patch series and determine
if it makes functional changes to the kernel that should be fuzzed.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively
use your code access tools to examine the actual source code and confirm any assumptions.

Return WorthFuzzing=false if the patch only contains:
- Modifications to Documentation/, Kconfig files, or code comments.
- Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints.
- Changes to numeric constants or macros that do not functionally alter execution flow.
- Code paths that are impossible to reach in virtualized environments like GCE or QEMU,
  even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim).
- Code in vendor-specific PCIe switch, SmartNIC, or GPU drivers (e.g., mlxsw, pds_core, qed,
  ionic, amdgpu) that require physical PCIe hardware cards not emulated in standard QEMU.
- Driver .remove, .shutdown, or pci_unregister_driver teardown callbacks (e.g., igb_remove)
  that are executed only during PCI hot-unplug or sysfs driver unbind operations.

If it modifies reachable core kernel logic, drivers, or architectures, use your code search
tools to verify the code can be executed, then return WorthFuzzing=true.

When returning WorthFuzzing=true, you MUST ALSO:
1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols.
   Avoid listing generic hot-path functions to prevent skewed test distributions.
   Prefer non-static, non-inlined API entrypoint functions over internal static helper functions
   (which are inlined by the compiler and do not have distinct symbol addresses).
2. Identify any specific CONFIG_ options required to properly test this new/modified feature.
   Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions.
   Also check "depends on" lines in Kconfig to include any non-standard parent subsystem configs
   needed for Kbuild to compile the code statically into vmlinux. List them in the EnableConfigs
   output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
For your convenience, here is the diff of the changes:
commit dcc705ffe8ebbf669c7932e642a61d50a51c0800
Author: syz-cluster <triage@syzkaller.com>
Date:   Tue Aug 11 16:41:33 2026 +0000

    syz-cluster: applied patch under review

diff --git a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
index 1e00ef5b3acda..fad002492421a 100644
--- a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
+++ b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
@@ -97,6 +97,8 @@ properties:
 
   phy-handle: true
 
+  ptp-timer: true
+
   '#address-cells':
     description: Number of address cells for the MDIO bus.
     const: 1
@@ -305,6 +307,15 @@ allOf:
             items:
               - const: fck
               - const: refclk
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              const: renesas,etheravb-rcar-gen4
+    then:
+      properties:
+        ptp-timer: false
 
 additionalProperties: false
 
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 5e56ec9b1013a..4c8dc02022e23 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -249,6 +249,8 @@ enum APSR_BIT {
 	APSR_RDM	= 0x00002000,
 	APSR_TDM	= 0x00004000,
 	APSR_MIISELECT	= 0x01000000,	/* R-Car V4M only */
+	APSR_GPTPTIMER_SOURCE = BIT(25), /* Gen4 */
+	APSR_GPTPCLOCK	= BIT(29),	/* Gen4 */
 };
 
 /* RCR */
@@ -1034,6 +1036,31 @@ struct ravb_ptp {
 	struct ravb_ptp_perout perout[N_PER_OUT];
 };
 
+/**
+ * struct ravb_gptp_info - Platform specific gPTP behavior
+ *
+ * Each generation of RAVB have slightly different behaviors when interacting
+ * with the gPTP clock. This struct provides the callbacks to be called at
+ * critical points in the RAVB driver.
+ *
+ * @probe:		Probe the gPTP clock
+ * @clock_index:	Get the PTP clock index, if any
+ * @set_config_mode:	Enter config mode
+ * @dmac_start:		Called when the DMAC starts
+ * @dmac_stop:		Called when the DMAC stops
+ * @ndev_open:		Called when the ndev is opened
+ * @ndev_close:		Called when the ndev is closed
+ */
+struct ravb_gptp_info {
+	int (*probe)(struct net_device *ndev);
+	int (*clock_index)(struct net_device *ndev);
+	int (*set_config_mode)(struct net_device *ndev);
+	int (*dmac_start)(struct net_device *ndev);
+	void (*dmac_stop)(struct net_device *ndev);
+	int (*ndev_open)(struct net_device *ndev);
+	void (*ndev_close)(struct net_device *ndev);
+};
+
 struct ravb_hw_info {
 	int (*receive)(struct net_device *ndev, int budget, int q);
 	void (*set_rate)(struct net_device *ndev);
@@ -1052,6 +1079,7 @@ struct ravb_hw_info {
 	u32 rx_buffer_size;
 	u32 rx_desc_size;
 	u32 dbat_entry_num;
+	const struct ravb_gptp_info *ptp; /* Callbacks to handle gPTP interactions. */
 	unsigned aligned_tx: 1;
 	unsigned coalesce_irqs:1;	/* Needs software IRQ coalescing */
 
@@ -1062,9 +1090,6 @@ struct ravb_hw_info {
 	unsigned multi_irqs:1;		/* AVB-DMAC and E-MAC has multiple irqs */
 	unsigned irq_en_dis:1;		/* Has separate irq enable and disable regs */
 	unsigned err_mgmt_irqs:1;	/* Line1 (Err) and Line2 (Mgmt) irqs are separate */
-	unsigned gptp:1;		/* AVB-DMAC has gPTP support */
-	unsigned ccc_gac:1;		/* AVB-DMAC has gPTP support active in config mode */
-	unsigned gptp_ref_clk:1;	/* gPTP has separate reference clock */
 	unsigned nc_queues:1;		/* AVB-DMAC has RX and TX NC queues */
 	unsigned magic_pkt:1;		/* E-MAC supports magic packet detection */
 	unsigned half_duplex:1;		/* E-MAC supports half duplex mode */
@@ -1109,6 +1134,7 @@ struct ravb_private {
 	struct list_head ts_skb_list;
 	u32 ts_skb_tag;
 	struct ravb_ptp ptp;
+	struct device_node *of_gptp;	/* Reference to external gPTP clock, if any. */
 	spinlock_t lock;		/* Register access lock */
 	u32 cur_rx[NUM_RX_QUEUE];	/* Consumer ring indices */
 	u32 dirty_rx[NUM_RX_QUEUE];	/* Producer ring indices */
@@ -1160,7 +1186,7 @@ void ravb_modify(struct net_device *ndev, enum ravb_reg reg, u32 clear,
 int ravb_wait(struct net_device *ndev, enum ravb_reg reg, u32 mask, u32 value);
 
 void ravb_ptp_interrupt(struct net_device *ndev);
-void ravb_ptp_init(struct net_device *ndev, struct platform_device *pdev);
+int ravb_ptp_init(struct net_device *ndev);
 void ravb_ptp_stop(struct net_device *ndev);
 
 #endif	/* #ifndef __RAVB_H__ */
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 5f88733094d0f..30170e92d3d70 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -707,7 +707,15 @@ static int ravb_dmac_init(struct net_device *ndev)
 		return error;
 
 	/* Setting the control will start the AVB-DMAC process. */
-	return ravb_set_opmode(ndev, CCC_OPC_OPERATION);
+	error = ravb_set_opmode(ndev, CCC_OPC_OPERATION);
+	if (error)
+		return error;
+
+	/* Initialise PTP Clock driver */
+	if (info->ptp && info->ptp->dmac_start)
+		return info->ptp->dmac_start(ndev);
+
+	return 0;
 }
 
 static void ravb_get_tx_tstamp(struct net_device *ndev)
@@ -1115,6 +1123,10 @@ static int ravb_stop_dma(struct net_device *ndev)
 			netdev_err(ndev, "failed to stop AXI BUS\n");
 	}
 
+	/* Stop PTP Clock driver */
+	if (info->ptp && info->ptp->dmac_stop)
+		info->ptp->dmac_stop(ndev);
+
 	/* Stop AVB-DMAC process */
 	return ravb_set_opmode(ndev, CCC_OPC_CONFIG);
 }
@@ -1719,9 +1731,7 @@ static int ravb_set_ringparam(struct net_device *ndev,
 
 	if (netif_running(ndev)) {
 		netif_device_detach(ndev);
-		/* Stop PTP Clock driver */
-		if (info->gptp)
-			ravb_ptp_stop(ndev);
+
 		/* Wait for DMA stopping */
 		error = ravb_stop_dma(ndev);
 		if (error) {
@@ -1752,10 +1762,6 @@ static int ravb_set_ringparam(struct net_device *ndev,
 
 		ravb_emac_init(ndev);
 
-		/* Initialise PTP Clock driver */
-		if (info->gptp)
-			ravb_ptp_init(ndev, priv->pdev);
-
 		netif_device_attach(ndev);
 	}
 
@@ -1767,8 +1773,13 @@ static int ravb_get_ts_info(struct net_device *ndev,
 {
 	struct ravb_private *priv = netdev_priv(ndev);
 	const struct ravb_hw_info *hw_info = priv->info;
+	int index = -1;
+
+	if (hw_info->ptp && hw_info->ptp->clock_index)
+		index = hw_info->ptp->clock_index(ndev);
 
-	if (hw_info->gptp || hw_info->ccc_gac) {
+	/* Only advertise ptp clock if present. */
+	if (index >= 0) {
 		info->so_timestamping =
 			SOF_TIMESTAMPING_TX_SOFTWARE |
 			SOF_TIMESTAMPING_TX_HARDWARE |
@@ -1779,7 +1790,7 @@ static int ravb_get_ts_info(struct net_device *ndev,
 			(1 << HWTSTAMP_FILTER_NONE) |
 			(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
 			(1 << HWTSTAMP_FILTER_ALL);
-		info->phc_index = ptp_clock_index(priv->ptp.clock);
+		info->phc_index = index;
 	}
 
 	return 0;
@@ -1826,55 +1837,24 @@ static const struct ethtool_ops ravb_ethtool_ops = {
 };
 
 static int ravb_set_config_mode(struct net_device *ndev)
-{
-	struct ravb_private *priv = netdev_priv(ndev);
-	const struct ravb_hw_info *info = priv->info;
-	int error;
-
-	if (info->gptp) {
-		error = ravb_set_opmode(ndev, CCC_OPC_CONFIG);
-		if (error)
-			return error;
-		/* Set CSEL value */
-		ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB);
-	} else if (info->ccc_gac) {
-		error = ravb_set_opmode(ndev, CCC_OPC_CONFIG | CCC_GAC | CCC_CSEL_HPB);
-	} else {
-		error = ravb_set_opmode(ndev, CCC_OPC_CONFIG);
-	}
-
-	return error;
-}
-
-static void ravb_set_gti(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
 	const struct ravb_hw_info *info = priv->info;
 
-	if (!(info->gptp || info->ccc_gac))
-		return;
+	if (info->ptp && info->ptp->set_config_mode)
+		return info->ptp->set_config_mode(ndev);
 
-	ravb_write(ndev, priv->gti_tiv, GTI);
-
-	/* Request GTI loading */
-	ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
+	return ravb_set_opmode(ndev, CCC_OPC_CONFIG);
 }
 
-static int ravb_compute_gti(struct net_device *ndev)
+static int ravb_compute_gti(struct net_device *ndev, struct clk *clk)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
-	const struct ravb_hw_info *info = priv->info;
 	struct device *dev = ndev->dev.parent;
 	unsigned long rate;
 	u64 inc;
 
-	if (!(info->gptp || info->ccc_gac))
-		return 0;
-
-	if (info->gptp_ref_clk)
-		rate = clk_get_rate(priv->gptp_clk);
-	else
-		rate = clk_get_rate(priv->clk);
+	rate = clk_get_rate(clk);
 	if (!rate)
 		return -EINVAL;
 
@@ -1974,11 +1954,12 @@ static int ravb_open(struct net_device *ndev)
 
 	ravb_emac_init(ndev);
 
-	ravb_set_gti(ndev);
-
 	/* Initialise PTP Clock driver */
-	if (info->gptp || info->ccc_gac)
-		ravb_ptp_init(ndev, priv->pdev);
+	if (info->ptp && info->ptp->ndev_open) {
+		error = info->ptp->ndev_open(ndev);
+		if (error)
+			goto out_ptp_stop;
+	}
 
 	/* PHY control start */
 	error = ravb_phy_start(ndev);
@@ -1990,9 +1971,6 @@ static int ravb_open(struct net_device *ndev)
 	return 0;
 
 out_ptp_stop:
-	/* Stop PTP Clock driver */
-	if (info->gptp || info->ccc_gac)
-		ravb_ptp_stop(ndev);
 	ravb_stop_dma(ndev);
 out_set_reset:
 	ravb_set_opmode(ndev, CCC_OPC_RESET);
@@ -2036,10 +2014,6 @@ static void ravb_tx_timeout_work(struct work_struct *work)
 
 	netif_tx_stop_all_queues(ndev);
 
-	/* Stop PTP Clock driver */
-	if (info->gptp)
-		ravb_ptp_stop(ndev);
-
 	/* Wait for DMA stopping */
 	if (ravb_stop_dma(ndev)) {
 		/* If ravb_stop_dma() fails, the hardware is still operating
@@ -2072,10 +2046,6 @@ static void ravb_tx_timeout_work(struct work_struct *work)
 	ravb_emac_init(ndev);
 
 out:
-	/* Initialise PTP Clock driver */
-	if (info->gptp)
-		ravb_ptp_init(ndev, priv->pdev);
-
 	netif_tx_start_all_queues(ndev);
 
 out_unlock:
@@ -2208,7 +2178,7 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	desc->dptr = cpu_to_le32(dma_addr);
 
 	/* TX timestamp required */
-	if (info->gptp || info->ccc_gac) {
+	if (info->ptp) {
 		if (q == RAVB_NC) {
 			ts_skb = kmalloc_obj(*ts_skb, GFP_ATOMIC);
 			if (!ts_skb) {
@@ -2390,8 +2360,8 @@ static int ravb_close(struct net_device *ndev)
 	}
 
 	/* Stop PTP Clock driver */
-	if (info->gptp || info->ccc_gac)
-		ravb_ptp_stop(ndev);
+	if (info->ptp && info->ptp->ndev_close)
+		info->ptp->ndev_close(ndev);
 
 	/* Set the config mode to stop the AVB-DMAC's processes */
 	if (ravb_stop_dma(ndev) < 0)
@@ -2399,7 +2369,7 @@ static int ravb_close(struct net_device *ndev)
 			   "device will be stopped after h/w processes are done.\n");
 
 	/* Clear the timestamp list */
-	if (info->gptp || info->ccc_gac) {
+	if (info->ptp) {
 		list_for_each_entry_safe(ts_skb, ts_skb2, &priv->ts_skb_list, list) {
 			list_del(&ts_skb->list);
 			kfree_skb(ts_skb->skb);
@@ -2681,6 +2651,42 @@ static int ravb_mdio_release(struct ravb_private *priv)
 	return 0;
 }
 
+static int ravb_gen2_ptp_probe(struct net_device *ndev)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+
+	return ravb_compute_gti(ndev, priv->clk);
+}
+
+static int ravb_gen2_ptp_clock_index(struct net_device *ndev)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+
+	return ptp_clock_index(priv->ptp.clock);
+}
+
+static int ravb_gen2_ptp_set_config_mode(struct net_device *ndev)
+{
+	int ret;
+
+	ret = ravb_set_opmode(ndev, CCC_OPC_CONFIG);
+	if (ret)
+		return ret;
+
+	/* gPTP Clock Select High-speed peripheral bus clock. */
+	ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB);
+
+	return 0;
+}
+
+static const struct ravb_gptp_info ravb_gen2_ptp_info = {
+	.probe = ravb_gen2_ptp_probe,
+	.clock_index = ravb_gen2_ptp_clock_index,
+	.set_config_mode = ravb_gen2_ptp_set_config_mode,
+	.dmac_start = ravb_ptp_init,
+	.dmac_stop = ravb_ptp_stop,
+};
+
 static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.receive = ravb_rx_rcar,
 	.set_rate = ravb_set_rate_rcar,
@@ -2699,12 +2705,26 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
 			  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
 	.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
 	.dbat_entry_num = 22,
+	.ptp = &ravb_gen2_ptp_info,
 	.aligned_tx = 1,
-	.gptp = 1,
 	.nc_queues = 1,
 	.magic_pkt = 1,
 };
 
+static int ravb_gen3_ptp_set_config_mode(struct net_device *ndev)
+{
+	/* Enable gPTP Clock and Select High-speed peripheral bus clock. */
+	return ravb_set_opmode(ndev, CCC_OPC_CONFIG | CCC_GAC | CCC_CSEL_HPB);
+}
+
+static const struct ravb_gptp_info ravb_gen3_ptp_info = {
+	.probe = ravb_gen2_ptp_probe,
+	.clock_index = ravb_gen2_ptp_clock_index,
+	.set_config_mode = ravb_gen3_ptp_set_config_mode,
+	.ndev_open = ravb_ptp_init,
+	.ndev_close = ravb_ptp_stop,
+};
+
 static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.receive = ravb_rx_rcar,
 	.set_rate = ravb_set_rate_rcar,
@@ -2723,15 +2743,68 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 			  SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
 	.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
 	.dbat_entry_num = 22,
+	.ptp = &ravb_gen3_ptp_info,
 	.internal_delay = 1,
 	.tx_counters = 1,
 	.multi_irqs = 1,
 	.irq_en_dis = 1,
-	.ccc_gac = 1,
 	.nc_queues = 1,
 	.magic_pkt = 1,
 };
 
+static int ravb_gen4_ptp_probe(struct net_device *ndev)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+
+	priv->of_gptp =
+		of_parse_phandle(priv->pdev->dev.of_node, "ptp-timer", 0);
+	if (!priv->of_gptp)
+		return 0;
+
+	if (!of_device_is_available(priv->of_gptp)) {
+		of_node_put(priv->of_gptp);
+		priv->of_gptp = NULL;
+		return 0;
+	}
+
+	return 0;
+}
+
+static int ravb_gen4_ptp_clock_index(struct net_device *ndev)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+
+	/* If no clock, mimic ptp_clock_index_by_of_node() fail and return -1 */
+	if (!priv->of_gptp)
+		return -1;
+
+	return ptp_clock_index_by_of_node(priv->of_gptp);
+}
+
+static int ravb_gen4_ptp_set_config_mode(struct net_device *ndev)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+	int ret;
+
+	/* Enable gPTP Clock and Select High-speed peripheral bus clock. */
+	ret = ravb_set_opmode(ndev, CCC_OPC_CONFIG | CCC_GAC | CCC_CSEL_HPB);
+	if (ret)
+		return ret;
+
+	/* Set PTP source to GPTP module, only option on Gen4. */
+	if (priv->of_gptp)
+		ravb_modify(ndev, APSR, APSR_GPTPTIMER_SOURCE | APSR_GPTPCLOCK,
+			    APSR_GPTPTIMER_SOURCE | APSR_GPTPCLOCK);
+
+	return 0;
+}
+
+static const struct ravb_gptp_info ravb_gen4_ptp_info = {
+	.probe = ravb_gen4_ptp_probe,
+	.clock_index = ravb_gen4_ptp_clock_index,
+	.set_config_mode = ravb_gen4_ptp_set_config_mode,
+};
+
 static const struct ravb_hw_info ravb_gen4_hw_info = {
 	.receive = ravb_rx_rcar,
 	.set_rate = ravb_set_rate_rcar,
@@ -2754,11 +2827,30 @@ static const struct ravb_hw_info ravb_gen4_hw_info = {
 	.tx_counters = 1,
 	.multi_irqs = 1,
 	.irq_en_dis = 1,
-	.ccc_gac = 1,
+	.ptp = &ravb_gen4_ptp_info,
 	.nc_queues = 1,
 	.magic_pkt = 1,
 };
 
+static int ravb_rzv2m_ptp_probe(struct net_device *ndev)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+
+	priv->gptp_clk = devm_clk_get(&priv->pdev->dev, "gptp");
+	if (IS_ERR(priv->gptp_clk))
+		return PTR_ERR(priv->gptp_clk);
+
+	return ravb_compute_gti(ndev, priv->gptp_clk);
+}
+
+static const struct ravb_gptp_info ravb_rzv2m_ptp_info = {
+	.probe = ravb_rzv2m_ptp_probe,
+	.clock_index = ravb_gen2_ptp_clock_index,
+	.set_config_mode = ravb_gen2_ptp_set_config_mode,
+	.dmac_start = ravb_ptp_init,
+	.dmac_stop = ravb_ptp_stop,
+};
+
 static const struct ravb_hw_info ravb_rzv2m_hw_info = {
 	.receive = ravb_rx_rcar,
 	.set_rate = ravb_set_rate_rcar,
@@ -2779,8 +2871,7 @@ static const struct ravb_hw_info ravb_rzv2m_hw_info = {
 	.dbat_entry_num = 22,
 	.multi_irqs = 1,
 	.err_mgmt_irqs = 1,
-	.gptp = 1,
-	.gptp_ref_clk = 1,
+	.ptp = &ravb_rzv2m_ptp_info,
 	.nc_queues = 1,
 	.magic_pkt = 1,
 };
@@ -2970,12 +3061,10 @@ static int ravb_probe(struct platform_device *pdev)
 		goto out_reset_assert;
 	}
 
-	if (info->gptp_ref_clk) {
-		priv->gptp_clk = devm_clk_get(&pdev->dev, "gptp");
-		if (IS_ERR(priv->gptp_clk)) {
-			error = PTR_ERR(priv->gptp_clk);
+	if (info->ptp && info->ptp->probe) {
+		error = info->ptp->probe(ndev);
+		if (error)
 			goto out_reset_assert;
-		}
 	}
 
 	priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk");
@@ -3028,10 +3117,6 @@ static int ravb_probe(struct platform_device *pdev)
 	ndev->netdev_ops = &ravb_netdev_ops;
 	ndev->ethtool_ops = &ravb_ethtool_ops;
 
-	error = ravb_compute_gti(ndev);
-	if (error)
-		goto out_rpm_put;
-
 	ravb_parse_delay_mode(np, ndev);
 
 	/* Allocate descriptor base address table */
@@ -3154,6 +3239,7 @@ static void ravb_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_dont_use_autosuspend(dev);
 	clk_unprepare(priv->refclk);
+	of_node_put(priv->of_gptp);
 	reset_control_assert(priv->rstc);
 	free_netdev(ndev);
 	platform_set_drvdata(pdev, NULL);
@@ -3179,9 +3265,6 @@ static int ravb_wol_setup(struct net_device *ndev)
 	/* Enable MagicPacket */
 	ravb_modify(ndev, ECMR, ECMR_MPDE, ECMR_MPDE);
 
-	if (priv->info->ccc_gac)
-		ravb_ptp_stop(ndev);
-
 	return enable_irq_wake(priv->emac_irq);
 }
 
@@ -3201,9 +3284,6 @@ static int ravb_wol_restore(struct net_device *ndev)
 	if (error)
 		return error;
 
-	if (priv->info->ccc_gac)
-		ravb_ptp_init(ndev, priv->pdev);
-
 	if (info->nc_queues)
 		napi_enable(&priv->napi[RAVB_NC]);
 	napi_enable(&priv->napi[RAVB_BE]);
diff --git a/drivers/net/ethernet/renesas/ravb_ptp.c b/drivers/net/ethernet/renesas/ravb_ptp.c
index 226c6c0ab945b..473a2aedb745e 100644
--- a/drivers/net/ethernet/renesas/ravb_ptp.c
+++ b/drivers/net/ethernet/renesas/ravb_ptp.c
@@ -312,22 +312,39 @@ void ravb_ptp_interrupt(struct net_device *ndev)
 	ravb_write(ndev, ~(gis | GIS_RESERVED), GIS);
 }
 
-void ravb_ptp_init(struct net_device *ndev, struct platform_device *pdev)
+int ravb_ptp_init(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
 	unsigned long flags;
+	int ret = 0;
 
 	priv->ptp.info = ravb_ptp_info;
 
-	priv->ptp.default_addend = ravb_read(ndev, GTI);
+	priv->ptp.default_addend = priv->gti_tiv;
 	priv->ptp.current_addend = priv->ptp.default_addend;
 
 	spin_lock_irqsave(&priv->lock, flags);
+
+	/* Set gPTP Timer Increment Value. */
+	ravb_write(ndev, priv->ptp.default_addend, GTI);
+
+	/* Request GTI loading. */
+	ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
+
+	/* Wait for GIT loading to complete. */
 	ravb_wait(ndev, GCCR, GCCR_TCR, GCCR_TCR_NOREQ);
+
 	ravb_modify(ndev, GCCR, GCCR_TCSS, GCCR_TCSS_ADJGPTP);
 	spin_unlock_irqrestore(&priv->lock, flags);
 
-	priv->ptp.clock = ptp_clock_register(&priv->ptp.info, &pdev->dev);
+	priv->ptp.clock = ptp_clock_register(&priv->ptp.info, &priv->pdev->dev);
+	if (IS_ERR(priv->ptp.clock)) {
+		ret = PTR_ERR(priv->ptp.clock);
+		priv->ptp.clock = NULL;
+		ravb_ptp_stop(ndev);
+	}
+
+	return ret;
 }
 
 void ravb_ptp_stop(struct net_device *ndev)
@@ -337,5 +354,6 @@ void ravb_ptp_stop(struct net_device *ndev)
 	ravb_write(ndev, 0, GIC);
 	ravb_write(ndev, 0, GIS);
 
-	ptp_clock_unregister(priv->ptp.clock);
+	if (priv->ptp.clock)
+		ptp_clock_unregister(priv->ptp.clock);
 }

3/2 2026/08/11 16:41 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 10257
							output: 35
							thoughts: 325
						

Thoughts:
**Analyzing the Reachability of gPTP Refactoring in the Renesas RAVB Driver**

Okay, so we have this patch that's refactoring the gPTP implementation within the Renesas Ethernet AVB driver, specifically the `ravb` driver. It's adding a new `ravb_gptp_info` struct and callback functions to handle platform-specific gPTP behavior, including support for Gen4 gPTP using an external PTP timer, which is interesting. My immediate concern, as always, is reachability – can this code actually *be* triggered in a realistic environment?

Given the driver path, `drivers/net/ethernet/renesas/ravb`, it's almost certainly tied to physical hardware, on-chip Ethernet controllers found in Renesas R-Car SoCs. My first thought is whether this can be reliably emulated. My experience tells me that full R-Car SoC emulation in something like QEMU can be patchy at best, or incredibly specific in its configuration. I need to figure out if there's any QEMU support for Renesas Ethernet AVB specifically.

Wait a minute, syzkaller *usually* doesn't emulate these types of platform devices in its standard QEMU setup unless it's a generic PCI device, and this is definitely DT-based. That means it might be challenging to trigger this code in a standard testing environment. I'll need to double-check `drivers/net/ethernet/renesas/Kconfig` to see if there are any hints about conditional compilation or other configuration options that might provide a workaround. This is the starting point for me. I need to understand if the hardware is virtualizable.



4/2 2026/08/11 16:41 tool grepper
0m Args:
{
  "Expression": "config RAVB",
  "PathPrefix": "drivers/net/ethernet/renesas/Kconfig"
}

Results:
{
  "Output": "drivers/net/ethernet/renesas/Kconfig=19=config SH_ETH\n--\ndrivers/net/ethernet/renesas/Kconfig-28-\ndrivers/net/ethernet/renesas/Kconfig:29:config RAVB\ndrivers/net/ethernet/renesas/Kconfig-30-\ttristate \"Renesas Ethernet AVB support\"\n"
}

5/2 2026/08/11 16:41 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 11076
							output: 39
							thoughts: 10
						

Thoughts:
Okay, here's my attempt at summarizing my thought process regarding RAVB's dependencies, as though I were an expert:

**Analyzing the Dependencies of RAVB**

Alright, let's break this down. The first thing I'm doing is mentally sketching out the landscape of RAVB. I need to understand its dependencies. What other systems, libraries, or external resources does it rely on to function? Is it tightly coupled to some specific infrastructure, or is it designed with a degree of modularity? I'm thinking about:

*   **Underlying technologies:** Does it leverage a particular database, message queue, or cloud platform? Knowing this quickly indicates potential integration pain points or scalability limitations.
*   **External APIs/services:** Is RAVB dependent on other systems or services outside its direct control? If so, I need to know the reliability and performance characteristics of those dependencies. This also highlights any potential security concerns arising from those dependencies.
*   **Internal modules and libraries:** How is RAVB structured internally? Are there specific modules or libraries that it leans heavily on? Understanding these inner dependencies is crucial for any potential modifications, refactoring, or performance optimizations.
*   **Versioning and Compatibility:** What versions of these dependencies are required or supported? Any compatibility issues and potential breaking changes become vital to consider.
*   **Configuration:** Is its behavior dependent on the input parameters to RAVB? What specific types of inputs are accepted and how they affect the functionality?
*   **Data Dependencies:** What is the input and output data?

I'm essentially building a mental map of RAVB's ecosystem, anticipating potential bottlenecks, risks, and areas of architectural strength. This is the groundwork for any serious analysis or intervention.



6/2 2026/08/11 16:41 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/renesas/Kconfig",
  "FirstLine": 29,
  "LineCount": 20
}

Results:
{
  "Contents": "  29:\tconfig RAVB\n  30:\t\ttristate \"Renesas Ethernet AVB support\"\n  31:\t\tdepends on ARCH_RENESAS || COMPILE_TEST\n  32:\t\tdepends on PTP_1588_CLOCK_OPTIONAL\n  33:\t\tselect CRC32\n  34:\t\tselect MII\n  35:\t\tselect MDIO_BITBANG\n  36:\t\tselect PAGE_POOL\n  37:\t\tselect PHYLIB\n  38:\t\tselect RESET_CONTROLLER\n  39:\t\thelp\n  40:\t\t  Renesas Ethernet AVB device driver.\n  41:\t\n  42:\tconfig RENESAS_ETHER_SWITCH\n  43:\t\ttristate \"Renesas Ethernet Switch support\"\n  44:\t\tdepends on ARCH_RENESAS || COMPILE_TEST\n  45:\t\tdepends on PTP_1588_CLOCK\n  46:\t\tselect CRC32\n  47:\t\tselect MII\n  48:\t\tselect PHYLINK\n"
}

7/2 2026/08/11 16:41 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 11747
							output: 127
							thoughts: 859
						

Thoughts:
**WorthFuzzing=false: Unreachable Code in Standard Fuzzing Environments**

Okay, let's break this down. My initial assessment hinges on whether this code is accessible during standard fuzzing, particularly in environments like QEMU or GCE.  It looks like the patch touches `ravb_main.c` and `ravb_ptp.c`, but the core of the issue lies in the driver itself, `ravb_driver`.  It's a platform driver. Platform drivers, generally, are a red flag for standard fuzzing. They rely on the presence of a specific hardware platform and, critically, the corresponding device tree nodes for probing.

I need to confirm if this particular device, Renesas Ethernet AVB, is likely to be emulated or even represented in standard setups. From past experiences and looking at the driver structure (`ravb_driver`), this driver is a platform driver specifically for Renesas R-Car SoCs.  That means it’s expecting a device tree node with something like `"renesas,etheravb-rcar-gen4"` as a compatible string.

Syzkaller *can* fuzz platform devices, but it needs a specific mechanism: either it would need to inject device tree nodes or use a specialized fuzzer. It's not the default behavior. I've considered that `syz_dev_init` might offer a backdoor or that syzkaller’s device description generation may help, but usually that only works for explicitly supported devices or subsystems.

Crucially, this is a platform driver, *not* a PCI or USB device. Without a specific device tree node, this code won't be probed in a default QEMU setup. And, let's be realistic, standard virtualized environments, like GCE or the typical `qemu-system-x86_64` or `qemu-system-aarch64 -machine virt` configurations, *don't* emulate this specific Renesas hardware.

I've even double-checked if there are any specific QEMU machines known to emulate this particular device, and there are not. Since the patched code is specific to a vendor hardware device, and since QEMU does not emulate this device, it's clear this code is not reachable. Even if a hypothetical emulation existed, it’s vendor-specific, which leads back to the same problem. This all falls under the criteria defined for WorthFuzzing=false.

Therefore, the patch introduces refactoring to gPTP support in a driver for the Renesas R-Car Ethernet AVB controller. The changes are specific to the Renesas SoC and require specific device tree nodes. Given the standard fuzzing environment limitations, the code is unreachable. Therefore, it's not worth fuzzing.



8/2 2026/08/11 16:42 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch refactors gPTP support in the Renesas Ethernet AVB (ravb) driver, adding support for Gen4 gPTP and introducing a struct for platform-specific callbacks. This is a vendor-specific platform driver for Renesas R-Car SoCs. The hardware is not emulated in standard QEMU/GCE environments, and the driver requires specific device tree nodes to probe. Therefore, the modified code paths are unreachable during standard fuzzing.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch refactors gPTP support in the Renesas Ethernet AVB (ravb) driver, adding support for Gen4 gPTP and introducing a struct for platform-specific callbacks. This is a vendor-specific platform driver for Renesas R-Car SoCs. The hardware is not emulated in standard QEMU/GCE environments, and the driver requires specific device tree nodes to probe. Therefore, the modified code paths are unreachable during standard fuzzing.",
  "WorthFuzzing": false
}

9/1 2026/08/11 16:42 action If
0m Args:
{
  "WorthFuzzing": false
}

Results:
null

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)