Alexander Usyskin
2f79d3d1f7
mei: add device kind to sysfs
...
Some of the mei device heads are not generic and have
a specific purpose, we need to announce it to the user space
so it is possible to detect the correct device node via
matching attributes.
Generic heads are marked as 'mei' while special purpose heads
have their own names. Currently we are adding 'itouch' string
for Intel IPTS 1.0, 2.0 devices.
This is done via new sysfs attribute 'kind'.
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200728192242.3117779-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:21:13 +02:00
Tomas Winkler
92ca3dd486
mei: hw: don't use one element arrays
...
Replace the single element arrays with a simple value type u8 reserved,
even thought is is not used for dynamically sized trailing elements
it confuses the effort of replacing one-element arrays with
flexible arrays for that purpose.
Link: https://github.com/KSPP/linux/issues/79
Cc: Gustavo A. R. Silva <gustavoars@kernel.org >
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200723145927.882743-7-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-23 19:33:09 +02:00
Tomas Winkler
c614970e3e
mei: hw: use sizeof of variable instead of struct type
...
Use sizeof(*dev) + sizeof(*hw) instead of
sizeof(struct mei_device) + sizeof(struct mei_me_hw)
There is a possibility of bug when variable type has changed but
corresponding struct passed to the sizeof has not.
Cc: Gustavo A. R. Silva <gustavoars@kernel.org >
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200723145927.882743-6-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-23 19:33:09 +02:00
Tomas Winkler
4b40b22581
mei: client: use sizeof of variable instead of struct type
...
There is a possibility of bug when variable type has changed but
corresponding struct passed to the sizeof has not.
Cc: Gustavo A. R. Silva <gustavoars@kernel.org >
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200723145927.882743-5-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-23 19:33:09 +02:00
Tomas Winkler
71ae5255f8
mei: bus: use sizeof of variable instead of struct type
...
There is a possibility of bug when variable type has changed but
corresponding struct passed to the sizeof has not.
Cc: Gustavo A. R. Silva <gustavoars@kernel.org >
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200723145927.882743-4-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-23 19:33:09 +02:00
Tomas Winkler
b4a6700c80
mei: ioctl: use sizeof of variable instead of struct type
...
Use sizeof(connect_data))) instead of
sizeof(struct mei_connect_client_data) when copying data
between user space and kernel.
There is a possibility of bug when variable type has changed but
corresponding struct passed to the sizeof has not.
Cc: Gustavo A. R. Silva <gustavoars@kernel.org >
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200723145927.882743-3-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-23 19:33:09 +02:00
Tomas Winkler
df4b37bcc8
mei: hbm: use sizeof of variable instead of struct type
...
There is a possibility of bug when variable type has changed but
corresponding struct passed to the sizeof has not.
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200723145927.882743-2-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-23 19:33:08 +02:00
Greg Kroah-Hartman
e24ca92599
Revert "mei: Avoid the use of one-element arrays"
...
This reverts commit 3c3b7ddef7 , as it
turns out Tomas made a better series of patches for this same issue.
Cc: Gustavo A. R. Silva <gustavoars@kernel.org >
Cc: Tomas Winkler <tomas.winkler@intel.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-23 19:29:25 +02:00
Gustavo A. R. Silva
3c3b7ddef7
mei: Avoid the use of one-element arrays
...
One-element arrays are being deprecated[1]. Replace the one-element
arrays with a simple value type u8 reserved, once this is just a
placeholder for alignment.
Also, while there, use the preferred form for passing a size of a struct.
The alternative form where struct name is spelled out hurts readability
and introduces an opportunity for a bug when the variable type is changed
but the corresponding sizeof that is passed as argument is not.
[1] https://github.com/KSPP/linux/issues/79
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Link: https://lore.kernel.org/r/20200714214516.GA1040@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-23 09:27:10 +02:00
Alexander A. Klimov
74b04fae45
mei: Replace HTTP links with HTTPS ones
...
Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.
Deterministic algorithm:
For each file:
If not .svg:
For each line:
If doesn't contain `\bxmlns\b`:
For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
If both the HTTP and HTTPS versions
return 200 OK and serve the same content:
Replace HTTP with HTTPS.
Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de >
Acked-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200717185925.84102-1-grandmaster@al2klimov.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-23 09:27:09 +02:00
Gustavo A. R. Silva
c56967d674
mei: hdcp: Replace one-element array with flexible-array member
...
There is a regular need in the kernel to provide a way to declare
having a dynamically sized set of trailing elements in a structure.
Kernel code should always use “flexible array members”[1] for these
cases. The older style of one-element or zero-length arrays should
no longer be used[2].
Also, make use of the array_size() helper instead of the open-coded
version in memcpy(). These sorts of multiplication factors need to
be wrapped in array_size().
And while there, use the preferred form for passing a size of a struct.
The alternative form where struct name is spelled out hurts readability
and introduces an opportunity for a bug when the pointer variable type is
changed but the corresponding sizeof that is passed as argument is not.
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://github.com/KSPP/linux/issues/79
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
Link: https://lore.kernel.org/r/20200722181534.GA31357@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-23 09:27:09 +02:00
Greg Kroah-Hartman
2d41d2ab85
Merge branch 'char-misc-linus' into 'char-misc-next'
...
We need the virtbox changes in here as well to build on top of.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-10 13:42:33 +02:00
Alexander Usyskin
e852c2c251
mei: bus: don't clean driver pointer
...
It's not needed to set driver to NULL in mei_cl_device_remove()
which is bus_type remove() handler as this is done anyway
in __device_release_driver().
Actually this is causing an endless loop in driver_detach()
on ubuntu patched kernel, while removing (rmmod) the mei_hdcp module.
The reason list_empty(&drv->p->klist_devices.k_list) is always not-empty.
as the check is always true in __device_release_driver()
if (dev->driver != drv)
return;
The non upstream patch is causing this behavior, titled:
'vfio -- release device lock before userspace requests'
Nevertheless the fix is correct also for the upstream.
Link: https://patchwork.ozlabs.org/project/ubuntu-kernel/patch/20180912085046.3401-2-apw@canonical.com/
Cc: <stable@vger.kernel.org >
Cc: Andy Whitcroft <apw@canonical.com >
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200628225359.2185929-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-29 19:10:51 +02:00
Tomas Winkler
4afc339ef0
mei: me: add MEI device for KBP with ITPS capability
...
Add device ID for Intel Kaby Point PCH (Kabylake) which has
Intel Precise Touch & Stylus IPTS (iTouch).
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200619165121.2145330-6-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-29 18:40:26 +02:00
Tomas Winkler
372a829862
mei: me: add MEI device for SPT with ITPS capability
...
Add device ID for Intel Sunrise Point PCH (Skylake) which has
Intel Precise Touch & Stylus IPTS (iTouch).
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200619165121.2145330-5-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-29 18:40:26 +02:00
Tomas Winkler
3fbd1dfe26
mei: me: add kdoc for mei_me_fw_type_nm()
...
Add kdoc for mei_me_fw_type_nm() function.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200619165121.2145330-4-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-29 18:40:26 +02:00
Tomas Winkler
4d3c6c8eb9
mei: me: make mei_me_fw_sku_sps_4() less cryptic
...
Last add mei_me_fw_sku_sps_4() kdoc and add descriptive defines
for register name and values.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200619165121.2145330-3-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-29 18:40:26 +02:00
Tomas Winkler
45a2c76283
mei: me: constify the device parameter to the probe quirk
...
The quirk_probe there is no writing to pci device hence
we can constify the passed pci_dev pointer.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200619165121.2145330-2-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-29 18:40:26 +02:00
Rikard Falkeborn
50bf73bdce
mei: hdcp: Constify struct mei_cl_device_id
...
mei_hdcp_tbl[] is never modified and can be made const to allow the
compiler to put it in read-only memory.
Before:
text data bss dec hex filename
15844 5416 0 21260 530c drivers/misc/mei/hdcp/mei_hdcp.o
After:
text data bss dec hex filename
16004 5256 0 21260 530c drivers/misc/mei/hdcp/mei_hdcp.o
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com >
Link: https://lore.kernel.org/r/20200610224704.27082-4-rikard.falkeborn@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-29 18:39:44 +02:00
Alexander Usyskin
8c289ea064
mei: me: add tiger lake point device ids for H platforms.
...
Add Tiger Lake device ids H for HECI1.
TGH_H is also used in Tatlow SPS platform we need to
disable the mei interface there.
Cc: <stable@vger.kernel.org >
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200619165121.2145330-7-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-23 07:55:47 +02:00
Tomas Winkler
f76d77f50b
mei: me: disable mei interface on Mehlow server platforms
...
For SPS firmware versions 5.0 and newer the way detection has changed.
The detection is done now via PCI_CFG_HFS_3 register.
To prevent conflict the previous method will get sps_4 suffix
Disable both CNP_H and CNP_H_3 interfaces. CNP_H_3 requires
a separate configuration as it doesn't support DMA.
Cc: <stable@vger.kernel.org >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200619165121.2145330-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-23 07:55:47 +02:00
Rafael J. Wysocki
be6018a44c
Merge branches 'pm-core' and 'pm-sleep'
...
* pm-core:
PM: runtime: Replace pm_runtime_callbacks_present()
PM: runtime: clk: Fix clk_pm_runtime_get() error path
PM: runtime: Make clear what we do when conditions are wrong in rpm_suspend()
* pm-sleep:
PM: hibernate: Restrict writes to the resume device
PM: hibernate: Split off snapshot dev option
PM: hibernate: Incorporate concurrency handling
PM: sleep: Helpful edits for devices.rst documentation
Documentation: PM: sleep: Update driver flags documentation
PM: sleep: core: Rename DPM_FLAG_LEAVE_SUSPENDED
PM: sleep: core: Rename DPM_FLAG_NEVER_SKIP
PM: sleep: core: Rename dev_pm_smart_suspend_and_suspended()
PM: sleep: core: Rename dev_pm_may_skip_resume()
PM: sleep: core: Rework the power.may_skip_resume handling
PM: sleep: core: Do not skip callbacks in the resume phase
PM: sleep: core: Fold functions into their callers
PM: sleep: core: Simplify the SMART_SUSPEND flag handling
2020-06-01 15:19:08 +02:00
Alexander Usyskin
fc9c03ce30
mei: release me_cl object reference
...
Allow me_cl object to be freed by releasing the reference
that was acquired by one of the search functions:
__mei_me_cl_by_uuid_id() or __mei_me_cl_by_uuid()
Cc: <stable@vger.kernel.org >
Reported-by: 亿一 <teroincn@gmail.com >
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200512223140.32186-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-05-15 16:32:19 +02:00
Tomas Winkler
d76bc8200f
mei: me: disable mei interface on LBG servers.
...
Disable the MEI driver on LBG SPS (server) platforms, some corner
flows such as recovery mode does not work, and the driver
doesn't have working use cases.
Cc: <stable@vger.kernel.org >
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com >
Link: https://lore.kernel.org/r/20200428211200.12200-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-05-05 16:56:41 +02:00
Rafael J. Wysocki
3a4ccdb92e
Merge back system-wide PM material for v5.8.
2020-05-02 21:59:03 +02:00