Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dm: add virtio_mei mediator #1536

Closed
tomasbw opened this issue Oct 20, 2018 · 1 comment
Closed

dm: add virtio_mei mediator #1536

tomasbw opened this issue Oct 20, 2018 · 1 comment
Assignees

Comments

@tomasbw
Copy link
Contributor

tomasbw commented Oct 20, 2018

The MEI device mediator works over virtualization enabled mei device and mei driver.
Currently it only supports MEI on APL-I with HBM version 2.2
And as well it requires an SOS kernel with mei virtualization support.
For other platforms only passthru mode is enabled.

tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
Remove virtio_heci to be replaced with virtio_mei

Tracked-On: projectacrn#1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
HBM is a control channel protocol between mei device
driver and mei fw.

Add new ioctl IOCTL_MEI_CONNECT_CLIENT_VTAG

Tracked-On: projectacrn#1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw pushed a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
libuuid sports only uuid (big endian encoding),
though mei requires guids (little endian encoding).
The base types are based on <linux/uuid.h> header.

Tracked-On: projectacrn#1536
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
Add standard container_of macro to access
the parent struct pointer.

Tracked-On: projectacrn#1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
mei handles objects on the list, hence reference counting
infrastructure is required for easier multithreading.

Tracked-On: projectacrn#1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
mei requires reading of u8, u32 and uuid
sysfs files.

Tracked-On: projectacrn#1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
The virtio has two virtio queues, TX and RX.
TX have two segment buffers one for header and one for data.
The virtio_mei declares host buffer of size 128 slots, each
slot is a 4 bytes value.
For synchronization hw_ready and host_reset configuration flags
are used that emulates mei reset flow.
And last fw status registers must be also readable via virtio
mei device.

Tracked-On: projectacrn#1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
1. virtio_mei structure represents an instance of mei device.
2. vmei_me_client represents an ME application in the MEI FW.
3. vmei_host_client represent a host application talking to the
ME application, ME application can support multiple connections.
4. Add debug helpers

Tracked-On: projectacrn#1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw pushed a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
There are multiple types of resets that need to be handled
by the mei device.
The reset may be initiated from both sides host or fw.
The host requests reset on probe and remove,
power state transaction, and errors,
while ME FW may request reset upon error.
If the native device undergo reset the host application
has to be notified.

Tracked-On: projectacrn#1536
Signed-off-by: Aviad Nissel <aviad.nissel@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
mei mediator perform reset handshake via
the cfgread/write handlers and provide access
to fw status registers.

Tracked-On: projectacrn#1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
ME client enumeration is received from sysfs attributes
of the native device.

V3: Use bounded functions.

Tracked-On: projectacrn#1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
Add read write and connect handler,
that perform io peration on SOS /dev/meiX
device.

Tracked-On: projectacrn#1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
Implement the FW part of the HBM protocol.
Currently the support version is 2.0.
The HBM protocol handles client management, such
initialization handshake, connection, power management,
and the flow control.

Tracked-On: projectacrn#1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
TX from virtio driver is handled firt via
virio tx notify handler vmei_notify_tx(),
placed into host clinet tx circular buffer.
TX thread will then write the data to the device.

Tracked-On: projectacrn#1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
Rx is triggered from epoll event (mevent), a host client
is retrieved from associated event data. P proper mei message header is
attached to the packet and sent to the virtio FE device.

Tracked-On: projectacrn#1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
In vmei_start() the HBM host client is created,
it handles HBM protocol.
The HBM client is a management object and
is not exposed by the mei native driver.
The communication between TX and RX threads
is handed via internal pipe(2).
Second, we connect all fixed address clients as the mei
protocol doesn't provide connection mechanism for them,
they appear always connected.
Last, the hw_ready is set.

Define virtio_mei_ops, ass all the handlers are now available.

Tracked-On: projectacrn#1536
Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
Register virtio device virtio-mei.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>

Tracked-On: projectacrn#1536
Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw added a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
Add virtio_mei to the Makefile

Tracked-On: projectacrn#1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
tomasbw pushed a commit to tomasbw/acrn-hypervisor that referenced this issue Oct 20, 2018
Detect if SOS kernel mei drivers supports virtualization,
via driver hbm version 2.2
If yes use virtio_mei mediator for the mei device
otherwise fallback to passthrou mode.
Note that HBM version is not sufficient identification

Tracked-On: projectacrn#1536
Signed-off-by: Aviad Nissel <aviad.nissel@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
@mwang106 mwang106 added the type: feature New feature label Oct 22, 2018
@mwang106
Copy link
Contributor

mwang106 commented Oct 23, 2018

[External_System_ID] ACRN-2183

@mwang106 mwang106 added area: device model priority: medium status: new The issue status: new for creation labels Oct 23, 2018
wenlingz pushed a commit that referenced this issue Oct 23, 2018
Remove virtio_heci to be replaced with virtio_mei

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
HBM is a control channel protocol between mei device
driver and mei fw.

Add new ioctl IOCTL_MEI_CONNECT_CLIENT_VTAG

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
libuuid sports only uuid (big endian encoding),
though mei requires guids (little endian encoding).
The base types are based on <linux/uuid.h> header.

Tracked-On: #1536
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
Add standard container_of macro to access
the parent struct pointer.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
mei handles objects on the list, hence reference counting
infrastructure is required for easier multithreading.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
mei requires reading of u8, u32 and uuid
sysfs files.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
The virtio has two virtio queues, TX and RX.
TX have two segment buffers one for header and one for data.
The virtio_mei declares host buffer of size 128 slots, each
slot is a 4 bytes value.
For synchronization hw_ready and host_reset configuration flags
are used that emulates mei reset flow.
And last fw status registers must be also readable via virtio
mei device.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
1. virtio_mei structure represents an instance of mei device.
2. vmei_me_client represents an ME application in the MEI FW.
3. vmei_host_client represent a host application talking to the
ME application, ME application can support multiple connections.
4. Add debug helpers

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
There are multiple types of resets that need to be handled
by the mei device.
The reset may be initiated from both sides host or fw.
The host requests reset on probe and remove,
power state transaction, and errors,
while ME FW may request reset upon error.
If the native device undergo reset the host application
has to be notified.

Tracked-On: #1536
Signed-off-by: Aviad Nissel <aviad.nissel@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
mei mediator perform reset handshake via
the cfgread/write handlers and provide access
to fw status registers.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
ME client enumeration is received from sysfs attributes
of the native device.

V3: Use bounded functions.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
Add read write and connect handler,
that perform io peration on SOS /dev/meiX
device.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
Implement the FW part of the HBM protocol.
Currently the support version is 2.0.
The HBM protocol handles client management, such
initialization handshake, connection, power management,
and the flow control.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
TX from virtio driver is handled firt via
virio tx notify handler vmei_notify_tx(),
placed into host clinet tx circular buffer.
TX thread will then write the data to the device.

Tracked-On: #1536
Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
Rx is triggered from epoll event (mevent), a host client
is retrieved from associated event data. P proper mei message header is
attached to the packet and sent to the virtio FE device.

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
In vmei_start() the HBM host client is created,
it handles HBM protocol.
The HBM client is a management object and
is not exposed by the mei native driver.
The communication between TX and RX threads
is handed via internal pipe(2).
Second, we connect all fixed address clients as the mei
protocol doesn't provide connection mechanism for them,
they appear always connected.
Last, the hw_ready is set.

Define virtio_mei_ops, ass all the handlers are now available.

Tracked-On: #1536
Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
Register virtio device virtio-mei.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>

Tracked-On: #1536
Signed-off-by: Liu Shuo <shuo.a.liu@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
Add virtio_mei to the Makefile

Tracked-On: #1536
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
wenlingz pushed a commit that referenced this issue Oct 23, 2018
Detect if SOS kernel mei drivers supports virtualization,
via driver hbm version 2.2
If yes use virtio_mei mediator for the mei device
otherwise fallback to passthrou mode.
Note that HBM version is not sufficient identification

Tracked-On: #1536
Signed-off-by: Aviad Nissel <aviad.nissel@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
@Mingyuan18 Mingyuan18 added status: closed The issue been closed and removed status: new The issue status: new for creation labels Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants