Commit fb1c592c authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'char-misc-4.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

I wrote:
  "Char/Misc fixes for 4.19-rc7

   Here are 8 small fixes for some char/misc driver issues

   Included here are:
	- fpga driver fixes
	- thunderbolt bugfixes
	- firmware core revert/fix
	- hv core fix
	- hv tool fix

   All of these have been in linux-next with no reported issues."

* tag 'char-misc-4.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  thunderbolt: Initialize after IOMMUs
  thunderbolt: Do not handle ICM events after domain is stopped
  firmware: Always initialize the fw_priv list object
  docs: fpga: document fpga manager flags
  fpga: bridge: fix obvious function documentation error
  tools: hv: fcopy: set 'error' in case an unknown operation was requested
  fpga: do not access region struct after fpga_region_unregister
  Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect()
parents 4ebaf075 eafa717b
...@@ -184,6 +184,11 @@ API for implementing a new FPGA Manager driver ...@@ -184,6 +184,11 @@ API for implementing a new FPGA Manager driver
API for programming an FPGA API for programming an FPGA
--------------------------- ---------------------------
FPGA Manager flags
.. kernel-doc:: include/linux/fpga/fpga-mgr.h
:doc: FPGA Manager flags
.. kernel-doc:: include/linux/fpga/fpga-mgr.h .. kernel-doc:: include/linux/fpga/fpga-mgr.h
:functions: fpga_image_info :functions: fpga_image_info
......
...@@ -226,8 +226,11 @@ static int alloc_lookup_fw_priv(const char *fw_name, ...@@ -226,8 +226,11 @@ static int alloc_lookup_fw_priv(const char *fw_name,
} }
tmp = __allocate_fw_priv(fw_name, fwc, dbuf, size); tmp = __allocate_fw_priv(fw_name, fwc, dbuf, size);
if (tmp && !(opt_flags & FW_OPT_NOCACHE)) if (tmp) {
list_add(&tmp->list, &fwc->head); INIT_LIST_HEAD(&tmp->list);
if (!(opt_flags & FW_OPT_NOCACHE))
list_add(&tmp->list, &fwc->head);
}
spin_unlock(&fwc->lock); spin_unlock(&fwc->lock);
*fw_priv = tmp; *fw_priv = tmp;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/fpga/fpga-mgr.h>
#include <linux/fpga/fpga-region.h> #include <linux/fpga/fpga-region.h>
#include "dfl-fme-pr.h" #include "dfl-fme-pr.h"
...@@ -66,9 +67,10 @@ static int fme_region_probe(struct platform_device *pdev) ...@@ -66,9 +67,10 @@ static int fme_region_probe(struct platform_device *pdev)
static int fme_region_remove(struct platform_device *pdev) static int fme_region_remove(struct platform_device *pdev)
{ {
struct fpga_region *region = dev_get_drvdata(&pdev->dev); struct fpga_region *region = dev_get_drvdata(&pdev->dev);
struct fpga_manager *mgr = region->mgr;
fpga_region_unregister(region); fpga_region_unregister(region);
fpga_mgr_put(region->mgr); fpga_mgr_put(mgr);
return 0; return 0;
} }
......
...@@ -125,7 +125,7 @@ static int fpga_bridge_dev_match(struct device *dev, const void *data) ...@@ -125,7 +125,7 @@ static int fpga_bridge_dev_match(struct device *dev, const void *data)
* *
* Given a device, get an exclusive reference to a fpga bridge. * Given a device, get an exclusive reference to a fpga bridge.
* *
* Return: fpga manager struct or IS_ERR() condition containing error code. * Return: fpga bridge struct or IS_ERR() condition containing error code.
*/ */
struct fpga_bridge *fpga_bridge_get(struct device *dev, struct fpga_bridge *fpga_bridge_get(struct device *dev,
struct fpga_image_info *info) struct fpga_image_info *info)
......
...@@ -437,9 +437,10 @@ static int of_fpga_region_probe(struct platform_device *pdev) ...@@ -437,9 +437,10 @@ static int of_fpga_region_probe(struct platform_device *pdev)
static int of_fpga_region_remove(struct platform_device *pdev) static int of_fpga_region_remove(struct platform_device *pdev)
{ {
struct fpga_region *region = platform_get_drvdata(pdev); struct fpga_region *region = platform_get_drvdata(pdev);
struct fpga_manager *mgr = region->mgr;
fpga_region_unregister(region); fpga_region_unregister(region);
fpga_mgr_put(region->mgr); fpga_mgr_put(mgr);
return 0; return 0;
} }
......
...@@ -76,6 +76,7 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, ...@@ -76,6 +76,7 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
__u32 version) __u32 version)
{ {
int ret = 0; int ret = 0;
unsigned int cur_cpu;
struct vmbus_channel_initiate_contact *msg; struct vmbus_channel_initiate_contact *msg;
unsigned long flags; unsigned long flags;
...@@ -118,9 +119,10 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, ...@@ -118,9 +119,10 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
* the CPU attempting to connect may not be CPU 0. * the CPU attempting to connect may not be CPU 0.
*/ */
if (version >= VERSION_WIN8_1) { if (version >= VERSION_WIN8_1) {
msg->target_vcpu = cur_cpu = get_cpu();
hv_cpu_number_to_vp_number(smp_processor_id()); msg->target_vcpu = hv_cpu_number_to_vp_number(cur_cpu);
vmbus_connection.connect_cpu = smp_processor_id(); vmbus_connection.connect_cpu = cur_cpu;
put_cpu();
} else { } else {
msg->target_vcpu = 0; msg->target_vcpu = 0;
vmbus_connection.connect_cpu = 0; vmbus_connection.connect_cpu = 0;
......
...@@ -738,14 +738,6 @@ icm_fr_xdomain_connected(struct tb *tb, const struct icm_pkg_header *hdr) ...@@ -738,14 +738,6 @@ icm_fr_xdomain_connected(struct tb *tb, const struct icm_pkg_header *hdr)
u8 link, depth; u8 link, depth;
u64 route; u64 route;
/*
* After NVM upgrade adding root switch device fails because we
* initiated reset. During that time ICM might still send
* XDomain connected message which we ignore here.
*/
if (!tb->root_switch)
return;
link = pkg->link_info & ICM_LINK_INFO_LINK_MASK; link = pkg->link_info & ICM_LINK_INFO_LINK_MASK;
depth = (pkg->link_info & ICM_LINK_INFO_DEPTH_MASK) >> depth = (pkg->link_info & ICM_LINK_INFO_DEPTH_MASK) >>
ICM_LINK_INFO_DEPTH_SHIFT; ICM_LINK_INFO_DEPTH_SHIFT;
...@@ -1037,14 +1029,6 @@ icm_tr_device_connected(struct tb *tb, const struct icm_pkg_header *hdr) ...@@ -1037,14 +1029,6 @@ icm_tr_device_connected(struct tb *tb, const struct icm_pkg_header *hdr)
if (pkg->hdr.packet_id) if (pkg->hdr.packet_id)
return; return;
/*
* After NVM upgrade adding root switch device fails because we
* initiated reset. During that time ICM might still send device
* connected message which we ignore here.
*/
if (!tb->root_switch)
return;
route = get_route(pkg->route_hi, pkg->route_lo); route = get_route(pkg->route_hi, pkg->route_lo);
authorized = pkg->link_info & ICM_LINK_INFO_APPROVED; authorized = pkg->link_info & ICM_LINK_INFO_APPROVED;
security_level = (pkg->hdr.flags & ICM_FLAGS_SLEVEL_MASK) >> security_level = (pkg->hdr.flags & ICM_FLAGS_SLEVEL_MASK) >>
...@@ -1408,19 +1392,26 @@ static void icm_handle_notification(struct work_struct *work) ...@@ -1408,19 +1392,26 @@ static void icm_handle_notification(struct work_struct *work)
mutex_lock(&tb->lock); mutex_lock(&tb->lock);
switch (n->pkg->code) { /*
case ICM_EVENT_DEVICE_CONNECTED: * When the domain is stopped we flush its workqueue but before
icm->device_connected(tb, n->pkg); * that the root switch is removed. In that case we should treat
break; * the queued events as being canceled.
case ICM_EVENT_DEVICE_DISCONNECTED: */
icm->device_disconnected(tb, n->pkg); if (tb->root_switch) {
break; switch (n->pkg->code) {
case ICM_EVENT_XDOMAIN_CONNECTED: case ICM_EVENT_DEVICE_CONNECTED:
icm->xdomain_connected(tb, n->pkg); icm->device_connected(tb, n->pkg);
break; break;
case ICM_EVENT_XDOMAIN_DISCONNECTED: case ICM_EVENT_DEVICE_DISCONNECTED:
icm->xdomain_disconnected(tb, n->pkg); icm->device_disconnected(tb, n->pkg);
break; break;
case ICM_EVENT_XDOMAIN_CONNECTED:
icm->xdomain_connected(tb, n->pkg);
break;
case ICM_EVENT_XDOMAIN_DISCONNECTED:
icm->xdomain_disconnected(tb, n->pkg);
break;
}
} }
mutex_unlock(&tb->lock); mutex_unlock(&tb->lock);
......
...@@ -1191,5 +1191,5 @@ static void __exit nhi_unload(void) ...@@ -1191,5 +1191,5 @@ static void __exit nhi_unload(void)
tb_domain_exit(); tb_domain_exit();
} }
fs_initcall(nhi_init); rootfs_initcall(nhi_init);
module_exit(nhi_unload); module_exit(nhi_unload);
...@@ -53,12 +53,20 @@ enum fpga_mgr_states { ...@@ -53,12 +53,20 @@ enum fpga_mgr_states {
FPGA_MGR_STATE_OPERATING, FPGA_MGR_STATE_OPERATING,
}; };
/* /**
* FPGA Manager flags * DOC: FPGA Manager flags
* FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported *
* FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting * Flags used in the &fpga_image_info->flags field
* FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first *
* FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed * %FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
*
* %FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting
*
* %FPGA_MGR_ENCRYPTED_BITSTREAM: indicates bitstream is encrypted
*
* %FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first
*
* %FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed
*/ */
#define FPGA_MGR_PARTIAL_RECONFIG BIT(0) #define FPGA_MGR_PARTIAL_RECONFIG BIT(0)
#define FPGA_MGR_EXTERNAL_CONFIG BIT(1) #define FPGA_MGR_EXTERNAL_CONFIG BIT(1)
......
...@@ -234,6 +234,7 @@ int main(int argc, char *argv[]) ...@@ -234,6 +234,7 @@ int main(int argc, char *argv[])
break; break;
default: default:
error = HV_E_FAIL;
syslog(LOG_ERR, "Unknown operation: %d", syslog(LOG_ERR, "Unknown operation: %d",
buffer.hdr.operation); buffer.hdr.operation);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment