xref: /dpdk/doc/guides/rawdevs/cnxk_rvu_lf.rst (revision aeb86158bf15140d49f9904ae40aa0ea9f13ec62)
1318ee1b0SAkhil Goyal.. SPDX-License-Identifier: BSD-3-Clause
2318ee1b0SAkhil Goyal   Copyright(c) 2024 Marvell.
3318ee1b0SAkhil Goyal
4318ee1b0SAkhil GoyalMarvell CNXK RVU LF Driver
5318ee1b0SAkhil Goyal==========================
6318ee1b0SAkhil Goyal
7318ee1b0SAkhil GoyalCNXK product families can have a use case to allow RVU PF and RVU VF
8318ee1b0SAkhil Goyaldriver to communicate using mailboxes
9318ee1b0SAkhil Goyaland also get notified of any interrupt that may occur on the device.
10318ee1b0SAkhil GoyalHence, a new raw device driver is added for such RVU LF devices.
11318ee1b0SAkhil GoyalThese devices can map to a RVU PF or a RVU VF
12318ee1b0SAkhil Goyalwhich can send mailboxes to each other.
13318ee1b0SAkhil Goyal
1459c15941SAkhil GoyalFeatures
1559c15941SAkhil Goyal--------
1659c15941SAkhil Goyal
1759c15941SAkhil GoyalThe RVU LF device implements following features in the rawdev API:
1859c15941SAkhil Goyal
1959c15941SAkhil Goyal- Get PF FUNC of associated NPA and SSO devices.
20fcac76a8SAkhil Goyal- Get PF FUNC for RVU LF device.
21f4c67d72SAkhil Goyal- Register/unregister interrupt handlers.
227396eaceSAkhil Goyal- Register/unregister mailbox callbacks for the other side to process mailboxes.
230924cc0bSAkhil Goyal- Set mailbox message ID range to be used by the driver.
24384903edSAkhil Goyal- Process mailbox messages.
2579c469dfSAkhil Goyal- Get BAR Addresses for the out-of-tree drivers to configure registers.
2659c15941SAkhil Goyal
27318ee1b0SAkhil GoyalLimitations
28318ee1b0SAkhil Goyal-----------
29318ee1b0SAkhil Goyal
30318ee1b0SAkhil GoyalIn multi-process mode user-space application must ensure
31318ee1b0SAkhil Goyalno resources sharing takes place.
32318ee1b0SAkhil GoyalOtherwise, user-space application should ensure synchronization.
33318ee1b0SAkhil Goyal
34318ee1b0SAkhil GoyalDevice Setup
35318ee1b0SAkhil Goyal------------
36318ee1b0SAkhil Goyal
37318ee1b0SAkhil GoyalThe RVU LF devices will need to be bound to a user-space IO driver for use.
38318ee1b0SAkhil GoyalThe script ``dpdk-devbind.py`` included with DPDK can be used
39318ee1b0SAkhil Goyalto view the state of the devices
40318ee1b0SAkhil Goyaland to bind them to a suitable DPDK-supported kernel driver.
41318ee1b0SAkhil GoyalWhen querying the status of the devices,
42318ee1b0SAkhil Goyalthey will appear under the category of "Misc (rawdev) devices",
43318ee1b0SAkhil Goyali.e. the command ``dpdk-devbind.py --status-dev misc``
44318ee1b0SAkhil Goyalcan be used to see the state of those devices alone.
4559c15941SAkhil Goyal
4659c15941SAkhil GoyalGet NPA and SSO PF FUNC
4759c15941SAkhil Goyal-----------------------
4859c15941SAkhil Goyal
4959c15941SAkhil GoyalAPI functions ``rte_pmd_rvu_lf_npa_pf_func_get()`` and ``rte_pmd_rvu_lf_sso_pf_func_get()``
5059c15941SAkhil Goyalcan be used to get the cnxk NPA PF func and SSO PF func
5159c15941SAkhil Goyalwhich application can use for NPA/SSO specific configuration.
52f4c67d72SAkhil Goyal
53fcac76a8SAkhil GoyalGet RVU LF PF FUNC
54fcac76a8SAkhil Goyal------------------
55fcac76a8SAkhil Goyal
56fcac76a8SAkhil GoyalAPI function ``rte_pmd_rvu_lf_pf_func_get()`` gets the RVU LF device PF FUNC.
57fcac76a8SAkhil Goyal
58f4c67d72SAkhil GoyalRegister or remove interrupt handler
59f4c67d72SAkhil Goyal------------------------------------
60f4c67d72SAkhil Goyal
61f4c67d72SAkhil GoyalOut-of-tree drivers can register interrupt handlers using ``rte_pmd_rvu_lf_irq_register()``
62f4c67d72SAkhil Goyalor remove interrupt handler using ``rte_pmd_rvu_lf_irq_unregister()``.
63f4c67d72SAkhil GoyalThe IRQ numbers for which the interrupts are registered
64f4c67d72SAkhil Goyalis negotiated separately and is not in scope of the driver.
657396eaceSAkhil Goyal
667396eaceSAkhil GoyalRVU LF raw message processing
677396eaceSAkhil Goyal-----------------------------
687396eaceSAkhil Goyal
697396eaceSAkhil GoyalFor processing of mailboxes received on RVU PF/VF application,
707396eaceSAkhil Goyalout-of-tree drivers can register/unregister callbacks
717396eaceSAkhil Goyalusing ``rte_pmd_rvu_lf_msg_handler_register()``
727396eaceSAkhil Goyaland ``rte_pmd_rvu_lf_msg_handler_unregister()``.
737396eaceSAkhil GoyalRequired responses as per the request and message id received
747396eaceSAkhil Goyalcan be filled in the callbacks.
750924cc0bSAkhil Goyal
760924cc0bSAkhil GoyalOnce a RVU LF raw device is probed, a range of message ids can be configured
770924cc0bSAkhil Goyalfor which mailboxes will be sent using the API ``rte_pmd_rvu_lf_msg_id_range_set()``.
78384903edSAkhil Goyal
79384903edSAkhil GoyalThe out-of-tree driver can call ``rte_pmd_rvu_lf_msg_process()`` to send a request
80384903edSAkhil Goyaland receive corresponding response from the other side (PF/VF).
81384903edSAkhil GoyalIt accepts an opaque pointer of a request and its size which can be defined by user
82384903edSAkhil Goyaland provides an opaque pointer for a response and its length.
83384903edSAkhil GoyalPF and VF out-of-tree driver can define its own request and response
84384903edSAkhil Goyalbased on the message id of the mailbox.
8579c469dfSAkhil Goyal
86*aeb86158SAkhil GoyalFor sample usage of the API, refer ``rvu_lf_rawdev_selftest()``.
87*aeb86158SAkhil Goyal
8879c469dfSAkhil GoyalGet BAR addresses
8979c469dfSAkhil Goyal-----------------
9079c469dfSAkhil Goyal
9179c469dfSAkhil GoyalOut-of-tree drivers can retrieve PCI BAR addresses of the device
9279c469dfSAkhil Goyalusing the API function ``rte_pmd_rvu_lf_bar_get()``.
9379c469dfSAkhil GoyalThis helps PF/VF drivers to configure the registers of the hardware device.
94*aeb86158SAkhil Goyal
95*aeb86158SAkhil GoyalSelf test
96*aeb86158SAkhil Goyal---------
97*aeb86158SAkhil Goyal
98*aeb86158SAkhil GoyalOn EAL initialization RVU LF devices will be probed
99*aeb86158SAkhil Goyaland populated into the raw devices.
100*aeb86158SAkhil GoyalThe rawdev ID of the device can be obtained using invocation
101*aeb86158SAkhil Goyalof ``rte_rawdev_get_dev_id("NAME:x")`` from the test application, where:
102*aeb86158SAkhil Goyal
103*aeb86158SAkhil Goyal- NAME is the desired subsystem: use "RVU_LF".
104*aeb86158SAkhil Goyal- x is the device's bus id specified in "bus:device.func" (BDF) format.
105*aeb86158SAkhil Goyal  BDF follows convention used by lspci i.e. bus, device and func
106*aeb86158SAkhil Goyal  are specified using respectively two, two and one hex digit(s).
107*aeb86158SAkhil Goyal
108*aeb86158SAkhil GoyalUse this identifier for further rawdev function calls.
109*aeb86158SAkhil Goyal
110*aeb86158SAkhil GoyalSelftest rawdev API can be used to verify the mailbox communication
111*aeb86158SAkhil Goyalbetween PF and VF devices based applications.
112*aeb86158SAkhil GoyalThere can be multiple VFs for a particular PF.
113*aeb86158SAkhil GoyalEach VF can send mailboxes to PF and PF can broadcast message to all VFs.
114