Pull char/misc driver fixes Greg KH: "Here are some small char/misc driver fixes for 5.3-rc4. Two of these are for the habanalabs driver for issues found when running on a big-endian system (are they still alive?) The others are tiny fixes reported by people, and a MAINTAINERS update about the location of the fpga development tree. All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute MAINTAINERS: Move linux-fpga tree to new location nvmem: Use the same permissions for eeprom as for nvmem habanalabs: fix host memory polling in BE architecture habanalabs: fix F/W download in BE architecture
Unified · Split
| @@ -6344,7 +6344,7 @@ FPGA MANAGER FRAMEWORK · 6343 unmodified lines | |||
| 6344 | M: Moritz Fischer <mdf@kernel.org> | 6344 | M: Moritz Fischer <mdf@kernel.org> |
| 6345 | L: linux-fpga@vger.kernel.org | 6345 | L: linux-fpga@vger.kernel.org |
| 6346 | S: Maintained | 6346 | S: Maintained |
| 6347 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/atull/linux-fpga.git | 6347 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mdf/linux-fpga.git |
| 6348 | Q: http://patchwork.kernel.org/project/linux-fpga/list/ | 6348 | Q: http://patchwork.kernel.org/project/linux-fpga/list/ |
| 6349 | F: Documentation/fpga/ | 6349 | F: Documentation/fpga/ |
| 6350 | F: Documentation/driver-api/fpga/ | 6350 | F: Documentation/driver-api/fpga/ |
| @@ -544,6 +544,7 @@ int etm_perf_add_symlink_sink(struct coresight_device *csdev) · 543 unmodified lines | |||
| 544 | /* See function coresight_get_sink_by_id() to know where this is used */ | 544 | /* See function coresight_get_sink_by_id() to know where this is used */ |
| 545 | hash = hashlen_hash(hashlen_string(NULL, name)); | 545 | hash = hashlen_hash(hashlen_string(NULL, name)); |
| 546 | 546 | ||
| 547 | sysfs_attr_init(&ea->attr.attr); | ||
| 547 | ea->attr.attr.name = devm_kstrdup(dev, name, GFP_KERNEL); | 548 | ea->attr.attr.name = devm_kstrdup(dev, name, GFP_KERNEL); |
| 548 | if (!ea->attr.attr.name) | 549 | if (!ea->attr.attr.name) |
| 549 | return -ENOMEM; | 550 | return -ENOMEM; |
| @@ -683,7 +683,7 @@ int hl_cs_ioctl(struct hl_fpriv *hpriv, void *data) · 682 unmodified lines | |||
| 683 | 683 | ||
| 684 | rc = hl_poll_timeout_memory(hdev, | 684 | rc = hl_poll_timeout_memory(hdev, |
| 685 | &ctx->thread_ctx_switch_wait_token, tmp, (tmp == 1), | 685 | &ctx->thread_ctx_switch_wait_token, tmp, (tmp == 1), |
| 686 | 100, jiffies_to_usecs(hdev->timeout_jiffies)); | 686 | 100, jiffies_to_usecs(hdev->timeout_jiffies), false); |
| 687 | 687 | ||
| 688 | if (rc == -ETIMEDOUT) { | 688 | if (rc == -ETIMEDOUT) { |
| 689 | dev_err(hdev->dev, | 689 | dev_err(hdev->dev, |
| @@ -24,7 +24,7 @@ int hl_fw_push_fw_to_device(struct hl_device *hdev, const char *fw_name, · 23 unmodified lines | |||
| 24 | { | 24 | { |
| 25 | const struct firmware *fw; | 25 | const struct firmware *fw; |
| 26 | const u64 *fw_data; | 26 | const u64 *fw_data; |
| 27 | size_t fw_size, i; | 27 | size_t fw_size; |
| 28 | int rc; | 28 | int rc; |
| 29 | 29 | ||
| 30 | rc = request_firmware(&fw, fw_name, hdev->dev); | 30 | rc = request_firmware(&fw, fw_name, hdev->dev); |
| @@ -45,22 +45,7 @@ int hl_fw_push_fw_to_device(struct hl_device *hdev, const char *fw_name, · 14 unmodified lines | |||
| 45 | 45 | ||
| 46 | fw_data = (const u64 *) fw->data; | 46 | fw_data = (const u64 *) fw->data; |
| 47 | 47 | ||
| 48 | if ((fw->size % 8) != 0) | 48 | memcpy_toio(dst, fw_data, fw_size); |
| 49 | fw_size -= 8; | ||
| 50 | |||
| 51 | for (i = 0 ; i < fw_size ; i += 8, fw_data++, dst += 8) { | ||
| 52 | if (!(i & (0x80000 - 1))) { | ||
| 53 | dev_dbg(hdev->dev, | ||
| 54 | "copied so far %zu out of %zu for %s firmware", | ||
| 55 | i, fw_size, fw_name); | ||
| 56 | usleep_range(20, 100); | ||
| 57 | } | ||
| 58 | |||
| 59 | writeq(*fw_data, dst); | ||
| 60 | } | ||
| 61 | |||
| 62 | if ((fw->size % 8) != 0) | ||
| 63 | writel(*(const u32 *) fw_data, dst); | ||
| 64 | 49 | ||
| 65 | out: | 50 | out: |
| 66 | release_firmware(fw); | 51 | release_firmware(fw); |
| @@ -112,7 +97,8 @@ int hl_fw_send_cpu_message(struct hl_device *hdev, u32 hw_queue_id, u32 *msg, · 45 unmodified lines | |||
| 112 | } | 97 | } |
| 113 | 98 | ||
| 114 | rc = hl_poll_timeout_memory(hdev, &pkt->fence, tmp, | 99 | rc = hl_poll_timeout_memory(hdev, &pkt->fence, tmp, |
| 115 | (tmp == ARMCP_PACKET_FENCE_VAL), 1000, timeout); | 100 | (tmp == ARMCP_PACKET_FENCE_VAL), 1000, |
| 101 | timeout, true); | ||
| 116 | 102 | ||
| 117 | hl_hw_queue_inc_ci_kernel(hdev, hw_queue_id); | 103 | hl_hw_queue_inc_ci_kernel(hdev, hw_queue_id); |
| 118 | 104 | ||
| @@ -2864,7 +2864,8 @@ static int goya_send_job_on_qman0(struct hl_device *hdev, struct hl_cs_job *job) · 2863 unmodified lines | |||
| 2864 | } | 2864 | } |
| 2865 | 2865 | ||
| 2866 | rc = hl_poll_timeout_memory(hdev, fence_ptr, tmp, | 2866 | rc = hl_poll_timeout_memory(hdev, fence_ptr, tmp, |
| 2867 | (tmp == GOYA_QMAN0_FENCE_VAL), 1000, timeout); | 2867 | (tmp == GOYA_QMAN0_FENCE_VAL), 1000, |
| 2868 | timeout, true); | ||
| 2868 | 2869 | ||
| 2869 | hl_hw_queue_inc_ci_kernel(hdev, GOYA_QUEUE_ID_DMA_0); | 2870 | hl_hw_queue_inc_ci_kernel(hdev, GOYA_QUEUE_ID_DMA_0); |
| 2870 | 2871 | ||
| @@ -2945,7 +2946,7 @@ int goya_test_queue(struct hl_device *hdev, u32 hw_queue_id) · 74 unmodified lines | |||
| 2945 | } | 2946 | } |
| 2946 | 2947 | ||
| 2947 | rc = hl_poll_timeout_memory(hdev, fence_ptr, tmp, (tmp == fence_val), | 2948 | rc = hl_poll_timeout_memory(hdev, fence_ptr, tmp, (tmp == fence_val), |
| 2948 | 1000, GOYA_TEST_QUEUE_WAIT_USEC); | 2949 | 1000, GOYA_TEST_QUEUE_WAIT_USEC, true); |
| 2949 | 2950 | ||
| 2950 | hl_hw_queue_inc_ci_kernel(hdev, hw_queue_id); | 2951 | hl_hw_queue_inc_ci_kernel(hdev, hw_queue_id); |
| 2951 | 2952 | ||
| @@ -1062,9 +1062,17 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val); · 1061 unmodified lines | |||
| 1062 | /* | 1062 | /* |
| 1063 | * address in this macro points always to a memory location in the | 1063 | * address in this macro points always to a memory location in the |
| 1064 | * host's (server's) memory. That location is updated asynchronously | 1064 | * host's (server's) memory. That location is updated asynchronously |
| 1065 | * either by the direct access of the device or by another core | 1065 | * either by the direct access of the device or by another core. |
| 1066 | * | ||
| 1067 | * To work both in LE and BE architectures, we need to distinguish between the | ||
| 1068 | * two states (device or another core updates the memory location). Therefore, | ||
| 1069 | * if mem_written_by_device is true, the host memory being polled will be | ||
| 1070 | * updated directly by the device. If false, the host memory being polled will | ||
| 1071 | * be updated by host CPU. Required so host knows whether or not the memory | ||
| 1072 | * might need to be byte-swapped before returning value to caller. | ||
| 1066 | */ | 1073 | */ |
| 1067 | #define hl_poll_timeout_memory(hdev, addr, val, cond, sleep_us, timeout_us) \ | 1074 | #define hl_poll_timeout_memory(hdev, addr, val, cond, sleep_us, timeout_us, \ |
| 1075 | mem_written_by_device) \ | ||
| 1068 | ({ \ | 1076 | ({ \ |
| 1069 | ktime_t __timeout; \ | 1077 | ktime_t __timeout; \ |
| 1070 | /* timeout should be longer when working with simulator */ \ | 1078 | /* timeout should be longer when working with simulator */ \ |
| @@ -1077,10 +1085,14 @@ void hl_wreg(struct hl_device *hdev, u32 reg, u32 val); · 6 unmodified lines | |||
| 1077 | /* Verify we read updates done by other cores or by device */ \ | 1085 | /* Verify we read updates done by other cores or by device */ \ |
| 1078 | mb(); \ | 1086 | mb(); \ |
| 1079 | (val) = *((u32 *) (uintptr_t) (addr)); \ | 1087 | (val) = *((u32 *) (uintptr_t) (addr)); \ |
| 1088 | if (mem_written_by_device) \ | ||
| 1089 | (val) = le32_to_cpu(val); \ | ||
| 1080 | if (cond) \ | 1090 | if (cond) \ |
| 1081 | break; \ | 1091 | break; \ |
| 1082 | if (timeout_us && ktime_compare(ktime_get(), __timeout) > 0) { \ | 1092 | if (timeout_us && ktime_compare(ktime_get(), __timeout) > 0) { \ |
| 1083 | (val) = *((u32 *) (uintptr_t) (addr)); \ | 1093 | (val) = *((u32 *) (uintptr_t) (addr)); \ |
| 1094 | if (mem_written_by_device) \ | ||
| 1095 | (val) = le32_to_cpu(val); \ | ||
| 1084 | break; \ | 1096 | break; \ |
| 1085 | } \ | 1097 | } \ |
| 1086 | if (sleep_us) \ | 1098 | if (sleep_us) \ |
| @@ -224,10 +224,17 @@ int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem, · 223 unmodified lines | |||
| 224 | if (!config->base_dev) | 224 | if (!config->base_dev) |
| 225 | return -EINVAL; | 225 | return -EINVAL; |
| 226 | 226 | ||
| 227 | if (nvmem->read_only) | 227 | if (nvmem->read_only) { |
| 228 | nvmem->eeprom = bin_attr_ro_root_nvmem; | 228 | if (config->root_only) |
| 229 | else | 229 | nvmem->eeprom = bin_attr_ro_root_nvmem; |
| 230 | nvmem->eeprom = bin_attr_rw_root_nvmem; | 230 | else |
| 231 | nvmem->eeprom = bin_attr_ro_nvmem; | ||
| 232 | } else { | ||
| 233 | if (config->root_only) | ||
| 234 | nvmem->eeprom = bin_attr_rw_root_nvmem; | ||
| 235 | else | ||
| 236 | nvmem->eeprom = bin_attr_rw_nvmem; | ||
| 237 | } | ||
| 231 | nvmem->eeprom.attr.name = "eeprom"; | 238 | nvmem->eeprom.attr.name = "eeprom"; |
| 232 | nvmem->eeprom.size = nvmem->size; | 239 | nvmem->eeprom.size = nvmem->size; |
| 233 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 240 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |