aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-01-21 10:36:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-01-21 10:36:55 -0500
commit4caca5f917ce991dc67fbb42fa82a1f044538e23 (patch)
tree29c9dadc3ab4aed954d8900f7171b44cd7a873bd
parentf8c7e6c2038a96f427911264a0c1448c9e3c2a9e (diff)
parent7692fd4d441afac728cb83fdd33349d5ba07406c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: Staging: hv: fix smp problems in the hyperv core code Staging: et131x: Fix 2.6.33rc1 regression in et131x Staging: asus_oled: fix oops in 2.6.32.2
-rw-r--r--drivers/staging/asus_oled/asus_oled.c12
-rw-r--r--drivers/staging/et131x/et1310_address_map.h18
-rw-r--r--drivers/staging/et131x/et1310_rx.c6
-rw-r--r--drivers/staging/hv/Hv.c50
-rw-r--r--drivers/staging/hv/Hv.h6
-rw-r--r--drivers/staging/hv/Vmbus.c12
6 files changed, 59 insertions, 45 deletions
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
index f4c26572c7df..43c57b7688ab 100644
--- a/drivers/staging/asus_oled/asus_oled.c
+++ b/drivers/staging/asus_oled/asus_oled.c
@@ -194,9 +194,11 @@ static ssize_t set_enabled(struct device *dev, struct device_attribute *attr,
194{ 194{
195 struct usb_interface *intf = to_usb_interface(dev); 195 struct usb_interface *intf = to_usb_interface(dev);
196 struct asus_oled_dev *odev = usb_get_intfdata(intf); 196 struct asus_oled_dev *odev = usb_get_intfdata(intf);
197 int temp = strict_strtoul(buf, 10, NULL); 197 unsigned long value;
198 if (strict_strtoul(buf, 10, &value))
199 return -EINVAL;
198 200
199 enable_oled(odev, temp); 201 enable_oled(odev, value);
200 202
201 return count; 203 return count;
202} 204}
@@ -207,10 +209,12 @@ static ssize_t class_set_enabled(struct device *device,
207{ 209{
208 struct asus_oled_dev *odev = 210 struct asus_oled_dev *odev =
209 (struct asus_oled_dev *) dev_get_drvdata(device); 211 (struct asus_oled_dev *) dev_get_drvdata(device);
212 unsigned long value;
210 213
211 int temp = strict_strtoul(buf, 10, NULL); 214 if (strict_strtoul(buf, 10, &value))
215 return -EINVAL;
212 216
213 enable_oled(odev, temp); 217 enable_oled(odev, value);
214 218
215 return count; 219 return count;
216} 220}
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index 6da843cc343c..e715e4dcb523 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -203,11 +203,14 @@ typedef struct _GLOBAL_t { /* Location: */
203 * 9-0: pr ndes 203 * 9-0: pr ndes
204 */ 204 */
205 205
206#define ET_DMA10_MASK 0x3FF /* 10 bit mask for DMA10W types */ 206#define ET_DMA12_MASK 0x0FFF /* 12 bit mask for DMA12W types */
207#define ET_DMA10_WRAP 0x400 207#define ET_DMA12_WRAP 0x1000
208#define ET_DMA4_MASK 0x00F /* 4 bit mask for DMA4W types */ 208#define ET_DMA10_MASK 0x03FF /* 10 bit mask for DMA10W types */
209#define ET_DMA4_WRAP 0x010 209#define ET_DMA10_WRAP 0x0400
210 210#define ET_DMA4_MASK 0x000F /* 4 bit mask for DMA4W types */
211#define ET_DMA4_WRAP 0x0010
212
213#define INDEX12(x) ((x) & ET_DMA12_MASK)
211#define INDEX10(x) ((x) & ET_DMA10_MASK) 214#define INDEX10(x) ((x) & ET_DMA10_MASK)
212#define INDEX4(x) ((x) & ET_DMA4_MASK) 215#define INDEX4(x) ((x) & ET_DMA4_MASK)
213 216
@@ -216,6 +219,11 @@ extern inline void add_10bit(u32 *v, int n)
216 *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP); 219 *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP);
217} 220}
218 221
222extern inline void add_12bit(u32 *v, int n)
223{
224 *v = INDEX12(*v + n) | (*v & ET_DMA12_WRAP);
225}
226
219/* 227/*
220 * 10bit DMA with wrap 228 * 10bit DMA with wrap
221 * txdma tx queue write address reg in txdma address map at 0x1010 229 * txdma tx queue write address reg in txdma address map at 0x1010
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 3ddc9b12b8db..81c1a7478ad6 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -831,10 +831,10 @@ PMP_RFD nic_rx_pkts(struct et131x_adapter *etdev)
831 831
832 /* Indicate that we have used this PSR entry. */ 832 /* Indicate that we have used this PSR entry. */
833 /* FIXME wrap 12 */ 833 /* FIXME wrap 12 */
834 rx_local->local_psr_full = (rx_local->local_psr_full + 1) & 0xFFF; 834 add_12bit(&rx_local->local_psr_full, 1);
835 if (rx_local->local_psr_full > rx_local->PsrNumEntries - 1) { 835 if ((rx_local->local_psr_full & 0xFFF) > rx_local->PsrNumEntries - 1) {
836 /* Clear psr full and toggle the wrap bit */ 836 /* Clear psr full and toggle the wrap bit */
837 rx_local->local_psr_full &= 0xFFF; 837 rx_local->local_psr_full &= ~0xFFF;
838 rx_local->local_psr_full ^= 0x1000; 838 rx_local->local_psr_full ^= 0x1000;
839 } 839 }
840 840
diff --git a/drivers/staging/hv/Hv.c b/drivers/staging/hv/Hv.c
index c5b6613f2f2f..c2809f2a2ce0 100644
--- a/drivers/staging/hv/Hv.c
+++ b/drivers/staging/hv/Hv.c
@@ -386,7 +386,7 @@ u16 HvSignalEvent(void)
386 * retrieve the initialized message and event pages. Otherwise, we create and 386 * retrieve the initialized message and event pages. Otherwise, we create and
387 * initialize the message and event pages. 387 * initialize the message and event pages.
388 */ 388 */
389int HvSynicInit(u32 irqVector) 389void HvSynicInit(void *irqarg)
390{ 390{
391 u64 version; 391 u64 version;
392 union hv_synic_simp simp; 392 union hv_synic_simp simp;
@@ -394,13 +394,14 @@ int HvSynicInit(u32 irqVector)
394 union hv_synic_sint sharedSint; 394 union hv_synic_sint sharedSint;
395 union hv_synic_scontrol sctrl; 395 union hv_synic_scontrol sctrl;
396 u64 guestID; 396 u64 guestID;
397 int ret = 0; 397 u32 irqVector = *((u32 *)(irqarg));
398 int cpu = smp_processor_id();
398 399
399 DPRINT_ENTER(VMBUS); 400 DPRINT_ENTER(VMBUS);
400 401
401 if (!gHvContext.HypercallPage) { 402 if (!gHvContext.HypercallPage) {
402 DPRINT_EXIT(VMBUS); 403 DPRINT_EXIT(VMBUS);
403 return ret; 404 return;
404 } 405 }
405 406
406 /* Check the version */ 407 /* Check the version */
@@ -425,27 +426,27 @@ int HvSynicInit(u32 irqVector)
425 */ 426 */
426 rdmsrl(HV_X64_MSR_GUEST_OS_ID, guestID); 427 rdmsrl(HV_X64_MSR_GUEST_OS_ID, guestID);
427 if (guestID == HV_LINUX_GUEST_ID) { 428 if (guestID == HV_LINUX_GUEST_ID) {
428 gHvContext.synICMessagePage[0] = 429 gHvContext.synICMessagePage[cpu] =
429 phys_to_virt(simp.BaseSimpGpa << PAGE_SHIFT); 430 phys_to_virt(simp.BaseSimpGpa << PAGE_SHIFT);
430 gHvContext.synICEventPage[0] = 431 gHvContext.synICEventPage[cpu] =
431 phys_to_virt(siefp.BaseSiefpGpa << PAGE_SHIFT); 432 phys_to_virt(siefp.BaseSiefpGpa << PAGE_SHIFT);
432 } else { 433 } else {
433 DPRINT_ERR(VMBUS, "unknown guest id!!"); 434 DPRINT_ERR(VMBUS, "unknown guest id!!");
434 goto Cleanup; 435 goto Cleanup;
435 } 436 }
436 DPRINT_DBG(VMBUS, "MAPPED: Simp: %p, Sifep: %p", 437 DPRINT_DBG(VMBUS, "MAPPED: Simp: %p, Sifep: %p",
437 gHvContext.synICMessagePage[0], 438 gHvContext.synICMessagePage[cpu],
438 gHvContext.synICEventPage[0]); 439 gHvContext.synICEventPage[cpu]);
439 } else { 440 } else {
440 gHvContext.synICMessagePage[0] = osd_PageAlloc(1); 441 gHvContext.synICMessagePage[cpu] = (void *)get_zeroed_page(GFP_ATOMIC);
441 if (gHvContext.synICMessagePage[0] == NULL) { 442 if (gHvContext.synICMessagePage[cpu] == NULL) {
442 DPRINT_ERR(VMBUS, 443 DPRINT_ERR(VMBUS,
443 "unable to allocate SYNIC message page!!"); 444 "unable to allocate SYNIC message page!!");
444 goto Cleanup; 445 goto Cleanup;
445 } 446 }
446 447
447 gHvContext.synICEventPage[0] = osd_PageAlloc(1); 448 gHvContext.synICEventPage[cpu] = (void *)get_zeroed_page(GFP_ATOMIC);
448 if (gHvContext.synICEventPage[0] == NULL) { 449 if (gHvContext.synICEventPage[cpu] == NULL) {
449 DPRINT_ERR(VMBUS, 450 DPRINT_ERR(VMBUS,
450 "unable to allocate SYNIC event page!!"); 451 "unable to allocate SYNIC event page!!");
451 goto Cleanup; 452 goto Cleanup;
@@ -454,7 +455,7 @@ int HvSynicInit(u32 irqVector)
454 /* Setup the Synic's message page */ 455 /* Setup the Synic's message page */
455 rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); 456 rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64);
456 simp.SimpEnabled = 1; 457 simp.SimpEnabled = 1;
457 simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[0]) 458 simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[cpu])
458 >> PAGE_SHIFT; 459 >> PAGE_SHIFT;
459 460
460 DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", 461 DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx",
@@ -465,7 +466,7 @@ int HvSynicInit(u32 irqVector)
465 /* Setup the Synic's event page */ 466 /* Setup the Synic's event page */
466 rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); 467 rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64);
467 siefp.SiefpEnabled = 1; 468 siefp.SiefpEnabled = 1;
468 siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[0]) 469 siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[cpu])
469 >> PAGE_SHIFT; 470 >> PAGE_SHIFT;
470 471
471 DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", 472 DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx",
@@ -501,32 +502,30 @@ int HvSynicInit(u32 irqVector)
501 502
502 DPRINT_EXIT(VMBUS); 503 DPRINT_EXIT(VMBUS);
503 504
504 return ret; 505 return;
505 506
506Cleanup: 507Cleanup:
507 ret = -1;
508
509 if (gHvContext.GuestId == HV_LINUX_GUEST_ID) { 508 if (gHvContext.GuestId == HV_LINUX_GUEST_ID) {
510 if (gHvContext.synICEventPage[0]) 509 if (gHvContext.synICEventPage[cpu])
511 osd_PageFree(gHvContext.synICEventPage[0], 1); 510 osd_PageFree(gHvContext.synICEventPage[cpu], 1);
512 511
513 if (gHvContext.synICMessagePage[0]) 512 if (gHvContext.synICMessagePage[cpu])
514 osd_PageFree(gHvContext.synICMessagePage[0], 1); 513 osd_PageFree(gHvContext.synICMessagePage[cpu], 1);
515 } 514 }
516 515
517 DPRINT_EXIT(VMBUS); 516 DPRINT_EXIT(VMBUS);
518 517 return;
519 return ret;
520} 518}
521 519
522/** 520/**
523 * HvSynicCleanup - Cleanup routine for HvSynicInit(). 521 * HvSynicCleanup - Cleanup routine for HvSynicInit().
524 */ 522 */
525void HvSynicCleanup(void) 523void HvSynicCleanup(void *arg)
526{ 524{
527 union hv_synic_sint sharedSint; 525 union hv_synic_sint sharedSint;
528 union hv_synic_simp simp; 526 union hv_synic_simp simp;
529 union hv_synic_siefp siefp; 527 union hv_synic_siefp siefp;
528 int cpu = smp_processor_id();
530 529
531 DPRINT_ENTER(VMBUS); 530 DPRINT_ENTER(VMBUS);
532 531
@@ -539,6 +538,7 @@ void HvSynicCleanup(void)
539 538
540 sharedSint.Masked = 1; 539 sharedSint.Masked = 1;
541 540
541 /* Need to correctly cleanup in the case of SMP!!! */
542 /* Disable the interrupt */ 542 /* Disable the interrupt */
543 wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); 543 wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64);
544 544
@@ -560,8 +560,8 @@ void HvSynicCleanup(void)
560 560
561 wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); 561 wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64);
562 562
563 osd_PageFree(gHvContext.synICMessagePage[0], 1); 563 osd_PageFree(gHvContext.synICMessagePage[cpu], 1);
564 osd_PageFree(gHvContext.synICEventPage[0], 1); 564 osd_PageFree(gHvContext.synICEventPage[cpu], 1);
565 } 565 }
566 566
567 DPRINT_EXIT(VMBUS); 567 DPRINT_EXIT(VMBUS);
diff --git a/drivers/staging/hv/Hv.h b/drivers/staging/hv/Hv.h
index 5379e4bfc56e..fce4b5cdac30 100644
--- a/drivers/staging/hv/Hv.h
+++ b/drivers/staging/hv/Hv.h
@@ -93,7 +93,7 @@ static const struct hv_guid VMBUS_SERVICE_ID = {
93 }, 93 },
94}; 94};
95 95
96#define MAX_NUM_CPUS 1 96#define MAX_NUM_CPUS 32
97 97
98 98
99struct hv_input_signal_event_buffer { 99struct hv_input_signal_event_buffer {
@@ -137,8 +137,8 @@ extern u16 HvPostMessage(union hv_connection_id connectionId,
137 137
138extern u16 HvSignalEvent(void); 138extern u16 HvSignalEvent(void);
139 139
140extern int HvSynicInit(u32 irqVector); 140extern void HvSynicInit(void *irqarg);
141 141
142extern void HvSynicCleanup(void); 142extern void HvSynicCleanup(void *arg);
143 143
144#endif /* __HV_H__ */ 144#endif /* __HV_H__ */
diff --git a/drivers/staging/hv/Vmbus.c b/drivers/staging/hv/Vmbus.c
index a4dd06f6d459..35a023e9f9d1 100644
--- a/drivers/staging/hv/Vmbus.c
+++ b/drivers/staging/hv/Vmbus.c
@@ -129,7 +129,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo)
129 129
130 /* strcpy(dev->name, "vmbus"); */ 130 /* strcpy(dev->name, "vmbus"); */
131 /* SynIC setup... */ 131 /* SynIC setup... */
132 ret = HvSynicInit(*irqvector); 132 on_each_cpu(HvSynicInit, (void *)irqvector, 1);
133 133
134 /* Connect to VMBus in the root partition */ 134 /* Connect to VMBus in the root partition */
135 ret = VmbusConnect(); 135 ret = VmbusConnect();
@@ -150,7 +150,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev)
150 DPRINT_ENTER(VMBUS); 150 DPRINT_ENTER(VMBUS);
151 VmbusChannelReleaseUnattachedChannels(); 151 VmbusChannelReleaseUnattachedChannels();
152 VmbusDisconnect(); 152 VmbusDisconnect();
153 HvSynicCleanup(); 153 on_each_cpu(HvSynicCleanup, NULL, 1);
154 DPRINT_EXIT(VMBUS); 154 DPRINT_EXIT(VMBUS);
155 155
156 return ret; 156 return ret;
@@ -173,7 +173,8 @@ static void VmbusOnCleanup(struct hv_driver *drv)
173 */ 173 */
174static void VmbusOnMsgDPC(struct hv_driver *drv) 174static void VmbusOnMsgDPC(struct hv_driver *drv)
175{ 175{
176 void *page_addr = gHvContext.synICMessagePage[0]; 176 int cpu = smp_processor_id();
177 void *page_addr = gHvContext.synICMessagePage[cpu];
177 struct hv_message *msg = (struct hv_message *)page_addr + 178 struct hv_message *msg = (struct hv_message *)page_addr +
178 VMBUS_MESSAGE_SINT; 179 VMBUS_MESSAGE_SINT;
179 struct hv_message *copied; 180 struct hv_message *copied;
@@ -230,11 +231,12 @@ static void VmbusOnEventDPC(struct hv_driver *drv)
230static int VmbusOnISR(struct hv_driver *drv) 231static int VmbusOnISR(struct hv_driver *drv)
231{ 232{
232 int ret = 0; 233 int ret = 0;
234 int cpu = smp_processor_id();
233 void *page_addr; 235 void *page_addr;
234 struct hv_message *msg; 236 struct hv_message *msg;
235 union hv_synic_event_flags *event; 237 union hv_synic_event_flags *event;
236 238
237 page_addr = gHvContext.synICMessagePage[0]; 239 page_addr = gHvContext.synICMessagePage[cpu];
238 msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; 240 msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT;
239 241
240 DPRINT_ENTER(VMBUS); 242 DPRINT_ENTER(VMBUS);
@@ -248,7 +250,7 @@ static int VmbusOnISR(struct hv_driver *drv)
248 } 250 }
249 251
250 /* TODO: Check if there are events to be process */ 252 /* TODO: Check if there are events to be process */
251 page_addr = gHvContext.synICEventPage[0]; 253 page_addr = gHvContext.synICEventPage[cpu];
252 event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; 254 event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT;
253 255
254 /* Since we are a child, we only need to check bit 0 */ 256 /* Since we are a child, we only need to check bit 0 */