mbox series

[RESEND,0/5] Add support for AMT over WLAN

Message ID 20210322204633.102581-1-emmanuel.grumbach@intel.com
Headers show
Series Add support for AMT over WLAN | expand

Message

Emmanuel Grumbach March 22, 2021, 8:46 p.m. UTC
This patch series adds support for AMT over WLAN.
Information about Intel Active Management Technology is
available on the net, but in a nutshell, it is an application
running on an embedded CPU in the chipset. This application
can provide remote control to the system even when no OS is,
present or not even installed. By control, we mean, KVM,
the possibility to attach a remote driver, power up / down
/ reset the machine and other options.

When the host uses wireless, the embedded CPU can't access
the wireless device and hence, the traffic for AMT must be
routed through the host. The AMT <-> WLAN driver interface
is explained at lengh inside the patches. Basically, there
is a memory region that is mapped to a PCI devices that can
read / write to that memory and sends the data to the embedded
CPU. The driver for this PCI device is mei. We needed to add
code for that driver, those patches are in this series and
need to be routed through wireless-drivers tree as requested
by Greg KH.
There is also a cfg80211 patch that I should have sent earlier
to Johannes. I include this here. Hopefully, it'll not cause
trouble.

Note about how to use this new feature:
In order to fully use this new feature, we need to add a few
vendor commands that are not included in this series. The
upstream process for those commands will take some more time
but it is definitely planned. The motivation to use vendor
commands as opposed to regular nl80211 APIs is that we do not
expect any other vendor to need similar APIs. We had no control
on the AMT APIs and this is why we needed to add vendor commands
for flows that differ just a tiny bit from the regular flow. For
example, AMT needs to know when we are associated, but it
requires to know whether we are associated in WPA or in WPA2.
This is not known to the kernel, so we, unfortunately, had
to add a vendor command for this. This is just an example.

Integration with the connection manager is required to be able
to use this new feature.
In case the device is controlled by AMT and is actively used
by AMT, AMT will not release the device. To properly reflect
this state, we report hardware RF-Kill to the stack, but we
add a reason saying that we do not own the device. The
connection manager can then check what AP AMT is connected to
and signal to AMT that it can ensure the connetion to that
same AP can be kept. AMT will then release the device allowing
the host to connect to that AP. Doing this transition fast
enough will allow not to break the TCP connections that AMT
maintains.

I worked with Ayala Beker on the iwlwifi part of this feature.

Please do not apply those patches, they'll be part of a regular
pull request from Luca.

Johannes, feel free to pick the cfg80211 patch although then, it
will require to merge mac80211-next into wireless-drivers-next so
maybe it's better to route it through Kalle as well?

Alexander Usyskin (1):
  mei: bus: add client dma interface

Emmanuel Grumbach (3):
  cfg80211: allow to specifying a reason for hw_rfkill
  iwlwifi: mei: add the driver to allow cooperation with CSME
  iwlwifi: integrate with iwlmei

Tomas Winkler (1):
  mei: allow map and unmap of client dma buffer only for disconnected
    client

 drivers/misc/mei/bus.c                        |   67 +-
 drivers/misc/mei/client.c                     |   20 +-
 drivers/misc/mei/hw.h                         |    5 +
 drivers/net/wireless/intel/iwlwifi/Kconfig    |   13 +
 drivers/net/wireless/intel/iwlwifi/Makefile   |    2 +
 .../wireless/intel/iwlwifi/iwl-nvm-parse.c    |   61 +
 .../wireless/intel/iwlwifi/iwl-nvm-parse.h    |   11 +-
 .../net/wireless/intel/iwlwifi/iwl-trans.h    |    2 +
 .../net/wireless/intel/iwlwifi/mei/Makefile   |    8 +
 .../net/wireless/intel/iwlwifi/mei/internal.h |   20 +
 .../net/wireless/intel/iwlwifi/mei/iwl-mei.h  |  440 ++++
 drivers/net/wireless/intel/iwlwifi/mei/main.c | 2026 +++++++++++++++++
 drivers/net/wireless/intel/iwlwifi/mei/net.c  |  409 ++++
 drivers/net/wireless/intel/iwlwifi/mei/sap.h  |  736 ++++++
 .../wireless/intel/iwlwifi/mei/trace-data.h   |   69 +
 .../net/wireless/intel/iwlwifi/mei/trace.c    |   15 +
 .../net/wireless/intel/iwlwifi/mei/trace.h    |   62 +
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c   |    3 +-
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |   42 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |   70 +
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c  |  208 +-
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c   |    7 +-
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c |   25 +
 .../net/wireless/intel/iwlwifi/pcie/trans.c   |   16 +-
 include/linux/mei_cl_bus.h                    |    3 +
 include/net/cfg80211.h                        |   11 +-
 net/wireless/core.c                           |    7 +-
 27 files changed, 4322 insertions(+), 36 deletions(-)
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mei/Makefile
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mei/internal.h
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mei/iwl-mei.h
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mei/main.c
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mei/net.c
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mei/sap.h
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mei/trace-data.h
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mei/trace.c
 create mode 100644 drivers/net/wireless/intel/iwlwifi/mei/trace.h

Comments

Emmanuel Grumbach March 23, 2021, 3:15 p.m. UTC | #1
On Mon, Mar 22, 2021 at 10:49 PM Emmanuel Grumbach
<emmanuel.grumbach@intel.com> wrote:
>

> From: Tomas Winkler <tomas.winkler@intel.com>

>

> Allow map and unmap of the client dma buffer only when the client is not

> connected. The functions return -EPROTO if the client is already connected.

> This is to fix the race when traffic may start or stop when buffer

> is not available.

>

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

> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


This one has been taken by Greg through his tree so I'll drop it.
I won't resend the series for this though.

> ---

>  drivers/misc/mei/client.c | 17 +++++++----------

>  1 file changed, 7 insertions(+), 10 deletions(-)

>

> diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c

> index 4378a9b25848..2cc370adb238 100644

> --- a/drivers/misc/mei/client.c

> +++ b/drivers/misc/mei/client.c

> @@ -2286,8 +2286,8 @@ int mei_cl_dma_alloc_and_map(struct mei_cl *cl, const struct file *fp,

>         if (buffer_id == 0)

>                 return -EINVAL;

>

> -       if (!mei_cl_is_connected(cl))

> -               return -ENODEV;

> +       if (mei_cl_is_connected(cl))

> +               return -EPROTO;

>

>         if (cl->dma_mapped)

>                 return -EPROTO;

> @@ -2327,9 +2327,7 @@ int mei_cl_dma_alloc_and_map(struct mei_cl *cl, const struct file *fp,

>

>         mutex_unlock(&dev->device_lock);

>         wait_event_timeout(cl->wait,

> -                          cl->dma_mapped ||

> -                          cl->status ||

> -                          !mei_cl_is_connected(cl),

> +                          cl->dma_mapped || cl->status,

>                            mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT));

>         mutex_lock(&dev->device_lock);

>

> @@ -2376,8 +2374,9 @@ int mei_cl_dma_unmap(struct mei_cl *cl, const struct file *fp)

>                 return -EOPNOTSUPP;

>         }

>

> -       if (!mei_cl_is_connected(cl))

> -               return -ENODEV;

> +       /* do not allow unmap for connected client */

> +       if (mei_cl_is_connected(cl))

> +               return -EPROTO;

>

>         if (!cl->dma_mapped)

>                 return -EPROTO;

> @@ -2405,9 +2404,7 @@ int mei_cl_dma_unmap(struct mei_cl *cl, const struct file *fp)

>

>         mutex_unlock(&dev->device_lock);

>         wait_event_timeout(cl->wait,

> -                          !cl->dma_mapped ||

> -                          cl->status ||

> -                          !mei_cl_is_connected(cl),

> +                          !cl->dma_mapped || cl->status,

>                            mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT));

>         mutex_lock(&dev->device_lock);

>

> --

> 2.25.1

>