Skip to content

Commit 5717af5

Browse files
committed
Merge pull request #43 from torvalds/master
Sync up with Linus
2 parents 4a1e024 + b24e2bd commit 5717af5

19 files changed

+146
-27
lines changed

arch/x86/kernel/entry_32.S

+3
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,9 @@ ENTRY(xen_hypervisor_callback)
982982
ENTRY(xen_do_upcall)
983983
1: mov %esp, %eax
984984
call xen_evtchn_do_upcall
985+
#ifndef CONFIG_PREEMPT
986+
call xen_maybe_preempt_hcall
987+
#endif
985988
jmp ret_from_intr
986989
CFI_ENDPROC
987990
ENDPROC(xen_hypervisor_callback)

arch/x86/kernel/entry_64.S

+3
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,9 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
12081208
popq %rsp
12091209
CFI_DEF_CFA_REGISTER rsp
12101210
decl PER_CPU_VAR(irq_count)
1211+
#ifndef CONFIG_PREEMPT
1212+
call xen_maybe_preempt_hcall
1213+
#endif
12111214
jmp error_exit
12121215
CFI_ENDPROC
12131216
END(xen_do_hypervisor_callback)

arch/x86/lguest/Kconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
config LGUEST_GUEST
22
bool "Lguest guest support"
3-
depends on X86_32 && PARAVIRT
3+
depends on X86_32 && PARAVIRT && PCI
44
select TTY
55
select VIRTUALIZATION
66
select VIRTIO
77
select VIRTIO_CONSOLE
88
help
99
Lguest is a tiny in-kernel hypervisor. Selecting this will
1010
allow your kernel to boot under lguest. This option will increase
11-
your kernel size by about 6k. If in doubt, say N.
11+
your kernel size by about 10k. If in doubt, say N.
1212

1313
If you say Y here, make sure you say Y (or M) to the virtio block
1414
and net drivers which lguest needs.

arch/x86/xen/enlighten.c

+19-1
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,23 @@ static inline void xen_write_cr8(unsigned long val)
10701070
BUG_ON(val);
10711071
}
10721072
#endif
1073+
1074+
static u64 xen_read_msr_safe(unsigned int msr, int *err)
1075+
{
1076+
u64 val;
1077+
1078+
val = native_read_msr_safe(msr, err);
1079+
switch (msr) {
1080+
case MSR_IA32_APICBASE:
1081+
#ifdef CONFIG_X86_X2APIC
1082+
if (!(cpuid_ecx(1) & (1 << (X86_FEATURE_X2APIC & 31))))
1083+
#endif
1084+
val &= ~X2APIC_ENABLE;
1085+
break;
1086+
}
1087+
return val;
1088+
}
1089+
10731090
static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
10741091
{
10751092
int ret;
@@ -1240,7 +1257,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
12401257

12411258
.wbinvd = native_wbinvd,
12421259

1243-
.read_msr = native_read_msr_safe,
1260+
.read_msr = xen_read_msr_safe,
12441261
.write_msr = xen_write_msr_safe,
12451262

12461263
.read_tsc = native_read_tsc,
@@ -1741,6 +1758,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
17411758
#ifdef CONFIG_X86_32
17421759
i386_start_kernel();
17431760
#else
1761+
cr4_init_shadow(); /* 32b kernel does this in i386_start_kernel() */
17441762
x86_64_start_reservations((char *)__pa_symbol(&boot_params));
17451763
#endif
17461764
}

drivers/hid/hid-core.c

+2
Original file line numberDiff line numberDiff line change
@@ -1872,6 +1872,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
18721872
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
18731873
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) },
18741874
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) },
1875+
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K) },
18751876
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) },
18761877
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
18771878
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
@@ -1926,6 +1927,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
19261927
#endif
19271928
#if IS_ENABLED(CONFIG_HID_SAITEK)
19281929
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) },
1930+
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD) },
19291931
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) },
19301932
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) },
19311933
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) },

drivers/hid/hid-ids.h

+2
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@
654654
#define USB_DEVICE_ID_MS_LK6K 0x00f9
655655
#define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701
656656
#define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713
657+
#define USB_DEVICE_ID_MS_NE7K 0x071d
657658
#define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730
658659
#define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c
659660
#define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799
@@ -802,6 +803,7 @@
802803
#define USB_VENDOR_ID_SAITEK 0x06a3
803804
#define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
804805
#define USB_DEVICE_ID_SAITEK_PS1000 0x0621
806+
#define USB_DEVICE_ID_SAITEK_RAT7_OLD 0x0ccb
805807
#define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7
806808
#define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0
807809

drivers/hid/hid-microsoft.c

+2
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ static const struct hid_device_id ms_devices[] = {
264264
.driver_data = MS_ERGONOMY },
265265
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP),
266266
.driver_data = MS_ERGONOMY },
267+
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K),
268+
.driver_data = MS_ERGONOMY },
267269
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K),
268270
.driver_data = MS_ERGONOMY | MS_RDESC },
269271
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB),

drivers/hid/hid-saitek.c

+2
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ static int saitek_event(struct hid_device *hdev, struct hid_field *field,
177177
static const struct hid_device_id saitek_devices[] = {
178178
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000),
179179
.driver_data = SAITEK_FIX_PS1000 },
180+
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD),
181+
.driver_data = SAITEK_RELEASE_MODE_RAT7 },
180182
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7),
181183
.driver_data = SAITEK_RELEASE_MODE_RAT7 },
182184
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9),

drivers/hid/hid-sensor-hub.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
135135
{
136136
struct hid_sensor_hub_callbacks_list *callback;
137137
struct sensor_hub_data *pdata = hid_get_drvdata(hdev);
138+
unsigned long flags;
138139

139-
spin_lock(&pdata->dyn_callback_lock);
140+
spin_lock_irqsave(&pdata->dyn_callback_lock, flags);
140141
list_for_each_entry(callback, &pdata->dyn_callback_list, list)
141142
if (callback->usage_id == usage_id &&
142143
(collection_index >=
@@ -145,10 +146,11 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
145146
callback->hsdev->end_collection_index)) {
146147
*priv = callback->priv;
147148
*hsdev = callback->hsdev;
148-
spin_unlock(&pdata->dyn_callback_lock);
149+
spin_unlock_irqrestore(&pdata->dyn_callback_lock,
150+
flags);
149151
return callback->usage_callback;
150152
}
151-
spin_unlock(&pdata->dyn_callback_lock);
153+
spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags);
152154

153155
return NULL;
154156
}

drivers/hid/hid-sony.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ union sixaxis_output_report_01 {
804804
#define DS4_REPORT_0x81_SIZE 7
805805
#define SIXAXIS_REPORT_0xF2_SIZE 18
806806

807-
static spinlock_t sony_dev_list_lock;
807+
static DEFINE_SPINLOCK(sony_dev_list_lock);
808808
static LIST_HEAD(sony_device_list);
809809
static DEFINE_IDA(sony_device_id_allocator);
810810

@@ -1944,6 +1944,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
19441944
return -ENOMEM;
19451945
}
19461946

1947+
spin_lock_init(&sc->lock);
1948+
19471949
sc->quirks = quirks;
19481950
hid_set_drvdata(hdev, sc);
19491951
sc->hdev = hdev;
@@ -2147,8 +2149,8 @@ static void __exit sony_exit(void)
21472149
{
21482150
dbg_hid("Sony:%s\n", __func__);
21492151

2150-
ida_destroy(&sony_device_id_allocator);
21512152
hid_unregister_driver(&sony_driver);
2153+
ida_destroy(&sony_device_id_allocator);
21522154
}
21532155
module_init(sony_init);
21542156
module_exit(sony_exit);

drivers/hid/i2c-hid/i2c-hid.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,10 @@ static int i2c_hid_hwreset(struct i2c_client *client)
370370
static void i2c_hid_get_input(struct i2c_hid *ihid)
371371
{
372372
int ret, ret_size;
373-
int size = ihid->bufsize;
373+
int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
374+
375+
if (size > ihid->bufsize)
376+
size = ihid->bufsize;
374377

375378
ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
376379
if (ret != size) {
@@ -785,7 +788,7 @@ static int i2c_hid_init_irq(struct i2c_client *client)
785788
dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq);
786789

787790
ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq,
788-
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
791+
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
789792
client->name, ihid);
790793
if (ret < 0) {
791794
dev_warn(&client->dev,

drivers/hid/wacom_wac.c

+8-3
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,11 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
778778
input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4]));
779779
input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6]));
780780
input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8]));
781+
if ((data[2] & 0x07) | data[4] | data[5] | data[6] | data[7] | data[8] | data[9]) {
782+
input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
783+
} else {
784+
input_report_abs(input, ABS_MISC, 0);
785+
}
781786
} else if (features->type == CINTIQ_HYBRID) {
782787
/*
783788
* Do not send hardware buttons under Android. They
@@ -2725,9 +2730,9 @@ static const struct wacom_features wacom_features_0xF6 =
27252730
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10,
27262731
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
27272732
static const struct wacom_features wacom_features_0x32A =
2728-
{ "Wacom Cintiq 27QHD", 119740, 67520, 2047,
2729-
63, WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2730-
WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2733+
{ "Wacom Cintiq 27QHD", 119740, 67520, 2047, 63,
2734+
WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2735+
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
27312736
static const struct wacom_features wacom_features_0x32B =
27322737
{ "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63,
27332738
WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,

drivers/xen/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ifeq ($(filter y, $(CONFIG_ARM) $(CONFIG_ARM64)),)
22
obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o
33
endif
44
obj-$(CONFIG_X86) += fallback.o
5-
obj-y += grant-table.o features.o balloon.o manage.o
5+
obj-y += grant-table.o features.o balloon.o manage.o preempt.o
66
obj-y += events/
77
obj-y += xenbus/
88

drivers/xen/preempt.c

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Preemptible hypercalls
3+
*
4+
* Copyright (C) 2014 Citrix Systems R&D ltd.
5+
*
6+
* This source code is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU General Public License as
8+
* published by the Free Software Foundation; either version 2 of the
9+
* License, or (at your option) any later version.
10+
*/
11+
12+
#include <linux/sched.h>
13+
#include <xen/xen-ops.h>
14+
15+
#ifndef CONFIG_PREEMPT
16+
17+
/*
18+
* Some hypercalls issued by the toolstack can take many 10s of
19+
* seconds. Allow tasks running hypercalls via the privcmd driver to
20+
* be voluntarily preempted even if full kernel preemption is
21+
* disabled.
22+
*
23+
* Such preemptible hypercalls are bracketed by
24+
* xen_preemptible_hcall_begin() and xen_preemptible_hcall_end()
25+
* calls.
26+
*/
27+
28+
DEFINE_PER_CPU(bool, xen_in_preemptible_hcall);
29+
EXPORT_SYMBOL_GPL(xen_in_preemptible_hcall);
30+
31+
asmlinkage __visible void xen_maybe_preempt_hcall(void)
32+
{
33+
if (unlikely(__this_cpu_read(xen_in_preemptible_hcall)
34+
&& should_resched())) {
35+
/*
36+
* Clear flag as we may be rescheduled on a different
37+
* cpu.
38+
*/
39+
__this_cpu_write(xen_in_preemptible_hcall, false);
40+
_cond_resched();
41+
__this_cpu_write(xen_in_preemptible_hcall, true);
42+
}
43+
}
44+
#endif /* CONFIG_PREEMPT */

drivers/xen/privcmd.c

+2
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ static long privcmd_ioctl_hypercall(void __user *udata)
5656
if (copy_from_user(&hypercall, udata, sizeof(hypercall)))
5757
return -EFAULT;
5858

59+
xen_preemptible_hcall_begin();
5960
ret = privcmd_call(hypercall.op,
6061
hypercall.arg[0], hypercall.arg[1],
6162
hypercall.arg[2], hypercall.arg[3],
6263
hypercall.arg[4]);
64+
xen_preemptible_hcall_end();
6365

6466
return ret;
6567
}

drivers/xen/xen-scsiback.c

+6-8
Original file line numberDiff line numberDiff line change
@@ -709,12 +709,11 @@ static int prepare_pending_reqs(struct vscsibk_info *info,
709709
static int scsiback_do_cmd_fn(struct vscsibk_info *info)
710710
{
711711
struct vscsiif_back_ring *ring = &info->ring;
712-
struct vscsiif_request *ring_req;
712+
struct vscsiif_request ring_req;
713713
struct vscsibk_pend *pending_req;
714714
RING_IDX rc, rp;
715715
int err, more_to_do;
716716
uint32_t result;
717-
uint8_t act;
718717

719718
rc = ring->req_cons;
720719
rp = ring->sring->req_prod;
@@ -735,11 +734,10 @@ static int scsiback_do_cmd_fn(struct vscsibk_info *info)
735734
if (!pending_req)
736735
return 1;
737736

738-
ring_req = RING_GET_REQUEST(ring, rc);
737+
ring_req = *RING_GET_REQUEST(ring, rc);
739738
ring->req_cons = ++rc;
740739

741-
act = ring_req->act;
742-
err = prepare_pending_reqs(info, ring_req, pending_req);
740+
err = prepare_pending_reqs(info, &ring_req, pending_req);
743741
if (err) {
744742
switch (err) {
745743
case -ENODEV:
@@ -755,9 +753,9 @@ static int scsiback_do_cmd_fn(struct vscsibk_info *info)
755753
return 1;
756754
}
757755

758-
switch (act) {
756+
switch (ring_req.act) {
759757
case VSCSIIF_ACT_SCSI_CDB:
760-
if (scsiback_gnttab_data_map(ring_req, pending_req)) {
758+
if (scsiback_gnttab_data_map(&ring_req, pending_req)) {
761759
scsiback_fast_flush_area(pending_req);
762760
scsiback_do_resp_with_sense(NULL,
763761
DRIVER_ERROR << 24, 0, pending_req);
@@ -768,7 +766,7 @@ static int scsiback_do_cmd_fn(struct vscsibk_info *info)
768766
break;
769767
case VSCSIIF_ACT_SCSI_ABORT:
770768
scsiback_device_action(pending_req, TMR_ABORT_TASK,
771-
ring_req->ref_rqid);
769+
ring_req.ref_rqid);
772770
break;
773771
case VSCSIIF_ACT_SCSI_RESET:
774772
scsiback_device_action(pending_req, TMR_LUN_RESET, 0);

include/linux/hid-sensor-hub.h

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
* @units: Measurment unit for this attribute.
3434
* @unit_expo: Exponent used in the data.
3535
* @size: Size in bytes for data size.
36+
* @logical_minimum: Logical minimum value for this attribute.
37+
* @logical_maximum: Logical maximum value for this attribute.
3638
*/
3739
struct hid_sensor_hub_attribute_info {
3840
u32 usage_id;
@@ -146,6 +148,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
146148

147149
/**
148150
* sensor_hub_input_attr_get_raw_value() - Synchronous read request
151+
* @hsdev: Hub device instance.
149152
* @usage_id: Attribute usage id of parent physical device as per spec
150153
* @attr_usage_id: Attribute usage id as per spec
151154
* @report_id: Report id to look for
@@ -160,6 +163,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
160163
u32 attr_usage_id, u32 report_id);
161164
/**
162165
* sensor_hub_set_feature() - Feature set request
166+
* @hsdev: Hub device instance.
163167
* @report_id: Report id to look for
164168
* @field_index: Field index inside a report
165169
* @value: Value to set
@@ -172,6 +176,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
172176

173177
/**
174178
* sensor_hub_get_feature() - Feature get request
179+
* @hsdev: Hub device instance.
175180
* @report_id: Report id to look for
176181
* @field_index: Field index inside a report
177182
* @value: Place holder for return value

0 commit comments

Comments
 (0)