Skip to content

Commit fb1c592

Browse files
committed
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()
2 parents 4ebaf07 + eafa717 commit fb1c592

File tree

10 files changed

+57
-44
lines changed

10 files changed

+57
-44
lines changed

Documentation/driver-api/fpga/fpga-mgr.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ API for implementing a new FPGA Manager driver
184184
API for programming an FPGA
185185
---------------------------
186186

187+
FPGA Manager flags
188+
189+
.. kernel-doc:: include/linux/fpga/fpga-mgr.h
190+
:doc: FPGA Manager flags
191+
187192
.. kernel-doc:: include/linux/fpga/fpga-mgr.h
188193
:functions: fpga_image_info
189194

drivers/base/firmware_loader/main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,11 @@ static int alloc_lookup_fw_priv(const char *fw_name,
226226
}
227227

228228
tmp = __allocate_fw_priv(fw_name, fwc, dbuf, size);
229-
if (tmp && !(opt_flags & FW_OPT_NOCACHE))
230-
list_add(&tmp->list, &fwc->head);
229+
if (tmp) {
230+
INIT_LIST_HEAD(&tmp->list);
231+
if (!(opt_flags & FW_OPT_NOCACHE))
232+
list_add(&tmp->list, &fwc->head);
233+
}
231234
spin_unlock(&fwc->lock);
232235

233236
*fw_priv = tmp;

drivers/fpga/dfl-fme-region.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
#include <linux/module.h>
17+
#include <linux/fpga/fpga-mgr.h>
1718
#include <linux/fpga/fpga-region.h>
1819

1920
#include "dfl-fme-pr.h"
@@ -66,9 +67,10 @@ static int fme_region_probe(struct platform_device *pdev)
6667
static int fme_region_remove(struct platform_device *pdev)
6768
{
6869
struct fpga_region *region = dev_get_drvdata(&pdev->dev);
70+
struct fpga_manager *mgr = region->mgr;
6971

7072
fpga_region_unregister(region);
71-
fpga_mgr_put(region->mgr);
73+
fpga_mgr_put(mgr);
7274

7375
return 0;
7476
}

drivers/fpga/fpga-bridge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static int fpga_bridge_dev_match(struct device *dev, const void *data)
125125
*
126126
* Given a device, get an exclusive reference to a fpga bridge.
127127
*
128-
* Return: fpga manager struct or IS_ERR() condition containing error code.
128+
* Return: fpga bridge struct or IS_ERR() condition containing error code.
129129
*/
130130
struct fpga_bridge *fpga_bridge_get(struct device *dev,
131131
struct fpga_image_info *info)

drivers/fpga/of-fpga-region.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,10 @@ static int of_fpga_region_probe(struct platform_device *pdev)
437437
static int of_fpga_region_remove(struct platform_device *pdev)
438438
{
439439
struct fpga_region *region = platform_get_drvdata(pdev);
440+
struct fpga_manager *mgr = region->mgr;
440441

441442
fpga_region_unregister(region);
442-
fpga_mgr_put(region->mgr);
443+
fpga_mgr_put(mgr);
443444

444445
return 0;
445446
}

drivers/hv/connection.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
7676
__u32 version)
7777
{
7878
int ret = 0;
79+
unsigned int cur_cpu;
7980
struct vmbus_channel_initiate_contact *msg;
8081
unsigned long flags;
8182

@@ -118,9 +119,10 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
118119
* the CPU attempting to connect may not be CPU 0.
119120
*/
120121
if (version >= VERSION_WIN8_1) {
121-
msg->target_vcpu =
122-
hv_cpu_number_to_vp_number(smp_processor_id());
123-
vmbus_connection.connect_cpu = smp_processor_id();
122+
cur_cpu = get_cpu();
123+
msg->target_vcpu = hv_cpu_number_to_vp_number(cur_cpu);
124+
vmbus_connection.connect_cpu = cur_cpu;
125+
put_cpu();
124126
} else {
125127
msg->target_vcpu = 0;
126128
vmbus_connection.connect_cpu = 0;

drivers/thunderbolt/icm.c

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -738,14 +738,6 @@ icm_fr_xdomain_connected(struct tb *tb, const struct icm_pkg_header *hdr)
738738
u8 link, depth;
739739
u64 route;
740740

741-
/*
742-
* After NVM upgrade adding root switch device fails because we
743-
* initiated reset. During that time ICM might still send
744-
* XDomain connected message which we ignore here.
745-
*/
746-
if (!tb->root_switch)
747-
return;
748-
749741
link = pkg->link_info & ICM_LINK_INFO_LINK_MASK;
750742
depth = (pkg->link_info & ICM_LINK_INFO_DEPTH_MASK) >>
751743
ICM_LINK_INFO_DEPTH_SHIFT;
@@ -1037,14 +1029,6 @@ icm_tr_device_connected(struct tb *tb, const struct icm_pkg_header *hdr)
10371029
if (pkg->hdr.packet_id)
10381030
return;
10391031

1040-
/*
1041-
* After NVM upgrade adding root switch device fails because we
1042-
* initiated reset. During that time ICM might still send device
1043-
* connected message which we ignore here.
1044-
*/
1045-
if (!tb->root_switch)
1046-
return;
1047-
10481032
route = get_route(pkg->route_hi, pkg->route_lo);
10491033
authorized = pkg->link_info & ICM_LINK_INFO_APPROVED;
10501034
security_level = (pkg->hdr.flags & ICM_FLAGS_SLEVEL_MASK) >>
@@ -1408,19 +1392,26 @@ static void icm_handle_notification(struct work_struct *work)
14081392

14091393
mutex_lock(&tb->lock);
14101394

1411-
switch (n->pkg->code) {
1412-
case ICM_EVENT_DEVICE_CONNECTED:
1413-
icm->device_connected(tb, n->pkg);
1414-
break;
1415-
case ICM_EVENT_DEVICE_DISCONNECTED:
1416-
icm->device_disconnected(tb, n->pkg);
1417-
break;
1418-
case ICM_EVENT_XDOMAIN_CONNECTED:
1419-
icm->xdomain_connected(tb, n->pkg);
1420-
break;
1421-
case ICM_EVENT_XDOMAIN_DISCONNECTED:
1422-
icm->xdomain_disconnected(tb, n->pkg);
1423-
break;
1395+
/*
1396+
* When the domain is stopped we flush its workqueue but before
1397+
* that the root switch is removed. In that case we should treat
1398+
* the queued events as being canceled.
1399+
*/
1400+
if (tb->root_switch) {
1401+
switch (n->pkg->code) {
1402+
case ICM_EVENT_DEVICE_CONNECTED:
1403+
icm->device_connected(tb, n->pkg);
1404+
break;
1405+
case ICM_EVENT_DEVICE_DISCONNECTED:
1406+
icm->device_disconnected(tb, n->pkg);
1407+
break;
1408+
case ICM_EVENT_XDOMAIN_CONNECTED:
1409+
icm->xdomain_connected(tb, n->pkg);
1410+
break;
1411+
case ICM_EVENT_XDOMAIN_DISCONNECTED:
1412+
icm->xdomain_disconnected(tb, n->pkg);
1413+
break;
1414+
}
14241415
}
14251416

14261417
mutex_unlock(&tb->lock);

drivers/thunderbolt/nhi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,5 +1191,5 @@ static void __exit nhi_unload(void)
11911191
tb_domain_exit();
11921192
}
11931193

1194-
fs_initcall(nhi_init);
1194+
rootfs_initcall(nhi_init);
11951195
module_exit(nhi_unload);

include/linux/fpga/fpga-mgr.h

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,20 @@ enum fpga_mgr_states {
5353
FPGA_MGR_STATE_OPERATING,
5454
};
5555

56-
/*
57-
* FPGA Manager flags
58-
* FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
59-
* FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting
60-
* FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first
61-
* FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed
56+
/**
57+
* DOC: FPGA Manager flags
58+
*
59+
* Flags used in the &fpga_image_info->flags field
60+
*
61+
* %FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
62+
*
63+
* %FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting
64+
*
65+
* %FPGA_MGR_ENCRYPTED_BITSTREAM: indicates bitstream is encrypted
66+
*
67+
* %FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first
68+
*
69+
* %FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed
6270
*/
6371
#define FPGA_MGR_PARTIAL_RECONFIG BIT(0)
6472
#define FPGA_MGR_EXTERNAL_CONFIG BIT(1)

tools/hv/hv_fcopy_daemon.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ int main(int argc, char *argv[])
234234
break;
235235

236236
default:
237+
error = HV_E_FAIL;
237238
syslog(LOG_ERR, "Unknown operation: %d",
238239
buffer.hdr.operation);
239240

0 commit comments

Comments
 (0)