diff options
| author | Arjan van de Ven <arjan@linux.intel.com> | 2008-10-17 12:20:26 -0400 |
|---|---|---|
| committer | Arjan van de Ven <arjan@linux.intel.com> | 2008-10-17 12:20:26 -0400 |
| commit | 651dab4264e4ba0e563f5ff56f748127246e9065 (patch) | |
| tree | 016630974bdcb00fe529b673f96d389e0fd6dc94 /drivers/misc | |
| parent | 40b8606253552109815786e5d4b0de98782d31f5 (diff) | |
| parent | 2e532d68a2b3e2aa6b19731501222069735c741c (diff) | |
Merge commit 'linus/master' into merge-linus
Conflicts:
arch/x86/kvm/i8254.c
Diffstat (limited to 'drivers/misc')
| -rw-r--r-- | drivers/misc/Kconfig | 3 | ||||
| -rw-r--r-- | drivers/misc/eeepc-laptop.c | 16 | ||||
| -rw-r--r-- | drivers/misc/hp-wmi.c | 2 | ||||
| -rw-r--r-- | drivers/misc/phantom.c | 6 | ||||
| -rw-r--r-- | drivers/misc/sgi-gru/gru.h | 4 | ||||
| -rw-r--r-- | drivers/misc/sgi-gru/gru_instructions.h | 10 | ||||
| -rw-r--r-- | drivers/misc/sgi-gru/grufault.c | 11 | ||||
| -rw-r--r-- | drivers/misc/sgi-gru/grufile.c | 11 | ||||
| -rw-r--r-- | drivers/misc/sgi-gru/gruhandles.h | 5 | ||||
| -rw-r--r-- | drivers/misc/sgi-gru/grukservices.c | 3 | ||||
| -rw-r--r-- | drivers/misc/sgi-gru/grumain.c | 29 |
11 files changed, 62 insertions, 38 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index a726f3b01a6b..efd3aa08b88b 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
| @@ -15,7 +15,7 @@ if MISC_DEVICES | |||
| 15 | 15 | ||
| 16 | config ATMEL_PWM | 16 | config ATMEL_PWM |
| 17 | tristate "Atmel AT32/AT91 PWM support" | 17 | tristate "Atmel AT32/AT91 PWM support" |
| 18 | depends on AVR32 || ARCH_AT91 | 18 | depends on AVR32 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91CAP9 |
| 19 | help | 19 | help |
| 20 | This option enables device driver support for the PWM channels | 20 | This option enables device driver support for the PWM channels |
| 21 | on certain Atmel prcoessors. Pulse Width Modulation is used for | 21 | on certain Atmel prcoessors. Pulse Width Modulation is used for |
| @@ -409,6 +409,7 @@ config EEEPC_LAPTOP | |||
| 409 | depends on BACKLIGHT_CLASS_DEVICE | 409 | depends on BACKLIGHT_CLASS_DEVICE |
| 410 | depends on HWMON | 410 | depends on HWMON |
| 411 | depends on EXPERIMENTAL | 411 | depends on EXPERIMENTAL |
| 412 | depends on RFKILL | ||
| 412 | ---help--- | 413 | ---help--- |
| 413 | This driver supports the Fn-Fx keys on Eee PC laptops. | 414 | This driver supports the Fn-Fx keys on Eee PC laptops. |
| 414 | It also adds the ability to switch camera/wlan on/off. | 415 | It also adds the ability to switch camera/wlan on/off. |
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c index facdb9893c84..1ee8501e90f1 100644 --- a/drivers/misc/eeepc-laptop.c +++ b/drivers/misc/eeepc-laptop.c | |||
| @@ -450,12 +450,14 @@ static int eeepc_get_fan_pwm(void) | |||
| 450 | int value = 0; | 450 | int value = 0; |
| 451 | 451 | ||
| 452 | read_acpi_int(NULL, EEEPC_EC_FAN_PWM, &value); | 452 | read_acpi_int(NULL, EEEPC_EC_FAN_PWM, &value); |
| 453 | value = value * 255 / 100; | ||
| 453 | return (value); | 454 | return (value); |
| 454 | } | 455 | } |
| 455 | 456 | ||
| 456 | static void eeepc_set_fan_pwm(int value) | 457 | static void eeepc_set_fan_pwm(int value) |
| 457 | { | 458 | { |
| 458 | value = SENSORS_LIMIT(value, 0, 100); | 459 | value = SENSORS_LIMIT(value, 0, 255); |
| 460 | value = value * 100 / 255; | ||
| 459 | ec_write(EEEPC_EC_SC02, value); | 461 | ec_write(EEEPC_EC_SC02, value); |
| 460 | } | 462 | } |
| 461 | 463 | ||
| @@ -520,15 +522,23 @@ static ssize_t show_sys_hwmon(int (*get)(void), char *buf) | |||
| 520 | static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0); | 522 | static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0); |
| 521 | 523 | ||
| 522 | EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL); | 524 | EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL); |
| 523 | EEEPC_CREATE_SENSOR_ATTR(fan1_pwm, S_IRUGO | S_IWUSR, | 525 | EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR, |
| 524 | eeepc_get_fan_pwm, eeepc_set_fan_pwm); | 526 | eeepc_get_fan_pwm, eeepc_set_fan_pwm); |
| 525 | EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, | 527 | EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, |
| 526 | eeepc_get_fan_ctrl, eeepc_set_fan_ctrl); | 528 | eeepc_get_fan_ctrl, eeepc_set_fan_ctrl); |
| 527 | 529 | ||
| 530 | static ssize_t | ||
| 531 | show_name(struct device *dev, struct device_attribute *attr, char *buf) | ||
| 532 | { | ||
| 533 | return sprintf(buf, "eeepc\n"); | ||
| 534 | } | ||
| 535 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); | ||
| 536 | |||
| 528 | static struct attribute *hwmon_attributes[] = { | 537 | static struct attribute *hwmon_attributes[] = { |
| 529 | &sensor_dev_attr_fan1_pwm.dev_attr.attr, | 538 | &sensor_dev_attr_pwm1.dev_attr.attr, |
| 530 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 539 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
| 531 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | 540 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, |
| 541 | &sensor_dev_attr_name.dev_attr.attr, | ||
| 532 | NULL | 542 | NULL |
| 533 | }; | 543 | }; |
| 534 | 544 | ||
diff --git a/drivers/misc/hp-wmi.c b/drivers/misc/hp-wmi.c index 6d407c2a4f91..5dabfb69ee53 100644 --- a/drivers/misc/hp-wmi.c +++ b/drivers/misc/hp-wmi.c | |||
| @@ -309,7 +309,7 @@ static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) | |||
| 309 | return -EINVAL; | 309 | return -EINVAL; |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | void hp_wmi_notify(u32 value, void *context) | 312 | static void hp_wmi_notify(u32 value, void *context) |
| 313 | { | 313 | { |
| 314 | struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; | 314 | struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 315 | static struct key_entry *key; | 315 | static struct key_entry *key; |
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c index daf585689ce3..abdebe347383 100644 --- a/drivers/misc/phantom.c +++ b/drivers/misc/phantom.c | |||
| @@ -399,9 +399,9 @@ static int __devinit phantom_probe(struct pci_dev *pdev, | |||
| 399 | goto err_irq; | 399 | goto err_irq; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | if (IS_ERR(device_create_drvdata(phantom_class, &pdev->dev, | 402 | if (IS_ERR(device_create(phantom_class, &pdev->dev, |
| 403 | MKDEV(phantom_major, minor), | 403 | MKDEV(phantom_major, minor), NULL, |
| 404 | NULL, "phantom%u", minor))) | 404 | "phantom%u", minor))) |
| 405 | dev_err(&pdev->dev, "can't create device\n"); | 405 | dev_err(&pdev->dev, "can't create device\n"); |
| 406 | 406 | ||
| 407 | pci_set_drvdata(pdev, pht); | 407 | pci_set_drvdata(pdev, pht); |
diff --git a/drivers/misc/sgi-gru/gru.h b/drivers/misc/sgi-gru/gru.h index 40df7cb3f0a5..f93f03a9e6e9 100644 --- a/drivers/misc/sgi-gru/gru.h +++ b/drivers/misc/sgi-gru/gru.h | |||
| @@ -30,9 +30,9 @@ | |||
| 30 | /* | 30 | /* |
| 31 | * Size used to map GRU GSeg | 31 | * Size used to map GRU GSeg |
| 32 | */ | 32 | */ |
| 33 | #if defined CONFIG_IA64 | 33 | #if defined(CONFIG_IA64) |
| 34 | #define GRU_GSEG_PAGESIZE (256 * 1024UL) | 34 | #define GRU_GSEG_PAGESIZE (256 * 1024UL) |
| 35 | #elif defined CONFIG_X86_64 | 35 | #elif defined(CONFIG_X86_64) |
| 36 | #define GRU_GSEG_PAGESIZE (256 * 1024UL) /* ZZZ 2MB ??? */ | 36 | #define GRU_GSEG_PAGESIZE (256 * 1024UL) /* ZZZ 2MB ??? */ |
| 37 | #else | 37 | #else |
| 38 | #error "Unsupported architecture" | 38 | #error "Unsupported architecture" |
diff --git a/drivers/misc/sgi-gru/gru_instructions.h b/drivers/misc/sgi-gru/gru_instructions.h index 0dc36225c7c6..48762e7b98be 100644 --- a/drivers/misc/sgi-gru/gru_instructions.h +++ b/drivers/misc/sgi-gru/gru_instructions.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | * Architecture dependent functions | 26 | * Architecture dependent functions |
| 27 | */ | 27 | */ |
| 28 | 28 | ||
| 29 | #if defined CONFIG_IA64 | 29 | #if defined(CONFIG_IA64) |
| 30 | #include <linux/compiler.h> | 30 | #include <linux/compiler.h> |
| 31 | #include <asm/intrinsics.h> | 31 | #include <asm/intrinsics.h> |
| 32 | #define __flush_cache(p) ia64_fc(p) | 32 | #define __flush_cache(p) ia64_fc(p) |
| @@ -36,7 +36,7 @@ | |||
| 36 | barrier(); \ | 36 | barrier(); \ |
| 37 | *((volatile int *)(p)) = v; /* force st.rel */ \ | 37 | *((volatile int *)(p)) = v; /* force st.rel */ \ |
| 38 | } while (0) | 38 | } while (0) |
| 39 | #elif defined CONFIG_X86_64 | 39 | #elif defined(CONFIG_X86_64) |
| 40 | #define __flush_cache(p) clflush(p) | 40 | #define __flush_cache(p) clflush(p) |
| 41 | #define gru_ordered_store_int(p,v) \ | 41 | #define gru_ordered_store_int(p,v) \ |
| 42 | do { \ | 42 | do { \ |
| @@ -299,6 +299,7 @@ static inline void gru_flush_cache(void *p) | |||
| 299 | static inline void gru_start_instruction(struct gru_instruction *ins, int op32) | 299 | static inline void gru_start_instruction(struct gru_instruction *ins, int op32) |
| 300 | { | 300 | { |
| 301 | gru_ordered_store_int(ins, op32); | 301 | gru_ordered_store_int(ins, op32); |
| 302 | gru_flush_cache(ins); | ||
| 302 | } | 303 | } |
| 303 | 304 | ||
| 304 | 305 | ||
| @@ -604,8 +605,9 @@ static inline int gru_get_cb_substatus(void *cb) | |||
| 604 | static inline int gru_check_status(void *cb) | 605 | static inline int gru_check_status(void *cb) |
| 605 | { | 606 | { |
| 606 | struct gru_control_block_status *cbs = (void *)cb; | 607 | struct gru_control_block_status *cbs = (void *)cb; |
| 607 | int ret = cbs->istatus; | 608 | int ret; |
| 608 | 609 | ||
| 610 | ret = cbs->istatus; | ||
| 609 | if (ret == CBS_CALL_OS) | 611 | if (ret == CBS_CALL_OS) |
| 610 | ret = gru_check_status_proc(cb); | 612 | ret = gru_check_status_proc(cb); |
| 611 | return ret; | 613 | return ret; |
| @@ -617,7 +619,7 @@ static inline int gru_check_status(void *cb) | |||
| 617 | static inline int gru_wait(void *cb) | 619 | static inline int gru_wait(void *cb) |
| 618 | { | 620 | { |
| 619 | struct gru_control_block_status *cbs = (void *)cb; | 621 | struct gru_control_block_status *cbs = (void *)cb; |
| 620 | int ret = cbs->istatus;; | 622 | int ret = cbs->istatus; |
| 621 | 623 | ||
| 622 | if (ret != CBS_IDLE) | 624 | if (ret != CBS_IDLE) |
| 623 | ret = gru_wait_proc(cb); | 625 | ret = gru_wait_proc(cb); |
diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c index 3d33015bbf31..8c389d606c30 100644 --- a/drivers/misc/sgi-gru/grufault.c +++ b/drivers/misc/sgi-gru/grufault.c | |||
| @@ -214,12 +214,14 @@ static int non_atomic_pte_lookup(struct vm_area_struct *vma, | |||
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | /* | 216 | /* |
| 217 | * | ||
| 218 | * atomic_pte_lookup | 217 | * atomic_pte_lookup |
| 219 | * | 218 | * |
| 220 | * Convert a user virtual address to a physical address | 219 | * Convert a user virtual address to a physical address |
| 221 | * Only supports Intel large pages (2MB only) on x86_64. | 220 | * Only supports Intel large pages (2MB only) on x86_64. |
| 222 | * ZZZ - hugepage support is incomplete | 221 | * ZZZ - hugepage support is incomplete |
| 222 | * | ||
| 223 | * NOTE: mmap_sem is already held on entry to this function. This | ||
| 224 | * guarantees existence of the page tables. | ||
| 223 | */ | 225 | */ |
| 224 | static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr, | 226 | static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr, |
| 225 | int write, unsigned long *paddr, int *pageshift) | 227 | int write, unsigned long *paddr, int *pageshift) |
| @@ -229,9 +231,6 @@ static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr, | |||
| 229 | pud_t *pudp; | 231 | pud_t *pudp; |
| 230 | pte_t pte; | 232 | pte_t pte; |
| 231 | 233 | ||
| 232 | WARN_ON(irqs_disabled()); /* ZZZ debug */ | ||
| 233 | |||
| 234 | local_irq_disable(); | ||
| 235 | pgdp = pgd_offset(vma->vm_mm, vaddr); | 234 | pgdp = pgd_offset(vma->vm_mm, vaddr); |
| 236 | if (unlikely(pgd_none(*pgdp))) | 235 | if (unlikely(pgd_none(*pgdp))) |
| 237 | goto err; | 236 | goto err; |
| @@ -250,8 +249,6 @@ static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr, | |||
| 250 | #endif | 249 | #endif |
| 251 | pte = *pte_offset_kernel(pmdp, vaddr); | 250 | pte = *pte_offset_kernel(pmdp, vaddr); |
| 252 | 251 | ||
| 253 | local_irq_enable(); | ||
| 254 | |||
| 255 | if (unlikely(!pte_present(pte) || | 252 | if (unlikely(!pte_present(pte) || |
| 256 | (write && (!pte_write(pte) || !pte_dirty(pte))))) | 253 | (write && (!pte_write(pte) || !pte_dirty(pte))))) |
| 257 | return 1; | 254 | return 1; |
| @@ -324,6 +321,7 @@ static int gru_try_dropin(struct gru_thread_state *gts, | |||
| 324 | * Atomic lookup is faster & usually works even if called in non-atomic | 321 | * Atomic lookup is faster & usually works even if called in non-atomic |
| 325 | * context. | 322 | * context. |
| 326 | */ | 323 | */ |
| 324 | rmb(); /* Must/check ms_range_active before loading PTEs */ | ||
| 327 | ret = atomic_pte_lookup(vma, vaddr, write, &paddr, &pageshift); | 325 | ret = atomic_pte_lookup(vma, vaddr, write, &paddr, &pageshift); |
| 328 | if (ret) { | 326 | if (ret) { |
| 329 | if (!cb) | 327 | if (!cb) |
| @@ -543,6 +541,7 @@ int gru_get_exception_detail(unsigned long arg) | |||
| 543 | ucbnum = get_cb_number((void *)excdet.cb); | 541 | ucbnum = get_cb_number((void *)excdet.cb); |
| 544 | cbrnum = thread_cbr_number(gts, ucbnum); | 542 | cbrnum = thread_cbr_number(gts, ucbnum); |
| 545 | cbe = get_cbe_by_index(gts->ts_gru, cbrnum); | 543 | cbe = get_cbe_by_index(gts->ts_gru, cbrnum); |
| 544 | prefetchw(cbe); /* Harmless on hardware, required for emulator */ | ||
| 546 | excdet.opc = cbe->opccpy; | 545 | excdet.opc = cbe->opccpy; |
| 547 | excdet.exopc = cbe->exopccpy; | 546 | excdet.exopc = cbe->exopccpy; |
| 548 | excdet.ecause = cbe->ecause; | 547 | excdet.ecause = cbe->ecause; |
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index 23c91f5f6b61..5c027b6b4e5a 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
| @@ -113,7 +113,7 @@ static int gru_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
| 113 | return -EPERM; | 113 | return -EPERM; |
| 114 | 114 | ||
| 115 | if (vma->vm_start & (GRU_GSEG_PAGESIZE - 1) || | 115 | if (vma->vm_start & (GRU_GSEG_PAGESIZE - 1) || |
| 116 | vma->vm_end & (GRU_GSEG_PAGESIZE - 1)) | 116 | vma->vm_end & (GRU_GSEG_PAGESIZE - 1)) |
| 117 | return -EINVAL; | 117 | return -EINVAL; |
| 118 | 118 | ||
| 119 | vma->vm_flags |= | 119 | vma->vm_flags |= |
| @@ -398,6 +398,12 @@ static int __init gru_init(void) | |||
| 398 | irq = get_base_irq(); | 398 | irq = get_base_irq(); |
| 399 | for (chip = 0; chip < GRU_CHIPLETS_PER_BLADE; chip++) { | 399 | for (chip = 0; chip < GRU_CHIPLETS_PER_BLADE; chip++) { |
| 400 | ret = request_irq(irq + chip, gru_intr, 0, id, NULL); | 400 | ret = request_irq(irq + chip, gru_intr, 0, id, NULL); |
| 401 | /* TODO: fix irq handling on x86. For now ignore failures because | ||
| 402 | * interrupts are not required & not yet fully supported */ | ||
| 403 | if (ret) { | ||
| 404 | printk("!!!WARNING: GRU ignoring request failure!!!\n"); | ||
| 405 | ret = 0; | ||
| 406 | } | ||
| 401 | if (ret) { | 407 | if (ret) { |
| 402 | printk(KERN_ERR "%s: request_irq failed\n", | 408 | printk(KERN_ERR "%s: request_irq failed\n", |
| 403 | GRU_DRIVER_ID_STR); | 409 | GRU_DRIVER_ID_STR); |
| @@ -445,6 +451,9 @@ static void __exit gru_exit(void) | |||
| 445 | int order = get_order(sizeof(struct gru_state) * | 451 | int order = get_order(sizeof(struct gru_state) * |
| 446 | GRU_CHIPLETS_PER_BLADE); | 452 | GRU_CHIPLETS_PER_BLADE); |
| 447 | 453 | ||
| 454 | if (!IS_UV()) | ||
| 455 | return; | ||
| 456 | |||
| 448 | for (i = 0; i < GRU_CHIPLETS_PER_BLADE; i++) | 457 | for (i = 0; i < GRU_CHIPLETS_PER_BLADE; i++) |
| 449 | free_irq(IRQ_GRU + i, NULL); | 458 | free_irq(IRQ_GRU + i, NULL); |
| 450 | 459 | ||
diff --git a/drivers/misc/sgi-gru/gruhandles.h b/drivers/misc/sgi-gru/gruhandles.h index d16031d62673..b63018d60fe1 100644 --- a/drivers/misc/sgi-gru/gruhandles.h +++ b/drivers/misc/sgi-gru/gruhandles.h | |||
| @@ -91,12 +91,7 @@ | |||
| 91 | #define GSEGPOFF(h) ((h) & (GRU_SIZE - 1)) | 91 | #define GSEGPOFF(h) ((h) & (GRU_SIZE - 1)) |
| 92 | 92 | ||
| 93 | /* Convert an arbitrary handle address to the beginning of the GRU segment */ | 93 | /* Convert an arbitrary handle address to the beginning of the GRU segment */ |
| 94 | #ifndef __PLUGIN__ | ||
| 95 | #define GRUBASE(h) ((void *)((unsigned long)(h) & ~(GRU_SIZE - 1))) | 94 | #define GRUBASE(h) ((void *)((unsigned long)(h) & ~(GRU_SIZE - 1))) |
| 96 | #else | ||
| 97 | extern void *gmu_grubase(void *h); | ||
| 98 | #define GRUBASE(h) gmu_grubase(h) | ||
| 99 | #endif | ||
| 100 | 95 | ||
| 101 | /* General addressing macros. */ | 96 | /* General addressing macros. */ |
| 102 | static inline void *get_gseg_base_address(void *base, int ctxnum) | 97 | static inline void *get_gseg_base_address(void *base, int ctxnum) |
diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c index dfd49af0fe18..880c55dfb662 100644 --- a/drivers/misc/sgi-gru/grukservices.c +++ b/drivers/misc/sgi-gru/grukservices.c | |||
| @@ -122,6 +122,7 @@ int gru_get_cb_exception_detail(void *cb, | |||
| 122 | struct gru_control_block_extended *cbe; | 122 | struct gru_control_block_extended *cbe; |
| 123 | 123 | ||
| 124 | cbe = get_cbe(GRUBASE(cb), get_cb_number(cb)); | 124 | cbe = get_cbe(GRUBASE(cb), get_cb_number(cb)); |
| 125 | prefetchw(cbe); /* Harmless on hardware, required for emulator */ | ||
| 125 | excdet->opc = cbe->opccpy; | 126 | excdet->opc = cbe->opccpy; |
| 126 | excdet->exopc = cbe->exopccpy; | 127 | excdet->exopc = cbe->exopccpy; |
| 127 | excdet->ecause = cbe->ecause; | 128 | excdet->ecause = cbe->ecause; |
| @@ -466,7 +467,7 @@ int gru_send_message_gpa(unsigned long mq, void *mesg, unsigned int bytes) | |||
| 466 | STAT(mesq_send); | 467 | STAT(mesq_send); |
| 467 | BUG_ON(bytes < sizeof(int) || bytes > 2 * GRU_CACHE_LINE_BYTES); | 468 | BUG_ON(bytes < sizeof(int) || bytes > 2 * GRU_CACHE_LINE_BYTES); |
| 468 | 469 | ||
| 469 | clines = (bytes + GRU_CACHE_LINE_BYTES - 1) / GRU_CACHE_LINE_BYTES; | 470 | clines = DIV_ROUND_UP(bytes, GRU_CACHE_LINE_BYTES); |
| 470 | if (gru_get_cpu_resources(bytes, &cb, &dsr)) | 471 | if (gru_get_cpu_resources(bytes, &cb, &dsr)) |
| 471 | return MQE_BUG_NO_RESOURCES; | 472 | return MQE_BUG_NO_RESOURCES; |
| 472 | memcpy(dsr, mesg, bytes); | 473 | memcpy(dsr, mesg, bytes); |
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c index 0eeb8dddd2f5..e11e1ac50900 100644 --- a/drivers/misc/sgi-gru/grumain.c +++ b/drivers/misc/sgi-gru/grumain.c | |||
| @@ -432,29 +432,35 @@ static inline long gru_copy_handle(void *d, void *s) | |||
| 432 | return GRU_HANDLE_BYTES; | 432 | return GRU_HANDLE_BYTES; |
| 433 | } | 433 | } |
| 434 | 434 | ||
| 435 | /* rewrite in assembly & use lots of prefetch */ | 435 | static void gru_prefetch_context(void *gseg, void *cb, void *cbe, unsigned long cbrmap, |
| 436 | static void gru_load_context_data(void *save, void *grubase, int ctxnum, | 436 | unsigned long length) |
| 437 | unsigned long cbrmap, unsigned long dsrmap) | ||
| 438 | { | 437 | { |
| 439 | void *gseg, *cb, *cbe; | ||
| 440 | unsigned long length; | ||
| 441 | int i, scr; | 438 | int i, scr; |
| 442 | 439 | ||
| 443 | gseg = grubase + ctxnum * GRU_GSEG_STRIDE; | ||
| 444 | length = hweight64(dsrmap) * GRU_DSR_AU_BYTES; | ||
| 445 | prefetch_data(gseg + GRU_DS_BASE, length / GRU_CACHE_LINE_BYTES, | 440 | prefetch_data(gseg + GRU_DS_BASE, length / GRU_CACHE_LINE_BYTES, |
| 446 | GRU_CACHE_LINE_BYTES); | 441 | GRU_CACHE_LINE_BYTES); |
| 447 | 442 | ||
| 448 | cb = gseg + GRU_CB_BASE; | ||
| 449 | cbe = grubase + GRU_CBE_BASE; | ||
| 450 | for_each_cbr_in_allocation_map(i, &cbrmap, scr) { | 443 | for_each_cbr_in_allocation_map(i, &cbrmap, scr) { |
| 451 | prefetch_data(cb, 1, GRU_CACHE_LINE_BYTES); | 444 | prefetch_data(cb, 1, GRU_CACHE_LINE_BYTES); |
| 452 | prefetch_data(cbe + i * GRU_HANDLE_STRIDE, 1, | 445 | prefetch_data(cbe + i * GRU_HANDLE_STRIDE, 1, |
| 453 | GRU_CACHE_LINE_BYTES); | 446 | GRU_CACHE_LINE_BYTES); |
| 454 | cb += GRU_HANDLE_STRIDE; | 447 | cb += GRU_HANDLE_STRIDE; |
| 455 | } | 448 | } |
| 449 | } | ||
| 450 | |||
| 451 | static void gru_load_context_data(void *save, void *grubase, int ctxnum, | ||
| 452 | unsigned long cbrmap, unsigned long dsrmap) | ||
| 453 | { | ||
| 454 | void *gseg, *cb, *cbe; | ||
| 455 | unsigned long length; | ||
| 456 | int i, scr; | ||
| 456 | 457 | ||
| 458 | gseg = grubase + ctxnum * GRU_GSEG_STRIDE; | ||
| 457 | cb = gseg + GRU_CB_BASE; | 459 | cb = gseg + GRU_CB_BASE; |
| 460 | cbe = grubase + GRU_CBE_BASE; | ||
| 461 | length = hweight64(dsrmap) * GRU_DSR_AU_BYTES; | ||
| 462 | gru_prefetch_context(gseg, cb, cbe, cbrmap, length); | ||
| 463 | |||
| 458 | for_each_cbr_in_allocation_map(i, &cbrmap, scr) { | 464 | for_each_cbr_in_allocation_map(i, &cbrmap, scr) { |
| 459 | save += gru_copy_handle(cb, save); | 465 | save += gru_copy_handle(cb, save); |
| 460 | save += gru_copy_handle(cbe + i * GRU_HANDLE_STRIDE, save); | 466 | save += gru_copy_handle(cbe + i * GRU_HANDLE_STRIDE, save); |
| @@ -472,15 +478,16 @@ static void gru_unload_context_data(void *save, void *grubase, int ctxnum, | |||
| 472 | int i, scr; | 478 | int i, scr; |
| 473 | 479 | ||
| 474 | gseg = grubase + ctxnum * GRU_GSEG_STRIDE; | 480 | gseg = grubase + ctxnum * GRU_GSEG_STRIDE; |
| 475 | |||
| 476 | cb = gseg + GRU_CB_BASE; | 481 | cb = gseg + GRU_CB_BASE; |
| 477 | cbe = grubase + GRU_CBE_BASE; | 482 | cbe = grubase + GRU_CBE_BASE; |
| 483 | length = hweight64(dsrmap) * GRU_DSR_AU_BYTES; | ||
| 484 | gru_prefetch_context(gseg, cb, cbe, cbrmap, length); | ||
| 485 | |||
| 478 | for_each_cbr_in_allocation_map(i, &cbrmap, scr) { | 486 | for_each_cbr_in_allocation_map(i, &cbrmap, scr) { |
| 479 | save += gru_copy_handle(save, cb); | 487 | save += gru_copy_handle(save, cb); |
| 480 | save += gru_copy_handle(save, cbe + i * GRU_HANDLE_STRIDE); | 488 | save += gru_copy_handle(save, cbe + i * GRU_HANDLE_STRIDE); |
| 481 | cb += GRU_HANDLE_STRIDE; | 489 | cb += GRU_HANDLE_STRIDE; |
| 482 | } | 490 | } |
| 483 | length = hweight64(dsrmap) * GRU_DSR_AU_BYTES; | ||
| 484 | memcpy(save, gseg + GRU_DS_BASE, length); | 491 | memcpy(save, gseg + GRU_DS_BASE, length); |
| 485 | } | 492 | } |
| 486 | 493 | ||
